Repository: julianshapiro/velocity Branch: master Commit: 767e35cac121 Files: 254 Total size: 1.7 MB Directory structure: gitextract_o9xnzj9n/ ├── .babelrc ├── .editorconfig ├── .github/ │ ├── ISSUE_TEMPLATE.md │ └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── V2_CHANGES.md ├── babel.config.js ├── bower.json ├── docs.ts ├── gsap/ │ ├── GreenSock Animation Platform (GSAP) Speed Test.html │ └── GreenSock Animation Platform (GSAP) Speed Test_files/ │ ├── CSSPlugin.js.download │ ├── CSSPlugin.min.js.download │ ├── Ease.js.download │ ├── TweenLite.min.js.download │ ├── anime.min.js.download │ ├── css │ ├── dojo.js.download │ ├── easeljs-0.4.2.min.js.download │ ├── easing.js.download │ ├── jquery-3.0.0.min.js.download │ ├── jquery.gsap.min.js.download │ ├── mootools-core-1.4.5-full-compat-yc.js.download │ ├── tweenjs-0.2.0.min.js.download │ ├── web-animations-basic.min.js.download │ └── zepto.min.js.download ├── legacy/ │ ├── README.md │ ├── blur.ts │ ├── borderColor.ts │ ├── clip.ts │ ├── normalisations.ts │ └── opacity.ts ├── package.json ├── rollup.config.js ├── src/ │ ├── Velocity/ │ │ ├── _all.ts │ │ ├── actions/ │ │ │ ├── _all.ts │ │ │ ├── actions.ts │ │ │ ├── finish.ts │ │ │ ├── index.ts │ │ │ ├── option.ts │ │ │ ├── pauseResume.ts │ │ │ ├── property.ts │ │ │ ├── reverse.ts │ │ │ ├── stop.ts │ │ │ ├── style.ts │ │ │ └── tween.ts │ │ ├── camelCase.ts │ │ ├── complete.ts │ │ ├── css/ │ │ │ ├── _all.ts │ │ │ ├── augmentDimension.ts │ │ │ ├── colors.ts │ │ │ ├── fixColors.ts │ │ │ ├── getPropertyValue.ts │ │ │ ├── index.ts │ │ │ ├── removeNestedCalc.ts │ │ │ └── setPropertyValue.ts │ │ ├── data.ts │ │ ├── defaults.ts │ │ ├── easing/ │ │ │ ├── _all.ts │ │ │ ├── back.ts │ │ │ ├── bezier.ts │ │ │ ├── bounce.ts │ │ │ ├── easings.ts │ │ │ ├── elastic.ts │ │ │ ├── index.ts │ │ │ ├── spring_rk4.ts │ │ │ ├── step.ts │ │ │ └── string.ts │ │ ├── index.ts │ │ ├── normalizations/ │ │ │ ├── _all.ts │ │ │ ├── dimensions.ts │ │ │ ├── display.ts │ │ │ ├── index.ts │ │ │ ├── normalizations.ts │ │ │ ├── normalizationsObject.ts │ │ │ ├── scroll.ts │ │ │ ├── style.ts │ │ │ ├── svg/ │ │ │ │ ├── _all.ts │ │ │ │ ├── attributes.ts │ │ │ │ ├── dimensions.ts │ │ │ │ └── index.ts │ │ │ └── tween.ts │ │ ├── options.ts │ │ ├── patch.ts │ │ ├── queue.ts │ │ ├── sequences.ts │ │ ├── sequencesObject.ts │ │ ├── state.ts │ │ ├── tick.ts │ │ └── tweens.ts │ ├── constants.ts │ ├── fakeClass.js │ ├── fakeClass.ts │ ├── tsconfig.json │ ├── types.ts │ ├── utility.ts │ ├── velocity.ts │ └── velocityFn.ts ├── src-ui/ │ ├── attention_seekers/ │ │ ├── _all.ts │ │ ├── bounce.ts │ │ ├── flash.ts │ │ ├── headShake.ts │ │ ├── jello.ts │ │ ├── pulse.ts │ │ ├── rubberBand.ts │ │ ├── shake.ts │ │ ├── swing.ts │ │ ├── tada.ts │ │ └── wobble.ts │ ├── bouncing_entrances/ │ │ ├── _all.ts │ │ ├── bounceIn.ts │ │ ├── bounceInDown.ts │ │ ├── bounceInLeft.ts │ │ ├── bounceInRight.ts │ │ └── bounceInUp.ts │ ├── bouncing_exits/ │ │ ├── _all.ts │ │ ├── bounceOut.ts │ │ ├── bounceOutDown.ts │ │ ├── bounceOutLeft.ts │ │ ├── bounceOutRight.ts │ │ └── bounceOutUp.ts │ ├── fading_entrances/ │ │ ├── _all.ts │ │ ├── fadeIn.ts │ │ ├── fadeInDown.ts │ │ ├── fadeInDownBig.ts │ │ ├── fadeInLeft.ts │ │ ├── fadeInLeftBig.ts │ │ ├── fadeInRight.ts │ │ ├── fadeInRightBig.ts │ │ ├── fadeInUp.ts │ │ └── fadeInUpBig.ts │ ├── fading_exits/ │ │ ├── _all.ts │ │ ├── fadeOut.ts │ │ ├── fadeOutDown.ts │ │ ├── fadeOutDownBig.ts │ │ ├── fadeOutLeft.ts │ │ ├── fadeOutLeftBig.ts │ │ ├── fadeOutRight.ts │ │ ├── fadeOutRightBig.ts │ │ ├── fadeOutUp.ts │ │ └── fadeOutUpBig.ts │ ├── flippers/ │ │ ├── _all.ts │ │ ├── flip.ts │ │ ├── flipInX.ts │ │ ├── flipInY.ts │ │ ├── flipOutX.ts │ │ └── flipOutY.ts │ ├── lightspeed/ │ │ ├── _all.ts │ │ ├── lightSpeedIn.ts │ │ └── lightSpeedOut.ts │ ├── rotating_entrances/ │ │ ├── _all.ts │ │ ├── rotateIn.ts │ │ ├── rotateInDownLeft.ts │ │ ├── rotateInDownRight.ts │ │ ├── rotateInUpLeft.ts │ │ └── rotateInUpRight.ts │ ├── rotating_exits/ │ │ ├── _all.ts │ │ ├── rotateOut.ts │ │ ├── rotateOutDownLeft.ts │ │ ├── rotateOutDownRight.ts │ │ ├── rotateOutUpLeft.ts │ │ └── rotateOutUpRight.ts │ ├── sliding_entrances/ │ │ ├── _all.ts │ │ ├── slideInDown.ts │ │ ├── slideInLeft.ts │ │ ├── slideInRight.ts │ │ └── slideInUp.ts │ ├── sliding_exits/ │ │ ├── _all.ts │ │ ├── slideOutDown.ts │ │ ├── slideOutLeft.ts │ │ ├── slideOutRight.ts │ │ └── slideOutUp.ts │ ├── specials/ │ │ ├── _all.ts │ │ ├── hinge.ts │ │ ├── jackInTheBox.ts │ │ ├── rollIn.ts │ │ └── rollOut.ts │ ├── tsconfig.json │ ├── velocity.ui.ts │ ├── zooming_entrances/ │ │ ├── _all.ts │ │ ├── zoomIn.ts │ │ ├── zoomInDown.ts │ │ ├── zoomInLeft.ts │ │ ├── zoomInRight.ts │ │ └── zoomInUp.ts │ └── zooming_exits/ │ ├── _all.ts │ ├── zoomOut.ts │ ├── zoomOutDown.ts │ ├── zoomOutLeft.ts │ ├── zoomOutRight.ts │ └── zoomOutUp.ts ├── test/ │ ├── index.html │ ├── qunit-2.5.0.css │ ├── qunit-2.5.0.js │ ├── qunit-assert-close.js │ ├── src/ │ │ ├── 1_Core/ │ │ │ ├── Arguments.ts │ │ │ ├── End Value Caching.ts │ │ │ ├── End Value Setting.ts │ │ │ ├── Start Value Calculation.ts │ │ │ ├── Unit Calculation.ts │ │ │ └── _module.ts │ │ ├── 2_Option/ │ │ │ ├── Option Begin.ts │ │ │ ├── Option Complete.ts │ │ │ ├── Option Delay.ts │ │ │ ├── Option Duration.ts │ │ │ ├── Option Easing.ts │ │ │ ├── Option Fps Limit.ts │ │ │ ├── Option Loop.ts │ │ │ ├── Option Progress.ts │ │ │ ├── Option Queue.ts │ │ │ ├── Option Repeat.ts │ │ │ ├── Option Speed.ts │ │ │ ├── Option Sync.ts │ │ │ └── _module.ts │ │ ├── 3_Command/ │ │ │ ├── Command Finish.ts │ │ │ ├── Command Pause + Resume.ts │ │ │ ├── Command Reverse.ts │ │ │ ├── Command Scroll.ts │ │ │ ├── Command Stop.ts │ │ │ ├── Command Tween.ts │ │ │ └── _module.ts │ │ ├── 4_Feature/ │ │ │ ├── Feature Classname.ts │ │ │ ├── Feature Colors.ts │ │ │ ├── Feature Forcefeeding.ts │ │ │ ├── Feature Promises.ts │ │ │ ├── Feature Sequences.ts │ │ │ ├── Feature Value Functions.ts │ │ │ └── _module.ts │ │ ├── 5_UIPack/ │ │ │ ├── Packaged Effect slideUp+Down.ts │ │ │ ├── UI Pack Call Options.ts │ │ │ ├── UI Pack Callbacks.ts │ │ │ ├── UI Pack In+Out.ts │ │ │ ├── UI Pack RegisterEffect.ts │ │ │ ├── UI Pack RunSequence.ts │ │ │ └── _module.ts │ │ ├── 6_Properties/ │ │ │ ├── Normalization property value reordering.ts │ │ │ ├── Property Display.ts │ │ │ ├── Property Visibility.ts │ │ │ └── _module.ts │ │ ├── test.ts │ │ ├── tsconfig.json │ │ └── utilities.ts │ └── test.js ├── tsconfig.json ├── tslint.json ├── velocity.d.ts ├── velocity.es5.js ├── velocity.js ├── velocity.ui.js └── version.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .babelrc ================================================ { "presets": [ ["env", { "modules": false }] ], "plugins": ["external-helpers"] } ================================================ FILE: .editorconfig ================================================ # .editorconfig root = true [*] indent_style = tab indent_size = 4 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false ================================================ FILE: .github/ISSUE_TEMPLATE.md ================================================ #### Your system information * VelocityJS version: * Browser: * Operating System: #### Checklist * Is this an issue with *code*?: [Yes/No] * Is this an issue with *documentation*?: [Yes/No] * Have you reproduced this in other browsers?: [Yes/No] * Have you checked for updates?: [Yes/No] * Have you checked for similar open issues?: [Yes/No] > Please remember that this is an issue tracker, support requests should be posted on StackOverflow - see CONTRIBUTING.md #### Please describe your issue in as much detail as possible: Describe what you _expected_ should happen and what _did_ happen. #### Steps for reproducing this issue (code): 1. 2. 3. #### JSFiddle example showing issue in action (code): > Go to https://jsfiddle.net/Rycochet/mqv9L27u/ - click the "Fork" button at the top, create the example and copy the new URL back here. ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ #### Checklist * Have you linked to relevant open issues?: [Yes/No] * I agree for this to be covered by the Velocity [license](https://github.com/julianshapiro/velocity/blob/master/LICENSE.md)?: [Yes/No] #### Please describe this Pull Request in as much detail as possible: Describe what the _old behaviour_ was, and what the _new behaviour_ is. #### People who contributed to this change: ================================================ FILE: .gitignore ================================================ /node_modules /.vscode ================================================ FILE: CHANGELOG.md ================================================ ### Changelog All notable changes to this project will be documented in this file. Dates are displayed in UTC. Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### [v2.0.5](https://github.com/julianshapiro/velocity/compare/v2.0.3...v2.0.5) > 10 June 2018 - Grab Promise in a try/catch [`#875`](https://github.com/julianshapiro/velocity/issues/875) - Get default duration if none set in arguments [`#874`](https://github.com/julianshapiro/velocity/issues/874) - Caching is disabled for scrollTop/Left so don't loop [`#866`](https://github.com/julianshapiro/velocity/issues/866) - Expose Velocity().promise for use in Promise.all() etc [`#868`](https://github.com/julianshapiro/velocity/issues/868) - Consistent getPropertyValue for width / height [`#860`](https://github.com/julianshapiro/velocity/issues/860) [`#861`](https://github.com/julianshapiro/velocity/issues/861) - Lock down some publicly accessible structures [`acb2bd5`](https://github.com/julianshapiro/velocity/commit/acb2bd548d9b51cbc3cec2649a2720fee3cac4f3) - Add Stagger and Drag options back - available for all animations [`6b961de`](https://github.com/julianshapiro/velocity/commit/6b961de4c80f723b6ef9ced13d93e06d9d426736) - Ensure default delay, fix "pattern" error, create callback for options to use [`2bdd7c1`](https://github.com/julianshapiro/velocity/commit/2bdd7c1994b3e23bd314495722ae37356ac088e2) #### [v2.0.3](https://github.com/julianshapiro/velocity/compare/v2.0.2...v2.0.3) > 27 May 2018 - Refactor as ES6 to build on RollupJS [`#873`](https://github.com/julianshapiro/velocity/pull/873) - Polyfill for Object.assign [`#855`](https://github.com/julianshapiro/velocity/issues/855) - Fix package-lock.json [`9092f18`](https://github.com/julianshapiro/velocity/commit/9092f1870569fc58d7c6b087dc22c23dfa5098a0) - Version 2.0.3 [`a263bb8`](https://github.com/julianshapiro/velocity/commit/a263bb8489930f58aa0bf79b3a8193e9a566d857) - Update CDN links in readme [`c17a6a3`](https://github.com/julianshapiro/velocity/commit/c17a6a341cfaee405515bdedd5993853de2bca51) #### [v2.0.2](https://github.com/julianshapiro/velocity/compare/v2.0.1...v2.0.2) > 4 March 2018 - The correct name for the requireJS package is "velocity-animate" [`#768`](https://github.com/julianshapiro/velocity/issues/768) - Fixes and updates in preparation for new sequence code [`#849`](https://github.com/julianshapiro/velocity/issues/849) [`#845`](https://github.com/julianshapiro/velocity/issues/845) [`#839`](https://github.com/julianshapiro/velocity/issues/839) - Make note of load order and extending other libraries [`#828`](https://github.com/julianshapiro/velocity/issues/828) - Shortcut for Object.create(null), Fix unit adding for some css styles and move into normalization code. [`794d15c`](https://github.com/julianshapiro/velocity/commit/794d15c977c4d8c253ae7a8a4905670d66ca63ec) - Version 2.0.2-beta [`30ee65e`](https://github.com/julianshapiro/velocity/commit/30ee65ec047b440842ba0e6ae75dd48223547007) - Highlighted the documentation for V2 [`007e977`](https://github.com/julianshapiro/velocity/commit/007e977cb1fc3025f42c16f9cf05de19b9da294d) #### [v2.0.1](https://github.com/julianshapiro/velocity/compare/v2.0.0...v2.0.1) > 11 February 2018 - Version 2.0.1 [`24bf716`](https://github.com/julianshapiro/velocity/commit/24bf716fd10ef322e284d505a186f7b4f097a932) - Optimise "reverse" command, make use of built-in reverse flag [`4d39bfa`](https://github.com/julianshapiro/velocity/commit/4d39bfae9ed5c03ee8b7c06ea75275b506ff99cd) - Update package dependencies [`58f640c`](https://github.com/julianshapiro/velocity/commit/58f640c4ab8297b2c536132ee32dd2dad5b2beb3) ### [v2.0.0](https://github.com/julianshapiro/velocity/compare/v1.5.1...v2.0.0) > 1 February 2018 - Add a legacy readme, make sure we're using the latest Typescript, make sure npm's package-lock.json is included [`5182912`](https://github.com/julianshapiro/velocity/commit/5182912d93efb3b8a8b13019549d8d04546982f0) - Comment updates and and changes doc [`e26106a`](https://github.com/julianshapiro/velocity/commit/e26106ad6aedb0224fb322ccc6735710eef4f4fb) - While documenting realised that the timeStart argument to a progress callback is now too different, and that the activeCall argument was not listed in the typedef file. [`69c7e44`](https://github.com/julianshapiro/velocity/commit/69c7e44808fa8413cbf711caa83b808af47c56cb) #### [v1.5.1](https://github.com/julianshapiro/velocity/compare/v1.5.0...v1.5.1) > 6 January 2018 - Fix crash on queue stop [`#830`](https://github.com/julianshapiro/velocity/pull/830) - Update jsDelivr links [`#799`](https://github.com/julianshapiro/velocity/pull/799) - Add "window" to access to the 'navigator' property [`#803`](https://github.com/julianshapiro/velocity/pull/803) - Correct the initialization of the variable "firstTick" in the tick handler [`#827`](https://github.com/julianshapiro/velocity/pull/827) - Add support for global fps limiting [`#818`](https://github.com/julianshapiro/velocity/pull/818) - Release 1.5.1 [`6dd28a2`](https://github.com/julianshapiro/velocity/commit/6dd28a2a6b7ec87257bb8e5b54a3355bd766e027) - Update tick.ts [`ed4634b`](https://github.com/julianshapiro/velocity/commit/ed4634b9241d3d76b8472af964992b5d9e4e9a15) - Update tick.ts [`ff6a8c5`](https://github.com/julianshapiro/velocity/commit/ff6a8c522e3cdc70cb7049d2c41a80dcffb1b08b) #### [v1.5.0](https://github.com/julianshapiro/velocity/compare/v1.4.3...v1.5.0) > 18 March 2017 - Fix 2 issues breaking IE8 compatibility [`#764`](https://github.com/julianshapiro/velocity/pull/764) - Prevent console.log error in IE9 or less [`#756`](https://github.com/julianshapiro/velocity/pull/756) - IE9 sometimes checks again window which can have length 0 [`#757`](https://github.com/julianshapiro/velocity/pull/757) - Fix performance.now() polyfill [`#763`](https://github.com/julianshapiro/velocity/pull/763) - Code cleanup, add [].includes() shim, fix JSHint warnings [`4184d8e`](https://github.com/julianshapiro/velocity/commit/4184d8e757038bdc0f1e7449c847728ddbe7674b) - Release 1.5.0 [`9f4aacd`](https://github.com/julianshapiro/velocity/commit/9f4aacdacd9eff5a4abbd5154b8d367dcda2f047) - Update CDN links [`c8eb3e6`](https://github.com/julianshapiro/velocity/commit/c8eb3e6cd60f93fe251b33f5e6cd657d5973a490) #### [v1.4.3](https://github.com/julianshapiro/velocity/compare/v1.4.2...v1.4.3) > 16 February 2017 - Typo cloned->clone, Fixes #749 [`#749`](https://github.com/julianshapiro/velocity/issues/749) - Release 1.4.3 [`8c3d003`](https://github.com/julianshapiro/velocity/commit/8c3d003e0e893597c7f91528ad2cff732f249c57) - Allow auto-parameters to support negative numbers (literally just missing a "-" in the RegExp) [`465e84c`](https://github.com/julianshapiro/velocity/commit/465e84c99cc0ab262b57ec0e491190213ba184e0) #### [v1.4.2](https://github.com/julianshapiro/velocity/compare/v1.4.1...v1.4.2) > 30 January 2017 - Fix IE8 lacking hasOwnProperty on window.performance. Fixes #738 [`#739`](https://github.com/julianshapiro/velocity/pull/739) - IE8 can't [].slice.call(NodeList) etc, Fixes #742 [`#742`](https://github.com/julianshapiro/velocity/issues/742) - Release 1.4.2 [`d2cdefd`](https://github.com/julianshapiro/velocity/commit/d2cdefd8c2f7763f45e027910eed14bb091add78) #### [v1.4.1](https://github.com/julianshapiro/velocity/compare/v1.4.0...v1.4.1) > 17 December 2016 - Allow .isWrappped() to handle nodeLists and more wrapped types. FORM has a length and is not wrapped, so disallow Nodes [`#723`](https://github.com/julianshapiro/velocity/issues/723) - Share remaining duration between all remaining parts of an effect, allow 0 duration. [`#726`](https://github.com/julianshapiro/velocity/issues/726) - Fix for "0" in an auto-parameter value [`0ee450d`](https://github.com/julianshapiro/velocity/commit/0ee450df15b8b3c248f3911733e6b40a55357c1a) - Release v1.4.1 [`e745208`](https://github.com/julianshapiro/velocity/commit/e745208c390a4a2d444b9441ced8115698a704bd) - Make version numbers link to changelog [`4b6beab`](https://github.com/julianshapiro/velocity/commit/4b6beabf20ff463de8934b7956d238ab16ff754d) #### [v1.4.0](https://github.com/julianshapiro/velocity/compare/v1.3.2...v1.4.0) > 4 December 2016 - Update version numbers in README [`#731`](https://github.com/julianshapiro/velocity/pull/731) - Pause and Resume commands implemented and tested. [`#718`](https://github.com/julianshapiro/velocity/pull/718) - Select correct ticker function during initialization [`#725`](https://github.com/julianshapiro/velocity/pull/725) - Add pause/resume, disable global test as it breaks other tests. Cleanup test code slightly. [`#718`](https://github.com/julianshapiro/velocity/issues/718) - Auto parameters now accept unit changes and any colour names. [`d81e17a`](https://github.com/julianshapiro/velocity/commit/d81e17a63c6c83b72409f437eb1de29fc379a2d1) - Update README.md [`170c4f5`](https://github.com/julianshapiro/velocity/commit/170c4f5a70961bee175a2eafd32174a069a4ff8b) - v1.4.0 - CDN links TODO when updated [`139de8b`](https://github.com/julianshapiro/velocity/commit/139de8b51e7a94cf69a1005354476a61112bd832) #### [v1.3.2](https://github.com/julianshapiro/velocity/compare/v1.3.1...v1.3.2) > 21 November 2016 - Fixed incorrect usage of nodeType [`#720`](https://github.com/julianshapiro/velocity/pull/720) - lost `var` definition [`#713`](https://github.com/julianshapiro/velocity/pull/713) - Use window.document [`#710`](https://github.com/julianshapiro/velocity/pull/710) - Fix typo [`#712`](https://github.com/julianshapiro/velocity/pull/712) - Add editorconfig. See #706 for more. [`#707`](https://github.com/julianshapiro/velocity/pull/707) - Improving Readme, fix #704 [`#705`](https://github.com/julianshapiro/velocity/pull/705) - Allow Velocity(document.querySelector("div"), ...) and similar calls (not specific checking for jQuery / Zepto wrapped) [`#714`](https://github.com/julianshapiro/velocity/issues/714) - Add Auto-parameterised start and end values #697 [`#677`](https://github.com/julianshapiro/velocity/issues/677) [`#459`](https://github.com/julianshapiro/velocity/issues/459) [`#562`](https://github.com/julianshapiro/velocity/issues/562) [`#388`](https://github.com/julianshapiro/velocity/issues/388) [`#263`](https://github.com/julianshapiro/velocity/issues/263) - Allow a value function to return a forcefeeding array. [`#639`](https://github.com/julianshapiro/velocity/issues/639) - Ensure being and complete are called correctly for slide/fade effects [`#460`](https://github.com/julianshapiro/velocity/issues/460) - Don't split out *-color properties when the start and end are functions [`#660`](https://github.com/julianshapiro/velocity/issues/660) - Add inner / outer + Width / Height to get and set - handles box-sizing correctly [`#485`](https://github.com/julianshapiro/velocity/issues/485) - Whitelist "loop" for RegisterEffect [`#654`](https://github.com/julianshapiro/velocity/issues/654) [`#655`](https://github.com/julianshapiro/velocity/issues/655) - Release v1.3.2 [`fbb5540`](https://github.com/julianshapiro/velocity/commit/fbb554026a8ad2c1069a8de55f13c4930b02ecdd) - Fixes after #720 - more bad code that didn't work, plus optimisations and minification [`b0c6c3c`](https://github.com/julianshapiro/velocity/commit/b0c6c3c05063c4501818897b71f1c1a7737d5fb4) - Update CONTRIBUTING.md [`f22ec01`](https://github.com/julianshapiro/velocity/commit/f22ec01bc11e114daab7d314af2fc7478794c379) #### [v1.3.1](https://github.com/julianshapiro/velocity/compare/v1.3.0...v1.3.1) > 21 September 2016 - Add hasOwnProperty() checks for badly extended Object prototype [`#541`](https://github.com/julianshapiro/velocity/issues/541) - Update README.md [`631232f`](https://github.com/julianshapiro/velocity/commit/631232f892591d0e11a7130058505561d886bd84) - Release v1.3.1 [`e4bc3f1`](https://github.com/julianshapiro/velocity/commit/e4bc3f1010ce78482f85288e66080a4f8e968476) - Somehow missed updating the version numbers [`9731478`](https://github.com/julianshapiro/velocity/commit/9731478e101db5d6ac8b74910b993176dfaff7ce) #### [v1.3.0](https://github.com/julianshapiro/velocity/compare/v1.2.3...v1.3.0) > 13 August 2016 - Fix durations set to 0 being ignored with Velocity UI [`#483`](https://github.com/julianshapiro/velocity/pull/483) - Fix animateParentHeight height calc when border-box [`#504`](https://github.com/julianshapiro/velocity/pull/504) - Update README.md [`#615`](https://github.com/julianshapiro/velocity/pull/615) - Fix severe hangs in tick() when overflowing 10,000 call compaction limit [`#523`](https://github.com/julianshapiro/velocity/pull/523) - forgot to bump actual version to 1.2.3 [`#600`](https://github.com/julianshapiro/velocity/pull/600) - Remove jQuery dependency from package.json and bower.json [`#618`](https://github.com/julianshapiro/velocity/pull/618) - Cleanup cache properly [`#646`](https://github.com/julianshapiro/velocity/pull/646) - Correctly handle "html style" property names [`#666`](https://github.com/julianshapiro/velocity/pull/666) - Fix to Issue #675 [`#676`](https://github.com/julianshapiro/velocity/pull/676) - Potential fix for: Uncaught TypeError: Cannot read property 'tweensCo… [`#690`](https://github.com/julianshapiro/velocity/pull/690) - Code cleanup (formatting and semi-colon use) [`efe5795`](https://github.com/julianshapiro/velocity/commit/efe57951d9a6d20d32358a02c52027b55f3dacbb) - Add Gruntfile, strict mode, fixes for jshint - shouldn't break anything, but test properly [`c3b9f01`](https://github.com/julianshapiro/velocity/commit/c3b9f017b30e1979f7a4892c52625034b3f36f41) - Allow infinite loop on counterclockwise rotateZ and any 360 degree loop [`64c8f1e`](https://github.com/julianshapiro/velocity/commit/64c8f1e1fa69df2275650dbb89934574e9f1be60) #### [v1.2.3](https://github.com/julianshapiro/velocity/compare/v1.2.2...v1.2.3) > 26 September 2015 - Fix BrowserStack link. [`#472`](https://github.com/julianshapiro/velocity/pull/472) - "finishAll" functionality [`d9cd60b`](https://github.com/julianshapiro/velocity/commit/d9cd60bc0c026adff6303869934bb58fc832e82f) - Merging/building finishAll & versions bump [`f28c610`](https://github.com/julianshapiro/velocity/commit/f28c610da721048abee0be4f88a5d32d71ae8ea4) - Update README.md [`2a952e2`](https://github.com/julianshapiro/velocity/commit/2a952e2201f0373147780e50ae446bc42ea541c5) #### [v1.2.2](https://github.com/julianshapiro/velocity/compare/v1.2.1...v1.2.2) > 17 February 2015 - UI Pack Fixes [`#413`](https://github.com/julianshapiro/velocity/issues/413) [`#421`](https://github.com/julianshapiro/velocity/issues/421) [`#435`](https://github.com/julianshapiro/velocity/issues/435) [`#415`](https://github.com/julianshapiro/velocity/issues/415) [`#407`](https://github.com/julianshapiro/velocity/issues/407) - 5.0.3: Fix for e/p/o shorthands [`#410`](https://github.com/julianshapiro/velocity/issues/410) - publishing velocity tests [`cc07cbd`](https://github.com/julianshapiro/velocity/commit/cc07cbdd05ef6bf2b8c91b5a9c093a391e8d0ef8) - Update README.md [`69e5793`](https://github.com/julianshapiro/velocity/commit/69e579357ebdad864790e89ba0ee5af87b70be99) - Update README.md [`0b701fe`](https://github.com/julianshapiro/velocity/commit/0b701fe0b218b787b7e677b4aa790c015f572eac) #### [v1.2.1](https://github.com/julianshapiro/velocity/compare/v1.2.0...v1.2.1) > 5 January 2015 - 5.0.2: Fix for E/P/O shorthands. [`2fd2efb`](https://github.com/julianshapiro/velocity/commit/2fd2efb5de95570d9d5797b2d21f8c5e026e1af6) - Update README.md [`c412909`](https://github.com/julianshapiro/velocity/commit/c412909952428758e820b985495b4220fda65129) - Update README.md [`cda7496`](https://github.com/julianshapiro/velocity/commit/cda7496818c793cbfc15797d7dee333323f6ef8f) #### [v1.2.0](https://github.com/julianshapiro/velocity/compare/v1.1.0...v1.2.0) > 5 January 2015 - Allow any version of jquery, don't need to specify github repo [`#338`](https://github.com/julianshapiro/velocity/pull/338) - 1.2.0 [`#293`](https://github.com/julianshapiro/velocity/issues/293) [`#368`](https://github.com/julianshapiro/velocity/issues/368) [`#396`](https://github.com/julianshapiro/velocity/issues/396) [`#343`](https://github.com/julianshapiro/velocity/issues/343) [`#321`](https://github.com/julianshapiro/velocity/issues/321) [`#352`](https://github.com/julianshapiro/velocity/issues/352) [`#317`](https://github.com/julianshapiro/velocity/issues/317) [`#324`](https://github.com/julianshapiro/velocity/issues/324) [`#371`](https://github.com/julianshapiro/velocity/issues/371) - Update README.md [`79821c8`](https://github.com/julianshapiro/velocity/commit/79821c8ac8a34daddaa65bdf9c482348d39ef892) - Update README.md [`279b340`](https://github.com/julianshapiro/velocity/commit/279b340f3536b8ae46431ed21848887d8f42f4c5) - Update README.md [`e8f1121`](https://github.com/julianshapiro/velocity/commit/e8f11212af378ecd2351abbc3087d6f72cd210ee) #### [v1.1.0](https://github.com/julianshapiro/velocity/compare/v1.0.0...v1.1.0) > 18 September 2014 - 5.0.0 [`#288`](https://github.com/julianshapiro/velocity/issues/288) - 1.1.0 [`#292`](https://github.com/julianshapiro/velocity/issues/292) [`#285`](https://github.com/julianshapiro/velocity/issues/285) [`#275`](https://github.com/julianshapiro/velocity/issues/275) [`#299`](https://github.com/julianshapiro/velocity/issues/299) - 5.0.0 [`#248`](https://github.com/julianshapiro/velocity/issues/248) [`#296`](https://github.com/julianshapiro/velocity/issues/296) - Update README.md [`42af632`](https://github.com/julianshapiro/velocity/commit/42af632533d7e416f10301d6a599e3872b18e221) - Update bower.json [`e917431`](https://github.com/julianshapiro/velocity/commit/e917431f20f96977f9c1b95488e7e90388e7d659) - Update package.json [`e2f1075`](https://github.com/julianshapiro/velocity/commit/e2f1075b9df469873ba9ca2d00134eddd376fa84) ### [v1.0.0](https://github.com/julianshapiro/velocity/compare/v0.11.9...v1.0.0) > 28 August 2014 - 4.1.4 [`#272`](https://github.com/julianshapiro/velocity/issues/272) - display: flex prefixing [`#273`](https://github.com/julianshapiro/velocity/issues/273) - Callbacks receive arrays. [`#270`](https://github.com/julianshapiro/velocity/issues/270) - Update README.md [`04c68ca`](https://github.com/julianshapiro/velocity/commit/04c68cab3a58eda15b2804ed63c935a8f29db493) - Update README.md [`a12f5a4`](https://github.com/julianshapiro/velocity/commit/a12f5a4f48a6c86d3479978d8aeb442b53f21675) - Update README.md [`5db45e6`](https://github.com/julianshapiro/velocity/commit/5db45e6c5d340b5d68c614ba9a26fe115d6cf6e0) #### [v0.11.9](https://github.com/julianshapiro/velocity/compare/v0.11.8...v0.11.9) > 24 August 2014 - 0.11.9 [`#260`](https://github.com/julianshapiro/velocity/issues/260) [`#265`](https://github.com/julianshapiro/velocity/issues/265) [`#262`](https://github.com/julianshapiro/velocity/issues/262) - Add examples for requirejs/r.js projects. [`49f0ae9`](https://github.com/julianshapiro/velocity/commit/49f0ae9a92f8b5e1ab485ca541df431fb6f59228) - Fix AMD support. Tested with both builds, optimised and unoptimised. [`3295176`](https://github.com/julianshapiro/velocity/commit/3295176e15c0a19924c8f5d292a2d6c0e7abc289) - Update README.md [`e7f4004`](https://github.com/julianshapiro/velocity/commit/e7f400467af9ce9deb60d63426769c5315e4fb85) #### [v0.11.8](https://github.com/julianshapiro/velocity/compare/v0.11.7...v0.11.8) > 23 August 2014 - 0.11.8 [`#257`](https://github.com/julianshapiro/velocity/issues/257) [`#260`](https://github.com/julianshapiro/velocity/issues/260) [`#184`](https://github.com/julianshapiro/velocity/issues/184) [`#262`](https://github.com/julianshapiro/velocity/issues/262) - Update README.md [`94885bd`](https://github.com/julianshapiro/velocity/commit/94885bdfb6403f38047e9bfcf432f0efbd9d176e) - Update README.md [`d9b6aa5`](https://github.com/julianshapiro/velocity/commit/d9b6aa5cd0f2f994d4a161a1aec55df39447c921) - Update README.md [`b8a19b2`](https://github.com/julianshapiro/velocity/commit/b8a19b23d390ef60a9c33bdb3d839db5644cbbb7) #### [v0.11.7](https://github.com/julianshapiro/velocity/compare/v0.11.6...v0.11.7) > 20 August 2014 - jQuery-free public beta [`a50ef4b`](https://github.com/julianshapiro/velocity/commit/a50ef4b1af6fb6138478854a1064ff5daf4bcc85) - Create .gitignore [`31d3f26`](https://github.com/julianshapiro/velocity/commit/31d3f26bb7565be6d57f733c96b4c631a749bc07) - Update README.md [`8ed430e`](https://github.com/julianshapiro/velocity/commit/8ed430e906239ed412f242f94e98cb0607c27cfc) #### [v0.11.6](https://github.com/julianshapiro/velocity/compare/v0.11.5...v0.11.6) > 18 August 2014 - Utility function w/ sequences fix [`#247`](https://github.com/julianshapiro/velocity/issues/247) [`#249`](https://github.com/julianshapiro/velocity/issues/249) [`#208`](https://github.com/julianshapiro/velocity/issues/208) - Update README.md [`3a8e7a4`](https://github.com/julianshapiro/velocity/commit/3a8e7a4cbedc1e4763a4f1d8f749a793e116c40a) - Update README.md [`052c0fe`](https://github.com/julianshapiro/velocity/commit/052c0fec21c7b8d458365f723fce3799e80d5d10) - Update README.md [`b2f77c1`](https://github.com/julianshapiro/velocity/commit/b2f77c1c07c2ae5a08a3b6b7fc2216f0dbc28982) #### [v0.11.5](https://github.com/julianshapiro/velocity/compare/v0.11.2...v0.11.5) > 15 August 2014 - Update README.md [`#243`](https://github.com/julianshapiro/velocity/pull/243) - Prevent transform auto-removal [`#224`](https://github.com/julianshapiro/velocity/issues/224) - Bug fixes [`#232`](https://github.com/julianshapiro/velocity/issues/232) [`#238`](https://github.com/julianshapiro/velocity/issues/238) [`#239`](https://github.com/julianshapiro/velocity/issues/239) [`#237`](https://github.com/julianshapiro/velocity/issues/237) [`#246`](https://github.com/julianshapiro/velocity/issues/246) - Update README.md [`cb9745b`](https://github.com/julianshapiro/velocity/commit/cb9745b4c6cbfda50e68317674c1d0075daf2923) - Update README.md [`03109eb`](https://github.com/julianshapiro/velocity/commit/03109eb67066ea2d7a2af643f791ccaafced8c7d) - Update README.md [`31c42b7`](https://github.com/julianshapiro/velocity/commit/31c42b71637775908de65cdb401def98a5524251) #### [v0.11.2](https://github.com/julianshapiro/velocity/compare/v0.11.1...v0.11.2) > 12 August 2014 - Update CONTRIBUTING.md [`257b81f`](https://github.com/julianshapiro/velocity/commit/257b81f7cedccf28f02e05b15992195ef17e73dc) - Update CONTRIBUTING.md [`d5af523`](https://github.com/julianshapiro/velocity/commit/d5af5234682a0c2cb1d9d04901a0c1a8d6e2830c) - Update README.md [`eb4c350`](https://github.com/julianshapiro/velocity/commit/eb4c3509a5d12d6cbf7d9ef86dc5e3d79d339a0a) #### [v0.11.1](https://github.com/julianshapiro/velocity/compare/v0.11.0...v0.11.1) > 11 August 2014 - 0.11.1: Big Performance Boost [`#178`](https://github.com/julianshapiro/velocity/issues/178) [`#223`](https://github.com/julianshapiro/velocity/issues/223) - Update README.md [`edf8c5c`](https://github.com/julianshapiro/velocity/commit/edf8c5cdadd5185f75a213cb53957584665936eb) - Update README.md [`6d875c1`](https://github.com/julianshapiro/velocity/commit/6d875c13d48144f1821fb20e98fa7d87ca70dfec) - Update README.md [`f483765`](https://github.com/julianshapiro/velocity/commit/f48376517f604599cec076ca974122b189aa582a) #### [v0.11.0](https://github.com/julianshapiro/velocity/compare/v0.10.1...v0.11.0) > 10 August 2014 - 0.11.0 [`#229`](https://github.com/julianshapiro/velocity/issues/229) - Future shim support [`8959193`](https://github.com/julianshapiro/velocity/commit/89591937d611901309c5835159be336e0123efee) - Update README.md [`1d1ec13`](https://github.com/julianshapiro/velocity/commit/1d1ec13585d46cb9a6303e257d1024acf3526a43) - Module loader clarification [`f926248`](https://github.com/julianshapiro/velocity/commit/f92624866f7726a5fc03379026e7f14b856b80a1) #### [v0.10.1](https://github.com/julianshapiro/velocity/compare/v0.10.0...v0.10.1) > 4 August 2014 - 0.10.1 [`#215`](https://github.com/julianshapiro/velocity/issues/215) - Update README.md [`ce76483`](https://github.com/julianshapiro/velocity/commit/ce76483e9b7bf4568124e0e99316f63dc028fcb0) - Update README.md [`9f2fe91`](https://github.com/julianshapiro/velocity/commit/9f2fe91d1382169d283c5d23bc8a939b49f4c78a) #### [v0.10.0](https://github.com/julianshapiro/velocity/compare/v0.9.0...v0.10.0) > 30 July 2014 - Infinite looping [`#175`](https://github.com/julianshapiro/velocity/issues/175) [`#207`](https://github.com/julianshapiro/velocity/issues/207) - Update README.md [`f9be38d`](https://github.com/julianshapiro/velocity/commit/f9be38d8bd03fa1a1e62cbde1fa760a8b7686b41) - Update README.md [`22a014f`](https://github.com/julianshapiro/velocity/commit/22a014f0e84e59afc52309b2c8ca148300158269) - Update README.md [`eb48d87`](https://github.com/julianshapiro/velocity/commit/eb48d87640b5a8fc422603050b807bc71e8b2ac3) #### [v0.9.0](https://github.com/julianshapiro/velocity/compare/v0.8.0...v0.9.0) > 23 July 2014 - Upgrades [`#194`](https://github.com/julianshapiro/velocity/issues/194) [`#179`](https://github.com/julianshapiro/velocity/issues/179) [`#183`](https://github.com/julianshapiro/velocity/issues/183) [`#196`](https://github.com/julianshapiro/velocity/issues/196) [`#199`](https://github.com/julianshapiro/velocity/issues/199) [`#201`](https://github.com/julianshapiro/velocity/issues/201) [`#181`](https://github.com/julianshapiro/velocity/issues/181) [`#202`](https://github.com/julianshapiro/velocity/issues/202) - Version Update [`69e3758`](https://github.com/julianshapiro/velocity/commit/69e375896ec50ef315af5c7e9bf2252fbeacba23) - Update CONTRIBUTING.md [`36e9d55`](https://github.com/julianshapiro/velocity/commit/36e9d55d37200b7b70745aa2970cfacf0ee49537) - Update README.md [`6f403e1`](https://github.com/julianshapiro/velocity/commit/6f403e1c3b7ea7be4b3badd79976376615b35269) #### [v0.8.0](https://github.com/julianshapiro/velocity/compare/v0.7.0...v0.8.0) > 16 July 2014 - 0.8.0 [`#181`](https://github.com/julianshapiro/velocity/issues/181) [`#182`](https://github.com/julianshapiro/velocity/issues/182) [`#177`](https://github.com/julianshapiro/velocity/issues/177) [`#176`](https://github.com/julianshapiro/velocity/issues/176) [`#159`](https://github.com/julianshapiro/velocity/issues/159) - Update README.md [`467e1f3`](https://github.com/julianshapiro/velocity/commit/467e1f31d7d8da814214eaadbf78ba43adcfbce9) - Update README.md [`7bbd156`](https://github.com/julianshapiro/velocity/commit/7bbd1567a9792272bf929b3343589d383ff39c40) - Update README.md [`ca4097c`](https://github.com/julianshapiro/velocity/commit/ca4097c2dd2c5bbb6e69803767f81e14cfc4f76d) #### [v0.7.0](https://github.com/julianshapiro/velocity/compare/v0.6.0...v0.7.0) > 13 July 2014 - :animating and transform value removal [`#172`](https://github.com/julianshapiro/velocity/issues/172) [`#155`](https://github.com/julianshapiro/velocity/issues/155) - Ability to transition inline elements [`#173`](https://github.com/julianshapiro/velocity/issues/173) - Update README.md [`e88a4eb`](https://github.com/julianshapiro/velocity/commit/e88a4ebf8c007521aa789c5f32516e9ceedc5cd8) - Update README.md [`0e8e7b0`](https://github.com/julianshapiro/velocity/commit/0e8e7b0ea422c2f5a147e6cfc787122ffd732819) - Update README.md [`178de4c`](https://github.com/julianshapiro/velocity/commit/178de4c8234914765c927e95343c2c572ca129f7) #### [v0.6.0](https://github.com/julianshapiro/velocity/compare/v0.5.3...v0.6.0) > 11 July 2014 - Visibility Toggling [`#9`](https://github.com/julianshapiro/velocity/issues/9) [`#164`](https://github.com/julianshapiro/velocity/issues/164) [`#163`](https://github.com/julianshapiro/velocity/issues/163) [`#162`](https://github.com/julianshapiro/velocity/issues/162) - Include minified files. [`#166`](https://github.com/julianshapiro/velocity/issues/166) - Include minified UI Pack in repo [`e172be3`](https://github.com/julianshapiro/velocity/commit/e172be326f4817cbef095fd97502eba88bb97efe) - Update README.md [`edb0023`](https://github.com/julianshapiro/velocity/commit/edb0023dc729c3edd46a93bef493698c97839727) #### [v0.5.3](https://github.com/julianshapiro/velocity/compare/v0.5.2...v0.5.3) > 10 July 2014 - display:none w/ height & width [`#121`](https://github.com/julianshapiro/velocity/issues/121) - Update README.md [`600b13f`](https://github.com/julianshapiro/velocity/commit/600b13f03863351490679e7ccf26c93f95116161) - Update README.md [`90354a0`](https://github.com/julianshapiro/velocity/commit/90354a09a897e0c707faa614cd50022d44d97bce) #### [v0.5.2](https://github.com/julianshapiro/velocity/compare/v0.5.1...v0.5.2) > 10 July 2014 - Revert "Default display toggling" [`160e12d`](https://github.com/julianshapiro/velocity/commit/160e12de08132dba4cd91613ef7e380d5def1004) - Display toggling fix [`ed5a9c3`](https://github.com/julianshapiro/velocity/commit/ed5a9c3ec9fa8eaecd18a6c34f18db232db11c27) - Update README.md [`745d80e`](https://github.com/julianshapiro/velocity/commit/745d80ea7c7b30ce27338c2b326da0c18c5d35ba) #### [v0.5.1](https://github.com/julianshapiro/velocity/compare/v0.5.0...v0.5.1) > 10 July 2014 - Default display toggling [`#146`](https://github.com/julianshapiro/velocity/issues/146) [`#157`](https://github.com/julianshapiro/velocity/issues/157) - animateParentHeight Fix [`53f2d03`](https://github.com/julianshapiro/velocity/commit/53f2d03ed2e02032ab58156251eab572321d4a73) - Update README.md [`946ed3f`](https://github.com/julianshapiro/velocity/commit/946ed3fe7610b4d9e3d62bd19e3116c1d61d0da3) - Update README.md [`8c8b913`](https://github.com/julianshapiro/velocity/commit/8c8b913cb0144a21d3f78e2a9d3bd9e1cc8d15a9) #### [v0.5.0](https://github.com/julianshapiro/velocity/compare/v0.4.1...v0.5.0) > 8 July 2014 - Promises Support [`#153`](https://github.com/julianshapiro/velocity/issues/153) [`#110`](https://github.com/julianshapiro/velocity/issues/110) [`#143`](https://github.com/julianshapiro/velocity/issues/143) [`#95`](https://github.com/julianshapiro/velocity/issues/95) [`#156`](https://github.com/julianshapiro/velocity/issues/156) - Promises Support [`8933ab4`](https://github.com/julianshapiro/velocity/commit/8933ab40e7536d5b46b9faa786b4b77ee631e84a) - JSON version updates [`3e1ec95`](https://github.com/julianshapiro/velocity/commit/3e1ec955349d2da172f6d1a772dc9834b64671f4) - Version update [`92cc9d7`](https://github.com/julianshapiro/velocity/commit/92cc9d7c499186fbc446e6a5b8cc9f25c8ad97dd) #### [v0.4.1](https://github.com/julianshapiro/velocity/compare/v0.4.0...v0.4.1) > 3 July 2014 - Custom Effects + Improvements [`#132`](https://github.com/julianshapiro/velocity/issues/132) [`#129`](https://github.com/julianshapiro/velocity/issues/129) [`#94`](https://github.com/julianshapiro/velocity/issues/94) [`#136`](https://github.com/julianshapiro/velocity/issues/136) - Implemented Promises support [`6334862`](https://github.com/julianshapiro/velocity/commit/6334862af6c75cf5ea3e9337ac3f372cbfe92895) - Changed rejecting on stop with resolving [`66f521c`](https://github.com/julianshapiro/velocity/commit/66f521ca75c00d2426171c0e5a86c3c8ef462324) - Update README.md [`893cd9d`](https://github.com/julianshapiro/velocity/commit/893cd9d17c87df43b2aae695f57097471f615ebe) #### [v0.4.0](https://github.com/julianshapiro/velocity/compare/v0.3.0...v0.4.0) > 1 July 2014 - 3D SVG Support [`#137`](https://github.com/julianshapiro/velocity/issues/137) [`#134`](https://github.com/julianshapiro/velocity/issues/134) [`#139`](https://github.com/julianshapiro/velocity/issues/139) - fix #134 unhandled console.log in IE [`#134`](https://github.com/julianshapiro/velocity/issues/134) - Comment Modifications [`#133`](https://github.com/julianshapiro/velocity/issues/133) - Update README.md [`4e89b84`](https://github.com/julianshapiro/velocity/commit/4e89b84029f566c13f128f6dc29702e3eec345f1) - Update CONTRIBUTING.md [`4df3e0a`](https://github.com/julianshapiro/velocity/commit/4df3e0a7e4c22764ea74c9212b056e64a4c06286) - Update CONTRIBUTING.md [`28d29f2`](https://github.com/julianshapiro/velocity/commit/28d29f282a08039c963629b0c8e74d5c829de3c0) #### [v0.3.0](https://github.com/julianshapiro/velocity/compare/v0.2.1...v0.3.0) > 28 June 2014 - SVG Animation Support [`#74`](https://github.com/julianshapiro/velocity/issues/74) - Update README.md [`637bf59`](https://github.com/julianshapiro/velocity/commit/637bf59397e7d2c931c27ce0b46bffe070ec9286) - Update README.md [`56cce96`](https://github.com/julianshapiro/velocity/commit/56cce966622fb1aafaa5c417491602fadf2843f2) - Update README.md [`b70ac06`](https://github.com/julianshapiro/velocity/commit/b70ac064522746ed0b1f7a783f234b71ddcd4201) #### [v0.2.1](https://github.com/julianshapiro/velocity/compare/v0.2.0...v0.2.1) > 20 June 2014 - Prevent errors in older jQuery versions. [`#118`](https://github.com/julianshapiro/velocity/issues/118) - Update README.md [`cd1da99`](https://github.com/julianshapiro/velocity/commit/cd1da99495de9de9605f1d87fc268fb2510d2bc6) #### [v0.2.0](https://github.com/julianshapiro/velocity/compare/v0.1.0...v0.2.0) > 19 June 2014 - Step Easing [`#108`](https://github.com/julianshapiro/velocity/issues/108) - Container Check Update [`9262bc4`](https://github.com/julianshapiro/velocity/commit/9262bc4c279921efa711c963fae0f73490374760) - Version bump [`385af39`](https://github.com/julianshapiro/velocity/commit/385af39af218b548628019bdd05e7e8edf4cbdf1) - Update README.md [`71e6e00`](https://github.com/julianshapiro/velocity/commit/71e6e00c37b75e36d754fc0c783789c00d6edf21) #### [v0.1.0](https://github.com/julianshapiro/velocity/compare/v0.0.23...v0.1.0) > 15 June 2014 - Immediate Stopping [`#70`](https://github.com/julianshapiro/velocity/issues/70) - Update README.md [`1187ad5`](https://github.com/julianshapiro/velocity/commit/1187ad515f6579833ba40f39d8396938527363f2) - Update README.md [`e2702f7`](https://github.com/julianshapiro/velocity/commit/e2702f73fe3a94cc1d674035d4156eba10ad3585) - Update README.md [`5022869`](https://github.com/julianshapiro/velocity/commit/5022869dd20ace8ffe1e45355164156ec5a77f13) #### [v0.0.23](https://github.com/julianshapiro/velocity/compare/v0.0.22...v0.0.23) > 13 June 2014 - + SO link for help [`#107`](https://github.com/julianshapiro/velocity/pull/107) - Add option to set a custom display value on complete. [`#103`](https://github.com/julianshapiro/velocity/pull/103) - Closes #109. [`#109`](https://github.com/julianshapiro/velocity/issues/109) - Update README.md [`af5714d`](https://github.com/julianshapiro/velocity/commit/af5714def7b9c0e073464d5e7bf6c0396d144efb) - Update README.md [`956d75f`](https://github.com/julianshapiro/velocity/commit/956d75f869b32a6d10ae962227617f68cc7d6b98) - Update README.md [`420940e`](https://github.com/julianshapiro/velocity/commit/420940e5e5ea4808bc01b0c8ee4c4cdd4ceb6710) #### [v0.0.22](https://github.com/julianshapiro/velocity/compare/v0.0.21...v0.0.22) > 5 June 2014 - Closes #76. [`#76`](https://github.com/julianshapiro/velocity/issues/76) #### [v0.0.21](https://github.com/julianshapiro/velocity/compare/v0.0.20...v0.0.21) > 5 June 2014 - Closes #97. [`#97`](https://github.com/julianshapiro/velocity/issues/97) - Fixed an issue with the AMD/CommonJS definition not working when jQuery/Zepto is also used. [`73ea312`](https://github.com/julianshapiro/velocity/commit/73ea312aa85b3e2478ff754e22eb6e91a81a15af) - RequireJS Optimizer Fix [`1c9826d`](https://github.com/julianshapiro/velocity/commit/1c9826d57f884ab3b903c1b0f79e026858773b9d) - Update README.md [`7e5624b`](https://github.com/julianshapiro/velocity/commit/7e5624b683e6ef161aecc94185321ca84cdb62a7) #### [v0.0.20](https://github.com/julianshapiro/velocity/compare/v0.0.19...v0.0.20) > 3 June 2014 - Closes #16. Android fixes. [`#16`](https://github.com/julianshapiro/velocity/issues/16) - Update README.md [`d6091c4`](https://github.com/julianshapiro/velocity/commit/d6091c4f34600c13353ea4b2099978c1c8f397d2) - Update README.md [`4440591`](https://github.com/julianshapiro/velocity/commit/44405914feb3e56cd443f50a08cfda660b4d3e31) - Update README.md [`e1b0842`](https://github.com/julianshapiro/velocity/commit/e1b08425cef239365ae87dea3d1c32b138895b01) #### [v0.0.19](https://github.com/julianshapiro/velocity/compare/v0.0.18...v0.0.19) > 3 June 2014 - Firefox Syntax Fix [`6d95175`](https://github.com/julianshapiro/velocity/commit/6d95175f4b483941dd5b53bc90648a71fc4a2e6e) - Update package.json [`241b0de`](https://github.com/julianshapiro/velocity/commit/241b0de9f451658ec64e497247289a380159d391) - Update README.md [`a638153`](https://github.com/julianshapiro/velocity/commit/a63815377959d2de8ea484a62fa5d76aaeeb9447) #### [v0.0.18](https://github.com/julianshapiro/velocity/compare/v0.0.16...v0.0.18) > 1 June 2014 - Closes #76. [`#76`](https://github.com/julianshapiro/velocity/issues/76) - Update README.md [`7aee230`](https://github.com/julianshapiro/velocity/commit/7aee23011457083601c9db7e8673cde9df78e25f) - Update README.md [`013ec2d`](https://github.com/julianshapiro/velocity/commit/013ec2dbdccc9d60b5a979acda2c3e80981b4f6b) - Update README.md [`7ea2088`](https://github.com/julianshapiro/velocity/commit/7ea20889015cc35251d42ce4f0d96150e213237f) #### [v0.0.16](https://github.com/julianshapiro/velocity/compare/v0.0.15...v0.0.16) > 30 May 2014 - Closes #88, #90 [`#88`](https://github.com/julianshapiro/velocity/issues/88) - Support Notes [`43a0efd`](https://github.com/julianshapiro/velocity/commit/43a0efdcc9972e02d243da05c6c542172ac0996d) - Update README.md [`a507081`](https://github.com/julianshapiro/velocity/commit/a507081c4829507abf6a6bd7797227d22468c7c5) - Update README.md [`6cb4a06`](https://github.com/julianshapiro/velocity/commit/6cb4a0665dde69ce0625aada285e4cfba91f081b) #### [v0.0.15](https://github.com/julianshapiro/velocity/compare/v0.0.14...v0.0.15) > 27 May 2014 - Update README.md [`09749e5`](https://github.com/julianshapiro/velocity/commit/09749e57b75e1d00c066e71d7789e97e6b6a8844) #### [v0.0.14](https://github.com/julianshapiro/velocity/compare/v0.0.13...v0.0.14) > 23 May 2014 - Version Updates [`0365563`](https://github.com/julianshapiro/velocity/commit/036556305c969746bcce6eb5d24808c111f74c76) - Spring Physics for Element Sets Bug Fix [`7167288`](https://github.com/julianshapiro/velocity/commit/7167288d2617e5e7bd8b81db275a201176f97580) - Minified [`6aff975`](https://github.com/julianshapiro/velocity/commit/6aff97506fb8fae11cee06e23c2284ba4a57882c) #### [v0.0.13](https://github.com/julianshapiro/velocity/compare/v0.0.12...v0.0.13) > 21 May 2014 - Spring Physics [`d620394`](https://github.com/julianshapiro/velocity/commit/d62039420565dd1fbce2523064ac9dd3592b95ae) - Update README.md [`b361178`](https://github.com/julianshapiro/velocity/commit/b361178d7403effa1c5e65da86d235e8120a734e) - Update README.md [`5c24e97`](https://github.com/julianshapiro/velocity/commit/5c24e977bc5a9e9dc588304cc242873b9cbbe5b6) #### [v0.0.12](https://github.com/julianshapiro/velocity/compare/v0.0.10...v0.0.12) > 19 May 2014 - Closes #72. [`#72`](https://github.com/julianshapiro/velocity/issues/72) - Closes #65 and #73. [`#65`](https://github.com/julianshapiro/velocity/issues/65) - Update README.md [`f445d1b`](https://github.com/julianshapiro/velocity/commit/f445d1b05eaad80fead72a83906eee999dd4c086) #### [v0.0.10](https://github.com/julianshapiro/velocity/compare/v0.0.9...v0.0.10) > 14 May 2014 - Fixes #59. Fixes #2. Closes #55. [`#59`](https://github.com/julianshapiro/velocity/issues/59) [`#2`](https://github.com/julianshapiro/velocity/issues/2) [`#55`](https://github.com/julianshapiro/velocity/issues/55) - Update README.md [`871bb94`](https://github.com/julianshapiro/velocity/commit/871bb94466cbaffa247086b825e4d966d0886bb3) - Update README.md [`b186cbe`](https://github.com/julianshapiro/velocity/commit/b186cbea6925757896952cdee50d53fd82a09515) - Update README.md [`fa76d46`](https://github.com/julianshapiro/velocity/commit/fa76d46a0802ea1f1545d1c519f58645134128da) #### [v0.0.9](https://github.com/julianshapiro/velocity/compare/v0.0.1...v0.0.9) > 12 May 2014 - Back to the latest version [`#4`](https://github.com/julianshapiro/velocity/pull/4) - Remove dependency on jQuery $.easing object [`#48`](https://github.com/julianshapiro/velocity/issues/48) - Temporary jQuery-Less File Removal [`b33a9c5`](https://github.com/julianshapiro/velocity/commit/b33a9c591d3142e7fd96d3f3354878e82ce7c11a) - Performance Boost + Framework Prep [`4ee968b`](https://github.com/julianshapiro/velocity/commit/4ee968b1d2b37f6c5685fd130e171b92dfcf0370) - Performance Boost + Framework Prep [`be98b76`](https://github.com/julianshapiro/velocity/commit/be98b760d225adad1536a7cbfd4f2707b82595c8) #### v0.0.1 > 6 May 2014 - Updated bower.json, addition of component.json [`#33`](https://github.com/julianshapiro/velocity/pull/33) - Getting back in sync [`#3`](https://github.com/julianshapiro/velocity/pull/3) - Contained Element Scrolling Support [`#2`](https://github.com/julianshapiro/velocity/pull/2) - Back to the latest version [`#1`](https://github.com/julianshapiro/velocity/pull/1) - Support for custom user sequences. Thanks to @jeffmicklos and @nmussy. [`#22`](https://github.com/julianshapiro/velocity/pull/22) - Added optional CDN support [`#19`](https://github.com/julianshapiro/velocity/pull/19) - Contained Element Scrolling Support [`#26`](https://github.com/julianshapiro/velocity/issues/26) - non-camelCased Property Support, bower.json [`#27`](https://github.com/julianshapiro/velocity/issues/27) - Remove Forced Class Extraction [`#17`](https://github.com/julianshapiro/velocity/issues/17) - Fixes #11 [`#11`](https://github.com/julianshapiro/velocity/issues/11) - Fixes #1 [`#1`](https://github.com/julianshapiro/velocity/issues/1) - Update README.md [`0e226cb`](https://github.com/julianshapiro/velocity/commit/0e226cbe559460ef81b9f87c902aea94d8149842) - Update README.md [`4c9bd3e`](https://github.com/julianshapiro/velocity/commit/4c9bd3e7e6de29bb79da110461f53a06b38a2a13) - Sequence Fixes and Packaged Sequences [`e8ad8e4`](https://github.com/julianshapiro/velocity/commit/e8ad8e47879b7755b063a3368754aac482b08bbc) ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at rycochet@rycochet.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ ================================================ FILE: CONTRIBUTING.md ================================================ **Contributing** - Make sure you're using the latest version of Velocity before reporting a bug. - If you are asking for help please use [StackOverflow](https://stackoverflow.com/questions/tagged/velocity.js), as the issue tracker is for bugs and suggestions. - Unless you're reporting an obvious bug that can be immediately recreated by anyone, please **create a demo** with the minimum amount of code necessary to reproduce your bug. You can use [this template](https://jsfiddle.net/Rycochet/mqv9L27u/), which already has Velocity and jQuery included (jQuery is not required by Velocity, it is included for ease of examples). - Pull Requests for fixes and new features are often accepted, but feel free to open an issue first if you're unsure of the reception. All code submitted becomes part of VelocityJS and gets covered by its [license](https://github.com/julianshapiro/velocity/blob/master/LICENSE.md). - Please check the [wiki](https://github.com/julianshapiro/velocity/wiki). ================================================ FILE: LICENSE.md ================================================ The MIT License Copyright (c) 2014 Julian Shapiro Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Velocity beta [![npm](https://img.shields.io/npm/v/velocity-animate.svg)](https://www.npmjs.com/package/velocity-animate) [![npm (tag)](https://img.shields.io/npm/v/velocity-animate/beta.svg)](https://www.npmjs.com/package/velocity-animate) [![cdnjs version](https://img.shields.io/cdnjs/v/velocity.svg)](https://cdnjs.com/libraries/velocity) [![npm downloads](https://img.shields.io/npm/dm/velocity-animate.svg)](https://www.npmjs.com/package/velocity-animate) [![jsdelivr downloads](https://data.jsdelivr.com/v1/package/npm/velocity-animate/badge)](https://www.jsdelivr.com/package/npm/velocity-animate) ## NPM: `npm install velocity-animate@beta` ## Docs [https://github.com/julianshapiro/velocity/wiki](https://github.com/julianshapiro/velocity/wiki) # IMPORTANT: The velocityjs.org documentation refers to V1, not V2 beta - use the wiki for latest documentation! ## News WhatsApp, Tumblr, Windows, Samsung, Uber, and thousands of other companies rely on Velocity. Visit [Libscore.com](http://libscore.com/#$.Velocity) to see which sites use Velocity on their homepage. ## React Plugin Announcement: https://fabric.io/blog/introducing-the-velocityreact-library
Repo: https://github.com/twitter-fabric/velocity-react
NPM: https://www.npmjs.com/package/velocity-react ## Quickstart ### Velocity (CDN, choose one of them): ```html ``` ### Velocity UI pack (CDN, choose one of them): ```html ``` > Please note that JSDelivr can automatically supply the latest release, while CloudFlare needs to ask for a specific version. ### Package managers: _npm:_ `npm install velocity-animate@beta` ### Automagic chaining: If using the `.velocity(...)` chained function in libraries such as jQuery or Zepto you need to ensure that Velocity is loaded after them. If you wish to add it to anything loaded afterwards then look at the [Velocity.patch()](https://github.com/julianshapiro/velocity/wiki/Advanced---Patch) method. ## Questions or Problems? Ask on [StackOverflow](http://stackoverflow.com/tags/velocity.js) (make sure you add the `[velocity.js]` and the `[javascript]` or `[typescript]` tags). ## Updates - **[2.0](https://github.com/julianshapiro/velocity/compare/1.5.0...2.0.6)**: Typescript update and complete refactoring. - **[1.5](https://github.com/julianshapiro/velocity/compare/1.4.0...1.5.0)**: Bugfixes, IE9 compatibility fixes. - **[1.4](https://github.com/julianshapiro/velocity/compare/1.3.0...1.4.0)**: Pause / Resume (per element or global).
Forcefed string animation (just have matching number spaces) including unit conversions and colour names (ie `background:["rgba(red,0.1)", "blue"]`). High resolution timers (animations should be slightly smoother).
Various fixes including ticker (loading Velocity in a background window) and color handling. - **[1.3](https://github.com/julianshapiro/velocity/compare/1.2.0...1.3.0)**: Code cleanup - no breaking changes known. - **[1.2](https://github.com/julianshapiro/velocity/compare/1.1.0...1.2.0)**: [Custom tweens](http://VelocityJS.org/#progress). [Custom easings](http://VelocityJS.org/#easing). ["Finish" command](http://VelocityJS.org/#finish). - **[1.0](https://github.com/julianshapiro/velocity/compare/0.1.0...1.0.0)**: File name changed to `velocity.js`. Read [VelocityJS.org/#dependencies](http://VelocityJS.org/#dependencies). - **0.1**: `stop` now stops animations *immediately* (instead of only clearing the remainder of the animation queue). No other backwards-incompatible changes were made. ## Learn - **Motion design**: [smashingmagazine.com/2014/06/18/faster-ui-animations-with-velocity-js](http://smashingmagazine.com/2014/06/18/faster-ui-animations-with-velocity-js) - **Animating without jQuery**: [smashingmagazine.com/2014/09/04/animating-without-jquery](http://www.smashingmagazine.com/2014/09/04/animating-without-jquery/) - **Performance comparisons**: [davidwalsh.name/css-js-animation](http://davidwalsh.name/css-js-animation) - **Workflow**: [css-tricks.com/improving-ui-animation-workflow-velocity-js](http://css-tricks.com/improving-ui-animation-workflow-velocity-js) ## Comparisons - **CSS transitions** are meant for simple interface flourishes. - **jQuery's $.animate()** is slow and poorly-equipped for motion design. - **Velocity** is a fast, feature-rich standalone alternative to jQuery's $.animate(). ## License [MIT License](LICENSE.md). © Julian Shapiro (http://twitter.com/julian). ## Sponsors [![Kiss My Button](https://presskit.kissmybutton.gr/logos/kissmybutton-logo-small.png)](https://kissmybutton.gr) sponsors Velocity's development. [![BrowserStack](https://raw.githubusercontent.com/julianshapiro/velocity/master/.github/browserstack-logo-182x96.png)](https://browserstack.com/) provides browser testing services for Velocity. ================================================ FILE: V2_CHANGES.md ================================================ # Major Changes in Velocity V2 * APIs for extending Velocity - see the various register* commands in the wiki. * Chaining - Chaining is awesome, use it. Chained commands are designed to operate on the chained animation, not on the elements within it. * Colors - All web colors are supported internally. * Delay - You can pass a negative number to start inside the animation rather than just having a delay before it. * Display - This is a property, no longer an option. * Loop - This no longer copies the animation call, it calls it multiple times. * Per-element - Animations are now copied per-element, and not one a one-animation-per-array basis as in other libraries (and old Velocity v1). * Repeat - This is almost identical to loop, but only runs one way. * RequireJS - The namespace is now "velocity-animate" for consistency with the NPMjs project name. * Reverse - Now reverses the last animation at time of adding, not when playing. * Scroll - It is now a property, though it's preferred to use scrollTop and scrollLeft. (Working, but not happy with internal code - the API will not change again.) * Sequences - rewritten and completely incompatible with previous versions. * Speed - You can control the speed of the animation playback. * Styles - Use `element.velocity("style", "propertyName"[, value])`, the old .Hook has gone. * SVG - All SVG attributes are supported internally, though they must be placed on the correct type of element. * Sync - You can now de-sync animations so they start immediately per-element, rather than waiting for all to be ready. * Transforms - Use these directly within CSS, don't try the old shortcuts as they don't exist. * UI-Pack - Now only contains animations, all code is in the core Velocity now. * Visibility - This is a property, no longer an option. ================================================ FILE: babel.config.js ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. * * Babel config. */ module.exports = { "presets": [ [ "@babel/preset-env", { "modules": false } ], "@babel/preset-typescript" ], "plugins": [ [ "@babel/plugin-proposal-optional-chaining", { "loose": true } ], "@babel/plugin-external-helpers" ] }; ================================================ FILE: bower.json ================================================ { "name": "velocity", "homepage": "http://velocityjs.org", "authors": [ { "name" : "Julian Shapiro", "homepage" : "http://julian.com/" }, { "name": "Ryc O'Chet", "url": "https://github.com/Rycochet" } ], "description": "Accelerated JavaScript animation.", "main": [ "./velocity.js", "./velocity.ui.js"], "keywords": [ "animation", "jquery", "animate", "lightweight", "smooth", "ui", "velocity.js", "velocityjs", "javascript" ], "license": "MIT", "ignore": [ "*.json", "!/bower.json", "LICENSE", "*.md" ], "repository" : { "type" : "git", "url" : "http://github.com/julianshapiro/velocity.git" } } ================================================ FILE: docs.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ ================================================ FILE: gsap/GreenSock Animation Platform (GSAP) Speed Test.html ================================================ GreenSock Animation Platform (GSAP) Speed Test

HTML5 Animation Speed Test

Stress test the performance of various common JavaScript libraries and compare them with GSAP (GreenSock Animation Platform). This test does not use a canvas element (although it certainly could) - it simply animates the left, top, width, and height css properties of standard image elements. There are also versions of the GSAP, Zepto, anime, and Web Animations tests that use transforms ("translate/scale") instead so that you can compare performance. The goal was to be extremely fair and use the same code for everything except the actual animation. No tricks. Look at the source for yourself or run your own tests to confirm.

Choose the number of dots you'd like to animate and then choose the engine and click the "START" button below. Watch the fps in the lower right (higher is better - it reflects how many times the main thread updated over the past 1 second). As more dots are animated, you'll see the performance gap widen. Try to push things until the fps drops below 30fps. When the CPU isn't breaking a sweat, fps should hover around 100fps in most modern browsers.

Note: Zepto uses CSS3 transitions which won't work in some browsers (like IE9). Also beware that some browsers incorrectly fire requestAnimationFrame events even when the browser clearly isn't updating the screen and/or they handle JS in a different thread, thus 10fps transitions may inaccurately report in JS as running at 50fps. So focus on the actual animation of the starfield and how smooth it is (or isn't).

================================================ FILE: gsap/GreenSock Animation Platform (GSAP) Speed Test_files/CSSPlugin.js.download ================================================ /* * CSSPlugin by Grant Skinner. Mar 7, 2011 * Visit http://easeljs.com/ for documentation, updates and examples. * * * Copyright (c) 2010 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * The Tween Javascript library provides a retained graphics mode for canvas * including a full, hierarchical display list, a core interaction model, and * helper classes to make working with Canvas much easier. * @module TweenJS **/ (function(window) { /** * A plugin to help TweenJS tween CSS properties. * @class CSSPlugin * @constructor * @protected **/ var CSSPlugin = function() { throw("CSSPlugin cannot be instantiated.") } var p = CSSPlugin.prototype; // static interface: /** * Defines the default suffix map for CSS tweens. This can be overridden on a per tween basis by specifying a * cssSuffixMap value for the individual tween. The object maps CSS property names to the suffix to use when * reading or setting those properties. For example a map in the form {top:"px"} specifies that when tweening * the "top" CSS property, it should use the "px" suffix (ex. target.style.top = "20.5px"). This only applies * to tweens with the "css" config property set to true. * @property cssSuffixMap * @type Object * @static **/ CSSPlugin.cssSuffixMap = {top:"px",left:"px",bottom:"px",right:"px",width:"px",height:"px",opacity:""}; CSSPlugin.priority = -100; // very low priority, should run last /** * Install the plugin * @method install * @protected **/ CSSPlugin.install = function() { var arr = [], map = CSSPlugin.cssSuffixMap; for (var n in map) { arr.push(n); } Tween.installPlugin(CSSPlugin, arr); } /** * Initialize the plugin * @method init * @protected **/ CSSPlugin.init = function(tween, prop, value) { var sfx0,sfx1,style,map = CSSPlugin.cssSuffixMap; if ((sfx0 = map[prop]) == null || !(style = tween._target.style)) { return value; } var str = style[prop]; if (!str) { return 0; } // no style set. var i = str.length-sfx0.length; if ((sfx1 = str.substr(i)) != sfx0) { throw("CSSPlugin Error: Suffixes do not match. ("+sfx0+":"+sfx1+")"); } else { return parseInt(str.substr(0,i)); } } /** * Apply the plugin properties on a tween * @method tween * @protected **/ CSSPlugin.tween = function(tween, prop, value, startValues, endValues, ratio, position, end) { var style,map = CSSPlugin.cssSuffixMap; if (map[prop] == null || !(style = tween._target.style)) { return value; } style[prop] = value+map[prop]; return value; } // public properties: // private properties: // constructor: // public methods: // private methods: window.CSSPlugin = CSSPlugin; }(window)); ================================================ FILE: gsap/GreenSock Animation Platform (GSAP) Speed Test_files/CSSPlugin.min.js.download ================================================ /*! * VERSION: 1.19.0 * DATE: 2016-07-14 * UPDATES AND DOCS AT: http://greensock.com * * @license Copyright (c) 2008-2016, 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 */ 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(a,b){var c,d,e,f,g=function(){a.call(this,"css"),this._overwriteProps.length=0,this.setRatio=g.prototype.setRatio},h=_gsScope._gsDefine.globals,i={},j=g.prototype=new a("css");j.constructor=g,g.version="1.19.0",g.API=2,g.defaultTransformPerspective=0,g.defaultSkewType="compensated",g.defaultSmoothOrigin=!0,j="px",g.suffixMap={top:j,right:j,bottom:j,left:j,width:j,height:j,fontSize:j,padding:j,margin:j,perspective:j,lineHeight:""};var k,l,m,n,o,p,q,r,s=/(?:\-|\.|\b)(\d|\.|e\-)+/g,t=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,u=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,v=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,w=/(?:\d|\-|\+|=|#|\.)*/g,x=/opacity *= *([^)]*)/i,y=/opacity:([^;]*)/i,z=/alpha\(opacity *=.+?\)/i,A=/^(rgb|hsl)/,B=/([A-Z])/g,C=/-([a-z])/gi,D=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,E=function(a,b){return b.toUpperCase()},F=/(?:Left|Right|Width)/i,G=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,H=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,I=/,(?=[^\)]*(?:\(|$))/gi,J=/[\s,\(]/i,K=Math.PI/180,L=180/Math.PI,M={},N=document,O=function(a){return N.createElementNS?N.createElementNS("http://www.w3.org/1999/xhtml",a):N.createElement(a)},P=O("div"),Q=O("img"),R=g._internals={_specialProps:i},S=navigator.userAgent,T=function(){var a=S.indexOf("Android"),b=O("a");return m=-1!==S.indexOf("Safari")&&-1===S.indexOf("Chrome")&&(-1===a||Number(S.substr(a+8,1))>3),o=m&&Number(S.substr(S.indexOf("Version/")+8,1))<6,n=-1!==S.indexOf("Firefox"),(/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(S)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(S))&&(p=parseFloat(RegExp.$1)),b?(b.style.cssText="top:1px;opacity:.55;",/^0.55/.test(b.style.opacity)):!1}(),U=function(a){return x.test("string"==typeof a?a:(a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100:1},V=function(a){window.console&&console.log(a)},W="",X="",Y=function(a,b){b=b||P;var c,d,e=b.style;if(void 0!==e[a])return a;for(a=a.charAt(0).toUpperCase()+a.substr(1),c=["O","Moz","ms","Ms","Webkit"],d=5;--d>-1&&void 0===e[c[d]+a];);return d>=0?(X=3===d?"ms":c[d],W="-"+X.toLowerCase()+"-",X+a):null},Z=N.defaultView?N.defaultView.getComputedStyle:function(){},$=g.getStyle=function(a,b,c,d,e){var f;return T||"opacity"!==b?(!d&&a.style[b]?f=a.style[b]:(c=c||Z(a))?f=c[b]||c.getPropertyValue(b)||c.getPropertyValue(b.replace(B,"-$1").toLowerCase()):a.currentStyle&&(f=a.currentStyle[b]),null==e||f&&"none"!==f&&"auto"!==f&&"auto auto"!==f?f:e):U(a)},_=R.convertToPixels=function(a,c,d,e,f){if("px"===e||!e)return d;if("auto"===e||!d)return 0;var h,i,j,k=F.test(c),l=a,m=P.style,n=0>d,o=1===d;if(n&&(d=-d),o&&(d*=100),"%"===e&&-1!==c.indexOf("border"))h=d/100*(k?a.clientWidth:a.clientHeight);else{if(m.cssText="border:0 solid red;position:"+$(a,"position")+";line-height:0;","%"!==e&&l.appendChild&&"v"!==e.charAt(0)&&"rem"!==e)m[k?"borderLeftWidth":"borderTopWidth"]=d+e;else{if(l=a.parentNode||N.body,i=l._gsCache,j=b.ticker.frame,i&&k&&i.time===j)return i.width*d/100;m[k?"width":"height"]=d+e}l.appendChild(P),h=parseFloat(P[k?"offsetWidth":"offsetHeight"]),l.removeChild(P),k&&"%"===e&&g.cacheWidths!==!1&&(i=l._gsCache=l._gsCache||{},i.time=j,i.width=h/d*100),0!==h||f||(h=_(a,c,d,e,!0))}return o&&(h/=100),n?-h:h},aa=R.calculateOffset=function(a,b,c){if("absolute"!==$(a,"position",c))return 0;var d="left"===b?"Left":"Top",e=$(a,"margin"+d,c);return a["offset"+d]-(_(a,b,parseFloat(e),e.replace(w,""))||0)},ba=function(a,b){var c,d,e,f={};if(b=b||Z(a,null))if(c=b.length)for(;--c>-1;)e=b[c],(-1===e.indexOf("-transform")||Ca===e)&&(f[e.replace(C,E)]=b.getPropertyValue(e));else for(c in b)(-1===c.indexOf("Transform")||Ba===c)&&(f[c]=b[c]);else if(b=a.currentStyle||a.style)for(c in b)"string"==typeof c&&void 0===f[c]&&(f[c.replace(C,E)]=b[c]);return T||(f.opacity=U(a)),d=Pa(a,b,!1),f.rotation=d.rotation,f.skewX=d.skewX,f.scaleX=d.scaleX,f.scaleY=d.scaleY,f.x=d.x,f.y=d.y,Ea&&(f.z=d.z,f.rotationX=d.rotationX,f.rotationY=d.rotationY,f.scaleZ=d.scaleZ),f.filters&&delete f.filters,f},ca=function(a,b,c,d,e){var f,g,h,i={},j=a.style;for(g in c)"cssText"!==g&&"length"!==g&&isNaN(g)&&(b[g]!==(f=c[g])||e&&e[g])&&-1===g.indexOf("Origin")&&("number"==typeof f||"string"==typeof f)&&(i[g]="auto"!==f||"left"!==g&&"top"!==g?""!==f&&"auto"!==f&&"none"!==f||"string"!=typeof b[g]||""===b[g].replace(v,"")?f:0:aa(a,g),void 0!==j[g]&&(h=new ra(j,g,j[g],h)));if(d)for(g in d)"className"!==g&&(i[g]=d[g]);return{difs:i,firstMPT:h}},da={width:["Left","Right"],height:["Top","Bottom"]},ea=["marginLeft","marginRight","marginTop","marginBottom"],fa=function(a,b,c){if("svg"===(a.nodeName+"").toLowerCase())return(c||Z(a))[b]||0;if(a.getBBox&&Ma(a))return a.getBBox()[b]||0;var d=parseFloat("width"===b?a.offsetWidth:a.offsetHeight),e=da[b],f=e.length;for(c=c||Z(a,null);--f>-1;)d-=parseFloat($(a,"padding"+e[f],c,!0))||0,d-=parseFloat($(a,"border"+e[f]+"Width",c,!0))||0;return d},ga=function(a,b){if("contain"===a||"auto"===a||"auto auto"===a)return a+" ";(null==a||""===a)&&(a="0 0");var c,d=a.split(" "),e=-1!==a.indexOf("left")?"0%":-1!==a.indexOf("right")?"100%":d[0],f=-1!==a.indexOf("top")?"0%":-1!==a.indexOf("bottom")?"100%":d[1];if(d.length>3&&!b){for(d=a.split(", ").join(",").split(","),a=[],c=0;c2?" "+d[2]:""),b&&(b.oxp=-1!==e.indexOf("%"),b.oyp=-1!==f.indexOf("%"),b.oxr="="===e.charAt(1),b.oyr="="===f.charAt(1),b.ox=parseFloat(e.replace(v,"")),b.oy=parseFloat(f.replace(v,"")),b.v=a),b||a},ha=function(a,b){return"function"==typeof a&&(a=a(r,q)),"string"==typeof a&&"="===a.charAt(1)?parseInt(a.charAt(0)+"1",10)*parseFloat(a.substr(2)):parseFloat(a)-parseFloat(b)||0},ia=function(a,b){return"function"==typeof a&&(a=a(r,q)),null==a?b:"string"==typeof a&&"="===a.charAt(1)?parseInt(a.charAt(0)+"1",10)*parseFloat(a.substr(2))+b:parseFloat(a)||0},ja=function(a,b,c,d){var e,f,g,h,i,j=1e-6;return"function"==typeof a&&(a=a(r,q)),null==a?h=b:"number"==typeof a?h=a:(e=360,f=a.split("_"),i="="===a.charAt(1),g=(i?parseInt(a.charAt(0)+"1",10)*parseFloat(f[0].substr(2)):parseFloat(f[0]))*(-1===a.indexOf("rad")?1:L)-(i?0:b),f.length&&(d&&(d[c]=b+g),-1!==a.indexOf("short")&&(g%=e,g!==g%(e/2)&&(g=0>g?g+e:g-e)),-1!==a.indexOf("_cw")&&0>g?g=(g+9999999999*e)%e-(g/e|0)*e:-1!==a.indexOf("ccw")&&g>0&&(g=(g-9999999999*e)%e-(g/e|0)*e)),h=b+g),j>h&&h>-j&&(h=0),h},ka={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]},la=function(a,b,c){return a=0>a?a+1:a>1?a-1:a,255*(1>6*a?b+(c-b)*a*6:.5>a?c:2>3*a?b+(c-b)*(2/3-a)*6:b)+.5|0},ma=g.parseColor=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;if(a)if("number"==typeof a)c=[a>>16,a>>8&255,255&a];else{if(","===a.charAt(a.length-1)&&(a=a.substr(0,a.length-1)),ka[a])c=ka[a];else if("#"===a.charAt(0))4===a.length&&(d=a.charAt(1),e=a.charAt(2),f=a.charAt(3),a="#"+d+d+e+e+f+f),a=parseInt(a.substr(1),16),c=[a>>16,a>>8&255,255&a];else if("hsl"===a.substr(0,3))if(c=m=a.match(s),b){if(-1!==a.indexOf("="))return a.match(t)}else g=Number(c[0])%360/360,h=Number(c[1])/100,i=Number(c[2])/100,e=.5>=i?i*(h+1):i+h-i*h,d=2*i-e,c.length>3&&(c[3]=Number(a[3])),c[0]=la(g+1/3,d,e),c[1]=la(g,d,e),c[2]=la(g-1/3,d,e);else c=a.match(s)||ka.transparent;c[0]=Number(c[0]),c[1]=Number(c[1]),c[2]=Number(c[2]),c.length>3&&(c[3]=Number(c[3]))}else c=ka.black;return b&&!m&&(d=c[0]/255,e=c[1]/255,f=c[2]/255,j=Math.max(d,e,f),k=Math.min(d,e,f),i=(j+k)/2,j===k?g=h=0:(l=j-k,h=i>.5?l/(2-j-k):l/(j+k),g=j===d?(e-f)/l+(f>e?6:0):j===e?(f-d)/l+2:(d-e)/l+4,g*=60),c[0]=g+.5|0,c[1]=100*h+.5|0,c[2]=100*i+.5|0),c},na=function(a,b){var c,d,e,f=a.match(oa)||[],g=0,h=f.length?"":a;for(c=0;c0?g[0].replace(s,""):"";return k?e=b?function(a){var b,m,n,o;if("number"==typeof a)a+=l;else if(d&&I.test(a)){for(o=a.replace(I,"|").split("|"),n=0;nn--)for(;++nm--)for(;++mi;i++)h[a[i]]=j[i]=j[i]||j[(i-1)/2>>0];return e.parse(b,h,f,g)}},ra=(R._setPluginRatio=function(a){this.plugin.setRatio(a);for(var b,c,d,e,f,g=this.data,h=g.proxy,i=g.firstMPT,j=1e-6;i;)b=h[i.v],i.r?b=Math.round(b):j>b&&b>-j&&(b=0),i.t[i.p]=b,i=i._next;if(g.autoRotate&&(g.autoRotate.rotation=g.mod?g.mod(h.rotation,this.t):h.rotation),1===a||0===a)for(i=g.firstMPT,f=1===a?"e":"b";i;){if(c=i.t,c.type){if(1===c.type){for(e=c.xs0+c.s+c.xs1,d=1;d0;)i="xn"+g,h=d.p+"_"+i,n[h]=d.data[i],m[h]=d[i],f||(j=new ra(d,i,h,j,d.rxp[i]));d=d._next}return{proxy:m,end:n,firstMPT:j,pt:k}},R.CSSPropTween=function(a,b,d,e,g,h,i,j,k,l,m){this.t=a,this.p=b,this.s=d,this.c=e,this.n=i||b,a instanceof sa||f.push(this.n),this.r=j,this.type=h||0,k&&(this.pr=k,c=!0),this.b=void 0===l?d:l,this.e=void 0===m?d+e:m,g&&(this._next=g,g._prev=this)}),ta=function(a,b,c,d,e,f){var g=new sa(a,b,c,d-c,e,-1,f);return g.b=c,g.e=g.xs0=d,g},ua=g.parseComplex=function(a,b,c,d,e,f,h,i,j,l){c=c||f||"","function"==typeof d&&(d=d(r,q)),h=new sa(a,b,0,0,h,l?2:1,null,!1,i,c,d),d+="",e&&oa.test(d+c)&&(d=[c,d],g.colorStringFilter(d),c=d[0],d=d[1]);var m,n,o,p,u,v,w,x,y,z,A,B,C,D=c.split(", ").join(",").split(" "),E=d.split(", ").join(",").split(" "),F=D.length,G=k!==!1;for((-1!==d.indexOf(",")||-1!==c.indexOf(","))&&(D=D.join(" ").replace(I,", ").split(" "),E=E.join(" ").replace(I,", ").split(" "),F=D.length),F!==E.length&&(D=(f||"").split(" "),F=D.length),h.plugin=j,h.setRatio=l,oa.lastIndex=0,m=0;F>m;m++)if(p=D[m],u=E[m],x=parseFloat(p),x||0===x)h.appendXtra("",x,ha(u,x),u.replace(t,""),G&&-1!==u.indexOf("px"),!0);else if(e&&oa.test(p))B=u.indexOf(")")+1,B=")"+(B?u.substr(B):""),C=-1!==u.indexOf("hsl")&&T,p=ma(p,C),u=ma(u,C),y=p.length+u.length>6,y&&!T&&0===u[3]?(h["xs"+h.l]+=h.l?" transparent":"transparent",h.e=h.e.split(E[m]).join("transparent")):(T||(y=!1),C?h.appendXtra(y?"hsla(":"hsl(",p[0],ha(u[0],p[0]),",",!1,!0).appendXtra("",p[1],ha(u[1],p[1]),"%,",!1).appendXtra("",p[2],ha(u[2],p[2]),y?"%,":"%"+B,!1):h.appendXtra(y?"rgba(":"rgb(",p[0],u[0]-p[0],",",!0,!0).appendXtra("",p[1],u[1]-p[1],",",!0).appendXtra("",p[2],u[2]-p[2],y?",":B,!0),y&&(p=p.length<4?1:p[3],h.appendXtra("",p,(u.length<4?1:u[3])-p,B,!1))),oa.lastIndex=0;else if(v=p.match(s)){if(w=u.match(t),!w||w.length!==v.length)return h;for(o=0,n=0;n0;)j["xn"+va]=0,j["xs"+va]="";j.xs0="",j._next=j._prev=j.xfirst=j.data=j.plugin=j.setRatio=j.rxp=null,j.appendXtra=function(a,b,c,d,e,f){var g=this,h=g.l;return g["xs"+h]+=f&&(h||g["xs"+h])?" "+a:a||"",c||0===h||g.plugin?(g.l++,g.type=g.setRatio?2:1,g["xs"+g.l]=d||"",h>0?(g.data["xn"+h]=b+c,g.rxp["xn"+h]=e,g["xn"+h]=b,g.plugin||(g.xfirst=new sa(g,"xn"+h,b,c,g.xfirst||g,0,g.n,e,g.pr),g.xfirst.xs0=0),g):(g.data={s:b+c},g.rxp={},g.s=b,g.c=c,g.r=e,g)):(g["xs"+h]+=b+(d||""),g)};var wa=function(a,b){b=b||{},this.p=b.prefix?Y(a)||a:a,i[a]=i[this.p]=this,this.format=b.formatter||pa(b.defaultValue,b.color,b.collapsible,b.multi),b.parser&&(this.parse=b.parser),this.clrs=b.color,this.multi=b.multi,this.keyword=b.keyword,this.dflt=b.defaultValue,this.pr=b.priority||0},xa=R._registerComplexSpecialProp=function(a,b,c){"object"!=typeof b&&(b={parser:c});var d,e,f=a.split(","),g=b.defaultValue;for(c=c||[g],d=0;dh.length?i.length:h.length,g=0;j>g;g++)b=h[g]=h[g]||this.dflt,c=i[g]=i[g]||this.dflt,m&&(k=b.indexOf(m),l=c.indexOf(m),k!==l&&(-1===l?h[g]=h[g].split(m).join(""):-1===k&&(h[g]+=" "+m)));b=h.join(", "),c=i.join(", ")}return ua(a,this.p,b,c,this.clrs,this.dflt,d,this.pr,e,f)},j.parse=function(a,b,c,d,f,g,h){return this.parseComplex(a.style,this.format($(a,this.p,e,!1,this.dflt)),this.format(b),f,g)},g.registerSpecialProp=function(a,b,c){xa(a,{parser:function(a,d,e,f,g,h,i){var j=new sa(a,e,0,0,g,2,e,!1,c);return j.plugin=h,j.setRatio=b(a,d,f._tween,e),j},priority:c})},g.useSVGTransformAttr=m||n;var za,Aa="scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent".split(","),Ba=Y("transform"),Ca=W+"transform",Da=Y("transformOrigin"),Ea=null!==Y("perspective"),Fa=R.Transform=function(){this.perspective=parseFloat(g.defaultTransformPerspective)||0,this.force3D=g.defaultForce3D!==!1&&Ea?g.defaultForce3D||"auto":!1},Ga=window.SVGElement,Ha=function(a,b,c){var d,e=N.createElementNS("http://www.w3.org/2000/svg",a),f=/([a-z])([A-Z])/g;for(d in c)e.setAttributeNS(null,d.replace(f,"$1-$2").toLowerCase(),c[d]);return b.appendChild(e),e},Ia=N.documentElement,Ja=function(){var a,b,c,d=p||/Android/i.test(S)&&!window.chrome;return N.createElementNS&&!d&&(a=Ha("svg",Ia),b=Ha("rect",a,{width:100,height:50,x:100}),c=b.getBoundingClientRect().width,b.style[Da]="50% 50%",b.style[Ba]="scaleX(0.5)",d=c===b.getBoundingClientRect().width&&!(n&&Ea),Ia.removeChild(a)),d}(),Ka=function(a,b,c,d,e,f){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=a._gsTransform,w=Oa(a,!0);v&&(t=v.xOrigin,u=v.yOrigin),(!d||(h=d.split(" ")).length<2)&&(n=a.getBBox(),b=ga(b).split(" "),h=[(-1!==b[0].indexOf("%")?parseFloat(b[0])/100*n.width:parseFloat(b[0]))+n.x,(-1!==b[1].indexOf("%")?parseFloat(b[1])/100*n.height:parseFloat(b[1]))+n.y]),c.xOrigin=k=parseFloat(h[0]),c.yOrigin=l=parseFloat(h[1]),d&&w!==Na&&(m=w[0],n=w[1],o=w[2],p=w[3],q=w[4],r=w[5],s=m*p-n*o,i=k*(p/s)+l*(-o/s)+(o*r-p*q)/s,j=k*(-n/s)+l*(m/s)-(m*r-n*q)/s,k=c.xOrigin=h[0]=i,l=c.yOrigin=h[1]=j),v&&(f&&(c.xOffset=v.xOffset,c.yOffset=v.yOffset,v=c),e||e!==!1&&g.defaultSmoothOrigin!==!1?(i=k-t,j=l-u,v.xOffset+=i*w[0]+j*w[2]-i,v.yOffset+=i*w[1]+j*w[3]-j):v.xOffset=v.yOffset=0),f||a.setAttribute("data-svg-origin",h.join(" "))},La=function(a){try{return a.getBBox()}catch(a){}},Ma=function(a){return!!(Ga&&a.getBBox&&a.getCTM&&La(a)&&(!a.parentNode||a.parentNode.getBBox&&a.parentNode.getCTM))},Na=[1,0,0,1,0,0],Oa=function(a,b){var c,d,e,f,g,h,i=a._gsTransform||new Fa,j=1e5,k=a.style;if(Ba?d=$(a,Ca,null,!0):a.currentStyle&&(d=a.currentStyle.filter.match(G),d=d&&4===d.length?[d[0].substr(4),Number(d[2].substr(4)),Number(d[1].substr(4)),d[3].substr(4),i.x||0,i.y||0].join(","):""),c=!d||"none"===d||"matrix(1, 0, 0, 1, 0, 0)"===d,c&&Ba&&((h="none"===Z(a).display)||!a.parentNode)&&(h&&(f=k.display,k.display="block"),a.parentNode||(g=1,Ia.appendChild(a)),d=$(a,Ca,null,!0),c=!d||"none"===d||"matrix(1, 0, 0, 1, 0, 0)"===d,f?k.display=f:h&&Ta(k,"display"),g&&Ia.removeChild(a)),(i.svg||a.getBBox&&Ma(a))&&(c&&-1!==(k[Ba]+"").indexOf("matrix")&&(d=k[Ba],c=0),e=a.getAttribute("transform"),c&&e&&(-1!==e.indexOf("matrix")?(d=e,c=0):-1!==e.indexOf("translate")&&(d="matrix(1,0,0,1,"+e.match(/(?:\-|\b)[\d\-\.e]+\b/gi).join(",")+")",c=0))),c)return Na;for(e=(d||"").match(s)||[],va=e.length;--va>-1;)f=Number(e[va]),e[va]=(g=f-(f|=0))?(g*j+(0>g?-.5:.5)|0)/j+f:f;return b&&e.length>6?[e[0],e[1],e[4],e[5],e[12],e[13]]:e},Pa=R.getTransform=function(a,c,d,e){if(a._gsTransform&&d&&!e)return a._gsTransform;var f,h,i,j,k,l,m=d?a._gsTransform||new Fa:new Fa,n=m.scaleX<0,o=2e-5,p=1e5,q=Ea?parseFloat($(a,Da,c,!1,"0 0 0").split(" ")[2])||m.zOrigin||0:0,r=parseFloat(g.defaultTransformPerspective)||0;if(m.svg=!(!a.getBBox||!Ma(a)),m.svg&&(Ka(a,$(a,Da,c,!1,"50% 50%")+"",m,a.getAttribute("data-svg-origin")),za=g.useSVGTransformAttr||Ja),f=Oa(a),f!==Na){if(16===f.length){var s,t,u,v,w,x=f[0],y=f[1],z=f[2],A=f[3],B=f[4],C=f[5],D=f[6],E=f[7],F=f[8],G=f[9],H=f[10],I=f[12],J=f[13],K=f[14],M=f[11],N=Math.atan2(D,H);m.zOrigin&&(K=-m.zOrigin,I=F*K-f[12],J=G*K-f[13],K=H*K+m.zOrigin-f[14]),m.rotationX=N*L,N&&(v=Math.cos(-N),w=Math.sin(-N),s=B*v+F*w,t=C*v+G*w,u=D*v+H*w,F=B*-w+F*v,G=C*-w+G*v,H=D*-w+H*v,M=E*-w+M*v,B=s,C=t,D=u),N=Math.atan2(-z,H),m.rotationY=N*L,N&&(v=Math.cos(-N),w=Math.sin(-N),s=x*v-F*w,t=y*v-G*w,u=z*v-H*w,G=y*w+G*v,H=z*w+H*v,M=A*w+M*v,x=s,y=t,z=u),N=Math.atan2(y,x),m.rotation=N*L,N&&(v=Math.cos(-N),w=Math.sin(-N),x=x*v+B*w,t=y*v+C*w,C=y*-w+C*v,D=z*-w+D*v,y=t),m.rotationX&&Math.abs(m.rotationX)+Math.abs(m.rotation)>359.9&&(m.rotationX=m.rotation=0,m.rotationY=180-m.rotationY),m.scaleX=(Math.sqrt(x*x+y*y)*p+.5|0)/p,m.scaleY=(Math.sqrt(C*C+G*G)*p+.5|0)/p,m.scaleZ=(Math.sqrt(D*D+H*H)*p+.5|0)/p,m.rotationX||m.rotationY?m.skewX=0:(m.skewX=B||C?Math.atan2(B,C)*L+m.rotation:m.skewX||0,Math.abs(m.skewX)>90&&Math.abs(m.skewX)<270&&(n?(m.scaleX*=-1,m.skewX+=m.rotation<=0?180:-180,m.rotation+=m.rotation<=0?180:-180):(m.scaleY*=-1,m.skewX+=m.skewX<=0?180:-180))),m.perspective=M?1/(0>M?-M:M):0,m.x=I,m.y=J,m.z=K,m.svg&&(m.x-=m.xOrigin-(m.xOrigin*x-m.yOrigin*B),m.y-=m.yOrigin-(m.yOrigin*y-m.xOrigin*C))}else if(!Ea||e||!f.length||m.x!==f[4]||m.y!==f[5]||!m.rotationX&&!m.rotationY){var O=f.length>=6,P=O?f[0]:1,Q=f[1]||0,R=f[2]||0,S=O?f[3]:1;m.x=f[4]||0,m.y=f[5]||0,i=Math.sqrt(P*P+Q*Q),j=Math.sqrt(S*S+R*R),k=P||Q?Math.atan2(Q,P)*L:m.rotation||0,l=R||S?Math.atan2(R,S)*L+k:m.skewX||0,Math.abs(l)>90&&Math.abs(l)<270&&(n?(i*=-1,l+=0>=k?180:-180,k+=0>=k?180:-180):(j*=-1,l+=0>=l?180:-180)),m.scaleX=i,m.scaleY=j,m.rotation=k,m.skewX=l,Ea&&(m.rotationX=m.rotationY=m.z=0,m.perspective=r,m.scaleZ=1),m.svg&&(m.x-=m.xOrigin-(m.xOrigin*P+m.yOrigin*R),m.y-=m.yOrigin-(m.xOrigin*Q+m.yOrigin*S))}m.zOrigin=q;for(h in m)m[h]-o&&(m[h]=0)}return d&&(a._gsTransform=m,m.svg&&(za&&a.style[Ba]?b.delayedCall(.001,function(){Ta(a.style,Ba)}):!za&&a.getAttribute("transform")&&b.delayedCall(.001,function(){a.removeAttribute("transform")}))),m},Qa=function(a){var b,c,d=this.data,e=-d.rotation*K,f=e+d.skewX*K,g=1e5,h=(Math.cos(e)*d.scaleX*g|0)/g,i=(Math.sin(e)*d.scaleX*g|0)/g,j=(Math.sin(f)*-d.scaleY*g|0)/g,k=(Math.cos(f)*d.scaleY*g|0)/g,l=this.t.style,m=this.t.currentStyle;if(m){c=i,i=-j,j=-c,b=m.filter,l.filter="";var n,o,q=this.t.offsetWidth,r=this.t.offsetHeight,s="absolute"!==m.position,t="progid:DXImageTransform.Microsoft.Matrix(M11="+h+", M12="+i+", M21="+j+", M22="+k,u=d.x+q*d.xPercent/100,v=d.y+r*d.yPercent/100;if(null!=d.ox&&(n=(d.oxp?q*d.ox*.01:d.ox)-q/2,o=(d.oyp?r*d.oy*.01:d.oy)-r/2,u+=n-(n*h+o*i),v+=o-(n*j+o*k)),s?(n=q/2,o=r/2,t+=", Dx="+(n-(n*h+o*i)+u)+", Dy="+(o-(n*j+o*k)+v)+")"):t+=", sizingMethod='auto expand')",-1!==b.indexOf("DXImageTransform.Microsoft.Matrix(")?l.filter=b.replace(H,t):l.filter=t+" "+b,(0===a||1===a)&&1===h&&0===i&&0===j&&1===k&&(s&&-1===t.indexOf("Dx=0, Dy=0")||x.test(b)&&100!==parseFloat(RegExp.$1)||-1===b.indexOf(b.indexOf("Alpha"))&&l.removeAttribute("filter")),!s){var y,z,A,B=8>p?1:-1;for(n=d.ieOffsetX||0,o=d.ieOffsetY||0,d.ieOffsetX=Math.round((q-((0>h?-h:h)*q+(0>i?-i:i)*r))/2+u),d.ieOffsetY=Math.round((r-((0>k?-k:k)*r+(0>j?-j:j)*q))/2+v),va=0;4>va;va++)z=ea[va],y=m[z],c=-1!==y.indexOf("px")?parseFloat(y):_(this.t,z,parseFloat(y),y.replace(w,""))||0,A=c!==d[z]?2>va?-d.ieOffsetX:-d.ieOffsetY:2>va?n-d.ieOffsetX:o-d.ieOffsetY,l[z]=(d[z]=Math.round(c-A*(0===va||2===va?1:B)))+"px"}}},Ra=R.set3DTransformRatio=R.setTransformRatio=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u,v,w,x,y,z=this.data,A=this.t.style,B=z.rotation,C=z.rotationX,D=z.rotationY,E=z.scaleX,F=z.scaleY,G=z.scaleZ,H=z.x,I=z.y,J=z.z,L=z.svg,M=z.perspective,N=z.force3D;if(((1===a||0===a)&&"auto"===N&&(this.tween._totalTime===this.tween._totalDuration||!this.tween._totalTime)||!N)&&!J&&!M&&!D&&!C&&1===G||za&&L||!Ea)return void(B||z.skewX||L?(B*=K,x=z.skewX*K,y=1e5,b=Math.cos(B)*E,e=Math.sin(B)*E,c=Math.sin(B-x)*-F,f=Math.cos(B-x)*F,x&&"simple"===z.skewType&&(s=Math.tan(x-z.skewY*K),s=Math.sqrt(1+s*s),c*=s,f*=s,z.skewY&&(s=Math.tan(z.skewY*K),s=Math.sqrt(1+s*s),b*=s,e*=s)),L&&(H+=z.xOrigin-(z.xOrigin*b+z.yOrigin*c)+z.xOffset,I+=z.yOrigin-(z.xOrigin*e+z.yOrigin*f)+z.yOffset,za&&(z.xPercent||z.yPercent)&&(p=this.t.getBBox(),H+=.01*z.xPercent*p.width,I+=.01*z.yPercent*p.height),p=1e-6,p>H&&H>-p&&(H=0),p>I&&I>-p&&(I=0)),u=(b*y|0)/y+","+(e*y|0)/y+","+(c*y|0)/y+","+(f*y|0)/y+","+H+","+I+")",L&&za?this.t.setAttribute("transform","matrix("+u):A[Ba]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%) matrix(":"matrix(")+u):A[Ba]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%) matrix(":"matrix(")+E+",0,0,"+F+","+H+","+I+")");if(n&&(p=1e-4,p>E&&E>-p&&(E=G=2e-5),p>F&&F>-p&&(F=G=2e-5),!M||z.z||z.rotationX||z.rotationY||(M=0)),B||z.skewX)B*=K,q=b=Math.cos(B),r=e=Math.sin(B),z.skewX&&(B-=z.skewX*K,q=Math.cos(B),r=Math.sin(B),"simple"===z.skewType&&(s=Math.tan((z.skewX-z.skewY)*K),s=Math.sqrt(1+s*s),q*=s,r*=s,z.skewY&&(s=Math.tan(z.skewY*K),s=Math.sqrt(1+s*s),b*=s,e*=s))),c=-r,f=q;else{if(!(D||C||1!==G||M||L))return void(A[Ba]=(z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%) translate3d(":"translate3d(")+H+"px,"+I+"px,"+J+"px)"+(1!==E||1!==F?" scale("+E+","+F+")":""));b=f=1,c=e=0}j=1,d=g=h=i=k=l=0,m=M?-1/M:0,o=z.zOrigin,p=1e-6,v=",",w="0",B=D*K,B&&(q=Math.cos(B),r=Math.sin(B),h=-r,k=m*-r,d=b*r,g=e*r,j=q,m*=q,b*=q,e*=q),B=C*K,B&&(q=Math.cos(B),r=Math.sin(B),s=c*q+d*r,t=f*q+g*r,i=j*r,l=m*r,d=c*-r+d*q,g=f*-r+g*q,j*=q,m*=q,c=s,f=t),1!==G&&(d*=G,g*=G,j*=G,m*=G),1!==F&&(c*=F,f*=F,i*=F,l*=F),1!==E&&(b*=E,e*=E,h*=E,k*=E),(o||L)&&(o&&(H+=d*-o,I+=g*-o,J+=j*-o+o),L&&(H+=z.xOrigin-(z.xOrigin*b+z.yOrigin*c)+z.xOffset,I+=z.yOrigin-(z.xOrigin*e+z.yOrigin*f)+z.yOffset),p>H&&H>-p&&(H=w),p>I&&I>-p&&(I=w),p>J&&J>-p&&(J=0)),u=z.xPercent||z.yPercent?"translate("+z.xPercent+"%,"+z.yPercent+"%) matrix3d(":"matrix3d(",u+=(p>b&&b>-p?w:b)+v+(p>e&&e>-p?w:e)+v+(p>h&&h>-p?w:h),u+=v+(p>k&&k>-p?w:k)+v+(p>c&&c>-p?w:c)+v+(p>f&&f>-p?w:f),C||D||1!==G?(u+=v+(p>i&&i>-p?w:i)+v+(p>l&&l>-p?w:l)+v+(p>d&&d>-p?w:d),u+=v+(p>g&&g>-p?w:g)+v+(p>j&&j>-p?w:j)+v+(p>m&&m>-p?w:m)+v):u+=",0,0,0,0,1,0,",u+=H+v+I+v+J+v+(M?1+-J/M:1)+")",A[Ba]=u};j=Fa.prototype,j.x=j.y=j.z=j.skewX=j.skewY=j.rotation=j.rotationX=j.rotationY=j.zOrigin=j.xPercent=j.yPercent=j.xOffset=j.yOffset=0,j.scaleX=j.scaleY=j.scaleZ=1,xa("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(a,b,c,d,f,h,i){if(d._lastParsedTransform===i)return f;d._lastParsedTransform=i;var j;"function"==typeof i[c]&&(j=i[c],i[c]=b);var k,l,m,n,o,p,s,t,u,v=a._gsTransform,w=a.style,x=1e-6,y=Aa.length,z=i,A={},B="transformOrigin",C=Pa(a,e,!0,z.parseTransform),D=z.transform&&("function"==typeof z.transform?z.transform(r,q):z.transform);if(d._transform=C,D&&"string"==typeof D&&Ba)l=P.style,l[Ba]=D,l.display="block",l.position="absolute",N.body.appendChild(P),k=Pa(P,null,!1),C.svg&&(p=C.xOrigin,s=C.yOrigin,k.x-=C.xOffset,k.y-=C.yOffset,(z.transformOrigin||z.svgOrigin)&&(D={},Ka(a,ga(z.transformOrigin),D,z.svgOrigin,z.smoothOrigin,!0),p=D.xOrigin,s=D.yOrigin,k.x-=D.xOffset-C.xOffset,k.y-=D.yOffset-C.yOffset),(p||s)&&(t=Oa(P,!0),k.x-=p-(p*t[0]+s*t[2]),k.y-=s-(p*t[1]+s*t[3]))),N.body.removeChild(P),k.perspective||(k.perspective=C.perspective),null!=z.xPercent&&(k.xPercent=ia(z.xPercent,C.xPercent)),null!=z.yPercent&&(k.yPercent=ia(z.yPercent,C.yPercent));else if("object"==typeof z){if(k={scaleX:ia(null!=z.scaleX?z.scaleX:z.scale,C.scaleX),scaleY:ia(null!=z.scaleY?z.scaleY:z.scale,C.scaleY),scaleZ:ia(z.scaleZ,C.scaleZ),x:ia(z.x,C.x),y:ia(z.y,C.y),z:ia(z.z,C.z),xPercent:ia(z.xPercent,C.xPercent),yPercent:ia(z.yPercent,C.yPercent),perspective:ia(z.transformPerspective,C.perspective)},o=z.directionalRotation,null!=o)if("object"==typeof o)for(l in o)z[l]=o[l];else z.rotation=o;"string"==typeof z.x&&-1!==z.x.indexOf("%")&&(k.x=0,k.xPercent=ia(z.x,C.xPercent)),"string"==typeof z.y&&-1!==z.y.indexOf("%")&&(k.y=0,k.yPercent=ia(z.y,C.yPercent)),k.rotation=ja("rotation"in z?z.rotation:"shortRotation"in z?z.shortRotation+"_short":"rotationZ"in z?z.rotationZ:C.rotation-C.skewY,C.rotation-C.skewY,"rotation",A),Ea&&(k.rotationX=ja("rotationX"in z?z.rotationX:"shortRotationX"in z?z.shortRotationX+"_short":C.rotationX||0,C.rotationX,"rotationX",A),k.rotationY=ja("rotationY"in z?z.rotationY:"shortRotationY"in z?z.shortRotationY+"_short":C.rotationY||0,C.rotationY,"rotationY",A)),k.skewX=ja(z.skewX,C.skewX-C.skewY),(k.skewY=ja(z.skewY,C.skewY))&&(k.skewX+=k.skewY,k.rotation+=k.skewY)}for(Ea&&null!=z.force3D&&(C.force3D=z.force3D,n=!0),C.skewType=z.skewType||C.skewType||g.defaultSkewType,m=C.force3D||C.z||C.rotationX||C.rotationY||k.z||k.rotationX||k.rotationY||k.perspective,m||null==z.scale||(k.scaleZ=1);--y>-1;)u=Aa[y],D=k[u]-C[u],(D>x||-x>D||null!=z[u]||null!=M[u])&&(n=!0,f=new sa(C,u,C[u],D,f),u in A&&(f.e=A[u]),f.xs0=0,f.plugin=h,d._overwriteProps.push(f.n));return D=z.transformOrigin,C.svg&&(D||z.svgOrigin)&&(p=C.xOffset,s=C.yOffset,Ka(a,ga(D),k,z.svgOrigin,z.smoothOrigin),f=ta(C,"xOrigin",(v?C:k).xOrigin,k.xOrigin,f,B),f=ta(C,"yOrigin",(v?C:k).yOrigin,k.yOrigin,f,B),(p!==C.xOffset||s!==C.yOffset)&&(f=ta(C,"xOffset",v?p:C.xOffset,C.xOffset,f,B),f=ta(C,"yOffset",v?s:C.yOffset,C.yOffset,f,B)),D=za?null:"0px 0px"),(D||Ea&&m&&C.zOrigin)&&(Ba?(n=!0,u=Da,D=(D||$(a,u,e,!1,"50% 50%"))+"",f=new sa(w,u,0,0,f,-1,B),f.b=w[u],f.plugin=h,Ea?(l=C.zOrigin,D=D.split(" "),C.zOrigin=(D.length>2&&(0===l||"0px"!==D[2])?parseFloat(D[2]):l)||0,f.xs0=f.e=D[0]+" "+(D[1]||"50%")+" 0px",f=new sa(C,"zOrigin",0,0,f,-1,f.n),f.b=l,f.xs0=f.e=C.zOrigin):f.xs0=f.e=D):ga(D+"",C)),n&&(d._transformType=C.svg&&za||!m&&3!==this._transformType?2:3),j&&(i[c]=j),f},prefix:!0}),xa("boxShadow",{defaultValue:"0px 0px 0px 0px #999",prefix:!0,color:!0,multi:!0,keyword:"inset"}),xa("borderRadius",{defaultValue:"0px",parser:function(a,b,c,f,g,h){b=this.format(b);var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],z=a.style;for(q=parseFloat(a.offsetWidth),r=parseFloat(a.offsetHeight),i=b.split(" "),j=0;jp?1:0))||""):(p=parseFloat(n),s=n.substr((p+"").length)),""===s&&(s=d[c]||t),s!==t&&(v=_(a,"borderLeft",o,t),w=_(a,"borderTop",o,t),"%"===s?(m=v/q*100+"%",l=w/r*100+"%"):"em"===s?(x=_(a,"borderLeft",1,"em"),m=v/x+"em",l=w/x+"em"):(m=v+"px",l=w+"px"),u&&(n=parseFloat(m)+p+s,k=parseFloat(l)+p+s)),g=ua(z,y[j],m+" "+l,n+" "+k,!1,"0px",g);return g},prefix:!0,formatter:pa("0px 0px 0px 0px",!1,!0)}),xa("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius",{defaultValue:"0px",parser:function(a,b,c,d,f,g){return ua(a.style,c,this.format($(a,c,e,!1,"0px 0px")),this.format(b),!1,"0px",f)},prefix:!0,formatter:pa("0px 0px",!1,!0)}),xa("backgroundPosition",{defaultValue:"0 0",parser:function(a,b,c,d,f,g){var h,i,j,k,l,m,n="background-position",o=e||Z(a,null),q=this.format((o?p?o.getPropertyValue(n+"-x")+" "+o.getPropertyValue(n+"-y"):o.getPropertyValue(n):a.currentStyle.backgroundPositionX+" "+a.currentStyle.backgroundPositionY)||"0 0"),r=this.format(b);if(-1!==q.indexOf("%")!=(-1!==r.indexOf("%"))&&r.split(",").length<2&&(m=$(a,"backgroundImage").replace(D,""),m&&"none"!==m)){for(h=q.split(" "),i=r.split(" "),Q.setAttribute("src",m),j=2;--j>-1;)q=h[j],k=-1!==q.indexOf("%"),k!==(-1!==i[j].indexOf("%"))&&(l=0===j?a.offsetWidth-Q.width:a.offsetHeight-Q.height,h[j]=k?parseFloat(q)/100*l+"px":parseFloat(q)/l*100+"%");q=h.join(" ")}return this.parseComplex(a.style,q,r,f,g)},formatter:ga}),xa("backgroundSize",{defaultValue:"0 0",formatter:function(a){return a+="",ga(-1===a.indexOf(" ")?a+" "+a:a)}}),xa("perspective",{defaultValue:"0px",prefix:!0}),xa("perspectiveOrigin",{defaultValue:"50% 50%",prefix:!0}),xa("transformStyle",{prefix:!0}),xa("backfaceVisibility",{prefix:!0}),xa("userSelect",{prefix:!0}),xa("margin",{parser:qa("marginTop,marginRight,marginBottom,marginLeft")}),xa("padding",{parser:qa("paddingTop,paddingRight,paddingBottom,paddingLeft")}),xa("clip",{defaultValue:"rect(0px,0px,0px,0px)",parser:function(a,b,c,d,f,g){var h,i,j;return 9>p?(i=a.currentStyle,j=8>p?" ":",",h="rect("+i.clipTop+j+i.clipRight+j+i.clipBottom+j+i.clipLeft+")",b=this.format(b).split(",").join(j)):(h=this.format($(a,this.p,e,!1,this.dflt)),b=this.format(b)),this.parseComplex(a.style,h,b,f,g)}}),xa("textShadow",{defaultValue:"0px 0px 0px #999",color:!0,multi:!0}),xa("autoRound,strictUnits",{parser:function(a,b,c,d,e){return e}}),xa("border",{defaultValue:"0px solid #000",parser:function(a,b,c,d,f,g){var h=$(a,"borderTopWidth",e,!1,"0px"),i=this.format(b).split(" "),j=i[0].replace(w,"");return"px"!==j&&(h=parseFloat(h)/_(a,"borderTopWidth",1,j)+j),this.parseComplex(a.style,this.format(h+" "+$(a,"borderTopStyle",e,!1,"solid")+" "+$(a,"borderTopColor",e,!1,"#000")),i.join(" "),f,g)},color:!0,formatter:function(a){var b=a.split(" ");return b[0]+" "+(b[1]||"solid")+" "+(a.match(oa)||["#000"])[0]}}),xa("borderWidth",{ parser:qa("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}),xa("float,cssFloat,styleFloat",{parser:function(a,b,c,d,e,f){var g=a.style,h="cssFloat"in g?"cssFloat":"styleFloat";return new sa(g,h,0,0,e,-1,c,!1,0,g[h],b)}});var Sa=function(a){var b,c=this.t,d=c.filter||$(this.data,"filter")||"",e=this.s+this.c*a|0;100===e&&(-1===d.indexOf("atrix(")&&-1===d.indexOf("radient(")&&-1===d.indexOf("oader(")?(c.removeAttribute("filter"),b=!$(this.data,"filter")):(c.filter=d.replace(z,""),b=!0)),b||(this.xn1&&(c.filter=d=d||"alpha(opacity="+e+")"),-1===d.indexOf("pacity")?0===e&&this.xn1||(c.filter=d+" alpha(opacity="+e+")"):c.filter=d.replace(x,"opacity="+e))};xa("opacity,alpha,autoAlpha",{defaultValue:"1",parser:function(a,b,c,d,f,g){var h=parseFloat($(a,"opacity",e,!1,"1")),i=a.style,j="autoAlpha"===c;return"string"==typeof b&&"="===b.charAt(1)&&(b=("-"===b.charAt(0)?-1:1)*parseFloat(b.substr(2))+h),j&&1===h&&"hidden"===$(a,"visibility",e)&&0!==b&&(h=0),T?f=new sa(i,"opacity",h,b-h,f):(f=new sa(i,"opacity",100*h,100*(b-h),f),f.xn1=j?1:0,i.zoom=1,f.type=2,f.b="alpha(opacity="+f.s+")",f.e="alpha(opacity="+(f.s+f.c)+")",f.data=a,f.plugin=g,f.setRatio=Sa),j&&(f=new sa(i,"visibility",0,0,f,-1,null,!1,0,0!==h?"inherit":"hidden",0===b?"hidden":"inherit"),f.xs0="inherit",d._overwriteProps.push(f.n),d._overwriteProps.push(c)),f}});var Ta=function(a,b){b&&(a.removeProperty?(("ms"===b.substr(0,2)||"webkit"===b.substr(0,6))&&(b="-"+b),a.removeProperty(b.replace(B,"-$1").toLowerCase())):a.removeAttribute(b))},Ua=function(a){if(this.t._gsClassPT=this,1===a||0===a){this.t.setAttribute("class",0===a?this.b:this.e);for(var b=this.data,c=this.t.style;b;)b.v?c[b.p]=b.v:Ta(c,b.p),b=b._next;1===a&&this.t._gsClassPT===this&&(this.t._gsClassPT=null)}else this.t.getAttribute("class")!==this.e&&this.t.setAttribute("class",this.e)};xa("className",{parser:function(a,b,d,f,g,h,i){var j,k,l,m,n,o=a.getAttribute("class")||"",p=a.style.cssText;if(g=f._classNamePT=new sa(a,d,0,0,g,2),g.setRatio=Ua,g.pr=-11,c=!0,g.b=o,k=ba(a,e),l=a._gsClassPT){for(m={},n=l.data;n;)m[n.p]=1,n=n._next;l.setRatio(1)}return a._gsClassPT=g,g.e="="!==b.charAt(1)?b:o.replace(new RegExp("(?:\\s|^)"+b.substr(2)+"(?![\\w-])"),"")+("+"===b.charAt(0)?" "+b.substr(2):""),a.setAttribute("class",g.e),j=ca(a,k,ba(a),i,m),a.setAttribute("class",o),g.data=j.firstMPT,a.style.cssText=p,g=g.xfirst=f.parse(a,j.difs,g,h)}});var Va=function(a){if((1===a||0===a)&&this.data._totalTime===this.data._totalDuration&&"isFromStart"!==this.data.data){var b,c,d,e,f,g=this.t.style,h=i.transform.parse;if("all"===this.e)g.cssText="",e=!0;else for(b=this.e.split(" ").join("").split(","),d=b.length;--d>-1;)c=b[d],i[c]&&(i[c].parse===h?e=!0:c="transformOrigin"===c?Da:i[c].p),Ta(g,c);e&&(Ta(g,Ba),f=this.t._gsTransform,f&&(f.svg&&(this.t.removeAttribute("data-svg-origin"),this.t.removeAttribute("transform")),delete this.t._gsTransform))}};for(xa("clearProps",{parser:function(a,b,d,e,f){return f=new sa(a,d,0,0,f,2),f.setRatio=Va,f.e=b,f.pr=-10,f.data=e._tween,c=!0,f}}),j="bezier,throwProps,physicsProps,physics2D".split(","),va=j.length;va--;)ya(j[va]);j=g.prototype,j._firstPT=j._lastParsedTransform=j._transform=null,j._onInitTween=function(a,b,h,j){if(!a.nodeType)return!1;this._target=q=a,this._tween=h,this._vars=b,r=j,k=b.autoRound,c=!1,d=b.suffixMap||g.suffixMap,e=Z(a,""),f=this._overwriteProps;var n,p,s,t,u,v,w,x,z,A=a.style;if(l&&""===A.zIndex&&(n=$(a,"zIndex",e),("auto"===n||""===n)&&this._addLazySet(A,"zIndex",0)),"string"==typeof b&&(t=A.cssText,n=ba(a,e),A.cssText=t+";"+b,n=ca(a,n,ba(a)).difs,!T&&y.test(b)&&(n.opacity=parseFloat(RegExp.$1)),b=n,A.cssText=t),b.className?this._firstPT=p=i.className.parse(a,b.className,"className",this,null,null,b):this._firstPT=p=this.parse(a,b,null),this._transformType){for(z=3===this._transformType,Ba?m&&(l=!0,""===A.zIndex&&(w=$(a,"zIndex",e),("auto"===w||""===w)&&this._addLazySet(A,"zIndex",0)),o&&this._addLazySet(A,"WebkitBackfaceVisibility",this._vars.WebkitBackfaceVisibility||(z?"visible":"hidden"))):A.zoom=1,s=p;s&&s._next;)s=s._next;x=new sa(a,"transform",0,0,null,2),this._linkCSSP(x,null,s),x.setRatio=Ba?Ra:Qa,x.data=this._transform||Pa(a,e,!0),x.tween=h,x.pr=-1,f.pop()}if(c){for(;p;){for(v=p._next,s=t;s&&s.pr>p.pr;)s=s._next;(p._prev=s?s._prev:u)?p._prev._next=p:t=p,(p._next=s)?s._prev=p:u=p,p=v}this._firstPT=t}return!0},j.parse=function(a,b,c,f){var g,h,j,l,m,n,o,p,s,t,u=a.style;for(g in b)n=b[g],"function"==typeof n&&(n=n(r,q)),h=i[g],h?c=h.parse(a,n,g,this,c,f,b):(m=$(a,g,e)+"",s="string"==typeof n,"color"===g||"fill"===g||"stroke"===g||-1!==g.indexOf("Color")||s&&A.test(n)?(s||(n=ma(n),n=(n.length>3?"rgba(":"rgb(")+n.join(",")+")"),c=ua(u,g,m,n,!0,"transparent",c,0,f)):s&&J.test(n)?c=ua(u,g,m,n,!0,null,c,0,f):(j=parseFloat(m),o=j||0===j?m.substr((j+"").length):"",(""===m||"auto"===m)&&("width"===g||"height"===g?(j=fa(a,g,e),o="px"):"left"===g||"top"===g?(j=aa(a,g,e),o="px"):(j="opacity"!==g?0:1,o="")),t=s&&"="===n.charAt(1),t?(l=parseInt(n.charAt(0)+"1",10),n=n.substr(2),l*=parseFloat(n),p=n.replace(w,"")):(l=parseFloat(n),p=s?n.replace(w,""):""),""===p&&(p=g in d?d[g]:o),n=l||0===l?(t?l+j:l)+p:b[g],o!==p&&""!==p&&(l||0===l)&&j&&(j=_(a,g,j,o),"%"===p?(j/=_(a,g,100,"%")/100,b.strictUnits!==!0&&(m=j+"%")):"em"===p||"rem"===p||"vw"===p||"vh"===p?j/=_(a,g,1,p):"px"!==p&&(l=_(a,g,l,p),p="px"),t&&(l||0===l)&&(n=l+j+p)),t&&(l+=j),!j&&0!==j||!l&&0!==l?void 0!==u[g]&&(n||n+""!="NaN"&&null!=n)?(c=new sa(u,g,l||j||0,0,c,-1,g,!1,0,m,n),c.xs0="none"!==n||"display"!==g&&-1===g.indexOf("Style")?n:m):V("invalid "+g+" tween value: "+b[g]):(c=new sa(u,g,j,l-j,c,0,g,k!==!1&&("px"===p||"zIndex"===g),0,m,n),c.xs0=p))),f&&c&&!c.plugin&&(c.plugin=f);return c},j.setRatio=function(a){var b,c,d,e=this._firstPT,f=1e-6;if(1!==a||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(a||this._tween._time!==this._tween._duration&&0!==this._tween._time||this._tween._rawPrevTime===-1e-6)for(;e;){if(b=e.c*a+e.s,e.r?b=Math.round(b):f>b&&b>-f&&(b=0),e.type)if(1===e.type)if(d=e.l,2===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2;else if(3===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3;else if(4===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3+e.xn3+e.xs4;else if(5===d)e.t[e.p]=e.xs0+b+e.xs1+e.xn1+e.xs2+e.xn2+e.xs3+e.xn3+e.xs4+e.xn4+e.xs5;else{for(c=e.xs0+b+e.xs1,d=1;d-1;)Xa(a[e],b,c);else for(d=a.childNodes,e=d.length;--e>-1;)f=d[e],g=f.type,f.style&&(b.push(ba(f)),c&&c.push(f)),1!==g&&9!==g&&11!==g||!f.childNodes.length||Xa(f,b,c)};return g.cascadeTo=function(a,c,d){var e,f,g,h,i=b.to(a,c,d),j=[i],k=[],l=[],m=[],n=b._internals.reservedProps;for(a=i._targets||i.target,Xa(a,k,m),i.render(c,!0,!0),Xa(a,l),i.render(0,!0,!0),i._enabled(!0),e=m.length;--e>-1;)if(f=ca(m[e],k[e],l[e]),f.firstMPT){f=f.difs;for(g in d)n[g]&&(f[g]=d[g]);h={};for(g in f)h[g]=k[e][g];j.push(b.fromTo(m[e],c,h,f))}return j},a.activate([g]),g},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(a){"use strict";var b=function(){return(_gsScope.GreenSockGlobals||_gsScope)[a]};"function"==typeof define&&define.amd?define(["TweenLite"],b):"undefined"!=typeof module&&module.exports&&(require("../TweenLite.js"),module.exports=b())}("CSSPlugin"); ================================================ FILE: gsap/GreenSock Animation Platform (GSAP) Speed Test_files/Ease.js.download ================================================ /* * Ease by Grant Skinner. Oct 27, 2011 * Visit http://easeljs.com/ for documentation, updates and examples. * * Equations derived from work by Robert Penner. * * Copyright (c) 2011 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * The Tween Javascript library provides a retained graphics mode for canvas * including a full, hierarchical display list, a core interaction model, and * helper classes to make working with Canvas much easier. * @module TweenJS **/ (function(window) { // constructor: /** * The Ease class provides a collection of easing functions for use with TweenJS. * It does not use the standard 4 param easing signature. Instead it uses a single param * which indicates the current linear ratio (0 to 1) of the tween.
*
* Most methods on Ease can be passed directly as easing functions:
* Tween.get(target).to({x:100}, 500, Ease.linear);
*
* However, methods beginning with "get" will return an easing function based on parameter values:
* Tween.get(target).to({y:200}, 500, Ease.getPowIn(2.2));
*
* Equations derived from work by Robert Penner. * @class Ease * @static **/ var Ease = function() { throw "Ease cannot be instantiated."; } // public static methods: /** * @method linear * @static **/ Ease.linear = function(t) { return t; } /** * Identical to linear. * @method none * @static **/ Ease.none = Ease.linear; /** * Mimics the simple -100 to 100 easing in Flash Pro. * @method get * @param amount A value from -1 (ease in) to 1 (ease out) indicating the strength and direction of the ease. * @static **/ Ease.get = function(amount) { if (amount < -1) { amount = -1; } if (amount > 1) { amount = 1; } return function(t) { if (amount==0) { return t; } if (amount<0) { return t*(t*-amount+1+amount); } return t*((2-t)*amount+(1-amount)); } } /** * Configurable exponential ease. * @method getPowIn * @param pow The exponent to use (ex. 3 would return a cubic ease). * @static **/ Ease.getPowIn = function(pow) { return function(t) { return Math.pow(t,pow); } } /** * Configurable exponential ease. * @method getPowOut * @param pow The exponent to use (ex. 3 would return a cubic ease). * @static **/ Ease.getPowOut = function(pow) { return function(t) { return 1-Math.pow(1-t,pow); } } /** * Configurable exponential ease. * @method getPowInOut * @param pow The exponent to use (ex. 3 would return a cubic ease). * @static **/ Ease.getPowInOut = function(pow) { return function(t) { if ((t*=2)<1) return 0.5*Math.pow(t,pow); return 1-0.5*Math.abs(Math.pow(2-t,pow)); } } /** * @method quadIn * @static **/ Ease.quadIn = Ease.getPowIn(2); /** * @method quadOut * @static **/ Ease.quadOut = Ease.getPowOut(2); /** * @method quadInOut * @static **/ Ease.quadInOut = Ease.getPowInOut(2); /** * @method cubicIn * @static **/ Ease.cubicIn = Ease.getPowIn(3); /** * @method cubicOut * @static **/ Ease.cubicOut = Ease.getPowOut(3); /** * @method cubicInOut * @static **/ Ease.cubicInOut = Ease.getPowInOut(3); /** * @method quartIn * @static **/ Ease.quartIn = Ease.getPowIn(4); /** * @method quartOut * @static **/ Ease.quartOut = Ease.getPowOut(4); /** * @method quartInOut * @static **/ Ease.quartInOut = Ease.getPowInOut(4); /** * @method quintIn * @static **/ Ease.quintIn = Ease.getPowIn(5); /** * @method quintOut * @static **/ Ease.quintOut = Ease.getPowOut(5); /** * @method quintInOut * @static **/ Ease.quintInOut = Ease.getPowInOut(5); /** * @method sineIn * @static **/ Ease.sineIn = function(t) { return 1-Math.cos(t*Math.PI/2); } /** * @method sineOut * @static **/ Ease.sineOut = function(t) { return Math.sin(t*Math.PI/2); } /** * @method sineInOut * @static **/ Ease.sineInOut = function(t) { return -0.5*(Math.cos(Math.PI*t) - 1) } /** * Configurable "back in" ease. * @method getBackIn * @param amount The strength of the ease. * @static **/ Ease.getBackIn = function(amount) { return function(t) { return t*t*((amount+1)*t-amount); } } /** * @method backIn * @static **/ Ease.backIn = Ease.getBackIn(1.7); /** * Configurable "back out" ease. * @method getBackOut * @param amount The strength of the ease. * @static **/ Ease.getBackOut = function(amount) { return function(t) { return (--t*t*((amount+1)*t + amount) + 1); } } /** * @method backOut * @static **/ Ease.backOut = Ease.getBackOut(1.7); /** * Configurable "back in out" ease. * @method getBackInOut * @param amount The strength of the ease. * @static **/ Ease.getBackInOut = function(amount) { amount*=1.525; return function(t) { if ((t*=2)<1) return 0.5*(t*t*((amount+1)*t-amount)); return 0.5*((t-=2)*t*((amount+1)*t+amount)+2); } } /** * @method backInOut * @static **/ Ease.backInOut = Ease.getBackInOut(1.7); /** * @method circIn * @static **/ Ease.circIn = function(t) { return -(Math.sqrt(1-t*t)- 1); } /** * @method circOut * @static **/ Ease.circOut = function(t) { return Math.sqrt(1-(--t)*t); } /** * @method circInOut * @static **/ Ease.circInOut = function(t) { if ((t*=2) < 1) return -0.5*(Math.sqrt(1-t*t)-1); return 0.5*(Math.sqrt(1-(t-=2)*t)+1); } /** * @method bounceIn * @static **/ Ease.bounceIn = function(t) { return 1-Ease.bounceOut(1-t); } /** * @method bounceOut * @static **/ Ease.bounceOut = function(t) { if (t < 1/2.75) { return (7.5625*t*t); } else if (t < 2/2.75) { return (7.5625*(t-=1.5/2.75)*t+0.75); } else if (t < 2.5/2.75) { return (7.5625*(t-=2.25/2.75)*t+0.9375); } else { return (7.5625*(t-=2.625/2.75)*t +0.984375); } } /** * @method bounceInOut * @static **/ Ease.bounceInOut = function(t) { if (t<0.5) return Ease.bounceIn (t*2) * .5; return Ease.bounceOut(t*2-1)*0.5+0.5; } /** * Configurable elastic ease. * @method getElasticIn * @param amplitude * @param period * @static **/ Ease.getElasticIn = function(amplitude,period) { var pi2 = Math.PI*2; return function(t) { if (t==0 || t==1) return t; var s = period/pi2*Math.asin(1/amplitude); return -(amplitude*Math.pow(2,10*(t-=1))*Math.sin((t-s)*pi2/period)); } } /** * @method elasticIn * @static **/ Ease.elasticIn = Ease.getElasticIn(1,0.3); /** * Configurable elastic ease. * @method getElasticOut * @param amplitude * @param period * @static **/ Ease.getElasticOut = function(amplitude,period) { var pi2 = Math.PI*2; return function(t) { if (t==0 || t==1) return t; var s = period/pi2 * Math.asin(1/amplitude); return (amplitude*Math.pow(2,-10*t)*Math.sin((t-s)*pi2/period )+1); } } /** * @method elasticOut * @static **/ Ease.elasticOut = Ease.getElasticOut(1,0.3); /** * Configurable elastic ease. * @method getElasticInOut * @param amplitude * @param period * @static **/ Ease.getElasticInOut = function(amplitude,period) { var pi2 = Math.PI*2; return function(t) { var s = period/pi2 * Math.asin(1/amplitude); if ((t*=2)<1) return -0.5*(amplitude*Math.pow(2,10*(t-=1))*Math.sin( (t-s)*pi2/period )); return amplitude*Math.pow(2,-10*(t-=1))*Math.sin((t-s)*pi2/period)*0.5+1; } } /** * @method elasticInOut * @static **/ Ease.elasticInOut = Ease.getElasticInOut(1,0.3*1.5); window.Ease = Ease; }(window)); ================================================ FILE: gsap/GreenSock Animation Platform (GSAP) Speed Test_files/TweenLite.min.js.download ================================================ /*! * VERSION: 1.19.0 * DATE: 2016-07-16 * UPDATES AND DOCS AT: http://greensock.com * * @license Copyright (c) 2008-2016, 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 */ !function(a,b){"use strict";var c={},d=a.GreenSockGlobals=a.GreenSockGlobals||a;if(!d.TweenLite){var e,f,g,h,i,j=function(a){var b,c=a.split("."),e=d;for(b=0;b-1;)(l=p[f[s]]||new q(f[s],[])).gsClass?(i[s]=l.gsClass,t--):k&&l.sc.push(this);if(0===t&&g){if(m=("com.greensock."+e).split("."),n=m.pop(),o=j(m.join("."))[n]=this.gsClass=g.apply(g,i),h)if(d[n]=c[n]=o,r="undefined"!=typeof module&&module.exports,!r&&"function"==typeof define&&define.amd)define((a.GreenSockAMDPath?a.GreenSockAMDPath+"/":"")+e.split(".").pop(),[],function(){return o});else if(r)if(e===b){module.exports=c[b]=o;for(s in c)o[s]=c[s]}else c[b]&&(c[b][n]=o);for(s=0;s-1;)for(f=i[j],e=d?s("easing."+f,null,!0):k.easing[f]||{},g=l.length;--g>-1;)h=l[g],v[f+"."+h]=v[h+f]=e[h]=a.getRatio?a:a[h]||new a};for(g=u.prototype,g._calcEnd=!1,g.getRatio=function(a){if(this._func)return this._params[0]=a,this._func.apply(null,this._params);var b=this._type,c=this._power,d=1===b?1-a:2===b?a:.5>a?2*a:2*(1-a);return 1===c?d*=d:2===c?d*=d*d:3===c?d*=d*d*d:4===c&&(d*=d*d*d*d),1===b?1-d:2===b?d:.5>a?d/2:1-d/2},e=["Linear","Quad","Cubic","Quart","Quint,Strong"],f=e.length;--f>-1;)g=e[f]+",Power"+f,w(new u(null,null,1,f),g,"easeOut",!0),w(new u(null,null,2,f),g,"easeIn"+(0===f?",easeNone":"")),w(new u(null,null,3,f),g,"easeInOut");v.linear=k.easing.Linear.easeIn,v.swing=k.easing.Quad.easeInOut;var x=s("events.EventDispatcher",function(a){this._listeners={},this._eventTarget=a||this});g=x.prototype,g.addEventListener=function(a,b,c,d,e){e=e||0;var f,g,j=this._listeners[a],k=0;for(this!==h||i||h.wake(),null==j&&(this._listeners[a]=j=[]),g=j.length;--g>-1;)f=j[g],f.c===b&&f.s===c?j.splice(g,1):0===k&&f.pr-1;)if(d[c].c===b)return void d.splice(c,1)},g.dispatchEvent=function(a){var b,c,d,e=this._listeners[a];if(e)for(b=e.length,b>1&&(e=e.slice(0)),c=this._eventTarget;--b>-1;)d=e[b],d&&(d.up?d.c.call(d.s||c,{type:a,target:c}):d.c.call(d.s||c))};var y=a.requestAnimationFrame,z=a.cancelAnimationFrame,A=Date.now||function(){return(new Date).getTime()},B=A();for(e=["ms","moz","webkit","o"],f=e.length;--f>-1&&!y;)y=a[e[f]+"RequestAnimationFrame"],z=a[e[f]+"CancelAnimationFrame"]||a[e[f]+"CancelRequestAnimationFrame"];s("Ticker",function(a,b){var c,d,e,f,g,j=this,k=A(),m=b!==!1&&y?"auto":!1,o=500,p=33,q="tick",r=function(a){var b,h,i=A()-B;i>o&&(k+=i-p),B+=i,j.time=(B-k)/1e3,b=j.time-g,(!c||b>0||a===!0)&&(j.frame++,g+=b+(b>=f?.004:f-b),h=!0),a!==!0&&(e=d(r)),h&&j.dispatchEvent(q)};x.call(j),j.time=j.frame=0,j.tick=function(){r(!0)},j.lagSmoothing=function(a,b){o=a||1/l,p=Math.min(b,o,0)},j.sleep=function(){null!=e&&(m&&z?z(e):clearTimeout(e),d=n,e=null,j===h&&(i=!1))},j.wake=function(a){null!==e?j.sleep():a?k+=-B+(B=A()):j.frame>10&&(B=A()-o+5),d=0===c?n:m&&y?y:function(a){return setTimeout(a,1e3*(g-j.time)+1|0)},j===h&&(i=!0),r(2)},j.fps=function(a){return arguments.length?(c=a,f=1/(c||60),g=this.time+f,void j.wake()):c},j.useRAF=function(a){return arguments.length?(j.sleep(),m=a,void j.fps(c)):m},j.fps(a),setTimeout(function(){"auto"===m&&j.frame<5&&"hidden"!==document.visibilityState&&j.useRAF(!1)},1500)}),g=k.Ticker.prototype=new k.events.EventDispatcher,g.constructor=k.Ticker;var C=s("core.Animation",function(a,b){if(this.vars=b=b||{},this._duration=this._totalDuration=a||0,this._delay=Number(b.delay)||0,this._timeScale=1,this._active=b.immediateRender===!0,this.data=b.data,this._reversed=b.reversed===!0,V){i||h.wake();var c=this.vars.useFrames?U:V;c.add(this,c._time),this.vars.paused&&this.paused(!0)}});h=C.ticker=new k.Ticker,g=C.prototype,g._dirty=g._gc=g._initted=g._paused=!1,g._totalTime=g._time=0,g._rawPrevTime=-1,g._next=g._last=g._onUpdate=g._timeline=g.timeline=null,g._paused=!1;var D=function(){i&&A()-B>2e3&&h.wake(),setTimeout(D,2e3)};D(),g.play=function(a,b){return null!=a&&this.seek(a,b),this.reversed(!1).paused(!1)},g.pause=function(a,b){return null!=a&&this.seek(a,b),this.paused(!0)},g.resume=function(a,b){return null!=a&&this.seek(a,b),this.paused(!1)},g.seek=function(a,b){return this.totalTime(Number(a),b!==!1)},g.restart=function(a,b){return this.reversed(!1).paused(!1).totalTime(a?-this._delay:0,b!==!1,!0)},g.reverse=function(a,b){return null!=a&&this.seek(a||this.totalDuration(),b),this.reversed(!0).paused(!1)},g.render=function(a,b,c){},g.invalidate=function(){return this._time=this._totalTime=0,this._initted=this._gc=!1,this._rawPrevTime=-1,(this._gc||!this.timeline)&&this._enabled(!0),this},g.isActive=function(){var a,b=this._timeline,c=this._startTime;return!b||!this._gc&&!this._paused&&b.isActive()&&(a=b.rawTime())>=c&&a-1;)"{self}"===a[b]&&(c[b]=this);return c},g._callback=function(a){var b=this.vars,c=b[a],d=b[a+"Params"],e=b[a+"Scope"]||b.callbackScope||this,f=d?d.length:0;switch(f){case 0:c.call(e);break;case 1:c.call(e,d[0]);break;case 2:c.call(e,d[0],d[1]);break;default:c.apply(e,d)}},g.eventCallback=function(a,b,c,d){if("on"===(a||"").substr(0,2)){var e=this.vars;if(1===arguments.length)return e[a];null==b?delete e[a]:(e[a]=b,e[a+"Params"]=o(c)&&-1!==c.join("").indexOf("{self}")?this._swapSelfInParams(c):c,e[a+"Scope"]=d),"onUpdate"===a&&(this._onUpdate=b)}return this},g.delay=function(a){return arguments.length?(this._timeline.smoothChildTiming&&this.startTime(this._startTime+a-this._delay),this._delay=a,this):this._delay},g.duration=function(a){return arguments.length?(this._duration=this._totalDuration=a,this._uncache(!0),this._timeline.smoothChildTiming&&this._time>0&&this._timethis._duration?this._duration:a,b)):this._time},g.totalTime=function(a,b,c){if(i||h.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(0>a&&!c&&(a+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var d=this._totalDuration,e=this._timeline;if(a>d&&!c&&(a=d),this._startTime=(this._paused?this._pauseTime:e._time)-(this._reversed?d-a:a)/this._timeScale,e._dirty||this._uncache(!1),e._timeline)for(;e._timeline;)e._timeline._time!==(e._startTime+e._totalTime)/e._timeScale&&e.totalTime(e._totalTime,!0),e=e._timeline}this._gc&&this._enabled(!0,!1),(this._totalTime!==a||0===this._duration)&&(I.length&&X(),this.render(a,b,!1),I.length&&X())}return this},g.progress=g.totalProgress=function(a,b){var c=this.duration();return arguments.length?this.totalTime(c*a,b):c?this._time/c:this.ratio},g.startTime=function(a){return arguments.length?(a!==this._startTime&&(this._startTime=a,this.timeline&&this.timeline._sortChildren&&this.timeline.add(this,a-this._delay)),this):this._startTime},g.endTime=function(a){return this._startTime+(0!=a?this.totalDuration():this.duration())/this._timeScale},g.timeScale=function(a){if(!arguments.length)return this._timeScale;if(a=a||l,this._timeline&&this._timeline.smoothChildTiming){var b=this._pauseTime,c=b||0===b?b:this._timeline.totalTime();this._startTime=c-(c-this._startTime)*this._timeScale/a}return this._timeScale=a,this._uncache(!1)},g.reversed=function(a){return arguments.length?(a!=this._reversed&&(this._reversed=a,this.totalTime(this._timeline&&!this._timeline.smoothChildTiming?this.totalDuration()-this._totalTime:this._totalTime,!0)),this):this._reversed},g.paused=function(a){if(!arguments.length)return this._paused;var b,c,d=this._timeline;return a!=this._paused&&d&&(i||a||h.wake(),b=d.rawTime(),c=b-this._pauseTime,!a&&d.smoothChildTiming&&(this._startTime+=c,this._uncache(!1)),this._pauseTime=a?b:null,this._paused=a,this._active=this.isActive(),!a&&0!==c&&this._initted&&this.duration()&&(b=d.smoothChildTiming?this._totalTime:(b-this._startTime)/this._timeScale,this.render(b,b===this._totalTime,!0))),this._gc&&!a&&this._enabled(!0,!1),this};var E=s("core.SimpleTimeline",function(a){C.call(this,0,a),this.autoRemoveChildren=this.smoothChildTiming=!0});g=E.prototype=new C,g.constructor=E,g.kill()._gc=!1,g._first=g._last=g._recent=null,g._sortChildren=!1,g.add=g.insert=function(a,b,c,d){var e,f;if(a._startTime=Number(b||0)+a._delay,a._paused&&this!==a._timeline&&(a._pauseTime=a._startTime+(this.rawTime()-a._startTime)/a._timeScale),a.timeline&&a.timeline._remove(a,!0),a.timeline=a._timeline=this,a._gc&&a._enabled(!0,!0),e=this._last,this._sortChildren)for(f=a._startTime;e&&e._startTime>f;)e=e._prev;return e?(a._next=e._next,e._next=a):(a._next=this._first,this._first=a),a._next?a._next._prev=a:this._last=a,a._prev=e,this._recent=a,this._timeline&&this._uncache(!0),this},g._remove=function(a,b){return a.timeline===this&&(b||a._enabled(!1,!0),a._prev?a._prev._next=a._next:this._first===a&&(this._first=a._next),a._next?a._next._prev=a._prev:this._last===a&&(this._last=a._prev),a._next=a._prev=a.timeline=null,a===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},g.render=function(a,b,c){var d,e=this._first;for(this._totalTime=this._time=this._rawPrevTime=a;e;)d=e._next,(e._active||a>=e._startTime&&!e._paused)&&(e._reversed?e.render((e._dirty?e.totalDuration():e._totalDuration)-(a-e._startTime)*e._timeScale,b,c):e.render((a-e._startTime)*e._timeScale,b,c)),e=d},g.rawTime=function(){return i||h.wake(),this._totalTime};var F=s("TweenLite",function(b,c,d){if(C.call(this,c,d),this.render=F.prototype.render,null==b)throw"Cannot tween a null target.";this.target=b="string"!=typeof b?b:F.selector(b)||b;var e,f,g,h=b.jquery||b.length&&b!==a&&b[0]&&(b[0]===a||b[0].nodeType&&b[0].style&&!b.nodeType),i=this.vars.overwrite;if(this._overwrite=i=null==i?T[F.defaultOverwrite]:"number"==typeof i?i>>0:T[i],(h||b instanceof Array||b.push&&o(b))&&"number"!=typeof b[0])for(this._targets=g=m(b),this._propLookup=[],this._siblings=[],e=0;e1&&$(f,this,null,1,this._siblings[e])):(f=g[e--]=F.selector(f),"string"==typeof f&&g.splice(e+1,1)):g.splice(e--,1);else this._propLookup={},this._siblings=Y(b,this,!1),1===i&&this._siblings.length>1&&$(b,this,null,1,this._siblings);(this.vars.immediateRender||0===c&&0===this._delay&&this.vars.immediateRender!==!1)&&(this._time=-l,this.render(Math.min(0,-this._delay)))},!0),G=function(b){return b&&b.length&&b!==a&&b[0]&&(b[0]===a||b[0].nodeType&&b[0].style&&!b.nodeType)},H=function(a,b){var c,d={};for(c in a)S[c]||c in b&&"transform"!==c&&"x"!==c&&"y"!==c&&"width"!==c&&"height"!==c&&"className"!==c&&"border"!==c||!(!P[c]||P[c]&&P[c]._autoCSS)||(d[c]=a[c],delete a[c]);a.css=d};g=F.prototype=new C,g.constructor=F,g.kill()._gc=!1,g.ratio=0,g._firstPT=g._targets=g._overwrittenProps=g._startAt=null,g._notifyPluginsOfEnabled=g._lazy=!1,F.version="1.19.0",F.defaultEase=g._ease=new u(null,null,1,1),F.defaultOverwrite="auto",F.ticker=h,F.autoSleep=120,F.lagSmoothing=function(a,b){h.lagSmoothing(a,b)},F.selector=a.$||a.jQuery||function(b){var c=a.$||a.jQuery;return c?(F.selector=c,c(b)):"undefined"==typeof document?b:document.querySelectorAll?document.querySelectorAll(b):document.getElementById("#"===b.charAt(0)?b.substr(1):b)};var I=[],J={},K=/(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,L=function(a){for(var b,c=this._firstPT,d=1e-6;c;)b=c.blob?a?this.join(""):this.start:c.c*a+c.s,c.m?b=c.m(b,this._target||c.t):d>b&&b>-d&&(b=0),c.f?c.fp?c.t[c.p](c.fp,b):c.t[c.p](b):c.t[c.p]=b,c=c._next},M=function(a,b,c,d){var e,f,g,h,i,j,k,l=[a,b],m=0,n="",o=0;for(l.start=a,c&&(c(l),a=l[0],b=l[1]),l.length=0,e=a.match(K)||[],f=b.match(K)||[],d&&(d._next=null,d.blob=1,l._firstPT=l._applyPT=d),i=f.length,h=0;i>h;h++)k=f[h],j=b.substr(m,b.indexOf(k,m)-m),n+=j||!h?j:",",m+=j.length,o?o=(o+1)%5:"rgba("===j.substr(-5)&&(o=1),k===e[h]||e.length<=h?n+=k:(n&&(l.push(n),n=""),g=parseFloat(e[h]),l.push(g),l._firstPT={_next:l._firstPT,t:l,p:l.length-1,s:g,c:("="===k.charAt(1)?parseInt(k.charAt(0)+"1",10)*parseFloat(k.substr(2)):parseFloat(k)-g)||0,f:0,m:o&&4>o?Math.round:0}),m+=k.length;return n+=b.substr(m),n&&l.push(n),l.setRatio=L,l},N=function(a,b,c,d,e,f,g,h,i){"function"==typeof d&&(d=d(i||0,a));var j,k,l="get"===c?a[b]:c,m=typeof a[b],n="string"==typeof d&&"="===d.charAt(1),o={t:a,p:b,s:l,f:"function"===m,pg:0,n:e||b,m:f?"function"==typeof f?f:Math.round:0,pr:0,c:n?parseInt(d.charAt(0)+"1",10)*parseFloat(d.substr(2)):parseFloat(d)-l||0};return"number"!==m&&("function"===m&&"get"===c&&(k=b.indexOf("set")||"function"!=typeof a["get"+b.substr(3)]?b:"get"+b.substr(3),o.s=l=g?a[k](g):a[k]()),"string"==typeof l&&(g||isNaN(l))?(o.fp=g,j=M(l,d,h||F.defaultStringFilter,o),o={t:j,p:"setRatio",s:0,c:1,f:2,pg:0,n:e||b,pr:0,m:0}):n||(o.s=parseFloat(l),o.c=parseFloat(d)-o.s||0)),o.c?((o._next=this._firstPT)&&(o._next._prev=o),this._firstPT=o,o):void 0},O=F._internals={isArray:o,isSelector:G,lazyTweens:I,blobDif:M},P=F._plugins={},Q=O.tweenLookup={},R=0,S=O.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},T={none:0,all:1,auto:2,concurrent:3,allOnStart:4,preexisting:5,"true":1,"false":0},U=C._rootFramesTimeline=new E,V=C._rootTimeline=new E,W=30,X=O.lazyRender=function(){var a,b=I.length;for(J={};--b>-1;)a=I[b],a&&a._lazy!==!1&&(a.render(a._lazy[0],a._lazy[1],!0),a._lazy=!1);I.length=0};V._startTime=h.time,U._startTime=h.frame,V._active=U._active=!0,setTimeout(X,1),C._updateRoot=F.render=function(){var a,b,c;if(I.length&&X(),V.render((h.time-V._startTime)*V._timeScale,!1,!1),U.render((h.frame-U._startTime)*U._timeScale,!1,!1),I.length&&X(),h.frame>=W){W=h.frame+(parseInt(F.autoSleep,10)||120);for(c in Q){for(b=Q[c].tweens,a=b.length;--a>-1;)b[a]._gc&&b.splice(a,1);0===b.length&&delete Q[c]}if(c=V._first,(!c||c._paused)&&F.autoSleep&&!U._first&&1===h._listeners.tick.length){for(;c&&c._paused;)c=c._next;c||h.sleep()}}},h.addEventListener("tick",C._updateRoot);var Y=function(a,b,c){var d,e,f=a._gsTweenID;if(Q[f||(a._gsTweenID=f="t"+R++)]||(Q[f]={target:a,tweens:[]}),b&&(d=Q[f].tweens,d[e=d.length]=b,c))for(;--e>-1;)d[e]===b&&d.splice(e,1);return Q[f].tweens},Z=function(a,b,c,d){var e,f,g=a.vars.onOverwrite;return g&&(e=g(a,b,c,d)),g=F.onOverwrite,g&&(f=g(a,b,c,d)),e!==!1&&f!==!1},$=function(a,b,c,d,e){var f,g,h,i;if(1===d||d>=4){for(i=e.length,f=0;i>f;f++)if((h=e[f])!==b)h._gc||h._kill(null,a,b)&&(g=!0);else if(5===d)break;return g}var j,k=b._startTime+l,m=[],n=0,o=0===b._duration;for(f=e.length;--f>-1;)(h=e[f])===b||h._gc||h._paused||(h._timeline!==b._timeline?(j=j||_(b,0,o),0===_(h,j,o)&&(m[n++]=h)):h._startTime<=k&&h._startTime+h.totalDuration()/h._timeScale>k&&((o||!h._initted)&&k-h._startTime<=2e-10||(m[n++]=h)));for(f=n;--f>-1;)if(h=m[f],2===d&&h._kill(c,a,b)&&(g=!0),2!==d||!h._firstPT&&h._initted){if(2!==d&&!Z(h,b))continue;h._enabled(!1,!1)&&(g=!0)}return g},_=function(a,b,c){for(var d=a._timeline,e=d._timeScale,f=a._startTime;d._timeline;){if(f+=d._startTime,e*=d._timeScale,d._paused)return-100;d=d._timeline}return f/=e,f>b?f-b:c&&f===b||!a._initted&&2*l>f-b?l:(f+=a.totalDuration()/a._timeScale/e)>b+l?0:f-b-l};g._init=function(){var a,b,c,d,e,f,g=this.vars,h=this._overwrittenProps,i=this._duration,j=!!g.immediateRender,k=g.ease;if(g.startAt){this._startAt&&(this._startAt.render(-1,!0),this._startAt.kill()),e={};for(d in g.startAt)e[d]=g.startAt[d];if(e.overwrite=!1,e.immediateRender=!0,e.lazy=j&&g.lazy!==!1,e.startAt=e.delay=null,this._startAt=F.to(this.target,0,e),j)if(this._time>0)this._startAt=null;else if(0!==i)return}else if(g.runBackwards&&0!==i)if(this._startAt)this._startAt.render(-1,!0),this._startAt.kill(),this._startAt=null;else{0!==this._time&&(j=!1),c={};for(d in g)S[d]&&"autoCSS"!==d||(c[d]=g[d]);if(c.overwrite=0,c.data="isFromStart",c.lazy=j&&g.lazy!==!1,c.immediateRender=j,this._startAt=F.to(this.target,0,c),j){if(0===this._time)return}else this._startAt._init(),this._startAt._enabled(!1),this.vars.immediateRender&&(this._startAt=null)}if(this._ease=k=k?k instanceof u?k:"function"==typeof k?new u(k,g.easeParams):v[k]||F.defaultEase:F.defaultEase,g.easeParams instanceof Array&&k.config&&(this._ease=k.config.apply(k,g.easeParams)),this._easeType=this._ease._type,this._easePower=this._ease._power,this._firstPT=null,this._targets)for(f=this._targets.length,a=0;f>a;a++)this._initProps(this._targets[a],this._propLookup[a]={},this._siblings[a],h?h[a]:null,a)&&(b=!0);else b=this._initProps(this.target,this._propLookup,this._siblings,h,0);if(b&&F._onPluginEvent("_onInitAllProps",this),h&&(this._firstPT||"function"!=typeof this.target&&this._enabled(!1,!1)),g.runBackwards)for(c=this._firstPT;c;)c.s+=c.c,c.c=-c.c,c=c._next;this._onUpdate=g.onUpdate,this._initted=!0},g._initProps=function(b,c,d,e,f){var g,h,i,j,k,l;if(null==b)return!1;J[b._gsTweenID]&&X(),this.vars.css||b.style&&b!==a&&b.nodeType&&P.css&&this.vars.autoCSS!==!1&&H(this.vars,b);for(g in this.vars)if(l=this.vars[g],S[g])l&&(l instanceof Array||l.push&&o(l))&&-1!==l.join("").indexOf("{self}")&&(this.vars[g]=l=this._swapSelfInParams(l,this));else if(P[g]&&(j=new P[g])._onInitTween(b,this.vars[g],this,f)){for(this._firstPT=k={_next:this._firstPT,t:j,p:"setRatio",s:0,c:1,f:1,n:g,pg:1,pr:j._priority,m:0},h=j._overwriteProps.length;--h>-1;)c[j._overwriteProps[h]]=this._firstPT;(j._priority||j._onInitAllProps)&&(i=!0),(j._onDisable||j._onEnable)&&(this._notifyPluginsOfEnabled=!0),k._next&&(k._next._prev=k)}else c[g]=N.call(this,b,g,"get",l,g,0,null,this.vars.stringFilter,f);return e&&this._kill(e,b)?this._initProps(b,c,d,e,f):this._overwrite>1&&this._firstPT&&d.length>1&&$(b,this,c,this._overwrite,d)?(this._kill(c,b),this._initProps(b,c,d,e,f)):(this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration)&&(J[b._gsTweenID]=!0),i)},g.render=function(a,b,c){var d,e,f,g,h=this._time,i=this._duration,j=this._rawPrevTime;if(a>=i-1e-7)this._totalTime=this._time=i,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1,this._reversed||(d=!0,e="onComplete",c=c||this._timeline.autoRemoveChildren),0===i&&(this._initted||!this.vars.lazy||c)&&(this._startTime===this._timeline._duration&&(a=0),(0>j||0>=a&&a>=-1e-7||j===l&&"isPause"!==this.data)&&j!==a&&(c=!0,j>l&&(e="onReverseComplete")),this._rawPrevTime=g=!b||a||j===a?a:l);else if(1e-7>a)this._totalTime=this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==h||0===i&&j>0)&&(e="onReverseComplete",d=this._reversed),0>a&&(this._active=!1,0===i&&(this._initted||!this.vars.lazy||c)&&(j>=0&&(j!==l||"isPause"!==this.data)&&(c=!0),this._rawPrevTime=g=!b||a||j===a?a:l)),this._initted||(c=!0);else if(this._totalTime=this._time=a,this._easeType){var k=a/i,m=this._easeType,n=this._easePower;(1===m||3===m&&k>=.5)&&(k=1-k),3===m&&(k*=2),1===n?k*=k:2===n?k*=k*k:3===n?k*=k*k*k:4===n&&(k*=k*k*k*k),1===m?this.ratio=1-k:2===m?this.ratio=k:.5>a/i?this.ratio=k/2:this.ratio=1-k/2}else this.ratio=this._ease.getRatio(a/i);if(this._time!==h||c){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!c&&this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration))return this._time=this._totalTime=h,this._rawPrevTime=j,I.push(this),void(this._lazy=[a,b]);this._time&&!d?this.ratio=this._ease.getRatio(this._time/i):d&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(this._lazy!==!1&&(this._lazy=!1),this._active||!this._paused&&this._time!==h&&a>=0&&(this._active=!0),0===h&&(this._startAt&&(a>=0?this._startAt.render(a,b,c):e||(e="_dummyGS")),this.vars.onStart&&(0!==this._time||0===i)&&(b||this._callback("onStart"))),f=this._firstPT;f;)f.f?f.t[f.p](f.c*this.ratio+f.s):f.t[f.p]=f.c*this.ratio+f.s,f=f._next;this._onUpdate&&(0>a&&this._startAt&&a!==-1e-4&&this._startAt.render(a,b,c),b||(this._time!==h||d||c)&&this._callback("onUpdate")),e&&(!this._gc||c)&&(0>a&&this._startAt&&!this._onUpdate&&a!==-1e-4&&this._startAt.render(a,b,c),d&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!b&&this.vars[e]&&this._callback(e),0===i&&this._rawPrevTime===l&&g!==l&&(this._rawPrevTime=0))}},g._kill=function(a,b,c){if("all"===a&&(a=null),null==a&&(null==b||b===this.target))return this._lazy=!1,this._enabled(!1,!1);b="string"!=typeof b?b||this._targets||this.target:F.selector(b)||b;var d,e,f,g,h,i,j,k,l,m=c&&this._time&&c._startTime===this._startTime&&this._timeline===c._timeline;if((o(b)||G(b))&&"number"!=typeof b[0])for(d=b.length;--d>-1;)this._kill(a,b[d],c)&&(i=!0);else{if(this._targets){for(d=this._targets.length;--d>-1;)if(b===this._targets[d]){h=this._propLookup[d]||{},this._overwrittenProps=this._overwrittenProps||[],e=this._overwrittenProps[d]=a?this._overwrittenProps[d]||{}:"all";break}}else{if(b!==this.target)return!1;h=this._propLookup,e=this._overwrittenProps=a?this._overwrittenProps||{}:"all"}if(h){if(j=a||h,k=a!==e&&"all"!==e&&a!==h&&("object"!=typeof a||!a._tempKill),c&&(F.onOverwrite||this.vars.onOverwrite)){for(f in j)h[f]&&(l||(l=[]),l.push(f));if((l||!a)&&!Z(this,c,b,l))return!1}for(f in j)(g=h[f])&&(m&&(g.f?g.t[g.p](g.s):g.t[g.p]=g.s,i=!0),g.pg&&g.t._kill(j)&&(i=!0),g.pg&&0!==g.t._overwriteProps.length||(g._prev?g._prev._next=g._next:g===this._firstPT&&(this._firstPT=g._next),g._next&&(g._next._prev=g._prev),g._next=g._prev=null),delete h[f]),k&&(e[f]=1);!this._firstPT&&this._initted&&this._enabled(!1,!1)}}return i},g.invalidate=function(){return this._notifyPluginsOfEnabled&&F._onPluginEvent("_onDisable",this),this._firstPT=this._overwrittenProps=this._startAt=this._onUpdate=null,this._notifyPluginsOfEnabled=this._active=this._lazy=!1,this._propLookup=this._targets?{}:[],C.prototype.invalidate.call(this),this.vars.immediateRender&&(this._time=-l,this.render(Math.min(0,-this._delay))),this},g._enabled=function(a,b){if(i||h.wake(),a&&this._gc){var c,d=this._targets;if(d)for(c=d.length;--c>-1;)this._siblings[c]=Y(d[c],this,!0);else this._siblings=Y(this.target,this,!0)}return C.prototype._enabled.call(this,a,b),this._notifyPluginsOfEnabled&&this._firstPT?F._onPluginEvent(a?"_onEnable":"_onDisable",this):!1},F.to=function(a,b,c){return new F(a,b,c)},F.from=function(a,b,c){return c.runBackwards=!0,c.immediateRender=0!=c.immediateRender,new F(a,b,c)},F.fromTo=function(a,b,c,d){return d.startAt=c,d.immediateRender=0!=d.immediateRender&&0!=c.immediateRender,new F(a,b,d)},F.delayedCall=function(a,b,c,d,e){return new F(b,0,{delay:a,onComplete:b,onCompleteParams:c,callbackScope:d,onReverseComplete:b,onReverseCompleteParams:c,immediateRender:!1,lazy:!1,useFrames:e,overwrite:0})},F.set=function(a,b){return new F(a,0,b)},F.getTweensOf=function(a,b){if(null==a)return[];a="string"!=typeof a?a:F.selector(a)||a;var c,d,e,f;if((o(a)||G(a))&&"number"!=typeof a[0]){for(c=a.length,d=[];--c>-1;)d=d.concat(F.getTweensOf(a[c],b));for(c=d.length;--c>-1;)for(f=d[c],e=c;--e>-1;)f===d[e]&&d.splice(c,1)}else for(d=Y(a).concat(),c=d.length;--c>-1;)(d[c]._gc||b&&!d[c].isActive())&&d.splice(c,1);return d},F.killTweensOf=F.killDelayedCallsTo=function(a,b,c){"object"==typeof b&&(c=b,b=!1);for(var d=F.getTweensOf(a,b),e=d.length;--e>-1;)d[e]._kill(c,a)};var aa=s("plugins.TweenPlugin",function(a,b){this._overwriteProps=(a||"").split(","),this._propName=this._overwriteProps[0],this._priority=b||0,this._super=aa.prototype},!0);if(g=aa.prototype,aa.version="1.19.0",aa.API=2,g._firstPT=null,g._addTween=N,g.setRatio=L,g._kill=function(a){var b,c=this._overwriteProps,d=this._firstPT;if(null!=a[this._propName])this._overwriteProps=[];else for(b=c.length;--b>-1;)null!=a[c[b]]&&c.splice(b,1);for(;d;)null!=a[d.n]&&(d._next&&(d._next._prev=d._prev),d._prev?(d._prev._next=d._next,d._prev=null):this._firstPT===d&&(this._firstPT=d._next)),d=d._next;return!1},g._mod=g._roundProps=function(a){for(var b,c=this._firstPT;c;)b=a[this._propName]||null!=c.n&&a[c.n.split(this._propName+"_").join("")],b&&"function"==typeof b&&(2===c.f?c.t._applyPT.m=b:c.m=b),c=c._next},F._onPluginEvent=function(a,b){var c,d,e,f,g,h=b._firstPT;if("_onInitAllProps"===a){for(;h;){for(g=h._next,d=e;d&&d.pr>h.pr;)d=d._next;(h._prev=d?d._prev:f)?h._prev._next=h:e=h,(h._next=d)?d._prev=h:f=h,h=g}h=b._firstPT=e}for(;h;)h.pg&&"function"==typeof h.t[a]&&h.t[a]()&&(c=!0),h=h._next;return c},aa.activate=function(a){for(var b=a.length;--b>-1;)a[b].API===aa.API&&(P[(new a[b])._propName]=a[b]);return!0},r.plugin=function(a){if(!(a&&a.propName&&a.init&&a.API))throw"illegal plugin definition.";var b,c=a.propName,d=a.priority||0,e=a.overwriteProps,f={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},g=s("plugins."+c.charAt(0).toUpperCase()+c.substr(1)+"Plugin",function(){aa.call(this,c,d),this._overwriteProps=e||[]},a.global===!0),h=g.prototype=new aa(c);h.constructor=g,g.API=a.API;for(b in f)"function"==typeof a[b]&&(h[f[b]]=a[b]);return g.version=a.version,aa.activate([g]),g},e=a._gsQueue){for(f=0;fa?d(2*a,b)/2:1-d(-2*a+2,b)/2}});a.linear=function(a){return a};return a}(),u=function(a){return e.string(a)?a:a+""},A=function(a){return a.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()},B=function(a){if(e.color(a))return!1;try{return document.querySelectorAll(a)}catch(b){return!1}},v=function(a){return a.reduce(function(a,c){return a.concat(e.array(c)?v(c):c)},[])},p=function(a){if(e.array(a))return a;e.string(a)&&(a=B(a)||a);return e.html(a)?[].slice.call(a):[a]},C=function(a,b){return a.some(function(a){return a===b})},N=function(a,b){var c={};a.forEach(function(a){var f=JSON.stringify(b.map(function(b){return a[b]}));c[f]=c[f]||[];c[f].push(a)});return Object.keys(c).map(function(a){return c[a]})}, D=function(a){return a.filter(function(a,c,d){return d.indexOf(a)===c})},w=function(a){var b={},c;for(c in a)b[c]=a[c];return b},t=function(a,b){for(var c in b)a[c]=e.undef(a[c])?b[c]:a[c];return a},O=function(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,e){return b+b+c+c+e+e});var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);a=parseInt(b[1],16);var c=parseInt(b[2],16),b=parseInt(b[3],16);return"rgb("+a+","+c+","+b+")"},P=function(a){a=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a); var b=parseInt(a[1])/360,c=parseInt(a[2])/100,d=parseInt(a[3])/100;a=function(a,b,c){0>c&&(c+=1);1c?b:c<2/3?a+(b-a)*(2/3-c)*6:a};if(0==c)c=d=b=d;else var f=.5>d?d*(1+c):d+c-d*c,h=2*d-f,c=a(h,f,b+1/3),d=a(h,f,b),b=a(h,f,b-1/3);return"rgb("+255*c+","+255*d+","+255*b+")"},k=function(a){return/([\+\-]?[0-9|auto\.]+)(%|px|pt|em|rem|in|cm|mm|ex|pc|vw|vh|deg)?/.exec(a)[2]},E=function(a,b,c){return k(b)?b:-1=a.delay&&(a.begin(b),a.begin=void 0);c.current>=b.duration?(a.loop?(c.start=+new Date,"alternate"===a.direction&&y(b,!0),e.number(a.loop)&& a.loop--,c.raf=requestAnimationFrame(c.tick)):(b.ended=!0,a.complete&&a.complete(b),b.pause()),c.last=0):c.raf=requestAnimationFrame(c.tick)}}};b.seek=function(a){L(b,a/100*b.duration)};b.pause=function(){b.running=!1;cancelAnimationFrame(c.raf);X(b);var a=m.indexOf(b);-1= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ /* This is an optimized version of Dojo, built for deployment and not for development. To get sources and documentation, please visit: http://dojotoolkit.org */ //>>built (function(_1,_2){var _3=function(){},_4=function(it){for(var p in it){return 0;}return 1;},_5={}.toString,_6=function(it){return _5.call(it)=="[object Function]";},_7=function(it){return _5.call(it)=="[object String]";},_8=function(it){return _5.call(it)=="[object Array]";},_9=function(_a,_b){if(_a){for(var i=0;i<_a.length;){_b(_a[i++]);}}},_c=function(_d,_e){for(var p in _e){_d[p]=_e[p];}return _d;},_f=function(_10,_11){return _c(new Error(_10),{src:"dojoLoader",info:_11});},_12=1,uid=function(){return "_"+_12++;},req=function(_13,_14,_15){return _16(_13,_14,_15,0,req);},_17=this,doc=_17.document,_18=doc&&doc.createElement("DiV"),has=req.has=function(_19){return _6(_1a[_19])?(_1a[_19]=_1a[_19](_17,doc,_18)):_1a[_19];},_1a=has.cache=_2.hasCache;has.add=function(_1b,_1c,now,_1d){(_1a[_1b]===undefined||_1d)&&(_1a[_1b]=_1c);return now&&has(_1b);};false&&has.add("host-node",typeof process=="object"&&/node(\.exe)?$/.test(process.execPath));if(0){require("./_base/configNode.js").config(_2);_2.loaderPatch.nodeRequire=require;}false&&has.add("host-rhino",typeof load=="function"&&(typeof Packages=="function"||typeof Packages=="object"));if(0){for(var _1e=_1.baseUrl||".",arg,_1f=this.arguments,i=0;i<_1f.length;){arg=(_1f[i++]+"").split("=");if(arg[0]=="baseUrl"){_1e=arg[1];break;}}load(_1e+"/_base/configRhino.js");rhinoDojoConfig(_2,_1e,_1f);}for(var p in _1.has){has.add(p,_1.has[p],0,1);}var _20=1,_21=2,_22=3,_23=4,_24=5;if(0){_20="requested";_21="arrived";_22="not-a-module";_23="executing";_24="executed";}var _25=0,_26="sync",xd="xd",_27=[],_28=0,_29=_3,_2a=_3,_2b;if(1){req.isXdUrl=_3;req.initSyncLoader=function(_2c,_2d,_2e){if(!_28){_28=_2c;_29=_2d;_2a=_2e;}return {sync:_26,xd:xd,arrived:_21,nonmodule:_22,executing:_23,executed:_24,syncExecStack:_27,modules:_2f,execQ:_30,getModule:_31,injectModule:_32,setArrived:_33,signal:_34,finishExec:_35,execModule:_36,dojoRequirePlugin:_28,getLegacyMode:function(){return _25;},holdIdle:function(){_74++;},releaseIdle:function(){_37();}};};if(1){var _38=location.protocol,_39=location.host,_3a=!_39;req.isXdUrl=function(url){if(_3a||/^\./.test(url)){return false;}if(/^\/\//.test(url)){return true;}var _3b=url.match(/^([^\/\:]+\:)\/\/([^\/]+)/);return _3b&&(_3b[1]!=_38||_3b[2]!=_39);};true||has.add("dojo-xhr-factory",1);has.add("dojo-force-activex-xhr",1&&!doc.addEventListener&&window.location.protocol=="file:");has.add("native-xhr",typeof XMLHttpRequest!="undefined");if(has("native-xhr")&&!has("dojo-force-activex-xhr")){_2b=function(){return new XMLHttpRequest();};}else{for(var _3c=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],_3d,i=0;i<3;){try{_3d=_3c[i++];if(new ActiveXObject(_3d)){break;}}catch(e){}}_2b=function(){return new ActiveXObject(_3d);};}req.getXhr=_2b;has.add("dojo-gettext-api",1);req.getText=function(url,_3e,_3f){var xhr=_2b();xhr.open("GET",_40(url),false);xhr.send(null);if(xhr.status==200||(!location.host&&!xhr.status)){if(_3f){_3f(xhr.responseText,_3e);}}else{throw _f("xhrFailed",xhr.status);}return xhr.responseText;};}}else{req.async=1;}var _41=new Function("__text","return eval(__text);");req.eval=function(_42,_43){return _41(_42+"\r\n////@ sourceURL="+_43);};var _44={},_45="error",_34=req.signal=function(_46,_47){var _48=_44[_46];_9(_48&&_48.slice(0),function(_49){_49.apply(null,_8(_47)?_47:[_47]);});},on=req.on=function(_4a,_4b){var _4c=_44[_4a]||(_44[_4a]=[]);_4c.push(_4b);return {remove:function(){for(var i=0;i<_4c.length;i++){if(_4c[i]===_4b){_4c.splice(i,1);return;}}}};};var _4d=[],_4e={},_4f=[],_50={},_51={},_52=[],_2f={},_53="",_54={},_55={},_56={};if(1){var _57=function(_58){for(var p in _55){var _59=p.match(/^url\:(.+)/);if(_59){_54[_5a(_59[1],_58)]=_55[p];}else{if(p!="*noref"){_54[_5b(p,_58).mid]=_55[p];}}}_55={};},_5c=function(map,_5d,_5e){_5d.splice(0,_5d.length);var p,i,_5f,_60=0;for(p in map){_5d.push([p,map[p]]);if(map[p]==_5e){_60=p;}}_5d.sort(function(lhs,rhs){return rhs[0].length-lhs[0].length;});for(i=0;i<_5d.length;){_5f=_5d[i++];_5f[2]=new RegExp("^"+_5f[0].replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(c){return "\\"+c;})+"(/|$)");_5f[3]=_5f[0].length+1;}return _60;},_61=function(_62,_63){var _64=_62.name;if(!_64){_64=_62;_62={name:_64};}_62=_c({main:"main",mapProg:[]},_62);_62.location=(_63||"")+(_62.location?_62.location:_64);_62.reverseName=_5c(_62.packageMap,_62.mapProg,_64);if(!_62.main.indexOf("./")){_62.main=_62.main.substring(2);}_c(_4e,_62.paths);_50[_64]=_62;_51[_64]=_64;},_65=function(_66,_67){for(var p in _66){if(p=="waitSeconds"){req.waitms=(_66[p]||0)*1000;}if(p=="cacheBust"){_53=_66[p]?(_7(_66[p])?_66[p]:(new Date()).getTime()+""):"";}if(p=="baseUrl"||p=="combo"){req[p]=_66[p];}if(1&&p=="async"){var _68=_66[p];req.legacyMode=_25=(_7(_68)&&/sync|legacyAsync/.test(_68)?_68:(!_68?"sync":false));req.async=!_25;}if(_66[p]!==_1a){req.rawConfig[p]=_66[p];p!="has"&&has.add("config-"+p,_66[p],0,_67);}}if(!req.baseUrl){req.baseUrl="./";}if(!/\/$/.test(req.baseUrl)){req.baseUrl+="/";}for(p in _66.has){has.add(p,_66.has[p],0,_67);}_9(_66.packages,_61);for(_1e in _66.packagePaths){_9(_66.packagePaths[_1e],function(_69){_61(_69,_1e+"/");});}_5c(_c(_4e,_66.paths),_4f);_9(_66.aliases,function(_6a){if(_7(_6a[0])){_6a[0]=new RegExp("^"+_6a[0].replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(c){return "\\"+c;})+"$");}_4d.push(_6a);});_5c(_c(_51,_66.packageMap),_52);if(_66.cache){_57();_55=_66.cache;if(_66.cache["*noref"]){_57();}}_34("config",[_66,req.rawConfig]);};if(has("dojo-cdn")||1){for(var _6b,src,_6c,_6d=doc.getElementsByTagName("script"),i=0;i<_6d.length&&!_6c;i++){if((src=_6d[i].getAttribute("src"))&&(_6c=src.match(/(.*)\/?dojo\.js(\W|$)/i))){_1.baseUrl=_6b=_1.baseUrl||_2.baseUrl||_6c[1];src=(_6d[i].getAttribute("data-dojo-config")||_6d[i].getAttribute("djConfig"));if(src){_56=req.eval("({ "+src+" })","data-dojo-config");}if(0){var _6e=_6d[i].getAttribute("data-main");if(_6e){_56.deps=_56.deps||[_6e];}}}}}if(0){try{if(window.parent!=window&&window.parent.require){var doh=window.parent.require("doh");doh&&_c(_56,doh.testConfig);}}catch(e){}}req.rawConfig={};_65(_2,1);_65(_1,1);_65(_56,1);if(has("dojo-cdn")){_50.dojo.location=_6b;_50.dijit.location=_6b+"../dijit/";_50.dojox.location=_6b+"../dojox/";}}else{_4e=_2.paths;_4f=_2.pathsMapProg;_50=_2.packs;_4d=_2.aliases;_51=_2.packageMap;_52=_2.packageMapProg;_2f=_2.modules;_54=_2.cache;_53=_2.cacheBust;req.rawConfig=_2;}if(0){req.combo=req.combo||{add:_3};var _6f=0,_70=[],_71=null;}var _72=function(_73){_74++;_9(_73.deps,_32);if(0&&_6f&&!_71){_71=setTimeout(function(){_6f=0;_71=null;req.combo.done(function(_75,url){var _76=function(){_77(0,_75);_78();};_70.push(_75);_79=_75;req.injectUrl(url,_76,_75);_79=0;},req);},0);}_37();},_16=function(a1,a2,a3,_7a,_7b){var _7c,_7d;if(_7(a1)){_7c=_31(a1,_7a,true);if(_7c&&_7c.executed){return _7c.result;}throw _f("undefinedModule",a1);}if(!_8(a1)){_65(a1);a1=a2;a2=a3;}if(_8(a1)){if(!a1.length){a2&&a2();}else{_7d="require*"+uid();for(var mid,_7e=[],i=0;i_a6){_a7=_6(_a8[1])?mid.replace(_a8[0],_a8[1]):_a8[1];}});if(_a7){return _95(_a7,0,_97,_98,_99,_9a,_9b,_9c);}_a2=_98[mid];if(_a2){return _9c?_7f(_a2.pid,_a2.mid,_a2.pack,_a2.url,_a5):_98[mid];}}_a0=_8c(mid,_9b);if(_a0){url=_a0[1]+mid.substring(_a0[3]-1);}else{if(pid){url=_9d.location+"/"+_9e;}else{if(has("config-tlmSiblingOfDojo")){url="../"+mid;}else{url=mid;}}}if(!(/(^\/)|(\:)/.test(url))){url=_99+url;}url+=".js";return _7f(pid,mid,_9d,_8e(url),_a5);},_5b=function(mid,_aa){return _95(mid,_aa,_50,_2f,req.baseUrl,_52,_4f);},_ab=function(_ac,_ad,_ae){return _ac.normalize?_ac.normalize(_ad,function(mid){return _af(mid,_ae);}):_af(_ad,_ae);},_b0=0,_31=function(mid,_b1,_b2){var _b3,_b4,_b5,_b6;_b3=mid.match(/^(.+?)\!(.*)$/);if(_b3){_b4=_31(_b3[1],_b1,_b2);if(1&&_25==_26&&!_b4.executed){_32(_b4);if(_b4.injected===_21&&!_b4.executed){_74++;_36(_b4);_37();}if(_b4.executed){_b7(_b4);}else{_30.unshift(_b4);}}if(_b4.executed===_24&&!_b4.load){_b7(_b4);}if(_b4.load){_b5=_ab(_b4,_b3[2],_b1);mid=(_b4.mid+"!"+(_b4.dynamic?++_b0+"!":"")+_b5);}else{_b5=_b3[2];mid=_b4.mid+"!"+(++_b0)+"!waitingForPlugin";}_b6={plugin:_b4,mid:mid,req:_81(_b1),prid:_b5};}else{_b6=_5b(mid,_b1);}return _2f[_b6.mid]||(!_b2&&(_2f[_b6.mid]=_b6));},_af=req.toAbsMid=function(mid,_b8){return _5b(mid,_b8).mid;},_5a=req.toUrl=function(_b9,_ba){var _bb=_b9.match(/(.+)(\.[^\/\.]+?)$/),_bc=(_bb&&_bb[1])||_b9,ext=(_bb&&_bb[2])||"",_bd=_5b(_bc,_ba),url=_bd.url;url=typeof _bd.pid=="string"?url.substring(0,url.length-3):url;return _40(url+ext);},_be={injected:_21,executed:_24,def:_22,result:_22},_bf=function(mid){return _2f[mid]=_c({mid:mid},_be);},_c0=_bf("require"),_c1=_bf("exports"),_c2=_bf("module"),_c3=function(_c4,_c5){req.trace("loader-run-factory",[_c4.mid]);var _c6=_c4.def,_c7;1&&_27.unshift(_c4);if(has("config-dojo-loader-catches")){try{_c7=_6(_c6)?_c6.apply(null,_c5):_c6;}catch(e){_34(_45,_c4.result=_f("factoryThrew",[_c4,e]));}}else{_c7=_6(_c6)?_c6.apply(null,_c5):_c6;}_c4.result=_c7===undefined&&_c4.cjs?_c4.cjs.exports:_c7;1&&_27.shift(_c4);},_c8={},_c9=0,_b7=function(_ca){var _cb=_ca.result;_ca.dynamic=_cb.dynamic;_ca.normalize=_cb.normalize;_ca.load=_cb.load;return _ca;},_cc=function(_cd){var map={};_9(_cd.loadQ,function(_ce){var _cf=_ce.mid,_d0=_ab(_cd,_ce.prid,_ce.req.module),mid=_cd.dynamic?_ce.mid.replace(/waitingForPlugin$/,_d0):(_cd.mid+"!"+_d0),_d1=_c(_c({},_ce),{mid:mid,prid:_d0,injected:0});if(!_2f[mid]){_e2(_2f[mid]=_d1);}map[_ce.mid]=_2f[mid];_33(_ce);delete _2f[_ce.mid];});_cd.loadQ=0;var _d2=function(_d3){for(var _d4,_d5=_d3.deps||[],i=0;i<_d5.length;i++){_d4=map[_d5[i].mid];if(_d4){_d5[i]=_d4;}}};for(var p in _2f){_d2(_2f[p]);}_9(_30,_d2);},_35=function(_d6){req.trace("loader-finish-exec",[_d6.mid]);_d6.executed=_24;_d6.defOrder=_c9++;1&&_9(_d6.provides,function(cb){cb();});if(_d6.loadQ){_b7(_d6);_cc(_d6);}for(i=0;i<_30.length;){if(_30[i]===_d6){_30.splice(i,1);}else{i++;}}},_d7=[],_36=function(_d8,_d9){if(_d8.executed===_23){req.trace("loader-circular-dependency",[_d7.concat(mid).join("->")]);return (!_d8.def||_d9)?_c8:(_d8.cjs&&_d8.cjs.exports);}if(!_d8.executed){if(!_d8.def){return _c8;}var mid=_d8.mid,_da=_d8.deps||[],arg,_db,_dc=[],i=0;if(0){_d7.push(mid);req.trace("loader-exec-module",["exec",_d7.length,mid]);}_d8.executed=_23;while(i<_da.length){arg=_da[i++];_db=((arg===_c0)?_81(_d8):((arg===_c1)?_d8.cjs.exports:((arg===_c2)?_d8.cjs:_36(arg,_d9))));if(_db===_c8){_d8.executed=0;req.trace("loader-exec-module",["abort",mid]);0&&_d7.pop();return _c8;}_dc.push(_db);}_c3(_d8,_dc);_35(_d8);}0&&_d7.pop();return _d8.result;},_74=0,_78=function(){if(_74){return;}_74++;_29();for(var _dd,_de,i=0;i<_30.length;){_dd=_c9;_de=_30[i];_36(_de);if(_dd!=_c9){_29();i=0;}else{i++;}}_37();},_37=function(){_74--;if(_8b()){_34("idle",[]);}};if(0){req.undef=function(_df,_e0){var _e1=_31(_df,_e0);_33(_e1);delete _2f[_e1.mid];};}if(1){if(has("dojo-loader-eval-hint-url")===undefined){has.add("dojo-loader-eval-hint-url",1);}var _40=function(url){url+="";return url+(_53?((/\?/.test(url)?"&":"?")+_53):"");},_e2=function(_e3){var _e4=_e3.plugin;if(_e4.executed===_24&&!_e4.load){_b7(_e4);}var _e5=function(def){_e3.result=def;_33(_e3);_35(_e3);_78();};_87(_e3);if(_e4.load){_e4.load(_e3.prid,_e3.req,_e5);}else{if(_e4.loadQ){_e4.loadQ.push(_e3);}else{_30.unshift(_e4);_32(_e4);if(_e4.load){_e4.load(_e3.prid,_e3.req,_e5);}else{_e4.loadQ=[_e3];}}}},_e6=0,_79=0,_e7=0,_e8=function(_e9,_ea){_e7=1;if(has("config-dojo-loader-catches")){try{if(_e9===_e6){_e6.call(null);}else{req.eval(_e9,has("dojo-loader-eval-hint-url")?_ea.url:_ea.mid);}}catch(e){_34(_45,_f("evalModuleThrew",_ea));}}else{if(_e9===_e6){_e6.call(null);}else{req.eval(_e9,has("dojo-loader-eval-hint-url")?_ea.url:_ea.mid);}}_e7=0;},_32=function(_eb){var mid=_eb.mid,url=_eb.url;if(_eb.executed||_eb.injected||_86[mid]||(_eb.url&&((_eb.pack&&_86[_eb.url]===_eb.pack)||_86[_eb.url]==1))){return;}if(0){var _ec=0;if(_eb.plugin&&_eb.plugin.isCombo){req.combo.add(_eb.plugin.mid,_eb.prid,0,req);_ec=1;}else{if(!_eb.plugin){_ec=req.combo.add(0,_eb.mid,_eb.url,req);}}if(_ec){_87(_eb);_6f=1;return;}}if(_eb.plugin){_e2(_eb);return;}_87(_eb);var _ed=function(){_77(_eb);if(_eb.injected!==_21){_33(_eb);_c(_eb,_be);}if(1&&_25){!_27.length&&_78();}else{_78();}};_e6=_54[mid]||_54[_eb.cacheId];if(_e6){req.trace("loader-inject",["cache",_eb.mid,url]);_e8(_e6,_eb);_ed();return;}if(1&&_25){if(_eb.isXd){_25==_26&&(_25=xd);}else{if(_eb.isAmd&&_25!=_26){}else{var _ee=function(_ef){if(_25==_26){_27.unshift(_eb);_e8(_ef,_eb);_27.shift();_77(_eb);if(!_eb.cjs){_33(_eb);_35(_eb);}if(_eb.finish){var _f0=mid+"*finish",_f1=_eb.finish;delete _eb.finish;def(_f0,["dojo",("dojo/require!"+_f1.join(",")).replace(/\./g,"/")],function(_f2){_9(_f1,function(mid){_f2.require(mid);});});_30.unshift(_31(_f0));}_ed();}else{_ef=_2a(_eb,_ef);if(_ef){_e8(_ef,_eb);_ed();}else{_79=_eb;req.injectUrl(_40(url),_ed,_eb);_79=0;}}};req.trace("loader-inject",["xhr",_eb.mid,url,_25!=_26]);if(has("config-dojo-loader-catches")){try{req.getText(url,_25!=_26,_ee);}catch(e){_34(_45,_f("xhrInjectFailed",[_eb,e]));}}else{req.getText(url,_25!=_26,_ee);}return;}}}req.trace("loader-inject",["script",_eb.mid,url]);_79=_eb;req.injectUrl(_40(url),_ed,_eb);_79=0;},_f3=function(_f4,_f5,def){req.trace("loader-define-module",[_f4.mid,_f5]);if(0&&_f4.plugin&&_f4.plugin.isCombo){_f4.result=_6(def)?def():def;_33(_f4);_35(_f4);return _f4;}var mid=_f4.mid;if(_f4.injected===_21){_34(_45,_f("multipleDefine",_f4));return _f4;}_c(_f4,{deps:_f5,def:def,cjs:{id:_f4.mid,uri:_f4.url,exports:(_f4.result={}),setExports:function(_f6){_f4.cjs.exports=_f6;}}});for(var i=0;i<_f5.length;i++){_f5[i]=_31(_f5[i],_f4);}if(1&&_25&&!_86[mid]){_72(_f4);_30.push(_f4);_78();}_33(_f4);if(!_6(def)&&!_f5.length){_f4.result=def;_35(_f4);}return _f4;},_77=function(_f7,_f8){_57(_f7);var _f9=[],_fa,_fb;while(_85.length){_fb=_85.shift();_f8&&(_fb[0]=_f8.shift());_fa=_fb[0]&&_31(_fb[0])||_f7;_f9.push(_f3(_fa,_fb[1],_fb[2]));}_9(_f9,_72);};}var _fc=0,_8a=_3,_fd=_3;if(1){_8a=function(){_fc&&clearTimeout(_fc);_fc=0;},_fd=function(){_8a();req.waitms&&(_fc=setTimeout(function(){_8a();_34(_45,_f("timeout",_86));},req.waitms));};}if(1){has.add("ie-event-behavior",doc.attachEvent&&(typeof opera==="undefined"||opera.toString()!="[object Opera]"));}if(1&&(1||1)){var _fe=function(_ff,_100,_101,_102){if(!has("ie-event-behavior")){_ff.addEventListener(_100,_102,false);return function(){_ff.removeEventListener(_100,_102,false);};}else{_ff.attachEvent(_101,_102);return function(){_ff.detachEvent(_101,_102);};}},_103=_fe(window,"load","onload",function(){req.pageLoaded=1;doc.readyState!="complete"&&(doc.readyState="complete");_103();});if(1){var _104=doc.getElementsByTagName("script")[0],_105=_104.parentNode;req.injectUrl=function(url,_106,_107){_fd();var node=_107.node=doc.createElement("script"),_108=function(e){e=e||window.event;var node=e.target||e.srcElement;if(e.type==="load"||/complete|loaded/.test(node.readyState)){_109();_106&&_106();}},_109=_fe(node,"load","onreadystatechange",_108);node.type="text/javascript";node.charset="utf-8";node.src=url;_105.insertBefore(node,_104);return node;};}}if(1){req.log=function(){try{for(var i=0;i0){_124._delayTimer=setTimeout(_125,de);return _124;}_125();return _124;},_play:function(_126){var _127=this;if(_127._delayTimer){_127._clearTimer();}_127._startTime=new Date().valueOf();if(_127._paused){_127._startTime-=_127.duration*_127._percent;}_127._active=true;_127._paused=false;var _128=_127.curve.getValue(_127._getStep());if(!_127._percent){if(!_127._startRepeatCount){_127._startRepeatCount=_127.repeat;}_127._fire("onBegin",[_128]);}_127._fire("onPlay",[_128]);_127._cycle();return _127;},pause:function(){var _129=this;if(_129._delayTimer){_129._clearTimer();}_129._stopTimer();if(!_129._active){return _129;}_129._paused=true;_129._fire("onPause",[_129.curve.getValue(_129._getStep())]);return _129;},gotoPercent:function(_12a,_12b){var _12c=this;_12c._stopTimer();_12c._active=_12c._paused=true;_12c._percent=_12a;if(_12b){_12c.play();}return _12c;},stop:function(_12d){var _12e=this;if(_12e._delayTimer){_12e._clearTimer();}if(!_12e._timer){return _12e;}_12e._stopTimer();if(_12d){_12e._percent=1;}_12e._fire("onStop",[_12e.curve.getValue(_12e._getStep())]);_12e._active=_12e._paused=false;return _12e;},status:function(){if(this._active){return this._paused?"paused":"playing";}return "stopped";},_cycle:function(){var _12f=this;if(_12f._active){var curr=new Date().valueOf();var step=(curr-_12f._startTime)/(_12f.duration);if(step>=1){step=1;}_12f._percent=step;if(_12f.easing){step=_12f.easing(step);}_12f._fire("onAnimate",[_12f.curve.getValue(step)]);if(_12f._percent<1){_12f._startTimer();}else{_12f._active=false;if(_12f.repeat>0){_12f.repeat--;_12f.play(null,true);}else{if(_12f.repeat==-1){_12f.play(null,true);}else{if(_12f._startRepeatCount){_12f.repeat=_12f._startRepeatCount;_12f._startRepeatCount=0;}}}_12f._percent=0;_12f._fire("onEnd",[_12f.node]);!_12f.repeat&&_12f._stopTimer();}}return _12f;},_clearTimer:function(){clearTimeout(this._delayTimer);delete this._delayTimer;}});var ctr=0,_130=null,_131={run:function(){}};lang.extend(dojo.Animation,{_startTimer:function(){if(!this._timer){this._timer=_11c.connect(_131,"run",this,"_cycle");ctr++;}if(!_130){_130=setInterval(lang.hitch(_131,"run"),this.rate);}},_stopTimer:function(){if(this._timer){_11c.disconnect(this._timer);this._timer=null;ctr--;}if(ctr<=0){clearInterval(_130);_130=null;ctr=0;}}});var _132=has("ie")?function(node){var ns=node.style;if(!ns.width.length&&_11d.get(node,"width")=="auto"){ns.width="auto";}}:function(){};dojo._fade=function(args){args.node=dom.byId(args.node);var _133=_11e({properties:{}},args),_134=(_133.properties.opacity={});_134.start=!("start" in _133)?function(){return +_11d.get(_133.node,"opacity")||0;}:_133.start;_134.end=_133.end;var anim=dojo.animateProperty(_133);_11c.connect(anim,"beforeBegin",lang.partial(_132,_133.node));return anim;};dojo.fadeIn=function(args){return dojo._fade(_11e({end:1},args));};dojo.fadeOut=function(args){return dojo._fade(_11e({end:0},args));};dojo._defaultEasing=function(n){return 0.5+((Math.sin((n+1.5)*Math.PI))/2);};var _135=function(_136){this._properties=_136;for(var p in _136){var prop=_136[p];if(prop.start instanceof _11b){prop.tempColor=new _11b();}}};_135.prototype.getValue=function(r){var ret={};for(var p in this._properties){var prop=this._properties[p],_137=prop.start;if(_137 instanceof _11b){ret[p]=_11b.blendColors(_137,prop.end,r,prop.tempColor).toCss();}else{if(!lang.isArray(_137)){ret[p]=((prop.end-_137)*r)+_137+(p!="opacity"?prop.units||"px":0);}}}return ret;};dojo.animateProperty=function(args){var n=args.node=dom.byId(args.node);if(!args.easing){args.easing=dojo._defaultEasing;}var anim=new dojo.Animation(args);_11c.connect(anim,"beforeBegin",anim,function(){var pm={};for(var p in this.properties){if(p=="width"||p=="height"){this.node.display="block";}var prop=this.properties[p];if(lang.isFunction(prop)){prop=prop(n);}prop=pm[p]=_11e({},(lang.isObject(prop)?prop:{end:prop}));if(lang.isFunction(prop.start)){prop.start=prop.start(n);}if(lang.isFunction(prop.end)){prop.end=prop.end(n);}var _138=(p.toLowerCase().indexOf("color")>=0);function _139(node,p){var v={height:node.offsetHeight,width:node.offsetWidth}[p];if(v!==undefined){return v;}v=_11d.get(node,p);return (p=="opacity")?+v:(_138?v:parseFloat(v));};if(!("end" in prop)){prop.end=_139(n,p);}else{if(!("start" in prop)){prop.start=_139(n,p);}}if(_138){prop.start=new _11b(prop.start);prop.end=new _11b(prop.end);}else{prop.start=(p=="opacity")?+prop.start:parseFloat(prop.start);}}this.curve=new _135(pm);});_11c.connect(anim,"onAnimate",lang.hitch(_11d,"set",anim.node));return anim;};dojo.anim=function(node,_13a,_13b,_13c,_13d,_13e){return dojo.animateProperty({node:node,duration:_13b||dojo.Animation.prototype.duration,properties:_13a,easing:_13c,onEnd:_13d}).play(_13e||0);};return {_Line:dojo._Line,Animation:dojo.Animation,_fade:dojo._fade,fadeIn:dojo.fadeIn,fadeOut:dojo.fadeOut,_defaultEasing:dojo._defaultEasing,animateProperty:dojo.animateProperty,anim:dojo.anim};});},"dojo/dom-form":function(){define(["./_base/lang","./dom","./io-query","./json"],function(lang,dom,ioq,json){function _13f(obj,name,_140){if(_140===null){return;}var val=obj[name];if(typeof val=="string"){obj[name]=[val,_140];}else{if(lang.isArray(val)){val.push(_140);}else{obj[name]=_140;}}};var _141="file|submit|image|reset|button";var form={fieldToObject:function fieldToObject(_142){var ret=null;_142=dom.byId(_142);if(_142){var _143=_142.name,type=(_142.type||"").toLowerCase();if(_143&&type&&!_142.disabled){if(type=="radio"||type=="checkbox"){if(_142.checked){ret=_142.value;}}else{if(_142.multiple){ret=[];var _144=[_142.firstChild];while(_144.length){for(var node=_144.pop();node;node=node.nextSibling){if(node.nodeType==1&&node.tagName.toLowerCase()=="option"){if(node.selected){ret.push(node.value);}}else{if(node.nextSibling){_144.push(node.nextSibling);}if(node.firstChild){_144.push(node.firstChild);}break;}}}}else{ret=_142.value;}}}}return ret;},toObject:function formToObject(_145){var ret={},_146=dom.byId(_145).elements;for(var i=0,l=_146.length;i=0;i--){var node=(_1ee?this._cloneNode(ary[i]):ary[i]);if(ary._runParse&&dojo.parser&&dojo.parser.parse){if(!_1f0){_1f0=_1ef.ownerDocument.createElement("div");}_1f0.appendChild(node);dojo.parser.parse(_1f0);node=_1f0.firstChild;while(_1f0.firstChild){_1f0.removeChild(_1f0.firstChild);}}if(i==_1f1-1){_1de.place(node,_1ef,_1ed);}else{_1ef.parentNode.insertBefore(node,_1ef);}_1ef=node;}},attr:awc(_1e5(_1e0),_1e2),style:awc(_1e5(_1e1),_1e2),addClass:aafe(_1dd.add),removeClass:aafe(_1dd.remove),replaceClass:aafe(_1dd.replace),toggleClass:aafe(_1dd.toggle),empty:aafe(_1de.empty),removeAttr:aafe(_1e0.remove),position:aam(_1df.position),marginBox:aam(_1df.getMarginBox),place:function(_1f2,_1f3){var item=_1db(_1f2)[0];return this.forEach(function(node){_1de.place(node,item,_1f3);});},orphan:function(_1f4){return (_1f4?_1db._filterResult(this,_1f4):this).forEach(_1e3);},adopt:function(_1f5,_1f6){return _1db(_1f5).place(this[0],_1f6)._stash(this);},query:function(_1f7){if(!_1f7){return this;}var ret=new _1e4;this.map(function(node){_1db(_1f7,node).forEach(function(_1f8){if(_1f8!==undefined){ret.push(_1f8);}});});return ret._stash(this);},filter:function(_1f9){var a=arguments,_1fa=this,_1fb=0;if(typeof _1f9=="string"){_1fa=_1db._filterResult(this,a[0]);if(a.length==1){return _1fa._stash(this);}_1fb=1;}return this._wrap(_1dc.filter(_1fa,a[_1fb],a[_1fb+1]),this);},addContent:function(_1fc,_1fd){_1fc=this._normalize(_1fc,this[0]);for(var i=0,node;(node=this[i]);i++){this._place(_1fc,node,_1fd,i>0);}return this;}});return _1e4;});},"dojo/query":function(){define(["./_base/kernel","./has","./dom","./on","./_base/array","./_base/lang","./selector/_loader","./selector/_loader!default"],function(dojo,has,dom,on,_1fe,lang,_1ff,_200){"use strict";has.add("array-extensible",function(){return lang.delegate([],{length:1}).length==1&&!has("bug-for-in-skips-shadowed");});var ap=Array.prototype,aps=ap.slice,apc=ap.concat,_201=_1fe.forEach;var tnl=function(a,_202,_203){var _204=new (_203||this._NodeListCtor||nl)(a);return _202?_204._stash(_202):_204;};var _205=function(f,a,o){a=[0].concat(aps.call(a,0));o=o||dojo.global;return function(node){a[0]=node;return f.apply(o,a);};};var _206=function(f,o){return function(){this.forEach(_205(f,arguments,o));return this;};};var _207=function(f,o){return function(){return this.map(_205(f,arguments,o));};};var _208=function(f,o){return function(){return this.filter(_205(f,arguments,o));};};var _209=function(f,g,o){return function(){var a=arguments,body=_205(f,a,o);if(g.call(o||dojo.global,a)){return this.map(body);}this.forEach(body);return this;};};var _20a=function(_20b){var _20c=this instanceof nl&&has("array-extensible");if(typeof _20b=="number"){_20b=Array(_20b);}var _20d=(_20b&&"length" in _20b)?_20b:arguments;if(_20c||!_20d.sort){var _20e=_20c?this:[],l=_20e.length=_20d.length;for(var i=0;i0;};_21f.filter=_21d.filter||function(_223,_224,root){return _21f(_224,root).filter(function(node){return _1fe.indexOf(_223,node)>-1;});};if(typeof _21d!="function"){var _225=_21d.search;_21d=function(_226,root){return _225(root||document,_226);};}return _21f;};var _219=_21c(_200,_20a);dojo.query=_21c(_200,function(_227){return _20a(_227);});_219.load=function(id,_228,_229,_22a){_1ff.load(id,_228,function(_22b){_229(_21c(_22b,_20a));});};dojo._filterQueryResult=_219._filterResult=function(_22c,_22d,root){return new _20a(_219.filter(_22c,_22d,root));};dojo.NodeList=_219.NodeList=_20a;return _219;});},"dojo/has":function(){define(["require"],function(_22e){var has=_22e.has||function(){};if(!1){var _22f=typeof window!="undefined"&&typeof location!="undefined"&&typeof document!="undefined"&&window.location==location&&window.document==document,_230=this,doc=_22f&&document,_231=doc&&doc.createElement("DiV"),_232={};has=function(name){return typeof _232[name]=="function"?(_232[name]=_232[name](_230,doc,_231)):_232[name];};has.cache=_232;has.add=function(name,test,now,_233){(typeof _232[name]=="undefined"||_233)&&(_232[name]=test);return now&&has(name);};true||has.add("host-browser",_22f);true||has.add("dom",_22f);true||has.add("dojo-dom-ready-api",1);true||has.add("dojo-sniff",1);}if(1){var _234=navigator.userAgent;has.add("dom-addeventlistener",!!document.addEventListener);has.add("touch","ontouchstart" in document);has.add("device-width",screen.availWidth||innerWidth);has.add("agent-ios",!!_234.match(/iPhone|iP[ao]d/));has.add("agent-android",_234.indexOf("android")>1);}has.clearElement=function(_235){_235.innerHTML="";return _235;};has.normalize=function(id,_236){var _237=id.match(/[\?:]|[^:\?]*/g),i=0,get=function(skip){var term=_237[i++];if(term==":"){return 0;}else{if(_237[i++]=="?"){if(!skip&&has(term)){return get();}else{get(true);return get(skip);}}return term||0;}};id=get();return id&&_236(id);};has.load=function(id,_238,_239){if(id){_238([id],_239);}else{_239();}};return has;});},"dojo/_base/loader":function(){define(["./kernel","../has","require","module","./json","./lang","./array"],function(dojo,has,_23a,_23b,json,lang,_23c){if(!1){console.error("cannot load the Dojo v1.x loader with a foreign loader");return 0;}var _23d=function(id){return {src:_23b.id,id:id};},_23e=function(name){return name.replace(/\./g,"/");},_23f=/\/\/>>built/,_240=[],_241=[],_242=function(mid,_243,_244){_240.push(_244);_23c.forEach(mid.split(","),function(mid){var _245=_246(mid,_243.module);_241.push(_245);_247(_245);});_248();},_249,_24a=function(m){if(_249[m.mid]||/loadInit\!/.test(m.mid)){return true;}_249[m.mid]=1;if(m.injected!==_24b&&!m.executed){return false;}for(var deps=m.deps||[],i=0;i=0;--j){_2ad=lin[j].prototype;if(!_2ad.hasOwnProperty("declaredClass")){_2ad.declaredClass="uniqName_"+(_2a4++);}name=_2ad.declaredClass;if(!_2ab.hasOwnProperty(name)){_2ab[name]={count:0,refs:[],cls:lin[j]};++_2ac;}rec=_2ab[name];if(top&&top!==rec){rec.refs.push(top);++top.count;}top=rec;}++top.count;_2aa[0].refs.push(top);}while(_2aa.length){top=_2aa.pop();_2a9.push(top.cls);--_2ac;while(refs=top.refs,refs.length==1){top=refs[0];if(!top||--top.count){top=0;break;}_2a9.push(top.cls);--_2ac;}if(top){for(i=0,l=refs.length;i=0;--i){f=_2c5[i];m=f._meta;f=m?m.ctor:f;if(f){f.apply(this,_2c7?_2c7[i]:a);}}f=this.postscript;if(f){f.apply(this,args);}};};function _2c9(ctor,_2ca){return function(){var a=arguments,t=a,a0=a[0],f;if(!(this instanceof a.callee)){return _2c8(a);}if(_2ca){if(a0){f=a0.preamble;if(f){t=f.apply(this,t)||t;}}f=this.preamble;if(f){f.apply(this,t);}}if(ctor){ctor.apply(this,a);}f=this.postscript;if(f){f.apply(this,a);}};};function _2cb(_2cc){return function(){var a=arguments,i=0,f,m;if(!(this instanceof a.callee)){return _2c8(a);}for(;f=_2cc[i];++i){m=f._meta;f=m?m.ctor:f;if(f){f.apply(this,a);break;}}f=this.postscript;if(f){f.apply(this,a);}};};function _2cd(name,_2ce,_2cf){return function(){var b,m,f,i=0,step=1;if(_2cf){i=_2ce.length-1;step=-1;}for(;b=_2ce[i];i+=step){m=b._meta;f=(m?m.hidden:b.prototype)[name];if(f){f.apply(this,arguments);}}};};function _2d0(ctor){xtor.prototype=ctor.prototype;var t=new xtor;xtor.prototype=null;return t;};function _2c8(args){var ctor=args.callee,t=_2d0(ctor);ctor.apply(t,args);return t;};function _2c3(_2d1,_2d2,_2d3){if(typeof _2d1!="string"){_2d3=_2d2;_2d2=_2d1;_2d1="";}_2d3=_2d3||{};var _2d4,i,t,ctor,name,_2d5,_2d6,_2d7=1,_2d8=_2d2;if(opts.call(_2d2)=="[object Array]"){_2d5=_2a6(_2d2,_2d1);t=_2d5[0];_2d7=_2d5.length-t;_2d2=_2d5[_2d7];}else{_2d5=[0];if(_2d2){if(opts.call(_2d2)=="[object Function]"){t=_2d2._meta;_2d5=_2d5.concat(t?t.bases:_2d2);}else{err("base class is not a callable constructor.",_2d1);}}else{if(_2d2!==null){err("unknown base class. Did you use dojo.require to pull it in?",_2d1);}}}if(_2d2){for(i=_2d7-1;;--i){_2d4=_2d0(_2d2);if(!i){break;}t=_2d5[i];(t._meta?_2b9:mix)(_2d4,t.prototype);ctor=new Function;ctor.superclass=_2d2;ctor.prototype=_2d4;_2d2=_2d4.constructor=ctor;}}else{_2d4={};}_2c3.safeMixin(_2d4,_2d3);t=_2d3.constructor;if(t!==op.constructor){t.nom=_2a5;_2d4.constructor=t;}for(i=_2d7-1;i;--i){t=_2d5[i]._meta;if(t&&t.chains){_2d6=mix(_2d6||{},t.chains);}}if(_2d4["-chains-"]){_2d6=mix(_2d6||{},_2d4["-chains-"]);}t=!_2d6||!_2d6.hasOwnProperty(_2a5);_2d5[0]=ctor=(_2d6&&_2d6.constructor==="manual")?_2cb(_2d5):(_2d5.length==1?_2c9(_2d3.constructor,t):_2c4(_2d5,t));ctor._meta={bases:_2d5,hidden:_2d3,chains:_2d6,parents:_2d8,ctor:_2d3.constructor};ctor.superclass=_2d2&&_2d2.prototype;ctor.extend=_2c1;ctor.prototype=_2d4;_2d4.constructor=ctor;_2d4.getInherited=_2b4;_2d4.isInstanceOf=_2b7;_2d4.inherited=_2b6;_2d4.__inherited=_2ae;if(_2d1){_2d4.declaredClass=_2d1;lang.setObject(_2d1,ctor);}if(_2d6){for(name in _2d6){if(_2d4[name]&&typeof _2d6[name]=="string"&&name!=_2a5){t=_2d4[name]=_2cd(name,_2d5,_2d6[name]==="after");t.nom=name;}}}return ctor;};dojo.safeMixin=_2c3.safeMixin=_2bd;dojo.declare=_2c3;return _2c3;});},"dojo/dom":function(){define(["./_base/sniff","./_base/lang","./_base/window"],function(has,lang,win){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}var dom={};if(has("ie")){dom.byId=function(id,doc){if(typeof id!="string"){return id;}var _2d9=doc||win.doc,te=id&&_2d9.getElementById(id);if(te&&(te.attributes.id.value==id||te.id==id)){return te;}else{var eles=_2d9.all[id];if(!eles||eles.nodeName){eles=[eles];}var i=0;while((te=eles[i++])){if((te.attributes&&te.attributes.id&&te.attributes.id.value==id)||te.id==id){return te;}}}};}else{dom.byId=function(id,doc){return ((typeof id=="string")?(doc||win.doc).getElementById(id):id)||null;};}dom.isDescendant=function(node,_2da){try{node=dom.byId(node);_2da=dom.byId(_2da);while(node){if(node==_2da){return true;}node=node.parentNode;}}catch(e){}return false;};dom.setSelectable=function(node,_2db){node=dom.byId(node);if(has("mozilla")){node.style.MozUserSelect=_2db?"":"none";}else{if(has("khtml")||has("webkit")){node.style.KhtmlUserSelect=_2db?"auto":"none";}else{if(has("ie")){var v=(node.unselectable=_2db?"":"on"),cs=node.getElementsByTagName("*"),i=0,l=cs.length;for(;i=0){_2e2+=" * ";}else{_2e2+=" ";}var ts=function(s,e){return trim(_2e2.slice(s,e));};var _2e3=[];var _2e4=-1,_2e5=-1,_2e6=-1,_2e7=-1,_2e8=-1,inId=-1,_2e9=-1,lc="",cc="",_2ea;var x=0,ql=_2e2.length,_2eb=null,_2ec=null;var _2ed=function(){if(_2e9>=0){var tv=(_2e9==x)?null:ts(_2e9,x);_2eb[(_2de.indexOf(tv)<0)?"tag":"oper"]=tv;_2e9=-1;}};var _2ee=function(){if(inId>=0){_2eb.id=ts(inId,x).replace(/\\/g,"");inId=-1;}};var _2ef=function(){if(_2e8>=0){_2eb.classes.push(ts(_2e8+1,x).replace(/\\/g,""));_2e8=-1;}};var _2f0=function(){_2ee();_2ed();_2ef();};var _2f1=function(){_2f0();if(_2e7>=0){_2eb.pseudos.push({name:ts(_2e7+1,x)});}_2eb.loops=(_2eb.pseudos.length||_2eb.attrs.length||_2eb.classes.length);_2eb.oquery=_2eb.query=ts(_2ea,x);_2eb.otag=_2eb.tag=(_2eb["oper"])?null:(_2eb.tag||"*");if(_2eb.tag){_2eb.tag=_2eb.tag.toUpperCase();}if(_2e3.length&&(_2e3[_2e3.length-1].oper)){_2eb.infixOper=_2e3.pop();_2eb.query=_2eb.infixOper.query+" "+_2eb.query;}_2e3.push(_2eb);_2eb=null;};for(;lc=cc,cc=_2e2.charAt(x),x=0){if(cc=="]"){if(!_2ec.attr){_2ec.attr=ts(_2e4+1,x);}else{_2ec.matchFor=ts((_2e6||_2e4+1),x);}var cmf=_2ec.matchFor;if(cmf){if((cmf.charAt(0)=="\"")||(cmf.charAt(0)=="'")){_2ec.matchFor=cmf.slice(1,-1);}}_2eb.attrs.push(_2ec);_2ec=null;_2e4=_2e6=-1;}else{if(cc=="="){var _2f2=("|~^$*".indexOf(lc)>=0)?lc:"";_2ec.type=_2f2+cc;_2ec.attr=ts(_2e4+1,x-_2f2.length);_2e6=x+1;}}}else{if(_2e5>=0){if(cc==")"){if(_2e7>=0){_2ec.value=ts(_2e5+1,x);}_2e7=_2e5=-1;}}else{if(cc=="#"){_2f0();inId=x+1;}else{if(cc=="."){_2f0();_2e8=x;}else{if(cc==":"){_2f0();_2e7=x;}else{if(cc=="["){_2f0();_2e4=x;_2ec={};}else{if(cc=="("){if(_2e7>=0){_2ec={name:ts(_2e7+1,x),value:null};_2eb.pseudos.push(_2ec);}_2e5=x;}else{if((cc==" ")&&(lc!=cc)){_2f1();}}}}}}}}}return _2e3;};var _2f3=function(_2f4,_2f5){if(!_2f4){return _2f5;}if(!_2f5){return _2f4;}return function(){return _2f4.apply(window,arguments)&&_2f5.apply(window,arguments);};};var _2f6=function(i,arr){var r=arr||[];if(i){r.push(i);}return r;};var _2f7=function(n){return (1==n.nodeType);};var _2f8="";var _2f9=function(elem,attr){if(!elem){return _2f8;}if(attr=="class"){return elem.className||_2f8;}if(attr=="for"){return elem.htmlFor||_2f8;}if(attr=="style"){return elem.style.cssText||_2f8;}return (_2df?elem.getAttribute(attr):elem.getAttribute(attr,2))||_2f8;};var _2fa={"*=":function(attr,_2fb){return function(elem){return (_2f9(elem,attr).indexOf(_2fb)>=0);};},"^=":function(attr,_2fc){return function(elem){return (_2f9(elem,attr).indexOf(_2fc)==0);};},"$=":function(attr,_2fd){return function(elem){var ea=" "+_2f9(elem,attr);return (ea.lastIndexOf(_2fd)==(ea.length-_2fd.length));};},"~=":function(attr,_2fe){var tval=" "+_2fe+" ";return function(elem){var ea=" "+_2f9(elem,attr)+" ";return (ea.indexOf(tval)>=0);};},"|=":function(attr,_2ff){var _300=_2ff+"-";return function(elem){var ea=_2f9(elem,attr);return ((ea==_2ff)||(ea.indexOf(_300)==0));};},"=":function(attr,_301){return function(elem){return (_2f9(elem,attr)==_301);};}};var _302=(typeof _2dc().firstChild.nextElementSibling=="undefined");var _303=!_302?"nextElementSibling":"nextSibling";var _304=!_302?"previousElementSibling":"previousSibling";var _305=(_302?_2f7:_2e0);var _306=function(node){while(node=node[_304]){if(_305(node)){return false;}}return true;};var _307=function(node){while(node=node[_303]){if(_305(node)){return false;}}return true;};var _308=function(node){var root=node.parentNode;var i=0,tret=root.children||root.childNodes,ci=(node["_i"]||-1),cl=(root["_l"]||-1);if(!tret){return -1;}var l=tret.length;if(cl==l&&ci>=0&&cl>=0){return ci;}root["_l"]=l;ci=-1;for(var te=root["firstElementChild"]||root["firstChild"];te;te=te[_303]){if(_305(te)){te["_i"]=++i;if(node===te){ci=i;}}}return ci;};var _309=function(elem){return !((_308(elem))%2);};var _30a=function(elem){return ((_308(elem))%2);};var _30b={"checked":function(name,_30c){return function(elem){return !!("checked" in elem?elem.checked:elem.selected);};},"first-child":function(){return _306;},"last-child":function(){return _307;},"only-child":function(name,_30d){return function(node){return _306(node)&&_307(node);};},"empty":function(name,_30e){return function(elem){var cn=elem.childNodes;var cnl=elem.childNodes.length;for(var x=cnl-1;x>=0;x--){var nt=cn[x].nodeType;if((nt===1)||(nt==3)){return false;}}return true;};},"contains":function(name,_30f){var cz=_30f.charAt(0);if(cz=="\""||cz=="'"){_30f=_30f.slice(1,-1);}return function(elem){return (elem.innerHTML.indexOf(_30f)>=0);};},"not":function(name,_310){var p=_2e1(_310)[0];var _311={el:1};if(p.tag!="*"){_311.tag=1;}if(!p.classes.length){_311.classes=1;}var ntf=_312(p,_311);return function(elem){return (!ntf(elem));};},"nth-child":function(name,_313){var pi=parseInt;if(_313=="odd"){return _30a;}else{if(_313=="even"){return _309;}}if(_313.indexOf("n")!=-1){var _314=_313.split("n",2);var pred=_314[0]?((_314[0]=="-")?-1:pi(_314[0])):1;var idx=_314[1]?pi(_314[1]):0;var lb=0,ub=-1;if(pred>0){if(idx<0){idx=(idx%pred)&&(pred+(idx%pred));}else{if(idx>0){if(idx>=pred){lb=idx-idx%pred;}idx=idx%pred;}}}else{if(pred<0){pred*=-1;if(idx>0){ub=idx;idx=idx%pred;}}}if(pred>0){return function(elem){var i=_308(elem);return (i>=lb)&&(ub<0||i<=ub)&&((i%pred)==idx);};}else{_313=idx;}}var _315=pi(_313);return function(elem){return (_308(elem)==_315);};}};var _316=(dojo.isIE&&(dojo.isIE<9||dojo.isQuirks))?function(cond){var clc=cond.toLowerCase();if(clc=="class"){cond="className";}return function(elem){return (_2df?elem.getAttribute(cond):elem[cond]||elem[clc]);};}:function(cond){return function(elem){return (elem&&elem.getAttribute&&elem.hasAttribute(cond));};};var _312=function(_317,_318){if(!_317){return _2e0;}_318=_318||{};var ff=null;if(!("el" in _318)){ff=_2f3(ff,_2f7);}if(!("tag" in _318)){if(_317.tag!="*"){ff=_2f3(ff,function(elem){return (elem&&(elem.tagName==_317.getTag()));});}}if(!("classes" in _318)){each(_317.classes,function(_319,idx,arr){var re=new RegExp("(?:^|\\s)"+_319+"(?:\\s|$)");ff=_2f3(ff,function(elem){return re.test(elem.className);});ff.count=idx;});}if(!("pseudos" in _318)){each(_317.pseudos,function(_31a){var pn=_31a.name;if(_30b[pn]){ff=_2f3(ff,_30b[pn](pn,_31a.value));}});}if(!("attrs" in _318)){each(_317.attrs,function(attr){var _31b;var a=attr.attr;if(attr.type&&_2fa[attr.type]){_31b=_2fa[attr.type](a,attr.matchFor);}else{if(a.length){_31b=_316(a);}}if(_31b){ff=_2f3(ff,_31b);}});}if(!("id" in _318)){if(_317.id){ff=_2f3(ff,function(elem){return (!!elem&&(elem.id==_317.id));});}}if(!ff){if(!("default" in _318)){ff=_2e0;}}return ff;};var _31c=function(_31d){return function(node,ret,bag){while(node=node[_303]){if(_302&&(!_2f7(node))){continue;}if((!bag||_31e(node,bag))&&_31d(node)){ret.push(node);}break;}return ret;};};var _31f=function(_320){return function(root,ret,bag){var te=root[_303];while(te){if(_305(te)){if(bag&&!_31e(te,bag)){break;}if(_320(te)){ret.push(te);}}te=te[_303];}return ret;};};var _321=function(_322){_322=_322||_2e0;return function(root,ret,bag){var te,x=0,tret=root.children||root.childNodes;while(te=tret[x++]){if(_305(te)&&(!bag||_31e(te,bag))&&(_322(te,x))){ret.push(te);}}return ret;};};var _323=function(node,root){var pn=node.parentNode;while(pn){if(pn==root){break;}pn=pn.parentNode;}return !!pn;};var _324={};var _325=function(_326){var _327=_324[_326.query];if(_327){return _327;}var io=_326.infixOper;var oper=(io?io.oper:"");var _328=_312(_326,{el:1});var qt=_326.tag;var _329=("*"==qt);var ecs=_2dc()["getElementsByClassName"];if(!oper){if(_326.id){_328=(!_326.loops&&_329)?_2e0:_312(_326,{el:1,id:1});_327=function(root,arr){var te=dom.byId(_326.id,(root.ownerDocument||root));if(!te||!_328(te)){return;}if(9==root.nodeType){return _2f6(te,arr);}else{if(_323(te,root)){return _2f6(te,arr);}}};}else{if(ecs&&/\{\s*\[native code\]\s*\}/.test(String(ecs))&&_326.classes.length&&!_2dd){_328=_312(_326,{el:1,classes:1,id:1});var _32a=_326.classes.join(" ");_327=function(root,arr,bag){var ret=_2f6(0,arr),te,x=0;var tret=root.getElementsByClassName(_32a);while((te=tret[x++])){if(_328(te,root)&&_31e(te,bag)){ret.push(te);}}return ret;};}else{if(!_329&&!_326.loops){_327=function(root,arr,bag){var ret=_2f6(0,arr),te,x=0;var tret=root.getElementsByTagName(_326.getTag());while((te=tret[x++])){if(_31e(te,bag)){ret.push(te);}}return ret;};}else{_328=_312(_326,{el:1,tag:1,id:1});_327=function(root,arr,bag){var ret=_2f6(0,arr),te,x=0;var tret=root.getElementsByTagName(_326.getTag());while((te=tret[x++])){if(_328(te,root)&&_31e(te,bag)){ret.push(te);}}return ret;};}}}}else{var _32b={el:1};if(_329){_32b.tag=1;}_328=_312(_326,_32b);if("+"==oper){_327=_31c(_328);}else{if("~"==oper){_327=_31f(_328);}else{if(">"==oper){_327=_321(_328);}}}}return _324[_326.query]=_327;};var _32c=function(root,_32d){var _32e=_2f6(root),qp,x,te,qpl=_32d.length,bag,ret;for(var i=0;i0){bag={};ret.nozip=true;}var gef=_325(qp);for(var j=0;(te=_32e[j]);j++){gef(te,ret,bag);}if(!ret.length){break;}_32e=ret;}return ret;};var _32f={},_330={};var _331=function(_332){var _333=_2e1(trim(_332));if(_333.length==1){var tef=_325(_333[0]);return function(root){var r=tef(root,[]);if(r){r.nozip=true;}return r;};}return function(root){return _32c(root,_333);};};var nua=navigator.userAgent;var wk="WebKit/";var _334=(dojo.isWebKit&&(nua.indexOf(wk)>0)&&(parseFloat(nua.split(wk)[1])>528));var _335=dojo.isIE?"commentStrip":"nozip";var qsa="querySelectorAll";var _336=(!!_2dc()[qsa]&&(!dojo.isSafari||(dojo.isSafari>3.1)||_334));var _337=/n\+\d|([^ ])?([>~+])([^ =])?/g;var _338=function(_339,pre,ch,post){return ch?(pre?pre+" ":"")+ch+(post?" "+post:""):_339;};var _33a=function(_33b,_33c){_33b=_33b.replace(_337,_338);if(_336){var _33d=_330[_33b];if(_33d&&!_33c){return _33d;}}var _33e=_32f[_33b];if(_33e){return _33e;}var qcz=_33b.charAt(0);var _33f=(-1==_33b.indexOf(" "));if((_33b.indexOf("#")>=0)&&(_33f)){_33c=true;}var _340=(_336&&(!_33c)&&(_2de.indexOf(qcz)==-1)&&(!dojo.isIE||(_33b.indexOf(":")==-1))&&(!(_2dd&&(_33b.indexOf(".")>=0)))&&(_33b.indexOf(":contains")==-1)&&(_33b.indexOf(":checked")==-1)&&(_33b.indexOf("|=")==-1));if(_340){var tq=(_2de.indexOf(_33b.charAt(_33b.length-1))>=0)?(_33b+" *"):_33b;return _330[_33b]=function(root){try{if(!((9==root.nodeType)||_33f)){throw "";}var r=root[qsa](tq);r[_335]=true;return r;}catch(e){return _33a(_33b,true)(root);}};}else{var _341=_33b.split(/\s*,\s*/);return _32f[_33b]=((_341.length<2)?_331(_33b):function(root){var _342=0,ret=[],tp;while((tp=_341[_342++])){ret=ret.concat(_331(tp)(root));}return ret;});}};var _343=0;var _344=dojo.isIE?function(node){if(_2df){return (node.getAttribute("_uid")||node.setAttribute("_uid",++_343)||_343);}else{return node.uniqueID;}}:function(node){return (node._uid||(node._uid=++_343));};var _31e=function(node,bag){if(!bag){return 1;}var id=_344(node);if(!bag[id]){return bag[id]=1;}return 0;};var _345="_zipIdx";var _346=function(arr){if(arr&&arr.nozip){return arr;}var ret=[];if(!arr||!arr.length){return ret;}if(arr[0]){ret.push(arr[0]);}if(arr.length<2){return ret;}_343++;if(dojo.isIE&&_2df){var _347=_343+"";arr[0].setAttribute(_345,_347);for(var x=1,te;te=arr[x];x++){if(arr[x].getAttribute(_345)!=_347){ret.push(te);}te.setAttribute(_345,_347);}}else{if(dojo.isIE&&arr.commentStrip){try{for(var x=1,te;te=arr[x];x++){if(_2f7(te)){ret.push(te);}}}catch(e){}}else{if(arr[0]){arr[0][_345]=_343;}for(var x=1,te;te=arr[x];x++){if(arr[x][_345]!=_343){ret.push(te);}te[_345]=_343;}}}return ret;};var _348=function(_349,root){root=root||_2dc();var od=root.ownerDocument||root.documentElement;_2df=(root.contentType&&root.contentType=="application/xml")||(dojo.isOpera&&(root.doctype||od.toString()=="[object XMLDocument]"))||(!!od)&&(dojo.isIE?od.xml:(root.xmlVersion||od.xmlVersion));var r=_33a(_349)(root);if(r&&r.nozip){return r;}return _346(r);};_348.filter=function(_34a,_34b,root){var _34c=[],_34d=_2e1(_34b),_34e=(_34d.length==1&&!/[^\w#\.]/.test(_34b))?_312(_34d[0]):function(node){return dojo.query(_34b,root).indexOf(node)!=-1;};for(var x=0,te;te=_34a[x];x++){if(_34e(te)){_34c.push(te);}}return _34c;};return _348;});},"dojo/dom-style":function(){define("dojo/dom-style",["./_base/sniff","./dom"],function(has,dom){var _34f,_350={};if(has("webkit")){_34f=function(node){var s;if(node.nodeType==1){var dv=node.ownerDocument.defaultView;s=dv.getComputedStyle(node,null);if(!s&&node.style){node.style.display="";s=dv.getComputedStyle(node,null);}}return s||{};};}else{if(has("ie")&&(has("ie")<9||has("quirks"))){_34f=function(node){return node.nodeType==1?node.currentStyle:{};};}else{_34f=function(node){return node.nodeType==1?node.ownerDocument.defaultView.getComputedStyle(node,null):{};};}}_350.getComputedStyle=_34f;var _351;if(!has("ie")){_351=function(_352,_353){return parseFloat(_353)||0;};}else{_351=function(_354,_355){if(!_355){return 0;}if(_355=="medium"){return 4;}if(_355.slice&&_355.slice(-2)=="px"){return parseFloat(_355);}var s=_354.style,rs=_354.runtimeStyle,cs=_354.currentStyle,_356=s.left,_357=rs.left;rs.left=cs.left;try{s.left=_355;_355=s.pixelLeft;}catch(e){_355=0;}s.left=_356;rs.left=_357;return _355;};}_350.toPixelValue=_351;var astr="DXImageTransform.Microsoft.Alpha";var af=function(n,f){try{return n.filters.item(astr);}catch(e){return f?{}:null;}};var _358=has("ie")<9||(has("ie")&&has("quirks"))?function(node){try{return af(node).Opacity/100;}catch(e){return 1;}}:function(node){return _34f(node).opacity;};var _359=has("ie")<9||(has("ie")&&has("quirks"))?function(node,_35a){var ov=_35a*100,_35b=_35a==1;node.style.zoom=_35b?"":1;if(!af(node)){if(_35b){return _35a;}node.style.filter+=" progid:"+astr+"(Opacity="+ov+")";}else{af(node,1).Opacity=ov;}af(node,1).Enabled=!_35b;if(node.tagName.toLowerCase()=="tr"){for(var td=node.firstChild;td;td=td.nextSibling){if(td.tagName.toLowerCase()=="td"){_359(td,_35a);}}}return _35a;}:function(node,_35c){return node.style.opacity=_35c;};var _35d={left:true,top:true};var _35e=/margin|padding|width|height|max|min|offset/;function _35f(node,type,_360){type=type.toLowerCase();if(has("ie")){if(_360=="auto"){if(type=="height"){return node.offsetHeight;}if(type=="width"){return node.offsetWidth;}}if(type=="fontweight"){switch(_360){case 700:return "bold";case 400:default:return "normal";}}}if(!(type in _35d)){_35d[type]=_35e.test(type);}return _35d[type]?_351(node,_360):_360;};var _361=has("ie")?"styleFloat":"cssFloat",_362={"cssFloat":_361,"styleFloat":_361,"float":_361};_350.get=function getStyle(node,name){var n=dom.byId(node),l=arguments.length,op=(name=="opacity");if(l==2&&op){return _358(n);}name=_362[name]||name;var s=_350.getComputedStyle(n);return (l==1)?s:_35f(n,name,s[name]||n.style[name]);};_350.set=function setStyle(node,name,_363){var n=dom.byId(node),l=arguments.length,op=(name=="opacity");name=_362[name]||name;if(l==3){return op?_359(n,_363):n.style[name]=_363;}for(var x in name){_350.set(node,x,name[x]);}return _350.getComputedStyle(n);};return _350;});},"dojo/dom-geometry":function(){define(["./_base/sniff","./_base/window","./dom","./dom-style"],function(has,win,dom,_364){var geom={};geom.boxModel="content-box";if(has("ie")){geom.boxModel=document.compatMode=="BackCompat"?"border-box":"content-box";}geom.getPadExtents=function getPadExtents(node,_365){node=dom.byId(node);var s=_365||_364.getComputedStyle(node),px=_364.toPixelValue,l=px(node,s.paddingLeft),t=px(node,s.paddingTop),r=px(node,s.paddingRight),b=px(node,s.paddingBottom);return {l:l,t:t,r:r,b:b,w:l+r,h:t+b};};var none="none";geom.getBorderExtents=function getBorderExtents(node,_366){node=dom.byId(node);var px=_364.toPixelValue,s=_366||_364.getComputedStyle(node),l=s.borderLeftStyle!=none?px(node,s.borderLeftWidth):0,t=s.borderTopStyle!=none?px(node,s.borderTopWidth):0,r=s.borderRightStyle!=none?px(node,s.borderRightWidth):0,b=s.borderBottomStyle!=none?px(node,s.borderBottomWidth):0;return {l:l,t:t,r:r,b:b,w:l+r,h:t+b};};geom.getPadBorderExtents=function getPadBorderExtents(node,_367){node=dom.byId(node);var s=_367||_364.getComputedStyle(node),p=geom.getPadExtents(node,s),b=geom.getBorderExtents(node,s);return {l:p.l+b.l,t:p.t+b.t,r:p.r+b.r,b:p.b+b.b,w:p.w+b.w,h:p.h+b.h};};geom.getMarginExtents=function getMarginExtents(node,_368){node=dom.byId(node);var s=_368||_364.getComputedStyle(node),px=_364.toPixelValue,l=px(node,s.marginLeft),t=px(node,s.marginTop),r=px(node,s.marginRight),b=px(node,s.marginBottom);if(has("webkit")&&(s.position!="absolute")){r=l;}return {l:l,t:t,r:r,b:b,w:l+r,h:t+b};};geom.getMarginBox=function getMarginBox(node,_369){node=dom.byId(node);var s=_369||_364.getComputedStyle(node),me=geom.getMarginExtents(node,s),l=node.offsetLeft-me.l,t=node.offsetTop-me.t,p=node.parentNode,px=_364.toPixelValue,pcs;if(has("mozilla")){var sl=parseFloat(s.left),st=parseFloat(s.top);if(!isNaN(sl)&&!isNaN(st)){l=sl,t=st;}else{if(p&&p.style){pcs=_364.getComputedStyle(p);if(pcs.overflow!="visible"){l+=pcs.borderLeftStyle!=none?px(node,pcs.borderLeftWidth):0;t+=pcs.borderTopStyle!=none?px(node,pcs.borderTopWidth):0;}}}}else{if(has("opera")||(has("ie")==8&&!has("quirks"))){if(p){pcs=_364.getComputedStyle(p);l-=pcs.borderLeftStyle!=none?px(node,pcs.borderLeftWidth):0;t-=pcs.borderTopStyle!=none?px(node,pcs.borderTopWidth):0;}}}return {l:l,t:t,w:node.offsetWidth+me.w,h:node.offsetHeight+me.h};};geom.getContentBox=function getContentBox(node,_36a){node=dom.byId(node);var s=_36a||_364.getComputedStyle(node),w=node.clientWidth,h,pe=geom.getPadExtents(node,s),be=geom.getBorderExtents(node,s);if(!w){w=node.offsetWidth;h=node.offsetHeight;}else{h=node.clientHeight;be.w=be.h=0;}if(has("opera")){pe.l+=be.l;pe.t+=be.t;}return {l:pe.l,t:pe.t,w:w-pe.w-be.w,h:h-pe.h-be.h};};function _36b(node,l,t,w,h,u){u=u||"px";var s=node.style;if(!isNaN(l)){s.left=l+u;}if(!isNaN(t)){s.top=t+u;}if(w>=0){s.width=w+u;}if(h>=0){s.height=h+u;}};function _36c(node){return node.tagName.toLowerCase()=="button"||node.tagName.toLowerCase()=="input"&&(node.getAttribute("type")||"").toLowerCase()=="button";};function _36d(node){return geom.boxModel=="border-box"||node.tagName.toLowerCase()=="table"||_36c(node);};geom.setContentSize=function setContentSize(node,box,_36e){node=dom.byId(node);var w=box.w,h=box.h;if(_36d(node)){var pb=geom.getPadBorderExtents(node,_36e);if(w>=0){w+=pb.w;}if(h>=0){h+=pb.h;}}_36b(node,NaN,NaN,w,h);};var _36f={l:0,t:0,w:0,h:0};geom.setMarginBox=function setMarginBox(node,box,_370){node=dom.byId(node);var s=_370||_364.getComputedStyle(node),w=box.w,h=box.h,pb=_36d(node)?_36f:geom.getPadBorderExtents(node,s),mb=geom.getMarginExtents(node,s);if(has("webkit")){if(_36c(node)){var ns=node.style;if(w>=0&&!ns.width){ns.width="4px";}if(h>=0&&!ns.height){ns.height="4px";}}}if(w>=0){w=Math.max(w-pb.w-mb.w,0);}if(h>=0){h=Math.max(h-pb.h-mb.h,0);}_36b(node,box.l,box.t,w,h);};geom.isBodyLtr=function isBodyLtr(){return (win.body().dir||win.doc.documentElement.dir||"ltr").toLowerCase()=="ltr";};geom.docScroll=function docScroll(){var node=win.doc.parentWindow||win.doc.defaultView;return "pageXOffset" in node?{x:node.pageXOffset,y:node.pageYOffset}:(node=has("quirks")?win.body():win.doc.documentElement,{x:geom.fixIeBiDiScrollLeft(node.scrollLeft||0),y:node.scrollTop||0});};geom.getIeDocumentElementOffset=function getIeDocumentElementOffset(){var de=win.doc.documentElement;if(has("ie")<8){var r=de.getBoundingClientRect(),l=r.left,t=r.top;if(has("ie")<7){l+=de.clientLeft;t+=de.clientTop;}return {x:l<0?0:l,y:t<0?0:t};}else{return {x:0,y:0};}};geom.fixIeBiDiScrollLeft=function fixIeBiDiScrollLeft(_371){var ie=has("ie");if(ie&&!geom.isBodyLtr()){var qk=has("quirks"),de=qk?win.body():win.doc.documentElement;if(ie==6&&!qk&&win.global.frameElement&&de.scrollHeight>de.clientHeight){_371+=de.clientLeft;}return (ie<8||qk)?(_371+de.clientWidth-de.scrollWidth):-_371;}return _371;};geom.position=function(node,_372){node=dom.byId(node);var db=win.body(),dh=db.parentNode,ret=node.getBoundingClientRect();ret={x:ret.left,y:ret.top,w:ret.right-ret.left,h:ret.bottom-ret.top};if(has("ie")){var _373=geom.getIeDocumentElementOffset();ret.x-=_373.x+(has("quirks")?db.clientLeft+db.offsetLeft:0);ret.y-=_373.y+(has("quirks")?db.clientTop+db.offsetTop:0);}else{if(has("ff")==3){var cs=_364.getComputedStyle(dh),px=_364.toPixelValue;ret.x-=px(dh,cs.marginLeft)+px(dh,cs.borderLeftWidth);ret.y-=px(dh,cs.marginTop)+px(dh,cs.borderTopWidth);}}if(_372){var _374=geom.docScroll();ret.x+=_374.x;ret.y+=_374.y;}return ret;};geom.getMarginSize=function getMarginSize(node,_375){node=dom.byId(node);var me=geom.getMarginExtents(node,_375||_364.getComputedStyle(node));var size=node.getBoundingClientRect();return {w:(size.right-size.left)+me.w,h:(size.bottom-size.top)+me.h};};geom.normalizeEvent=function(_376){if(!("layerX" in _376)){_376.layerX=_376.offsetX;_376.layerY=_376.offsetY;}if(!has("dom-addeventlistener")){var se=_376.target;var doc=(se&&se.ownerDocument)||document;var _377=has("quirks")?doc.body:doc.documentElement;var _378=geom.getIeDocumentElementOffset();_376.pageX=_376.clientX+geom.fixIeBiDiScrollLeft(_377.scrollLeft||0)-_378.x;_376.pageY=_376.clientY+(_377.scrollTop||0)-_378.y;}};return geom;});},"dojo/dom-prop":function(){define(["exports","./_base/kernel","./_base/sniff","./_base/lang","./dom","./dom-style","./dom-construct","./_base/connect"],function(_379,dojo,has,lang,dom,_37a,ctr,conn){var _37b={},_37c=0,_37d=dojo._scopeName+"attrid";var _37e={col:1,colgroup:1,table:1,tbody:1,tfoot:1,thead:1,tr:1,title:1};_379.names={"class":"className","for":"htmlFor",tabindex:"tabIndex",readonly:"readOnly",colspan:"colSpan",frameborder:"frameBorder",rowspan:"rowSpan",valuetype:"valueType"};_379.get=function getProp(node,name){node=dom.byId(node);var lc=name.toLowerCase(),_37f=_379.names[lc]||name;return node[_37f];};_379.set=function setProp(node,name,_380){node=dom.byId(node);var l=arguments.length;if(l==2&&typeof name!="string"){for(var x in name){_379.set(node,x,name[x]);}return node;}var lc=name.toLowerCase(),_381=_379.names[lc]||name;if(_381=="style"&&typeof _380!="string"){_37a.style(node,_380);return node;}if(_381=="innerHTML"){if(has("ie")&&node.tagName.toLowerCase() in _37e){ctr.empty(node);node.appendChild(ctr.toDom(_380,node.ownerDocument));}else{node[_381]=_380;}return node;}if(lang.isFunction(_380)){var _382=node[_37d];if(!_382){_382=_37c++;node[_37d]=_382;}if(!_37b[_382]){_37b[_382]={};}var h=_37b[_382][_381];if(h){conn.disconnect(h);}else{try{delete node[_381];}catch(e){}}if(_380){_37b[_382][_381]=conn.connect(node,_381,_380);}else{node[_381]=null;}return node;}node[_381]=_380;return node;};});},"dojo/dom-attr":function(){define(["exports","./_base/sniff","./_base/lang","./dom","./dom-style","./dom-prop"],function(_383,has,lang,dom,_384,prop){var _385={innerHTML:1,className:1,htmlFor:has("ie"),value:1},_386={classname:"class",htmlfor:"for",tabindex:"tabIndex",readonly:"readOnly"};function _387(node,name){var attr=node.getAttributeNode&&node.getAttributeNode(name);return attr&&attr.specified;};_383.has=function hasAttr(node,name){var lc=name.toLowerCase();return _385[prop.names[lc]||name]||_387(dom.byId(node),_386[lc]||name);};_383.get=function getAttr(node,name){node=dom.byId(node);var lc=name.toLowerCase(),_388=prop.names[lc]||name,_389=_385[_388];value=node[_388];if(_389&&typeof value!="undefined"){return value;}if(_388!="href"&&(typeof value=="boolean"||lang.isFunction(value))){return value;}var _38a=_386[lc]||name;return _387(node,_38a)?node.getAttribute(_38a):null;};_383.set=function setAttr(node,name,_38b){node=dom.byId(node);if(arguments.length==2){for(var x in name){_383.set(node,x,name[x]);}return node;}var lc=name.toLowerCase(),_38c=prop.names[lc]||name,_38d=_385[_38c];if(_38c=="style"&&typeof _38b!="string"){_384.set(node,_38b);return node;}if(_38d||typeof _38b=="boolean"||lang.isFunction(_38b)){return prop.set(node,name,_38b);}node.setAttribute(_386[lc]||name,_38b);return node;};_383.remove=function removeAttr(node,name){dom.byId(node).removeAttribute(_386[name.toLowerCase()]||name);};_383.getNodeProp=function getNodeProp(node,name){node=dom.byId(node);var lc=name.toLowerCase(),_38e=prop.names[lc]||name;if((_38e in node)&&_38e!="href"){return node[_38e];}var _38f=_386[lc]||name;return _387(node,_38f)?node.getAttribute(_38f):null;};});},"dojo/dom-construct":function(){define(["exports","./_base/kernel","./_base/sniff","./_base/window","./dom","./dom-attr","./on"],function(_390,dojo,has,win,dom,attr,on){var _391={option:["select"],tbody:["table"],thead:["table"],tfoot:["table"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","thead","tr"],legend:["fieldset"],caption:["table"],colgroup:["table"],col:["table","colgroup"],li:["ul"]},_392=/<\s*([\w\:]+)/,_393={},_394=0,_395="__"+dojo._scopeName+"ToDomId";for(var _396 in _391){if(_391.hasOwnProperty(_396)){var tw=_391[_396];tw.pre=_396=="option"?"",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[0>c?c+b:c]}),even:pa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e)}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,e>i&&ya(a.slice(i,e)),f>e&&ya(a=a.slice(e)),f>e&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;d>b;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;d>b;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(f>b)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(1>=b&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){ return j.call(r(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:X.test(c)?JSON.parse(c):c}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),Z(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=Z(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthf;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ba(d)&&(e[f]=fa(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;g>f;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ga(this,!0)},hide:function(){return ga(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ba(this)?r(this).show():r(this).hide()})}});var ha=/^(?:checkbox|radio)$/i,ia=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;d>c;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var na=/<|&#?\w+;/;function oa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;o>n;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(na.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ia.exec(f)||["",""])[1].toLowerCase(),i=ka[h]||ka._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;cc;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?r(e,this).index(i)>-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ga(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ha.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ha(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;m>l;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,la(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ea),l=0;i>l;l++)j=h[l],ja.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ba,""),k))}return a}function Ia(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(la(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&ma(la(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(xa,"<$1>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;e>d;d++)Ga(f[d],g[d]);if(b)if(c)for(f=f||la(a),g=g||la(h),d=0,e=f.length;e>d;d++)Fa(f[d],g[d]);else Fa(a,h);return g=la(h,"script"),g.length>0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(la(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(la(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;f>=g;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ja=/^margin/,Ka=new RegExp("^("+$+")(?!px)[a-z%]+$","i"),La=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",pa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,pa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Ma(a,b,c){var d,e,f,g,h=a.style;return c=c||La(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ka.test(g)&&Ja.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Na(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Oa=/^(none|table(?!-c[ea]).+)/,Pa={position:"absolute",visibility:"hidden",display:"block"},Qa={letterSpacing:"0",fontWeight:"400"},Ra=["Webkit","Moz","ms"],Sa=d.createElement("div").style;function Ta(a){if(a in Sa)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ra.length;while(c--)if(a=Ra[c]+b,a in Sa)return a}function Ua(a,b,c){var d=_.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Va(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=r.css(a,c+aa[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+aa[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+aa[f]+"Width",!0,e))):(g+=r.css(a,"padding"+aa[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+aa[f]+"Width",!0,e)));return g}function Wa(a,b,c){var d,e=!0,f=La(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),0>=d||null==d){if(d=Ma(a,b,f),(0>d||null==d)&&(d=a.style[b]),Ka.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Va(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ma(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=_.exec(c))&&e[1]&&(c=da(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Ma(a,b,d)),"normal"===e&&b in Qa&&(e=Qa[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){return c?!Oa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Wa(a,b,d):ca(a,Pa,function(){return Wa(a,b,d)}):void 0},set:function(a,c,d){var e,f=d&&La(a),g=d&&Va(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=_.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ua(a,c,g)}}}),r.cssHooks.marginLeft=Na(o.reliableMarginLeft,function(a,b){return b?(parseFloat(Ma(a,"marginLeft"))||a.getBoundingClientRect().left-ca(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+aa[d]+b]=f[d]||f[d-2]||f[0];return e}},Ja.test(a)||(r.cssHooks[a+b].set=Ua)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=La(a),e=b.length;e>g;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Xa(a,b,c,d,e){return new Xa.prototype.init(a,b,c,d,e)}r.Tween=Xa,Xa.prototype={constructor:Xa,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Xa.propHooks[this.prop];return a&&a.get?a.get(this):Xa.propHooks._default.get(this)},run:function(a){var b,c=Xa.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Xa.propHooks._default.set(this),this}},Xa.prototype.init.prototype=Xa.prototype,Xa.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Xa.propHooks.scrollTop=Xa.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Xa.prototype.init,r.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=/queueHooks$/;function ab(){Za&&(a.requestAnimationFrame(ab),r.fx.tick())}function bb(){return a.setTimeout(function(){Ya=void 0}),Ya=r.now()}function cb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=aa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function db(a,b,c){for(var d,e=(gb.tweeners[b]||[]).concat(gb.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function eb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ba(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],$a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ga([a],!0),j=a.style.display||j,k=r.css(a,"display"),ga([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ga([a],!0),m.done(function(){p||ga([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=db(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function fb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function gb(a,b,c){var d,e,f=0,g=gb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Ya||bb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Ya||bb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(fb(k,j.opts.specialEasing);g>f;f++)if(d=gb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,db,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}r.Animation=r.extend(gb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return da(c.elem,a,_.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;e>d;d++)c=a[d],gb.tweeners[c]=gb.tweeners[c]||[],gb.tweeners[c].unshift(b)},prefilters:[eb],prefilter:function(a,b){b?gb.prefilters.unshift(a):gb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:e.duration="number"==typeof e.duration?e.duration:e.duration in r.fx.speeds?r.fx.speeds[e.duration]:r.fx.speeds._default,null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ba).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=gb(this,r.extend({},a),f);(e||V.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&_a.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(cb(b,!0),a,d,e)}}),r.each({slideDown:cb("show"),slideUp:cb("hide"),slideToggle:cb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Ya=r.now();b1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?hb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c); }}),hb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ib[b]||r.find.attr;ib[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=ib[g],ib[g]=e,e=null!=c(a,b,d)?g:null,ib[g]=f),e}});var jb=/^(?:input|select|textarea|button)$/i,kb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):jb.test(a.nodeName)||kb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;function mb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,mb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,mb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,mb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=mb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(c)+" ").replace(lb," ").indexOf(b)>-1)return!0;return!1}});var nb=/\r/g,ob=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(nb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(ob," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){return r.isArray(b)?a.checked=r.inArray(r(a).val(),b)>-1:void 0}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?r.event.trigger(a,b,c,!0):void 0}}),r.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(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,""),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",0>b&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;return o.cors||Pb&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("
================================================ FILE: test/qunit-2.5.0.css ================================================ /*! * QUnit 2.5.0 * https://qunitjs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * https://jquery.org/license * * Date: 2018-01-10T02:56Z */ /** Font Family and Sizes */ #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult { font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; } #qunit-testrunner-toolbar, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } #qunit-tests { font-size: smaller; } /** Resets */ #qunit-tests, #qunit-header, #qunit-banner, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { margin: 0; padding: 0; } /** Header (excluding toolbar) */ #qunit-header { padding: 0.5em 0 0.5em 1em; color: #8699A4; background-color: #0D3349; font-size: 1.5em; line-height: 1em; font-weight: 400; border-radius: 5px 5px 0 0; } #qunit-header a { text-decoration: none; color: #C2CCD1; } #qunit-header a:hover, #qunit-header a:focus { color: #FFF; } #qunit-banner { height: 5px; } #qunit-filteredTest { padding: 0.5em 1em 0.5em 1em; color: #366097; background-color: #F4FF77; } #qunit-userAgent { padding: 0.5em 1em 0.5em 1em; color: #FFF; background-color: #2B81AF; text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; } /** Toolbar */ #qunit-testrunner-toolbar { padding: 0.5em 1em 0.5em 1em; color: #5E740B; background-color: #EEE; } #qunit-testrunner-toolbar .clearfix { height: 0; clear: both; } #qunit-testrunner-toolbar label { display: inline-block; } #qunit-testrunner-toolbar input[type=checkbox], #qunit-testrunner-toolbar input[type=radio] { margin: 3px; vertical-align: -2px; } #qunit-testrunner-toolbar input[type=text] { box-sizing: border-box; height: 1.6em; } .qunit-url-config, .qunit-filter, #qunit-modulefilter { display: inline-block; line-height: 2.1em; } .qunit-filter, #qunit-modulefilter { float: right; position: relative; margin-left: 1em; } .qunit-url-config label { margin-right: 0.5em; } #qunit-modulefilter-search { box-sizing: border-box; width: 400px; } #qunit-modulefilter-search-container:after { position: absolute; right: 0.3em; content: "\25bc"; color: black; } #qunit-modulefilter-dropdown { /* align with #qunit-modulefilter-search */ box-sizing: border-box; width: 400px; position: absolute; right: 0; top: 50%; margin-top: 0.8em; border: 1px solid #D3D3D3; border-top: none; border-radius: 0 0 .25em .25em; color: #000; background-color: #F5F5F5; z-index: 99; } #qunit-modulefilter-dropdown a { color: inherit; text-decoration: none; } #qunit-modulefilter-dropdown .clickable.checked { font-weight: bold; color: #000; background-color: #D2E0E6; } #qunit-modulefilter-dropdown .clickable:hover { color: #FFF; background-color: #0D3349; } #qunit-modulefilter-actions { display: block; overflow: auto; /* align with #qunit-modulefilter-dropdown-list */ font: smaller/1.5em sans-serif; } #qunit-modulefilter-dropdown #qunit-modulefilter-actions > * { box-sizing: border-box; max-height: 2.8em; display: block; padding: 0.4em; } #qunit-modulefilter-dropdown #qunit-modulefilter-actions > button { float: right; font: inherit; } #qunit-modulefilter-dropdown #qunit-modulefilter-actions > :last-child { /* insert padding to align with checkbox margins */ padding-left: 3px; } #qunit-modulefilter-dropdown-list { max-height: 200px; overflow-y: auto; margin: 0; border-top: 2px groove threedhighlight; padding: 0.4em 0 0; font: smaller/1.5em sans-serif; } #qunit-modulefilter-dropdown-list li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #qunit-modulefilter-dropdown-list .clickable { display: block; padding-left: 0.15em; } /** Tests: Pass/Fail */ #qunit-tests { list-style-position: inside; } #qunit-tests li { padding: 0.4em 1em 0.4em 1em; border-bottom: 1px solid #FFF; list-style-position: inside; } #qunit-tests > li { display: none; } #qunit-tests li.running, #qunit-tests li.pass, #qunit-tests li.fail, #qunit-tests li.skipped, #qunit-tests li.aborted { display: list-item; } #qunit-tests.hidepass { position: relative; } #qunit-tests.hidepass li.running, #qunit-tests.hidepass li.pass:not(.todo) { visibility: hidden; position: absolute; width: 0; height: 0; padding: 0; border: 0; margin: 0; } #qunit-tests li strong { cursor: pointer; } #qunit-tests li.skipped strong { cursor: default; } #qunit-tests li a { padding: 0.5em; color: #C2CCD1; text-decoration: none; } #qunit-tests li p a { padding: 0.25em; color: #6B6464; } #qunit-tests li a:hover, #qunit-tests li a:focus { color: #000; } #qunit-tests li .runtime { float: right; font-size: smaller; } .qunit-assert-list { margin-top: 0.5em; padding: 0.5em; background-color: #FFF; border-radius: 5px; } .qunit-source { margin: 0.6em 0 0.3em; } .qunit-collapsed { display: none; } #qunit-tests table { border-collapse: collapse; margin-top: 0.2em; } #qunit-tests th { text-align: right; vertical-align: top; padding: 0 0.5em 0 0; } #qunit-tests td { vertical-align: top; } #qunit-tests pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; } #qunit-tests del { color: #374E0C; background-color: #E0F2BE; text-decoration: none; } #qunit-tests ins { color: #500; background-color: #FFCACA; text-decoration: none; } /*** Test Counts */ #qunit-tests b.counts { color: #000; } #qunit-tests b.passed { color: #5E740B; } #qunit-tests b.failed { color: #710909; } #qunit-tests li li { padding: 5px; background-color: #FFF; border-bottom: none; list-style-position: inside; } /*** Passing Styles */ #qunit-tests li li.pass { color: #3C510C; background-color: #FFF; border-left: 10px solid #C6E746; } #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } #qunit-tests .pass .test-name { color: #366097; } #qunit-tests .pass .test-actual, #qunit-tests .pass .test-expected { color: #999; } #qunit-banner.qunit-pass { background-color: #C6E746; } /*** Failing Styles */ #qunit-tests li li.fail { color: #710909; background-color: #FFF; border-left: 10px solid #EE5757; white-space: pre; } #qunit-tests > li:last-child { border-radius: 0 0 5px 5px; } #qunit-tests .fail { color: #000; background-color: #EE5757; } #qunit-tests .fail .test-name, #qunit-tests .fail .module-name { color: #000; } #qunit-tests .fail .test-actual { color: #EE5757; } #qunit-tests .fail .test-expected { color: #008000; } #qunit-banner.qunit-fail { background-color: #EE5757; } /*** Aborted tests */ #qunit-tests .aborted { color: #000; background-color: orange; } /*** Skipped tests */ #qunit-tests .skipped { background-color: #EBECE9; } #qunit-tests .qunit-todo-label, #qunit-tests .qunit-skipped-label { background-color: #F4FF77; display: inline-block; font-style: normal; color: #366097; line-height: 1.8em; padding: 0 0.5em; margin: -0.4em 0.4em -0.4em 0; } #qunit-tests .qunit-todo-label { background-color: #EEE; } /** Result */ #qunit-testresult { color: #2B81AF; background-color: #D2E0E6; border-bottom: 1px solid #FFF; } #qunit-testresult .clearfix { height: 0; clear: both; } #qunit-testresult .module-name { font-weight: 700; } #qunit-testresult-display { padding: 0.5em 1em 0.5em 1em; width: 85%; float:left; } #qunit-testresult-controls { padding: 0.5em 1em 0.5em 1em; width: 10%; float:left; } /** Fixture */ #qunit-fixture { position: absolute; top: -10000px; left: -10000px; width: 1000px; height: 1000px; } ================================================ FILE: test/qunit-2.5.0.js ================================================ /*! * QUnit 2.5.0 * https://qunitjs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * https://jquery.org/license * * Date: 2018-01-10T02:56Z */ (function (global$1) { 'use strict'; global$1 = global$1 && global$1.hasOwnProperty('default') ? global$1['default'] : global$1; var window = global$1.window; var self$1 = global$1.self; var console = global$1.console; var setTimeout = global$1.setTimeout; var clearTimeout = global$1.clearTimeout; var document = window && window.document; var navigator = window && window.navigator; var localSessionStorage = function () { var x = "qunit-test-string"; try { global$1.sessionStorage.setItem(x, x); global$1.sessionStorage.removeItem(x); return global$1.sessionStorage; } catch (e) { return undefined; } }(); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }; var toString = Object.prototype.toString; var hasOwn = Object.prototype.hasOwnProperty; var now = Date.now || function () { return new Date().getTime(); }; var defined = { document: window && window.document !== undefined, setTimeout: setTimeout !== undefined }; // Returns a new Array with the elements that are in a but not in b function diff(a, b) { var i, j, result = a.slice(); for (i = 0; i < result.length; i++) { for (j = 0; j < b.length; j++) { if (result[i] === b[j]) { result.splice(i, 1); i--; break; } } } return result; } /** * Determines whether an element exists in a given array or not. * * @method inArray * @param {Any} elem * @param {Array} array * @return {Boolean} */ function inArray(elem, array) { return array.indexOf(elem) !== -1; } /** * Makes a clone of an object using only Array or Object as base, * and copies over the own enumerable properties. * * @param {Object} obj * @return {Object} New object with only the own properties (recursively). */ function objectValues(obj) { var key, val, vals = is("array", obj) ? [] : {}; for (key in obj) { if (hasOwn.call(obj, key)) { val = obj[key]; vals[key] = val === Object(val) ? objectValues(val) : val; } } return vals; } function extend(a, b, undefOnly) { for (var prop in b) { if (hasOwn.call(b, prop)) { if (b[prop] === undefined) { delete a[prop]; } else if (!(undefOnly && typeof a[prop] !== "undefined")) { a[prop] = b[prop]; } } } return a; } function objectType(obj) { if (typeof obj === "undefined") { return "undefined"; } // Consider: typeof null === object if (obj === null) { return "null"; } var match = toString.call(obj).match(/^\[object\s(.*)\]$/), type = match && match[1]; switch (type) { case "Number": if (isNaN(obj)) { return "nan"; } return "number"; case "String": case "Boolean": case "Array": case "Set": case "Map": case "Date": case "RegExp": case "Function": case "Symbol": return type.toLowerCase(); default: return typeof obj === "undefined" ? "undefined" : _typeof(obj); } } // Safe object type checking function is(type, obj) { return objectType(obj) === type; } // Based on Java's String.hashCode, a simple but not // rigorously collision resistant hashing function function generateHash(module, testName) { var str = module + "\x1C" + testName; var hash = 0; for (var i = 0; i < str.length; i++) { hash = (hash << 5) - hash + str.charCodeAt(i); hash |= 0; } // Convert the possibly negative integer hash code into an 8 character hex string, which isn't // strictly necessary but increases user understanding that the id is a SHA-like hash var hex = (0x100000000 + hash).toString(16); if (hex.length < 8) { hex = "0000000" + hex; } return hex.slice(-8); } // Test for equality any JavaScript type. // Authors: Philippe Rathé , David Chan var equiv = (function () { // Value pairs queued for comparison. Used for breadth-first processing order, recursion // detection and avoiding repeated comparison (see below for details). // Elements are { a: val, b: val }. var pairs = []; var getProto = Object.getPrototypeOf || function (obj) { return obj.__proto__; }; function useStrictEquality(a, b) { // This only gets called if a and b are not strict equal, and is used to compare on // the primitive values inside object wrappers. For example: // `var i = 1;` // `var j = new Number(1);` // Neither a nor b can be null, as a !== b and they have the same type. if ((typeof a === "undefined" ? "undefined" : _typeof(a)) === "object") { a = a.valueOf(); } if ((typeof b === "undefined" ? "undefined" : _typeof(b)) === "object") { b = b.valueOf(); } return a === b; } function compareConstructors(a, b) { var protoA = getProto(a); var protoB = getProto(b); // Comparing constructors is more strict than using `instanceof` if (a.constructor === b.constructor) { return true; } // Ref #851 // If the obj prototype descends from a null constructor, treat it // as a null prototype. if (protoA && protoA.constructor === null) { protoA = null; } if (protoB && protoB.constructor === null) { protoB = null; } // Allow objects with no prototype to be equivalent to // objects with Object as their constructor. if (protoA === null && protoB === Object.prototype || protoB === null && protoA === Object.prototype) { return true; } return false; } function getRegExpFlags(regexp) { return "flags" in regexp ? regexp.flags : regexp.toString().match(/[gimuy]*$/)[0]; } function isContainer(val) { return ["object", "array", "map", "set"].indexOf(objectType(val)) !== -1; } function breadthFirstCompareChild(a, b) { // If a is a container not reference-equal to b, postpone the comparison to the // end of the pairs queue -- unless (a, b) has been seen before, in which case skip // over the pair. if (a === b) { return true; } if (!isContainer(a)) { return typeEquiv(a, b); } if (pairs.every(function (pair) { return pair.a !== a || pair.b !== b; })) { // Not yet started comparing this pair pairs.push({ a: a, b: b }); } return true; } var callbacks = { "string": useStrictEquality, "boolean": useStrictEquality, "number": useStrictEquality, "null": useStrictEquality, "undefined": useStrictEquality, "symbol": useStrictEquality, "date": useStrictEquality, "nan": function nan() { return true; }, "regexp": function regexp(a, b) { return a.source === b.source && // Include flags in the comparison getRegExpFlags(a) === getRegExpFlags(b); }, // abort (identical references / instance methods were skipped earlier) "function": function _function() { return false; }, "array": function array(a, b) { var i, len; len = a.length; if (len !== b.length) { // Safe and faster return false; } for (i = 0; i < len; i++) { // Compare non-containers; queue non-reference-equal containers if (!breadthFirstCompareChild(a[i], b[i])) { return false; } } return true; }, // Define sets a and b to be equivalent if for each element aVal in a, there // is some element bVal in b such that aVal and bVal are equivalent. Element // repetitions are not counted, so these are equivalent: // a = new Set( [ {}, [], [] ] ); // b = new Set( [ {}, {}, [] ] ); "set": function set$$1(a, b) { var innerEq, outerEq = true; if (a.size !== b.size) { // This optimization has certain quirks because of the lack of // repetition counting. For instance, adding the same // (reference-identical) element to two equivalent sets can // make them non-equivalent. return false; } a.forEach(function (aVal) { // Short-circuit if the result is already known. (Using for...of // with a break clause would be cleaner here, but it would cause // a syntax error on older Javascript implementations even if // Set is unused) if (!outerEq) { return; } innerEq = false; b.forEach(function (bVal) { var parentPairs; // Likewise, short-circuit if the result is already known if (innerEq) { return; } // Swap out the global pairs list, as the nested call to // innerEquiv will clobber its contents parentPairs = pairs; if (innerEquiv(bVal, aVal)) { innerEq = true; } // Replace the global pairs list pairs = parentPairs; }); if (!innerEq) { outerEq = false; } }); return outerEq; }, // Define maps a and b to be equivalent if for each key-value pair (aKey, aVal) // in a, there is some key-value pair (bKey, bVal) in b such that // [ aKey, aVal ] and [ bKey, bVal ] are equivalent. Key repetitions are not // counted, so these are equivalent: // a = new Map( [ [ {}, 1 ], [ {}, 1 ], [ [], 1 ] ] ); // b = new Map( [ [ {}, 1 ], [ [], 1 ], [ [], 1 ] ] ); "map": function map(a, b) { var innerEq, outerEq = true; if (a.size !== b.size) { // This optimization has certain quirks because of the lack of // repetition counting. For instance, adding the same // (reference-identical) key-value pair to two equivalent maps // can make them non-equivalent. return false; } a.forEach(function (aVal, aKey) { // Short-circuit if the result is already known. (Using for...of // with a break clause would be cleaner here, but it would cause // a syntax error on older Javascript implementations even if // Map is unused) if (!outerEq) { return; } innerEq = false; b.forEach(function (bVal, bKey) { var parentPairs; // Likewise, short-circuit if the result is already known if (innerEq) { return; } // Swap out the global pairs list, as the nested call to // innerEquiv will clobber its contents parentPairs = pairs; if (innerEquiv([bVal, bKey], [aVal, aKey])) { innerEq = true; } // Replace the global pairs list pairs = parentPairs; }); if (!innerEq) { outerEq = false; } }); return outerEq; }, "object": function object(a, b) { var i, aProperties = [], bProperties = []; if (compareConstructors(a, b) === false) { return false; } // Be strict: don't ensure hasOwnProperty and go deep for (i in a) { // Collect a's properties aProperties.push(i); // Skip OOP methods that look the same if (a.constructor !== Object && typeof a.constructor !== "undefined" && typeof a[i] === "function" && typeof b[i] === "function" && a[i].toString() === b[i].toString()) { continue; } // Compare non-containers; queue non-reference-equal containers if (!breadthFirstCompareChild(a[i], b[i])) { return false; } } for (i in b) { // Collect b's properties bProperties.push(i); } // Ensures identical properties name return typeEquiv(aProperties.sort(), bProperties.sort()); } }; function typeEquiv(a, b) { var type = objectType(a); // Callbacks for containers will append to the pairs queue to achieve breadth-first // search order. The pairs queue is also used to avoid reprocessing any pair of // containers that are reference-equal to a previously visited pair (a special case // this being recursion detection). // // Because of this approach, once typeEquiv returns a false value, it should not be // called again without clearing the pair queue else it may wrongly report a visited // pair as being equivalent. return objectType(b) === type && callbacks[type](a, b); } function innerEquiv(a, b) { var i, pair; // We're done when there's nothing more to compare if (arguments.length < 2) { return true; } // Clear the global pair queue and add the top-level values being compared pairs = [{ a: a, b: b }]; for (i = 0; i < pairs.length; i++) { pair = pairs[i]; // Perform type-specific comparison on any pairs that are not strictly // equal. For container types, that comparison will postpone comparison // of any sub-container pair to the end of the pair queue. This gives // breadth-first search order. It also avoids the reprocessing of // reference-equal siblings, cousins etc, which can have a significant speed // impact when comparing a container of small objects each of which has a // reference to the same (singleton) large object. if (pair.a !== pair.b && !typeEquiv(pair.a, pair.b)) { return false; } } // ...across all consecutive argument pairs return arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1)); } return function () { var result = innerEquiv.apply(undefined, arguments); // Release any retained objects pairs.length = 0; return result; }; })(); /** * Config object: Maintain internal state * Later exposed as QUnit.config * `config` initialized at top of scope */ var config = { // The queue of tests to run queue: [], // Block until document ready blocking: true, // By default, run previously failed tests first // very useful in combination with "Hide passed tests" checked reorder: true, // By default, modify document.title when suite is done altertitle: true, // HTML Reporter: collapse every test except the first failing test // If false, all failing tests will be expanded collapse: true, // By default, scroll to top of the page when suite is done scrolltop: true, // Depth up-to which object will be dumped maxDepth: 5, // When enabled, all tests must call expect() requireExpects: false, // Placeholder for user-configurable form-exposed URL parameters urlConfig: [], // Set of all modules. modules: [], // The first unnamed module currentModule: { name: "", tests: [], childModules: [], testsRun: 0, unskippedTestsRun: 0, hooks: { before: [], beforeEach: [], afterEach: [], after: [] } }, callbacks: {}, // The storage module to use for reordering tests storage: localSessionStorage }; // take a predefined QUnit.config and extend the defaults var globalConfig = window && window.QUnit && window.QUnit.config; // only extend the global config if there is no QUnit overload if (window && window.QUnit && !window.QUnit.version) { extend(config, globalConfig); } // Push a loose unnamed module to the modules collection config.modules.push(config.currentModule); // Based on jsDump by Ariel Flesler // http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html var dump = (function () { function quote(str) { return "\"" + str.toString().replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\""; } function literal(o) { return o + ""; } function join(pre, arr, post) { var s = dump.separator(), base = dump.indent(), inner = dump.indent(1); if (arr.join) { arr = arr.join("," + s + inner); } if (!arr) { return pre + post; } return [pre, inner + arr, base + post].join(s); } function array(arr, stack) { var i = arr.length, ret = new Array(i); if (dump.maxDepth && dump.depth > dump.maxDepth) { return "[object Array]"; } this.up(); while (i--) { ret[i] = this.parse(arr[i], undefined, stack); } this.down(); return join("[", ret, "]"); } function isArray(obj) { return ( //Native Arrays toString.call(obj) === "[object Array]" || // NodeList objects typeof obj.length === "number" && obj.item !== undefined && (obj.length ? obj.item(0) === obj[0] : obj.item(0) === null && obj[0] === undefined) ); } var reName = /^function (\w+)/, dump = { // The objType is used mostly internally, you can fix a (custom) type in advance parse: function parse(obj, objType, stack) { stack = stack || []; var res, parser, parserType, objIndex = stack.indexOf(obj); if (objIndex !== -1) { return "recursion(" + (objIndex - stack.length) + ")"; } objType = objType || this.typeOf(obj); parser = this.parsers[objType]; parserType = typeof parser === "undefined" ? "undefined" : _typeof(parser); if (parserType === "function") { stack.push(obj); res = parser.call(this, obj, stack); stack.pop(); return res; } return parserType === "string" ? parser : this.parsers.error; }, typeOf: function typeOf(obj) { var type; if (obj === null) { type = "null"; } else if (typeof obj === "undefined") { type = "undefined"; } else if (is("regexp", obj)) { type = "regexp"; } else if (is("date", obj)) { type = "date"; } else if (is("function", obj)) { type = "function"; } else if (obj.setInterval !== undefined && obj.document !== undefined && obj.nodeType === undefined) { type = "window"; } else if (obj.nodeType === 9) { type = "document"; } else if (obj.nodeType) { type = "node"; } else if (isArray(obj)) { type = "array"; } else if (obj.constructor === Error.prototype.constructor) { type = "error"; } else { type = typeof obj === "undefined" ? "undefined" : _typeof(obj); } return type; }, separator: function separator() { if (this.multiline) { return this.HTML ? "
" : "\n"; } else { return this.HTML ? " " : " "; } }, // Extra can be a number, shortcut for increasing-calling-decreasing indent: function indent(extra) { if (!this.multiline) { return ""; } var chr = this.indentChar; if (this.HTML) { chr = chr.replace(/\t/g, " ").replace(/ /g, " "); } return new Array(this.depth + (extra || 0)).join(chr); }, up: function up(a) { this.depth += a || 1; }, down: function down(a) { this.depth -= a || 1; }, setParser: function setParser(name, parser) { this.parsers[name] = parser; }, // The next 3 are exposed so you can use them quote: quote, literal: literal, join: join, depth: 1, maxDepth: config.maxDepth, // This is the list of parsers, to modify them, use dump.setParser parsers: { window: "[Window]", document: "[Document]", error: function error(_error) { return "Error(\"" + _error.message + "\")"; }, unknown: "[Unknown]", "null": "null", "undefined": "undefined", "function": function _function(fn) { var ret = "function", // Functions never have name in IE name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; if (name) { ret += " " + name; } ret += "("; ret = [ret, dump.parse(fn, "functionArgs"), "){"].join(""); return join(ret, dump.parse(fn, "functionCode"), "}"); }, array: array, nodelist: array, "arguments": array, object: function object(map, stack) { var keys, key, val, i, nonEnumerableProperties, ret = []; if (dump.maxDepth && dump.depth > dump.maxDepth) { return "[object Object]"; } dump.up(); keys = []; for (key in map) { keys.push(key); } // Some properties are not always enumerable on Error objects. nonEnumerableProperties = ["message", "name"]; for (i in nonEnumerableProperties) { key = nonEnumerableProperties[i]; if (key in map && !inArray(key, keys)) { keys.push(key); } } keys.sort(); for (i = 0; i < keys.length; i++) { key = keys[i]; val = map[key]; ret.push(dump.parse(key, "key") + ": " + dump.parse(val, undefined, stack)); } dump.down(); return join("{", ret, "}"); }, node: function node(_node) { var len, i, val, open = dump.HTML ? "<" : "<", close = dump.HTML ? ">" : ">", tag = _node.nodeName.toLowerCase(), ret = open + tag, attrs = _node.attributes; if (attrs) { for (i = 0, len = attrs.length; i < len; i++) { val = attrs[i].nodeValue; // IE6 includes all attributes in .attributes, even ones not explicitly // set. Those have values like undefined, null, 0, false, "" or // "inherit". if (val && val !== "inherit") { ret += " " + attrs[i].nodeName + "=" + dump.parse(val, "attribute"); } } } ret += close; // Show content of TextNode or CDATASection if (_node.nodeType === 3 || _node.nodeType === 4) { ret += _node.nodeValue; } return ret + open + "/" + tag + close; }, // Function calls it internally, it's the arguments part of the function functionArgs: function functionArgs(fn) { var args, l = fn.length; if (!l) { return ""; } args = new Array(l); while (l--) { // 97 is 'a' args[l] = String.fromCharCode(97 + l); } return " " + args.join(", ") + " "; }, // Object calls it internally, the key part of an item in a map key: quote, // Function calls it internally, it's the content of the function functionCode: "[code]", // Node calls it internally, it's a html attribute value attribute: quote, string: quote, date: quote, regexp: literal, number: literal, "boolean": literal, symbol: function symbol(sym) { return sym.toString(); } }, // If true, entities are escaped ( <, >, \t, space and \n ) HTML: false, // Indentation unit indentChar: " ", // If true, items in a collection, are separated by a \n, else just a space. multiline: true }; return dump; })(); var LISTENERS = Object.create(null); var SUPPORTED_EVENTS = ["runStart", "suiteStart", "testStart", "assertion", "testEnd", "suiteEnd", "runEnd"]; /** * Emits an event with the specified data to all currently registered listeners. * Callbacks will fire in the order in which they are registered (FIFO). This * function is not exposed publicly; it is used by QUnit internals to emit * logging events. * * @private * @method emit * @param {String} eventName * @param {Object} data * @return {Void} */ function emit(eventName, data) { if (objectType(eventName) !== "string") { throw new TypeError("eventName must be a string when emitting an event"); } // Clone the callbacks in case one of them registers a new callback var originalCallbacks = LISTENERS[eventName]; var callbacks = originalCallbacks ? [].concat(toConsumableArray(originalCallbacks)) : []; for (var i = 0; i < callbacks.length; i++) { callbacks[i](data); } } /** * Registers a callback as a listener to the specified event. * * @public * @method on * @param {String} eventName * @param {Function} callback * @return {Void} */ function on(eventName, callback) { if (objectType(eventName) !== "string") { throw new TypeError("eventName must be a string when registering a listener"); } else if (!inArray(eventName, SUPPORTED_EVENTS)) { var events = SUPPORTED_EVENTS.join(", "); throw new Error("\"" + eventName + "\" is not a valid event; must be one of: " + events + "."); } else if (objectType(callback) !== "function") { throw new TypeError("callback must be a function when registering a listener"); } if (!LISTENERS[eventName]) { LISTENERS[eventName] = []; } // Don't register the same callback more than once if (!inArray(callback, LISTENERS[eventName])) { LISTENERS[eventName].push(callback); } } // Register logging callbacks function registerLoggingCallbacks(obj) { var i, l, key, callbackNames = ["begin", "done", "log", "testStart", "testDone", "moduleStart", "moduleDone"]; function registerLoggingCallback(key) { var loggingCallback = function loggingCallback(callback) { if (objectType(callback) !== "function") { throw new Error("QUnit logging methods require a callback function as their first parameters."); } config.callbacks[key].push(callback); }; return loggingCallback; } for (i = 0, l = callbackNames.length; i < l; i++) { key = callbackNames[i]; // Initialize key collection of logging callback if (objectType(config.callbacks[key]) === "undefined") { config.callbacks[key] = []; } obj[key] = registerLoggingCallback(key); } } function runLoggingCallbacks(key, args) { var i, l, callbacks; callbacks = config.callbacks[key]; for (i = 0, l = callbacks.length; i < l; i++) { callbacks[i](args); } } // Doesn't support IE9, it will return undefined on these browsers // See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack var fileName = (sourceFromStacktrace(0) || "").replace(/(:\d+)+\)?/, "").replace(/.+\//, ""); function extractStacktrace(e, offset) { offset = offset === undefined ? 4 : offset; var stack, include, i; if (e && e.stack) { stack = e.stack.split("\n"); if (/^error$/i.test(stack[0])) { stack.shift(); } if (fileName) { include = []; for (i = offset; i < stack.length; i++) { if (stack[i].indexOf(fileName) !== -1) { break; } include.push(stack[i]); } if (include.length) { return include.join("\n"); } } return stack[offset]; } } function sourceFromStacktrace(offset) { var error = new Error(); // Support: Safari <=7 only, IE <=10 - 11 only // Not all browsers generate the `stack` property for `new Error()`, see also #636 if (!error.stack) { try { throw error; } catch (err) { error = err; } } return extractStacktrace(error, offset); } var priorityCount = 0; var unitSampler = void 0; /** * Advances the ProcessingQueue to the next item if it is ready. * @param {Boolean} last */ function advance() { var start = now(); config.depth = (config.depth || 0) + 1; while (config.queue.length && !config.blocking) { var elapsedTime = now() - start; if (!defined.setTimeout || config.updateRate <= 0 || elapsedTime < config.updateRate) { if (priorityCount > 0) { priorityCount--; } config.queue.shift()(); } else { setTimeout(advance); break; } } config.depth--; if (!config.blocking && !config.queue.length && config.depth === 0) { done(); } } function addToQueueImmediate(callback) { if (objectType(callback) === "array") { while (callback.length) { addToQueueImmediate(callback.pop()); } return; } config.queue.unshift(callback); priorityCount++; } /** * Adds a function to the ProcessingQueue for execution. * @param {Function|Array} callback * @param {Boolean} priority * @param {String} seed */ function addToQueue(callback, prioritize, seed) { if (prioritize) { config.queue.splice(priorityCount++, 0, callback); } else if (seed) { if (!unitSampler) { unitSampler = unitSamplerGenerator(seed); } // Insert into a random position after all prioritized items var index = Math.floor(unitSampler() * (config.queue.length - priorityCount + 1)); config.queue.splice(priorityCount + index, 0, callback); } else { config.queue.push(callback); } } /** * Creates a seeded "sample" generator which is used for randomizing tests. */ function unitSamplerGenerator(seed) { // 32-bit xorshift, requires only a nonzero seed // http://excamera.com/sphinx/article-xorshift.html var sample = parseInt(generateHash(seed), 16) || -1; return function () { sample ^= sample << 13; sample ^= sample >>> 17; sample ^= sample << 5; // ECMAScript has no unsigned number type if (sample < 0) { sample += 0x100000000; } return sample / 0x100000000; }; } /** * This function is called when the ProcessingQueue is done processing all * items. It handles emitting the final run events. */ function done() { var storage = config.storage; ProcessingQueue.finished = true; var runtime = now() - config.started; var passed = config.stats.all - config.stats.bad; emit("runEnd", globalSuite.end(true)); runLoggingCallbacks("done", { passed: passed, failed: config.stats.bad, total: config.stats.all, runtime: runtime }); // Clear own storage items if all tests passed if (storage && config.stats.bad === 0) { for (var i = storage.length - 1; i >= 0; i--) { var key = storage.key(i); if (key.indexOf("qunit-test-") === 0) { storage.removeItem(key); } } } } var ProcessingQueue = { finished: false, add: addToQueue, addImmediate: addToQueueImmediate, advance: advance }; var TestReport = function () { function TestReport(name, suite, options) { classCallCheck(this, TestReport); this.name = name; this.suiteName = suite.name; this.fullName = suite.fullName.concat(name); this.runtime = 0; this.assertions = []; this.skipped = !!options.skip; this.todo = !!options.todo; this.valid = options.valid; this._startTime = 0; this._endTime = 0; suite.pushTest(this); } createClass(TestReport, [{ key: "start", value: function start(recordTime) { if (recordTime) { this._startTime = Date.now(); } return { name: this.name, suiteName: this.suiteName, fullName: this.fullName.slice() }; } }, { key: "end", value: function end(recordTime) { if (recordTime) { this._endTime = Date.now(); } return extend(this.start(), { runtime: this.getRuntime(), status: this.getStatus(), errors: this.getFailedAssertions(), assertions: this.getAssertions() }); } }, { key: "pushAssertion", value: function pushAssertion(assertion) { this.assertions.push(assertion); } }, { key: "getRuntime", value: function getRuntime() { return this._endTime - this._startTime; } }, { key: "getStatus", value: function getStatus() { if (this.skipped) { return "skipped"; } var testPassed = this.getFailedAssertions().length > 0 ? this.todo : !this.todo; if (!testPassed) { return "failed"; } else if (this.todo) { return "todo"; } else { return "passed"; } } }, { key: "getFailedAssertions", value: function getFailedAssertions() { return this.assertions.filter(function (assertion) { return !assertion.passed; }); } }, { key: "getAssertions", value: function getAssertions() { return this.assertions.slice(); } // Remove actual and expected values from assertions. This is to prevent // leaking memory throughout a test suite. }, { key: "slimAssertions", value: function slimAssertions() { this.assertions = this.assertions.map(function (assertion) { delete assertion.actual; delete assertion.expected; return assertion; }); } }]); return TestReport; }(); var focused$1 = false; function Test(settings) { var i, l; ++Test.count; this.expected = null; this.assertions = []; this.semaphore = 0; this.module = config.currentModule; this.stack = sourceFromStacktrace(3); this.steps = []; this.timeout = undefined; // If a module is skipped, all its tests and the tests of the child suites // should be treated as skipped even if they are defined as `only` or `todo`. // As for `todo` module, all its tests will be treated as `todo` except for // tests defined as `skip` which will be left intact. // // So, if a test is defined as `todo` and is inside a skipped module, we should // then treat that test as if was defined as `skip`. if (this.module.skip) { settings.skip = true; settings.todo = false; // Skipped tests should be left intact } else if (this.module.todo && !settings.skip) { settings.todo = true; } extend(this, settings); this.testReport = new TestReport(settings.testName, this.module.suiteReport, { todo: settings.todo, skip: settings.skip, valid: this.valid() }); // Register unique strings for (i = 0, l = this.module.tests; i < l.length; i++) { if (this.module.tests[i].name === this.testName) { this.testName += " "; } } this.testId = generateHash(this.module.name, this.testName); this.module.tests.push({ name: this.testName, testId: this.testId, skip: !!settings.skip }); if (settings.skip) { // Skipped tests will fully ignore any sent callback this.callback = function () {}; this.async = false; this.expected = 0; } else { if (typeof this.callback !== "function") { var method = this.todo ? "todo" : "test"; // eslint-disable-next-line max-len throw new TypeError("You must provide a function as a test callback to QUnit." + method + "(\"" + settings.testName + "\")"); } this.assert = new Assert(this); } } Test.count = 0; function getNotStartedModules(startModule) { var module = startModule, modules = []; while (module && module.testsRun === 0) { modules.push(module); module = module.parentModule; } return modules; } Test.prototype = { before: function before() { var i, startModule, module = this.module, notStartedModules = getNotStartedModules(module); for (i = notStartedModules.length - 1; i >= 0; i--) { startModule = notStartedModules[i]; startModule.stats = { all: 0, bad: 0, started: now() }; emit("suiteStart", startModule.suiteReport.start(true)); runLoggingCallbacks("moduleStart", { name: startModule.name, tests: startModule.tests }); } config.current = this; this.testEnvironment = extend({}, module.testEnvironment); this.started = now(); emit("testStart", this.testReport.start(true)); runLoggingCallbacks("testStart", { name: this.testName, module: module.name, testId: this.testId, previousFailure: this.previousFailure }); if (!config.pollution) { saveGlobal(); } }, run: function run() { var promise; config.current = this; this.callbackStarted = now(); if (config.notrycatch) { runTest(this); return; } try { runTest(this); } catch (e) { this.pushFailure("Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + (e.message || e), extractStacktrace(e, 0)); // Else next test will carry the responsibility saveGlobal(); // Restart the tests if they're blocking if (config.blocking) { internalRecover(this); } } function runTest(test) { promise = test.callback.call(test.testEnvironment, test.assert); test.resolvePromise(promise); // If the test has a "lock" on it, but the timeout is 0, then we push a // failure as the test should be synchronous. if (test.timeout === 0 && test.semaphore !== 0) { pushFailure("Test did not finish synchronously even though assert.timeout( 0 ) was used.", sourceFromStacktrace(2)); } } }, after: function after() { checkPollution(); }, queueHook: function queueHook(hook, hookName, hookOwner) { var _this = this; var callHook = function callHook() { var promise = hook.call(_this.testEnvironment, _this.assert); _this.resolvePromise(promise, hookName); }; var runHook = function runHook() { if (hookName === "before") { if (hookOwner.unskippedTestsRun !== 0) { return; } _this.preserveEnvironment = true; } if (hookName === "after" && hookOwner.unskippedTestsRun !== numberOfUnskippedTests(hookOwner) - 1 && config.queue.length > 2) { return; } config.current = _this; if (config.notrycatch) { callHook(); return; } try { callHook(); } catch (error) { _this.pushFailure(hookName + " failed on " + _this.testName + ": " + (error.message || error), extractStacktrace(error, 0)); } }; return runHook; }, // Currently only used for module level hooks, can be used to add global level ones hooks: function hooks(handler) { var hooks = []; function processHooks(test, module) { if (module.parentModule) { processHooks(test, module.parentModule); } if (module.hooks[handler].length) { for (var i = 0; i < module.hooks[handler].length; i++) { hooks.push(test.queueHook(module.hooks[handler][i], handler, module)); } } } // Hooks are ignored on skipped tests if (!this.skip) { processHooks(this, this.module); } return hooks; }, finish: function finish() { config.current = this; if (config.requireExpects && this.expected === null) { this.pushFailure("Expected number of assertions to be defined, but expect() was " + "not called.", this.stack); } else if (this.expected !== null && this.expected !== this.assertions.length) { this.pushFailure("Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack); } else if (this.expected === null && !this.assertions.length) { this.pushFailure("Expected at least one assertion, but none were run - call " + "expect(0) to accept zero assertions.", this.stack); } var i, module = this.module, moduleName = module.name, testName = this.testName, skipped = !!this.skip, todo = !!this.todo, bad = 0, storage = config.storage; this.runtime = now() - this.started; config.stats.all += this.assertions.length; module.stats.all += this.assertions.length; for (i = 0; i < this.assertions.length; i++) { if (!this.assertions[i].result) { bad++; config.stats.bad++; module.stats.bad++; } } notifyTestsRan(module, skipped); // Store result when possible if (storage) { if (bad) { storage.setItem("qunit-test-" + moduleName + "-" + testName, bad); } else { storage.removeItem("qunit-test-" + moduleName + "-" + testName); } } // After emitting the js-reporters event we cleanup the assertion data to // avoid leaking it. It is not used by the legacy testDone callbacks. emit("testEnd", this.testReport.end(true)); this.testReport.slimAssertions(); runLoggingCallbacks("testDone", { name: testName, module: moduleName, skipped: skipped, todo: todo, failed: bad, passed: this.assertions.length - bad, total: this.assertions.length, runtime: skipped ? 0 : this.runtime, // HTML Reporter use assertions: this.assertions, testId: this.testId, // Source of Test source: this.stack }); if (module.testsRun === numberOfTests(module)) { logSuiteEnd(module); // Check if the parent modules, iteratively, are done. If that the case, // we emit the `suiteEnd` event and trigger `moduleDone` callback. var parent = module.parentModule; while (parent && parent.testsRun === numberOfTests(parent)) { logSuiteEnd(parent); parent = parent.parentModule; } } config.current = undefined; function logSuiteEnd(module) { emit("suiteEnd", module.suiteReport.end(true)); runLoggingCallbacks("moduleDone", { name: module.name, tests: module.tests, failed: module.stats.bad, passed: module.stats.all - module.stats.bad, total: module.stats.all, runtime: now() - module.stats.started }); } }, preserveTestEnvironment: function preserveTestEnvironment() { if (this.preserveEnvironment) { this.module.testEnvironment = this.testEnvironment; this.testEnvironment = extend({}, this.module.testEnvironment); } }, queue: function queue() { var test = this; if (!this.valid()) { return; } function runTest() { // Each of these can by async ProcessingQueue.addImmediate([function () { test.before(); }, test.hooks("before"), function () { test.preserveTestEnvironment(); }, test.hooks("beforeEach"), function () { test.run(); }, test.hooks("afterEach").reverse(), test.hooks("after").reverse(), function () { test.after(); }, function () { test.finish(); }]); } var previousFailCount = config.storage && +config.storage.getItem("qunit-test-" + this.module.name + "-" + this.testName); // Prioritize previously failed tests, detected from storage var prioritize = config.reorder && !!previousFailCount; this.previousFailure = !!previousFailCount; ProcessingQueue.add(runTest, prioritize, config.seed); // If the queue has already finished, we manually process the new test if (ProcessingQueue.finished) { ProcessingQueue.advance(); } }, pushResult: function pushResult(resultInfo) { if (this !== config.current) { throw new Error("Assertion occurred after test had finished."); } // Destructure of resultInfo = { result, actual, expected, message, negative } var source, details = { module: this.module.name, name: this.testName, result: resultInfo.result, message: resultInfo.message, actual: resultInfo.actual, testId: this.testId, negative: resultInfo.negative || false, runtime: now() - this.started, todo: !!this.todo }; if (hasOwn.call(resultInfo, "expected")) { details.expected = resultInfo.expected; } if (!resultInfo.result) { source = resultInfo.source || sourceFromStacktrace(); if (source) { details.source = source; } } this.logAssertion(details); this.assertions.push({ result: !!resultInfo.result, message: resultInfo.message }); }, pushFailure: function pushFailure(message, source, actual) { if (!(this instanceof Test)) { throw new Error("pushFailure() assertion outside test context, was " + sourceFromStacktrace(2)); } this.pushResult({ result: false, message: message || "error", actual: actual || null, source: source }); }, /** * Log assertion details using both the old QUnit.log interface and * QUnit.on( "assertion" ) interface. * * @private */ logAssertion: function logAssertion(details) { runLoggingCallbacks("log", details); var assertion = { passed: details.result, actual: details.actual, expected: details.expected, message: details.message, stack: details.source, todo: details.todo }; this.testReport.pushAssertion(assertion); emit("assertion", assertion); }, resolvePromise: function resolvePromise(promise, phase) { var then, resume, message, test = this; if (promise != null) { then = promise.then; if (objectType(then) === "function") { resume = internalStop(test); if (config.notrycatch) { then.call(promise, function () { resume(); }); } else { then.call(promise, function () { resume(); }, function (error) { message = "Promise rejected " + (!phase ? "during" : phase.replace(/Each$/, "")) + " \"" + test.testName + "\": " + (error && error.message || error); test.pushFailure(message, extractStacktrace(error, 0)); // Else next test will carry the responsibility saveGlobal(); // Unblock resume(); }); } } } }, valid: function valid() { var filter = config.filter, regexFilter = /^(!?)\/([\w\W]*)\/(i?$)/.exec(filter), module = config.module && config.module.toLowerCase(), fullName = this.module.name + ": " + this.testName; function moduleChainNameMatch(testModule) { var testModuleName = testModule.name ? testModule.name.toLowerCase() : null; if (testModuleName === module) { return true; } else if (testModule.parentModule) { return moduleChainNameMatch(testModule.parentModule); } else { return false; } } function moduleChainIdMatch(testModule) { return inArray(testModule.moduleId, config.moduleId) || testModule.parentModule && moduleChainIdMatch(testModule.parentModule); } // Internally-generated tests are always valid if (this.callback && this.callback.validTest) { return true; } if (config.moduleId && config.moduleId.length > 0 && !moduleChainIdMatch(this.module)) { return false; } if (config.testId && config.testId.length > 0 && !inArray(this.testId, config.testId)) { return false; } if (module && !moduleChainNameMatch(this.module)) { return false; } if (!filter) { return true; } return regexFilter ? this.regexFilter(!!regexFilter[1], regexFilter[2], regexFilter[3], fullName) : this.stringFilter(filter, fullName); }, regexFilter: function regexFilter(exclude, pattern, flags, fullName) { var regex = new RegExp(pattern, flags); var match = regex.test(fullName); return match !== exclude; }, stringFilter: function stringFilter(filter, fullName) { filter = filter.toLowerCase(); fullName = fullName.toLowerCase(); var include = filter.charAt(0) !== "!"; if (!include) { filter = filter.slice(1); } // If the filter matches, we need to honour include if (fullName.indexOf(filter) !== -1) { return include; } // Otherwise, do the opposite return !include; } }; function pushFailure() { if (!config.current) { throw new Error("pushFailure() assertion outside test context, in " + sourceFromStacktrace(2)); } // Gets current test obj var currentTest = config.current; return currentTest.pushFailure.apply(currentTest, arguments); } function saveGlobal() { config.pollution = []; if (config.noglobals) { for (var key in global$1) { if (hasOwn.call(global$1, key)) { // In Opera sometimes DOM element ids show up here, ignore them if (/^qunit-test-output/.test(key)) { continue; } config.pollution.push(key); } } } } function checkPollution() { var newGlobals, deletedGlobals, old = config.pollution; saveGlobal(); newGlobals = diff(config.pollution, old); if (newGlobals.length > 0) { pushFailure("Introduced global variable(s): " + newGlobals.join(", ")); } deletedGlobals = diff(old, config.pollution); if (deletedGlobals.length > 0) { pushFailure("Deleted global variable(s): " + deletedGlobals.join(", ")); } } // Will be exposed as QUnit.test function test(testName, callback) { if (focused$1) { return; } var newTest = new Test({ testName: testName, callback: callback }); newTest.queue(); } function todo(testName, callback) { if (focused$1) { return; } var newTest = new Test({ testName: testName, callback: callback, todo: true }); newTest.queue(); } // Will be exposed as QUnit.skip function skip(testName) { if (focused$1) { return; } var test = new Test({ testName: testName, skip: true }); test.queue(); } // Will be exposed as QUnit.only function only(testName, callback) { if (focused$1) { return; } config.queue.length = 0; focused$1 = true; var newTest = new Test({ testName: testName, callback: callback }); newTest.queue(); } // Put a hold on processing and return a function that will release it. function internalStop(test) { test.semaphore += 1; config.blocking = true; // Set a recovery timeout, if so configured. if (defined.setTimeout) { var timeoutDuration = void 0; if (typeof test.timeout === "number") { timeoutDuration = test.timeout; } else if (typeof config.testTimeout === "number") { timeoutDuration = config.testTimeout; } if (typeof timeoutDuration === "number" && timeoutDuration > 0) { clearTimeout(config.timeout); config.timeout = setTimeout(function () { pushFailure("Test took longer than " + timeoutDuration + "ms; test timed out.", sourceFromStacktrace(2)); internalRecover(test); }, timeoutDuration); } } var released = false; return function resume() { if (released) { return; } released = true; test.semaphore -= 1; internalStart(test); }; } // Forcefully release all processing holds. function internalRecover(test) { test.semaphore = 0; internalStart(test); } // Release a processing hold, scheduling a resumption attempt if no holds remain. function internalStart(test) { // If semaphore is non-numeric, throw error if (isNaN(test.semaphore)) { test.semaphore = 0; pushFailure("Invalid value on test.semaphore", sourceFromStacktrace(2)); return; } // Don't start until equal number of stop-calls if (test.semaphore > 0) { return; } // Throw an Error if start is called more often than stop if (test.semaphore < 0) { test.semaphore = 0; pushFailure("Tried to restart test while already started (test's semaphore was 0 already)", sourceFromStacktrace(2)); return; } // Add a slight delay to allow more assertions etc. if (defined.setTimeout) { if (config.timeout) { clearTimeout(config.timeout); } config.timeout = setTimeout(function () { if (test.semaphore > 0) { return; } if (config.timeout) { clearTimeout(config.timeout); } begin(); }); } else { begin(); } } function collectTests(module) { var tests = [].concat(module.tests); var modules = [].concat(toConsumableArray(module.childModules)); // Do a breadth-first traversal of the child modules while (modules.length) { var nextModule = modules.shift(); tests.push.apply(tests, nextModule.tests); modules.push.apply(modules, toConsumableArray(nextModule.childModules)); } return tests; } function numberOfTests(module) { return collectTests(module).length; } function numberOfUnskippedTests(module) { return collectTests(module).filter(function (test) { return !test.skip; }).length; } function notifyTestsRan(module, skipped) { module.testsRun++; if (!skipped) { module.unskippedTestsRun++; } while (module = module.parentModule) { module.testsRun++; if (!skipped) { module.unskippedTestsRun++; } } } /** * Returns a function that proxies to the given method name on the globals * console object. The proxy will also detect if the console doesn't exist and * will appropriately no-op. This allows support for IE9, which doesn't have a * console if the developer tools are not open. */ function consoleProxy(method) { return function () { if (console) { console[method].apply(console, arguments); } }; } var Logger = { warn: consoleProxy("warn") }; var Assert = function () { function Assert(testContext) { classCallCheck(this, Assert); this.test = testContext; } // Assert helpers createClass(Assert, [{ key: "timeout", value: function timeout(duration) { if (typeof duration !== "number") { throw new Error("You must pass a number as the duration to assert.timeout"); } this.test.timeout = duration; } // Documents a "step", which is a string value, in a test as a passing assertion }, { key: "step", value: function step(message) { var result = !!message; this.test.steps.push(message); return this.pushResult({ result: result, message: message || "You must provide a message to assert.step" }); } // Verifies the steps in a test match a given array of string values }, { key: "verifySteps", value: function verifySteps(steps, message) { this.deepEqual(this.test.steps, steps, message); this.test.steps.length = 0; } // Specify the number of expected assertions to guarantee that failed test // (no assertions are run at all) don't slip through. }, { key: "expect", value: function expect(asserts) { if (arguments.length === 1) { this.test.expected = asserts; } else { return this.test.expected; } } // Put a hold on processing and return a function that will release it a maximum of once. }, { key: "async", value: function async(count) { var test$$1 = this.test; var popped = false, acceptCallCount = count; if (typeof acceptCallCount === "undefined") { acceptCallCount = 1; } var resume = internalStop(test$$1); return function done() { if (config.current !== test$$1) { throw Error("assert.async callback called after test finished."); } if (popped) { test$$1.pushFailure("Too many calls to the `assert.async` callback", sourceFromStacktrace(2)); return; } acceptCallCount -= 1; if (acceptCallCount > 0) { return; } popped = true; resume(); }; } // Exports test.push() to the user API // Alias of pushResult. }, { key: "push", value: function push(result, actual, expected, message, negative) { Logger.warn("assert.push is deprecated and will be removed in QUnit 3.0." + " Please use assert.pushResult instead (https://api.qunitjs.com/assert/pushResult)."); var currentAssert = this instanceof Assert ? this : config.current.assert; return currentAssert.pushResult({ result: result, actual: actual, expected: expected, message: message, negative: negative }); } }, { key: "pushResult", value: function pushResult(resultInfo) { // Destructure of resultInfo = { result, actual, expected, message, negative } var assert = this; var currentTest = assert instanceof Assert && assert.test || config.current; // Backwards compatibility fix. // Allows the direct use of global exported assertions and QUnit.assert.* // Although, it's use is not recommended as it can leak assertions // to other tests from async tests, because we only get a reference to the current test, // not exactly the test where assertion were intended to be called. if (!currentTest) { throw new Error("assertion outside test context, in " + sourceFromStacktrace(2)); } if (!(assert instanceof Assert)) { assert = currentTest.assert; } return assert.test.pushResult(resultInfo); } }, { key: "ok", value: function ok(result, message) { if (!message) { message = result ? "okay" : "failed, expected argument to be truthy, was: " + dump.parse(result); } this.pushResult({ result: !!result, actual: result, expected: true, message: message }); } }, { key: "notOk", value: function notOk(result, message) { if (!message) { message = !result ? "okay" : "failed, expected argument to be falsy, was: " + dump.parse(result); } this.pushResult({ result: !result, actual: result, expected: false, message: message }); } }, { key: "equal", value: function equal(actual, expected, message) { // eslint-disable-next-line eqeqeq var result = expected == actual; this.pushResult({ result: result, actual: actual, expected: expected, message: message }); } }, { key: "notEqual", value: function notEqual(actual, expected, message) { // eslint-disable-next-line eqeqeq var result = expected != actual; this.pushResult({ result: result, actual: actual, expected: expected, message: message, negative: true }); } }, { key: "propEqual", value: function propEqual(actual, expected, message) { actual = objectValues(actual); expected = objectValues(expected); this.pushResult({ result: equiv(actual, expected), actual: actual, expected: expected, message: message }); } }, { key: "notPropEqual", value: function notPropEqual(actual, expected, message) { actual = objectValues(actual); expected = objectValues(expected); this.pushResult({ result: !equiv(actual, expected), actual: actual, expected: expected, message: message, negative: true }); } }, { key: "deepEqual", value: function deepEqual(actual, expected, message) { this.pushResult({ result: equiv(actual, expected), actual: actual, expected: expected, message: message }); } }, { key: "notDeepEqual", value: function notDeepEqual(actual, expected, message) { this.pushResult({ result: !equiv(actual, expected), actual: actual, expected: expected, message: message, negative: true }); } }, { key: "strictEqual", value: function strictEqual(actual, expected, message) { this.pushResult({ result: expected === actual, actual: actual, expected: expected, message: message }); } }, { key: "notStrictEqual", value: function notStrictEqual(actual, expected, message) { this.pushResult({ result: expected !== actual, actual: actual, expected: expected, message: message, negative: true }); } }, { key: "throws", value: function throws(block, expected, message) { var actual = void 0, result = false; var currentTest = this instanceof Assert && this.test || config.current; // 'expected' is optional unless doing string comparison if (objectType(expected) === "string") { if (message == null) { message = expected; expected = null; } else { throw new Error("throws/raises does not accept a string value for the expected argument.\n" + "Use a non-string object value (e.g. regExp) instead if it's necessary."); } } currentTest.ignoreGlobalErrors = true; try { block.call(currentTest.testEnvironment); } catch (e) { actual = e; } currentTest.ignoreGlobalErrors = false; if (actual) { var expectedType = objectType(expected); // We don't want to validate thrown error if (!expected) { result = true; expected = null; // Expected is a regexp } else if (expectedType === "regexp") { result = expected.test(errorString(actual)); // Expected is a constructor, maybe an Error constructor } else if (expectedType === "function" && actual instanceof expected) { result = true; // Expected is an Error object } else if (expectedType === "object") { result = actual instanceof expected.constructor && actual.name === expected.name && actual.message === expected.message; // Expected is a validation function which returns true if validation passed } else if (expectedType === "function" && expected.call({}, actual) === true) { expected = null; result = true; } } currentTest.assert.pushResult({ result: result, actual: actual, expected: expected, message: message }); } }, { key: "rejects", value: function rejects(promise, expected, message) { var result = false; var currentTest = this instanceof Assert && this.test || config.current; // 'expected' is optional unless doing string comparison if (objectType(expected) === "string") { if (message === undefined) { message = expected; expected = undefined; } else { message = "assert.rejects does not accept a string value for the expected " + "argument.\nUse a non-string object value (e.g. validator function) instead " + "if necessary."; currentTest.assert.pushResult({ result: false, message: message }); return; } } var then = promise && promise.then; if (objectType(then) !== "function") { var _message = "The value provided to `assert.rejects` in " + "\"" + currentTest.testName + "\" was not a promise."; currentTest.assert.pushResult({ result: false, message: _message, actual: promise }); return; } var done = this.async(); return then.call(promise, function handleFulfillment() { var message = "The promise returned by the `assert.rejects` callback in " + "\"" + currentTest.testName + "\" did not reject."; currentTest.assert.pushResult({ result: false, message: message, actual: promise }); done(); }, function handleRejection(actual) { if (actual) { var expectedType = objectType(expected); // We don't want to validate if (expected === undefined) { result = true; expected = null; // Expected is a regexp } else if (expectedType === "regexp") { result = expected.test(errorString(actual)); // Expected is a constructor, maybe an Error constructor } else if (expectedType === "function" && actual instanceof expected) { result = true; // Expected is an Error object } else if (expectedType === "object") { result = actual instanceof expected.constructor && actual.name === expected.name && actual.message === expected.message; // Expected is a validation function which returns true if validation passed } else { if (expectedType === "function") { result = expected.call({}, actual) === true; expected = null; // Expected is some other invalid type } else { result = false; message = "invalid expected value provided to `assert.rejects` " + "callback in \"" + currentTest.testName + "\": " + expectedType + "."; } } } currentTest.assert.pushResult({ result: result, actual: actual, expected: expected, message: message }); done(); }); } }]); return Assert; }(); // Provide an alternative to assert.throws(), for environments that consider throws a reserved word // Known to us are: Closure Compiler, Narwhal // eslint-disable-next-line dot-notation Assert.prototype.raises = Assert.prototype["throws"]; /** * Converts an error into a simple string for comparisons. * * @param {Error} error * @return {String} */ function errorString(error) { var resultErrorString = error.toString(); if (resultErrorString.substring(0, 7) === "[object") { var name = error.name ? error.name.toString() : "Error"; var message = error.message ? error.message.toString() : ""; if (name && message) { return name + ": " + message; } else if (name) { return name; } else if (message) { return message; } else { return "Error"; } } else { return resultErrorString; } } /* global module, exports, define */ function exportQUnit(QUnit) { if (defined.document) { // QUnit may be defined when it is preconfigured but then only QUnit and QUnit.config may be defined. if (window.QUnit && window.QUnit.version) { throw new Error("QUnit has already been defined."); } window.QUnit = QUnit; } // For nodejs if (typeof module !== "undefined" && module && module.exports) { module.exports = QUnit; // For consistency with CommonJS environments' exports module.exports.QUnit = QUnit; } // For CommonJS with exports, but without module.exports, like Rhino if (typeof exports !== "undefined" && exports) { exports.QUnit = QUnit; } if (typeof define === "function" && define.amd) { define(function () { return QUnit; }); QUnit.config.autostart = false; } // For Web/Service Workers if (self$1 && self$1.WorkerGlobalScope && self$1 instanceof self$1.WorkerGlobalScope) { self$1.QUnit = QUnit; } } var SuiteReport = function () { function SuiteReport(name, parentSuite) { classCallCheck(this, SuiteReport); this.name = name; this.fullName = parentSuite ? parentSuite.fullName.concat(name) : []; this.tests = []; this.childSuites = []; if (parentSuite) { parentSuite.pushChildSuite(this); } } createClass(SuiteReport, [{ key: "start", value: function start(recordTime) { if (recordTime) { this._startTime = Date.now(); } return { name: this.name, fullName: this.fullName.slice(), tests: this.tests.map(function (test) { return test.start(); }), childSuites: this.childSuites.map(function (suite) { return suite.start(); }), testCounts: { total: this.getTestCounts().total } }; } }, { key: "end", value: function end(recordTime) { if (recordTime) { this._endTime = Date.now(); } return { name: this.name, fullName: this.fullName.slice(), tests: this.tests.map(function (test) { return test.end(); }), childSuites: this.childSuites.map(function (suite) { return suite.end(); }), testCounts: this.getTestCounts(), runtime: this.getRuntime(), status: this.getStatus() }; } }, { key: "pushChildSuite", value: function pushChildSuite(suite) { this.childSuites.push(suite); } }, { key: "pushTest", value: function pushTest(test) { this.tests.push(test); } }, { key: "getRuntime", value: function getRuntime() { return this._endTime - this._startTime; } }, { key: "getTestCounts", value: function getTestCounts() { var counts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { passed: 0, failed: 0, skipped: 0, todo: 0, total: 0 }; counts = this.tests.reduce(function (counts, test) { if (test.valid) { counts[test.getStatus()]++; counts.total++; } return counts; }, counts); return this.childSuites.reduce(function (counts, suite) { return suite.getTestCounts(counts); }, counts); } }, { key: "getStatus", value: function getStatus() { var _getTestCounts = this.getTestCounts(), total = _getTestCounts.total, failed = _getTestCounts.failed, skipped = _getTestCounts.skipped, todo = _getTestCounts.todo; if (failed) { return "failed"; } else { if (skipped === total) { return "skipped"; } else if (todo === total) { return "todo"; } else { return "passed"; } } } }]); return SuiteReport; }(); // Handle an unhandled exception. By convention, returns true if further // error handling should be suppressed and false otherwise. // In this case, we will only suppress further error handling if the // "ignoreGlobalErrors" configuration option is enabled. function onError(error) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } if (config.current) { if (config.current.ignoreGlobalErrors) { return true; } pushFailure.apply(undefined, [error.message, error.fileName + ":" + error.lineNumber].concat(args)); } else { test("global failure", extend(function () { pushFailure.apply(undefined, [error.message, error.fileName + ":" + error.lineNumber].concat(args)); }, { validTest: true })); } return false; } // Handle an unhandled rejection function onUnhandledRejection(reason) { var resultInfo = { result: false, message: reason.message || "error", actual: reason, source: reason.stack || sourceFromStacktrace(3) }; var currentTest = config.current; if (currentTest) { currentTest.assert.pushResult(resultInfo); } else { test("global failure", extend(function (assert) { assert.pushResult(resultInfo); }, { validTest: true })); } } var focused = false; var QUnit = {}; var globalSuite = new SuiteReport(); // The initial "currentModule" represents the global (or top-level) module that // is not explicitly defined by the user, therefore we add the "globalSuite" to // it since each module has a suiteReport associated with it. config.currentModule.suiteReport = globalSuite; var moduleStack = []; var globalStartCalled = false; var runStarted = false; // Figure out if we're running the tests from a server or not QUnit.isLocal = !(defined.document && window.location.protocol !== "file:"); // Expose the current QUnit version QUnit.version = "2.5.0"; function createModule(name, testEnvironment, modifiers) { var parentModule = moduleStack.length ? moduleStack.slice(-1)[0] : null; var moduleName = parentModule !== null ? [parentModule.name, name].join(" > ") : name; var parentSuite = parentModule ? parentModule.suiteReport : globalSuite; var skip$$1 = parentModule !== null && parentModule.skip || modifiers.skip; var todo$$1 = parentModule !== null && parentModule.todo || modifiers.todo; var module = { name: moduleName, parentModule: parentModule, tests: [], moduleId: generateHash(moduleName), testsRun: 0, unskippedTestsRun: 0, childModules: [], suiteReport: new SuiteReport(name, parentSuite), // Pass along `skip` and `todo` properties from parent module, in case // there is one, to childs. And use own otherwise. // This property will be used to mark own tests and tests of child suites // as either `skipped` or `todo`. skip: skip$$1, todo: skip$$1 ? false : todo$$1 }; var env = {}; if (parentModule) { parentModule.childModules.push(module); extend(env, parentModule.testEnvironment); } extend(env, testEnvironment); module.testEnvironment = env; config.modules.push(module); return module; } function processModule(name, options, executeNow) { var modifiers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var module = createModule(name, options, modifiers); // Move any hooks to a 'hooks' object var testEnvironment = module.testEnvironment; var hooks = module.hooks = {}; setHookFromEnvironment(hooks, testEnvironment, "before"); setHookFromEnvironment(hooks, testEnvironment, "beforeEach"); setHookFromEnvironment(hooks, testEnvironment, "afterEach"); setHookFromEnvironment(hooks, testEnvironment, "after"); function setHookFromEnvironment(hooks, environment, name) { var potentialHook = environment[name]; hooks[name] = typeof potentialHook === "function" ? [potentialHook] : []; delete environment[name]; } var moduleFns = { before: setHookFunction(module, "before"), beforeEach: setHookFunction(module, "beforeEach"), afterEach: setHookFunction(module, "afterEach"), after: setHookFunction(module, "after") }; var currentModule = config.currentModule; if (objectType(executeNow) === "function") { moduleStack.push(module); config.currentModule = module; executeNow.call(module.testEnvironment, moduleFns); moduleStack.pop(); module = module.parentModule || currentModule; } config.currentModule = module; } // TODO: extract this to a new file alongside its related functions function module$1(name, options, executeNow) { if (focused) { return; } if (arguments.length === 2) { if (objectType(options) === "function") { executeNow = options; options = undefined; } } processModule(name, options, executeNow); } module$1.only = function () { if (focused) { return; } config.modules.length = 0; config.queue.length = 0; module$1.apply(undefined, arguments); focused = true; }; module$1.skip = function (name, options, executeNow) { if (focused) { return; } if (arguments.length === 2) { if (objectType(options) === "function") { executeNow = options; options = undefined; } } processModule(name, options, executeNow, { skip: true }); }; module$1.todo = function (name, options, executeNow) { if (focused) { return; } if (arguments.length === 2) { if (objectType(options) === "function") { executeNow = options; options = undefined; } } processModule(name, options, executeNow, { todo: true }); }; extend(QUnit, { on: on, module: module$1, test: test, todo: todo, skip: skip, only: only, start: function start(count) { var globalStartAlreadyCalled = globalStartCalled; if (!config.current) { globalStartCalled = true; if (runStarted) { throw new Error("Called start() while test already started running"); } else if (globalStartAlreadyCalled || count > 1) { throw new Error("Called start() outside of a test context too many times"); } else if (config.autostart) { throw new Error("Called start() outside of a test context when " + "QUnit.config.autostart was true"); } else if (!config.pageLoaded) { // The page isn't completely loaded yet, so we set autostart and then // load if we're in Node or wait for the browser's load event. config.autostart = true; // Starts from Node even if .load was not previously called. We still return // early otherwise we'll wind up "beginning" twice. if (!defined.document) { QUnit.load(); } return; } } else { throw new Error("QUnit.start cannot be called inside a test context."); } scheduleBegin(); }, config: config, is: is, objectType: objectType, extend: extend, load: function load() { config.pageLoaded = true; // Initialize the configuration options extend(config, { stats: { all: 0, bad: 0 }, started: 0, updateRate: 1000, autostart: true, filter: "" }, true); if (!runStarted) { config.blocking = false; if (config.autostart) { scheduleBegin(); } } }, stack: function stack(offset) { offset = (offset || 0) + 2; return sourceFromStacktrace(offset); }, onError: onError, onUnhandledRejection: onUnhandledRejection }); QUnit.pushFailure = pushFailure; QUnit.assert = Assert.prototype; QUnit.equiv = equiv; QUnit.dump = dump; registerLoggingCallbacks(QUnit); function scheduleBegin() { runStarted = true; // Add a slight delay to allow definition of more modules and tests. if (defined.setTimeout) { setTimeout(function () { begin(); }); } else { begin(); } } function begin() { var i, l, modulesLog = []; // If the test run hasn't officially begun yet if (!config.started) { // Record the time of the test run's beginning config.started = now(); // Delete the loose unnamed module if unused. if (config.modules[0].name === "" && config.modules[0].tests.length === 0) { config.modules.shift(); } // Avoid unnecessary information by not logging modules' test environments for (i = 0, l = config.modules.length; i < l; i++) { modulesLog.push({ name: config.modules[i].name, tests: config.modules[i].tests }); } // The test run is officially beginning now emit("runStart", globalSuite.start(true)); runLoggingCallbacks("begin", { totalTests: Test.count, modules: modulesLog }); } config.blocking = false; ProcessingQueue.advance(); } function setHookFunction(module, hookName) { return function setHook(callback) { module.hooks[hookName].push(callback); }; } exportQUnit(QUnit); (function () { if (typeof window === "undefined" || typeof document === "undefined") { return; } var config = QUnit.config, hasOwn = Object.prototype.hasOwnProperty; // Stores fixture HTML for resetting later function storeFixture() { // Avoid overwriting user-defined values if (hasOwn.call(config, "fixture")) { return; } var fixture = document.getElementById("qunit-fixture"); if (fixture) { config.fixture = fixture.innerHTML; } } QUnit.begin(storeFixture); // Resets the fixture DOM element if available. function resetFixture() { if (config.fixture == null) { return; } var fixture = document.getElementById("qunit-fixture"); if (fixture) { fixture.innerHTML = config.fixture; } } QUnit.testStart(resetFixture); })(); (function () { // Only interact with URLs via window.location var location = typeof window !== "undefined" && window.location; if (!location) { return; } var urlParams = getUrlParams(); QUnit.urlParams = urlParams; // Match module/test by inclusion in an array QUnit.config.moduleId = [].concat(urlParams.moduleId || []); QUnit.config.testId = [].concat(urlParams.testId || []); // Exact case-insensitive match of the module name QUnit.config.module = urlParams.module; // Regular expression or case-insenstive substring match against "moduleName: testName" QUnit.config.filter = urlParams.filter; // Test order randomization if (urlParams.seed === true) { // Generate a random seed if the option is specified without a value QUnit.config.seed = Math.random().toString(36).slice(2); } else if (urlParams.seed) { QUnit.config.seed = urlParams.seed; } // Add URL-parameter-mapped config values with UI form rendering data QUnit.config.urlConfig.push({ id: "hidepassed", label: "Hide passed tests", tooltip: "Only show tests and assertions that fail. Stored as query-strings." }, { id: "noglobals", label: "Check for Globals", tooltip: "Enabling this will test if any test introduces new properties on the " + "global object (`window` in Browsers). Stored as query-strings." }, { id: "notrycatch", label: "No try-catch", tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging " + "exceptions in IE reasonable. Stored as query-strings." }); QUnit.begin(function () { var i, option, urlConfig = QUnit.config.urlConfig; for (i = 0; i < urlConfig.length; i++) { // Options can be either strings or objects with nonempty "id" properties option = QUnit.config.urlConfig[i]; if (typeof option !== "string") { option = option.id; } if (QUnit.config[option] === undefined) { QUnit.config[option] = urlParams[option]; } } }); function getUrlParams() { var i, param, name, value; var urlParams = Object.create(null); var params = location.search.slice(1).split("&"); var length = params.length; for (i = 0; i < length; i++) { if (params[i]) { param = params[i].split("="); name = decodeQueryParam(param[0]); // Allow just a key to turn on a flag, e.g., test.html?noglobals value = param.length === 1 || decodeQueryParam(param.slice(1).join("=")); if (name in urlParams) { urlParams[name] = [].concat(urlParams[name], value); } else { urlParams[name] = value; } } } return urlParams; } function decodeQueryParam(param) { return decodeURIComponent(param.replace(/\+/g, "%20")); } })(); var stats = { passedTests: 0, failedTests: 0, skippedTests: 0, todoTests: 0 }; // Escape text for attribute or text content. function escapeText(s) { if (!s) { return ""; } s = s + ""; // Both single quotes and double quotes (for attributes) return s.replace(/['"<>&]/g, function (s) { switch (s) { case "'": return "'"; case "\"": return """; case "<": return "<"; case ">": return ">"; case "&": return "&"; } }); } (function () { // Don't load the HTML Reporter on non-browser environments if (typeof window === "undefined" || !window.document) { return; } var config = QUnit.config, document$$1 = window.document, collapseNext = false, hasOwn = Object.prototype.hasOwnProperty, unfilteredUrl = setUrl({ filter: undefined, module: undefined, moduleId: undefined, testId: undefined }), modulesList = []; function addEvent(elem, type, fn) { elem.addEventListener(type, fn, false); } function removeEvent(elem, type, fn) { elem.removeEventListener(type, fn, false); } function addEvents(elems, type, fn) { var i = elems.length; while (i--) { addEvent(elems[i], type, fn); } } function hasClass(elem, name) { return (" " + elem.className + " ").indexOf(" " + name + " ") >= 0; } function addClass(elem, name) { if (!hasClass(elem, name)) { elem.className += (elem.className ? " " : "") + name; } } function toggleClass(elem, name, force) { if (force || typeof force === "undefined" && !hasClass(elem, name)) { addClass(elem, name); } else { removeClass(elem, name); } } function removeClass(elem, name) { var set = " " + elem.className + " "; // Class name may appear multiple times while (set.indexOf(" " + name + " ") >= 0) { set = set.replace(" " + name + " ", " "); } // Trim for prettiness elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, ""); } function id(name) { return document$$1.getElementById && document$$1.getElementById(name); } function abortTests() { var abortButton = id("qunit-abort-tests-button"); if (abortButton) { abortButton.disabled = true; abortButton.innerHTML = "Aborting..."; } QUnit.config.queue.length = 0; return false; } function interceptNavigation(ev) { applyUrlParams(); if (ev && ev.preventDefault) { ev.preventDefault(); } return false; } function getUrlConfigHtml() { var i, j, val, escaped, escapedTooltip, selection = false, urlConfig = config.urlConfig, urlConfigHtml = ""; for (i = 0; i < urlConfig.length; i++) { // Options can be either strings or objects with nonempty "id" properties val = config.urlConfig[i]; if (typeof val === "string") { val = { id: val, label: val }; } escaped = escapeText(val.id); escapedTooltip = escapeText(val.tooltip); if (!val.value || typeof val.value === "string") { urlConfigHtml += ""; } else { urlConfigHtml += ""; } } return urlConfigHtml; } // Handle "click" events on toolbar checkboxes and "change" for select menus. // Updates the URL with the new state of `config.urlConfig` values. function toolbarChanged() { var updatedUrl, value, tests, field = this, params = {}; // Detect if field is a select menu or a checkbox if ("selectedIndex" in field) { value = field.options[field.selectedIndex].value || undefined; } else { value = field.checked ? field.defaultValue || true : undefined; } params[field.name] = value; updatedUrl = setUrl(params); // Check if we can apply the change without a page refresh if ("hidepassed" === field.name && "replaceState" in window.history) { QUnit.urlParams[field.name] = value; config[field.name] = value || false; tests = id("qunit-tests"); if (tests) { toggleClass(tests, "hidepass", value || false); } window.history.replaceState(null, "", updatedUrl); } else { window.location = updatedUrl; } } function setUrl(params) { var key, arrValue, i, querystring = "?", location = window.location; params = QUnit.extend(QUnit.extend({}, QUnit.urlParams), params); for (key in params) { // Skip inherited or undefined properties if (hasOwn.call(params, key) && params[key] !== undefined) { // Output a parameter for each value of this key // (but usually just one) arrValue = [].concat(params[key]); for (i = 0; i < arrValue.length; i++) { querystring += encodeURIComponent(key); if (arrValue[i] !== true) { querystring += "=" + encodeURIComponent(arrValue[i]); } querystring += "&"; } } } return location.protocol + "//" + location.host + location.pathname + querystring.slice(0, -1); } function applyUrlParams() { var i, selectedModules = [], modulesList = id("qunit-modulefilter-dropdown-list").getElementsByTagName("input"), filter = id("qunit-filter-input").value; for (i = 0; i < modulesList.length; i++) { if (modulesList[i].checked) { selectedModules.push(modulesList[i].value); } } window.location = setUrl({ filter: filter === "" ? undefined : filter, moduleId: selectedModules.length === 0 ? undefined : selectedModules, // Remove module and testId filter module: undefined, testId: undefined }); } function toolbarUrlConfigContainer() { var urlConfigContainer = document$$1.createElement("span"); urlConfigContainer.innerHTML = getUrlConfigHtml(); addClass(urlConfigContainer, "qunit-url-config"); addEvents(urlConfigContainer.getElementsByTagName("input"), "change", toolbarChanged); addEvents(urlConfigContainer.getElementsByTagName("select"), "change", toolbarChanged); return urlConfigContainer; } function abortTestsButton() { var button = document$$1.createElement("button"); button.id = "qunit-abort-tests-button"; button.innerHTML = "Abort"; addEvent(button, "click", abortTests); return button; } function toolbarLooseFilter() { var filter = document$$1.createElement("form"), label = document$$1.createElement("label"), input = document$$1.createElement("input"), button = document$$1.createElement("button"); addClass(filter, "qunit-filter"); label.innerHTML = "Filter: "; input.type = "text"; input.value = config.filter || ""; input.name = "filter"; input.id = "qunit-filter-input"; button.innerHTML = "Go"; label.appendChild(input); filter.appendChild(label); filter.appendChild(document$$1.createTextNode(" ")); filter.appendChild(button); addEvent(filter, "submit", interceptNavigation); return filter; } function moduleListHtml() { var i, checked, html = ""; for (i = 0; i < config.modules.length; i++) { if (config.modules[i].name !== "") { checked = config.moduleId.indexOf(config.modules[i].moduleId) > -1; html += "
  • "; } } return html; } function toolbarModuleFilter() { var allCheckbox, commit, reset, moduleFilter = document$$1.createElement("form"), label = document$$1.createElement("label"), moduleSearch = document$$1.createElement("input"), dropDown = document$$1.createElement("div"), actions = document$$1.createElement("span"), dropDownList = document$$1.createElement("ul"), dirty = false; moduleSearch.id = "qunit-modulefilter-search"; addEvent(moduleSearch, "input", searchInput); addEvent(moduleSearch, "input", searchFocus); addEvent(moduleSearch, "focus", searchFocus); addEvent(moduleSearch, "click", searchFocus); label.id = "qunit-modulefilter-search-container"; label.innerHTML = "Module: "; label.appendChild(moduleSearch); actions.id = "qunit-modulefilter-actions"; actions.innerHTML = "" + "" + ""; allCheckbox = actions.lastChild.firstChild; commit = actions.firstChild; reset = commit.nextSibling; addEvent(commit, "click", applyUrlParams); dropDownList.id = "qunit-modulefilter-dropdown-list"; dropDownList.innerHTML = moduleListHtml(); dropDown.id = "qunit-modulefilter-dropdown"; dropDown.style.display = "none"; dropDown.appendChild(actions); dropDown.appendChild(dropDownList); addEvent(dropDown, "change", selectionChange); selectionChange(); moduleFilter.id = "qunit-modulefilter"; moduleFilter.appendChild(label); moduleFilter.appendChild(dropDown); addEvent(moduleFilter, "submit", interceptNavigation); addEvent(moduleFilter, "reset", function () { // Let the reset happen, then update styles window.setTimeout(selectionChange); }); // Enables show/hide for the dropdown function searchFocus() { if (dropDown.style.display !== "none") { return; } dropDown.style.display = "block"; addEvent(document$$1, "click", hideHandler); addEvent(document$$1, "keydown", hideHandler); // Hide on Escape keydown or outside-container click function hideHandler(e) { var inContainer = moduleFilter.contains(e.target); if (e.keyCode === 27 || !inContainer) { if (e.keyCode === 27 && inContainer) { moduleSearch.focus(); } dropDown.style.display = "none"; removeEvent(document$$1, "click", hideHandler); removeEvent(document$$1, "keydown", hideHandler); moduleSearch.value = ""; searchInput(); } } } // Processes module search box input function searchInput() { var i, item, searchText = moduleSearch.value.toLowerCase(), listItems = dropDownList.children; for (i = 0; i < listItems.length; i++) { item = listItems[i]; if (!searchText || item.textContent.toLowerCase().indexOf(searchText) > -1) { item.style.display = ""; } else { item.style.display = "none"; } } } // Processes selection changes function selectionChange(evt) { var i, item, checkbox = evt && evt.target || allCheckbox, modulesList = dropDownList.getElementsByTagName("input"), selectedNames = []; toggleClass(checkbox.parentNode, "checked", checkbox.checked); dirty = false; if (checkbox.checked && checkbox !== allCheckbox) { allCheckbox.checked = false; removeClass(allCheckbox.parentNode, "checked"); } for (i = 0; i < modulesList.length; i++) { item = modulesList[i]; if (!evt) { toggleClass(item.parentNode, "checked", item.checked); } else if (checkbox === allCheckbox && checkbox.checked) { item.checked = false; removeClass(item.parentNode, "checked"); } dirty = dirty || item.checked !== item.defaultChecked; if (item.checked) { selectedNames.push(item.parentNode.textContent); } } commit.style.display = reset.style.display = dirty ? "" : "none"; moduleSearch.placeholder = selectedNames.join(", ") || allCheckbox.parentNode.textContent; moduleSearch.title = "Type to filter list. Current selection:\n" + (selectedNames.join("\n") || allCheckbox.parentNode.textContent); } return moduleFilter; } function appendToolbar() { var toolbar = id("qunit-testrunner-toolbar"); if (toolbar) { toolbar.appendChild(toolbarUrlConfigContainer()); toolbar.appendChild(toolbarModuleFilter()); toolbar.appendChild(toolbarLooseFilter()); toolbar.appendChild(document$$1.createElement("div")).className = "clearfix"; } } function appendHeader() { var header = id("qunit-header"); if (header) { header.innerHTML = "" + header.innerHTML + " "; } } function appendBanner() { var banner = id("qunit-banner"); if (banner) { banner.className = ""; } } function appendTestResults() { var tests = id("qunit-tests"), result = id("qunit-testresult"), controls; if (result) { result.parentNode.removeChild(result); } if (tests) { tests.innerHTML = ""; result = document$$1.createElement("p"); result.id = "qunit-testresult"; result.className = "result"; tests.parentNode.insertBefore(result, tests); result.innerHTML = "
    Running...
     
    " + "
    " + "
    "; controls = id("qunit-testresult-controls"); } if (controls) { controls.appendChild(abortTestsButton()); } } function appendFilteredTest() { var testId = QUnit.config.testId; if (!testId || testId.length <= 0) { return ""; } return "
    Rerunning selected tests: " + escapeText(testId.join(", ")) + " Run all tests
    "; } function appendUserAgent() { var userAgent = id("qunit-userAgent"); if (userAgent) { userAgent.innerHTML = ""; userAgent.appendChild(document$$1.createTextNode("QUnit " + QUnit.version + "; " + navigator.userAgent)); } } function appendInterface() { var qunit = id("qunit"); if (qunit) { qunit.innerHTML = "

    " + escapeText(document$$1.title) + "

    " + "

    " + "
    " + appendFilteredTest() + "

    " + "
      "; } appendHeader(); appendBanner(); appendTestResults(); appendUserAgent(); appendToolbar(); } function appendTestsList(modules) { var i, l, x, z, test, moduleObj; for (i = 0, l = modules.length; i < l; i++) { moduleObj = modules[i]; for (x = 0, z = moduleObj.tests.length; x < z; x++) { test = moduleObj.tests[x]; appendTest(test.name, test.testId, moduleObj.name); } } } function appendTest(name, testId, moduleName) { var title, rerunTrigger, testBlock, assertList, tests = id("qunit-tests"); if (!tests) { return; } title = document$$1.createElement("strong"); title.innerHTML = getNameHtml(name, moduleName); rerunTrigger = document$$1.createElement("a"); rerunTrigger.innerHTML = "Rerun"; rerunTrigger.href = setUrl({ testId: testId }); testBlock = document$$1.createElement("li"); testBlock.appendChild(title); testBlock.appendChild(rerunTrigger); testBlock.id = "qunit-test-output-" + testId; assertList = document$$1.createElement("ol"); assertList.className = "qunit-assert-list"; testBlock.appendChild(assertList); tests.appendChild(testBlock); } // HTML Reporter initialization and load QUnit.begin(function (details) { var i, moduleObj, tests; // Sort modules by name for the picker for (i = 0; i < details.modules.length; i++) { moduleObj = details.modules[i]; if (moduleObj.name) { modulesList.push(moduleObj.name); } } modulesList.sort(function (a, b) { return a.localeCompare(b); }); // Initialize QUnit elements appendInterface(); appendTestsList(details.modules); tests = id("qunit-tests"); if (tests && config.hidepassed) { addClass(tests, "hidepass"); } }); QUnit.done(function (details) { var banner = id("qunit-banner"), tests = id("qunit-tests"), abortButton = id("qunit-abort-tests-button"), totalTests = stats.passedTests + stats.skippedTests + stats.todoTests + stats.failedTests, html = [totalTests, " tests completed in ", details.runtime, " milliseconds, with ", stats.failedTests, " failed, ", stats.skippedTests, " skipped, and ", stats.todoTests, " todo.
      ", "", details.passed, " assertions of ", details.total, " passed, ", details.failed, " failed."].join(""), test, assertLi, assertList; // Update remaing tests to aborted if (abortButton && abortButton.disabled) { html = "Tests aborted after " + details.runtime + " milliseconds."; for (var i = 0; i < tests.children.length; i++) { test = tests.children[i]; if (test.className === "" || test.className === "running") { test.className = "aborted"; assertList = test.getElementsByTagName("ol")[0]; assertLi = document$$1.createElement("li"); assertLi.className = "fail"; assertLi.innerHTML = "Test aborted."; assertList.appendChild(assertLi); } } } if (banner && (!abortButton || abortButton.disabled === false)) { banner.className = stats.failedTests ? "qunit-fail" : "qunit-pass"; } if (abortButton) { abortButton.parentNode.removeChild(abortButton); } if (tests) { id("qunit-testresult-display").innerHTML = html; } if (config.altertitle && document$$1.title) { // Show ✖ for good, ✔ for bad suite result in title // use escape sequences in case file gets loaded with non-utf-8 // charset document$$1.title = [stats.failedTests ? "\u2716" : "\u2714", document$$1.title.replace(/^[\u2714\u2716] /i, "")].join(" "); } // Scroll back to top to show results if (config.scrolltop && window.scrollTo) { window.scrollTo(0, 0); } }); function getNameHtml(name, module) { var nameHtml = ""; if (module) { nameHtml = "" + escapeText(module) + ": "; } nameHtml += "" + escapeText(name) + ""; return nameHtml; } QUnit.testStart(function (details) { var running, testBlock, bad; testBlock = id("qunit-test-output-" + details.testId); if (testBlock) { testBlock.className = "running"; } else { // Report later registered tests appendTest(details.name, details.testId, details.module); } running = id("qunit-testresult-display"); if (running) { bad = QUnit.config.reorder && details.previousFailure; running.innerHTML = [bad ? "Rerunning previously failed test:
      " : "Running:
      ", getNameHtml(details.name, details.module)].join(""); } }); function stripHtml(string) { // Strip tags, html entity and whitespaces return string.replace(/<\/?[^>]+(>|$)/g, "").replace(/\"/g, "").replace(/\s+/g, ""); } QUnit.log(function (details) { var assertList, assertLi, message, expected, actual, diff, showDiff = false, testItem = id("qunit-test-output-" + details.testId); if (!testItem) { return; } message = escapeText(details.message) || (details.result ? "okay" : "failed"); message = "" + message + ""; message += "@ " + details.runtime + " ms"; // The pushFailure doesn't provide details.expected // when it calls, it's implicit to also not show expected and diff stuff // Also, we need to check details.expected existence, as it can exist and be undefined if (!details.result && hasOwn.call(details, "expected")) { if (details.negative) { expected = "NOT " + QUnit.dump.parse(details.expected); } else { expected = QUnit.dump.parse(details.expected); } actual = QUnit.dump.parse(details.actual); message += ""; if (actual !== expected) { message += ""; if (typeof details.actual === "number" && typeof details.expected === "number") { if (!isNaN(details.actual) && !isNaN(details.expected)) { showDiff = true; diff = details.actual - details.expected; diff = (diff > 0 ? "+" : "") + diff; } } else if (typeof details.actual !== "boolean" && typeof details.expected !== "boolean") { diff = QUnit.diff(expected, actual); // don't show diff if there is zero overlap showDiff = stripHtml(diff).length !== stripHtml(expected).length + stripHtml(actual).length; } if (showDiff) { message += ""; } } else if (expected.indexOf("[object Array]") !== -1 || expected.indexOf("[object Object]") !== -1) { message += ""; } else { message += ""; } if (details.source) { message += ""; } message += "
      Expected:
      " + escapeText(expected) + "
      Result:
      " + escapeText(actual) + "
      Diff:
      " + diff + "
      Message: " + "Diff suppressed as the depth of object is more than current max depth (" + QUnit.config.maxDepth + ").

      Hint: Use QUnit.dump.maxDepth to " + " run with a higher max depth or " + "Rerun without max depth.

      Message: " + "Diff suppressed as the expected and actual results have an equivalent" + " serialization
      Source:
      " + escapeText(details.source) + "
      "; // This occurs when pushFailure is set and we have an extracted stack trace } else if (!details.result && details.source) { message += "" + "" + "
      Source:
      " + escapeText(details.source) + "
      "; } assertList = testItem.getElementsByTagName("ol")[0]; assertLi = document$$1.createElement("li"); assertLi.className = details.result ? "pass" : "fail"; assertLi.innerHTML = message; assertList.appendChild(assertLi); }); QUnit.testDone(function (details) { var testTitle, time, testItem, assertList, good, bad, testCounts, skipped, sourceName, tests = id("qunit-tests"); if (!tests) { return; } testItem = id("qunit-test-output-" + details.testId); assertList = testItem.getElementsByTagName("ol")[0]; good = details.passed; bad = details.failed; // This test passed if it has no unexpected failed assertions var testPassed = details.failed > 0 ? details.todo : !details.todo; if (testPassed) { // Collapse the passing tests addClass(assertList, "qunit-collapsed"); } else if (config.collapse) { if (!collapseNext) { // Skip collapsing the first failing test collapseNext = true; } else { // Collapse remaining tests addClass(assertList, "qunit-collapsed"); } } // The testItem.firstChild is the test name testTitle = testItem.firstChild; testCounts = bad ? "" + bad + ", " + "" + good + ", " : ""; testTitle.innerHTML += " (" + testCounts + details.assertions.length + ")"; if (details.skipped) { stats.skippedTests++; testItem.className = "skipped"; skipped = document$$1.createElement("em"); skipped.className = "qunit-skipped-label"; skipped.innerHTML = "skipped"; testItem.insertBefore(skipped, testTitle); } else { addEvent(testTitle, "click", function () { toggleClass(assertList, "qunit-collapsed"); }); testItem.className = testPassed ? "pass" : "fail"; if (details.todo) { var todoLabel = document$$1.createElement("em"); todoLabel.className = "qunit-todo-label"; todoLabel.innerHTML = "todo"; testItem.className += " todo"; testItem.insertBefore(todoLabel, testTitle); } time = document$$1.createElement("span"); time.className = "runtime"; time.innerHTML = details.runtime + " ms"; testItem.insertBefore(time, assertList); if (!testPassed) { stats.failedTests++; } else if (details.todo) { stats.todoTests++; } else { stats.passedTests++; } } // Show the source of the test when showing assertions if (details.source) { sourceName = document$$1.createElement("p"); sourceName.innerHTML = "Source: " + details.source; addClass(sourceName, "qunit-source"); if (testPassed) { addClass(sourceName, "qunit-collapsed"); } addEvent(testTitle, "click", function () { toggleClass(sourceName, "qunit-collapsed"); }); testItem.appendChild(sourceName); } }); // Avoid readyState issue with phantomjs // Ref: #818 var notPhantom = function (p) { return !(p && p.version && p.version.major > 0); }(window.phantom); if (notPhantom && document$$1.readyState === "complete") { QUnit.load(); } else { addEvent(window, "load", QUnit.load); } // Wrap window.onerror. We will call the original window.onerror to see if // the existing handler fully handles the error; if not, we will call the // QUnit.onError function. var originalWindowOnError = window.onerror; // Cover uncaught exceptions // Returning true will suppress the default browser handler, // returning false will let it run. window.onerror = function (message, fileName, lineNumber) { var ret = false; if (originalWindowOnError) { for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { args[_key - 3] = arguments[_key]; } ret = originalWindowOnError.call.apply(originalWindowOnError, [this, message, fileName, lineNumber].concat(args)); } // Treat return value as window.onerror itself does, // Only do our handling if not suppressed. if (ret !== true) { var error = { message: message, fileName: fileName, lineNumber: lineNumber }; ret = QUnit.onError(error); } return ret; }; // Listen for unhandled rejections, and call QUnit.onUnhandledRejection window.addEventListener("unhandledrejection", function (event) { QUnit.onUnhandledRejection(event.reason); }); })(); /* * This file is a modified version of google-diff-match-patch's JavaScript implementation * (https://code.google.com/p/google-diff-match-patch/source/browse/trunk/javascript/diff_match_patch_uncompressed.js), * modifications are licensed as more fully set forth in LICENSE.txt. * * The original source of google-diff-match-patch is attributable and licensed as follows: * * Copyright 2006 Google Inc. * https://code.google.com/p/google-diff-match-patch/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * More Info: * https://code.google.com/p/google-diff-match-patch/ * * Usage: QUnit.diff(expected, actual) * */ QUnit.diff = function () { function DiffMatchPatch() {} // DIFF FUNCTIONS /** * The data structure representing a diff is an array of tuples: * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] * which means: delete 'Hello', add 'Goodbye' and keep ' world.' */ var DIFF_DELETE = -1, DIFF_INSERT = 1, DIFF_EQUAL = 0; /** * Find the differences between two texts. Simplifies the problem by stripping * any common prefix or suffix off the texts before diffing. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {boolean=} optChecklines Optional speedup flag. If present and false, * then don't run a line-level diff first to identify the changed areas. * Defaults to true, which does a faster, slightly less optimal diff. * @return {!Array.} Array of diff tuples. */ DiffMatchPatch.prototype.DiffMain = function (text1, text2, optChecklines) { var deadline, checklines, commonlength, commonprefix, commonsuffix, diffs; // The diff must be complete in up to 1 second. deadline = new Date().getTime() + 1000; // Check for null inputs. if (text1 === null || text2 === null) { throw new Error("Null input. (DiffMain)"); } // Check for equality (speedup). if (text1 === text2) { if (text1) { return [[DIFF_EQUAL, text1]]; } return []; } if (typeof optChecklines === "undefined") { optChecklines = true; } checklines = optChecklines; // Trim off common prefix (speedup). commonlength = this.diffCommonPrefix(text1, text2); commonprefix = text1.substring(0, commonlength); text1 = text1.substring(commonlength); text2 = text2.substring(commonlength); // Trim off common suffix (speedup). commonlength = this.diffCommonSuffix(text1, text2); commonsuffix = text1.substring(text1.length - commonlength); text1 = text1.substring(0, text1.length - commonlength); text2 = text2.substring(0, text2.length - commonlength); // Compute the diff on the middle block. diffs = this.diffCompute(text1, text2, checklines, deadline); // Restore the prefix and suffix. if (commonprefix) { diffs.unshift([DIFF_EQUAL, commonprefix]); } if (commonsuffix) { diffs.push([DIFF_EQUAL, commonsuffix]); } this.diffCleanupMerge(diffs); return diffs; }; /** * Reduce the number of edits by eliminating operationally trivial equalities. * @param {!Array.} diffs Array of diff tuples. */ DiffMatchPatch.prototype.diffCleanupEfficiency = function (diffs) { var changes, equalities, equalitiesLength, lastequality, pointer, preIns, preDel, postIns, postDel; changes = false; equalities = []; // Stack of indices where equalities are found. equalitiesLength = 0; // Keeping our own length var is faster in JS. /** @type {?string} */ lastequality = null; // Always equal to diffs[equalities[equalitiesLength - 1]][1] pointer = 0; // Index of current position. // Is there an insertion operation before the last equality. preIns = false; // Is there a deletion operation before the last equality. preDel = false; // Is there an insertion operation after the last equality. postIns = false; // Is there a deletion operation after the last equality. postDel = false; while (pointer < diffs.length) { // Equality found. if (diffs[pointer][0] === DIFF_EQUAL) { if (diffs[pointer][1].length < 4 && (postIns || postDel)) { // Candidate found. equalities[equalitiesLength++] = pointer; preIns = postIns; preDel = postDel; lastequality = diffs[pointer][1]; } else { // Not a candidate, and can never become one. equalitiesLength = 0; lastequality = null; } postIns = postDel = false; // An insertion or deletion. } else { if (diffs[pointer][0] === DIFF_DELETE) { postDel = true; } else { postIns = true; } /* * Five types to be split: * ABXYCD * AXCD * ABXC * AXCD * ABXC */ if (lastequality && (preIns && preDel && postIns && postDel || lastequality.length < 2 && preIns + preDel + postIns + postDel === 3)) { // Duplicate record. diffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]); // Change second copy to insert. diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; equalitiesLength--; // Throw away the equality we just deleted; lastequality = null; if (preIns && preDel) { // No changes made which could affect previous entry, keep going. postIns = postDel = true; equalitiesLength = 0; } else { equalitiesLength--; // Throw away the previous equality. pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; postIns = postDel = false; } changes = true; } } pointer++; } if (changes) { this.diffCleanupMerge(diffs); } }; /** * Convert a diff array into a pretty HTML report. * @param {!Array.} diffs Array of diff tuples. * @param {integer} string to be beautified. * @return {string} HTML representation. */ DiffMatchPatch.prototype.diffPrettyHtml = function (diffs) { var op, data, x, html = []; for (x = 0; x < diffs.length; x++) { op = diffs[x][0]; // Operation (insert, delete, equal) data = diffs[x][1]; // Text of change. switch (op) { case DIFF_INSERT: html[x] = "" + escapeText(data) + ""; break; case DIFF_DELETE: html[x] = "" + escapeText(data) + ""; break; case DIFF_EQUAL: html[x] = "" + escapeText(data) + ""; break; } } return html.join(""); }; /** * Determine the common prefix of two strings. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {number} The number of characters common to the start of each * string. */ DiffMatchPatch.prototype.diffCommonPrefix = function (text1, text2) { var pointermid, pointermax, pointermin, pointerstart; // Quick check for common null cases. if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) { return 0; } // Binary search. // Performance analysis: https://neil.fraser.name/news/2007/10/09/ pointermin = 0; pointermax = Math.min(text1.length, text2.length); pointermid = pointermax; pointerstart = 0; while (pointermin < pointermid) { if (text1.substring(pointerstart, pointermid) === text2.substring(pointerstart, pointermid)) { pointermin = pointermid; pointerstart = pointermin; } else { pointermax = pointermid; } pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); } return pointermid; }; /** * Determine the common suffix of two strings. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {number} The number of characters common to the end of each string. */ DiffMatchPatch.prototype.diffCommonSuffix = function (text1, text2) { var pointermid, pointermax, pointermin, pointerend; // Quick check for common null cases. if (!text1 || !text2 || text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)) { return 0; } // Binary search. // Performance analysis: https://neil.fraser.name/news/2007/10/09/ pointermin = 0; pointermax = Math.min(text1.length, text2.length); pointermid = pointermax; pointerend = 0; while (pointermin < pointermid) { if (text1.substring(text1.length - pointermid, text1.length - pointerend) === text2.substring(text2.length - pointermid, text2.length - pointerend)) { pointermin = pointermid; pointerend = pointermin; } else { pointermax = pointermid; } pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); } return pointermid; }; /** * Find the differences between two texts. Assumes that the texts do not * have any common prefix or suffix. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {boolean} checklines Speedup flag. If false, then don't run a * line-level diff first to identify the changed areas. * If true, then run a faster, slightly less optimal diff. * @param {number} deadline Time when the diff should be complete by. * @return {!Array.} Array of diff tuples. * @private */ DiffMatchPatch.prototype.diffCompute = function (text1, text2, checklines, deadline) { var diffs, longtext, shorttext, i, hm, text1A, text2A, text1B, text2B, midCommon, diffsA, diffsB; if (!text1) { // Just add some text (speedup). return [[DIFF_INSERT, text2]]; } if (!text2) { // Just delete some text (speedup). return [[DIFF_DELETE, text1]]; } longtext = text1.length > text2.length ? text1 : text2; shorttext = text1.length > text2.length ? text2 : text1; i = longtext.indexOf(shorttext); if (i !== -1) { // Shorter text is inside the longer text (speedup). diffs = [[DIFF_INSERT, longtext.substring(0, i)], [DIFF_EQUAL, shorttext], [DIFF_INSERT, longtext.substring(i + shorttext.length)]]; // Swap insertions for deletions if diff is reversed. if (text1.length > text2.length) { diffs[0][0] = diffs[2][0] = DIFF_DELETE; } return diffs; } if (shorttext.length === 1) { // Single character string. // After the previous speedup, the character can't be an equality. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; } // Check to see if the problem can be split in two. hm = this.diffHalfMatch(text1, text2); if (hm) { // A half-match was found, sort out the return data. text1A = hm[0]; text1B = hm[1]; text2A = hm[2]; text2B = hm[3]; midCommon = hm[4]; // Send both pairs off for separate processing. diffsA = this.DiffMain(text1A, text2A, checklines, deadline); diffsB = this.DiffMain(text1B, text2B, checklines, deadline); // Merge the results. return diffsA.concat([[DIFF_EQUAL, midCommon]], diffsB); } if (checklines && text1.length > 100 && text2.length > 100) { return this.diffLineMode(text1, text2, deadline); } return this.diffBisect(text1, text2, deadline); }; /** * Do the two texts share a substring which is at least half the length of the * longer text? * This speedup can produce non-minimal diffs. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {Array.} Five element Array, containing the prefix of * text1, the suffix of text1, the prefix of text2, the suffix of * text2 and the common middle. Or null if there was no match. * @private */ DiffMatchPatch.prototype.diffHalfMatch = function (text1, text2) { var longtext, shorttext, dmp, text1A, text2B, text2A, text1B, midCommon, hm1, hm2, hm; longtext = text1.length > text2.length ? text1 : text2; shorttext = text1.length > text2.length ? text2 : text1; if (longtext.length < 4 || shorttext.length * 2 < longtext.length) { return null; // Pointless. } dmp = this; // 'this' becomes 'window' in a closure. /** * Does a substring of shorttext exist within longtext such that the substring * is at least half the length of longtext? * Closure, but does not reference any external variables. * @param {string} longtext Longer string. * @param {string} shorttext Shorter string. * @param {number} i Start index of quarter length substring within longtext. * @return {Array.} Five element Array, containing the prefix of * longtext, the suffix of longtext, the prefix of shorttext, the suffix * of shorttext and the common middle. Or null if there was no match. * @private */ function diffHalfMatchI(longtext, shorttext, i) { var seed, j, bestCommon, prefixLength, suffixLength, bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB; // Start with a 1/4 length substring at position i as a seed. seed = longtext.substring(i, i + Math.floor(longtext.length / 4)); j = -1; bestCommon = ""; while ((j = shorttext.indexOf(seed, j + 1)) !== -1) { prefixLength = dmp.diffCommonPrefix(longtext.substring(i), shorttext.substring(j)); suffixLength = dmp.diffCommonSuffix(longtext.substring(0, i), shorttext.substring(0, j)); if (bestCommon.length < suffixLength + prefixLength) { bestCommon = shorttext.substring(j - suffixLength, j) + shorttext.substring(j, j + prefixLength); bestLongtextA = longtext.substring(0, i - suffixLength); bestLongtextB = longtext.substring(i + prefixLength); bestShorttextA = shorttext.substring(0, j - suffixLength); bestShorttextB = shorttext.substring(j + prefixLength); } } if (bestCommon.length * 2 >= longtext.length) { return [bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB, bestCommon]; } else { return null; } } // First check if the second quarter is the seed for a half-match. hm1 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 4)); // Check again based on the third quarter. hm2 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 2)); if (!hm1 && !hm2) { return null; } else if (!hm2) { hm = hm1; } else if (!hm1) { hm = hm2; } else { // Both matched. Select the longest. hm = hm1[4].length > hm2[4].length ? hm1 : hm2; } // A half-match was found, sort out the return data. if (text1.length > text2.length) { text1A = hm[0]; text1B = hm[1]; text2A = hm[2]; text2B = hm[3]; } else { text2A = hm[0]; text2B = hm[1]; text1A = hm[2]; text1B = hm[3]; } midCommon = hm[4]; return [text1A, text1B, text2A, text2B, midCommon]; }; /** * Do a quick line-level diff on both strings, then rediff the parts for * greater accuracy. * This speedup can produce non-minimal diffs. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {number} deadline Time when the diff should be complete by. * @return {!Array.} Array of diff tuples. * @private */ DiffMatchPatch.prototype.diffLineMode = function (text1, text2, deadline) { var a, diffs, linearray, pointer, countInsert, countDelete, textInsert, textDelete, j; // Scan the text on a line-by-line basis first. a = this.diffLinesToChars(text1, text2); text1 = a.chars1; text2 = a.chars2; linearray = a.lineArray; diffs = this.DiffMain(text1, text2, false, deadline); // Convert the diff back to original text. this.diffCharsToLines(diffs, linearray); // Eliminate freak matches (e.g. blank lines) this.diffCleanupSemantic(diffs); // Rediff any replacement blocks, this time character-by-character. // Add a dummy entry at the end. diffs.push([DIFF_EQUAL, ""]); pointer = 0; countDelete = 0; countInsert = 0; textDelete = ""; textInsert = ""; while (pointer < diffs.length) { switch (diffs[pointer][0]) { case DIFF_INSERT: countInsert++; textInsert += diffs[pointer][1]; break; case DIFF_DELETE: countDelete++; textDelete += diffs[pointer][1]; break; case DIFF_EQUAL: // Upon reaching an equality, check for prior redundancies. if (countDelete >= 1 && countInsert >= 1) { // Delete the offending records and add the merged ones. diffs.splice(pointer - countDelete - countInsert, countDelete + countInsert); pointer = pointer - countDelete - countInsert; a = this.DiffMain(textDelete, textInsert, false, deadline); for (j = a.length - 1; j >= 0; j--) { diffs.splice(pointer, 0, a[j]); } pointer = pointer + a.length; } countInsert = 0; countDelete = 0; textDelete = ""; textInsert = ""; break; } pointer++; } diffs.pop(); // Remove the dummy entry at the end. return diffs; }; /** * Find the 'middle snake' of a diff, split the problem in two * and return the recursively constructed diff. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {number} deadline Time at which to bail if not yet complete. * @return {!Array.} Array of diff tuples. * @private */ DiffMatchPatch.prototype.diffBisect = function (text1, text2, deadline) { var text1Length, text2Length, maxD, vOffset, vLength, v1, v2, x, delta, front, k1start, k1end, k2start, k2end, k2Offset, k1Offset, x1, x2, y1, y2, d, k1, k2; // Cache the text lengths to prevent multiple calls. text1Length = text1.length; text2Length = text2.length; maxD = Math.ceil((text1Length + text2Length) / 2); vOffset = maxD; vLength = 2 * maxD; v1 = new Array(vLength); v2 = new Array(vLength); // Setting all elements to -1 is faster in Chrome & Firefox than mixing // integers and undefined. for (x = 0; x < vLength; x++) { v1[x] = -1; v2[x] = -1; } v1[vOffset + 1] = 0; v2[vOffset + 1] = 0; delta = text1Length - text2Length; // If the total number of characters is odd, then the front path will collide // with the reverse path. front = delta % 2 !== 0; // Offsets for start and end of k loop. // Prevents mapping of space beyond the grid. k1start = 0; k1end = 0; k2start = 0; k2end = 0; for (d = 0; d < maxD; d++) { // Bail out if deadline is reached. if (new Date().getTime() > deadline) { break; } // Walk the front path one step. for (k1 = -d + k1start; k1 <= d - k1end; k1 += 2) { k1Offset = vOffset + k1; if (k1 === -d || k1 !== d && v1[k1Offset - 1] < v1[k1Offset + 1]) { x1 = v1[k1Offset + 1]; } else { x1 = v1[k1Offset - 1] + 1; } y1 = x1 - k1; while (x1 < text1Length && y1 < text2Length && text1.charAt(x1) === text2.charAt(y1)) { x1++; y1++; } v1[k1Offset] = x1; if (x1 > text1Length) { // Ran off the right of the graph. k1end += 2; } else if (y1 > text2Length) { // Ran off the bottom of the graph. k1start += 2; } else if (front) { k2Offset = vOffset + delta - k1; if (k2Offset >= 0 && k2Offset < vLength && v2[k2Offset] !== -1) { // Mirror x2 onto top-left coordinate system. x2 = text1Length - v2[k2Offset]; if (x1 >= x2) { // Overlap detected. return this.diffBisectSplit(text1, text2, x1, y1, deadline); } } } } // Walk the reverse path one step. for (k2 = -d + k2start; k2 <= d - k2end; k2 += 2) { k2Offset = vOffset + k2; if (k2 === -d || k2 !== d && v2[k2Offset - 1] < v2[k2Offset + 1]) { x2 = v2[k2Offset + 1]; } else { x2 = v2[k2Offset - 1] + 1; } y2 = x2 - k2; while (x2 < text1Length && y2 < text2Length && text1.charAt(text1Length - x2 - 1) === text2.charAt(text2Length - y2 - 1)) { x2++; y2++; } v2[k2Offset] = x2; if (x2 > text1Length) { // Ran off the left of the graph. k2end += 2; } else if (y2 > text2Length) { // Ran off the top of the graph. k2start += 2; } else if (!front) { k1Offset = vOffset + delta - k2; if (k1Offset >= 0 && k1Offset < vLength && v1[k1Offset] !== -1) { x1 = v1[k1Offset]; y1 = vOffset + x1 - k1Offset; // Mirror x2 onto top-left coordinate system. x2 = text1Length - x2; if (x1 >= x2) { // Overlap detected. return this.diffBisectSplit(text1, text2, x1, y1, deadline); } } } } } // Diff took too long and hit the deadline or // number of diffs equals number of characters, no commonality at all. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; }; /** * Given the location of the 'middle snake', split the diff in two parts * and recurse. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {number} x Index of split point in text1. * @param {number} y Index of split point in text2. * @param {number} deadline Time at which to bail if not yet complete. * @return {!Array.} Array of diff tuples. * @private */ DiffMatchPatch.prototype.diffBisectSplit = function (text1, text2, x, y, deadline) { var text1a, text1b, text2a, text2b, diffs, diffsb; text1a = text1.substring(0, x); text2a = text2.substring(0, y); text1b = text1.substring(x); text2b = text2.substring(y); // Compute both diffs serially. diffs = this.DiffMain(text1a, text2a, false, deadline); diffsb = this.DiffMain(text1b, text2b, false, deadline); return diffs.concat(diffsb); }; /** * Reduce the number of edits by eliminating semantically trivial equalities. * @param {!Array.} diffs Array of diff tuples. */ DiffMatchPatch.prototype.diffCleanupSemantic = function (diffs) { var changes, equalities, equalitiesLength, lastequality, pointer, lengthInsertions2, lengthDeletions2, lengthInsertions1, lengthDeletions1, deletion, insertion, overlapLength1, overlapLength2; changes = false; equalities = []; // Stack of indices where equalities are found. equalitiesLength = 0; // Keeping our own length var is faster in JS. /** @type {?string} */ lastequality = null; // Always equal to diffs[equalities[equalitiesLength - 1]][1] pointer = 0; // Index of current position. // Number of characters that changed prior to the equality. lengthInsertions1 = 0; lengthDeletions1 = 0; // Number of characters that changed after the equality. lengthInsertions2 = 0; lengthDeletions2 = 0; while (pointer < diffs.length) { if (diffs[pointer][0] === DIFF_EQUAL) { // Equality found. equalities[equalitiesLength++] = pointer; lengthInsertions1 = lengthInsertions2; lengthDeletions1 = lengthDeletions2; lengthInsertions2 = 0; lengthDeletions2 = 0; lastequality = diffs[pointer][1]; } else { // An insertion or deletion. if (diffs[pointer][0] === DIFF_INSERT) { lengthInsertions2 += diffs[pointer][1].length; } else { lengthDeletions2 += diffs[pointer][1].length; } // Eliminate an equality that is smaller or equal to the edits on both // sides of it. if (lastequality && lastequality.length <= Math.max(lengthInsertions1, lengthDeletions1) && lastequality.length <= Math.max(lengthInsertions2, lengthDeletions2)) { // Duplicate record. diffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]); // Change second copy to insert. diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; // Throw away the equality we just deleted. equalitiesLength--; // Throw away the previous equality (it needs to be reevaluated). equalitiesLength--; pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; // Reset the counters. lengthInsertions1 = 0; lengthDeletions1 = 0; lengthInsertions2 = 0; lengthDeletions2 = 0; lastequality = null; changes = true; } } pointer++; } // Normalize the diff. if (changes) { this.diffCleanupMerge(diffs); } // Find any overlaps between deletions and insertions. // e.g: abcxxxxxxdef // -> abcxxxdef // e.g: xxxabcdefxxx // -> defxxxabc // Only extract an overlap if it is as big as the edit ahead or behind it. pointer = 1; while (pointer < diffs.length) { if (diffs[pointer - 1][0] === DIFF_DELETE && diffs[pointer][0] === DIFF_INSERT) { deletion = diffs[pointer - 1][1]; insertion = diffs[pointer][1]; overlapLength1 = this.diffCommonOverlap(deletion, insertion); overlapLength2 = this.diffCommonOverlap(insertion, deletion); if (overlapLength1 >= overlapLength2) { if (overlapLength1 >= deletion.length / 2 || overlapLength1 >= insertion.length / 2) { // Overlap found. Insert an equality and trim the surrounding edits. diffs.splice(pointer, 0, [DIFF_EQUAL, insertion.substring(0, overlapLength1)]); diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlapLength1); diffs[pointer + 1][1] = insertion.substring(overlapLength1); pointer++; } } else { if (overlapLength2 >= deletion.length / 2 || overlapLength2 >= insertion.length / 2) { // Reverse overlap found. // Insert an equality and swap and trim the surrounding edits. diffs.splice(pointer, 0, [DIFF_EQUAL, deletion.substring(0, overlapLength2)]); diffs[pointer - 1][0] = DIFF_INSERT; diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlapLength2); diffs[pointer + 1][0] = DIFF_DELETE; diffs[pointer + 1][1] = deletion.substring(overlapLength2); pointer++; } } pointer++; } pointer++; } }; /** * Determine if the suffix of one string is the prefix of another. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {number} The number of characters common to the end of the first * string and the start of the second string. * @private */ DiffMatchPatch.prototype.diffCommonOverlap = function (text1, text2) { var text1Length, text2Length, textLength, best, length, pattern, found; // Cache the text lengths to prevent multiple calls. text1Length = text1.length; text2Length = text2.length; // Eliminate the null case. if (text1Length === 0 || text2Length === 0) { return 0; } // Truncate the longer string. if (text1Length > text2Length) { text1 = text1.substring(text1Length - text2Length); } else if (text1Length < text2Length) { text2 = text2.substring(0, text1Length); } textLength = Math.min(text1Length, text2Length); // Quick check for the worst case. if (text1 === text2) { return textLength; } // Start by looking for a single character match // and increase length until no match is found. // Performance analysis: https://neil.fraser.name/news/2010/11/04/ best = 0; length = 1; while (true) { pattern = text1.substring(textLength - length); found = text2.indexOf(pattern); if (found === -1) { return best; } length += found; if (found === 0 || text1.substring(textLength - length) === text2.substring(0, length)) { best = length; length++; } } }; /** * Split two texts into an array of strings. Reduce the texts to a string of * hashes where each Unicode character represents one line. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {{chars1: string, chars2: string, lineArray: !Array.}} * An object containing the encoded text1, the encoded text2 and * the array of unique strings. * The zeroth element of the array of unique strings is intentionally blank. * @private */ DiffMatchPatch.prototype.diffLinesToChars = function (text1, text2) { var lineArray, lineHash, chars1, chars2; lineArray = []; // E.g. lineArray[4] === 'Hello\n' lineHash = {}; // E.g. lineHash['Hello\n'] === 4 // '\x00' is a valid character, but various debuggers don't like it. // So we'll insert a junk entry to avoid generating a null character. lineArray[0] = ""; /** * Split a text into an array of strings. Reduce the texts to a string of * hashes where each Unicode character represents one line. * Modifies linearray and linehash through being a closure. * @param {string} text String to encode. * @return {string} Encoded string. * @private */ function diffLinesToCharsMunge(text) { var chars, lineStart, lineEnd, lineArrayLength, line; chars = ""; // Walk the text, pulling out a substring for each line. // text.split('\n') would would temporarily double our memory footprint. // Modifying text would create many large strings to garbage collect. lineStart = 0; lineEnd = -1; // Keeping our own length variable is faster than looking it up. lineArrayLength = lineArray.length; while (lineEnd < text.length - 1) { lineEnd = text.indexOf("\n", lineStart); if (lineEnd === -1) { lineEnd = text.length - 1; } line = text.substring(lineStart, lineEnd + 1); lineStart = lineEnd + 1; var lineHashExists = lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== undefined; if (lineHashExists) { chars += String.fromCharCode(lineHash[line]); } else { chars += String.fromCharCode(lineArrayLength); lineHash[line] = lineArrayLength; lineArray[lineArrayLength++] = line; } } return chars; } chars1 = diffLinesToCharsMunge(text1); chars2 = diffLinesToCharsMunge(text2); return { chars1: chars1, chars2: chars2, lineArray: lineArray }; }; /** * Rehydrate the text in a diff from a string of line hashes to real lines of * text. * @param {!Array.} diffs Array of diff tuples. * @param {!Array.} lineArray Array of unique strings. * @private */ DiffMatchPatch.prototype.diffCharsToLines = function (diffs, lineArray) { var x, chars, text, y; for (x = 0; x < diffs.length; x++) { chars = diffs[x][1]; text = []; for (y = 0; y < chars.length; y++) { text[y] = lineArray[chars.charCodeAt(y)]; } diffs[x][1] = text.join(""); } }; /** * Reorder and merge like edit sections. Merge equalities. * Any edit section can move as long as it doesn't cross an equality. * @param {!Array.} diffs Array of diff tuples. */ DiffMatchPatch.prototype.diffCleanupMerge = function (diffs) { var pointer, countDelete, countInsert, textInsert, textDelete, commonlength, changes, diffPointer, position; diffs.push([DIFF_EQUAL, ""]); // Add a dummy entry at the end. pointer = 0; countDelete = 0; countInsert = 0; textDelete = ""; textInsert = ""; while (pointer < diffs.length) { switch (diffs[pointer][0]) { case DIFF_INSERT: countInsert++; textInsert += diffs[pointer][1]; pointer++; break; case DIFF_DELETE: countDelete++; textDelete += diffs[pointer][1]; pointer++; break; case DIFF_EQUAL: // Upon reaching an equality, check for prior redundancies. if (countDelete + countInsert > 1) { if (countDelete !== 0 && countInsert !== 0) { // Factor out any common prefixes. commonlength = this.diffCommonPrefix(textInsert, textDelete); if (commonlength !== 0) { if (pointer - countDelete - countInsert > 0 && diffs[pointer - countDelete - countInsert - 1][0] === DIFF_EQUAL) { diffs[pointer - countDelete - countInsert - 1][1] += textInsert.substring(0, commonlength); } else { diffs.splice(0, 0, [DIFF_EQUAL, textInsert.substring(0, commonlength)]); pointer++; } textInsert = textInsert.substring(commonlength); textDelete = textDelete.substring(commonlength); } // Factor out any common suffixies. commonlength = this.diffCommonSuffix(textInsert, textDelete); if (commonlength !== 0) { diffs[pointer][1] = textInsert.substring(textInsert.length - commonlength) + diffs[pointer][1]; textInsert = textInsert.substring(0, textInsert.length - commonlength); textDelete = textDelete.substring(0, textDelete.length - commonlength); } } // Delete the offending records and add the merged ones. if (countDelete === 0) { diffs.splice(pointer - countInsert, countDelete + countInsert, [DIFF_INSERT, textInsert]); } else if (countInsert === 0) { diffs.splice(pointer - countDelete, countDelete + countInsert, [DIFF_DELETE, textDelete]); } else { diffs.splice(pointer - countDelete - countInsert, countDelete + countInsert, [DIFF_DELETE, textDelete], [DIFF_INSERT, textInsert]); } pointer = pointer - countDelete - countInsert + (countDelete ? 1 : 0) + (countInsert ? 1 : 0) + 1; } else if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) { // Merge this equality with the previous one. diffs[pointer - 1][1] += diffs[pointer][1]; diffs.splice(pointer, 1); } else { pointer++; } countInsert = 0; countDelete = 0; textDelete = ""; textInsert = ""; break; } } if (diffs[diffs.length - 1][1] === "") { diffs.pop(); // Remove the dummy entry at the end. } // Second pass: look for single edits surrounded on both sides by equalities // which can be shifted sideways to eliminate an equality. // e.g: ABAC -> ABAC changes = false; pointer = 1; // Intentionally ignore the first and last element (don't need checking). while (pointer < diffs.length - 1) { if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) { diffPointer = diffs[pointer][1]; position = diffPointer.substring(diffPointer.length - diffs[pointer - 1][1].length); // This is a single edit surrounded by equalities. if (position === diffs[pointer - 1][1]) { // Shift the edit over the previous equality. diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length); diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; diffs.splice(pointer - 1, 1); changes = true; } else if (diffPointer.substring(0, diffs[pointer + 1][1].length) === diffs[pointer + 1][1]) { // Shift the edit over the next equality. diffs[pointer - 1][1] += diffs[pointer + 1][1]; diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1]; diffs.splice(pointer + 1, 1); changes = true; } } pointer++; } // If shifts were made, the diff needs reordering and another shift sweep. if (changes) { this.diffCleanupMerge(diffs); } }; return function (o, n) { var diff, output, text; diff = new DiffMatchPatch(); output = diff.DiffMain(o, n); diff.diffCleanupEfficiency(output); text = diff.diffPrettyHtml(output); return text; }; }(); }((function() { return this; }()))); ================================================ FILE: test/qunit-assert-close.js ================================================ (function(factory) { // NOTE: // All techniques except for the "browser globals" fallback will extend the // provided QUnit object but return the isolated API methods // For AMD: Register as an anonymous AMD module with a named dependency on "qunit". if (typeof define === "function" && define.amd) { define(["qunit"], factory); } // For Node.js else if (typeof module !== "undefined" && module && module.exports && typeof require === "function") { module.exports = factory(require("qunitjs")); } // For CommonJS with `exports`, but without `module.exports`, like Rhino else if (typeof exports !== "undefined" && exports && typeof require === "function") { var qunit = require("qunitjs"); qunit.extend(exports, factory(qunit)); } // For browser globals else { factory(QUnit); } }(function(QUnit) { /** * Find an appropriate `Assert` context to `push` results to. * @param * context - An unknown context, possibly `Assert`, `Test`, or neither * @private */ function _getPushContext(context) { var pushContext; if (context && typeof context.push === "function") { // `context` is an `Assert` context pushContext = context; } else if (context && context.assert && typeof context.assert.push === "function") { // `context` is a `Test` context pushContext = context.assert; } else if ( QUnit && QUnit.config && QUnit.config.current && QUnit.config.current.assert && typeof QUnit.config.current.assert.push === "function" ) { // `context` is an unknown context but we can find the `Assert` context via QUnit pushContext = QUnit.config.current.assert; } else if (QUnit && typeof QUnit.push === "function") { pushContext = QUnit.push; } else { throw new Error("Could not find the QUnit `Assert` context to push results"); } return pushContext; } /** * Checks that the first two arguments are equal, or are numbers close enough to be considered equal * based on a specified maximum allowable difference. * * @example assert.close(3.141, Math.PI, 0.001); * * @param Number actual * @param Number expected * @param Number maxDifference (the maximum inclusive difference allowed between the actual and expected numbers) * @param String message (optional) */ function close(actual, expected, maxDifference, message) { var actualDiff = (actual === expected) ? 0 : Math.abs(actual - expected), result = actualDiff <= maxDifference, pushContext = _getPushContext(this); message = message || (actual + " should be within " + maxDifference + " (inclusive) of " + expected + (result ? "" : ". Actual: " + actualDiff)); if (pushContext.pushResult) { pushContext.pushResult({ "result": result, "actual": actual, "expected": expected, "message": message }); } else { pushContext.push(result, actual, expected, message); } } /** * Checks that the first two arguments are equal, or are numbers close enough to be considered equal * based on a specified maximum allowable difference percentage. * * @example assert.close.percent(155, 150, 3.4); // Difference is ~3.33% * * @param Number actual * @param Number expected * @param Number maxPercentDifference (the maximum inclusive difference percentage allowed between the actual and expected numbers) * @param String message (optional) */ close.percent = function closePercent(actual, expected, maxPercentDifference, message) { var actualDiff, result, pushContext = _getPushContext(this); if (actual === expected) { actualDiff = 0; result = actualDiff <= maxPercentDifference; } else if (actual !== 0 && expected !== 0 && expected !== Infinity && expected !== -Infinity) { actualDiff = Math.abs(100 * (actual - expected) / expected); result = actualDiff <= maxPercentDifference; } else { // Dividing by zero (0)! Should return `false` unless the max percentage was `Infinity` actualDiff = Infinity; result = maxPercentDifference === Infinity; } message = message || (actual + " should be within " + maxPercentDifference + "% (inclusive) of " + expected + (result ? "" : ". Actual: " + actualDiff + "%")); if (pushContext.pushResult) { pushContext.pushResult({ "result": result, "actual": actual, "expected": expected, "message": message }); } else { pushContext.push(result, actual, expected, message); } }; /** * Checks that the first two arguments are numbers with differences greater than the specified * minimum difference. * * @example assert.notClose(3.1, Math.PI, 0.001); * * @param Number actual * @param Number expected * @param Number minDifference (the minimum exclusive difference allowed between the actual and expected numbers) * @param String message (optional) */ function notClose(actual, expected, minDifference, message) { var actualDiff = Math.abs(actual - expected), result = actualDiff > minDifference, pushContext = _getPushContext(this); message = message || (actual + " should not be within " + minDifference + " (exclusive) of " + expected + (result ? "" : ". Actual: " + actualDiff)); if (pushContext.pushResult) { pushContext.pushResult({ "result": result, "actual": actual, "expected": expected, "message": message }); } else { pushContext.push(result, actual, expected, message); } } /** * Checks that the first two arguments are numbers with differences greater than the specified * minimum difference percentage. * * @example assert.notClose.percent(156, 150, 3.5); // Difference is 4.0% * * @param Number actual * @param Number expected * @param Number minPercentDifference (the minimum exclusive difference percentage allowed between the actual and expected numbers) * @param String message (optional) */ notClose.percent = function notClosePercent(actual, expected, minPercentDifference, message) { var actualDiff, result, pushContext = _getPushContext(this); if (actual === expected) { actualDiff = 0; result = actualDiff > minPercentDifference; } else if (actual !== 0 && expected !== 0 && expected !== Infinity && expected !== -Infinity) { actualDiff = Math.abs(100 * (actual - expected) / expected); result = actualDiff > minPercentDifference; } else { // Dividing by zero (0)! Should only return `true` if the min percentage was `Infinity` actualDiff = Infinity; result = minPercentDifference !== Infinity; } message = message || (actual + " should not be within " + minPercentDifference + "% (exclusive) of " + expected + (result ? "" : ". Actual: " + actualDiff + "%")); if (pushContext.pushResult) { pushContext.pushResult({ "result": result, "actual": actual, "expected": expected, "message": message }); } else { pushContext.push(result, actual, expected, message); } }; var api = { close: close, notClose: notClose, closePercent: close.percent, notClosePercent: notClose.percent }; QUnit.extend(QUnit.assert, api); return api; })); ================================================ FILE: test/src/1_Core/Arguments.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity, {VelocityOptions, VelocityResult} from "velocity-animate"; import {Data, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("Arguments", (assert) => { const testComplete = () => { // Do nothing }, testDuration = 1000, testEasing = "easeInSine", testOptions: VelocityOptions = { duration: 123, easing: testEasing, complete: testComplete, }; let result: VelocityResult; assert.expect(18); /**************** Overloading ****************/ result = Velocity(getTarget(), defaultProperties); assert.ok(result.length, "Overload variation #1a: Velocity(ELEMENT, {properties})"); assert.ok(result.velocity.animations.length, "Overload variation #1b: Velocity(element, {PROPERTIES})"); result = Velocity(getTarget(), defaultProperties, testDuration); assert.equal(result.velocity.animations[0].options.duration, testDuration, "Overload variation #2a: Velocity(element, {properties}, DURATION)"); result = Velocity(getTarget(), defaultProperties, "slow"); assert.equal(result.velocity.animations[0].options.duration, 600, "Overload variation #2b: Velocity(element, {properties}, DURATION)"); result = Velocity(getTarget(), defaultProperties, "normal"); assert.equal(result.velocity.animations[0].options.duration, 400, "Overload variation #2c: Velocity(element, {properties}, DURATION)"); result = Velocity(getTarget(), defaultProperties, "fast"); assert.equal(result.velocity.animations[0].options.duration, 200, "Overload variation #2d: Velocity(element, {properties}, DURATION)"); result = Velocity(getTarget(), defaultProperties, testEasing); assert.equal(typeof result.velocity.animations[0].options.easing, "function", "Overload variation #3: Velocity(element, {properties}, EASING)"); result = Velocity(getTarget(), defaultProperties, testComplete); assert.equal(typeof result.velocity.animations[0].options.complete, "function", "Overload variation #4: Velocity(element, {properties}, COMPLETE)"); result = Velocity(getTarget(), defaultProperties, testDuration, [0.42, 0, 0.58, 1]); assert.equal(result.velocity.animations[0].options.duration, testDuration, "Overload variation #5a: Velocity(element, {properties}, DURATION, easing)"); assert.equal(result.velocity.animations[0].options.easing(0.2, 0, 1), 0.0816598562658975, "Overload variation #5b: Velocity(element, {properties}, duration, EASING)"); result = Velocity(getTarget(), defaultProperties, testDuration, testComplete); assert.equal(result.velocity.animations[0].options.duration, testDuration, "Overload variation #6a: Velocity(element, {properties}, DURATION, complete)"); assert.equal(result.velocity.animations[0].options.complete, testComplete, "Overload variation #6b: Velocity(element, {properties}, duration, COMPLETE)"); result = Velocity(getTarget(), defaultProperties, testDuration, testEasing, testComplete); assert.equal(result.velocity.animations[0].options.duration, testDuration, "Overload variation #7a: Velocity(element, {properties}, DURATION, easing, complete)"); assert.equal(typeof result.velocity.animations[0].options.easing, "function", "Overload variation #7b: Velocity(element, {properties}, duration, EASING, complete)"); assert.equal(result.velocity.animations[0].options.complete, testComplete, "Overload variation #7c: Velocity(element, {properties}, duration, easing, COMPLETE)"); result = Velocity(getTarget(), defaultProperties, testOptions); assert.equal(result.velocity.animations[0].options.duration, testOptions.duration, "Overload variation #8: Velocity(element, {properties}, {OPTIONS})"); Velocity({elements: [getTarget()], properties: defaultProperties, options: testOptions}); assert.equal(result.velocity.animations[0].options.duration, testOptions.duration, "Overload variation #9: Velocity({elements:[elements], properties:{properties}, options:{OPTIONS})"); Velocity({elements: [getTarget()], properties: "stop", options: testOptions}); assert.equal(result.velocity.animations[0].options.duration, testOptions.duration, "Overload variation #10: Velocity({elements:[elements], properties:\"ACTION\", options:{OPTIONS})"); // var $target12 = getTarget(); // Velocity($target12, {opacity: [0.75, "spring", 0.25]}, testDuration); // assert.equal(Data($target12).style.opacity.startValue, 0.25, "Overload variation #10a."); // assert.equal(Data($target12).style.opacity.easing, "spring", "Overload variation #10b."); // assert.equal(Data($target12).style.opacity.endValue, 0.75, "Overload variation #10c."); // var $target13 = getTarget(); // Velocity($target13, {opacity: [0.75, 0.25]}, testDuration); // assert.equal(Data($target13).style.opacity.startValue, 0.25, "Overload variation #11a."); // assert.equal(Data($target13).style.opacity.endValue, 0.75, "Overload variation #11b."); // var $target14 = getTarget(); // Velocity($target14, {opacity: [0.75, "spring"]}, testDuration); // assert.equal(Data($target14).style.opacity.endValue, 0.75, "Overload variation #12a."); // assert.equal(Data($target14).style.opacity.easing, "spring", "Overload variation #12b."); // if ($) { // var $target17 = getTarget(); // $($target17).velocity(defaultProperties, testOptions); // assert.deepEqual(Data($target17).opts, testOptions, "$.fn.: Utility function variation #1: options object."); // // var $target18 = getTarget(); // $($target18).velocity({properties: defaultProperties, options: testOptions}); // assert.deepEqual(Data($target18).opts, testOptions, "$.fn.: Utility function variation #2: single object."); // // var $target19 = getTarget(); // $($target19).velocity(defaultProperties, testDuration, testEasing, testComplete); // assert.equal(Data($target19).opts.duration, testDuration, "$.fn.: Utility function variation #2a."); // assert.equal(Data($target19).opts.easing, testEasing, "$.fn.: Utility function variation #2b."); // assert.equal(Data($target19).opts.complete, testComplete, "$.fn.: Utility function variation #2c."); // // var $target20 = getTarget(); // assert.equal($($target20).length, $($target20).velocity(defaultProperties, testDuration, testEasing, testComplete) // .velocity(defaultProperties, testDuration, testEasing, testComplete).length, "$.fn.: Elements passed back to the call stack."); // // TODO: Should check in a better way - but the prototype chain is now extended with a Promise so a standard (non-length) comparison *will* fail // } }); ================================================ FILE: test/src/1_Core/End Value Caching.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {Data, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("End Value Caching", (assert) => { const done = assert.async(2), newProperties = {height: "50px", width: "250px"}; assert.expect(4); /* Called after the last call is complete (stale). Ensure that the newly-set (via $.css()) properties are used. */ Velocity(getTarget(newProperties), defaultProperties) .then((elements) => { assert.equal(Data(elements[0]).cache.width, defaultProperties.width, "Stale end value #1 wasn't pulled."); assert.equal(Data(elements[0]).cache.height, defaultProperties.height, "Stale end value #2 wasn't pulled."); done(); }); Velocity(getTarget(), defaultProperties) .velocity(newProperties) .then((elements) => { /* Chained onto a previous call (fresh). */ assert.equal(Data(elements[0]).cache.width, newProperties.width, "Chained end value #1 was pulled."); assert.equal(Data(elements[0]).cache.height, newProperties.height, "Chained end value #2 was pulled."); done(); }); }); ================================================ FILE: test/src/1_Core/End Value Setting.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {Data, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("End Value Setting", (assert) => { const done = assert.async(1); /* Standard properties. */ Velocity(getTarget(), defaultProperties) .then((elements) => { assert.equal(Velocity(elements[0], "style", "width"), defaultProperties.width, "Standard end value #1 was set."); assert.equal(Velocity(elements[0], "style", "opacity"), defaultProperties.opacity, "Standard end value #2 was set."); done(); }); }); ================================================ FILE: test/src/1_Core/Start Value Calculation.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {$qunitStage, applyStartValues, Data, defaultProperties, defaultStyles, getTarget} from "../utilities"; import "./_module"; QUnit.todo("Start Value Calculation", (assert) => { const testStartValues = { paddingLeft: "10px", height: "100px", paddingRight: "50%", marginLeft: "100px", marginBottom: "33%", marginTop: "100px", lineHeight: "30px", wordSpacing: "40px", backgroundColor: "rgb(123,0,0)", }; /* Properties not previously defined on the element. */ const $target1 = getTarget(); Velocity($target1, testStartValues); assert.equal(Data($target1).cache.paddingLeft, testStartValues.paddingLeft, "Undefined standard start value was calculated."); assert.equal(Data($target1).cache.backgroundColor, testStartValues.backgroundColor, "Undefined start value hook was calculated."); /* Properties previously defined on the element. */ const $target2 = getTarget(); Velocity($target2, defaultProperties); assert.equal(Data($target2).cache.width, parseFloat(defaultStyles.width as any), "Defined start value #1 was calculated."); assert.equal(Data($target2).cache.opacity, parseFloat(defaultStyles.opacity as any), "Defined start value #2 was calculated."); assert.equal(Data($target2).cache.color, parseFloat(defaultStyles.colorGreen as any), "Defined hooked start value was calculated."); /* Properties that shouldn't cause start values to be unit-converted. */ const testPropertiesEndNoConvert = {paddingLeft: "20px", height: "40px", paddingRight: "75%"}, $target3 = getTarget(); applyStartValues($target3, testStartValues); Velocity($target3, testPropertiesEndNoConvert); assert.equal(Data($target3).cache.paddingLeft, parseFloat(testStartValues.paddingLeft), "Start value #1 wasn't unit converted."); assert.equal(Data($target3).cache.height, parseFloat(testStartValues.height), "Start value #2 wasn't unit converted."); // assert.deepEqual(Data($target3).cache.paddingRight.startValue, [Math.floor((parentWidth * parseFloat(testStartValues.paddingRight)) / 100), 0], // "Start value #3 was pattern matched."); /* Properties that should cause start values to be unit-converted. */ const testPropertiesEndConvert = {paddingLeft: "20%", height: "40%", lineHeight: "0.5em", wordSpacing: "2rem", marginLeft: "10vw", marginTop: "5vh", marginBottom: "100px"}, parentWidth = $qunitStage.clientWidth, parentHeight = $qunitStage.clientHeight, parentFontSize = Velocity($qunitStage, "style", "fontSize"), remSize = parseFloat(Velocity(document.body, "style", "fontSize") as any), $target4 = getTarget(); applyStartValues($target4, testStartValues); Velocity($target4, testPropertiesEndConvert); /* Long decimal results can be returned after unit conversion, and Velocity's code and the code here can differ in precision. So, we round floor values before comparison. */ // assert.deepEqual(Data($target4).cache.paddingLeft.startValue, [parseFloat(testStartValues.paddingLeft), 0], // "Horizontal property converted to %."); assert.equal(parseInt(Data($target4).cache.height, 10), Math.floor((parseFloat(testStartValues.height) / parentHeight) * 100), "Vertical property converted to %."); // assert.equal(Data($target4).cache.lineHeight.startValue, Math.floor(parseFloat(testStartValues.lineHeight) / parseFloat(parentFontSize)), // "Property converted to em."); // assert.equal(Data($target4).cache.wordSpacing.startValue, Math.floor(parseFloat(testStartValues.wordSpacing) / parseFloat(remSize)), // "Property converted to rem."); assert.equal(parseInt(Data($target4).cache.marginBottom, 10), parseFloat(testStartValues.marginBottom) / 100 * parseFloat($target4.parentElement.offsetWidth as any), "Property converted to px."); // if (!(IE<=8) && !isAndroid) { // assert.equal(Data($target4).cache.marginLeft.startValue, Math.floor(parseFloat(testStartValues.marginLeft) / window.innerWidth * 100), // "Horizontal property converted to vw."); // assert.equal(Data($target4).cache.marginTop.startValue, Math.floor(parseFloat(testStartValues.marginTop) / window.innerHeight * 100), // "Vertical property converted to vh."); // } // TODO: Tests for auto-parameters as the units are no longer converted. /* jQuery TRBL deferring. */ const testPropertiesTRBL = {left: "1000px"}, $TRBLContainer = document.createElement("div"); $TRBLContainer.setAttribute("id", "TRBLContainer"); $TRBLContainer.style.marginLeft = testPropertiesTRBL.left; $TRBLContainer.style.width = "100px"; $TRBLContainer.style.height = "100px"; document.body.appendChild($TRBLContainer); const $target5 = getTarget(); $target5.style.position = "absolute"; $TRBLContainer.appendChild($target5); Velocity($target5, testPropertiesTRBL); assert.equal(parseInt(Data($target5).cache.left, 10), Math.round(parseFloat(testPropertiesTRBL.left) + parseFloat(Velocity(document.body, "style", "marginLeft") as any)), "TRBL value was deferred to jQuery."); }); ================================================ FILE: test/src/1_Core/Unit Calculation.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, getPropertyValue, getTarget, sleep} from "../utilities"; import "./_module"; QUnit.test("Unit Calculation", (assert) => { // TODO: Add code and tests for operators - probably using calc() internally // /* Standard properties with operators. */ // var testIncrementWidth = "5px", // testDecrementOpacity = 0.25, // testMultiplyMarginBottom = 4, // testDivideHeight = 2; // // var $target2 = getTarget(); // Velocity($target2, {width: "+=" + testIncrementWidth, opacity: "-=" + testDecrementOpacity, marginBottom: "*=" + testMultiplyMarginBottom, height: "/=" + testDivideHeight}); // setTimeout(function() { // // assert.equal(Data($target2).style.width.endValue, defaultStyles.width + parseFloat(testIncrementWidth), "Incremented end value was calculated."); // assert.equal(Data($target2).style.opacity.endValue, defaultStyles.opacity - testDecrementOpacity, "Decremented end value was calculated."); // assert.equal(Data($target2).style.marginBottom.endValue, defaultStyles.marginBottom * testMultiplyMarginBottom, "Multiplied end value was calculated."); // assert.equal(Data($target2).style.height.endValue, defaultStyles.height / testDivideHeight, "Divided end value was calculated."); // // done(); // }, asyncCheckDuration); asyncTests(assert, 2, async (done) => { const $target = getTarget(); Velocity($target, {left: "500px"}, {duration: 10}); await sleep(100); assert.equal(getPropertyValue($target, "left"), "500px", "Finished animated value with given pixels should be the same."); Velocity($target, {left: "0px"}, {duration: 10}); await sleep(100); assert.equal(getPropertyValue($target, "left"), "0px", "Finished animated value with 0px should be the same."); done(); }); // async(assert, 1, async (done) => { // const $target = getTarget(); // // Velocity($target, {left: "500px"}, {duration: 10}); // await sleep(100); // Velocity($target, {left: "0"}, {duration: 10}); // await sleep(100); // assert.equal(getPropertyValue($target, "left"), "0px", "Finished animated value without giving px, but only number as a string should be the same."); // // done(); // }); asyncTests(assert, 1, async (done) => { const $target = getTarget(); Velocity($target, {left: "500px"}, {duration: 10}); await sleep(100); Velocity($target, {left: 0}, {duration: 10}); await sleep(1000); assert.equal(getPropertyValue($target, "left"), "0px", "Finished animated value given as number 0 should be the same as 0px."); done(); }); asyncTests(assert, 2, async (done) => { const $target = getTarget(); Velocity($target, {left: 500}, {duration: 10}); await sleep(100); assert.equal(getPropertyValue($target, "left"), "500px", "Finished animated value with given pixels should be the same."); Velocity($target, {left: 0}, {duration: 10}); await sleep(100); assert.equal(getPropertyValue($target, "left"), "0px", "Omitted pixels (px) when given animation should run properly."); done(); }); }); ================================================ FILE: test/src/1_Core/_module.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; QUnit.module("Core"); ================================================ FILE: test/src/2_Option/Option Begin.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncCheckDuration, asyncTests, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("Begin", (assert) => { asyncTests(assert, 1, (done) => { const $targetSet = [getTarget(), getTarget()]; Velocity($targetSet, defaultProperties, { duration: asyncCheckDuration, begin(elements) { assert.deepEqual(elements, $targetSet, "Elements passed into callback."); done(); }, }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Complete.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncCheckDuration, asyncTests, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("Complete", (assert) => { asyncTests(assert, 1, (done) => { const $targetSet = [getTarget(), getTarget()]; Velocity($targetSet, defaultProperties, { duration: asyncCheckDuration, complete(elements) { assert.deepEqual(elements, $targetSet, "Elements passed into callback."); done(); }, }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Delay.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, defaultOptions, defaultProperties, getNow, getTarget} from "../utilities"; import "./_module"; QUnit.test("Delay", (assert) => { const testDelay = 250; asyncTests(assert, 1, (done) => { const start = getNow(); Velocity(getTarget(), defaultProperties, { duration: defaultOptions.duration, delay: testDelay, begin(elements, activeCall) { assert.close(getNow() - start, testDelay, 32, "Delayed calls start after the correct delay."); done(); }, }); }); asyncTests(assert, 1, (done) => { const start = getNow(); Velocity(getTarget(), defaultProperties, { duration: defaultOptions.duration, delay: testDelay, }) .velocity(defaultProperties, { duration: defaultOptions.duration, delay: testDelay, begin(elements, activeCall) { assert.close(getNow() - start, (testDelay * 2) + (defaultOptions.duration as number), 32, "Chained delays start after the correct delay."); done(); }, }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Duration.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, defaultOptions, defaultProperties, getNow, getTarget} from "../utilities"; import "./_module"; QUnit.test("Duration", (assert) => { const testDuration = Velocity.defaults.duration as number; asyncTests(assert, 1, (done) => { const start = getNow(); Velocity(getTarget(), defaultProperties, { duration: testDuration, complete(elements, activeCall) { const time = getNow() - start; assert.close(time, testDuration, 32, `Calls run for the correct duration (~${Math.floor(time)}ms / ${testDuration}ms).`); done(); }, }); }); asyncTests(assert, 1, (done) => { const start = getNow(); Velocity(getTarget(), {width: ["200px", "500px"]}, { duration: testDuration, }) .velocity({width: ["500px", "200px"]}, { duration: testDuration, complete(elements, activeCall) { const time = getNow() - start; assert.close(getNow() - start, testDuration * 2, 32, `Chained durations run for the correct duration (~${Math.floor(time)}ms / ${testDuration * 2}ms).`); done(); }, }); }); asyncTests(assert, 1, (done) => { const start = getNow(); Velocity(getTarget(), {width: ["200px", "500px"]}) .velocity({width: ["500px", "200px"]}) .then(() => { const time = getNow() - start; assert.close(getNow() - start, testDuration * 2, 32, `Chained durations with defaults run for the correct duration (~${Math.floor(time)}ms / ${testDuration * 2}ms).`); done(); }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Easing.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity, {VelocityResult} from "velocity-animate"; import {asyncCheckDuration, asyncTests, defaultProperties, getTarget, once} from "../utilities"; import "./_module"; QUnit.test("Easing", (assert) => { asyncTests(assert, 1, (done) => { let success = false; try { success = true; Velocity(getTarget(), defaultProperties, {easing: "fake"}); } catch (e) { success = false; } assert.ok(success, "Fake easing string didn't throw error."); done(); }); asyncTests(assert, 1, (done) => { let success = false; try { success = true; Velocity(getTarget(), defaultProperties, {easing: ["a" as any, 0.5, 0.5, 0.5]}); Velocity(getTarget(), defaultProperties, {easing: [0.5, 0.5, 0.5]}); } catch (e) { success = false; } assert.ok(success, "Invalid bezier curve didn't throw error."); done(); }); asyncTests(assert, 1, (done) => { // TODO: Use a "tween" action? /* Ensure that a properly-formatted bezier curve array returns a bezier function. */ const easingBezierArray = [0.27, -0.65, 0.78, 0.19], easingBezierTestPercent = 0.25, easingBezierTestValue = -0.23; Velocity(getTarget(), defaultProperties, { easing: easingBezierArray, begin(elements, animation) { assert.close(animation.options.easing(easingBezierTestPercent, 0, 1), easingBezierTestValue, 0.005, "Array converted into bezier function."); done(); }, }); }); asyncTests(assert, 1, (done) => { /* Ensure that a properly-formatted spring RK4 array returns a bezier function. */ const easingSpringRK4Array = [250, 12], easingSpringRK4TestPercent = 0.25, easingSpringRK4TestValue = 0.928, // TODO: Check accuracy easingSpringRK4TestDuration = 992; Velocity(getTarget(), defaultProperties, { duration: 150, easing: easingSpringRK4Array, begin(elements, animation) { assert.close(animation.options.easing(easingSpringRK4TestPercent, 0, 1), easingSpringRK4TestValue, 10, "Array with duration converted into springRK4 function."); done(); }, }); }); // TODO: Get this working in Velocity - so it can be tested // async(assert, 1, (done) => { // Velocity(getTarget(), defaultProperties, { // easing: easingSpringRK4Array, // begin(elements, animation) { // assert.equal(animation.duration, easingSpringRK4TestDuration, "Array without duration converted into springRK4 duration."); // done(); // } // }); // }); asyncTests(assert, 1, (done) => { /* Ensure that a properly-formatted step easing array returns a step function. */ const easingStepArray = [4], easingStepTestPercent = 0.35, easingStepTestValue = 0.25; Velocity(getTarget(), defaultProperties, { easing: easingStepArray, begin(elements, animation) { assert.close(animation.options.easing(easingStepTestPercent, 0, 1), easingStepTestValue, 0.05, "Array converted into Step function."); done(); }, }); }); asyncTests(assert, 3, (done) => { Velocity(getTarget(), {opacity: [0, "during", 1]}, { duration: asyncCheckDuration, begin(elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct begin value (easing:'during')."); }, progress: once((elements: VelocityResult) => { assert.equal(elements.velocity("style", "opacity"), 0, "Correct progress value (easing:'during')."); }), complete(elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct complete value (easing:'during')."); done(); }, }); }); asyncTests(assert, 3, (done) => { Velocity(getTarget(), {opacity: [0, "at-start", 1]}, { duration: asyncCheckDuration, begin(elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct begin value (easing:'at-start')."); }, progress: once((elements: VelocityResult) => { assert.equal(elements.velocity("style", "opacity"), 0, "Correct progress value (easing:'at-start')."); }), complete(elements) { assert.equal(elements.velocity("style", "opacity"), 0, "Correct complete value (easing:'at-start')."); done(); }, }); }); asyncTests(assert, 3, (done) => { Velocity(getTarget(), {opacity: [0, "at-end", 1]}, { duration: asyncCheckDuration, begin(elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct begin value (easing:'at-end')."); }, progress: once((elements: VelocityResult) => { assert.equal(elements.velocity("style", "opacity"), 1, "Correct progress value (easing:'at-end')."); }), complete(elements) { assert.equal(elements.velocity("style", "opacity"), 0, "Correct complete value (easing:'at-end')."); done(); }, }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Fps Limit.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("FPS Limit", async (assert) => { let count: number; const $target = getTarget(), frameRates = [5, 15, 30, 60], testFrame = (frameRate) => { let counter = 0; Velocity.defaults.fpsLimit = frameRate; // Test if the frame rate is assigned succesfully. assert.equal(frameRate, Velocity.defaults.fpsLimit, "Setting global fps limit to " + frameRate); return Velocity($target, defaultProperties, { duration: 1000, progress() { counter++; }, }) .then(() => counter); }; assert.expect(frameRates.length * 2); // Test if the limit is working for 60, 30, 15 and 5 fps. for (const frameRate of frameRates) { assert.ok((count = await testFrame(frameRate)) <= frameRate + 1, `...counted ${count} frames (\xB11 frame)`); } }); ================================================ FILE: test/src/2_Option/Option Loop.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, defaultProperties, getNow, getTarget} from "../utilities"; import "./_module"; QUnit.test("Loop", (assert) => { asyncTests(assert, 4, (done) => { const testOptions = {loop: 2, delay: 100, duration: 100}, start = getNow(); let begin = 0, complete = 0, loop = 0, lastPercentComplete = 2; Velocity(getTarget(), defaultProperties, { loop: testOptions.loop, delay: testOptions.delay, duration: testOptions.duration, begin() { begin++; }, progress(elements, percentComplete) { if (lastPercentComplete > percentComplete) { loop++; } lastPercentComplete = percentComplete; }, complete() { complete++; }, }) .then(() => { assert.equal(begin, 1, "Begin callback only called once."); assert.equal(loop, testOptions.loop * 2 - 1, "Animation looped correct number of times (once each direction per loop)."); assert.close(getNow() - start, (testOptions.delay + testOptions.duration) * loop, 32, "Looping with 'delay' has correct duration."); assert.equal(complete, 1, "Complete callback only called once."); done(); }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Progress.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncCheckDuration, asyncTests, defaultProperties, getTarget, once} from "../utilities"; import "./_module"; QUnit.test("Progress", (assert) => { asyncTests(assert, 4, (done) => { const $target = getTarget(); Velocity($target, defaultProperties, { duration: asyncCheckDuration, progress: once(function(elements, percentComplete, msRemaining) { // tslint:disable-line:only-arrow-functions assert.deepEqual(elements, [$target], "Elements passed into progress."); assert.deepEqual(this, [$target], "Elements passed into progress as this."); // tslint:disable-line:no-invalid-this assert.equal(percentComplete >= 0 && percentComplete <= 1, true, "'percentComplete' passed into progress."); assert.equal(msRemaining > asyncCheckDuration - 50, true, "'msRemaining' passed into progress."); done(); }), }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Queue.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {Data, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("Queue", (assert) => { const done = assert.async(4), testQueue = "custom", $target = getTarget(), ignore = $target.velocity("style", "display"), // Force data creation data = Data($target); let anim1: boolean, anim2: boolean, anim3: boolean; assert.expect(7); assert.ok(data.queueList[testQueue] === undefined, "Custom queue is empty."); // Shouldn't exist $target.velocity(defaultProperties, { queue: testQueue, begin() { anim1 = true; }, complete() { anim1 = false; assert.ok(!anim2, "Queued animation isn't started early."); done(); }, }); assert.ok(data.queueList[testQueue] !== undefined, "Custom queue was created."); // Should exist, but be "null" $target.velocity(defaultProperties, { queue: testQueue, begin() { anim2 = true; assert.ok(anim1 === false, "Queued animation starts after first."); done(); }, complete() { anim2 = false; }, }); assert.ok(data.queueList[testQueue], "Custom queue grows."); // Should exist and point at the next animation $target.velocity(defaultProperties, { begin() { anim3 = true; assert.ok(anim1 === true, "Different queue animation starts in parallel."); done(); }, complete() { anim3 = false; }, }); $target.velocity(defaultProperties, { queue: false, begin() { assert.ok(anim1 === true, "Queue:false animation starts in parallel."); done(); }, }); }); ================================================ FILE: test/src/2_Option/Option Repeat.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("Repeat", (assert) => { asyncTests(assert, 4, (done) => { const testOptions = {repeat: 2, delay: 100, duration: 100}, start = Date.now(); let begin = 0, complete = 0, repeat = 0; Velocity(getTarget(), defaultProperties, { repeat: testOptions.repeat, delay: testOptions.delay, duration: testOptions.duration, begin() { begin++; }, progress(elements, percentComplete) { if (percentComplete === 1) { repeat++; } }, complete() { complete++; assert.equal(begin, 1, "Begin callback only called once."); assert.equal(repeat, testOptions.repeat + 1, "Animation repeated correct number of times (original plus repeats)."); assert.close(Date.now() - start, (testOptions.delay + testOptions.duration) * (testOptions.repeat + 1), (testOptions.repeat + 1) * 16 + 32, "Repeat with 'delay' has correct duration."); assert.equal(complete, 1, "Complete callback only called once."); done(); }, }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Speed.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity, {VelocityResult} from "velocity-animate"; import {asyncTests, defaultProperties, getNow, getTarget} from "../utilities"; import "./_module"; interface ExtendedVelocityExtended extends VelocityResult { __count?: number; __start?: number; } QUnit.test("Speed", (assert) => { const delay = 200, duration = 400, startDelay = getNow(); asyncTests(assert, 1, (done) => { Velocity.defaults.speed = 3; Velocity(getTarget(), defaultProperties, { speed: 5, begin(elements) { assert.equal(elements.velocity.animations[0].options.speed, 5, "Speed on options overrides default."); done(); }, }); }); asyncTests(assert, 1, (done) => { Velocity(getTarget(), defaultProperties, { duration, begin(elements: ExtendedVelocityExtended) { elements.__start = getNow(); }, complete(elements: ExtendedVelocityExtended) { const actual = getNow() - elements.__start, expected = duration / 3; assert.close(actual, expected, 32, `Velocity.defaults.speed change is respected. (\xD73, ${Math.floor(actual - expected)}ms \xB132ms)`); done(); }, }); }); asyncTests(assert, 1, (done) => { Velocity(getTarget(), defaultProperties, { duration, speed: 2, begin(elements: ExtendedVelocityExtended) { elements.__start = getNow(); }, complete(elements: ExtendedVelocityExtended) { const actual = getNow() - elements.__start, expected = duration / 2; assert.close(actual, expected, 32, `Double speed animation lasts half as long. (\xD72, ${Math.floor(actual - expected)}ms \xB132ms)`); done(); }, }); }); asyncTests(assert, 1, (done) => { Velocity(getTarget(), defaultProperties, { duration, delay, speed: 2, begin(elements: ExtendedVelocityExtended) { elements.__start = startDelay; }, complete(elements: ExtendedVelocityExtended) { const actual = getNow() - elements.__start, expected = (duration + delay) / 2; assert.close(actual, expected, 32, `Delayed animation includes speed for delay. (\xD72, ${Math.floor(actual - expected)}ms \xB132ms)`); done(); }, }); }); asyncTests(assert, 1, (done) => { Velocity(getTarget(), defaultProperties, { duration, delay: -delay, speed: 2, begin(elements: ExtendedVelocityExtended) { elements.__start = startDelay; }, complete(elements: ExtendedVelocityExtended) { const actual = getNow() - elements.__start, expected = (duration - delay) / 2; assert.close(actual, expected, 32, `Negative delay animation includes speed for delay. (\xD72, ${Math.floor(actual - expected)}ms \xB132ms)`); done(); }, }); }); asyncTests(assert, 1, (done) => { Velocity(getTarget(), defaultProperties, { duration, speed: 0.5, begin(elements: ExtendedVelocityExtended) { elements.__start = getNow(); }, complete(elements: ExtendedVelocityExtended) { const actual = getNow() - elements.__start, expected = duration * 2; // TODO: Really not happy with the allowed range - it sits around 40ms, but should be closer to 16ms assert.close(actual, expected, 64, `Half speed animation lasts twice as long. (\xD7\xBD, ${Math.floor(actual - expected)}ms \xB164ms)`); done(); }, }); }); asyncTests(assert, 1, (done) => { Velocity(getTarget(), defaultProperties, { duration, speed: 0, progress(elements: ExtendedVelocityExtended, percentComplete) { if (!elements.__count) { elements.__start = percentComplete; elements.__count = 1; } else { assert.equal(elements.__start, percentComplete, "Frozen (speed:0) animation doesn't progress."); elements .velocity("option", "speed", 1) // Just in case "stop" is broken .velocity("stop"); done(); } }, }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/Option Sync.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, defaultProperties, getTarget, sleep} from "../utilities"; import "./_module"; QUnit.test("Sync", (assert) => { asyncTests(assert, 1, async (done) => { const $target = getTarget(), $targetSet = [getTarget(), $target, getTarget()]; let complete = false; Velocity($target, defaultProperties, { duration: 300, complete() { complete = true; }, }); Velocity($targetSet, defaultProperties, { sync: false, duration: 250, }); await sleep(275); assert.notOk(complete, "Sync 'false' animations don't wait for completion."); done(); }); asyncTests(assert, 1, async (done) => { const $target = getTarget(), $targetSet = [getTarget(), $target, getTarget()]; let complete = false; Velocity($target, defaultProperties, { duration: 300, complete() { complete = true; }, }); Velocity($targetSet, defaultProperties, { sync: true, duration: 250, begin() { assert.ok(complete, "Sync 'true' animations wait for completion."); done(); }, }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/2_Option/_module.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; QUnit.module("Option"); ================================================ FILE: test/src/3_Command/Command Finish.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, defaultOptions, defaultProperties, getPropertyValue, getTarget, sleep} from "../utilities"; import "./_module"; QUnit.test("Finish", async (assert) => { asyncTests(assert, 1, (done) => { Velocity(getTarget(), "finish"); assert.ok(true, "Calling on an element that isn't animating doesn't cause an error."); done(); }); asyncTests(assert, 1, (done) => { const $target = getTarget(); Velocity($target, defaultProperties, defaultOptions); Velocity($target, {top: 0}, defaultOptions); Velocity($target, {width: 0}, defaultOptions); Velocity($target, "finish"); assert.ok(true, "Calling on an element that is animating doesn't cause an error."); done(); }); asyncTests(assert, 2, async (done) => { const $target = getTarget(); let complete1 = false, complete2 = false; Velocity($target, {opacity: [0, 1]}, { queue: "test1", complete() { complete1 = true; }, }); Velocity($target, {opacity: [0, 1]}, { queue: "test2", complete() { complete2 = true; }, }); Velocity($target, "finish", "test1"); await sleep(defaultOptions.duration as number / 2); assert.ok(complete1, "Finish animation with correct queue."); assert.notOk(complete2, "Don't finish animation with wrong queue."); done(); }); asyncTests(assert, 3, async (done) => { const $target = getTarget(); let begin = false, complete = false; Velocity($target, {opacity: [0, 1]}, { begin() { begin = true; }, complete() { complete = true; }, }); await sleep(500); Velocity($target, "finish"); assert.ok(begin, "Finish calls 'begin()' callback without delay."); assert.ok(complete, "Finish calls 'complete()' callback without delay."); assert.equal(getPropertyValue($target, "opacity"), "0", "Finish animation with correct value."); done(); }); asyncTests(assert, 3, async (done) => { const $target = getTarget(); let begin = false, complete = false; Velocity($target, {opacity: [0, 1]}, { delay: 1000, begin() { begin = true; }, complete() { complete = true; }, }); await sleep(500); Velocity($target, "finish"); assert.ok(begin, "Finish calls 'begin()' callback with delay."); assert.ok(complete, "Finish calls 'complete()' callback with delay."); assert.equal(getPropertyValue($target, "opacity"), "0", "Finish animation with correct value before delay ends."); done(); }); asyncTests(assert, 3, async (done) => { const $target = getTarget(); Velocity($target, {opacity: 0}) .velocity({opacity: 1}) .velocity({opacity: 0.25}) .velocity({opacity: 0.75}) .velocity({opacity: 0.5}); Velocity($target, "finish"); assert.equal(getPropertyValue($target, "opacity"), "0", "Finish once starts the second animation."); Velocity($target, "finish"); assert.equal(getPropertyValue($target, "opacity"), "1", "Finish twice starts the third animation."); Velocity($target, "finish", true); assert.equal(getPropertyValue($target, "opacity"), "0.5", "Finish 'true' finishes all animations."); done(); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/3_Command/Command Pause + Resume.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, getPropertyValue, getTarget, sleep} from "../utilities"; import "./_module"; QUnit.test("Pause + Resume", async (assert) => { asyncTests(assert, 2, (done) => { const $target = getTarget(); Velocity($target, "pause"); assert.ok(true, "Calling \"pause\" on an element that isn't animating doesn't cause an error."); Velocity($target, "resume"); assert.ok(true, "Calling \"resume\" on an element that isn't animating doesn't cause an error."); done(); }); asyncTests(assert, 4, async (done) => { const $target = getTarget(); let progress = false; Velocity($target, {opacity: 0}, { duration: 250, progress() { progress = true; }, }); Velocity($target, "pause"); await sleep(50); assert.equal(getPropertyValue($target, "opacity"), "1", "Property value unchanged after pause."); assert.notOk(progress, "Progress callback not run during pause."); Velocity($target, "resume"); await sleep(300); assert.equal(getPropertyValue($target, "opacity"), "0", "Tween completed after pause/resume."); assert.ok(progress, "Progress callback run after pause."); done(); }); asyncTests(assert, 3, async (done) => { const $target = getTarget(); Velocity($target, {opacity: 0}, {duration: 250, delay: 250}); Velocity($target, "pause"); await sleep(500); assert.equal(getPropertyValue($target, "opacity"), "1", "Delayed property value unchanged after pause."); Velocity($target, "resume"); await sleep(100); assert.equal(getPropertyValue($target, "opacity"), "1", "Delayed tween did not start early after pause."); await sleep(500); assert.equal(getPropertyValue($target, "opacity"), "0", "Delayed tween completed after pause/resume."); done(); }); asyncTests(assert, 1, async (done) => { const $target = getTarget(); Velocity($target, {opacity: 0}, {queue: "test", duration: 250}); Velocity("pause", "test"); await sleep(300); assert.equal(getPropertyValue($target, "opacity"), "1", "Pause 'queue' works globally."); done(); }); asyncTests(assert, 1, async (done) => { const $target = getTarget(); Velocity($target, {opacity: 0}) .velocity("pause"); await sleep(300); assert.equal(getPropertyValue($target, "opacity"), "1", "Chained pause only pauses chained tweens."); done(); }); // TODO: Better global tests, queue: false, named queues // /* Ensure proper behavior with queue:false */ // var $target4 = getTarget(); // Velocity($target4, {opacity: 0}, {duration: 200}); // // var isResumed = false; // // await sleep(100); // Velocity($target4, "pause"); // Velocity($target4, {left: -20}, { // duration: 100, // easing: "linear", // queue: false, // begin: function(elements) { // assert.ok(true, "Animation with {queue:false} will run regardless of previously paused animations."); // } // }); // // Velocity($target4, {top: 20}, { // duration: 100, // easing: "linear", // begin: function(elements) { // assert.ok(isResumed, "Queued animation began after previously paused animation completed"); // } // }); // // await sleep(100); // // isResumed = true; // Velocity($target4, "resume"); // await sleep(100); assert.expect(asyncTests()); }); ================================================ FILE: test/src/3_Command/Command Reverse.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("Reverse", (assert) => { const $target = getTarget(), opacity = $target.velocity("style", "opacity"), // Browsers don't always suffix, but Velocity does. width = $target.velocity("style", "width") === "0" ? "0px" : $target.velocity("style", "width"); asyncTests(assert, 2, (done) => { Velocity($target, defaultProperties, { complete(elements) { assert.equal(elements[0].velocity("style", "opacity"), defaultProperties.opacity, `Initial property #1 set correctly. (${defaultProperties.opacity})`); assert.equal(elements[0].velocity("style", "width"), defaultProperties.width, `Initial property #2 set correctly. (${defaultProperties.width})`); done(); }, }); }); asyncTests(assert, 2, (done) => { Velocity($target, "reverse", { complete(elements) { assert.equal(elements[0].velocity("style", "opacity"), opacity, `Reversed property #1 set correctly. (${opacity})`); assert.equal(elements[0].velocity("style", "width"), width, `Reversed property #2 set correctly. (${width})`); done(); }, }); }); asyncTests(assert, 2, (done) => { Velocity($target, "reverse", { complete(elements) { assert.equal(elements[0].velocity("style", "opacity"), defaultProperties.opacity, `Chained reversed property #1 set correctly. (${defaultProperties.opacity})`); assert.equal(elements[0].velocity("style", "width"), defaultProperties.width, `Chained reversed property #2 set correctly. (${defaultProperties.width})`); done(); }, }); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/3_Command/Command Scroll.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncCheckDuration, asyncTests, defaultProperties, getTarget} from "../utilities"; import "./_module"; /* Window scrolling. */ QUnit.skip("Scroll (Window)", (assert) => { // var done = assert.async(4), // $details = $("#details"), // $scrollTarget1 = $("
      Scroll target #1. Should stop 50 pixels above this point.
      "), // $scrollTarget2 = $("
      Scroll target #2. Should stop 50 pixels before this point.
      "), // scrollOffset = -50; // // $scrollTarget1 // .css({position: "relative", top: 3000, height: 100, paddingBottom: 10000}) // .appendTo($("body")); // // $scrollTarget2 // .css({position: "absolute", top: 100, left: 3000, width: 100, paddingRight: 15000}) // .appendTo($("body")); // // $scrollTarget1 // .velocity("scroll", { // duration: 500, offset: scrollOffset, complete: function() { // assert.equal(Math.abs(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyTop] // - ($scrollTarget1.offset().top + scrollOffset)) <= 100, true, "Page scrolled top with a scroll offset."); // // done(); // } // }) // .velocity({opacity: 0.5}, function() { // $details // .velocity({opacity: 0.5}, 500) // .velocity("scroll", 500) // .velocity({opacity: 1}, 500, function() { // //alert(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyTop] + " " + ($details.offset().top + scrollOffset)) // assert.equal(Math.abs(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyTop] // - ($details.offset().top + scrollOffset)) <= 100, true, "Page scroll top was chained."); // // done(); // // //$scrollTarget1.remove(); // // $scrollTarget2 // .velocity("scroll", { // duration: 500, axis: "x", offset: scrollOffset, complete: function() { // /* Phones can reposition the browser's scroll position by a 10 pixels or so, so we just check for a value that's within that range. */ // assert.equal(Math.abs(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyLeft] // - ($scrollTarget2.offset().left + scrollOffset)) <= 100, true, "Page scrolled left with a scroll offset."); // // done(); // } // }) // .velocity({opacity: 0.5}, function() { // $details // .velocity({opacity: 0.5}, 500) // .velocity("scroll", {duration: 500, axis: "x"}) // .velocity({opacity: 1}, 500, function() { // assert.equal(Math.abs(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyLeft] // - ($details.offset().left + scrollOffset)) <= 100, true, "Page scroll left was chained."); // // done(); // }); // }); // }); // }); }); /* Element scrolling. */ QUnit.skip("Scroll (Element)", (assert) => { // var done = assert.async(2), // $scrollTarget1 = $("\ //
      \ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ //
      \ // Stop #1\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ //
      \ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ //
      \ // Stop #2\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ //
      \ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ //
      \ // "); // // assert.expect(2); // $scrollTarget1 // .css({position: "absolute", backgroundColor: "white", top: 100, left: "50%", width: 500, height: 100, overflowY: "scroll"}) // .appendTo($("body")); // // /* Test with a jQuery object container. */ // $("#scrollerChild1").velocity("scroll", { // container: $("#scroller"), duration: 750, complete: function() { // /* Test with a raw DOM element container. */ // $("#scrollerChild2").velocity("scroll", { // container: $("#scroller")[0], duration: 750, complete: function() { // /* This test is purely visual. */ // assert.ok(true); // // $scrollTarget1.remove(); // // var $scrollTarget2 = $("\ //
      \ //
      \ // Stop #1\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ //
      \ //
      \ // Stop #2\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ //
      \ //
      \ // "); // // $scrollTarget2 // .css({position: "absolute", backgroundColor: "white", top: 100, left: "50%", width: 100, height: 500, overflowX: "scroll"}) // .appendTo($("body")); // // /* Test with a jQuery object container. */ // $("#scrollerChild2").velocity("scroll", { // axis: "x", container: $("#scroller"), duration: 750, complete: function() { // /* Test with a raw DOM element container. */ // $("#scrollerChild1").velocity("scroll", { // axis: "x", container: $("#scroller")[0], duration: 750, complete: function() { // /* This test is purely visual. */ // assert.ok(true); // // $scrollTarget2.remove(); // // done(); // } // }); // } // }); // // done(); // } // }); // } // }); }); ================================================ FILE: test/src/3_Command/Command Stop.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncTests, defaultOptions, defaultProperties, getPropertyValue, getTarget, sleep} from "../utilities"; import "./_module"; QUnit.test("Stop", async (assert) => { asyncTests(assert, 1, (done) => { Velocity(getTarget(), "stop"); assert.ok(true, "Calling on an element that isn't animating doesn't cause an error."); done(); }); asyncTests(assert, 1, (done) => { const $target = getTarget(); Velocity($target, defaultProperties, defaultOptions); Velocity($target, {top: 0}, defaultOptions); Velocity($target, {width: 0}, defaultOptions); Velocity($target, "stop"); assert.ok(true, "Calling on an element that is animating doesn't cause an error."); done(); }); asyncTests(assert, 1, async (done) => { const $target = getTarget(), startOpacity = getPropertyValue($target, "opacity"); Velocity($target, {opacity: [0, 1]}, defaultOptions); await sleep(defaultOptions.duration as number / 2); Velocity($target, "stop"); assert.close(parseFloat(getPropertyValue($target, "opacity")), parseFloat(startOpacity) / 2, 0.1, "Animation runs until stopped."); done(); }); asyncTests(assert, 1, async (done) => { const $target = getTarget(); let begin = false; Velocity($target, {opacity: [0, 1]}, { delay: 1000, begin() { begin = true; }, }); await sleep(500); Velocity($target, "stop"); assert.notOk(begin, "Stop animation before delay ends."); done(); }); asyncTests(assert, 2, async (done) => { const $target = getTarget(); let complete1 = false, complete2 = false; Velocity($target, {opacity: [0, 1]}, { queue: "test1", complete() { complete1 = true; }, }); Velocity($target, {opacity: [0, 1]}, { queue: "test2", complete() { complete2 = true; }, }); Velocity($target, "stop", "test1"); await sleep(defaultOptions.duration as number * 2); assert.ok(complete2, "Stop animation with correct queue."); assert.notOk(complete1, "Don't stop animation with wrong queue."); done(); }); asyncTests(assert, 1, async (done) => { const $target = getTarget(); let begin1 = false, begin2 = false; Velocity($target, {opacity: [0, 1]}, { begin() { begin1 = true; }, }); Velocity($target, {width: "500px"}, { begin() { begin2 = true; }, }); Velocity($target, "stop", true); await sleep(defaultOptions.duration as number * 2); assert.notOk(begin1 || begin2, "Stop 'true' stops all animations."); done(); }); asyncTests(assert, 2, async (done) => { const $target = getTarget(), anim = Velocity($target, {opacity: [0, 1]}, { queue: "test", begin() { begin1 = true; }, }); let begin1 = false, begin2 = false; Velocity($target, {opacity: [0, 1]}, { begin() { begin2 = true; }, }); anim.velocity("stop"); await sleep(defaultOptions.duration as number * 2); assert.notOk(begin1, "Stop without arguments on a chain stops chain animations."); assert.ok(begin2, "Stop without arguments on a chain doesn't stop other animations."); done(); }); assert.expect(asyncTests()); }); ================================================ FILE: test/src/3_Command/Command Tween.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {getTarget} from "../utilities"; import "./_module"; QUnit.test("Tween", (assert) => { const $target1 = getTarget(), startOpacity = $target1.style.opacity; assert.expect(11); assert.raises(() => (Velocity as any)("tween", "invalid"), "Invalid percentComplete throws an error."); assert.raises(() => (Velocity as any)([$target1, $target1], "tween", "invalid"), "Passing more than one target throws an error."); assert.raises(() => (Velocity as any)("tween", 0, ["invalid"]), "Invalid propertyMap throws an error."); assert.raises(() => (Velocity as any)("tween", 0, "invalid", 1), "Property without an element must be forcefed or throw an error."); assert.equal($target1.velocity("tween", 0.5, "opacity", [1, 0], "linear"), "0.5", "Calling on an chain returns the correct value."); assert.equal(Velocity($target1, "tween", 0.5, "opacity", [1, 0], "linear"), "0.5", "Calling with an element returns the correct value."); assert.equal(Velocity("tween", 0.5, "opacity", [1, 0], "linear"), "0.5", "Calling without an element returns the correct value."); assert.equal($target1.style.opacity, startOpacity, "Ensure that the element is not altered."); assert.equal(typeof Velocity($target1, "tween", 0.5, "opacity", [1, 0], "linear"), "string", "Calling a single property returns a value."); assert.equal(typeof Velocity($target1, "tween", 0.5, {opacity: [1, 0]}, "linear"), "object", "Calling a propertiesMap returns an object."); assert.deepEqual($target1.velocity("tween", 0.5, {opacity: [1, 0]}, "linear"), Velocity($target1, "tween", 0.5, {opacity: [1, 0]}, "linear"), "Calling directly returns the same as a chain."); }); ================================================ FILE: test/src/3_Command/_module.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; QUnit.module("Command"); ================================================ FILE: test/src/4_Feature/Feature Classname.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.test("'velocity-animating' Classname", (assert) => { const done = assert.async(1); Velocity(getTarget(), defaultProperties, { begin(elements) { assert.equal(/velocity-animating/.test(elements[0].className), true, "Class added."); }, complete(elements) { assert.equal(/velocity-animating/.test(elements[0].className), false, "Class removed."); }, }) .then(done); }); ================================================ FILE: test/src/4_Feature/Feature Colors.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {getTarget} from "../utilities"; import "./_module"; QUnit.skip("Colors (Shorthands)", (assert) => { const $target = getTarget(); Velocity($target, {borderColor: "#7871c2", color: ["#297dad", "spring", "#5ead29"]}); // assert.equal(Data($target).style.borderColorRed.endValue, 120, "Hex #1a component."); // assert.equal(Data($target).style.borderColorGreen.endValue, 113, "Hex #1b component."); // assert.equal(Data($target).style.borderColorBlue.endValue, 194, "Hex #1c component."); // assert.equal(Data($target).style.colorRed.easing, "spring", "Per-property easing."); // assert.equal(Data($target).style.colorRed.startValue, 94, "Forcefed hex #2a component."); // assert.equal(Data($target).style.colorGreen.startValue, 173, "Forcefed hex #2b component."); // assert.equal(Data($target).style.colorBlue.startValue, 41, "Forcefed hex #2c component."); // assert.equal(Data($target).style.colorRed.endValue, 41, "Hex #3a component."); // assert.equal(Data($target).style.colorGreen.endValue, 125, "Hex #3b component."); // assert.equal(Data($target).style.colorBlue.endValue, 173, "Hex #3c component."); }); ================================================ FILE: test/src/4_Feature/Feature Forcefeeding.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {Data, defaultProperties, defaultStyles, getTarget} from "../utilities"; import "./_module"; QUnit.todo("Forcefeeding", (assert) => { /* Note: Start values are always converted into pixels. W test the conversion ratio we already know to avoid additional work. */ const testStartWidth = "1rem", testStartWidthToPx = "16px", testStartHeight = "10px", $target = getTarget(); Velocity($target, { width: [100, "linear", testStartWidth], height: [100, testStartHeight], opacity: [defaultProperties.opacity as any, "easeInQuad"], }); assert.equal(Data($target).cache.width, parseFloat(testStartWidthToPx), "Forcefed value #1 passed to tween."); assert.equal(Data($target).cache.height, parseFloat(testStartHeight), "Forcefed value #2 passed to tween."); assert.equal(Data($target).cache.opacity, defaultStyles.opacity, "Easing was misinterpreted as forcefed value."); }); ================================================ FILE: test/src/4_Feature/Feature Promises.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity, {VelocityResult} from "velocity-animate"; import {defaultOptions, defaultProperties, getNow, getTarget} from "../utilities"; import "./_module"; QUnit.test("Promises", (assert) => { const done = assert.async(10), start = getNow(); let result: VelocityResult; assert.expect(10); /********************** Invalid Arguments **********************/ ((Velocity as any)() as Promise) .then(() => { assert.notOk(true, "Calling with no arguments should reject a Promise."); }, () => { assert.ok(true, "Calling with no arguments should reject a Promise."); }) .then(done); Velocity(getTarget() as any) .then(() => { assert.notOk(true, "Calling with no properties should reject a Promise."); }, () => { assert.ok(true, "Calling with no properties should reject a Promise."); }) .then(done); Velocity(getTarget(), {}) .then(() => { assert.ok(true, "Calling with empty properties should not reject a Promise."); }, () => { assert.notOk(true, "Calling with empty properties should not reject a Promise."); }) .then(done); Velocity(getTarget(), {}, defaultOptions.duration) .then(() => { assert.ok(true, "Calling with empty properties + duration should not reject a Promise."); }, () => { assert.notOk(true, "Calling with empty properties + duration should not reject a Promise."); }) .then(done); /* Invalid arguments: Ensure an error isn't thrown. */ Velocity(getTarget(), {} as any, "fakeArg1", "fakeArg2") .then(() => { assert.ok(true, "Calling with invalid arguments should reject a Promise."); }, () => { assert.notOk(true, "Calling with invalid arguments should reject a Promise."); }) .then(done); result = Velocity(getTarget(), defaultProperties, defaultOptions); result .then((elements) => { assert.equal(elements.length, 1, "Calling with a single element fulfills with a single element array."); }, () => { assert.ok(false, "Calling with a single element fulfills with a single element array."); }) .then(done); result.velocity(defaultProperties) .then((elements) => { assert.ok(getNow() - start > 2 * (defaultOptions.duration as number), "Queued call fulfilled after correct delay."); }, () => { assert.ok(false, "Queued call fulfilled after correct delay."); }) .then(done); result = Velocity([getTarget(), getTarget()], defaultProperties, defaultOptions); result .then((elements) => { assert.equal(elements.length, 2, "Calling with multiple elements fulfills with a multiple element array."); }, () => { assert.ok(false, "Calling with multiple elements fulfills with a multiple element array."); }) .then(done); const anim = Velocity(getTarget(), defaultProperties, defaultOptions); anim .then(() => { assert.ok(getNow() - start < (defaultOptions.duration as number), "Stop call fulfilled after correct delay."); }, () => { assert.ok(false, "Stop call fulfilled after correct delay."); }) .then(done); anim.velocity("stop"); Promise .all([ Velocity(getTarget(), defaultProperties, defaultOptions).promise, Velocity(getTarget(), defaultProperties, defaultOptions).promise, ]) .then(() => { assert.ok(true, "Promise.all fulfilled when all animations have finished."); }) .then(done); }); ================================================ FILE: test/src/4_Feature/Feature Sequences.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncCheckDuration, asyncTests, defaultProperties, getTarget} from "../utilities"; import "./_module"; QUnit.todo("Sequences", (assert) => { // var done = assert.async(2), // $target1 = getTarget(), // $target2 = getTarget(), // redirectOptions = {duration: 1500}; // // ((window as any).jQuery || (window as any).Zepto || window).Velocity.Redirects.test = function(element, options, elementIndex, elementsLength) { // if (elementIndex === 0) { // assert.deepEqual(element, $target1, "Element passed through #1."); // assert.deepEqual(options, redirectOptions, "Options object passed through #1."); // assert.equal(elementIndex, 0, "Element index passed through #1."); // assert.equal(elementsLength, 2, "Elements length passed through #1."); // // done(); // } else if (elementIndex === 1) { // assert.deepEqual(element, $target2, "Element passed through #2."); // assert.deepEqual(options, redirectOptions, "Options object passed through #2."); // assert.equal(elementIndex, 1, "Element index passed through #2."); // assert.equal(elementsLength, 2, "Elements length passed through #2."); // // done(); // } // }; // // Velocity([$target1, $target2], "test", redirectOptions); }); ================================================ FILE: test/src/4_Feature/Feature Value Functions.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {Data, getTarget} from "../utilities"; import "./_module"; QUnit.todo("Value Functions", (assert) => { const testWidth = 10, $target1 = getTarget(), $target2 = getTarget(); Velocity([$target1, $target2], { width(i, total) { return (i + 1) / total * testWidth; }, }); assert.equal(Data($target1).cache.width, parseFloat(testWidth as any) / 2, "Function value #1 passed to tween."); assert.equal(Data($target2).cache.width, parseFloat(testWidth as any), "Function value #2 passed to tween."); }); ================================================ FILE: test/src/4_Feature/_module.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; QUnit.module("Feature"); ================================================ FILE: test/src/5_UIPack/Packaged Effect slideUp+Down.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {getPropertyValue, getTarget} from "../utilities"; import "./_module"; QUnit.skip("Packaged Effect: slideUp/Down", (assert) => { const done = assert.async(4), $target1 = getTarget(), $target2 = getTarget(), initialStyles = { display: "none", paddingTop: "123px", }; $target1.style.display = initialStyles.display; $target1.style.paddingTop = initialStyles.paddingTop; Velocity($target1, "slideDown", { begin(elements) { assert.deepEqual(elements, [$target1], "slideDown: Begin callback returned."); done(); }, complete(elements) { assert.deepEqual(elements, [$target1], "slideDown: Complete callback returned."); // assert.equal(getPropertyValue($target1, "display"), Values.getDisplayType($target1), "slideDown: display set to default."); assert.notEqual(getPropertyValue($target1, "height"), 0, "slideDown: height set."); assert.equal(getPropertyValue($target1, "paddingTop"), initialStyles.paddingTop, "slideDown: paddingTop set."); done(); }, // }).then(function(elements) { // assert.deepEqual(elements, [$target1], "slideDown: Promise fulfilled."); // // done(); }); Velocity($target2, "slideUp", { begin(elements) { assert.deepEqual(elements, [$target2], "slideUp: Begin callback returned."); done(); }, complete(elements) { assert.deepEqual(elements, [$target2], "slideUp: Complete callback returned."); assert.equal(getPropertyValue($target2, "display"), 0, "slideUp: display set to none."); assert.notEqual(getPropertyValue($target2, "height"), 0, "slideUp: height reset."); assert.equal(getPropertyValue($target1, "paddingTop"), initialStyles.paddingTop, "slideUp: paddingTop reset."); done(); }, // }).then(function(elements) { // assert.deepEqual(elements, [$target2], "slideUp: Promise fulfilled."); // // done(); }); }); ================================================ FILE: test/src/5_UIPack/UI Pack Call Options.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {completeCheckDuration, defaultOptions, getTarget} from "../utilities"; import "./_module"; QUnit.skip("Call Options", (assert) => { const done = assert.async(2), UICallOptions1 = { delay: 123, duration: defaultOptions.duration, easing: "spring", // Should get ignored }, $target1 = getTarget(); //assert.expect(1); Velocity($target1, "transition.slideLeftIn", UICallOptions1); setTimeout(() => { // Note: We can do this because transition.slideLeftIn is composed of a single call. // assert.equal(Data($target1).opts.delay, UICallOptions1.delay, "Whitelisted option passed in."); // assert.notEqual(Data($target1).opts.easing, UICallOptions1.easing, "Non-whitelisted option not passed in #1a."); // assert.equal(!/velocity-animating/.test(Data($target1).className), true, "Duration option passed in."); done(); }, completeCheckDuration); const UICallOptions2 = { stagger: 100, duration: defaultOptions.duration, backwards: true, }; const $targets = [getTarget(), getTarget(), getTarget()]; Velocity($targets, "transition.slideLeftIn", UICallOptions2); setTimeout(() => { // assert.equal(Data($targets[0]).opts.delay, UICallOptions2.stagger * 2, "Backwards stagger delay passed in #1a."); // assert.equal(Data($targets[1]).opts.delay, UICallOptions2.stagger * 1, "Backwards stagger delay passed in #1b."); // assert.equal(Data($targets[2]).opts.delay, UICallOptions2.stagger * 0, "Backwards stagger delay passed in #1c."); done(); }, completeCheckDuration); }); ================================================ FILE: test/src/5_UIPack/UI Pack Callbacks.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {getTarget} from "../utilities"; import "./_module"; QUnit.skip("Callbacks", (assert) => { const done = assert.async(2), $targets = [getTarget(), getTarget()]; assert.expect(3); Velocity($targets, "transition.bounceIn", { begin(elements) { assert.deepEqual(elements, $targets, "Begin callback returned."); done(); }, complete(elements) { assert.deepEqual(elements, $targets, "Complete callback returned."); done(); }, // }).then(function(elements) { // assert.deepEqual(elements, $targets, "Promise fulfilled."); // // done(); }); }); ================================================ FILE: test/src/5_UIPack/UI Pack In+Out.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {asyncCheckDuration, completeCheckDuration, defaultOptions, getPropertyValue, getTarget} from "../utilities"; import "./_module"; QUnit.skip("In/Out", (assert) => { const done = assert.async(2), $target1 = getTarget(), $target2 = getTarget(), $target3 = getTarget(), $target4 = getTarget(), $target5 = getTarget(), $target6 = getTarget(); Velocity($target1, "transition.bounceIn", defaultOptions.duration); // Velocity($target2, "transition.bounceIn", {duration: defaultOptions.duration, display: "inline"}); // // Velocity($target3, "transition.bounceOut", defaultOptions.duration); // // Velocity($target4, "transition.bounceOut", {duration: defaultOptions.duration, display: null}); // // $target5.style.visibility = "hidden"; // Velocity($target5, "transition.bounceIn", {duration: defaultOptions.duration, visibility: "visible"}); // // $target6.style.visibility = "visible"; // Velocity($target6, "transition.bounceOut", {duration: defaultOptions.duration, visibility: "hidden"}); assert.expect(8); setTimeout(() => { assert.notEqual(getPropertyValue($target3, "display"), 0, "Out: display not prematurely set to none."); assert.notEqual(getPropertyValue($target6, "visibility"), "hidden", "Out: visibility not prematurely set to hidden."); done(); }, asyncCheckDuration); setTimeout(() => { // assert.equal(getPropertyValue($target1, "display"), Values.getDisplayType($target1), "In: display set to default."); assert.equal(getPropertyValue($target2, "display"), "inline", "In: Custom inline value set."); assert.equal(getPropertyValue($target3, "display"), 0, "Out: display set to none."); // assert.equal(getPropertyValue($target4, "display"), Values.getDisplayType($target3), "Out: No display value set."); assert.equal(getPropertyValue($target5, "visibility"), "visible", "In: visibility set to visible."); assert.equal(getPropertyValue($target6, "visibility"), "hidden", "Out: visibility set to hidden."); done(); }, completeCheckDuration); }); ================================================ FILE: test/src/5_UIPack/UI Pack RegisterEffect.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {getPropertyValue, getTarget} from "../utilities"; import "./_module"; QUnit.skip("RegisterEffect", (assert) => { // const done = assert.async(1), // effectDefaultDuration = 800; // // assert.expect(2); // Velocity.RegisterEffect("callout.twirl", { // defaultDuration: effectDefaultDuration, // calls: [ // [{rotateZ: 1080}, 0.5], // [{scaleX: 0.5}, 0.25, {easing: "spring"}], // [{scaleX: 1}, 0.25, {easing: "spring"}], // ], // }); // // const $target1 = getTarget(); // Velocity($target1, "callout.twirl"); // // setTimeout(() => { // assert.equal(parseFloat(getPropertyValue($target1, "rotateZ") as string), 1080, "First call's property animated."); // assert.equal(parseFloat(getPropertyValue($target1, "scaleX") as string), 1, "Last call's property animated."); // // done(); // }, effectDefaultDuration * 1.5); }); ================================================ FILE: test/src/5_UIPack/UI Pack RunSequence.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity from "velocity-animate"; import {defaultProperties, getPropertyValue, getTarget} from "../utilities"; import "./_module"; QUnit.skip("RunSequence", (assert) => { // // var done = assert.async(1), // $target1 = getTarget(), // $target2 = getTarget(), // $target3 = getTarget(), // mySequence = [ // {elements: $target1, properties: {opacity: defaultProperties.opacity}}, // {elements: $target2, properties: {height: defaultProperties.height}}, // { // elements: $target3, properties: {width: defaultProperties.width}, options: { // delay: 100, // sequenceQueue: false, // complete: function() { // assert.equal(parseFloat(getPropertyValue($target1, "opacity") as string), defaultProperties.opacity, "First call's property animated."); // assert.equal(parseFloat(getPropertyValue($target2, "height") as string), defaultProperties.height, "Second call's property animated."); // assert.equal(parseFloat(getPropertyValue($target3, "width") as string), defaultProperties.width, "Last call's property animated."); // // done(); // } // } // } // ]; // // assert.expect(3); // Velocity.RunSequence(mySequence); }); ================================================ FILE: test/src/5_UIPack/_module.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; QUnit.module("UI Pack"); ================================================ FILE: test/src/6_Properties/Normalization property value reordering.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity, {HTMLorSVGElement} from "velocity-animate"; import {getTarget} from "../utilities"; import "./_module"; QUnit.skip("GenericReordering", (assert) => { // function genericReordering(element: HTMLorSVGElement, propertyValue?: string): string | void { // if (propertyValue === undefined) { // propertyValue = Velocity(element, "style", "textShadow"); // const split = propertyValue.split(/\s/g), // firstPart = split[0]; // let newValue = ""; // // if (Velocity.CSS.ColorNames[firstPart]) { // split.shift(); // split.push(firstPart); // newValue = split.join(" "); // } else if (firstPart.match(/^#|^hsl|^rgb|-gradient/)) { // const matchedString = propertyValue.match(/(hsl.*\)|#[\da-fA-F]+|rgb.*\)|.*gradient.*\))\s/g)[0]; // // newValue = propertyValue.replace(matchedString, "") + " " + matchedString.trim(); // } else { // newValue = propertyValue; // } // return newValue; // } // } // // Velocity("registerNormalization", "Element", "genericReordering", genericReordering); // // let tests = [ // { // test: "hsl(16, 100%, 66%) 1px 1px 1px", // result: "1px 1px 1px hsl(16, 100%, 66%)", // }, { // test: "-webkit-linear-gradient(red, yellow) 1px 1px 1px", // result: "1px 1px 1px -webkit-linear-gradient(rgba(255,0,0,1), rgba(255,255,0,1))", // }, { // test: "-o-linear-gradient(red, yellow) 1px 1px 1px", // result: "1px 1px 1px -o-linear-gradient(rgba(255,0,0,1), rgba(255,255,0,1))", // }, { // test: "-moz-linear-gradient(red, yellow) 1px 1px 1px", // result: "1px 1px 1px -moz-linear-gradient(rgba(255,0,0,1), rgba(255,255,0,1))", // }, { // test: "linear-gradient(red, yellow) 1px 1px 1px", // result: "1px 1px 1px linear-gradient(rgba(255,0,0,1), rgba(255,255,0,1))", // }, { // test: "red 1px 1px 1px", // result: "1px 1px 1px rgba(255,0,0,1)", // }, { // test: "#000000 1px 1px 1px", // result: "1px 1px 1px rgba(0,0,0,1)", // }, { // test: "rgb(0, 0, 0) 1px 1px 1px", // result: "1px 1px 1px rgba(0,0,0,1)", // }, { // test: "rgba(0, 0, 0, 1) 1px 1px 1px", // result: "1px 1px 1px rgba(0,0,0,1)", // }, { // test: "1px 1px 1px rgb(0, 0, 0)", // result: "1px 1px 1px rgba(0,0,0,1)", // }, // ]; // // for (let test of tests) { // let element = getTarget(); // // element.velocity("style", "textShadow", test.test); // assert.equal(element.velocity("style", "genericReordering"), test.result, test.test); // } }); ================================================ FILE: test/src/6_Properties/Property Display.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity, {VelocityResult} from "velocity-animate"; import {getTarget, once} from "../utilities"; import "./_module"; QUnit.test("Display", (assert) => { const done = assert.async(5); Velocity(getTarget(), "style", "display", "none") .velocity({display: "block"}, { progress: once((elements: VelocityResult) => { assert.equal(elements.velocity("style", "display"), "block", "Display:'block' was set immediately."); done(); }), }); Velocity(getTarget(), "style", "display", "none") .velocity("style", "display", "auto") .then((elements) => { assert.equal(elements[0].style.display, "block", "Display:'auto' was understood."); assert.equal(elements.velocity("style", "display"), "block", "Display:'auto' was cached as 'block'."); done(); }); Velocity(getTarget(), "style", "display", "none") .velocity("style", "display", "") .then((elements) => { assert.equal(elements.velocity("style", "display"), "block", "Display:'' was reset correctly."); done(); }); Velocity(getTarget(), {display: "none"}, { progress: once((elements: VelocityResult) => { assert.notEqual(elements.velocity("style", "display"), "none", "Display:'none' was not set immediately."); done(); }), }) .then((elements) => { assert.equal(elements.velocity("style", "display"), "none", "Display:'none' was set upon completion."); done(); }); }); ================================================ FILE: test/src/6_Properties/Property Visibility.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity, {VelocityResult} from "velocity-animate"; import {getTarget, once} from "../utilities"; import "./_module"; QUnit.test("Visibility", (assert) => { const done = assert.async(4); Velocity(getTarget(), "style", "visibility", "hidden") .velocity({visibility: "visible"}, { progress: once((elements: VelocityResult) => { assert.equal(elements.velocity("style", "visibility"), "visible", "Visibility:'visible' was set immediately."); done(); }), }); Velocity(getTarget(), "style", "visibility", "hidden") .velocity("style", "visibility", "") .then((elements) => { // NOTE: The test elements inherit "hidden", so while illogical it // is in fact correct. assert.equal(elements.velocity("style", "visibility"), "hidden", "Visibility:'' was reset correctly."); done(); }); Velocity(getTarget(), {visibility: "hidden"}, { progress: once((elements: VelocityResult) => { assert.notEqual(elements.velocity("style", "visibility"), "visible", "Visibility:'hidden' was not set immediately."); done(); }), }) .then((elements) => { assert.equal(elements.velocity("style", "visibility"), "hidden", "Visibility:'hidden' was set upon completion."); done(); }); }); ================================================ FILE: test/src/6_Properties/_module.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; QUnit.module("Properties"); ================================================ FILE: test/src/test.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import "./utilities"; import "./1_Core/_module"; import "./1_Core/Arguments"; import "./1_Core/End Value Caching"; import "./1_Core/End Value Setting"; import "./1_Core/Start Value Calculation"; import "./1_Core/Unit Calculation"; import "./2_Option/_module"; import "./2_Option/Option Begin"; import "./2_Option/Option Complete"; import "./2_Option/Option Delay"; import "./2_Option/Option Duration"; import "./2_Option/Option Easing"; import "./2_Option/Option Fps Limit"; import "./2_Option/Option Loop"; import "./2_Option/Option Progress"; import "./2_Option/Option Queue"; import "./2_Option/Option Repeat"; import "./2_Option/Option Speed"; import "./2_Option/Option Sync"; import "./3_Command/_module"; import "./3_Command/Command Finish"; import "./3_Command/Command Pause + Resume"; import "./3_Command/Command Reverse"; import "./3_Command/Command Scroll"; import "./3_Command/Command Stop"; import "./3_Command/Command Tween"; import "./4_Feature/_module"; import "./4_Feature/Feature Classname"; import "./4_Feature/Feature Colors"; import "./4_Feature/Feature Forcefeeding"; import "./4_Feature/Feature Promises"; import "./4_Feature/Feature Sequences"; import "./4_Feature/Feature Value Functions"; import "./5_UIPack/_module"; import "./5_UIPack/Packaged Effect slideUp+Down"; import "./5_UIPack/UI Pack Call Options"; import "./5_UIPack/UI Pack Callbacks"; import "./5_UIPack/UI Pack In+Out"; import "./5_UIPack/UI Pack RegisterEffect"; import "./5_UIPack/UI Pack RunSequence"; import "./6_Properties/_module"; import "./6_Properties/Normalization property value reordering"; import "./6_Properties/Property Display"; import "./6_Properties/Property Visibility"; ================================================ FILE: test/src/tsconfig.json ================================================ { "extends": "../../tsconfig.json", "files": [ "test.ts" ] } ================================================ FILE: test/src/utilities.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ import "qunit"; import Velocity, { ElementData, VelocityOptions, VelocityProperties } from "velocity-animate"; declare global { interface QUnit { todo(name: string, callback: (assert: Assert) => void): void; } interface Assert { close: { (actual: number, expected: number, maxDifference: number, message: string): void; percent(actual: number, expected: number, maxPercentDifference: number, message: string): void; }; notClose: { (actual: number, expected: number, minDifference: number, message: string): void; percent(actual: number, expected: number, minPercentDifference: number, message: string): void; }; } } export const $ = ((window as any).jQuery || (window as any).Zepto), $qunitStage = document.getElementById("qunit-stage"), defaultStyles = { opacity: 1, width: 1, height: 1, marginBottom: 1, colorGreen: 200, textShadowBlur: 3, }, defaultProperties: VelocityProperties = { opacity: String(defaultStyles.opacity / 2), width: defaultStyles.width * 2 + "px", height: defaultStyles.height * 2 + "px", }, defaultOptions: VelocityOptions = { queue: "", duration: 300, easing: "swing", begin: null, complete: null, progress: null, loop: false, delay: 0, mobileHA: true, }, asyncCheckDuration = (defaultOptions.duration as number) / 2, completeCheckDuration = (defaultOptions.duration as number) * 2, IE = (() => { if ((document as any).documentMode) { return (document as any).documentMode as number; } else { for (let i = 7; i > 0; i--) { let div = document.createElement("div"); div.innerHTML = ``; if (div.getElementsByTagName("span").length) { div = null; return i; } div = null; } } return undefined; })(); const targets: HTMLDivElement[] = []; let asyncCount = 0; QUnit.config.reorder = false; export function applyStartValues(element: HTMLElement, startValues: { [name: string]: string }) { $.each(startValues, (property, startValue) => { element.style[property] = startValue; }); } export function Data(element): ElementData { return (element.jquery ? element[0] : element).velocityData; } export function getNow(): number { return performance && performance.now ? performance.now() : Date.now(); } export function getPropertyValue(element: HTMLElement, property: string): string { return Velocity(element, "style", property); } export function getTarget(startValues?: { [name: string]: string }): HTMLDivElement { const div = document.createElement("div") as HTMLDivElement; div.className = "target"; div.style.opacity = String(defaultStyles.opacity); div.style.color = `rgb(125, ${defaultStyles.colorGreen}, 125)`; div.style.width = defaultStyles.width + "px"; div.style.height = defaultStyles.height + "px"; div.style.marginBottom = defaultStyles.marginBottom + "px"; div.style.textShadow = `0px 0px ${defaultStyles.textShadowBlur}px red`; $qunitStage.appendChild(div); targets.push(div); if (startValues) { applyStartValues(div, startValues); } return div; } export function once(func): typeof func { let done: boolean, result: any; return function(this: any, ...args: any[]) { if (!done) { result = func.apply(this, args); func = done = true; // Don't care about type, just let the GC collect if possible } return result; }; } export function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); } /** * Create an asyn callback. Each callback must be independant of all others, and * gets it's own unique done() callback to use. This also requires a count of * the number of tests run, and the assert object used. * Call without any arguments to get a total count of tests requested. */ export function asyncTests(): number; export function asyncTests(assert: Assert, count: number, callback: (done: () => void) => void): void; export function asyncTests(assert?: Assert, count?: number, callback?: (done: () => void) => void): number { if (!assert) { const oldCount = asyncCount; asyncCount = 0; return oldCount; } const done = assert.async(1); asyncCount += count; setTimeout(() => { callback(done); }, 1); } export function isEmptyObject(variable): variable is {} { for (const name in variable) { if (variable.hasOwnProperty(name)) { return false; } } return true; } QUnit.testDone(() => { try { document.querySelectorAll(".velocity-animating") .velocity("stop"); } catch { // We don't care if it fails. } // Free all targets requested by the current test. while (targets.length) { try { $qunitStage.removeChild(targets.pop()); } catch { // We don't care if it fails. } } // Ensure we have reset the test counter. asyncTests(); // Make sure Velocity goes back to defaults. Velocity.defaults.reset(); }); /* Cleanup */ QUnit.done((details) => { // $(".velocity-animating").velocity("stop"); console.log("Total: ", details.total, " Failed: ", details.failed, " Passed: ", details.passed, " Runtime: ", details.runtime); }); /* Helpful redirect for testing custom and parallel queues. */ // var $div2 = $("#DataBody-PropertiesDummy"); // $.fn.velocity.defaults.duration = 1000; // $div2.velocity("scroll", { queue: "test" }) // $div2.velocity({width: 100}, { queue: "test" }) // $div2.velocity({ borderWidth: 50 }, { queue: "test" }) // $div2.velocity({height: 20}, { queue: "test" }) // $div2.velocity({marginLeft: 200}, { queue: "test" }) // $div2.velocity({paddingTop: 60}); // $div2.velocity({marginTop: 100}); // $div2.velocity({paddingRight: 40}); // $div2.velocity({marginTop: 0}) // $div2.dequeue("test") ================================================ FILE: test/test.js ================================================ /** * velocity-animate (C) 2014-2017 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('qunit'), require('velocity-animate')) : typeof define === 'function' && define.amd ? define(['qunit', 'velocity-animate'], factory) : (factory(global.QUnit,global.Velocity)); }(this, (function (qunit,Velocity) { 'use strict'; Velocity = Velocity && Velocity.hasOwnProperty('default') ? Velocity['default'] : Velocity; var $ = window.jQuery || window.Zepto, $qunitStage = document.getElementById("qunit-stage"), defaultStyles = { opacity: 1, width: 1, height: 1, marginBottom: 1, colorGreen: 200, textShadowBlur: 3 }, defaultProperties = { opacity: String(defaultStyles.opacity / 2), width: defaultStyles.width * 2 + "px", height: defaultStyles.height * 2 + "px" }, defaultOptions = { queue: "", duration: 300, easing: "swing", begin: null, complete: null, progress: null, loop: false, delay: 0, mobileHA: true }, asyncCheckDuration = defaultOptions.duration / 2, completeCheckDuration = defaultOptions.duration * 2, IE = function () { if (document.documentMode) { return document.documentMode; } else { for (var i = 7; i > 0; i--) { var div = document.createElement("div"); div.innerHTML = ""; if (div.getElementsByTagName("span").length) { div = null; return i; } div = null; } } return undefined; }(); var targets = []; var asyncCount = 0; QUnit.config.reorder = false; function applyStartValues(element, startValues) { $.each(startValues, function (property, startValue) { element.style[property] = startValue; }); } function Data(element) { return (element.jquery ? element[0] : element).velocityData; } function getNow() { return performance && performance.now ? performance.now() : Date.now(); } function getPropertyValue(element, property) { return Velocity(element, "style", property); } function getTarget(startValues) { var div = document.createElement("div"); div.className = "target"; div.style.opacity = String(defaultStyles.opacity); div.style.color = "rgb(125, " + defaultStyles.colorGreen + ", 125)"; div.style.width = defaultStyles.width + "px"; div.style.height = defaultStyles.height + "px"; div.style.marginBottom = defaultStyles.marginBottom + "px"; div.style.textShadow = "0px 0px " + defaultStyles.textShadowBlur + "px red"; $qunitStage.appendChild(div); targets.push(div); if (startValues) { applyStartValues(div, startValues); } return div; } function once(func) { var done = void 0, result = void 0; return function () { if (!done) { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } result = func.apply(this, args); func = done = true; // Don't care about type, just let the GC collect if possible } return result; }; } function sleep(ms) { return new Promise(function (resolve) { return setTimeout(resolve, ms); }); } function asyncTests(assert, count, callback) { if (!assert) { var oldCount = asyncCount; asyncCount = 0; return oldCount; } var done = assert.async(1); asyncCount += count; setTimeout(function () { callback(done); }, 1); } QUnit.testDone(function () { try { document.querySelectorAll(".velocity-animating").velocity("stop"); } catch (_a) {} // We don't care if it fails. // Free all targets requested by the current test. while (targets.length) { try { $qunitStage.removeChild(targets.pop()); } catch (_b) { // We don't care if it fails. } } // Ensure we have reset the test counter. asyncTests(); // Make sure Velocity goes back to defaults. Velocity.defaults.reset(); }); /* Cleanup */ QUnit.done(function (details) { // $(".velocity-animating").velocity("stop"); console.log("Total: ", details.total, " Failed: ", details.failed, " Passed: ", details.passed, " Runtime: ", details.runtime); }); /* Helpful redirect for testing custom and parallel queues. */ // var $div2 = $("#DataBody-PropertiesDummy"); // $.fn.velocity.defaults.duration = 1000; // $div2.velocity("scroll", { queue: "test" }) // $div2.velocity({width: 100}, { queue: "test" }) // $div2.velocity({ borderWidth: 50 }, { queue: "test" }) // $div2.velocity({height: 20}, { queue: "test" }) // $div2.velocity({marginLeft: 200}, { queue: "test" }) // $div2.velocity({paddingTop: 60}); // $div2.velocity({marginTop: 100}); // $div2.velocity({paddingRight: 40}); // $div2.velocity({marginTop: 0}) // $div2.dequeue("test") QUnit.module("Core"); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; QUnit.test("Arguments", function (assert) { var testComplete = function testComplete() { // Do nothing }, testDuration = 1000, testEasing = "easeInSine", testOptions = { duration: 123, easing: testEasing, complete: testComplete }; var result = void 0; assert.expect(18); /**************** Overloading ****************/ result = Velocity(getTarget(), defaultProperties); assert.ok(result.length, "Overload variation #1a: Velocity(ELEMENT, {properties})"); assert.ok(result.velocity.animations.length, "Overload variation #1b: Velocity(element, {PROPERTIES})"); result = Velocity(getTarget(), defaultProperties, testDuration); assert.equal(result.velocity.animations[0].options.duration, testDuration, "Overload variation #2a: Velocity(element, {properties}, DURATION)"); result = Velocity(getTarget(), defaultProperties, "slow"); assert.equal(result.velocity.animations[0].options.duration, 600, "Overload variation #2b: Velocity(element, {properties}, DURATION)"); result = Velocity(getTarget(), defaultProperties, "normal"); assert.equal(result.velocity.animations[0].options.duration, 400, "Overload variation #2c: Velocity(element, {properties}, DURATION)"); result = Velocity(getTarget(), defaultProperties, "fast"); assert.equal(result.velocity.animations[0].options.duration, 200, "Overload variation #2d: Velocity(element, {properties}, DURATION)"); result = Velocity(getTarget(), defaultProperties, testEasing); assert.equal(_typeof(result.velocity.animations[0].options.easing), "function", "Overload variation #3: Velocity(element, {properties}, EASING)"); result = Velocity(getTarget(), defaultProperties, testComplete); assert.equal(_typeof(result.velocity.animations[0].options.complete), "function", "Overload variation #4: Velocity(element, {properties}, COMPLETE)"); result = Velocity(getTarget(), defaultProperties, testDuration, [0.42, 0, 0.58, 1]); assert.equal(result.velocity.animations[0].options.duration, testDuration, "Overload variation #5a: Velocity(element, {properties}, DURATION, easing)"); assert.equal(result.velocity.animations[0].options.easing(0.2, 0, 1), 0.0816598562658975, "Overload variation #5b: Velocity(element, {properties}, duration, EASING)"); result = Velocity(getTarget(), defaultProperties, testDuration, testComplete); assert.equal(result.velocity.animations[0].options.duration, testDuration, "Overload variation #6a: Velocity(element, {properties}, DURATION, complete)"); assert.equal(result.velocity.animations[0].options.complete, testComplete, "Overload variation #6b: Velocity(element, {properties}, duration, COMPLETE)"); result = Velocity(getTarget(), defaultProperties, testDuration, testEasing, testComplete); assert.equal(result.velocity.animations[0].options.duration, testDuration, "Overload variation #7a: Velocity(element, {properties}, DURATION, easing, complete)"); assert.equal(_typeof(result.velocity.animations[0].options.easing), "function", "Overload variation #7b: Velocity(element, {properties}, duration, EASING, complete)"); assert.equal(result.velocity.animations[0].options.complete, testComplete, "Overload variation #7c: Velocity(element, {properties}, duration, easing, COMPLETE)"); result = Velocity(getTarget(), defaultProperties, testOptions); assert.equal(result.velocity.animations[0].options.duration, testOptions.duration, "Overload variation #8: Velocity(element, {properties}, {OPTIONS})"); Velocity({ elements: [getTarget()], properties: defaultProperties, options: testOptions }); assert.equal(result.velocity.animations[0].options.duration, testOptions.duration, "Overload variation #9: Velocity({elements:[elements], properties:{properties}, options:{OPTIONS})"); Velocity({ elements: [getTarget()], properties: "stop", options: testOptions }); assert.equal(result.velocity.animations[0].options.duration, testOptions.duration, "Overload variation #10: Velocity({elements:[elements], properties:\"ACTION\", options:{OPTIONS})"); // var $target12 = getTarget(); // Velocity($target12, {opacity: [0.75, "spring", 0.25]}, testDuration); // assert.equal(Data($target12).style.opacity.startValue, 0.25, "Overload variation #10a."); // assert.equal(Data($target12).style.opacity.easing, "spring", "Overload variation #10b."); // assert.equal(Data($target12).style.opacity.endValue, 0.75, "Overload variation #10c."); // var $target13 = getTarget(); // Velocity($target13, {opacity: [0.75, 0.25]}, testDuration); // assert.equal(Data($target13).style.opacity.startValue, 0.25, "Overload variation #11a."); // assert.equal(Data($target13).style.opacity.endValue, 0.75, "Overload variation #11b."); // var $target14 = getTarget(); // Velocity($target14, {opacity: [0.75, "spring"]}, testDuration); // assert.equal(Data($target14).style.opacity.endValue, 0.75, "Overload variation #12a."); // assert.equal(Data($target14).style.opacity.easing, "spring", "Overload variation #12b."); // if ($) { // var $target17 = getTarget(); // $($target17).velocity(defaultProperties, testOptions); // assert.deepEqual(Data($target17).opts, testOptions, "$.fn.: Utility function variation #1: options object."); // // var $target18 = getTarget(); // $($target18).velocity({properties: defaultProperties, options: testOptions}); // assert.deepEqual(Data($target18).opts, testOptions, "$.fn.: Utility function variation #2: single object."); // // var $target19 = getTarget(); // $($target19).velocity(defaultProperties, testDuration, testEasing, testComplete); // assert.equal(Data($target19).opts.duration, testDuration, "$.fn.: Utility function variation #2a."); // assert.equal(Data($target19).opts.easing, testEasing, "$.fn.: Utility function variation #2b."); // assert.equal(Data($target19).opts.complete, testComplete, "$.fn.: Utility function variation #2c."); // // var $target20 = getTarget(); // assert.equal($($target20).length, $($target20).velocity(defaultProperties, testDuration, testEasing, testComplete) // .velocity(defaultProperties, testDuration, testEasing, testComplete).length, "$.fn.: Elements passed back to the call stack."); // // TODO: Should check in a better way - but the prototype chain is now extended with a Promise so a standard (non-length) comparison *will* fail // } }); QUnit.test("End Value Caching", function (assert) { var done = assert.async(2), newProperties = { height: "50px", width: "250px" }; assert.expect(4); /* Called after the last call is complete (stale). Ensure that the newly-set (via $.css()) properties are used. */ Velocity(getTarget(newProperties), defaultProperties).then(function (elements) { assert.equal(Data(elements[0]).cache.width, defaultProperties.width, "Stale end value #1 wasn't pulled."); assert.equal(Data(elements[0]).cache.height, defaultProperties.height, "Stale end value #2 wasn't pulled."); done(); }); Velocity(getTarget(), defaultProperties).velocity(newProperties).then(function (elements) { /* Chained onto a previous call (fresh). */ assert.equal(Data(elements[0]).cache.width, newProperties.width, "Chained end value #1 was pulled."); assert.equal(Data(elements[0]).cache.height, newProperties.height, "Chained end value #2 was pulled."); done(); }); }); QUnit.test("End Value Setting", function (assert) { var done = assert.async(1); /* Standard properties. */ Velocity(getTarget(), defaultProperties).then(function (elements) { assert.equal(Velocity(elements[0], "style", "width"), defaultProperties.width, "Standard end value #1 was set."); assert.equal(Velocity(elements[0], "style", "opacity"), defaultProperties.opacity, "Standard end value #2 was set."); done(); }); }); QUnit.todo("Start Value Calculation", function (assert) { var testStartValues = { paddingLeft: "10px", height: "100px", paddingRight: "50%", marginLeft: "100px", marginBottom: "33%", marginTop: "100px", lineHeight: "30px", wordSpacing: "40px", backgroundColor: "rgb(123,0,0)" }; /* Properties not previously defined on the element. */ var $target1 = getTarget(); Velocity($target1, testStartValues); assert.equal(Data($target1).cache.paddingLeft, testStartValues.paddingLeft, "Undefined standard start value was calculated."); assert.equal(Data($target1).cache.backgroundColor, testStartValues.backgroundColor, "Undefined start value hook was calculated."); /* Properties previously defined on the element. */ var $target2 = getTarget(); Velocity($target2, defaultProperties); assert.equal(Data($target2).cache.width, parseFloat(defaultStyles.width), "Defined start value #1 was calculated."); assert.equal(Data($target2).cache.opacity, parseFloat(defaultStyles.opacity), "Defined start value #2 was calculated."); assert.equal(Data($target2).cache.color, parseFloat(defaultStyles.colorGreen), "Defined hooked start value was calculated."); /* Properties that shouldn't cause start values to be unit-converted. */ var testPropertiesEndNoConvert = { paddingLeft: "20px", height: "40px", paddingRight: "75%" }, $target3 = getTarget(); applyStartValues($target3, testStartValues); Velocity($target3, testPropertiesEndNoConvert); assert.equal(Data($target3).cache.paddingLeft, parseFloat(testStartValues.paddingLeft), "Start value #1 wasn't unit converted."); assert.equal(Data($target3).cache.height, parseFloat(testStartValues.height), "Start value #2 wasn't unit converted."); // assert.deepEqual(Data($target3).cache.paddingRight.startValue, [Math.floor((parentWidth * parseFloat(testStartValues.paddingRight)) / 100), 0], // "Start value #3 was pattern matched."); /* Properties that should cause start values to be unit-converted. */ var testPropertiesEndConvert = { paddingLeft: "20%", height: "40%", lineHeight: "0.5em", wordSpacing: "2rem", marginLeft: "10vw", marginTop: "5vh", marginBottom: "100px" }, parentWidth = $qunitStage.clientWidth, parentHeight = $qunitStage.clientHeight, parentFontSize = Velocity($qunitStage, "style", "fontSize"), remSize = parseFloat(Velocity(document.body, "style", "fontSize")), $target4 = getTarget(); applyStartValues($target4, testStartValues); Velocity($target4, testPropertiesEndConvert); /* Long decimal results can be returned after unit conversion, and Velocity's code and the code here can differ in precision. So, we round floor values before comparison. */ // assert.deepEqual(Data($target4).cache.paddingLeft.startValue, [parseFloat(testStartValues.paddingLeft), 0], // "Horizontal property converted to %."); assert.equal(parseInt(Data($target4).cache.height, 10), Math.floor(parseFloat(testStartValues.height) / parentHeight * 100), "Vertical property converted to %."); // assert.equal(Data($target4).cache.lineHeight.startValue, Math.floor(parseFloat(testStartValues.lineHeight) / parseFloat(parentFontSize)), // "Property converted to em."); // assert.equal(Data($target4).cache.wordSpacing.startValue, Math.floor(parseFloat(testStartValues.wordSpacing) / parseFloat(remSize)), // "Property converted to rem."); assert.equal(parseInt(Data($target4).cache.marginBottom, 10), parseFloat(testStartValues.marginBottom) / 100 * parseFloat($target4.parentElement.offsetWidth), "Property converted to px."); // if (!(IE<=8) && !isAndroid) { // assert.equal(Data($target4).cache.marginLeft.startValue, Math.floor(parseFloat(testStartValues.marginLeft) / window.innerWidth * 100), // "Horizontal property converted to vw."); // assert.equal(Data($target4).cache.marginTop.startValue, Math.floor(parseFloat(testStartValues.marginTop) / window.innerHeight * 100), // "Vertical property converted to vh."); // } // TODO: Tests for auto-parameters as the units are no longer converted. /* jQuery TRBL deferring. */ var testPropertiesTRBL = { left: "1000px" }, $TRBLContainer = document.createElement("div"); $TRBLContainer.setAttribute("id", "TRBLContainer"); $TRBLContainer.style.marginLeft = testPropertiesTRBL.left; $TRBLContainer.style.width = "100px"; $TRBLContainer.style.height = "100px"; document.body.appendChild($TRBLContainer); var $target5 = getTarget(); $target5.style.position = "absolute"; $TRBLContainer.appendChild($target5); Velocity($target5, testPropertiesTRBL); assert.equal(parseInt(Data($target5).cache.left, 10), Math.round(parseFloat(testPropertiesTRBL.left) + parseFloat(Velocity(document.body, "style", "marginLeft"))), "TRBL value was deferred to jQuery."); }); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ function __awaiter(thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } var _this = window; QUnit.test("Unit Calculation", function (assert) { // TODO: Add code and tests for operators - probably using calc() internally // /* Standard properties with operators. */ // var testIncrementWidth = "5px", // testDecrementOpacity = 0.25, // testMultiplyMarginBottom = 4, // testDivideHeight = 2; // // var $target2 = getTarget(); // Velocity($target2, {width: "+=" + testIncrementWidth, opacity: "-=" + testDecrementOpacity, marginBottom: "*=" + testMultiplyMarginBottom, height: "/=" + testDivideHeight}); // setTimeout(function() { // // assert.equal(Data($target2).style.width.endValue, defaultStyles.width + parseFloat(testIncrementWidth), "Incremented end value was calculated."); // assert.equal(Data($target2).style.opacity.endValue, defaultStyles.opacity - testDecrementOpacity, "Decremented end value was calculated."); // assert.equal(Data($target2).style.marginBottom.endValue, defaultStyles.marginBottom * testMultiplyMarginBottom, "Multiplied end value was calculated."); // assert.equal(Data($target2).style.height.endValue, defaultStyles.height / testDivideHeight, "Divided end value was calculated."); // // done(); // }, asyncCheckDuration); asyncTests(assert, 2, function (done) { return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var $target; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: $target = getTarget(); Velocity($target, { left: "500px" }, { duration: 10 }); _context.next = 4; return sleep(100); case 4: assert.equal(getPropertyValue($target, "left"), "500px", "Finished animated value with given pixels should be the same."); Velocity($target, { left: "0px" }, { duration: 10 }); _context.next = 8; return sleep(100); case 8: assert.equal(getPropertyValue($target, "left"), "0px", "Finished animated value with 0px should be the same."); done(); case 10: case "end": return _context.stop(); } } }, _callee, this); })); }); // async(assert, 1, async (done) => { // const $target = getTarget(); // // Velocity($target, {left: "500px"}, {duration: 10}); // await sleep(100); // Velocity($target, {left: "0"}, {duration: 10}); // await sleep(100); // assert.equal(getPropertyValue($target, "left"), "0px", "Finished animated value without giving px, but only number as a string should be the same."); // // done(); // }); asyncTests(assert, 1, function (done) { return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { var $target; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: $target = getTarget(); Velocity($target, { left: "500px" }, { duration: 10 }); _context2.next = 4; return sleep(100); case 4: Velocity($target, { left: 0 }, { duration: 10 }); _context2.next = 7; return sleep(1000); case 7: assert.equal(getPropertyValue($target, "left"), "0px", "Finished animated value given as number 0 should be the same as 0px."); done(); case 9: case "end": return _context2.stop(); } } }, _callee2, this); })); }); asyncTests(assert, 2, function (done) { return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { var $target; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: $target = getTarget(); Velocity($target, { left: 500 }, { duration: 10 }); _context3.next = 4; return sleep(100); case 4: assert.equal(getPropertyValue($target, "left"), "500px", "Finished animated value with given pixels should be the same."); Velocity($target, { left: 0 }, { duration: 10 }); _context3.next = 8; return sleep(100); case 8: assert.equal(getPropertyValue($target, "left"), "0px", "Omitted pixels (px) when given animation should run properly."); done(); case 10: case "end": return _context3.stop(); } } }, _callee3, this); })); }); }); QUnit.module("Option"); QUnit.test("Begin", function (assert) { asyncTests(assert, 1, function (done) { var $targetSet = [getTarget(), getTarget()]; Velocity($targetSet, defaultProperties, { duration: asyncCheckDuration, begin: function begin(elements) { assert.deepEqual(elements, $targetSet, "Elements passed into callback."); done(); } }); }); assert.expect(asyncTests()); }); QUnit.test("Complete", function (assert) { asyncTests(assert, 1, function (done) { var $targetSet = [getTarget(), getTarget()]; Velocity($targetSet, defaultProperties, { duration: asyncCheckDuration, complete: function complete(elements) { assert.deepEqual(elements, $targetSet, "Elements passed into callback."); done(); } }); }); assert.expect(asyncTests()); }); QUnit.test("Delay", function (assert) { var testDelay = 250; asyncTests(assert, 1, function (done) { var start = getNow(); Velocity(getTarget(), defaultProperties, { duration: defaultOptions.duration, delay: testDelay, begin: function begin(elements, activeCall) { assert.close(getNow() - start, testDelay, 32, "Delayed calls start after the correct delay."); done(); } }); }); asyncTests(assert, 1, function (done) { var start = getNow(); Velocity(getTarget(), defaultProperties, { duration: defaultOptions.duration, delay: testDelay }).velocity(defaultProperties, { duration: defaultOptions.duration, delay: testDelay, begin: function begin(elements, activeCall) { assert.close(getNow() - start, testDelay * 2 + defaultOptions.duration, 32, "Chained delays start after the correct delay."); done(); } }); }); assert.expect(asyncTests()); }); QUnit.test("Duration", function (assert) { var testDuration = Velocity.defaults.duration; asyncTests(assert, 1, function (done) { var start = getNow(); Velocity(getTarget(), defaultProperties, { duration: testDuration, complete: function complete(elements, activeCall) { var time = getNow() - start; assert.close(time, testDuration, 32, "Calls run for the correct duration (~" + Math.floor(time) + "ms / " + testDuration + "ms)."); done(); } }); }); asyncTests(assert, 1, function (done) { var start = getNow(); Velocity(getTarget(), { width: ["200px", "500px"] }, { duration: testDuration }).velocity({ width: ["500px", "200px"] }, { duration: testDuration, complete: function complete(elements, activeCall) { var time = getNow() - start; assert.close(getNow() - start, testDuration * 2, 32, "Chained durations run for the correct duration (~" + Math.floor(time) + "ms / " + testDuration * 2 + "ms)."); done(); } }); }); asyncTests(assert, 1, function (done) { var start = getNow(); Velocity(getTarget(), { width: ["200px", "500px"] }).velocity({ width: ["500px", "200px"] }).then(function () { var time = getNow() - start; assert.close(getNow() - start, testDuration * 2, 32, "Chained durations with defaults run for the correct duration (~" + Math.floor(time) + "ms / " + testDuration * 2 + "ms)."); done(); }); }); assert.expect(asyncTests()); }); QUnit.test("Easing", function (assert) { asyncTests(assert, 1, function (done) { var success = false; try { success = true; Velocity(getTarget(), defaultProperties, { easing: "fake" }); } catch (e) { success = false; } assert.ok(success, "Fake easing string didn't throw error."); done(); }); asyncTests(assert, 1, function (done) { var success = false; try { success = true; Velocity(getTarget(), defaultProperties, { easing: ["a", 0.5, 0.5, 0.5] }); Velocity(getTarget(), defaultProperties, { easing: [0.5, 0.5, 0.5] }); } catch (e) { success = false; } assert.ok(success, "Invalid bezier curve didn't throw error."); done(); }); asyncTests(assert, 1, function (done) { // TODO: Use a "tween" action? /* Ensure that a properly-formatted bezier curve array returns a bezier function. */ var easingBezierArray = [0.27, -0.65, 0.78, 0.19], easingBezierTestPercent = 0.25, easingBezierTestValue = -0.23; Velocity(getTarget(), defaultProperties, { easing: easingBezierArray, begin: function begin(elements, animation) { assert.close(animation.options.easing(easingBezierTestPercent, 0, 1), easingBezierTestValue, 0.005, "Array converted into bezier function."); done(); } }); }); asyncTests(assert, 1, function (done) { /* Ensure that a properly-formatted spring RK4 array returns a bezier function. */ var easingSpringRK4Array = [250, 12], easingSpringRK4TestPercent = 0.25, easingSpringRK4TestValue = 0.928; Velocity(getTarget(), defaultProperties, { duration: 150, easing: easingSpringRK4Array, begin: function begin(elements, animation) { assert.close(animation.options.easing(easingSpringRK4TestPercent, 0, 1), easingSpringRK4TestValue, 10, "Array with duration converted into springRK4 function."); done(); } }); }); // TODO: Get this working in Velocity - so it can be tested // async(assert, 1, (done) => { // Velocity(getTarget(), defaultProperties, { // easing: easingSpringRK4Array, // begin(elements, animation) { // assert.equal(animation.duration, easingSpringRK4TestDuration, "Array without duration converted into springRK4 duration."); // done(); // } // }); // }); asyncTests(assert, 1, function (done) { /* Ensure that a properly-formatted step easing array returns a step function. */ var easingStepArray = [4], easingStepTestPercent = 0.35, easingStepTestValue = 0.25; Velocity(getTarget(), defaultProperties, { easing: easingStepArray, begin: function begin(elements, animation) { assert.close(animation.options.easing(easingStepTestPercent, 0, 1), easingStepTestValue, 0.05, "Array converted into Step function."); done(); } }); }); asyncTests(assert, 3, function (done) { Velocity(getTarget(), { opacity: [0, "during", 1] }, { duration: asyncCheckDuration, begin: function begin(elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct begin value (easing:'during')."); }, progress: once(function (elements) { assert.equal(elements.velocity("style", "opacity"), 0, "Correct progress value (easing:'during')."); }), complete: function complete(elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct complete value (easing:'during')."); done(); } }); }); asyncTests(assert, 3, function (done) { Velocity(getTarget(), { opacity: [0, "at-start", 1] }, { duration: asyncCheckDuration, begin: function begin(elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct begin value (easing:'at-start')."); }, progress: once(function (elements) { assert.equal(elements.velocity("style", "opacity"), 0, "Correct progress value (easing:'at-start')."); }), complete: function complete(elements) { assert.equal(elements.velocity("style", "opacity"), 0, "Correct complete value (easing:'at-start')."); done(); } }); }); asyncTests(assert, 3, function (done) { Velocity(getTarget(), { opacity: [0, "at-end", 1] }, { duration: asyncCheckDuration, begin: function begin(elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct begin value (easing:'at-end')."); }, progress: once(function (elements) { assert.equal(elements.velocity("style", "opacity"), 1, "Correct progress value (easing:'at-end')."); }), complete: function complete(elements) { assert.equal(elements.velocity("style", "opacity"), 0, "Correct complete value (easing:'at-end')."); done(); } }); }); assert.expect(asyncTests()); }); var _this$1 = window; QUnit.test("FPS Limit", function (assert) { return __awaiter(_this$1, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var count, $target, frameRates, testFrame, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, frameRate; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: count = void 0; $target = getTarget(), frameRates = [5, 15, 30, 60], testFrame = function testFrame(frameRate) { var counter = 0; Velocity.defaults.fpsLimit = frameRate; // Test if the frame rate is assigned succesfully. assert.equal(frameRate, Velocity.defaults.fpsLimit, "Setting global fps limit to " + frameRate); return Velocity($target, defaultProperties, { duration: 1000, progress: function progress() { counter++; } }).then(function () { return counter; }); }; assert.expect(frameRates.length * 2); // Test if the limit is working for 60, 30, 15 and 5 fps. _iteratorNormalCompletion = true; _didIteratorError = false; _iteratorError = undefined; _context.prev = 6; _iterator = frameRates[Symbol.iterator](); case 8: if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { _context.next = 21; break; } frameRate = _step.value; _context.t0 = assert; _context.next = 13; return testFrame(frameRate); case 13: _context.t1 = count = _context.sent; _context.t2 = frameRate + 1; _context.t3 = _context.t1 <= _context.t2; _context.t4 = "...counted " + count + " frames (\xB11 frame)"; _context.t0.ok.call(_context.t0, _context.t3, _context.t4); case 18: _iteratorNormalCompletion = true; _context.next = 8; break; case 21: _context.next = 27; break; case 23: _context.prev = 23; _context.t5 = _context["catch"](6); _didIteratorError = true; _iteratorError = _context.t5; case 27: _context.prev = 27; _context.prev = 28; if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } case 30: _context.prev = 30; if (!_didIteratorError) { _context.next = 33; break; } throw _iteratorError; case 33: return _context.finish(30); case 34: return _context.finish(27); case 35: case "end": return _context.stop(); } } }, _callee, this, [[6, 23, 27, 35], [28,, 30, 34]]); })); }); QUnit.test("Loop", function (assert) { asyncTests(assert, 4, function (done) { var testOptions = { loop: 2, delay: 100, duration: 100 }, start = getNow(); var _begin = 0, _complete = 0, loop = 0, lastPercentComplete = 2; Velocity(getTarget(), defaultProperties, { loop: testOptions.loop, delay: testOptions.delay, duration: testOptions.duration, begin: function begin() { _begin++; }, progress: function progress(elements, percentComplete) { if (lastPercentComplete > percentComplete) { loop++; } lastPercentComplete = percentComplete; }, complete: function complete() { _complete++; } }).then(function () { assert.equal(_begin, 1, "Begin callback only called once."); assert.equal(loop, testOptions.loop * 2 - 1, "Animation looped correct number of times (once each direction per loop)."); assert.close(getNow() - start, (testOptions.delay + testOptions.duration) * loop, 32, "Looping with 'delay' has correct duration."); assert.equal(_complete, 1, "Complete callback only called once."); done(); }); }); assert.expect(asyncTests()); }); QUnit.test("Progress", function (assert) { asyncTests(assert, 4, function (done) { var $target = getTarget(); Velocity($target, defaultProperties, { duration: asyncCheckDuration, progress: once(function (elements, percentComplete, msRemaining) { assert.deepEqual(elements, [$target], "Elements passed into progress."); assert.deepEqual(this, [$target], "Elements passed into progress as this."); // tslint:disable-line:no-invalid-this assert.equal(percentComplete >= 0 && percentComplete <= 1, true, "'percentComplete' passed into progress."); assert.equal(msRemaining > asyncCheckDuration - 50, true, "'msRemaining' passed into progress."); done(); }) }); }); assert.expect(asyncTests()); }); QUnit.test("Queue", function (assert) { var done = assert.async(4), testQueue = "custom", $target = getTarget(), ignore = $target.velocity("style", "display"), // Force data creation data = Data($target); var anim1 = void 0, anim2 = void 0; assert.expect(7); assert.ok(data.queueList[testQueue] === undefined, "Custom queue is empty."); // Shouldn't exist $target.velocity(defaultProperties, { queue: testQueue, begin: function begin() { anim1 = true; }, complete: function complete() { anim1 = false; assert.ok(!anim2, "Queued animation isn't started early."); done(); } }); assert.ok(data.queueList[testQueue] !== undefined, "Custom queue was created."); // Should exist, but be "null" $target.velocity(defaultProperties, { queue: testQueue, begin: function begin() { anim2 = true; assert.ok(anim1 === false, "Queued animation starts after first."); done(); }, complete: function complete() { anim2 = false; } }); assert.ok(data.queueList[testQueue], "Custom queue grows."); // Should exist and point at the next animation $target.velocity(defaultProperties, { begin: function begin() { assert.ok(anim1 === true, "Different queue animation starts in parallel."); done(); }, complete: function complete() { } }); $target.velocity(defaultProperties, { queue: false, begin: function begin() { assert.ok(anim1 === true, "Queue:false animation starts in parallel."); done(); } }); }); QUnit.test("Repeat", function (assert) { asyncTests(assert, 4, function (done) { var testOptions = { repeat: 2, delay: 100, duration: 100 }, start = Date.now(); var _begin = 0, _complete = 0, repeat = 0; Velocity(getTarget(), defaultProperties, { repeat: testOptions.repeat, delay: testOptions.delay, duration: testOptions.duration, begin: function begin() { _begin++; }, progress: function progress(elements, percentComplete) { if (percentComplete === 1) { repeat++; } }, complete: function complete() { _complete++; assert.equal(_begin, 1, "Begin callback only called once."); assert.equal(repeat, testOptions.repeat + 1, "Animation repeated correct number of times (original plus repeats)."); assert.close(Date.now() - start, (testOptions.delay + testOptions.duration) * (testOptions.repeat + 1), (testOptions.repeat + 1) * 16 + 32, "Repeat with 'delay' has correct duration."); assert.equal(_complete, 1, "Complete callback only called once."); done(); } }); }); assert.expect(asyncTests()); }); QUnit.test("Speed", function (assert) { var delay = 200, duration = 400, startDelay = getNow(); asyncTests(assert, 1, function (done) { Velocity.defaults.speed = 3; Velocity(getTarget(), defaultProperties, { speed: 5, begin: function begin(elements) { assert.equal(elements.velocity.animations[0].options.speed, 5, "Speed on options overrides default."); done(); } }); }); asyncTests(assert, 1, function (done) { Velocity(getTarget(), defaultProperties, { duration: duration, begin: function begin(elements) { elements.__start = getNow(); }, complete: function complete(elements) { var actual = getNow() - elements.__start, expected = duration / 3; assert.close(actual, expected, 32, "Velocity.defaults.speed change is respected. (\xD73, " + Math.floor(actual - expected) + "ms \xB132ms)"); done(); } }); }); asyncTests(assert, 1, function (done) { Velocity(getTarget(), defaultProperties, { duration: duration, speed: 2, begin: function begin(elements) { elements.__start = getNow(); }, complete: function complete(elements) { var actual = getNow() - elements.__start, expected = duration / 2; assert.close(actual, expected, 32, "Double speed animation lasts half as long. (\xD72, " + Math.floor(actual - expected) + "ms \xB132ms)"); done(); } }); }); asyncTests(assert, 1, function (done) { Velocity(getTarget(), defaultProperties, { duration: duration, delay: delay, speed: 2, begin: function begin(elements) { elements.__start = startDelay; }, complete: function complete(elements) { var actual = getNow() - elements.__start, expected = (duration + delay) / 2; assert.close(actual, expected, 32, "Delayed animation includes speed for delay. (\xD72, " + Math.floor(actual - expected) + "ms \xB132ms)"); done(); } }); }); asyncTests(assert, 1, function (done) { Velocity(getTarget(), defaultProperties, { duration: duration, delay: -delay, speed: 2, begin: function begin(elements) { elements.__start = startDelay; }, complete: function complete(elements) { var actual = getNow() - elements.__start, expected = (duration - delay) / 2; assert.close(actual, expected, 32, "Negative delay animation includes speed for delay. (\xD72, " + Math.floor(actual - expected) + "ms \xB132ms)"); done(); } }); }); asyncTests(assert, 1, function (done) { Velocity(getTarget(), defaultProperties, { duration: duration, speed: 0.5, begin: function begin(elements) { elements.__start = getNow(); }, complete: function complete(elements) { var actual = getNow() - elements.__start, expected = duration * 2; // TODO: Really not happy with the allowed range - it sits around 40ms, but should be closer to 16ms assert.close(actual, expected, 64, "Half speed animation lasts twice as long. (\xD7\xBD, " + Math.floor(actual - expected) + "ms \xB164ms)"); done(); } }); }); asyncTests(assert, 1, function (done) { Velocity(getTarget(), defaultProperties, { duration: duration, speed: 0, progress: function progress(elements, percentComplete) { if (!elements.__count) { elements.__start = percentComplete; elements.__count = 1; } else { assert.equal(elements.__start, percentComplete, "Frozen (speed:0) animation doesn't progress."); elements.velocity("option", "speed", 1) // Just in case "stop" is broken .velocity("stop"); done(); } } }); }); assert.expect(asyncTests()); }); var _this$2 = window; QUnit.test("Sync", function (assert) { asyncTests(assert, 1, function (done) { return __awaiter(_this$2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var $target, $targetSet, _complete; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: $target = getTarget(), $targetSet = [getTarget(), $target, getTarget()]; _complete = false; Velocity($target, defaultProperties, { duration: 300, complete: function complete() { _complete = true; } }); Velocity($targetSet, defaultProperties, { sync: false, duration: 250 }); _context.next = 6; return sleep(275); case 6: assert.notOk(_complete, "Sync 'false' animations don't wait for completion."); done(); case 8: case "end": return _context.stop(); } } }, _callee, this); })); }); asyncTests(assert, 1, function (done) { return __awaiter(_this$2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { var $target, $targetSet, _complete2; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: $target = getTarget(), $targetSet = [getTarget(), $target, getTarget()]; _complete2 = false; Velocity($target, defaultProperties, { duration: 300, complete: function complete() { _complete2 = true; } }); Velocity($targetSet, defaultProperties, { sync: true, duration: 250, begin: function begin() { assert.ok(_complete2, "Sync 'true' animations wait for completion."); done(); } }); case 4: case "end": return _context2.stop(); } } }, _callee2, this); })); }); assert.expect(asyncTests()); }); QUnit.module("Command"); var _this$3 = window; QUnit.test("Finish", function (assert) { return __awaiter(_this$3, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { var _this2 = this; return regeneratorRuntime.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: asyncTests(assert, 1, function (done) { Velocity(getTarget(), "finish"); assert.ok(true, "Calling on an element that isn't animating doesn't cause an error."); done(); }); asyncTests(assert, 1, function (done) { var $target = getTarget(); Velocity($target, defaultProperties, defaultOptions); Velocity($target, { top: 0 }, defaultOptions); Velocity($target, { width: 0 }, defaultOptions); Velocity($target, "finish"); assert.ok(true, "Calling on an element that is animating doesn't cause an error."); done(); }); asyncTests(assert, 2, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var $target, complete1, complete2; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: $target = getTarget(); complete1 = false, complete2 = false; Velocity($target, { opacity: [0, 1] }, { queue: "test1", complete: function complete() { complete1 = true; } }); Velocity($target, { opacity: [0, 1] }, { queue: "test2", complete: function complete() { complete2 = true; } }); Velocity($target, "finish", "test1"); _context.next = 7; return sleep(defaultOptions.duration / 2); case 7: assert.ok(complete1, "Finish animation with correct queue."); assert.notOk(complete2, "Don't finish animation with wrong queue."); done(); case 10: case "end": return _context.stop(); } } }, _callee, this); })); }); asyncTests(assert, 3, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { var $target, _begin, _complete; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: $target = getTarget(); _begin = false, _complete = false; Velocity($target, { opacity: [0, 1] }, { begin: function begin() { _begin = true; }, complete: function complete() { _complete = true; } }); _context2.next = 5; return sleep(500); case 5: Velocity($target, "finish"); assert.ok(_begin, "Finish calls 'begin()' callback without delay."); assert.ok(_complete, "Finish calls 'complete()' callback without delay."); assert.equal(getPropertyValue($target, "opacity"), "0", "Finish animation with correct value."); done(); case 10: case "end": return _context2.stop(); } } }, _callee2, this); })); }); asyncTests(assert, 3, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { var $target, _begin2, _complete2; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: $target = getTarget(); _begin2 = false, _complete2 = false; Velocity($target, { opacity: [0, 1] }, { delay: 1000, begin: function begin() { _begin2 = true; }, complete: function complete() { _complete2 = true; } }); _context3.next = 5; return sleep(500); case 5: Velocity($target, "finish"); assert.ok(_begin2, "Finish calls 'begin()' callback with delay."); assert.ok(_complete2, "Finish calls 'complete()' callback with delay."); assert.equal(getPropertyValue($target, "opacity"), "0", "Finish animation with correct value before delay ends."); done(); case 10: case "end": return _context3.stop(); } } }, _callee3, this); })); }); asyncTests(assert, 3, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { var $target; return regeneratorRuntime.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: $target = getTarget(); Velocity($target, { opacity: 0 }).velocity({ opacity: 1 }).velocity({ opacity: 0.25 }).velocity({ opacity: 0.75 }).velocity({ opacity: 0.5 }); Velocity($target, "finish"); assert.equal(getPropertyValue($target, "opacity"), "0", "Finish once starts the second animation."); Velocity($target, "finish"); assert.equal(getPropertyValue($target, "opacity"), "1", "Finish twice starts the third animation."); Velocity($target, "finish", true); assert.equal(getPropertyValue($target, "opacity"), "0.5", "Finish 'true' finishes all animations."); done(); case 9: case "end": return _context4.stop(); } } }, _callee4, this); })); }); assert.expect(asyncTests()); case 7: case "end": return _context5.stop(); } } }, _callee5, this); })); }); var _this$4 = window; QUnit.test("Pause + Resume", function (assert) { return __awaiter(_this$4, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { var _this2 = this; return regeneratorRuntime.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: asyncTests(assert, 2, function (done) { var $target = getTarget(); Velocity($target, "pause"); assert.ok(true, "Calling \"pause\" on an element that isn't animating doesn't cause an error."); Velocity($target, "resume"); assert.ok(true, "Calling \"resume\" on an element that isn't animating doesn't cause an error."); done(); }); asyncTests(assert, 4, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var $target, _progress; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: $target = getTarget(); _progress = false; Velocity($target, { opacity: 0 }, { duration: 250, progress: function progress() { _progress = true; } }); Velocity($target, "pause"); _context.next = 6; return sleep(50); case 6: assert.equal(getPropertyValue($target, "opacity"), "1", "Property value unchanged after pause."); assert.notOk(_progress, "Progress callback not run during pause."); Velocity($target, "resume"); _context.next = 11; return sleep(300); case 11: assert.equal(getPropertyValue($target, "opacity"), "0", "Tween completed after pause/resume."); assert.ok(_progress, "Progress callback run after pause."); done(); case 14: case "end": return _context.stop(); } } }, _callee, this); })); }); asyncTests(assert, 3, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { var $target; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: $target = getTarget(); Velocity($target, { opacity: 0 }, { duration: 250, delay: 250 }); Velocity($target, "pause"); _context2.next = 5; return sleep(500); case 5: assert.equal(getPropertyValue($target, "opacity"), "1", "Delayed property value unchanged after pause."); Velocity($target, "resume"); _context2.next = 9; return sleep(100); case 9: assert.equal(getPropertyValue($target, "opacity"), "1", "Delayed tween did not start early after pause."); _context2.next = 12; return sleep(500); case 12: assert.equal(getPropertyValue($target, "opacity"), "0", "Delayed tween completed after pause/resume."); done(); case 14: case "end": return _context2.stop(); } } }, _callee2, this); })); }); asyncTests(assert, 1, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { var $target; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: $target = getTarget(); Velocity($target, { opacity: 0 }, { queue: "test", duration: 250 }); Velocity("pause", "test"); _context3.next = 5; return sleep(300); case 5: assert.equal(getPropertyValue($target, "opacity"), "1", "Pause 'queue' works globally."); done(); case 7: case "end": return _context3.stop(); } } }, _callee3, this); })); }); asyncTests(assert, 1, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { var $target; return regeneratorRuntime.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: $target = getTarget(); Velocity($target, { opacity: 0 }).velocity("pause"); _context4.next = 4; return sleep(300); case 4: assert.equal(getPropertyValue($target, "opacity"), "1", "Chained pause only pauses chained tweens."); done(); case 6: case "end": return _context4.stop(); } } }, _callee4, this); })); }); // TODO: Better global tests, queue: false, named queues // /* Ensure proper behavior with queue:false */ // var $target4 = getTarget(); // Velocity($target4, {opacity: 0}, {duration: 200}); // // var isResumed = false; // // await sleep(100); // Velocity($target4, "pause"); // Velocity($target4, {left: -20}, { // duration: 100, // easing: "linear", // queue: false, // begin: function(elements) { // assert.ok(true, "Animation with {queue:false} will run regardless of previously paused animations."); // } // }); // // Velocity($target4, {top: 20}, { // duration: 100, // easing: "linear", // begin: function(elements) { // assert.ok(isResumed, "Queued animation began after previously paused animation completed"); // } // }); // // await sleep(100); // // isResumed = true; // Velocity($target4, "resume"); // await sleep(100); assert.expect(asyncTests()); case 6: case "end": return _context5.stop(); } } }, _callee5, this); })); }); QUnit.test("Reverse", function (assert) { var $target = getTarget(), opacity = $target.velocity("style", "opacity"), // Browsers don't always suffix, but Velocity does. width = $target.velocity("style", "width") === "0" ? "0px" : $target.velocity("style", "width"); asyncTests(assert, 2, function (done) { Velocity($target, defaultProperties, { complete: function complete(elements) { assert.equal(elements[0].velocity("style", "opacity"), defaultProperties.opacity, "Initial property #1 set correctly. (" + defaultProperties.opacity + ")"); assert.equal(elements[0].velocity("style", "width"), defaultProperties.width, "Initial property #2 set correctly. (" + defaultProperties.width + ")"); done(); } }); }); asyncTests(assert, 2, function (done) { Velocity($target, "reverse", { complete: function complete(elements) { assert.equal(elements[0].velocity("style", "opacity"), opacity, "Reversed property #1 set correctly. (" + opacity + ")"); assert.equal(elements[0].velocity("style", "width"), width, "Reversed property #2 set correctly. (" + width + ")"); done(); } }); }); asyncTests(assert, 2, function (done) { Velocity($target, "reverse", { complete: function complete(elements) { assert.equal(elements[0].velocity("style", "opacity"), defaultProperties.opacity, "Chained reversed property #1 set correctly. (" + defaultProperties.opacity + ")"); assert.equal(elements[0].velocity("style", "width"), defaultProperties.width, "Chained reversed property #2 set correctly. (" + defaultProperties.width + ")"); done(); } }); }); assert.expect(asyncTests()); }); /* Window scrolling. */ QUnit.skip("Scroll (Window)", function (assert) { // var done = assert.async(4), // $details = $("#details"), // $scrollTarget1 = $("
      Scroll target #1. Should stop 50 pixels above this point.
      "), // $scrollTarget2 = $("
      Scroll target #2. Should stop 50 pixels before this point.
      "), // scrollOffset = -50; // // $scrollTarget1 // .css({position: "relative", top: 3000, height: 100, paddingBottom: 10000}) // .appendTo($("body")); // // $scrollTarget2 // .css({position: "absolute", top: 100, left: 3000, width: 100, paddingRight: 15000}) // .appendTo($("body")); // // $scrollTarget1 // .velocity("scroll", { // duration: 500, offset: scrollOffset, complete: function() { // assert.equal(Math.abs(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyTop] // - ($scrollTarget1.offset().top + scrollOffset)) <= 100, true, "Page scrolled top with a scroll offset."); // // done(); // } // }) // .velocity({opacity: 0.5}, function() { // $details // .velocity({opacity: 0.5}, 500) // .velocity("scroll", 500) // .velocity({opacity: 1}, 500, function() { // //alert(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyTop] + " " + ($details.offset().top + scrollOffset)) // assert.equal(Math.abs(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyTop] // - ($details.offset().top + scrollOffset)) <= 100, true, "Page scroll top was chained."); // // done(); // // //$scrollTarget1.remove(); // // $scrollTarget2 // .velocity("scroll", { // duration: 500, axis: "x", offset: scrollOffset, complete: function() { // /* Phones can reposition the browser's scroll position by a 10 pixels or so, so we just check for a value that's within that range. */ // assert.equal(Math.abs(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyLeft] // - ($scrollTarget2.offset().left + scrollOffset)) <= 100, true, "Page scrolled left with a scroll offset."); // // done(); // } // }) // .velocity({opacity: 0.5}, function() { // $details // .velocity({opacity: 0.5}, 500) // .velocity("scroll", {duration: 500, axis: "x"}) // .velocity({opacity: 1}, 500, function() { // assert.equal(Math.abs(Velocity.State.scrollAnchor[Velocity.State.scrollPropertyLeft] // - ($details.offset().left + scrollOffset)) <= 100, true, "Page scroll left was chained."); // // done(); // }); // }); // }); // }); }); /* Element scrolling. */ QUnit.skip("Scroll (Element)", function (assert) { // var done = assert.async(2), // $scrollTarget1 = $("\ //
      \ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ //
      \ // Stop #1\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ //
      \ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ //
      \ // Stop #2\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ //
      \ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ //
      \ // "); // // assert.expect(2); // $scrollTarget1 // .css({position: "absolute", backgroundColor: "white", top: 100, left: "50%", width: 500, height: 100, overflowY: "scroll"}) // .appendTo($("body")); // // /* Test with a jQuery object container. */ // $("#scrollerChild1").velocity("scroll", { // container: $("#scroller"), duration: 750, complete: function() { // /* Test with a raw DOM element container. */ // $("#scrollerChild2").velocity("scroll", { // container: $("#scroller")[0], duration: 750, complete: function() { // /* This test is purely visual. */ // assert.ok(true); // // $scrollTarget1.remove(); // // var $scrollTarget2 = $("\ //
      \ //
      \ // Stop #1\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ // cccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ //
      \ //
      \ // Stop #2\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ // eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ //
      \ //
      \ // "); // // $scrollTarget2 // .css({position: "absolute", backgroundColor: "white", top: 100, left: "50%", width: 100, height: 500, overflowX: "scroll"}) // .appendTo($("body")); // // /* Test with a jQuery object container. */ // $("#scrollerChild2").velocity("scroll", { // axis: "x", container: $("#scroller"), duration: 750, complete: function() { // /* Test with a raw DOM element container. */ // $("#scrollerChild1").velocity("scroll", { // axis: "x", container: $("#scroller")[0], duration: 750, complete: function() { // /* This test is purely visual. */ // assert.ok(true); // // $scrollTarget2.remove(); // // done(); // } // }); // } // }); // // done(); // } // }); // } // }); }); var _this$5 = window; QUnit.test("Stop", function (assert) { return __awaiter(_this$5, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { var _this2 = this; return regeneratorRuntime.wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: asyncTests(assert, 1, function (done) { Velocity(getTarget(), "stop"); assert.ok(true, "Calling on an element that isn't animating doesn't cause an error."); done(); }); asyncTests(assert, 1, function (done) { var $target = getTarget(); Velocity($target, defaultProperties, defaultOptions); Velocity($target, { top: 0 }, defaultOptions); Velocity($target, { width: 0 }, defaultOptions); Velocity($target, "stop"); assert.ok(true, "Calling on an element that is animating doesn't cause an error."); done(); }); asyncTests(assert, 1, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var $target, startOpacity; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: $target = getTarget(), startOpacity = getPropertyValue($target, "opacity"); Velocity($target, { opacity: [0, 1] }, defaultOptions); _context.next = 4; return sleep(defaultOptions.duration / 2); case 4: Velocity($target, "stop"); assert.close(parseFloat(getPropertyValue($target, "opacity")), parseFloat(startOpacity) / 2, 0.1, "Animation runs until stopped."); done(); case 7: case "end": return _context.stop(); } } }, _callee, this); })); }); asyncTests(assert, 1, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { var $target, _begin; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: $target = getTarget(); _begin = false; Velocity($target, { opacity: [0, 1] }, { delay: 1000, begin: function begin() { _begin = true; } }); _context2.next = 5; return sleep(500); case 5: Velocity($target, "stop"); assert.notOk(_begin, "Stop animation before delay ends."); done(); case 8: case "end": return _context2.stop(); } } }, _callee2, this); })); }); asyncTests(assert, 2, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { var $target, complete1, complete2; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: $target = getTarget(); complete1 = false, complete2 = false; Velocity($target, { opacity: [0, 1] }, { queue: "test1", complete: function complete() { complete1 = true; } }); Velocity($target, { opacity: [0, 1] }, { queue: "test2", complete: function complete() { complete2 = true; } }); Velocity($target, "stop", "test1"); _context3.next = 7; return sleep(defaultOptions.duration * 2); case 7: assert.ok(complete2, "Stop animation with correct queue."); assert.notOk(complete1, "Don't stop animation with wrong queue."); done(); case 10: case "end": return _context3.stop(); } } }, _callee3, this); })); }); asyncTests(assert, 1, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { var $target, begin1, begin2; return regeneratorRuntime.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: $target = getTarget(); begin1 = false, begin2 = false; Velocity($target, { opacity: [0, 1] }, { begin: function begin() { begin1 = true; } }); Velocity($target, { width: "500px" }, { begin: function begin() { begin2 = true; } }); Velocity($target, "stop", true); _context4.next = 7; return sleep(defaultOptions.duration * 2); case 7: assert.notOk(begin1 || begin2, "Stop 'true' stops all animations."); done(); case 9: case "end": return _context4.stop(); } } }, _callee4, this); })); }); asyncTests(assert, 2, function (done) { return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { var $target, anim, begin1, begin2; return regeneratorRuntime.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: $target = getTarget(), anim = Velocity($target, { opacity: [0, 1] }, { queue: "test", begin: function begin() { begin1 = true; } }); begin1 = false, begin2 = false; Velocity($target, { opacity: [0, 1] }, { begin: function begin() { begin2 = true; } }); anim.velocity("stop"); _context5.next = 6; return sleep(defaultOptions.duration * 2); case 6: assert.notOk(begin1, "Stop without arguments on a chain stops chain animations."); assert.ok(begin2, "Stop without arguments on a chain doesn't stop other animations."); done(); case 9: case "end": return _context5.stop(); } } }, _callee5, this); })); }); assert.expect(asyncTests()); case 8: case "end": return _context6.stop(); } } }, _callee6, this); })); }); QUnit.test("Tween", function (assert) { var $target1 = getTarget(), startOpacity = $target1.style.opacity; assert.expect(11); assert.raises(function () { return Velocity("tween", "invalid"); }, "Invalid percentComplete throws an error."); assert.raises(function () { return Velocity([$target1, $target1], "tween", "invalid"); }, "Passing more than one target throws an error."); assert.raises(function () { return Velocity("tween", 0, ["invalid"]); }, "Invalid propertyMap throws an error."); assert.raises(function () { return Velocity("tween", 0, "invalid", 1); }, "Property without an element must be forcefed or throw an error."); assert.equal($target1.velocity("tween", 0.5, "opacity", [1, 0], "linear"), "0.5", "Calling on an chain returns the correct value."); assert.equal(Velocity($target1, "tween", 0.5, "opacity", [1, 0], "linear"), "0.5", "Calling with an element returns the correct value."); assert.equal(Velocity("tween", 0.5, "opacity", [1, 0], "linear"), "0.5", "Calling without an element returns the correct value."); assert.equal($target1.style.opacity, startOpacity, "Ensure that the element is not altered."); assert.equal(_typeof(Velocity($target1, "tween", 0.5, "opacity", [1, 0], "linear")), "string", "Calling a single property returns a value."); assert.equal(_typeof(Velocity($target1, "tween", 0.5, { opacity: [1, 0] }, "linear")), "object", "Calling a propertiesMap returns an object."); assert.deepEqual($target1.velocity("tween", 0.5, { opacity: [1, 0] }, "linear"), Velocity($target1, "tween", 0.5, { opacity: [1, 0] }, "linear"), "Calling directly returns the same as a chain."); }); QUnit.module("Feature"); QUnit.test("'velocity-animating' Classname", function (assert) { var done = assert.async(1); Velocity(getTarget(), defaultProperties, { begin: function begin(elements) { assert.equal(/velocity-animating/.test(elements[0].className), true, "Class added."); }, complete: function complete(elements) { assert.equal(/velocity-animating/.test(elements[0].className), false, "Class removed."); } }).then(done); }); QUnit.skip("Colors (Shorthands)", function (assert) { var $target = getTarget(); Velocity($target, { borderColor: "#7871c2", color: ["#297dad", "spring", "#5ead29"] }); // assert.equal(Data($target).style.borderColorRed.endValue, 120, "Hex #1a component."); // assert.equal(Data($target).style.borderColorGreen.endValue, 113, "Hex #1b component."); // assert.equal(Data($target).style.borderColorBlue.endValue, 194, "Hex #1c component."); // assert.equal(Data($target).style.colorRed.easing, "spring", "Per-property easing."); // assert.equal(Data($target).style.colorRed.startValue, 94, "Forcefed hex #2a component."); // assert.equal(Data($target).style.colorGreen.startValue, 173, "Forcefed hex #2b component."); // assert.equal(Data($target).style.colorBlue.startValue, 41, "Forcefed hex #2c component."); // assert.equal(Data($target).style.colorRed.endValue, 41, "Hex #3a component."); // assert.equal(Data($target).style.colorGreen.endValue, 125, "Hex #3b component."); // assert.equal(Data($target).style.colorBlue.endValue, 173, "Hex #3c component."); }); QUnit.todo("Forcefeeding", function (assert) { /* Note: Start values are always converted into pixels. W test the conversion ratio we already know to avoid additional work. */ var testStartWidth = "1rem", testStartWidthToPx = "16px", testStartHeight = "10px", $target = getTarget(); Velocity($target, { width: [100, "linear", testStartWidth], height: [100, testStartHeight], opacity: [defaultProperties.opacity, "easeInQuad"] }); assert.equal(Data($target).cache.width, parseFloat(testStartWidthToPx), "Forcefed value #1 passed to tween."); assert.equal(Data($target).cache.height, parseFloat(testStartHeight), "Forcefed value #2 passed to tween."); assert.equal(Data($target).cache.opacity, defaultStyles.opacity, "Easing was misinterpreted as forcefed value."); }); QUnit.test("Promises", function (assert) { var done = assert.async(10), start = getNow(); var result = void 0; assert.expect(10); /********************** Invalid Arguments **********************/ Velocity().then(function () { assert.notOk(true, "Calling with no arguments should reject a Promise."); }, function () { assert.ok(true, "Calling with no arguments should reject a Promise."); }).then(done); Velocity(getTarget()).then(function () { assert.notOk(true, "Calling with no properties should reject a Promise."); }, function () { assert.ok(true, "Calling with no properties should reject a Promise."); }).then(done); Velocity(getTarget(), {}).then(function () { assert.ok(true, "Calling with empty properties should not reject a Promise."); }, function () { assert.notOk(true, "Calling with empty properties should not reject a Promise."); }).then(done); Velocity(getTarget(), {}, defaultOptions.duration).then(function () { assert.ok(true, "Calling with empty properties + duration should not reject a Promise."); }, function () { assert.notOk(true, "Calling with empty properties + duration should not reject a Promise."); }).then(done); /* Invalid arguments: Ensure an error isn't thrown. */ Velocity(getTarget(), {}, "fakeArg1", "fakeArg2").then(function () { assert.ok(true, "Calling with invalid arguments should reject a Promise."); }, function () { assert.notOk(true, "Calling with invalid arguments should reject a Promise."); }).then(done); result = Velocity(getTarget(), defaultProperties, defaultOptions); result.then(function (elements) { assert.equal(elements.length, 1, "Calling with a single element fulfills with a single element array."); }, function () { assert.ok(false, "Calling with a single element fulfills with a single element array."); }).then(done); result.velocity(defaultProperties).then(function (elements) { assert.ok(getNow() - start > 2 * defaultOptions.duration, "Queued call fulfilled after correct delay."); }, function () { assert.ok(false, "Queued call fulfilled after correct delay."); }).then(done); result = Velocity([getTarget(), getTarget()], defaultProperties, defaultOptions); result.then(function (elements) { assert.equal(elements.length, 2, "Calling with multiple elements fulfills with a multiple element array."); }, function () { assert.ok(false, "Calling with multiple elements fulfills with a multiple element array."); }).then(done); var anim = Velocity(getTarget(), defaultProperties, defaultOptions); anim.then(function () { assert.ok(getNow() - start < defaultOptions.duration, "Stop call fulfilled after correct delay."); }, function () { assert.ok(false, "Stop call fulfilled after correct delay."); }).then(done); anim.velocity("stop"); Promise.all([Velocity(getTarget(), defaultProperties, defaultOptions).promise, Velocity(getTarget(), defaultProperties, defaultOptions).promise]).then(function () { assert.ok(true, "Promise.all fulfilled when all animations have finished."); }).then(done); }); QUnit.todo("Sequences", function (assert) { // var done = assert.async(2), // $target1 = getTarget(), // $target2 = getTarget(), // redirectOptions = {duration: 1500}; // // ((window as any).jQuery || (window as any).Zepto || window).Velocity.Redirects.test = function(element, options, elementIndex, elementsLength) { // if (elementIndex === 0) { // assert.deepEqual(element, $target1, "Element passed through #1."); // assert.deepEqual(options, redirectOptions, "Options object passed through #1."); // assert.equal(elementIndex, 0, "Element index passed through #1."); // assert.equal(elementsLength, 2, "Elements length passed through #1."); // // done(); // } else if (elementIndex === 1) { // assert.deepEqual(element, $target2, "Element passed through #2."); // assert.deepEqual(options, redirectOptions, "Options object passed through #2."); // assert.equal(elementIndex, 1, "Element index passed through #2."); // assert.equal(elementsLength, 2, "Elements length passed through #2."); // // done(); // } // }; // // Velocity([$target1, $target2], "test", redirectOptions); }); QUnit.todo("Value Functions", function (assert) { var testWidth = 10, $target1 = getTarget(), $target2 = getTarget(); Velocity([$target1, $target2], { width: function width(i, total) { return (i + 1) / total * testWidth; } }); assert.equal(Data($target1).cache.width, parseFloat(testWidth) / 2, "Function value #1 passed to tween."); assert.equal(Data($target2).cache.width, parseFloat(testWidth), "Function value #2 passed to tween."); }); QUnit.module("UI Pack"); QUnit.skip("Packaged Effect: slideUp/Down", function (assert) { var done = assert.async(4), $target1 = getTarget(), $target2 = getTarget(), initialStyles = { display: "none", paddingTop: "123px" }; $target1.style.display = initialStyles.display; $target1.style.paddingTop = initialStyles.paddingTop; Velocity($target1, "slideDown", { begin: function begin(elements) { assert.deepEqual(elements, [$target1], "slideDown: Begin callback returned."); done(); }, complete: function complete(elements) { assert.deepEqual(elements, [$target1], "slideDown: Complete callback returned."); // assert.equal(getPropertyValue($target1, "display"), Values.getDisplayType($target1), "slideDown: display set to default."); assert.notEqual(getPropertyValue($target1, "height"), 0, "slideDown: height set."); assert.equal(getPropertyValue($target1, "paddingTop"), initialStyles.paddingTop, "slideDown: paddingTop set."); done(); } }); Velocity($target2, "slideUp", { begin: function begin(elements) { assert.deepEqual(elements, [$target2], "slideUp: Begin callback returned."); done(); }, complete: function complete(elements) { assert.deepEqual(elements, [$target2], "slideUp: Complete callback returned."); assert.equal(getPropertyValue($target2, "display"), 0, "slideUp: display set to none."); assert.notEqual(getPropertyValue($target2, "height"), 0, "slideUp: height reset."); assert.equal(getPropertyValue($target1, "paddingTop"), initialStyles.paddingTop, "slideUp: paddingTop reset."); done(); } }); }); QUnit.skip("Call Options", function (assert) { var done = assert.async(2), UICallOptions1 = { delay: 123, duration: defaultOptions.duration, easing: "spring" }, $target1 = getTarget(); //assert.expect(1); Velocity($target1, "transition.slideLeftIn", UICallOptions1); setTimeout(function () { // Note: We can do this because transition.slideLeftIn is composed of a single call. // assert.equal(Data($target1).opts.delay, UICallOptions1.delay, "Whitelisted option passed in."); // assert.notEqual(Data($target1).opts.easing, UICallOptions1.easing, "Non-whitelisted option not passed in #1a."); // assert.equal(!/velocity-animating/.test(Data($target1).className), true, "Duration option passed in."); done(); }, completeCheckDuration); var UICallOptions2 = { stagger: 100, duration: defaultOptions.duration, backwards: true }; var $targets = [getTarget(), getTarget(), getTarget()]; Velocity($targets, "transition.slideLeftIn", UICallOptions2); setTimeout(function () { // assert.equal(Data($targets[0]).opts.delay, UICallOptions2.stagger * 2, "Backwards stagger delay passed in #1a."); // assert.equal(Data($targets[1]).opts.delay, UICallOptions2.stagger * 1, "Backwards stagger delay passed in #1b."); // assert.equal(Data($targets[2]).opts.delay, UICallOptions2.stagger * 0, "Backwards stagger delay passed in #1c."); done(); }, completeCheckDuration); }); QUnit.skip("Callbacks", function (assert) { var done = assert.async(2), $targets = [getTarget(), getTarget()]; assert.expect(3); Velocity($targets, "transition.bounceIn", { begin: function begin(elements) { assert.deepEqual(elements, $targets, "Begin callback returned."); done(); }, complete: function complete(elements) { assert.deepEqual(elements, $targets, "Complete callback returned."); done(); } }); }); QUnit.skip("In/Out", function (assert) { var done = assert.async(2), $target1 = getTarget(), $target2 = getTarget(), $target3 = getTarget(), $target4 = getTarget(), $target5 = getTarget(), $target6 = getTarget(); Velocity($target1, "transition.bounceIn", defaultOptions.duration); // Velocity($target2, "transition.bounceIn", {duration: defaultOptions.duration, display: "inline"}); // // Velocity($target3, "transition.bounceOut", defaultOptions.duration); // // Velocity($target4, "transition.bounceOut", {duration: defaultOptions.duration, display: null}); // // $target5.style.visibility = "hidden"; // Velocity($target5, "transition.bounceIn", {duration: defaultOptions.duration, visibility: "visible"}); // // $target6.style.visibility = "visible"; // Velocity($target6, "transition.bounceOut", {duration: defaultOptions.duration, visibility: "hidden"}); assert.expect(8); setTimeout(function () { assert.notEqual(getPropertyValue($target3, "display"), 0, "Out: display not prematurely set to none."); assert.notEqual(getPropertyValue($target6, "visibility"), "hidden", "Out: visibility not prematurely set to hidden."); done(); }, asyncCheckDuration); setTimeout(function () { // assert.equal(getPropertyValue($target1, "display"), Values.getDisplayType($target1), "In: display set to default."); assert.equal(getPropertyValue($target2, "display"), "inline", "In: Custom inline value set."); assert.equal(getPropertyValue($target3, "display"), 0, "Out: display set to none."); // assert.equal(getPropertyValue($target4, "display"), Values.getDisplayType($target3), "Out: No display value set."); assert.equal(getPropertyValue($target5, "visibility"), "visible", "In: visibility set to visible."); assert.equal(getPropertyValue($target6, "visibility"), "hidden", "Out: visibility set to hidden."); done(); }, completeCheckDuration); }); QUnit.skip("RegisterEffect", function (assert) { // const done = assert.async(1), // effectDefaultDuration = 800; // // assert.expect(2); // Velocity.RegisterEffect("callout.twirl", { // defaultDuration: effectDefaultDuration, // calls: [ // [{rotateZ: 1080}, 0.5], // [{scaleX: 0.5}, 0.25, {easing: "spring"}], // [{scaleX: 1}, 0.25, {easing: "spring"}], // ], // }); // // const $target1 = getTarget(); // Velocity($target1, "callout.twirl"); // // setTimeout(() => { // assert.equal(parseFloat(getPropertyValue($target1, "rotateZ") as string), 1080, "First call's property animated."); // assert.equal(parseFloat(getPropertyValue($target1, "scaleX") as string), 1, "Last call's property animated."); // // done(); // }, effectDefaultDuration * 1.5); }); QUnit.skip("RunSequence", function (assert) { // // var done = assert.async(1), // $target1 = getTarget(), // $target2 = getTarget(), // $target3 = getTarget(), // mySequence = [ // {elements: $target1, properties: {opacity: defaultProperties.opacity}}, // {elements: $target2, properties: {height: defaultProperties.height}}, // { // elements: $target3, properties: {width: defaultProperties.width}, options: { // delay: 100, // sequenceQueue: false, // complete: function() { // assert.equal(parseFloat(getPropertyValue($target1, "opacity") as string), defaultProperties.opacity, "First call's property animated."); // assert.equal(parseFloat(getPropertyValue($target2, "height") as string), defaultProperties.height, "Second call's property animated."); // assert.equal(parseFloat(getPropertyValue($target3, "width") as string), defaultProperties.width, "Last call's property animated."); // // done(); // } // } // } // ]; // // assert.expect(3); // Velocity.RunSequence(mySequence); }); QUnit.module("Properties"); QUnit.skip("GenericReordering", function (assert) { // function genericReordering(element: HTMLorSVGElement, propertyValue?: string): string | void { // if (propertyValue === undefined) { // propertyValue = Velocity(element, "style", "textShadow"); // const split = propertyValue.split(/\s/g), // firstPart = split[0]; // let newValue = ""; // // if (Velocity.CSS.ColorNames[firstPart]) { // split.shift(); // split.push(firstPart); // newValue = split.join(" "); // } else if (firstPart.match(/^#|^hsl|^rgb|-gradient/)) { // const matchedString = propertyValue.match(/(hsl.*\)|#[\da-fA-F]+|rgb.*\)|.*gradient.*\))\s/g)[0]; // // newValue = propertyValue.replace(matchedString, "") + " " + matchedString.trim(); // } else { // newValue = propertyValue; // } // return newValue; // } // } // // Velocity("registerNormalization", "Element", "genericReordering", genericReordering); // // let tests = [ // { // test: "hsl(16, 100%, 66%) 1px 1px 1px", // result: "1px 1px 1px hsl(16, 100%, 66%)", // }, { // test: "-webkit-linear-gradient(red, yellow) 1px 1px 1px", // result: "1px 1px 1px -webkit-linear-gradient(rgba(255,0,0,1), rgba(255,255,0,1))", // }, { // test: "-o-linear-gradient(red, yellow) 1px 1px 1px", // result: "1px 1px 1px -o-linear-gradient(rgba(255,0,0,1), rgba(255,255,0,1))", // }, { // test: "-moz-linear-gradient(red, yellow) 1px 1px 1px", // result: "1px 1px 1px -moz-linear-gradient(rgba(255,0,0,1), rgba(255,255,0,1))", // }, { // test: "linear-gradient(red, yellow) 1px 1px 1px", // result: "1px 1px 1px linear-gradient(rgba(255,0,0,1), rgba(255,255,0,1))", // }, { // test: "red 1px 1px 1px", // result: "1px 1px 1px rgba(255,0,0,1)", // }, { // test: "#000000 1px 1px 1px", // result: "1px 1px 1px rgba(0,0,0,1)", // }, { // test: "rgb(0, 0, 0) 1px 1px 1px", // result: "1px 1px 1px rgba(0,0,0,1)", // }, { // test: "rgba(0, 0, 0, 1) 1px 1px 1px", // result: "1px 1px 1px rgba(0,0,0,1)", // }, { // test: "1px 1px 1px rgb(0, 0, 0)", // result: "1px 1px 1px rgba(0,0,0,1)", // }, // ]; // // for (let test of tests) { // let element = getTarget(); // // element.velocity("style", "textShadow", test.test); // assert.equal(element.velocity("style", "genericReordering"), test.result, test.test); // } }); QUnit.test("Display", function (assert) { var done = assert.async(5); Velocity(getTarget(), "style", "display", "none").velocity({ display: "block" }, { progress: once(function (elements) { assert.equal(elements.velocity("style", "display"), "block", "Display:'block' was set immediately."); done(); }) }); Velocity(getTarget(), "style", "display", "none").velocity("style", "display", "auto").then(function (elements) { assert.equal(elements[0].style.display, "block", "Display:'auto' was understood."); assert.equal(elements.velocity("style", "display"), "block", "Display:'auto' was cached as 'block'."); done(); }); Velocity(getTarget(), "style", "display", "none").velocity("style", "display", "").then(function (elements) { assert.equal(elements.velocity("style", "display"), "block", "Display:'' was reset correctly."); done(); }); Velocity(getTarget(), { display: "none" }, { progress: once(function (elements) { assert.notEqual(elements.velocity("style", "display"), "none", "Display:'none' was not set immediately."); done(); }) }).then(function (elements) { assert.equal(elements.velocity("style", "display"), "none", "Display:'none' was set upon completion."); done(); }); }); QUnit.test("Visibility", function (assert) { var done = assert.async(4); Velocity(getTarget(), "style", "visibility", "hidden").velocity({ visibility: "visible" }, { progress: once(function (elements) { assert.equal(elements.velocity("style", "visibility"), "visible", "Visibility:'visible' was set immediately."); done(); }) }); Velocity(getTarget(), "style", "visibility", "hidden").velocity("style", "visibility", "").then(function (elements) { // NOTE: The test elements inherit "hidden", so while illogical it // is in fact correct. assert.equal(elements.velocity("style", "visibility"), "hidden", "Visibility:'' was reset correctly."); done(); }); Velocity(getTarget(), { visibility: "hidden" }, { progress: once(function (elements) { assert.notEqual(elements.velocity("style", "visibility"), "visible", "Visibility:'hidden' was not set immediately."); done(); }) }).then(function (elements) { assert.equal(elements.velocity("style", "visibility"), "hidden", "Visibility:'hidden' was set upon completion."); done(); }); }); }))); //# sourceMappingURL=test.js.map ================================================ FILE: tsconfig.json ================================================ { "compilerOptions": { "allowUnreachableCode": true, "allowUnusedLabels": true, "alwaysStrict": false, "forceConsistentCasingInFileNames": true, "noEmitOnError": false, "noImplicitAny": false, "module": "es2015", "moduleResolution": "node", "outDir": "build/", "preserveConstEnums": true, "removeComments": false, "sourceMap": true, "target": "es6", "lib" : [ "dom", "es6", "es2016", "scripthost" ] }, "files": [ "src/velocity.ts", "src-ui/velocity.ui.ts", "test/src/test.ts" ] } ================================================ FILE: tslint.json ================================================ { "rules": { "adjacent-overload-signatures": true, "align": { "options": [ "parameters", "statements" ] }, "array-type": { "options": ["array"] }, "arrow-parens": true, "arrow-return-shorthand": true, "ban-types": { "options": [ ["Object", "Avoid using the `Object` type. Did you mean `object`?"], ["Function", "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."], ["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"], ["Number", "Avoid using the `Number` type. Did you mean `number`?"], ["String", "Avoid using the `String` type. Did you mean `string`?"], ["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"] ] }, "callable-types": true, "class-name": false, "comment-format": false, "completed-docs": false, "curly": true, "cyclomatic-complexity": false, "eofline": true, "file-header": [true, "velocity-animate \\(C\\) 2014"], "forin": true, "import-spacing": true, "indent": { "options": ["tabs"] }, "interface-name": false, "interface-over-type-literal": true, "jsdoc-format": true, "label-position": true, "max-classes-per-file": { "options": [1] }, "max-line-length": { "options": [180] }, "member-access": [true, "no-public"], "member-ordering": { "options": { "order": "statics-first" } }, "new-parens": true, "newline-before-return": true, "newline-per-chained-call": true, "no-angle-bracket-type-assertion": true, "no-any": false, "no-arg": true, "no-bitwise": true, "no-conditional-assignment": true, "no-consecutive-blank-lines": true, "no-console": false, "no-construct": true, "no-debugger": false, "no-default-export": true, "no-duplicate-super": true, "no-empty": true, "no-empty-interface": false, "no-eval": true, "no-internal-module": true, "no-invalid-this": true, "no-misused-new": true, "no-namespace": false, "no-parameter-properties": false, "no-redundant-jsdoc": false, "no-reference": true, "no-reference-import": true, "no-require-imports": true, "no-shadowed-variable": true, "no-string-literal": false, "no-string-throw": true, "no-switch-case-fall-through": false, "no-trailing-whitespace": true, "no-unnecessary-initializer": true, "no-unsafe-finally": true, "no-unused-expression": true, "no-use-before-declare": false, "no-var-keyword": true, "no-var-requires": true, "number-literal-format": true, "object-literal-key-quotes": { "options": ["consistent-as-needed"] }, "object-literal-shorthand": true, "object-literal-sort-keys": false, "one-line": true, "one-variable-per-declaration": false, "only-arrow-functions": { "options": [ "allow-declarations", "allow-named-functions" ] }, "ordered-imports": { "options": { "import-sources-order": "case-insensitive", "module-source-path": "full", "named-imports-order": "case-insensitive" } }, "prefer-const": true, "prefer-for-of": true, "prefer-switch": [true, { "min-cases": 2 }], "prefer-template": [true, "allow-single-concat"], "quotemark": { "options": [ "double", "avoid-escape" ] }, "radix": true, "semicolon": { "options": ["always"] }, "space-before-function-paren": { "options": { "anonymous": "never", "asyncArrow": "always", "constructor": "never", "method": "never", "named": "never" } }, "switch-final-break": [true, "always"], "trailing-comma": { "options": { "multiline": "always", "singleline": "never" } }, "triple-equals": { "options": ["allow-null-check"] }, "type-literal-delimiter": true, "typedef": false, "typedef-whitespace": { "options": [ { "call-signature": "nospace", "index-signature": "nospace", "parameter": "nospace", "property-declaration": "nospace", "variable-declaration": "nospace" }, { "call-signature": "onespace", "index-signature": "onespace", "parameter": "onespace", "property-declaration": "onespace", "variable-declaration": "onespace" } ] }, "unified-signatures": false, "use-isnan": true, "variable-name": { "options": [ "ban-keywords", "check-format", "allow-pascal-case" ] }, "whitespace": { "options": [ "check-branch", "check-decl", "check-operator", "check-separator", "check-type", "check-typecast" ] } } } ================================================ FILE: velocity.d.ts ================================================ /* * velocity-animate (C) 2014-2018 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. * * Velocity typings. */ /************** * Interfaces * **************/ /** * A single animation for a single element. This extends the strict options (ie, * after processing) to allow per-element options. Anything that is shared * between all elements in an animation will be under the `options` member. */ export interface AnimationCall extends StrictVelocityOptions { /** * Used to store the next AnimationCell in this list. * * @private */ _next?: AnimationCall; /** * Used to store the previous AnimationCell in this list. Used to make * removing items from the list significantly easier. * * @private */ _prev?: AnimationCall; /** * A number of flags for use in tracking an animation. */ _flags: number; /** * Properties to be tweened */ tweens?: {[property: string]: VelocityTween}; /** * The current value for the "tween" property, defaults to a percentage if * not used. */ tween?: string; /** * The element this specific animation is for. If there is more than one in * the elements list then this will be duplicated when it is pulled off a * queue. */ element?: HTMLorSVGElement; /** * The list of elements associated with this specific animation. * TODO: This should be removed so we're not trying to lock an element. * Without this entry, any removed elements will simply not exist in Data * (a WeakMap) and then can be removed from the list of animations. * @deprecated */ elements?: VelocityResult; /** * Shared options for the entire set of elements. */ options?: StrictVelocityOptions; /** * The time this animation started according to whichever clock we are * using. */ timeStart?: number; /** * The time (in ms) that this animation has already run. Used with the * duration and easing to provide the exact tween needed. */ ellapsedTime?: number; /** * The percentage complete as a number 0 <= n <= 1 */ percentComplete?: number; } /** * AnimationFlags are used internally. These are subject to change as they are * only valid for the internal state of the current version of Velocity. * * To get these values use the "option" action with a key of "isReady" etc. All * of these are gettable with the same pattern of keyname. * * @private */ export declare const enum AnimationFlags { /** * When the tweens are expanded this is set to save future processing. */ EXPANDED = 1 << 0, // tslint:disable-line:no-bitwise /** * Set once the animation is ready to start - after any delay (and possible * pause). */ READY = 1 << 1, // tslint:disable-line:no-bitwise /** * Set once the animation has started. */ STARTED = 1 << 2, // tslint:disable-line:no-bitwise /** * Set when an animation is manually stopped. */ STOPPED = 1 << 3, // tslint:disable-line:no-bitwise /** * The pause state of this animation. If true it is paused, if false it was * paused and needs to be resumed, and if undefined / null then not either. */ PAUSED = 1 << 4, // tslint:disable-line:no-bitwise /** * Set when the animation is a sync animation. */ SYNC = 1 << 5, // tslint:disable-line:no-bitwise /** * When the animation is running in reverse, such as for a loop. */ REVERSE = 1 << 6, // tslint:disable-line:no-bitwise } /** * Global per-Element data. This is persistent between animations, and freed * when the garbage collector removes the Element because it is no longer being * used. */ export interface ElementData { /** * A generated enum of types of this element, used for Normalizations. */ types: number; /** * A local cache of the current style values we're using, this is 80x faster * than element.style access. * * Empty strings are set to null to get the value from getComputedStyle * instead. If getComputedStyle returns an empty string then that is saved. */ cache: Properties; /** * A cached copy of getComputedStyle, this is 50% the speed of * element.style access. */ computedStyle?: CSSStyleDeclaration; /** * Changed as animations start and finish on an element. This allows us to * keep track of exactly how many are running at a given time. */ count: number; /** * Animations to be run for each queue. The animations are linked lists, * but treated as a FIFO queue (new ones are added to the end). When the * queue is empty (but still running) the key will still exist with a value * of "null". When the queue is empty and the next entry is pulled from it * then it will be set to "undefined". * * The default queue is an empty string - "" */ queueList: {[name: string]: AnimationCall}; /** * Last properties tweened per each queue. Used for both "reverse" and * "repeat" methods. */ lastAnimationList: {[name: string]: AnimationCall}; /** * The time the last animation on an element finished. This is used for * starting a new animation and making sure it follows directly if possible, * otherwise it will start as if one frame in already. */ lastFinishList: {[name: string]: number}; /** * The window used for this element. */ window: Window; } /** * Internal Sequence property value. */ export interface Sequence extends ReadonlyArray { /** * Pattern to use for tweening. */ pattern: ReadonlyArray; /** * Step value. */ [index: number]: TweenStep; } export interface SequenceList { duration: number; tweens: Properties; } /** * After correcting the options so they are usable internally, they will be of * this type. The base VelocityOptions includes human readable and shortcuts, * which this doesn't. */ export interface StrictVelocityOptions extends VelocityOptions, VelocityPromise { /** * Begin handler. Only the first element to check this callback gets to use * it. Cleared after calling * * @private */ begin?: VelocityCallbackFn; /** * Complete handler (only the last element in a set gets this) * * @private */ complete?: VelocityCallbackFn; /** * The amount of delay before this animation can start doing anything. */ delay?: number; /** * The length of time this animation will run for. */ duration?: number; /** * Easing for this animation while running. */ easing?: VelocityEasingFn; /** * Loop, calls 2n-1 times reversing it each iteration */ loop?: true | number; /** * TODO: Remove this so it's a normal property */ mobileHA?: boolean; /** * Progress handler (only the last element in a set gets this) * * @private */ progress?: VelocityProgressFn; /** * Queue */ queue?: false | string; /** * Repeat this number of times. If looped then each iteration of the loop * is actually repeated this number of times. */ repeat?: true | number; /** * This is a cache of the repeat value. When looping and repeating work * together, the repeat is looped, so it needs to remember how many repeats * to perform for each loop. */ repeatAgain?: true | number; /** * The first AnimationCall to get this - used for the progress callback. * * @private */ _first?: AnimationCall; /** * The total number of AnimationCalls that are pointing at this. * * @private */ _total?: number; /** * The number of AnimationCalls that are ready to start. * * @private */ _ready?: number; /** * The number of AnimationCalls that have started. * * @private */ _started?: number; /** * The number of AnimationCalls that have finished. * * @private */ _completed?: number; } /** * Internal list of values for a single Sequence data point. */ export interface TweenStep extends ReadonlyArray { /** * Percent of animation. */ percent?: number; /** * Easing function. */ easing?: VelocityEasingFn | null; /** * Values to tween and insert into pattern. */ [index: number]: string | number; } /** * Direct Velocity access. */ export interface Velocity { /** * Available to be able to check what version you're running against. */ readonly version: string; /** * Velocity option defaults, which can be overriden by the user. */ readonly defaults: VelocityOptions & { /** * Provided in order to reset Velocity defaults back to their initial * state. */ readonly reset: () => void; }; /** * Current internal state of Velocity. */ readonly State: VelocityState; /** * Actions cannot be replaced if they are internal (hasOwnProperty is false * but they still exist). Otherwise they can be replaced by users. * * All external method calls should be using actions rather than sub-calls * of Velocity itself. */ readonly Actions: {[name: string]: VelocityActionFn}; /** * Our known easing functions. */ readonly Easings: {[name: string]: VelocityEasingFn}; /** * The currently registered sequences. */ readonly Sequences: {[name: string]: SequenceList}; /** * Used to patch any object to allow Velocity chaining. In order to chain an * object must either be treatable as an array - with a .length * property, and each member a Node, or a Node directly. * * By default Velocity will try to patch window, * jQuery, Zepto, and several classes that return * Nodes or lists of Nodes. */ patch(proto: any, global?: boolean): void; /** * Set to true, 1 or 2 (most verbose) to output debug info to console. */ debug: boolean | 1 | 2; /** * In mock mode, all animations are forced to complete immediately upon the * next rAF tick. If there are further animations queued then they will each * take one single frame in turn. Loops and repeats will be disabled while * mock = true. */ mock: boolean; /******************** * Calling Velocity * ********************/ /** * Finish the running animations on the elements selected. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param queue The queue to finish. * @param finishAll Should this stop all queued animations too? */ (elements: T, action: "finish", queue?: string | false, finishAll?: true): VelocityResult; /** * Finish the running animations on the elements selected. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param finishAll Should this stop all queued animations too? */ (elements: T, action: "finish", finishAll?: true): VelocityResult; /** * Finish the running animations on this VelocityResult or on the elements * selected. * * @param queue The queue to finish. * @param finishAll Should this stop all queued animations too? */ (this: T, action: "finish", queue?: string | false, finishAll?: true): VelocityResult; /** * Finish the running animations on this VelocityResult or on the elements * selected. * * @param finishAll Should this stop all queued animations too? */ (this: T, action: "finish", finishAll?: true): VelocityResult; /** * Finish any running animations. * * @param queue The queue to finish. * @param finishAll Should this stop all queued animations too? */ (action: "finish", queue?: string | false, finishAll?: true): VelocityResult; /** * Finish any running animations. * * @param finishAll Should this stop all queued animations too? */ (action: "finish", finishAll?: true): VelocityResult; /** * Check if there is a normalisation handler for the named type of `Element` * and the named property. */ (this: T, action: "hasNormalization", constructor: {new: () => Element} | string, name: string): boolean; /** * Set the value of an option on a running animation. This performs some * validation on the named option as only some are available to set at * runtime. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param option The name of the option to get. * @param value The value to set it to. */ (elements: T, action: "option", option: string, value: any): VelocityResult; /** * Get the value of an option on a running animation. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param option The name of the option to get. */ (elements: T, action: "option", option: string): any; /** * Set the value of an option on a running animation. This performs some * validation on the named option as only some are available to set at * runtime. * * @param option The name of the option to get. * @param value The value to set it to. */ (this: T, action: "option", option: string, value: any): VelocityResult; /** * Get the value of an option on a running animation. * * @param option The name of the option to get. */ (this: T, action: "option", option: string): any; /** * Pause a currently running animation. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param queue The name of the queue to pause on it. */ (elements: T, action: "pause", queue?: string): VelocityResult; /** * Pause a currently running animation. * * @param queue The name of the queue to pause on it. */ (this: T, action: "pause", queue?: string): VelocityResult; /** * Pause all currently running animations. * * @param queue The name of the queue to pause on them. */ (action: "pause", queue?: string): VelocityResult; /** * Resume a currently paused animation. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param queue The name of the queue to resume on it. */ (elements: T, action: "resume", queue?: string): VelocityResult; /** * Resume a currently paused animation. * * @param queue The name of the queue to resume on it. */ (this: T, action: "resume", queue?: string): VelocityResult; /** * Resume all currently paused animations. * * @param queue The name of the queue to resume on them. */ (action: "resume", queue?: string): VelocityResult; /** * Register a new easing handler. * * @param name The name of the easing to add. * @param easing The function to call when this easing is used. */ (action: "registerEasing", name: string, easing: VelocityEasingFn): void; /** * Register a new normalization handler. This is the interface between * Velocity and the actual properties, so is responsible for reading and * writing any values on the `Element`. * * @param constructor The type of `Element`. If using ia string it will work * across iframe boundaries. * @param name The name of the property to provide. * @param normalization The function to call whenever this property is * accessed. * @param unit An optional unit string to add to any numeric values passed. * @param cache Set to false to prevent this property from being cached. */ (action: "registerNormalization", constructor: {new: () => Element} | string, name: string, normalization: VelocityNormalizationsFn, unit?: string, cache?: boolean): void; /** * Register a new normalization handler. This is the interface between * Velocity and the actual properties, so is responsible for reading and * writing any values on the `Element`. * * @param constructor The type of `Element`. If using ia string it will work * across iframe boundaries. * @param name The name of the property to provide. * @param normalization The function to call whenever this property is * accessed. * @param cache Set to false to prevent this property from being cached. */ (action: "registerNormalization", constructor: {new: () => Element} | string, name: string, normalization: VelocityNormalizationsFn, cache?: boolean): void; /** * Register a named animation sequence to be used elsewhere. * * @param name The sequence name. * @param sequence The animation steps to perform. */ (action: "registerSequence", name: string, sequence: VelocitySequence): void; /** * Register a named animation sequence to be used elsewhere. * * @param sequences Multiple named sequences to add. */ (action: "registerSequence", sequences: {[name: string]: VelocitySequence}): void; /** * Reverse the most recent animations on the supplied elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. */ (elements: T, action: "reverse", complete?: () => void): VelocityResult; /** * Reverse the most recent animations on the supplied elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param duration How long the animation should run in ms. * @param complete A function to call when finished. */ (elements: T, action: "reverse", duration?: number | "fast" | "normal" | "slow", complete?: () => void): VelocityResult; /** * Reverse the most recent animations on the supplied elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param duration How long the animation should run in ms. * @param easing The default easing to apply. * @param complete A function to call when finished. */ (elements: T, action: "reverse", duration?: number | "fast" | "normal" | "slow", easing?: string | number[], complete?: () => void): VelocityResult; /** * Reverse the most recent animations on the supplied elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param easing The default easing to apply. * @param complete A function to call when finished. */ (elements: T, action: "reverse", easing?: string | number[], complete?: () => void): VelocityResult; /** * Reverse the most recent animations on the supplied elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param options The options to apply. */ (elements: T, action: "reverse", options?: VelocityOptions): VelocityResult; /** * Stop without finishing the running animations on this VelocityResult or * on the elements selected. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param queue The queue to stop. * @param stopAll Should this stop all queued animations too? */ (elements: T, action: "stop", queue?: string | false, stopAll?: true): VelocityResult; /** * Stop without finishing the running animations on this VelocityResult or * on the elements selected. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param stopAll Should this stop all queued animations too? */ (elements: T, action: "stop", stopAll?: true): VelocityResult; /** * Stop without finishing the running animations on this VelocityResult or * on the elements selected. * * @param queue The queue to stop. * @param stopAll Should this stop all queued animations too? */ (this: T, action: "stop", queue?: string | false, stopAll?: true): VelocityResult; /** * Stop without finishing the running animations on this VelocityResult or * on the elements selected. * * @param stopAll Should this stop all queued animations too? */ (this: T, action: "stop", stopAll?: true): VelocityResult; /** * Get or set the value for a property that Velocity understands how to * access. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param property The name of the property to access. */ (elements: HTMLorSVGElement, action: "style" | "property", property: string): string; /** * Get or set the value for a property that Velocity understands how to * access. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param property The name of the property to access, or an object with * `name: value` pairs for setting. */ (elements: HTMLorSVGElement, action: "style" | "property", property: string[]): {[property: string]: string}[] | {[property: string]: string}; /** * Get or set the value for a property that Velocity understands how to * access. * * @param property The name of the property to access. */ (this: T, action: "style" | "property", property: string): string | string[]; /** * Get or set the value for a property that Velocity understands how to * access. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param property The name of the property to access. */ (elements: T, action: "style" | "property", property: string): string[]; /** * Get or set the value for a property that Velocity understands how to * access. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param property The name of the property to access, or an object with * `name: value` pairs for setting. */ (elements: T, action: "style" | "property", property: string[]): {[property: string]: string}[] | {[property: string]: string}[]; /** * Get or set the value for a property that Velocity understands how to * access. * * @param property The name of the property to access. * @param value The value to set the property to. */ (this: T, action: "style" | "property", property: string, value: string): VelocityResult; /** * Get or set the value for a property that Velocity understands how to * access. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param property The name of the property to access. * @param value The value to set the property to. */ (elements: T, action: "style" | "property", property: string, value: string): VelocityResult; /** * Get or set the value for a property that Velocity understands how to * access. * * @param property An object with `name: value` pairs for setting. */ (this: T, action: "style" | "property", property: {[property: string]: string}): VelocityResult; /** * Get or set the value for a property that Velocity understands how to * access. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param property An object with `name: value` pairs for setting. */ (elements: T, action: "style" | "property", property: {[property: string]: string}): VelocityResult; /** * Get the tween value for one or more elements using an animation at a * specific percentage complete. This does not animate the elements, just * obtains the values based on the current properties. * * @param percentComplete What specific percentage is needed (0 <= x <= 1) * @param property The property to animate. * @param value The end value or forcefed value. * @param easing The easing to use. */ (this: T, action: "tween", percentComplete: number, property: string, value: VelocityPropertyValue, easing?: VelocityEasingType): string; /** * Get the tween value for one or more elements using an animation at a * specific percentage complete. This does not animate the elements, just * obtains the values based on the current properties. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param percentComplete What specific percentage is needed (0 <= x <= 1) * @param property The property to animate. * @param value The end value or forcefed value. * @param easing The easing to use. */ (elements: T, action: "tween", percentComplete: number, property: string, value: VelocityPropertyValue, easing?: VelocityEasingType): string; /** * Get the tween value for one or more elements using an animation at a * specific percentage complete. This does not animate the elements, just * obtains the values based on the current properties. * * @param percentComplete What specific percentage is needed (0 <= x <= 1) * @param propertyMap The `key: value` property map to animate to. * @param easing The easing to use. */ (this: T, action: "tween", percentComplete: number, propertyMap: Properties, easing?: VelocityEasingType): Properties; /** * Get the tween value for one or more elements using an animation at a * specific percentage complete. This does not animate the elements, just * obtains the values based on the current properties. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param percentComplete What specific percentage is needed (0 <= x <= 1) * @param propertyMap The `key: value` property map to animate to. * @param easing The easing to use. */ (elements: T, action: "tween", percentComplete: number, propertyMap: Properties, easing?: VelocityEasingType): Properties; /** * Get the tween value for one or more elements using an animation at a * specific percentage complete. This does not animate the elements, just * obtains the values based on the current properties. * * When called on Velocity directly without any supplied elements, then the * values will be based on the `document.body` element. This can be useful * for simply finding the value for a forcefed animation. * * @param percentComplete What specific percentage is needed (0 <= x <= 1) * @param property The property to animate. * @param value The end value or forcefed value. * @param easing The easing to use. */ (action: "tween", percentComplete: number, property: string, value: VelocityPropertyValue, easing?: VelocityEasingType): string; /** * Get the tween value for one or more elements using an animation at a * specific percentage complete. This does not animate the elements, just * obtains the values based on the current properties. * * When called on Velocity directly without any supplied elements, then the * values will be based on the `document.body` element. This can be useful * for simply finding the value for a forcefed animation. * * @param percentComplete What specific percentage is needed (0 <= x <= 1) * @param propertyMap The `key: value` property map to animate to. * @param easing The easing to use. */ (action: "tween", percentComplete: number, propertyMap: Properties, easing?: VelocityEasingType): Properties; /** * Call Velocity with a single object containing all the necessary options. * * @param options An object containing the `elements`, `options`, and * `properties` to use. */ (options: VelocityObjectArgs): VelocityResult; /** * Call velocity on one or more elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param options The options to apply to the animation. This overrides the * default and any supplied in a sequence. */ (elements: T, propertyMap: string | Properties, options?: VelocityOptions): VelocityResult; /** * Call velocity on one or more elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param duration The length of time to run animation in ms (1000/s). * @param complete A function to call when the animation is finished. */ (elements: T, propertyMap: string | Properties, duration?: number | "fast" | "normal" | "slow", complete?: () => void): VelocityResult; /** * Call velocity on one or more elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param complete A function to call when the animation is finished. */ (elements: T, propertyMap: string | Properties, complete?: () => void): VelocityResult; /** * Call velocity on one or more elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param easing The easing to use for this animation. * @param complete A function to call when the animation is finished. */ (elements: T, propertyMap: string | Properties, easing?: string | number[], complete?: () => void): VelocityResult; /** * Call velocity on one or more elements. * * @param elements An `Element`, or an array-like list of `Elements` to * process. * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param duration The length of time to run animation in ms (1000/s). * @param easing The easing to use for this animation. * @param complete A function to call when the animation is finished. */ (elements: T, propertyMap: string | Properties, duration?: number | "fast" | "normal" | "slow", easing?: string | number[], complete?: () => void): VelocityResult; /** * Call velocity on one or more elements. * * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param options The options to apply to the animation. This overrides the * default and any supplied in a sequence. */ (this: T, propertyMap: string | Properties, options?: VelocityOptions): VelocityResult; /** * Call velocity on one or more elements. * * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param duration The length of time to run animation in ms (1000/s). * @param complete A function to call when the animation is finished. */ (this: T, propertyMap: string | Properties, duration?: number | "fast" | "normal" | "slow", complete?: () => void): VelocityResult; /** * Call velocity on one or more elements. * * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param complete A function to call when the animation is finished. */ (this: T, propertyMap: string | Properties, complete?: () => void): VelocityResult; /** * Call velocity on one or more elements. * * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param easing The easing to use for this animation. * @param complete A function to call when the animation is finished. */ (this: T, propertyMap: string | Properties, easing?: string | number[], complete?: () => void): VelocityResult; /** * Call velocity on one or more elements. * * @param propertyMap The `key: value` property map to animate to, or a * named sequence to use. * @param duration The length of time to run animation in ms (1000/s). * @param easing The easing to use for this animation. * @param complete A function to call when the animation is finished. */ (this: T, propertyMap: string | Properties, duration?: number | "fast" | "normal" | "slow", easing?: string | number[], complete?: () => void): VelocityResult; } /** * Add any easings to this interface to have them picked up by the Easings type. */ export interface VelocityEasings { "at-end": true; "at-start": true; "during": true; "ease": true; "ease-in": true; "ease-in-out": true; "ease-out": true; "easeIn": true; "easeInBack": true; "easeInBounce": true; "easeInCirc": true; "easeInCubic": true; "easeInElastic": true; "easeInExpo": true; "easeInOut": true; "easeInOutBack": true; "easeInOutBounce": true; "easeInOutCirc": true; "easeInOutCubic": true; "easeInOutElastic": true; "easeInOutExpo": true; "easeInOutQuad": true; "easeInOutQuart": true; "easeInOutQuint": true; "easeInOutSine": true; "easeInQuad": true; "easeInQuart": true; "easeInQuint": true; "easeInSine": true; "easeOut": true; "easeOutBack": true; "easeOutBounce": true; "easeOutCirc": true; "easeOutCubic": true; "easeOutElastic": true; "easeOutExpo": true; "easeOutQuad": true; "easeOutQuart": true; "easeOutQuint": true; "easeOutSine": true; "linear": true; "spring": true; "swing": true; } /** * Chaining Velocity calls from various sources. */ export interface VelocityExtended { /** * This is the Velocity chaining method. It is functionally equivalent to * the normal Velocity call, but allows chaining on the elements it is * attached to. */ readonly velocity: Velocity; } /** * This is used for CoffeeScript shortcuts apparently. Kept for legacy reasons. * * TODO: I don't like having two of these - need to merge into a type or similar */ export interface VelocityObjectArgs { elements?: HTMLorSVGElement[]; properties?: Properties; options?: VelocityOptions; e?: HTMLorSVGElement[]; p?: Properties; o?: VelocityOptions; } /** * Options passed to a new Velocity animation. These are validated and copied * into a StrictVelocityOptions object. */ export interface VelocityOptions { backwards?: boolean; /** * Begin handler. Only the first element to check this callback gets to use * it. * * default: undefined */ begin?: VelocityCallbackFn; /** * Complete handler (only the last element in a set gets this). * * default: undefined */ complete?: VelocityCallbackFn; /** * How long the animation should delay after becoming active and before it * actually starts to animate. This is a millisecond timer, but * can handle some string values. * "fast" = 200ms * "normal" = 400ms * "slow" = 600ms * NOTE: If passing a negative number then this will allow you to start with * the animation partially complete from the start. * * default 0 */ delay?: "fast" | "normal" | "slow" | number; /** * Reduce the duration of each successive element so they drag into final * state. The first quarter of the elements will get a reduced duration (ie. * they will finish faster) in a smooth way. */ drag?: boolean; /** * How long the animation should run for. This is a millisecond timer, but * can handle some string values. * "fast" = 200ms * "normal" = 400ms (default) * "slow" = 600ms * * default 400 */ duration?: "fast" | "normal" | "slow" | number; /** * Easing is the rate of change over time for an animation. A linear easing * would simply be 1% of the time to 1% of the animation. This allows you * to specify how that rate of change should be. There are various named * easings, but you can also supply your own. * * TODO: Copy more of the original description * * default "swing" */ easing?: VelocityEasingType; /** * Maximum number of frames to render on each second for all animations * * default 60 */ fpsLimit?: number; /** * How many times should this option loop. A loop is defined as a "return to * start values", so it will run, then reverse. This counts as a single * loop. Setting loop:4 will cause the animation to take the * same time as 4n+1 iterations. * * default 0 */ loop?: boolean | number; /** * The minimum frame time to achieve, the value is calculated based on fpsLimit * * default 16.33333333 (1000ms / 60fps) */ minFrameTime?: number; /** * Not currently implemented. * * @deprecated */ mobileHA?: boolean; /** * Progress handler (only the last element in a set gets this) * * default: undefined */ progress?: VelocityProgressFn; /** * If this should return a Promise with everything else. If promises are not * required at all, then simply setting it globally will turn them off. * * default true */ promise?: boolean; /** * If promises are turned on, then the promise can reject if there are no * elements supplied (an empty array is still valid). * * default false */ promiseRejectEmpty?: boolean; /** * The name of the queue to use. If this is set to false then * it will be added immediately ignoring any other queues running. Queues * start playing automatically (unlike jQuery, this doesn't need a queue to * be manually started). * * default "" */ queue?: false | string; /** * How many times should this animation repeat. A repeat will restart at * initial values and animate once. This is most useful for rotating * animations where 0deg === 360deg. If you are after a more * "bounce" effect then look at loop. * * default 0 */ repeat?: boolean | number; /** * The speed to play the animation back at. This number can change while * running, in order to vary the playback rate. * * default 0 */ speed?: number; /** * Supply a delay in ms, and every element in the animation will get this * delay multiplied by its index added to it. */ stagger?: number | VelocityOptionFn; /** * When adding animations to elements each element has its own queue of * pending animations. This ensures that when adding a single animation to * multiple elements, they all begin at the same time. * * default true */ sync?: boolean; /** * Should the cache be used for the tweens. Turning this off can improve * memory usage slightly, but will also make things slower when creating * animations. * * @private * default true */ cache?: boolean; } /** * Used internally for storing the Promise if used. */ export interface VelocityPromise { /** * A saved copy of the Promise. * * @private */ _promise?: Promise; /** * This method is called at most once to signify that the animation has * completed. Currently a loop:true animation will never complete. This * allows .then(fn) to run (see Promise support). * * @private */ _resolver?: (value?: (VelocityResult) | PromiseLike) => void; /** * This method is called at most once to signify that the animation has * completed. Currently a loop:true animation will never complete. This * allows .then(fn) to run (see Promise support). * * @private */ _rejecter?: (reason?: any) => void; } /** * The return type of any velocity call. If this is called via a "utility" * function (such a jQuery $(elements).velocity(...)) then it will * be based on the array-like list of elements supplied, otherwise it will * create a plain array. The extra values for Promises and Velocity are inserted * into the array in such a way as to not interfere with other methods unless * they are specifically overwriting them. */ export interface VelocityResult extends Array, Partial>> { /** * This is the actual Promise used by Velocity. If using Promise.all() or * similar methods then you may need to use this instead of the Velocity * result itself. */ readonly promise?: Promise>; /** * This is the Velocity chaining method. It is functionally equivalent to * the normal Velocity call, but allows chaining on the elements it is * attached to. */ readonly velocity?: Velocity & { /** * These are the animation objects attached to this specific chain. This * is used in some actions to allow the call to only touch the specific * animations called rather than just the animations on the linked * elements. * * TODO: Decide if this should be public * @private */ readonly animations?: AnimationCall[]; }; } /** * Container for page-wide Velocity state data. */ export interface VelocityState { /** * Detect if this is a NodeJS or web browser */ readonly isClient: boolean; /** * Detect mobile devices to determine if mobileHA should be turned * on. */ readonly isMobile: boolean; /** * The mobileHA option's behavior changes on older Android devices * (Gingerbread, versions 2.3.3-2.3.7). */ readonly isGingerbread: boolean; /** * Create a cached element for re-use when checking for CSS property * prefixes. */ readonly prefixElement?: HTMLDivElement; /** * Retrieve the appropriate scroll anchor and property name for the * browser: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */ readonly windowScrollAnchor: boolean; /** * Cache the anchor used for animating window scrolling. */ readonly scrollAnchor: Window | HTMLElement | Node | boolean; /** * Cache the browser-specific property names associated with the * scroll anchor. */ readonly scrollPropertyLeft: string; /** * Cache the browser-specific property names associated with the * scroll anchor. */ readonly scrollPropertyTop: string; /** * The className we add / remove when animating. */ readonly className: string; /** * Keep track of whether our RAF tick is running. * * @private */ isTicking: boolean; /** * Container for every in-progress call to Velocity. * * @private */ first?: AnimationCall; /** * Container for every in-progress call to Velocity. * * @private */ last?: AnimationCall; /** * First new animation - to shortcut starting them all up and push * any css reads to the start of the tick. * * @private */ firstNew?: AnimationCall; } /** * Internal Sequence per property. */ export interface VelocityTween { /** * Normalization function - cached at animation creation time. */ fn: VelocityNormalizationsFn; /** * Sequence to use for tweening (excludes pattern). */ sequence?: Sequence; /** * Easing function to use for entire tween. */ easing?: VelocityEasingFn; /** * Start value. */ start?: string; /** * End value. */ end?: string; } /********* * Types * *********/ /** * Velocity can run on both HTML and SVG elements. */ export type HTMLorSVGElement = HTMLElement | SVGElement; /** * The properties that are permitted to be animated. * TODO: Add SVG and "Tween" properties. Should (can?) this get html / svg specifics later */ export type Properties = { "clientHeight"?: T; "clientWidth"?: T; "innerHeight"?: T; "innerWidth"?: T; "outerHeight"?: T; "outerWidth"?: T; "scroll"?: T; "scrollHeight"?: T; "scrollLeft"?: T; "scrollTop"?: T; "scrollWidth"?: T; "tween"?: T; } & { // "style" normalizations [property in keyof CSSStyleDeclaration]?: T; }; /** * Used for action callbacks. These are the commands such as `"pause"` and * `"stop"` * * @param args The arguments passed to Velocity when calling this action. They * start as the first argument passed after the name of the action. * @param elements Any elements this action is being called on. This may be * null, in which case it is being called without any. * @param promiseHandler The action should resolve or reject the promise as * needed. * @param action The name of the action before any dot (used for sub-actions). */ export type VelocityActionFn = ( args?: any[], elements?: VelocityResult, promiseHandler?: VelocityPromise, action?: string) => any; /** * A callback used for the `begin` or `complete` callbacks of an animation. * * @param elements The elements being animated. * @param activeCall The animation being performed. */ export type VelocityCallbackFn = ( this: VelocityResult, elements?: VelocityResult, activeCall?: AnimationCall) => void; /** * All easings must return the current value given the start and end values, and * a percentage complete. The property name is also passed in case that makes a * difference to how values are used. * * @param percentComplete Between 0 and 1 inclusive. * @param startValue The value at 0. * @param endValue The value at 1. * @param property The property name. */ export type VelocityEasingFn = ( percentComplete: number, startValue: number, endValue: number, property?: string) => number; /** * List of all easing types for easy code completion in TypeScript */ export type VelocityEasingType = VelocityEasingFn | keyof VelocityEasings | string // Need to leave in to prevent errors. | [number] | [number, number] | [number, number, number, number] | number[]; // Need to leave in to prevent errors. /** * The various formats of Element argument for Velocity. Some libraries such as * jQuery and Zepto provide an array-like */ export type VelocityElements = HTMLorSVGElement | HTMLorSVGElement[]; /** * Used for normalization callbacks. * * @param element The element to be called on. * @param propertyValue The value to set. If undefined then this is * a get action and must return a string value for that element. * * @returns When getting a value it must return a string, otherwise the return * value is ignored. */ export type VelocityNormalizationsFn = (( element: HTMLorSVGElement, propertyValue: string) => void) & (( element: HTMLorSVGElement) => string); /** * A callback to allow us to generate an option value. */ export type VelocityOptionFn = ( this: HTMLorSVGElement, index?: number, total?: number, elements?: VelocityElements, option?: string) => T; /** * A callback used for progress tracking. */ export type VelocityProgressFn = ( this: VelocityResult, elements?: VelocityResult, percentComplete?: number, remaining?: number, tweenValue?: number, activeCall?: AnimationCall) => void; /** * Shortcut property type for HTML Elements. */ export type VelocityProperties = Properties; /** * A property value can be a string or a number. If it is a number then it will * get the correct unit added to it depending on the property name if required. */ export type VelocityProperty = VelocityPropertyValue | VelocityPropertyFn; /** * A callback to allow us to generate a property value for a property name. */ export type VelocityPropertyFn = ( this: HTMLorSVGElement, index?: number, total?: number, elements?: VelocityElements) => VelocityPropertyValue; /** * A property value can be a string or a number. If it is a number then it will * get the correct unit added to it depending on the property name if required. */ export type VelocityPropertyValue = number | string | [number | string] | [number | string, VelocityEasingType | number | string] | [number | string, VelocityEasingType, number | string]; /** * A callback to allow us to generate a property start / end value. */ export type VelocityPropertyValueFn = ( this: HTMLorSVGElement, index?: number, total?: number, propertyName?: string) => number | string; /** * Public Sequence definition. */ export type VelocitySequence = { duration?: number; easing?: VelocityEasingType; [percent: number]: Properties; } | { [percent: string]: Properties; }; // Needs to be like this to prevent warnings. /** * Public property value for a Sequence. */ export type VelocitySequenceProperty = string | [string] | [string, VelocityEasingType]; /****************** * Global extends * ******************/ declare global { /** * Extend the return value from document.querySelectorAll(). */ export interface NodeListOf extends VelocityExtended> {} /** * Extend Element directly. */ export interface Element extends VelocityExtended {} /** * Extend Element directly. */ export interface HTMLCollection extends VelocityExtended {} } /***************** * Global access * *****************/ export default Velocity; export declare const Velocity: Velocity; ================================================ FILE: velocity.es5.js ================================================ /** * velocity-animate (C) 2014-2017 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var defineProperty = function (obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }; /** * Check if a variable is a boolean. */ function isBoolean(variable) { return variable === true || variable === false; } /** * Check if a variable is a function. */ function isFunction(variable) { return Object.prototype.toString.call(variable) === "[object Function]"; } /** * Check if a variable is an HTMLElement or SVGElement. */ function isNode(variable) { return !!(variable && variable.nodeType); } /** * Check if a variable is a number. */ function isNumber(variable) { return typeof variable === "number"; } /** * Check if a variable is a plain object (and not an instance). */ function isPlainObject(variable) { if (!variable || (typeof variable === "undefined" ? "undefined" : _typeof(variable)) !== "object" || variable.nodeType || Object.prototype.toString.call(variable) !== "[object Object]") { return false; } var proto = Object.getPrototypeOf(variable); return !proto || proto.hasOwnProperty("constructor") && proto.constructor === Object; } /** * Check if a variable is a string. */ function isString(variable) { return typeof variable === "string"; } /** * Check if a variable is the result of calling Velocity. */ function isVelocityResult(variable) { return variable && isNumber(variable.length) && isFunction(variable.velocity); } /** * Check if a variable is an array-like wrapped jQuery, Zepto or similar, where * each indexed value is a Node. */ function isWrapped(variable) { return variable && variable !== window && isNumber(variable.length) && !isString(variable) && !isFunction(variable) && !isNode(variable) && (variable.length === 0 || isNode(variable[0])); } /** * Check is a property is an enumerable member of an object. */ function propertyIsEnumerable(obj, property) { return Object.prototype.propertyIsEnumerable.call(obj, property); } // Project /** * Add a single className to an Element. */ function addClass(element, className) { if (element instanceof Element) { if (element.classList) { element.classList.add(className); } else { removeClass(element, className); element.className += (element.className.length ? " " : "") + className; } } } /** * Clone an array, works for array-like too. */ function cloneArray(arrayLike) { return Array.prototype.slice.call(arrayLike, 0); } /** * The defineProperty() function provides a * shortcut to defining a property that cannot be accidentally iterated across. */ function defineProperty$1(proto, name, value, readonly) { if (proto) { Object.defineProperty(proto, name, { configurable: !readonly, writable: !readonly, value: value }); } } /** * When there are multiple locations for a value pass them all in, then get the * first value that is valid. */ function getValue() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var arg = _step.value; if (arg !== undefined && arg === arg) { return arg; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } /** * Shim to get the current milliseconds - on anything except old IE it'll use * Date.now() and save creating an object. If that doesn't exist then it'll * create one that gets GC. */ var now = Date.now ? Date.now : function () { return new Date().getTime(); }; /** * Remove a single className from an Element. */ function removeClass(element, className) { if (element instanceof Element) { if (element.classList) { element.classList.remove(className); } else { // TODO: Need some jsperf tests on performance - can we get rid of the regex and maybe use split / array manipulation? element.className = element.className.replace(new RegExp("(^|\\s)" + className + "(\\s|$)", "gi"), " "); } } } // Project // Constants var Actions = {}; /** * Used to register an action. This should never be called by users * directly, instead it should be called via an action:
      * Velocity("registerAction", "name", VelocityActionFn); */ function registerAction(args, internal) { var name = args[0], callback = args[1]; if (!isString(name)) { console.warn("VelocityJS: Trying to set 'registerAction' name to an invalid value:", name); } else if (!isFunction(callback)) { console.warn("VelocityJS: Trying to set 'registerAction' callback to an invalid value:", name, callback); } else if (Actions[name] && !propertyIsEnumerable(Actions, name)) { console.warn("VelocityJS: Trying to override internal 'registerAction' callback", name); } else if (internal === true) { defineProperty$1(Actions, name, callback); } else { Actions[name] = callback; } } registerAction(["registerAction", registerAction], true); /** * Without this it will only un-prefix properties that have a valid "normal" * version. */ var DURATION_FAST = 200; var DURATION_NORMAL = 400; var DURATION_SLOW = 600; var FUZZY_MS_PER_SECOND = 980; var DEFAULT_CACHE = true; var DEFAULT_DELAY = 0; var DEFAULT_DURATION = DURATION_NORMAL; var DEFAULT_EASING = "swing"; var DEFAULT_FPSLIMIT = 60; var DEFAULT_LOOP = 0; var DEFAULT_PROMISE = true; var DEFAULT_PROMISE_REJECT_EMPTY = true; var DEFAULT_QUEUE = ""; var DEFAULT_REPEAT = 0; var DEFAULT_SPEED = 1; var DEFAULT_SYNC = true; var CLASSNAME = "velocity-animating"; var Duration = { fast: DURATION_FAST, normal: DURATION_NORMAL, slow: DURATION_SLOW }; // Project // Constants var Easings = {}; /** * Used to register a easing. This should never be called by users * directly, instead it should be called via an action:
      * Velocity("registerEasing", "name", VelocityEasingFn); */ function registerEasing(args) { var name = args[0], callback = args[1]; if (!isString(name)) { console.warn("VelocityJS: Trying to set 'registerEasing' name to an invalid value:", name); } else if (!isFunction(callback)) { console.warn("VelocityJS: Trying to set 'registerEasing' callback to an invalid value:", name, callback); } else if (Easings[name]) { console.warn("VelocityJS: Trying to override 'registerEasing' callback", name); } else { Easings[name] = callback; } } registerAction(["registerEasing", registerEasing], true); /** * Linear easing, used for sequence parts that don't have an actual easing * function. */ function linearEasing(percentComplete, startValue, endValue, property) { return startValue + percentComplete * (endValue - startValue); } /** * Swing is the default for jQuery and Velocity. */ function swingEasing(percentComplete, startValue, endValue) { return startValue + (0.5 - Math.cos(percentComplete * Math.PI) / 2) * (endValue - startValue); } /** * A less exaggerated version of easeInOutElastic. */ function springEasing(percentComplete, startValue, endValue) { return startValue + (1 - Math.cos(percentComplete * 4.5 * Math.PI) * Math.exp(-percentComplete * 6)) * (endValue - startValue); } registerEasing(["linear", linearEasing]); registerEasing(["swing", swingEasing]); registerEasing(["spring", springEasing]); // Project /** * Fix to a range of 0 <= num <= 1. */ function fixRange(num) { return Math.min(Math.max(num, 0), 1); } function A(aA1, aA2) { return 1 - 3 * aA2 + 3 * aA1; } function B(aA1, aA2) { return 3 * aA2 - 6 * aA1; } function C(aA1) { return 3 * aA1; } function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; } function getSlope(aT, aA1, aA2) { return 3 * A(aA1, aA2) * aT * aT + 2 * B(aA1, aA2) * aT + C(aA1); } function generateBezier() { var NEWTON_ITERATIONS = 4, NEWTON_MIN_SLOPE = 0.001, SUBDIVISION_PRECISION = 0.0000001, SUBDIVISION_MAX_ITERATIONS = 10, kSplineTableSize = 11, kSampleStepSize = 1 / (kSplineTableSize - 1), float32ArraySupported = "Float32Array" in window; /* Must contain four args. */ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (args.length !== 4) { return; } /* Args must be numbers. */ for (var i = 0; i < 4; ++i) { if (typeof args[i] !== "number" || isNaN(args[i]) || !isFinite(args[i])) { return; } } /* X values must be in the [0, 1] range. */ var mX1 = fixRange(args[0]); var mY1 = args[1]; var mX2 = fixRange(args[2]); var mY2 = args[3]; var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); function newtonRaphsonIterate(aX, aGuessT) { for (var _i = 0; _i < NEWTON_ITERATIONS; ++_i) { var currentSlope = getSlope(aGuessT, mX1, mX2); if (currentSlope === 0) { return aGuessT; } var currentX = calcBezier(aGuessT, mX1, mX2) - aX; aGuessT -= currentX / currentSlope; } return aGuessT; } function calcSampleValues() { for (var _i2 = 0; _i2 < kSplineTableSize; ++_i2) { mSampleValues[_i2] = calcBezier(_i2 * kSampleStepSize, mX1, mX2); } } function binarySubdivide(aX, aA, aB) { var currentX = void 0, currentT = void 0, i = 0; do { currentT = aA + (aB - aA) / 2; currentX = calcBezier(currentT, mX1, mX2) - aX; if (currentX > 0) { aB = currentT; } else { aA = currentT; } } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); return currentT; } function getTForX(aX) { var lastSample = kSplineTableSize - 1; var intervalStart = 0, currentSample = 1; for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { intervalStart += kSampleStepSize; } --currentSample; var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), guessForT = intervalStart + dist * kSampleStepSize, initialSlope = getSlope(guessForT, mX1, mX2); if (initialSlope >= NEWTON_MIN_SLOPE) { return newtonRaphsonIterate(aX, guessForT); } else if (initialSlope === 0) { return guessForT; } else { return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); } } var precomputed = false; function precompute() { precomputed = true; if (mX1 !== mY1 || mX2 !== mY2) { calcSampleValues(); } } var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")", f = function f(percentComplete, startValue, endValue, property) { if (!precomputed) { precompute(); } if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } if (mX1 === mY1 && mX2 === mY2) { return startValue + percentComplete * (endValue - startValue); } return startValue + calcBezier(getTForX(percentComplete), mY1, mY2) * (endValue - startValue); }; f.getControlPoints = function () { return [{ x: mX1, y: mY1 }, { x: mX2, y: mY2 }]; }; f.toString = function () { return str; }; return f; } /* Common easings */ var easeIn = generateBezier(0.42, 0, 1, 1), easeOut = generateBezier(0, 0, 0.58, 1), easeInOut = generateBezier(0.42, 0, 0.58, 1); registerEasing(["ease", generateBezier(0.25, 0.1, 0.25, 1)]); registerEasing(["easeIn", easeIn]); registerEasing(["ease-in", easeIn]); registerEasing(["easeOut", easeOut]); registerEasing(["ease-out", easeOut]); registerEasing(["easeInOut", easeInOut]); registerEasing(["ease-in-out", easeInOut]); registerEasing(["easeInSine", generateBezier(0.47, 0, 0.745, 0.715)]); registerEasing(["easeOutSine", generateBezier(0.39, 0.575, 0.565, 1)]); registerEasing(["easeInOutSine", generateBezier(0.445, 0.05, 0.55, 0.95)]); registerEasing(["easeInQuad", generateBezier(0.55, 0.085, 0.68, 0.53)]); registerEasing(["easeOutQuad", generateBezier(0.25, 0.46, 0.45, 0.94)]); registerEasing(["easeInOutQuad", generateBezier(0.455, 0.03, 0.515, 0.955)]); registerEasing(["easeInCubic", generateBezier(0.55, 0.055, 0.675, 0.19)]); registerEasing(["easeOutCubic", generateBezier(0.215, 0.61, 0.355, 1)]); registerEasing(["easeInOutCubic", generateBezier(0.645, 0.045, 0.355, 1)]); registerEasing(["easeInQuart", generateBezier(0.895, 0.03, 0.685, 0.22)]); registerEasing(["easeOutQuart", generateBezier(0.165, 0.84, 0.44, 1)]); registerEasing(["easeInOutQuart", generateBezier(0.77, 0, 0.175, 1)]); registerEasing(["easeInQuint", generateBezier(0.755, 0.05, 0.855, 0.06)]); registerEasing(["easeOutQuint", generateBezier(0.23, 1, 0.32, 1)]); registerEasing(["easeInOutQuint", generateBezier(0.86, 0, 0.07, 1)]); registerEasing(["easeInExpo", generateBezier(0.95, 0.05, 0.795, 0.035)]); registerEasing(["easeOutExpo", generateBezier(0.19, 1, 0.22, 1)]); registerEasing(["easeInOutExpo", generateBezier(1, 0, 0, 1)]); registerEasing(["easeInCirc", generateBezier(0.6, 0.04, 0.98, 0.335)]); registerEasing(["easeOutCirc", generateBezier(0.075, 0.82, 0.165, 1)]); registerEasing(["easeInOutCirc", generateBezier(0.785, 0.135, 0.15, 0.86)]); /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ function springAccelerationForState(state) { return -state.tension * state.x - state.friction * state.v; } function springEvaluateStateWithDerivative(initialState, dt, derivative) { var state = { x: initialState.x + derivative.dx * dt, v: initialState.v + derivative.dv * dt, tension: initialState.tension, friction: initialState.friction }; return { dx: state.v, dv: springAccelerationForState(state) }; } function springIntegrateState(state, dt) { var a = { dx: state.v, dv: springAccelerationForState(state) }, b = springEvaluateStateWithDerivative(state, dt * 0.5, a), c = springEvaluateStateWithDerivative(state, dt * 0.5, b), d = springEvaluateStateWithDerivative(state, dt, c), dxdt = 1 / 6 * (a.dx + 2 * (b.dx + c.dx) + d.dx), dvdt = 1 / 6 * (a.dv + 2 * (b.dv + c.dv) + d.dv); state.x = state.x + dxdt * dt; state.v = state.v + dvdt * dt; return state; } function generateSpringRK4(tension, friction, duration) { var initState = { x: -1, v: 0, tension: parseFloat(tension) || 500, friction: parseFloat(friction) || 20 }, path = [0], tolerance = 1 / 10000, DT = 16 / 1000, haveDuration = duration != null; // deliberate "==", as undefined == null != 0 var timeLapsed = 0, dt = void 0, lastState = void 0; /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ if (haveDuration) { /* Run the simulation without a duration. */ timeLapsed = generateSpringRK4(initState.tension, initState.friction); /* Compute the adjusted time delta. */ dt = timeLapsed / duration * DT; } else { dt = DT; } while (true) { /* Next/step function .*/ lastState = springIntegrateState(lastState || initState, dt); /* Store the position. */ path.push(1 + lastState.x); timeLapsed += 16; /* If the change threshold is reached, break. */ if (!(Math.abs(lastState.x) > tolerance && Math.abs(lastState.v) > tolerance)) { break; } } /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the computed path and returns a snapshot of the position according to a given percentComplete. */ return !haveDuration ? timeLapsed : function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return startValue + path[Math.floor(percentComplete * (path.length - 1))] * (endValue - startValue); }; } // Constants var cache = {}; function generateStep(steps) { var fn = cache[steps]; if (fn) { return fn; } return cache[steps] = function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return startValue + Math.round(percentComplete * steps) * (1 / steps) * (endValue - startValue); }; } // Project /** * Parse a duration value and return an ms number. Optionally return a * default value if the number is not valid. */ function parseDuration(duration, def) { if (isNumber(duration)) { return duration; } if (isString(duration)) { return Duration[duration.toLowerCase()] || parseFloat(duration.replace("ms", "").replace("s", "000")); } return def == null ? undefined : parseDuration(def); } /** * Validate a cache option. */ function validateCache(value) { if (isBoolean(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'cache' to an invalid value:", value); } } /** * Validate a begin option. */ function validateBegin(value) { if (isFunction(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'begin' to an invalid value:", value); } } /** * Validate a complete option. */ function validateComplete(value, noError) { if (isFunction(value)) { return value; } if (value != null && !noError) { console.warn("VelocityJS: Trying to set 'complete' to an invalid value:", value); } } /** * Validate a delay option. */ function validateDelay(value) { var parsed = parseDuration(value); if (!isNaN(parsed)) { return parsed; } if (value != null) { console.error("VelocityJS: Trying to set 'delay' to an invalid value:", value); } } /** * Validate a duration option. */ function validateDuration(value, noError) { var parsed = parseDuration(value); if (!isNaN(parsed) && parsed >= 0) { return parsed; } if (value != null && !noError) { console.error("VelocityJS: Trying to set 'duration' to an invalid value:", value); } } /** * Validate a easing option. */ function validateEasing(value, duration, noError) { if (isString(value)) { // Named easing return Easings[value]; } if (isFunction(value)) { return value; } // TODO: We should only do these if the correct function exists - don't force loading. if (Array.isArray(value)) { if (value.length === 1) { // Steps return generateStep(value[0]); } if (value.length === 2) { // springRK4 must be passed the animation's duration. // Note: If the springRK4 array contains non-numbers, // generateSpringRK4() returns an easing function generated with // default tension and friction values. return generateSpringRK4(value[0], value[1], duration); } if (value.length === 4) { // Note: If the bezier array contains non-numbers, generateBezier() // returns undefined. return generateBezier.apply(null, value) || false; } } if (value != null && !noError) { console.error("VelocityJS: Trying to set 'easing' to an invalid value:", value); } } /** * Validate a fpsLimit option. */ function validateFpsLimit(value) { if (value === false) { return 0; } else { var parsed = parseInt(value, 10); if (!isNaN(parsed) && parsed >= 0) { return Math.min(parsed, 60); } } if (value != null) { console.warn("VelocityJS: Trying to set 'fpsLimit' to an invalid value:", value); } } /** * Validate a loop option. */ function validateLoop(value) { switch (value) { case false: return 0; case true: return true; default: var parsed = parseInt(value, 10); if (!isNaN(parsed) && parsed >= 0) { return parsed; } break; } if (value != null) { console.warn("VelocityJS: Trying to set 'loop' to an invalid value:", value); } } /** * Validate a progress option. */ function validateProgress(value) { if (isFunction(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'progress' to an invalid value:", value); } } /** * Validate a promise option. */ function validatePromise(value) { if (isBoolean(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'promise' to an invalid value:", value); } } /** * Validate a promiseRejectEmpty option. */ function validatePromiseRejectEmpty(value) { if (isBoolean(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'promiseRejectEmpty' to an invalid value:", value); } } /** * Validate a queue option. */ function validateQueue(value, noError) { if (value === false || isString(value)) { return value; } if (value != null && !noError) { console.warn("VelocityJS: Trying to set 'queue' to an invalid value:", value); } } /** * Validate a repeat option. */ function validateRepeat(value) { switch (value) { case false: return 0; case true: return true; default: var parsed = parseInt(value, 10); if (!isNaN(parsed) && parsed >= 0) { return parsed; } break; } if (value != null) { console.warn("VelocityJS: Trying to set 'repeat' to an invalid value:", value); } } /** * Validate a speed option. */ function validateSpeed(value) { if (isNumber(value)) { return value; } if (value != null) { console.error("VelocityJS: Trying to set 'speed' to an invalid value:", value); } } /** * Validate a sync option. */ function validateSync(value) { if (isBoolean(value)) { return value; } if (value != null) { console.error("VelocityJS: Trying to set 'sync' to an invalid value:", value); } } // Project // NOTE: Add the variable here, then add the default state in "reset" below. var cache$1 = void 0, begin = void 0, complete = void 0, delay = void 0, duration = void 0, easing = void 0, fpsLimit = void 0, loop = void 0, mobileHA = void 0, minFrameTime = void 0, promise = void 0, promiseRejectEmpty = void 0, queue = void 0, repeat = void 0, speed = void 0, sync = void 0; var defaults$1 = function () { function defaults$$1() { classCallCheck(this, defaults$$1); } createClass(defaults$$1, null, [{ key: "reset", value: function reset() { cache$1 = DEFAULT_CACHE; begin = undefined; complete = undefined; delay = DEFAULT_DELAY; duration = DEFAULT_DURATION; easing = validateEasing(DEFAULT_EASING, DEFAULT_DURATION); fpsLimit = DEFAULT_FPSLIMIT; loop = DEFAULT_LOOP; minFrameTime = FUZZY_MS_PER_SECOND / DEFAULT_FPSLIMIT; promise = DEFAULT_PROMISE; promiseRejectEmpty = DEFAULT_PROMISE_REJECT_EMPTY; queue = DEFAULT_QUEUE; repeat = DEFAULT_REPEAT; speed = DEFAULT_SPEED; sync = DEFAULT_SYNC; } }, { key: "cache", get: function get$$1() { return cache$1; }, set: function set$$1(value) { value = validateCache(value); if (value !== undefined) { cache$1 = value; } } }, { key: "begin", get: function get$$1() { return begin; }, set: function set$$1(value) { value = validateBegin(value); if (value !== undefined) { begin = value; } } }, { key: "complete", get: function get$$1() { return complete; }, set: function set$$1(value) { value = validateComplete(value); if (value !== undefined) { complete = value; } } }, { key: "delay", get: function get$$1() { return delay; }, set: function set$$1(value) { value = validateDelay(value); if (value !== undefined) { delay = value; } } }, { key: "duration", get: function get$$1() { return duration; }, set: function set$$1(value) { value = validateDuration(value); if (value !== undefined) { duration = value; } } }, { key: "easing", get: function get$$1() { return easing; }, set: function set$$1(value) { value = validateEasing(value, duration); if (value !== undefined) { easing = value; } } }, { key: "fpsLimit", get: function get$$1() { return fpsLimit; }, set: function set$$1(value) { value = validateFpsLimit(value); if (value !== undefined) { fpsLimit = value; minFrameTime = FUZZY_MS_PER_SECOND / value; } } }, { key: "loop", get: function get$$1() { return loop; }, set: function set$$1(value) { value = validateLoop(value); if (value !== undefined) { loop = value; } } }, { key: "mobileHA", get: function get$$1() { return mobileHA; }, set: function set$$1(value) { if (isBoolean(value)) { mobileHA = value; } } }, { key: "minFrameTime", get: function get$$1() { return minFrameTime; } }, { key: "promise", get: function get$$1() { return promise; }, set: function set$$1(value) { value = validatePromise(value); if (value !== undefined) { promise = value; } } }, { key: "promiseRejectEmpty", get: function get$$1() { return promiseRejectEmpty; }, set: function set$$1(value) { value = validatePromiseRejectEmpty(value); if (value !== undefined) { promiseRejectEmpty = value; } } }, { key: "queue", get: function get$$1() { return queue; }, set: function set$$1(value) { value = validateQueue(value); if (value !== undefined) { queue = value; } } }, { key: "repeat", get: function get$$1() { return repeat; }, set: function set$$1(value) { value = validateRepeat(value); if (value !== undefined) { repeat = value; } } }, { key: "repeatAgain", get: function get$$1() { return repeat; } }, { key: "speed", get: function get$$1() { return speed; }, set: function set$$1(value) { value = validateSpeed(value); if (value !== undefined) { speed = value; } } }, { key: "sync", get: function get$$1() { return sync; }, set: function set$$1(value) { value = validateSync(value); if (value !== undefined) { sync = value; } } }]); return defaults$$1; }(); Object.freeze(defaults$1); // Reset to our default values, currently everything is undefined. defaults$1.reset(); /** * The highest type index for finding the best normalization for a property. */ /** * Unlike "actions", normalizations can always be replaced by users. */ var Normalizations = []; /** * Store a cross-reference to units to be added to specific normalization * functions if the user supplies a unit-less number. * * This is pretty much confined to adding "px" to several css properties. */ var NormalizationUnits = {}; /** * Any normalisations that should never be cached are listed here. * Faster than an array - https://jsperf.com/array-includes-and-find-methods-vs-set-has */ var NoCacheNormalizations = new Set(); /** * An array of classes used for the per-class normalizations. This * translates into a bitwise enum for quick cross-reference, and so that * the element doesn't need multiple instanceof calls every * frame. */ var constructors = []; /** * A cache of the various constructors we've found and mapping to their real * name - saves expensive lookups. */ var constructorCache = new Map(); // Project // Constants var dataName = "velocityData"; /** * Get (and create) the internal data store for an element. */ function Data(element) { // Use a string member so Uglify doesn't mangle it. var data = element[dataName]; if (data) { return data; } var window = element.ownerDocument.defaultView; var types = 0; for (var index = 0; index < constructors.length; index++) { var _constructor = constructors[index]; if (isString(_constructor)) { if (element instanceof window[_constructor]) { types |= 1 << index; // tslint:disable-line:no-bitwise } } else if (element instanceof _constructor) { types |= 1 << index; // tslint:disable-line:no-bitwise } } // Use an intermediate object so it errors on incorrect data. var newData = { types: types, count: 0, computedStyle: null, cache: {}, queueList: {}, lastAnimationList: {}, lastFinishList: {}, window: window }; Object.defineProperty(element, dataName, { value: newData }); return newData; } // Constants var isClient = window && window === window.window, windowScrollAnchor = isClient && window.pageYOffset !== undefined; var State = { isClient: isClient, isMobile: isClient && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), isGingerbread: isClient && /Android 2\.3\.[3-7]/i.test(navigator.userAgent), prefixElement: isClient && document.createElement("div"), windowScrollAnchor: windowScrollAnchor, scrollAnchor: windowScrollAnchor ? window : !isClient || document.documentElement || document.body.parentNode || document.body, scrollPropertyLeft: windowScrollAnchor ? "pageXOffset" : "scrollLeft", scrollPropertyTop: windowScrollAnchor ? "pageYOffset" : "scrollTop", className: CLASSNAME, isTicking: false, first: undefined, last: undefined, firstNew: undefined }; // Project /** * Simple queue management. Un-named queue is directly within the element data, * named queue is within an object within it. */ function animate(animation) { var prev = State.last; animation._prev = prev; animation._next = undefined; if (prev) { prev._next = animation; } else { State.first = animation; } State.last = animation; if (!State.firstNew) { State.firstNew = animation; } var element = animation.element, data = Data(element); if (!data.count++) { //////////////////////// // Feature: Classname // //////////////////////// addClass(element, State.className); } } /** * Add an item to an animation queue. */ function queue$1(element, animation, queueName) { var data = Data(element); if (queueName !== false) { // Store the last animation added so we can use it for the // beginning of the next one. data.lastAnimationList[queueName] = animation; } if (queueName === false) { animate(animation); } else { if (!isString(queueName)) { queueName = ""; } var last = data.queueList[queueName]; if (!last) { if (last === null) { data.queueList[queueName] = animation; } else { data.queueList[queueName] = null; animate(animation); } } else { while (last._next) { last = last._next; } last._next = animation; animation._prev = last; } } } /** * Start the next animation on this element's queue (named or default). * * @returns the next animation that is starting. */ function dequeue(element, queueName, skip) { if (queueName !== false) { if (!isString(queueName)) { queueName = ""; } var data = Data(element), animation = data.queueList[queueName]; if (animation) { data.queueList[queueName] = animation._next || null; if (!skip) { animate(animation); } } else if (animation === null) { delete data.queueList[queueName]; } return animation; } } /** * Remove an animation from the active animation list. If it has a queue set * then remember it as the last animation for that queue, and free the one * that was previously there. If the animation list is completely empty then * mark us as finished. */ function freeAnimationCall(animation) { var next = animation._next, prev = animation._prev, queueName = animation.queue == null ? animation.options.queue : animation.queue; if (State.firstNew === animation) { State.firstNew = next; } if (State.first === animation) { State.first = next; } else if (prev) { prev._next = next; } if (State.last === animation) { State.last = prev; } else if (next) { next._prev = prev; } if (queueName) { var data = Data(animation.element); if (data) { animation._next = animation._prev = undefined; } } } var SequencesObject = {}; // Project /** * Call the complete method of an animation in a separate function so it can * benefit from JIT compiling while still having a try/catch block. */ function callComplete(activeCall) { var callback = activeCall.complete || activeCall.options.complete; if (callback) { try { var elements = activeCall.elements; callback.call(elements, elements, activeCall); } catch (error) { setTimeout(function () { throw error; }, 1); } } } /** * Complete an animation. This might involve restarting (for loop or repeat * options). Once it is finished we also check for any callbacks or Promises * that need updating. */ function completeCall(activeCall) { // TODO: Check if it's not been completed already var options = activeCall.options, queue = getValue(activeCall.queue, options.queue), isLoop = getValue(activeCall.loop, options.loop, defaults$1.loop), isRepeat = getValue(activeCall.repeat, options.repeat, defaults$1.repeat), isStopped = activeCall._flags & 8 /* STOPPED */; // tslint:disable-line:no-bitwise if (!isStopped && (isLoop || isRepeat)) { //////////////////// // Option: Loop // // Option: Repeat // //////////////////// if (isRepeat && isRepeat !== true) { activeCall.repeat = isRepeat - 1; } else if (isLoop && isLoop !== true) { activeCall.loop = isLoop - 1; activeCall.repeat = getValue(activeCall.repeatAgain, options.repeatAgain, defaults$1.repeatAgain); } if (isLoop) { activeCall._flags ^= 64 /* REVERSE */; // tslint:disable-line:no-bitwise } if (queue !== false) { // Can't be called when stopped so no need for an extra check. Data(activeCall.element).lastFinishList[queue] = activeCall.timeStart + getValue(activeCall.duration, options.duration, defaults$1.duration); } activeCall.timeStart = activeCall.ellapsedTime = activeCall.percentComplete = 0; activeCall._flags &= ~4 /* STARTED */; // tslint:disable-line:no-bitwise } else { var element = activeCall.element, data = Data(element); if (! --data.count && !isStopped) { //////////////////////// // Feature: Classname // //////////////////////// removeClass(element, State.className); } ////////////////////// // Option: Complete // ////////////////////// // If this is the last animation in this list then we can check for // and complete calls or Promises. // TODO: When deleting an element we need to adjust these values. if (options && ++options._completed === options._total) { if (!isStopped && options.complete) { // We don't call the complete if the animation is stopped, // and we clear the key to prevent it being called again. callComplete(activeCall); options.complete = null; } var resolver = options._resolver; if (resolver) { // Fulfil the Promise resolver(activeCall.elements); delete options._resolver; } } /////////////////// // Option: Queue // /////////////////// if (queue !== false) { // We only do clever things with queues... if (!isStopped) { // If we're not stopping an animation, we need to remember // what time it finished so that the next animation in // sequence gets the correct start time. data.lastFinishList[queue] = activeCall.timeStart + getValue(activeCall.duration, options.duration, defaults$1.duration); } // Start the next animation in sequence, or delete the queue if // this was the last one. dequeue(element, queue); } // Cleanup any pointers, and remember the last animation etc. freeAnimationCall(activeCall); } } // Project /** * Used to register a normalization. This should never be called by users * directly, instead it should be called via an action:
      * Velocity("registerNormalization", "Element", "name", VelocityNormalizationsFn[, false]); * * The second argument is the class of the animatable object. If this is passed * as a class name (ie, `"Element"` -> `window["Element"]`) then this will work * cross-iframe. If passed as an actual class (ie `Element`) then it will * attempt to find the class on the window and use that name instead. If it * can't find it then it will use the class passed, which allows for custom * animation targets, but will not work cross-iframe boundary. * * The fourth argument can be an explicit false, which prevents * the property from being cached. Please note that this can be dangerous * for performance! */ function registerNormalization(args) { var constructor = args[0], name = args[1], callback = args[2]; if (isString(constructor) && !(window[constructor] instanceof Object) || !isString(constructor) && !(constructor instanceof Object)) { console.warn("VelocityJS: Trying to set 'registerNormalization' constructor to an invalid value:", constructor); } else if (!isString(name)) { console.warn("VelocityJS: Trying to set 'registerNormalization' name to an invalid value:", name); } else if (!isFunction(callback)) { console.warn("VelocityJS: Trying to set 'registerNormalization' callback to an invalid value:", name, callback); } else { var index = constructors.indexOf(constructor), nextArg = 3; if (index < 0 && !isString(constructor)) { if (constructorCache.has(constructor)) { index = constructors.indexOf(constructorCache.get(constructor)); } else { for (var property in window) { if (window[property] === constructor) { index = constructors.indexOf(property); if (index < 0) { index = constructors.push(property) - 1; Normalizations[index] = {}; constructorCache.set(constructor, property); } break; } } } } if (index < 0) { index = constructors.push(constructor) - 1; Normalizations[index] = {}; } Normalizations[index][name] = callback; if (isString(args[nextArg])) { var unit = args[nextArg++]; var units = NormalizationUnits[unit]; if (!units) { units = NormalizationUnits[unit] = []; } units.push(callback); } if (args[nextArg] === false) { NoCacheNormalizations.add(name); } } } /** * Used to check if a normalisation exists on a specific class. */ function hasNormalization(args) { var constructor = args[0], name = args[1]; var index = constructors.indexOf(constructor); if (index < 0 && !isString(constructor)) { if (constructorCache.has(constructor)) { index = constructors.indexOf(constructorCache.get(constructor)); } else { for (var property in window) { if (window[property] === constructor) { index = constructors.indexOf(property); break; } } } } return index >= 0 && Normalizations[index].hasOwnProperty(name); } /** * Get the unit to add to a unitless number based on the normalization used. */ function getNormalizationUnit(fn) { for (var unit in NormalizationUnits) { if (NormalizationUnits[unit].includes(fn)) { return unit; } } return ""; } /** * Get the normalization for an element and propertyName combination. This * value should be cached at asking time, as it may change if the user adds * more normalizations. */ function getNormalization(element, propertyName) { var data = Data(element); var fn = void 0; for (var index = constructors.length - 1, types = data.types; !fn && index >= 0; index--) { if (types & 1 << index) { // tslint:disable-line:no-bitwise fn = Normalizations[index][propertyName]; } } return fn; } registerAction(["registerNormalization", registerNormalization]); registerAction(["hasNormalization", hasNormalization]); // Project /** * The singular setPropertyValue, which routes the logic for all * normalizations. */ function setPropertyValue(element, propertyName, propertyValue, fn) { var noCache = NoCacheNormalizations.has(propertyName), data = !noCache && Data(element); if (noCache || data && data.cache[propertyName] !== propertyValue) { // By setting it to undefined we force a true "get" later if (!noCache) { data.cache[propertyName] = propertyValue || undefined; } fn = fn || getNormalization(element, propertyName); if (fn) { fn(element, propertyValue); } if (Velocity$$1.debug >= 2) { console.info("Set \"" + propertyName + "\": \"" + propertyValue + "\"", element); } } } /** * Remove nested `calc(0px + *)` or `calc(* + (0px + *))` correctly. */ function removeNestedCalc(value) { if (value.indexOf("calc(") >= 0) { var tokens = value.split(/([\(\)])/); var depth = 0; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; switch (token) { case "(": depth++; break; case ")": depth--; break; default: if (depth && token[0] === "0") { tokens[i] = token.replace(/^0[a-z%]+ \+ /, ""); } break; } } return tokens.join("").replace(/(?:calc)?\(([0-9\.]+[a-z%]+)\)/g, "$1"); } return value; } /** * Cache every camelCase match to avoid repeating lookups. */ var cache$2 = {}; /** * Camelcase a property name into its JavaScript notation (e.g. * "background-color" ==> "backgroundColor"). Camelcasing is used to * normalize property names between and across calls. */ function camelCase(property) { var fixed = cache$2[property]; if (fixed) { return fixed; } return cache$2[property] = property.replace(/-([a-z])/g, function ($, letter) { return letter.toUpperCase(); }); } // Constants var rxColor6 = /#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/gi, rxColor3 = /#([a-f\d])([a-f\d])([a-f\d])/gi, rxColorName = /(rgba?\(\s*)?(\b[a-z]+\b)/g, rxRGB = /rgb(a?)\(([^\)]+)\)/gi, rxSpaces = /\s+/g; /** * This is the list of color names -> rgb values. The object is in here so * that the actual name conversion can be in a separate file and not * included for custom builds. */ var ColorNames = {}; /** * Convert a hex list to an rgba value. Designed to be used in replace. */ function makeRGBA(ignore, r, g, b) { return "rgba(" + parseInt(r, 16) + "," + parseInt(g, 16) + "," + parseInt(b, 16) + ",1)"; } /** * Replace any css colour name with its rgba() value. It is possible to use * the name within an "rgba(blue, 0.4)" string this way. */ function fixColors(str) { return str.replace(rxColor6, makeRGBA).replace(rxColor3, function ($0, r, g, b) { return makeRGBA($0, r + r, g + g, b + b); }).replace(rxColorName, function ($0, $1, $2) { if (ColorNames[$2]) { return ($1 ? $1 : "rgba(") + ColorNames[$2] + ($1 ? "" : ",1)"); } return $0; }).replace(rxRGB, function ($0, $1, $2) { return "rgba(" + ($2.replace(rxSpaces, "") + ($1 ? "" : ",1")) + ")"; }); } // Project /** * Figure out the dimensions for this width / height based on the * potential borders and whether we care about them. */ function augmentDimension(element, name, wantInner) { var isBorderBox = getPropertyValue(element, "boxSizing").toString().toLowerCase() === "border-box"; if (isBorderBox === wantInner) { // in box-sizing mode, the CSS width / height accessors already // give the outerWidth / outerHeight. var sides = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"], fields = ["padding" + sides[0], "padding" + sides[1], "border" + sides[0] + "Width", "border" + sides[1] + "Width"]; var augment = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var field = _step.value; var value = parseFloat(getPropertyValue(element, field)); if (!isNaN(value)) { augment += value; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return wantInner ? -augment : augment; } return 0; } // Project /** * Get the width or height of an element, pulled out as it can be used when the * in two locations so don't want to repeat it. */ function getWidthHeight(element, property) { return element.getBoundingClientRect()[property] + augmentDimension(element, property, true) + "px"; } // TODO: This is still a complete mess function computePropertyValue(element, property) { var data = Data(element), // If computedStyle is cached, use it. If not then get the correct one // for the element to support cross-iframe boundaries. computedStyle = data.computedStyle ? data.computedStyle : data.window.getComputedStyle(element, null); var computedValue = 0; if (!data.computedStyle) { data.computedStyle = computedStyle; } if (computedStyle["display"] === "none") { switch (property) { case "width": case "height": // Browsers do not return height and width values for elements // that are set to display:"none". Thus, we temporarily toggle // display to the element type's default value. setPropertyValue(element, "display", "auto"); computedValue = getWidthHeight(element, property); setPropertyValue(element, "display", "none"); return String(computedValue); } } /* IE and Firefox do not return a value for the generic borderColor -- they only return individual values for each border side's color. Also, in all browsers, when border colors aren't all the same, a compound value is returned that Velocity isn't setup to parse. So, as a polyfill for querying individual border side colors, we just return the top border's color and animate all borders from that value. */ /* TODO: There is a borderColor normalisation in legacy/ - figure out where this is needed... */ computedValue = computedStyle[property]; /* Fall back to the property's style value (if defined) when computedValue returns nothing, which can happen when the element hasn't been painted. */ if (!computedValue) { computedValue = element.style[property]; } /* For top, right, bottom, and left (TRBL) values that are set to "auto" on elements of "fixed" or "absolute" position, defer to jQuery for converting "auto" to a numeric value. (For elements with a "static" or "relative" position, "auto" has the same effect as being set to 0, so no conversion is necessary.) */ /* An example of why numeric conversion is necessary: When an element with "position:absolute" has an untouched "left" property, which reverts to "auto", left's value is 0 relative to its parent element, but is often non-zero relative to its *containing* (not parent) element, which is the nearest "position:relative" ancestor or the viewport (and always the viewport in the case of "position:fixed"). */ if (computedValue === "auto") { switch (property) { case "width": case "height": computedValue = getWidthHeight(element, property); break; case "top": case "left": case "right": case "bottom": var position = getPropertyValue(element, "position"); if (position === "fixed" || position === "absolute") { // Note: this has no pixel unit on its returned values, // we re-add it here to conform with // computePropertyValue's behavior. computedValue = element.getBoundingClientRect[property] + "px"; break; } // Deliberate fallthrough! default: computedValue = "0px"; break; } } return computedValue ? String(computedValue) : ""; } /** * Get a property value. This will grab via the cache if it exists, then * via any normalisations. */ function getPropertyValue(element, propertyName, fn, skipCache) { var data = Data(element); var propertyValue = void 0; if (NoCacheNormalizations.has(propertyName)) { skipCache = true; } if (!skipCache && data && data.cache[propertyName] != null) { propertyValue = data.cache[propertyName]; } else { fn = fn || getNormalization(element, propertyName); if (fn) { propertyValue = fn(element); if (data) { data.cache[propertyName] = propertyValue; } } } if (Velocity$$1.debug >= 2) { console.info("Get \"" + propertyName + "\": \"" + propertyValue + "\"", element); } return propertyValue; } // Project // Constants var rxHex = /^#([A-f\d]{3}){1,2}$/i, commands = { function: function _function(value, element, elements, elementArrayIndex, propertyName, tween) { return value.call(element, elementArrayIndex, elements.length, propertyName); }, number: function number(value, element, elements, elementArrayIndex, propertyName, tween) { return String(value) + getNormalizationUnit(tween.fn); }, string: function string(value, element, elements, elementArrayIndex, propertyName, tween) { return fixColors(value); }, undefined: function undefined(value, element, elements, elementArrayIndex, propertyName, tween) { return fixColors(getPropertyValue(element, propertyName, tween.fn) || ""); } }; /** * Expand a VelocityProperty argument into a valid sparse Tween array. This * pre-allocates the array as it is then the correct size and slightly * faster to access. */ function expandProperties(animation, properties) { var tweens = animation.tweens = Object.create(null), elements = animation.elements, element = animation.element, elementArrayIndex = elements.indexOf(element), data = Data(element), queue = getValue(animation.queue, animation.options.queue), duration = getValue(animation.options.duration, defaults$1.duration); for (var property in properties) { if (properties.hasOwnProperty(property)) { var propertyName = camelCase(property), fn = getNormalization(element, propertyName); var valueData = properties[property]; if (!fn && propertyName !== "tween") { if (Velocity$$1.debug) { console.log("Skipping \"" + property + "\" due to a lack of browser support."); } continue; } if (valueData == null) { if (Velocity$$1.debug) { console.log("Skipping \"" + property + "\" due to no value supplied."); } continue; } var tween = tweens[propertyName] = {}; var endValue = void 0, startValue = void 0; tween.fn = fn; if (isFunction(valueData)) { // If we have a function as the main argument then resolve // it first, in case it returns an array that needs to be // split. valueData = valueData.call(element, elementArrayIndex, elements.length, elements); } if (Array.isArray(valueData)) { // valueData is an array in the form of // [ endValue, [, easing] [, startValue] ] var arr1 = valueData[1], arr2 = valueData[2]; endValue = valueData[0]; if (isString(arr1) && (/^[\d-]/.test(arr1) || rxHex.test(arr1)) || isFunction(arr1) || isNumber(arr1)) { startValue = arr1; } else if (isString(arr1) && Easings[arr1] || Array.isArray(arr1)) { tween.easing = validateEasing(arr1, duration); startValue = arr2; } else { startValue = arr1 || arr2; } } else { endValue = valueData; } tween.end = commands[typeof endValue === "undefined" ? "undefined" : _typeof(endValue)](endValue, element, elements, elementArrayIndex, propertyName, tween); if (startValue != null || queue === false || data.queueList[queue] === undefined) { tween.start = commands[typeof startValue === "undefined" ? "undefined" : _typeof(startValue)](startValue, element, elements, elementArrayIndex, propertyName, tween); explodeTween(propertyName, tween, duration); } } } } // TODO: Needs a better match for "translate3d" etc - a number must be preceded by some form of break... var rxToken = /((?:[+\-*/]=)?(?:[+-]?\d*\.\d+|[+-]?\d+)[a-z%]*|(?:.(?!$|[+-]?\d|[+\-*/]=[+-]?\d))+.|.)/g, rxNumber = /^([+\-*/]=)?([+-]?\d*\.\d+|[+-]?\d+)(.*)$/; /** * Find a pattern between multiple strings, return a VelocitySequence with * the pattern and the tokenised values. * * If number then animate. * If a string then must match. * If units then convert between them by wrapping in a calc(). * - If already in a calc then nest another layer. * If in an rgba() then the first three numbers are rounded. */ function findPattern(parts, propertyName) { var partsLength = parts.length, tokens = [], indexes = []; var numbers = void 0; // First tokenise the strings - these have all values, we will pull // numbers later. for (var part = 0; part < partsLength; part++) { if (isString(parts[part])) { if (parts[part] === "") { tokens[part] = [""]; } else { tokens[part] = cloneArray(parts[part].match(rxToken)); } indexes[part] = 0; // If it matches more than one thing then we've got a number. numbers = numbers || tokens[part].length > 1; //console.log(`tokens:`, parts[part], tokens[part]) } else { // We have an incomplete lineup, it will get tried again later... return; } } var sequence = [], pattern = sequence.pattern = [], addString = function addString(text) { if (isString(pattern[pattern.length - 1])) { pattern[pattern.length - 1] += text; } else if (text) { pattern.push(text); for (var _part = 0; _part < partsLength; _part++) { sequence[_part].push(null); } } }, returnStringType = function returnStringType() { if (numbers || pattern.length > 1) { //console.error(`Velocity: Trying to pattern match mis-matched strings "${propertyName}":`, parts); return; } var isDisplay = propertyName === "display", isVisibility = propertyName === "visibility"; for (var _part2 = 0; _part2 < partsLength; _part2++) { var value = parts[_part2]; sequence[_part2][0] = value; // Don't care about duration... sequence[_part2].easing = validateEasing(isDisplay && value === "none" || isVisibility && value === "hidden" || !isDisplay && !isVisibility ? "at-end" : "at-start", 400); } pattern[0] = false; return sequence; }; var more = true; for (var _part3 = 0; _part3 < partsLength; _part3++) { sequence[_part3] = []; } while (more) { var bits = [], units = []; var text = void 0, isUnitless = false, hasNumbers = false; for (var _part4 = 0; _part4 < partsLength; _part4++) { var index = indexes[_part4]++, token = tokens[_part4][index]; if (token) { var num = token.match(rxNumber); // [ignore, change, number, unit] if (num) { // It's a number, possibly with a += change and unit. if (text) { return returnStringType(); } var digits = parseFloat(num[2]), unit = num[3], change = num[1] ? num[1][0] + unit : undefined, changeOrUnit = change || unit; if (digits && !units.includes(changeOrUnit)) { // Will be an empty string at the least. units.push(changeOrUnit); } if (!unit) { if (digits) { hasNumbers = true; } else { isUnitless = true; } } bits[_part4] = change ? [digits, changeOrUnit, true] : [digits, changeOrUnit]; } else if (bits.length) { return returnStringType(); } else { // It's a string. if (!text) { text = token; } else if (text !== token) { return returnStringType(); } } } else if (!_part4) { for (; _part4 < partsLength; _part4++) { var index2 = indexes[_part4]++; if (tokens[_part4][index2]) { return returnStringType(); } } // IMPORTANT: This is the exit point. more = false; break; } else { // Different return; } } if (text) { addString(text); } else if (units.length) { if (units.length === 2 && isUnitless && !hasNumbers) { // If we only have two units, and one is empty, and it's only empty on "0", then treat us as having one unit units.splice(units[0] ? 1 : 0, 1); } if (units.length === 1) { // All the same units, so append number then unit. var _unit = units[0], firstLetter = _unit[0]; switch (firstLetter) { case "+": case "-": case "*": case "/": if (propertyName) { console.error("Velocity: The first property must not contain a relative function \"" + propertyName + "\":", parts); } return; } pattern.push(false); for (var _part5 = 0; _part5 < partsLength; _part5++) { sequence[_part5].push(bits[_part5][0]); } addString(_unit); } else { // Multiple units, so must be inside a calc. addString("calc("); var patternCalc = pattern.length - 1; // Store the beginning of our calc. for (var i = 0; i < units.length; i++) { var _unit2 = units[i], _firstLetter = _unit2[0], isComplex = _firstLetter === "*" || _firstLetter === "/", isMaths = isComplex || _firstLetter === "+" || _firstLetter === "-"; if (isComplex) { // TODO: Not sure this should be done automatically! pattern[patternCalc] += "("; addString(")"); } if (i) { addString(" " + (isMaths ? _firstLetter : "+") + " "); } pattern.push(false); for (var _part6 = 0; _part6 < partsLength; _part6++) { var bit = bits[_part6], value = bit[1] === _unit2 ? bit[0] : bit.length === 3 ? sequence[_part6 - 1][sequence[_part6 - 1].length - 1] : isComplex ? 1 : 0; sequence[_part6].push(value); } addString(isMaths ? _unit2.substring(1) : _unit2); } addString(")"); } } } // We've got here, so a valid sequence - now check and fix RGB rounding // and calc() nesting... // TODO: Nested calc(a + calc(b + c)) -> calc(a + (b + c)) for (var _i = 0, inRGB = 0; _i < pattern.length; _i++) { var _text = pattern[_i]; if (isString(_text)) { if (inRGB && _text.indexOf(",") >= 0) { inRGB++; } else if (_text.indexOf("rgb") >= 0) { inRGB = 1; } } else if (inRGB) { if (inRGB < 4) { pattern[_i] = true; } else { inRGB = 0; } } } return sequence; } /** * Convert a string-based tween with start and end strings, into a pattern * based tween with arrays. */ function explodeTween(propertyName, tween, duration, starting) { var startValue = tween.start, endValue = tween.end; if (!isString(endValue) || !isString(startValue)) { return; } var sequence = findPattern([startValue, endValue], propertyName); if (!sequence && starting) { // This little piece will take a startValue, split out the // various numbers in it, then copy the endValue into the // startValue while replacing the numbers in it to match the // original start numbers as a repeating sequence. // Finally this function will run again with the new // startValue and a now matching pattern. var startNumbers = startValue.match(/\d\.?\d*/g) || ["0"], count = startNumbers.length; var index = 0; sequence = findPattern([endValue.replace(/\d+\.?\d*/g, function () { return startNumbers[index++ % count]; }), endValue], propertyName); } if (sequence) { if (Velocity$$1.debug) { console.log("Velocity: Sequence found:", sequence); } sequence[0].percent = 0; sequence[1].percent = 1; tween.sequence = sequence; switch (tween.easing) { case Easings["at-start"]: case Easings["during"]: case Easings["at-end"]: sequence[0].easing = sequence[1].easing = tween.easing; break; } } } /** * Expand all queued animations that haven't gone yet * * This will automatically expand the properties map for any recently added * animations so that the start and end values are correct. */ function validateTweens(activeCall) { // This might be called on an already-ready animation if (State.firstNew === activeCall) { State.firstNew = activeCall._next; } // Check if we're actually already ready if (activeCall._flags & 1 /* EXPANDED */) { // tslint:disable-line:no-bitwise return; } var element = activeCall.element, tweens = activeCall.tweens, duration = getValue(activeCall.options.duration, defaults$1.duration); // tslint:disable-next-line:forin for (var propertyName in tweens) { var tween = tweens[propertyName]; if (tween.start == null) { // Get the start value as it's not been passed in var startValue = getPropertyValue(activeCall.element, propertyName); if (isString(startValue)) { tween.start = fixColors(startValue); explodeTween(propertyName, tween, duration, true); } else if (!Array.isArray(startValue)) { console.warn("bad type", tween, propertyName, startValue); } } if (Velocity$$1.debug) { console.log("tweensContainer \"" + propertyName + "\": " + JSON.stringify(tween), element); } } activeCall._flags |= 1 /* EXPANDED */; // tslint:disable-line:no-bitwise } // Project /** * Call the begin method of an animation in a separate function so it can * benefit from JIT compiling while still having a try/catch block. */ function beginCall(activeCall) { var callback = activeCall.begin || activeCall.options.begin; if (callback) { try { var elements = activeCall.elements; callback.call(elements, elements, activeCall); } catch (error) { setTimeout(function () { throw error; }, 1); } } } /** * Call the progress method of an animation in a separate function so it can * benefit from JIT compiling while still having a try/catch block. */ function progressCall(activeCall) { var callback = activeCall.progress || activeCall.options.progress; if (callback) { try { var elements = activeCall.elements, percentComplete = activeCall.percentComplete, options = activeCall.options, tweenValue = activeCall.tween; callback.call(elements, elements, percentComplete, Math.max(0, activeCall.timeStart + (activeCall.duration != null ? activeCall.duration : options.duration != null ? options.duration : defaults$1.duration) - lastTick), tweenValue !== undefined ? tweenValue : String(percentComplete * 100), activeCall); } catch (error) { setTimeout(function () { throw error; }, 1); } } } /** * Call callbacks, potentially run async with the main animation thread. */ function asyncCallbacks() { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = progressed[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var activeCall = _step.value; progressCall(activeCall); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } progressed.clear(); var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = completed[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _activeCall = _step2.value; completeCall(_activeCall); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } completed.clear(); } /************** Timing **************/ var FRAME_TIME = 1000 / 60, /** * Animations with a Complete callback. */ completed = new Set(), /** * Animations with a Progress callback. */ progressed = new Set(), /** * Shim for window.performance in case it doesn't exist */ performance = function () { var perf = window.performance || {}; if (typeof perf.now !== "function") { var nowOffset = perf.timing && perf.timing.navigationStart ? perf.timing.navigationStart : now(); perf.now = function () { return now() - nowOffset; }; } return perf; }(), /** * Proxy function for when rAF is not available. * * This should hopefully never be used as the browsers often throttle * this to less than one frame per second in the background, making it * completely unusable. */ rAFProxy = function rAFProxy(callback) { return setTimeout(callback, Math.max(0, FRAME_TIME - (performance.now() - lastTick))); }, /** * Either requestAnimationFrame, or a shim for it. */ rAFShim = window.requestAnimationFrame || rAFProxy; /** * Set if we are currently inside a tick() to prevent double-calling. */ var ticking = void 0, /** * A background WebWorker that sends us framerate messages when we're in * the background. Without this we cannot maintain frame accuracy. */ worker = void 0; /** * The time that the last animation frame ran at. Set from tick(), and used * for missing rAF (ie, when not in focus etc). */ var lastTick = 0; /** * WebWorker background function. * * When we're in the background this will send us a msg every tick, when in * the foreground it won't. * * When running in the background the browser reduces allowed CPU etc, so * we raun at 30fps instead of 60fps. */ function workerFn() { var _this = this; var interval = void 0; this.onmessage = function (e) { switch (e.data) { case true: if (!interval) { interval = setInterval(function () { _this.postMessage(true); }, 1000 / 30); } break; case false: if (interval) { clearInterval(interval); interval = 0; } break; default: _this.postMessage(e.data); break; } }; } try { // Create the worker - this might not be supported, hence the try/catch. worker = new Worker(URL.createObjectURL(new Blob(["(" + workerFn + ")()"]))); // Whenever the worker sends a message we tick() worker.onmessage = function (e) { if (e.data === true) { tick(); } else { asyncCallbacks(); } }; // And watch for going to the background to start the WebWorker running. if (!State.isMobile && document.hidden !== undefined) { document.addEventListener("visibilitychange", function () { worker.postMessage(State.isTicking && document.hidden); }); } } catch (e) {} /* * WebWorkers are not supported in this format. This can happen in IE10 * where it can't create one from a blob this way. We fallback, but make * no guarantees towards accuracy in this case. */ /** * Called on every tick, preferably through rAF. This is reponsible for * initialising any new animations, then starting any that need starting. * Finally it will expand any tweens and set the properties relating to * them. If there are any callbacks relating to the animations then they * will attempt to call at the end (with the exception of "begin"). */ function tick(timestamp) { if (ticking) { // Should never happen - but if we've swapped back from hidden to // visibile then we want to make sure return; } ticking = true; /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on. We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever the browser's next tick sync time occurs, which results in the first elements subjected to Velocity calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */ if (timestamp !== false) { var timeCurrent = performance.now(), deltaTime = lastTick ? timeCurrent - lastTick : FRAME_TIME, defaultSpeed = defaults$1.speed, defaultEasing = defaults$1.easing, defaultDuration = defaults$1.duration; var activeCall = void 0, nextCall = void 0; if (deltaTime >= defaults$1.minFrameTime || !lastTick) { lastTick = timeCurrent; /******************** Call Iteration ********************/ // Expand any tweens that might need it. while (State.firstNew) { validateTweens(State.firstNew); } // Iterate through each active call. for (activeCall = State.first; activeCall && activeCall !== State.firstNew; activeCall = activeCall._next) { var element = activeCall.element, data = Data(element); // Check to see if this element has been deleted midway // through the animation. If it's gone then end this // animation. if (!element.parentNode || !data) { // TODO: Remove safely - decrease count, delete data, remove from arrays freeAnimationCall(activeCall); continue; } // Don't bother getting until we can use these. var options = activeCall.options, flags = activeCall._flags; var timeStart = activeCall.timeStart; // If this is the first time that this call has been // processed by tick() then we assign timeStart now so that // it's value is as close to the real animation start time // as possible. if (!timeStart) { var queue = activeCall.queue != null ? activeCall.queue : options.queue; timeStart = timeCurrent - deltaTime; if (queue !== false) { timeStart = Math.max(timeStart, data.lastFinishList[queue] || 0); } activeCall.timeStart = timeStart; } // If this animation is paused then skip processing unless // it has been set to resume. if (flags & 16 /* PAUSED */) { // tslint:disable-line:no-bitwise // Update the time start to accomodate the paused // completion amount. activeCall.timeStart += deltaTime; continue; } // Check if this animation is ready - if it's synced then it // needs to wait for all other animations in the sync if (!(flags & 2 /* READY */)) { // tslint:disable-line:no-bitwise activeCall._flags |= 2 /* READY */; // tslint:disable-line:no-bitwise options._ready++; } } // Need to split the loop, as ready sync animations must all get // the same start time. for (activeCall = State.first; activeCall && activeCall !== State.firstNew; activeCall = nextCall) { var _flags = activeCall._flags; nextCall = activeCall._next; if (!(_flags & 2 /* READY */) || _flags & 16 /* PAUSED */) { // tslint:disable-line:no-bitwise continue; } var _options = activeCall.options; if (_flags & 32 /* SYNC */ && _options._ready < _options._total) { // tslint:disable-line:no-bitwise activeCall.timeStart += deltaTime; continue; } var speed = activeCall.speed != null ? activeCall.speed : _options.speed != null ? _options.speed : defaultSpeed; var _timeStart = activeCall.timeStart; // Don't bother getting until we can use these. if (!(_flags & 4 /* STARTED */)) { // tslint:disable-line:no-bitwise var delay = activeCall.delay != null ? activeCall.delay : _options.delay; // Make sure anything we've delayed doesn't start // animating yet, there might still be an active delay // after something has been un-paused if (delay) { if (_timeStart + delay / speed > timeCurrent) { continue; } activeCall.timeStart = _timeStart += delay / (delay > 0 ? speed : 1); } activeCall._flags |= 4 /* STARTED */; // tslint:disable-line:no-bitwise // The begin callback is fired once per call, not once // per element, and is passed the full raw DOM element // set as both its context and its first argument. if (_options._started++ === 0) { _options._first = activeCall; if (_options.begin) { // Pass to an external fn with a try/catch block for optimisation beginCall(activeCall); // Only called once, even if reversed or repeated _options.begin = undefined; } } } if (speed !== 1) { // On the first frame we may have a shorter delta // const delta = Math.min(deltaTime, timeCurrent - timeStart); activeCall.timeStart = _timeStart += Math.min(deltaTime, timeCurrent - _timeStart) * (1 - speed); } var activeEasing = activeCall.easing != null ? activeCall.easing : _options.easing != null ? _options.easing : defaultEasing, millisecondsEllapsed = activeCall.ellapsedTime = timeCurrent - _timeStart, duration = activeCall.duration != null ? activeCall.duration : _options.duration != null ? _options.duration : defaultDuration, percentComplete = activeCall.percentComplete = Velocity$$1.mock ? 1 : Math.min(millisecondsEllapsed / duration, 1), tweens = activeCall.tweens, reverse = _flags & 64 /* REVERSE */; // tslint:disable-line:no-bitwise if (activeCall.progress || _options._first === activeCall && _options.progress) { progressed.add(activeCall); } if (percentComplete === 1) { completed.add(activeCall); } // tslint:disable-next-line:forin for (var property in tweens) { // For every element, iterate through each property. var tween = tweens[property], sequence = tween.sequence, pattern = sequence.pattern; var currentValue = "", i = 0; if (pattern) { var easingComplete = (tween.easing || activeEasing)(percentComplete, 0, 1, property); var best = 0; for (var j = 0; j < sequence.length - 1; j++) { if (sequence[j].percent < easingComplete) { best = j; } } var tweenFrom = sequence[best], tweenTo = sequence[best + 1] || tweenFrom, rawPercent = (percentComplete - tweenFrom.percent) / (tweenTo.percent - tweenFrom.percent), tweenPercent = reverse ? 1 - rawPercent : rawPercent, easing = tweenTo.easing || activeEasing || linearEasing; for (; i < pattern.length; i++) { var startValue = tweenFrom[i]; if (startValue == null) { currentValue += pattern[i]; } else { var endValue = tweenTo[i]; if (startValue === endValue) { currentValue += startValue; } else { // All easings must deal with numbers except for our internal ones. var result = easing(tweenPercent, startValue, endValue, property); currentValue += pattern[i] !== true ? result : Math.round(result); } } } if (property !== "tween") { if (percentComplete === 1) { currentValue = removeNestedCalc(currentValue); } // TODO: To solve an IE<=8 positioning bug, the unit type must be dropped when setting a property value of 0 - add normalisations to legacy setPropertyValue(activeCall.element, property, currentValue, tween.fn); } else { // Skip the fake 'tween' property as that is only // passed into the progress callback. activeCall.tween = currentValue; } } else { console.warn("VelocityJS: Missing pattern:", property, JSON.stringify(tween[property])); delete tweens[property]; } } } if (progressed.size || completed.size) { if (!document.hidden) { asyncCallbacks(); } else if (worker) { worker.postMessage(""); } else { setTimeout(asyncCallbacks, 1); } } } } if (State.first) { State.isTicking = true; if (!document.hidden) { rAFShim(tick); } else if (!worker) { rAFProxy(tick); } else if (timestamp === false) { // Make sure we turn on the messages. worker.postMessage(true); } } else { State.isTicking = false; lastTick = 0; if (document.hidden && worker) { // Make sure we turn off the messages. worker.postMessage(false); } } ticking = false; } // Project /** * Check if an animation should be finished, and if so we set the tweens to * the final value for it, then call complete. */ function checkAnimationShouldBeFinished(animation, queueName, defaultQueue) { validateTweens(animation); if (queueName === undefined || queueName === getValue(animation.queue, animation.options.queue, defaultQueue)) { if (!(animation._flags & 4 /* STARTED */)) { // tslint:disable-line:no-bitwise // Copied from tick.ts - ensure that the animation is completely // valid and run begin() before complete(). var options = animation.options; // The begin callback is fired once per call, not once per // element, and is passed the full raw DOM element set as both // its context and its first argument. if (options._started++ === 0) { options._first = animation; if (options.begin) { // Pass to an external fn with a try/catch block for optimisation beginCall(animation); // Only called once, even if reversed or repeated options.begin = undefined; } } animation._flags |= 4 /* STARTED */; // tslint:disable-line:no-bitwise } // tslint:disable-next-line:forin for (var property in animation.tweens) { var tween = animation.tweens[property], sequence = tween.sequence, pattern = sequence.pattern; var currentValue = "", i = 0; if (pattern) { var endValues = sequence[sequence.length - 1]; for (; i < pattern.length; i++) { var endValue = endValues[i]; currentValue += endValue == null ? pattern[i] : endValue; } } setPropertyValue(animation.element, property, currentValue, tween.fn); } completeCall(animation); } } /** * When the finish action is triggered, the elements' currently active call is * immediately finished. When an element is finished, the next item in its * animation queue is immediately triggered. If passed via a chained call * then this will only target the animations in that call, and not the * elements linked to it. * * A queue name may be passed in to specify that only animations on the * named queue are finished. The default queue is named "". In addition the * value of `false` is allowed for the queue name. * * An final argument may be passed in to clear an element's remaining queued * calls. This may only be the value `true`. */ function finish(args, elements, promiseHandler) { var queueName = validateQueue(args[0], true), defaultQueue = defaults$1.queue, finishAll = args[queueName === undefined ? 0 : 1] === true; if (isVelocityResult(elements) && elements.velocity.animations) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = elements.velocity.animations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var animation = _step.value; checkAnimationShouldBeFinished(animation, queueName, defaultQueue); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } else { while (State.firstNew) { validateTweens(State.firstNew); } for (var activeCall = State.first, nextCall; activeCall && (finishAll || activeCall !== State.firstNew); activeCall = nextCall || State.firstNew) { nextCall = activeCall._next; if (!elements || elements.includes(activeCall.element)) { checkAnimationShouldBeFinished(activeCall, queueName, defaultQueue); } } } if (promiseHandler) { if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["finish", finish], true); /** * Used to map getters for the various AnimationFlags. */ var animationFlags = { isExpanded: 1 /* EXPANDED */ , isReady: 2 /* READY */ , isStarted: 4 /* STARTED */ , isStopped: 8 /* STOPPED */ , isPaused: 16 /* PAUSED */ , isSync: 32 /* SYNC */ , isReverse: 64 /* REVERSE */ }; /** * Get or set an option or running AnimationCall data value. If there is no * value passed then it will get, otherwise we will set. * * NOTE: When using "get" this will not touch the Promise as it is never * returned to the user. */ function option(args, elements, promiseHandler, action) { var key = args[0], queue = action.indexOf(".") >= 0 ? action.replace(/^.*\./, "") : undefined, queueName = queue === "false" ? false : validateQueue(queue, true); var animations = void 0, value = args[1]; if (!key) { console.warn("VelocityJS: Cannot access a non-existant key!"); return null; } // If we're chaining the return value from Velocity then we are only // interested in the values related to that call if (isVelocityResult(elements) && elements.velocity.animations) { animations = elements.velocity.animations; } else { animations = []; for (var activeCall = State.first; activeCall; activeCall = activeCall._next) { if (elements.indexOf(activeCall.element) >= 0 && getValue(activeCall.queue, activeCall.options.queue) === queueName) { animations.push(activeCall); } } // If we're dealing with multiple elements that are pointing at a // single running animation, then instead treat them as a single // animation. if (elements.length > 1 && animations.length > 1) { var i = 1, options = animations[0].options; while (i < animations.length) { if (animations[i++].options !== options) { options = null; break; } } // TODO: this needs to check that they're actually a sync:true animation to merge the results, otherwise the individual values may be different if (options) { animations = [animations[0]]; } } } // GET if (value === undefined) { var result = [], flag = animationFlags[key]; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = animations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var animation = _step.value; if (flag === undefined) { // A normal key to get. result.push(getValue(animation[key], animation.options[key])); } else { // A flag that we're checking against. result.push((animation._flags & flag) === 0); // tslint:disable-line:no-bitwise } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } if (elements.length === 1 && animations.length === 1) { // If only a single animation is found and we're only targetting a // single element, then return the value directly return result[0]; } return result; } // SET var isPercentComplete = void 0; switch (key) { case "cache": value = validateCache(value); break; case "begin": value = validateBegin(value); break; case "complete": value = validateComplete(value); break; case "delay": value = validateDelay(value); break; case "duration": value = validateDuration(value); break; case "fpsLimit": value = validateFpsLimit(value); break; case "loop": value = validateLoop(value); break; case "percentComplete": isPercentComplete = true; value = parseFloat(value); break; case "repeat": case "repeatAgain": value = validateRepeat(value); break; default: if (key[0] !== "_") { var num = parseFloat(value); if (value === String(num)) { value = num; } break; } // deliberate fallthrough case "queue": case "promise": case "promiseRejectEmpty": case "easing": case "started": console.warn("VelocityJS: Trying to set a read-only key:", key); return; } if (value === undefined || value !== value) { console.warn("VelocityJS: Trying to set an invalid value:" + key + "=" + value + " (" + args[1] + ")"); return null; } var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = animations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _animation = _step2.value; if (isPercentComplete) { _animation.timeStart = lastTick - getValue(_animation.duration, _animation.options.duration, defaults$1.duration) * value; } else { _animation[key] = value; } } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } if (promiseHandler) { if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["option", option], true); // Project /** * Check if an animation should be paused / resumed. */ function checkAnimation(animation, queueName, defaultQueue, isPaused) { if (queueName === undefined || queueName === getValue(animation.queue, animation.options.queue, defaultQueue)) { if (isPaused) { animation._flags |= 16 /* PAUSED */; // tslint:disable-line:no-bitwise } else { animation._flags &= ~16 /* PAUSED */; // tslint:disable-line:no-bitwise } } } /** * Pause and Resume are call-wide (not on a per element basis). Thus, calling pause or resume on a * single element will cause any calls that contain tweens for that element to be paused/resumed * as well. */ function pauseResume(args, elements, promiseHandler, action) { var isPaused = action.indexOf("pause") === 0, queue = action.indexOf(".") >= 0 ? action.replace(/^.*\./, "") : undefined, queueName = queue === "false" ? false : validateQueue(args[0]), defaultQueue = defaults$1.queue; if (isVelocityResult(elements) && elements.velocity.animations) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = elements.velocity.animations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var animation = _step.value; checkAnimation(animation, queueName, defaultQueue, isPaused); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } else { var activeCall = State.first; while (activeCall) { if (!elements || elements.includes(activeCall.element)) { checkAnimation(activeCall, queueName, defaultQueue, isPaused); } activeCall = activeCall._next; } } if (promiseHandler) { if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["pause", pauseResume], true); registerAction(["resume", pauseResume], true); // Project /** * Get or set a style of Nomralised property value on one or more elements. * If there is no value passed then it will get, otherwise we will set. * * NOTE: When using "get" this will not touch the Promise as it is never * returned to the user. * * This can fail to set, and will reject the Promise if it does so. * * Velocity(elements, "style", "property", "value") => elements; * Velocity(elements, "style", {"property": "value", ...}) => elements; * Velocity(element, "style", "property") => "value"; * Velocity(elements, "style", "property") => ["value", ...]; */ function propertyAction(args, elements, promiseHandler, action) { var property = args[0], value = args[1]; if (!property) { console.warn("VelocityJS: Cannot access a non-existant property!"); return null; } // GET if (value === undefined && !isPlainObject(property)) { if (Array.isArray(property)) { if (elements.length === 1) { var result = {}; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = property[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var prop = _step.value; result[prop] = fixColors(getPropertyValue(elements[0], prop)); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return result; } else { var _result = []; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = elements[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var element = _step2.value; var res = {}; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = property[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var _prop = _step3.value; res[_prop] = fixColors(getPropertyValue(element, _prop)); } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } _result.push(res); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return _result; } } else { // If only a single animation is found and we're only targetting a // single element, then return the value directly if (elements.length === 1) { return fixColors(getPropertyValue(elements[0], property)); } var _result2 = []; var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = elements[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var _element = _step4.value; _result2.push(fixColors(getPropertyValue(_element, property))); } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } return _result2; } } // SET var error = []; if (isPlainObject(property)) { for (var propertyName in property) { if (property.hasOwnProperty(propertyName)) { var _iteratorNormalCompletion5 = true; var _didIteratorError5 = false; var _iteratorError5 = undefined; try { for (var _iterator5 = elements[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { var _element2 = _step5.value; var propertyValue = property[propertyName]; if (isString(propertyValue) || isNumber(propertyValue)) { setPropertyValue(_element2, propertyName, property[propertyName]); } else { error.push("Cannot set a property \"" + propertyName + "\" to an unknown type: " + (typeof propertyValue === "undefined" ? "undefined" : _typeof(propertyValue))); console.warn("VelocityJS: Cannot set a property \"" + propertyName + "\" to an unknown type:", propertyValue); } } } catch (err) { _didIteratorError5 = true; _iteratorError5 = err; } finally { try { if (!_iteratorNormalCompletion5 && _iterator5.return) { _iterator5.return(); } } finally { if (_didIteratorError5) { throw _iteratorError5; } } } } } } else if (isString(value) || isNumber(value)) { var _iteratorNormalCompletion6 = true; var _didIteratorError6 = false; var _iteratorError6 = undefined; try { for (var _iterator6 = elements[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { var _element3 = _step6.value; setPropertyValue(_element3, property, String(value)); } } catch (err) { _didIteratorError6 = true; _iteratorError6 = err; } finally { try { if (!_iteratorNormalCompletion6 && _iterator6.return) { _iterator6.return(); } } finally { if (_didIteratorError6) { throw _iteratorError6; } } } } else { error.push("Cannot set a property \"" + property + "\" to an unknown type: " + (typeof value === "undefined" ? "undefined" : _typeof(value))); console.warn("VelocityJS: Cannot set a property \"" + property + "\" to an unknown type:", value); } if (promiseHandler) { if (error.length) { promiseHandler._rejecter(error.join(", ")); } else if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["property", propertyAction], true); // Project registerAction(["reverse", function (args, elements, promiseHandler, action) { // NOTE: Code needs to split out before here - but this is needed to prevent it being overridden throw new SyntaxError("VelocityJS: The 'reverse' action is built in and private."); }], true); // Project /** * Check if an animation should be stopped, and if so then set the STOPPED * flag on it, then call complete. */ function checkAnimationShouldBeStopped(animation, queueName, defaultQueue) { validateTweens(animation); if (queueName === undefined || queueName === getValue(animation.queue, animation.options.queue, defaultQueue)) { animation._flags |= 8 /* STOPPED */; // tslint:disable-line:no-bitwise completeCall(animation); } } /** * When the stop action is triggered, the elements' currently active call is * immediately stopped. When an element is stopped, the next item in its * animation queue is immediately triggered. If passed via a chained call * then this will only target the animations in that call, and not the * elements linked to it. * * A queue name may be passed in to specify that only animations on the * named queue are stopped. The default queue is named "". In addition the * value of `false` is allowed for the queue name. * * An final argument may be passed in to clear an element's remaining queued * calls. This may only be the value `true`. * * Note: The stop command runs prior to Velocity's Queueing phase since its * behavior is intended to take effect *immediately*, regardless of the * element's current queue state. */ function stop(args, elements, promiseHandler, action) { var queueName = validateQueue(args[0], true), defaultQueue = defaults$1.queue, finishAll = args[queueName === undefined ? 0 : 1] === true; if (isVelocityResult(elements) && elements.velocity.animations) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = elements.velocity.animations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var animation = _step.value; checkAnimationShouldBeStopped(animation, queueName, defaultQueue); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } else { while (State.firstNew) { validateTweens(State.firstNew); } for (var activeCall = State.first, nextCall; activeCall && (finishAll || activeCall !== State.firstNew); activeCall = nextCall || State.firstNew) { nextCall = activeCall._next; if (!elements || elements.includes(activeCall.element)) { checkAnimationShouldBeStopped(activeCall, queueName, defaultQueue); } } } if (promiseHandler) { if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["stop", stop], true); // Project registerAction(["style", propertyAction], true); // Project /** * */ function tweenAction(args, elements, promiseHandler, action) { var requireForcefeeding = void 0; if (!elements) { if (!args.length) { console.info("Velocity(, \"tween\", percentComplete, property, end | [end, , ], ) => value\nVelocity(, \"tween\", percentComplete, {property: end | [end, , ], ...}, ) => {property: value, ...}"); return null; } elements = [document.body]; requireForcefeeding = true; } else if (elements.length !== 1) { // TODO: Allow more than a single element to return an array of results throw new Error("VelocityJS: Cannot tween more than one element!"); } var percentComplete = args[0], fakeAnimation = { elements: elements, element: elements[0], queue: false, options: { duration: 1000 }, tweens: null }, result = {}; var properties = args[1], singleResult = void 0, maybeSequence = void 0, easing = args[2], count = 0; if (isString(args[1])) { if (SequencesObject && SequencesObject[args[1]]) { maybeSequence = SequencesObject[args[1]]; properties = {}; easing = args[2]; } else { singleResult = true; properties = defineProperty({}, args[1], args[2]); easing = args[3]; } } else if (Array.isArray(args[1])) { singleResult = true; properties = { tween: args[1] }; easing = args[2]; } if (!isNumber(percentComplete) || percentComplete < 0 || percentComplete > 1) { throw new Error("VelocityJS: Must tween a percentage from 0 to 1!"); } if (!isPlainObject(properties)) { throw new Error("VelocityJS: Cannot tween an invalid property!"); } if (requireForcefeeding) { for (var property in properties) { if (properties.hasOwnProperty(property) && (!Array.isArray(properties[property]) || properties[property].length < 2)) { throw new Error("VelocityJS: When not supplying an element you must force-feed values: " + property); } } } var activeEasing = validateEasing(getValue(easing, defaults$1.easing), DEFAULT_DURATION); if (maybeSequence) { expandSequence(fakeAnimation, maybeSequence); } else { expandProperties(fakeAnimation, properties); } // tslint:disable-next-line:forin for (var _property in fakeAnimation.tweens) { // For every element, iterate through each property. var propertyTween = fakeAnimation.tweens[_property], sequence = propertyTween.sequence, pattern = sequence.pattern; var currentValue = "", i = 0; count++; if (pattern) { var easingComplete = (propertyTween.easing || activeEasing)(percentComplete, 0, 1, _property); var best = 0; for (var j = 0; j < sequence.length - 1; j++) { if (sequence[j].percent < easingComplete) { best = j; } } var tweenFrom = sequence[best], tweenTo = sequence[best + 1] || tweenFrom, tweenPercent = (percentComplete - tweenFrom.percent) / (tweenTo.percent - tweenFrom.percent), tweenEasing = tweenTo.easing || linearEasing; for (; i < pattern.length; i++) { var startValue = tweenFrom[i]; if (startValue == null) { currentValue += pattern[i]; } else { var endValue = tweenTo[i]; if (startValue === endValue) { currentValue += startValue; } else { // All easings must deal with numbers except for our internal ones. var value = tweenEasing(tweenPercent, startValue, endValue, _property); currentValue += pattern[i] === true ? Math.round(value) : value; } } } result[_property] = currentValue; } } if (singleResult && count === 1) { for (var _property2 in result) { if (result.hasOwnProperty(_property2)) { return result[_property2]; } } } return result; } registerAction(["tween", tweenAction], true); // Project /** * Converting from hex as it makes for a smaller file. */ var colorValues = { aliceblue: 0xF0F8FF, antiquewhite: 0xFAEBD7, aqua: 0x00FFFF, aquamarine: 0x7FFFD4, azure: 0xF0FFFF, beige: 0xF5F5DC, bisque: 0xFFE4C4, black: 0x000000, blanchedalmond: 0xFFEBCD, blue: 0x0000FF, blueviolet: 0x8A2BE2, brown: 0xA52A2A, burlywood: 0xDEB887, cadetblue: 0x5F9EA0, chartreuse: 0x7FFF00, chocolate: 0xD2691E, coral: 0xFF7F50, cornflowerblue: 0x6495ED, cornsilk: 0xFFF8DC, crimson: 0xDC143C, cyan: 0x00FFFF, darkblue: 0x00008B, darkcyan: 0x008B8B, darkgoldenrod: 0xB8860B, darkgray: 0xA9A9A9, darkgrey: 0xA9A9A9, darkgreen: 0x006400, darkkhaki: 0xBDB76B, darkmagenta: 0x8B008B, darkolivegreen: 0x556B2F, darkorange: 0xFF8C00, darkorchid: 0x9932CC, darkred: 0x8B0000, darksalmon: 0xE9967A, darkseagreen: 0x8FBC8F, darkslateblue: 0x483D8B, darkslategray: 0x2F4F4F, darkslategrey: 0x2F4F4F, darkturquoise: 0x00CED1, darkviolet: 0x9400D3, deeppink: 0xFF1493, deepskyblue: 0x00BFFF, dimgray: 0x696969, dimgrey: 0x696969, dodgerblue: 0x1E90FF, firebrick: 0xB22222, floralwhite: 0xFFFAF0, forestgreen: 0x228B22, fuchsia: 0xFF00FF, gainsboro: 0xDCDCDC, ghostwhite: 0xF8F8FF, gold: 0xFFD700, goldenrod: 0xDAA520, gray: 0x808080, grey: 0x808080, green: 0x008000, greenyellow: 0xADFF2F, honeydew: 0xF0FFF0, hotpink: 0xFF69B4, indianred: 0xCD5C5C, indigo: 0x4B0082, ivory: 0xFFFFF0, khaki: 0xF0E68C, lavender: 0xE6E6FA, lavenderblush: 0xFFF0F5, lawngreen: 0x7CFC00, lemonchiffon: 0xFFFACD, lightblue: 0xADD8E6, lightcoral: 0xF08080, lightcyan: 0xE0FFFF, lightgoldenrodyellow: 0xFAFAD2, lightgray: 0xD3D3D3, lightgrey: 0xD3D3D3, lightgreen: 0x90EE90, lightpink: 0xFFB6C1, lightsalmon: 0xFFA07A, lightseagreen: 0x20B2AA, lightskyblue: 0x87CEFA, lightslategray: 0x778899, lightslategrey: 0x778899, lightsteelblue: 0xB0C4DE, lightyellow: 0xFFFFE0, lime: 0x00FF00, limegreen: 0x32CD32, linen: 0xFAF0E6, magenta: 0xFF00FF, maroon: 0x800000, mediumaquamarine: 0x66CDAA, mediumblue: 0x0000CD, mediumorchid: 0xBA55D3, mediumpurple: 0x9370DB, mediumseagreen: 0x3CB371, mediumslateblue: 0x7B68EE, mediumspringgreen: 0x00FA9A, mediumturquoise: 0x48D1CC, mediumvioletred: 0xC71585, midnightblue: 0x191970, mintcream: 0xF5FFFA, mistyrose: 0xFFE4E1, moccasin: 0xFFE4B5, navajowhite: 0xFFDEAD, navy: 0x000080, oldlace: 0xFDF5E6, olive: 0x808000, olivedrab: 0x6B8E23, orange: 0xFFA500, orangered: 0xFF4500, orchid: 0xDA70D6, palegoldenrod: 0xEEE8AA, palegreen: 0x98FB98, paleturquoise: 0xAFEEEE, palevioletred: 0xDB7093, papayawhip: 0xFFEFD5, peachpuff: 0xFFDAB9, peru: 0xCD853F, pink: 0xFFC0CB, plum: 0xDDA0DD, powderblue: 0xB0E0E6, purple: 0x800080, rebeccapurple: 0x663399, red: 0xFF0000, rosybrown: 0xBC8F8F, royalblue: 0x4169E1, saddlebrown: 0x8B4513, salmon: 0xFA8072, sandybrown: 0xF4A460, seagreen: 0x2E8B57, seashell: 0xFFF5EE, sienna: 0xA0522D, silver: 0xC0C0C0, skyblue: 0x87CEEB, slateblue: 0x6A5ACD, slategray: 0x708090, slategrey: 0x708090, snow: 0xFFFAFA, springgreen: 0x00FF7F, steelblue: 0x4682B4, tan: 0xD2B48C, teal: 0x008080, thistle: 0xD8BFD8, tomato: 0xFF6347, turquoise: 0x40E0D0, violet: 0xEE82EE, wheat: 0xF5DEB3, white: 0xFFFFFF, whitesmoke: 0xF5F5F5, yellow: 0xFFFF00, yellowgreen: 0x9ACD32 }; for (var name in colorValues) { if (colorValues.hasOwnProperty(name)) { var color = colorValues[name]; ColorNames[name] = Math.floor(color / 65536) + "," + Math.floor(color / 256 % 256) + "," + color % 256; } } // Project function registerBackIn(name, amount) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return Math.pow(percentComplete, 2) * ((amount + 1) * percentComplete - amount) * (endValue - startValue); }]); } function registerBackOut(name, amount) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return (Math.pow(--percentComplete, 2) * ((amount + 1) * percentComplete + amount) + 1) * (endValue - startValue); }]); } function registerBackInOut(name, amount) { amount *= 1.525; registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } percentComplete *= 2; return (percentComplete < 1 ? Math.pow(percentComplete, 2) * ((amount + 1) * percentComplete - amount) : Math.pow(percentComplete - 2, 2) * ((amount + 1) * (percentComplete - 2) + amount) + 2) * 0.5 * (endValue - startValue); }]); } registerBackIn("easeInBack", 1.7); registerBackOut("easeOutBack", 1.7); registerBackInOut("easeInOutBack", 1.7); // TODO: Expose these as actions to register custom easings? // Project function easeOutBouncePercent(percentComplete) { if (percentComplete < 1 / 2.75) { return 7.5625 * percentComplete * percentComplete; } if (percentComplete < 2 / 2.75) { return 7.5625 * (percentComplete -= 1.5 / 2.75) * percentComplete + 0.75; } if (percentComplete < 2.5 / 2.75) { return 7.5625 * (percentComplete -= 2.25 / 2.75) * percentComplete + 0.9375; } return 7.5625 * (percentComplete -= 2.625 / 2.75) * percentComplete + 0.984375; } function easeInBouncePercent(percentComplete) { return 1 - easeOutBouncePercent(1 - percentComplete); } function easeInBounce(percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return easeInBouncePercent(percentComplete) * (endValue - startValue); } function easeOutBounce(percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return easeOutBouncePercent(percentComplete) * (endValue - startValue); } function easeInOutBounce(percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return (percentComplete < 0.5 ? easeInBouncePercent(percentComplete * 2) * 0.5 : easeOutBouncePercent(percentComplete * 2 - 1) * 0.5 + 0.5) * (endValue - startValue); } registerEasing(["easeInBounce", easeInBounce]); registerEasing(["easeOutBounce", easeOutBounce]); registerEasing(["easeInOutBounce", easeInOutBounce]); // Project // Constants var PI2 = Math.PI * 2; function registerElasticIn(name, amplitude, period) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return -(amplitude * Math.pow(2, 10 * (percentComplete -= 1)) * Math.sin((percentComplete - period / PI2 * Math.asin(1 / amplitude)) * PI2 / period)) * (endValue - startValue); }]); } function registerElasticOut(name, amplitude, period) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return (amplitude * Math.pow(2, -10 * percentComplete) * Math.sin((percentComplete - period / PI2 * Math.asin(1 / amplitude)) * PI2 / period) + 1) * (endValue - startValue); }]); } function registerElasticInOut(name, amplitude, period) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } var s = period / PI2 * Math.asin(1 / amplitude); percentComplete = percentComplete * 2 - 1; return (percentComplete < 0 ? -0.5 * (amplitude * Math.pow(2, 10 * percentComplete) * Math.sin((percentComplete - s) * PI2 / period)) : amplitude * Math.pow(2, -10 * percentComplete) * Math.sin((percentComplete - s) * PI2 / period) * 0.5 + 1) * (endValue - startValue); }]); } registerElasticIn("easeInElastic", 1, 0.3); registerElasticOut("easeOutElastic", 1, 0.3); registerElasticInOut("easeInOutElastic", 1, 0.3 * 1.5); // TODO: Expose these as actions to register custom easings? // Project /** * Easing function that sets to the specified value immediately after the * animation starts. */ function atStart(percentComplete, startValue, endValue) { return percentComplete === 0 ? startValue : endValue; } /** * Easing function that sets to the specified value while the animation is * running. */ function during(percentComplete, startValue, endValue) { return percentComplete === 0 || percentComplete === 1 ? startValue : endValue; } /** * Easing function that sets to the specified value when the animation ends. */ function atEnd(percentComplete, startValue, endValue) { return percentComplete === 1 ? endValue : startValue; } registerEasing(["at-start", atStart]); registerEasing(["during", during]); registerEasing(["at-end", atEnd]); // Project /** * Get/set the inner/outer dimension. */ function getDimension(name, wantInner) { return function (element, propertyValue) { if (propertyValue === undefined) { return augmentDimension(element, name, wantInner) + "px"; } setPropertyValue(element, name, parseFloat(propertyValue) - augmentDimension(element, name, wantInner) + "px"); }; } registerNormalization(["Element", "innerWidth", getDimension("width", true)]); registerNormalization(["Element", "innerHeight", getDimension("height", true)]); registerNormalization(["Element", "outerWidth", getDimension("width", false)]); registerNormalization(["Element", "outerHeight", getDimension("height", false)]); // Project // Constants var inlineRx = /^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|let|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i, listItemRx = /^(li)$/i, tableRowRx = /^(tr)$/i, tableRx = /^(table)$/i, tableRowGroupRx = /^(tbody)$/i; function display(element, propertyValue) { var style = element.style; if (propertyValue === undefined) { return computePropertyValue(element, "display"); } if (propertyValue === "auto") { var nodeName = element && element.nodeName, data = Data(element); if (inlineRx.test(nodeName)) { propertyValue = "inline"; } else if (listItemRx.test(nodeName)) { propertyValue = "list-item"; } else if (tableRowRx.test(nodeName)) { propertyValue = "table-row"; } else if (tableRx.test(nodeName)) { propertyValue = "table"; } else if (tableRowGroupRx.test(nodeName)) { propertyValue = "table-row-group"; } else { // Default to "block" when no match is found. propertyValue = "block"; } // IMPORTANT: We need to do this as getPropertyValue bypasses the // Normalisation when it exists in the cache. data.cache["display"] = propertyValue; } style.display = propertyValue; } registerNormalization(["Element", "display", display]); // Project function clientWidth(element, propertyValue) { if (propertyValue == null) { return element.clientWidth + "px"; } } function scrollWidth(element, propertyValue) { if (propertyValue == null) { return element.scrollWidth + "px"; } } function clientHeight(element, propertyValue) { if (propertyValue == null) { return element.clientHeight + "px"; } } function scrollHeight(element, propertyValue) { if (propertyValue == null) { return element.scrollHeight + "px"; } } function scroll(direction, end) { return function (element, propertyValue) { if (propertyValue == null) { // Make sure we have these values cached. getPropertyValue(element, "client" + direction, null, true); getPropertyValue(element, "scroll" + direction, null, true); return element["scroll" + end] + "px"; } var value = parseFloat(propertyValue), unit = propertyValue.replace(String(value), ""); switch (unit) { case "": case "px": element["scroll" + end] = value; break; case "%": var client = parseFloat(getPropertyValue(element, "client" + direction)), scrollValue = parseFloat(getPropertyValue(element, "scroll" + direction)); element["scroll" + end] = Math.max(0, scrollValue - client) * value / 100; break; } }; } registerNormalization(["HTMLElement", "scroll", scroll("Height", "Top"), false]); registerNormalization(["HTMLElement", "scrollTop", scroll("Height", "Top"), false]); registerNormalization(["HTMLElement", "scrollLeft", scroll("Width", "Left"), false]); registerNormalization(["HTMLElement", "scrollWidth", scrollWidth]); registerNormalization(["HTMLElement", "clientWidth", clientWidth]); registerNormalization(["HTMLElement", "scrollHeight", scrollHeight]); registerNormalization(["HTMLElement", "clientHeight", clientHeight]); // Project /** * An RegExp pattern for the following list of css words using * http://kemio.com.ar/tools/lst-trie-re.php to generate: * * blockSize * borderBottomLeftRadius * borderBottomRightRadius * borderBottomWidth * borderImageOutset * borderImageWidth * borderLeftWidth * borderRadius * borderRightWidth * borderSpacing * borderTopLeftRadius * borderTopRightRadius * borderTopWidth * borderWidth * bottom * columnGap * columnRuleWidth * columnWidth * flexBasis * fontSize * gridColumnGap * gridGap * gridRowGap * height * inlineSize * left * letterSpacing * margin * marginBottom * marginLeft * marginRight * marginTop * maxBlockSize * maxHeight * maxInlineSize * maxWidth * minBlockSize * minHeight * minInlineSize * minWidth * objectPosition * outlineOffset * outlineWidth * padding * paddingBottom * paddingLeft * paddingRight * paddingTop * perspective * right * shapeMargin * strokeDashoffset * strokeWidth * textIndent * top * transformOrigin * width * wordSpacing */ // tslint:disable-next-line:max-line-length var rxAddPx = /^(b(lockSize|o(rder(Bottom(LeftRadius|RightRadius|Width)|Image(Outset|Width)|LeftWidth|R(adius|ightWidth)|Spacing|Top(LeftRadius|RightRadius|Width)|Width)|ttom))|column(Gap|RuleWidth|Width)|f(lexBasis|ontSize)|grid(ColumnGap|Gap|RowGap)|height|inlineSize|le(ft|tterSpacing)|m(a(rgin(Bottom|Left|Right|Top)|x(BlockSize|Height|InlineSize|Width))|in(BlockSize|Height|InlineSize|Width))|o(bjectPosition|utline(Offset|Width))|p(adding(Bottom|Left|Right|Top)|erspective)|right|s(hapeMargin|troke(Dashoffset|Width))|t(extIndent|op|ransformOrigin)|w(idth|ordSpacing))$/; /** * Return a Normalisation that can be used to set / get a prefixed style * property. */ function getSetPrefixed(propertyName, unprefixed) { return function (element, propertyValue) { if (propertyValue === undefined) { return computePropertyValue(element, propertyName) || computePropertyValue(element, unprefixed); } element.style[propertyName] = element.style[unprefixed] = propertyValue; }; } /** * Return a Normalisation that can be used to set / get a style property. */ function getSetStyle(propertyName) { return function (element, propertyValue) { if (propertyValue === undefined) { return computePropertyValue(element, propertyName); } element.style[propertyName] = propertyValue; }; } /** * Vendor prefixes. Chrome / Safari, Firefox, IE / Edge, Opera. */ var rxVendors = /^(webkit|moz|ms|o)[A-Z]/, prefixElement = State.prefixElement; if (prefixElement) { for (var propertyName in prefixElement.style) { if (rxVendors.test(propertyName)) { var unprefixed = propertyName.replace(/^[a-z]+([A-Z])/, function ($, letter) { return letter.toLowerCase(); }); { var addUnit = rxAddPx.test(unprefixed) ? "px" : undefined; registerNormalization(["Element", unprefixed, getSetPrefixed(propertyName, unprefixed), addUnit]); } } else if (!hasNormalization(["Element", propertyName])) { var _addUnit = rxAddPx.test(propertyName) ? "px" : undefined; registerNormalization(["Element", propertyName, getSetStyle(propertyName), _addUnit]); } } } // Project /** * Get/set an attribute. */ function getAttribute(name) { return function (element, propertyValue) { if (propertyValue === undefined) { return element.getAttribute(name); } element.setAttribute(name, propertyValue); }; } var base = document.createElement("div"), rxSubtype = /^SVG(.*)Element$/, rxElement = /Element$/; Object.getOwnPropertyNames(window).forEach(function (property) { var subtype = rxSubtype.exec(property); if (subtype && subtype[1] !== "SVG") { // Don't do SVGSVGElement. try { var element = subtype[1] ? document.createElementNS("http://www.w3.org/2000/svg", (subtype[1] || "svg").toLowerCase()) : document.createElement("svg"); // tslint:disable-next-line:forin for (var attribute in element) { // Although this isn't a tween without prototypes, we do // want to get hold of all attributes and not just own ones. var value = element[attribute]; if (isString(attribute) && !(attribute[0] === "o" && attribute[1] === "n") && attribute !== attribute.toUpperCase() && !rxElement.test(attribute) && !(attribute in base) && !isFunction(value)) { // TODO: Should this all be set on the generic SVGElement, it would save space and time, but not as powerful registerNormalization([property, attribute, getAttribute(attribute)]); } } } catch (e) { console.error("VelocityJS: Error when trying to identify SVG attributes on " + property + ".", e); } } }); // Project /** * Get/set the width or height. */ function getDimension$1(name) { return function (element, propertyValue) { if (propertyValue === undefined) { // Firefox throws an error if .getBBox() is called on an SVG that isn't attached to the DOM. try { return element.getBBox()[name] + "px"; } catch (e) { return "0px"; } } element.setAttribute(name, propertyValue); }; } registerNormalization(["SVGElement", "width", getDimension$1("width")]); registerNormalization(["SVGElement", "height", getDimension$1("height")]); // Project /** * A fake normalization used to allow the "tween" property easy access. */ function getSetTween(element, propertyValue) { if (propertyValue === undefined) { return ""; } } registerNormalization(["Element", "tween", getSetTween]); // Automatically generated var VERSION = "2.0.6"; // Project var Velocity$$1 = Velocity$1; /** * These parts of Velocity absolutely must be included, even if they're unused! */ var VelocityStatic; (function (VelocityStatic) { /** * Actions cannot be replaced if they are internal (hasOwnProperty is false * but they still exist). Otherwise they can be replaced by users. * * All external method calls should be using actions rather than sub-calls * of Velocity itself. */ VelocityStatic.Actions = Actions; /** * Our known easing functions. */ VelocityStatic.Easings = Easings; /** * The currently registered sequences. */ VelocityStatic.Sequences = SequencesObject; /** * Current internal state of Velocity. */ VelocityStatic.State = State; // tslint:disable-line:no-shadowed-variable /** * Velocity option defaults, which can be overriden by the user. */ VelocityStatic.defaults = defaults$1; /** * Used to patch any object to allow Velocity chaining. In order to chain an * object must either be treatable as an array - with a .length * property, and each member a Node, or a Node directly. * * By default Velocity will try to patch window, * jQuery, Zepto, and several classes that return * Nodes or lists of Nodes. */ VelocityStatic.patch = patch; /** * Set to true, 1 or 2 (most verbose) to output debug info to console. */ VelocityStatic.debug = false; /** * In mock mode, all animations are forced to complete immediately upon the * next rAF tick. If there are further animations queued then they will each * take one single frame in turn. Loops and repeats will be disabled while * mock = true. */ VelocityStatic.mock = false; /** * Save our version number somewhere visible. */ VelocityStatic.version = VERSION; /** * Added as a fallback for "import {Velocity} from 'velocity-animate';". */ VelocityStatic.Velocity = Velocity$1; // tslint:disable-line:no-shadowed-variable })(VelocityStatic || (VelocityStatic = {})); /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ var IE = function () { if (document.documentMode) { return document.documentMode; } else { for (var i = 7; i > 4; i--) { var div = document.createElement("div"); div.innerHTML = ""; if (div.getElementsByTagName("span").length) { div = null; return i; } } } return undefined; }(); /****************** Unsupported ******************/ if (IE <= 8) { throw new Error("VelocityJS cannot run on Internet Explorer 8 or earlier"); } /****************** Frameworks ******************/ if (window) { /* * Both jQuery and Zepto allow their $.fn object to be extended to allow * wrapped elements to be subjected to plugin calls. If either framework is * loaded, register a "velocity" extension pointing to Velocity's core * animate() method. Velocity also registers itself onto a global container * (window.jQuery || window.Zepto || window) so that certain features are * accessible beyond just a per-element scope. Accordingly, Velocity can * both act on wrapped DOM elements and stand alone for targeting raw DOM * elements. */ var jQuery = window.jQuery, Zepto = window.Zepto; patch(window, true); patch(Element && Element.prototype); patch(NodeList && NodeList.prototype); patch(HTMLCollection && HTMLCollection.prototype); patch(jQuery, true); patch(jQuery && jQuery.fn); patch(Zepto, true); patch(Zepto && Zepto.fn); } // Make sure that the values within Velocity are read-only and upatchable. var _loop = function _loop(property) { if (VelocityStatic.hasOwnProperty(property)) { switch (typeof property === "undefined" ? "undefined" : _typeof(property)) { case "number": case "boolean": defineProperty$1(Velocity$$1, property, { get: function get$$1() { return VelocityStatic[property]; }, set: function set$$1(value) { VelocityStatic[property] = value; } }, true); break; default: defineProperty$1(Velocity$$1, property, VelocityStatic[property], true); break; } } }; for (var property in VelocityStatic) { _loop(property); } Object.freeze(Velocity$$1); // Project var rxPercents = /(\d*\.\d+|\d+\.?|from|to)/g; function expandSequence(animation, sequence) { var tweens = animation.tweens = Object.create(null), element = animation.element; for (var propertyName in sequence.tweens) { if (sequence.tweens.hasOwnProperty(propertyName)) { var fn = getNormalization(element, propertyName); if (!fn && propertyName !== "tween") { if (Velocity$$1.debug) { console.log("Skipping [" + propertyName + "] due to a lack of browser support."); } continue; } tweens[propertyName] = { fn: fn, sequence: sequence.tweens[propertyName] }; } } } /** * Used to register a sequence. This should never be called by users * directly, instead it should be called via an action:
      * Velocity("registerSequence", ""name", VelocitySequence); */ function registerSequence(args) { if (isPlainObject(args[0])) { for (var name in args[0]) { if (args[0].hasOwnProperty(name)) { registerSequence([name, args[0][name]]); } } } else if (isString(args[0])) { var _name = args[0], sequence = args[1]; if (!isString(_name)) { console.warn("VelocityJS: Trying to set 'registerSequence' name to an invalid value:", _name); } else if (!isPlainObject(sequence)) { console.warn("VelocityJS: Trying to set 'registerSequence' sequence to an invalid value:", _name, sequence); } else { if (SequencesObject[_name]) { console.warn("VelocityJS: Replacing named sequence:", _name); } var percents = {}, steps = new Array(100), properties = [], sequenceList = SequencesObject[_name] = {}, duration = validateDuration(sequence.duration); sequenceList.tweens = {}; if (isNumber(duration)) { sequenceList.duration = duration; } for (var part in sequence) { if (sequence.hasOwnProperty(part)) { var keys = String(part).match(rxPercents); if (keys) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; var percent = key === "from" ? 0 : key === "to" ? 100 : parseFloat(key); if (percent < 0 || percent > 100) { console.warn("VelocityJS: Trying to use an invalid value as a percentage (0 <= n <= 100):", _name, percent); } else if (isNaN(percent)) { console.warn("VelocityJS: Trying to use an invalid number as a percentage:", _name, part, key); } else { if (!percents[String(percent)]) { percents[String(percent)] = []; } percents[String(percent)].push(part); for (var property in sequence[part]) { if (!properties.includes(property)) { properties.push(property); } } } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } } } var orderedPercents = Object.keys(percents).sort(function (a, b) { var a1 = parseFloat(a), b1 = parseFloat(b); return a1 > b1 ? 1 : a1 < b1 ? -1 : 0; }); orderedPercents.forEach(function (key) { steps.push.apply(percents[key]); }); var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = properties[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _property = _step2.value; var parts = [], propertyName = camelCase(_property); var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = orderedPercents[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var _key = _step3.value; var _iteratorNormalCompletion6 = true; var _didIteratorError6 = false; var _iteratorError6 = undefined; try { for (var _iterator6 = percents[_key][Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { var _value = _step6.value; var stepProperties = sequence[_value]; if (stepProperties[propertyName]) { parts.push(isString(stepProperties[propertyName]) ? stepProperties[propertyName] : stepProperties[propertyName][0]); } } } catch (err) { _didIteratorError6 = true; _iteratorError6 = err; } finally { try { if (!_iteratorNormalCompletion6 && _iterator6.return) { _iterator6.return(); } } finally { if (_didIteratorError6) { throw _iteratorError6; } } } } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } if (parts.length) { var realSequence = findPattern(parts, propertyName); var index = 0; if (realSequence) { var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = orderedPercents[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var _key2 = _step4.value; var _iteratorNormalCompletion5 = true; var _didIteratorError5 = false; var _iteratorError5 = undefined; try { for (var _iterator5 = percents[_key2][Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { var value = _step5.value; var originalProperty = sequence[value][propertyName]; if (originalProperty) { if (Array.isArray(originalProperty) && originalProperty.length > 1 && (isString(originalProperty[1]) || Array.isArray(originalProperty[1]))) { realSequence[index].easing = validateEasing(originalProperty[1], sequenceList.duration || DEFAULT_DURATION); } realSequence[index++].percent = parseFloat(_key2) / 100; } } } catch (err) { _didIteratorError5 = true; _iteratorError5 = err; } finally { try { if (!_iteratorNormalCompletion5 && _iterator5.return) { _iterator5.return(); } } finally { if (_didIteratorError5) { throw _iteratorError5; } } } } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } sequenceList.tweens[propertyName] = realSequence; } } } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } } } registerAction(["registerSequence", registerSequence], true); // Project var globalPromise = void 0; try { globalPromise = Promise; } catch ( /**/_a) {/**/} var noPromiseOption = ", if that is deliberate then pass `promiseRejectEmpty:false` as an option"; /** * Patch a VelocityResult with a Promise. */ function patchPromise(promiseObject, result) { defineProperty$1(result, "promise", promiseObject); defineProperty$1(result, "then", promiseObject.then.bind(promiseObject)); defineProperty$1(result, "catch", promiseObject.catch.bind(promiseObject)); if (promiseObject.finally) { // Semi-standard defineProperty$1(result, "finally", promiseObject.finally.bind(promiseObject)); } } /* tslint:enable:max-line-length */ function Velocity$1() { var /** * A shortcut to the default options. */ defaults$$1 = defaults$1, /** * Cache of the first argument - this is used often enough to be saved. */ args0 = arguments.length <= 0 ? undefined : arguments[0], /** * To allow for expressive CoffeeScript code, Velocity supports an * alternative syntax in which "elements" (or "e"), "properties" (or * "p"), and "options" (or "o") objects are defined on a container * object that's passed in as Velocity's sole argument. * * Note: Some browsers automatically populate arguments with a * "properties" object. We detect it by checking for its default * "names" property. */ // TODO: Confirm which browsers - if <=IE8 the we can drop completely syntacticSugar = isPlainObject(args0) && (args0.p || isPlainObject(args0.properties) && !args0.properties.names || isString(args0.properties)); var /** * When Velocity is called via the utility function (Velocity()), * elements are explicitly passed in as the first parameter. Thus, * argument positioning varies. */ argumentIndex = 0, /** * The list of elements, extended with Promise and Velocity. */ elements = void 0, /** * The properties being animated. This can be a string, in which case it * is either a function for these elements, or it is a "named" animation * sequence to use instead. Named sequences start with either "callout." * or "transition.". When used as a callout the values will be reset * after finishing. When used as a transtition then there is no special * handling after finishing. */ propertiesMap = void 0, /** * Options supplied, this will be mapped and validated into * options. */ optionsMap = void 0, /** * If called via a chain then this contains the last calls * animations. If this does not have a value then any access to the * element's animations needs to be to the currently-running ones. */ animations = void 0, /** * The promise that is returned. */ promise = void 0, // Used when the animation is finished resolver = void 0, // Used when there was an issue with one or more of the Velocity arguments rejecter = void 0; //console.log(`Velocity`, args) // First get the elements, and the animations connected to the last call if // this is chained. // TODO: Clean this up a bit // TODO: Throw error if the chain is called with elements as the first argument. isVelocityResult(this) && ( (isNode(arg0) || isWrapped(arg0)) && arg0 == this) if (isNode(this)) { // This is from a chain such as document.getElementById("").velocity(...) elements = [this]; } else if (isWrapped(this)) { // This might be a chain from something else, but if chained from a // previous Velocity() call then grab the animations it's related to. elements = cloneArray(this); if (isVelocityResult(this)) { animations = this.velocity.animations; } } else if (syntacticSugar) { elements = cloneArray(args0.elements || args0.e); argumentIndex++; } else if (isNode(args0)) { elements = cloneArray([args0]); argumentIndex++; } else if (isWrapped(args0)) { elements = cloneArray(args0); argumentIndex++; } // Allow elements to be chained. if (elements) { defineProperty$1(elements, "velocity", Velocity$1.bind(elements)); if (animations) { defineProperty$1(elements.velocity, "animations", animations); } } // Next get the propertiesMap and options. if (syntacticSugar) { propertiesMap = getValue(args0.properties, args0.p); } else { var _ref; // TODO: Should be possible to call Velocity("pauseAll") - currently not possible propertiesMap = (_ref = argumentIndex++, arguments.length <= _ref ? undefined : arguments[_ref]); } // Get any options map passed in as arguments first, expand any direct // options if possible. var isReverse = propertiesMap === "reverse", isAction = !isReverse && isString(propertiesMap), maybeSequence = isAction && SequencesObject[propertiesMap], opts = syntacticSugar ? getValue(args0.options, args0.o) : arguments.length <= argumentIndex ? undefined : arguments[argumentIndex]; if (isPlainObject(opts)) { optionsMap = opts; } // Create the promise if supported and wanted. if (globalPromise && getValue(optionsMap && optionsMap.promise, defaults$$1.promise)) { promise = new globalPromise(function (resolve, reject) { rejecter = reject; // IMPORTANT: // If a resolver tries to run on a Promise then it will wait until // that Promise resolves - but in this case we're running on our own // Promise, so need to make sure it's not seen as one. Removing // these values for the duration of the resolve. // Due to being an async call, they should be back to "normal" // before the .then() function gets called. resolver = function resolver(result) { if (isVelocityResult(result) && result.promise) { delete result.then; delete result.catch; delete result.finally; resolve(result); patchPromise(result.promise, result); } else { resolve(result); } }; }); if (elements) { patchPromise(promise, elements); } } if (promise) { var optionPromiseRejectEmpty = optionsMap && optionsMap.promiseRejectEmpty, promiseRejectEmpty = getValue(optionPromiseRejectEmpty, defaults$$1.promiseRejectEmpty); if (!elements && !isAction) { if (promiseRejectEmpty) { rejecter("Velocity: No elements supplied" + (isBoolean(optionPromiseRejectEmpty) ? "" : noPromiseOption) + ". Aborting."); } else { resolver(); } } else if (!propertiesMap) { if (promiseRejectEmpty) { rejecter("Velocity: No properties supplied" + (isBoolean(optionPromiseRejectEmpty) ? "" : noPromiseOption) + ". Aborting."); } else { resolver(); } } } if (!elements && !isAction || !propertiesMap) { return promise; } // NOTE: Can't use isAction here due to type inference - there are callbacks // between so the type isn't considered safe. if (isAction) { var actionArgs = [], promiseHandler = promise && { _promise: promise, _resolver: resolver, _rejecter: rejecter }; while (argumentIndex < arguments.length) { var _ref2; actionArgs.push((_ref2 = argumentIndex++, arguments.length <= _ref2 ? undefined : arguments[_ref2])); } // Velocity's behavior is categorized into "actions". If a string is // passed in instead of a propertiesMap then that will call a function // to do something special to the animation linked. // There is one special case - "reverse" - which is handled differently, // by being stored on the animation and then expanded when the animation // starts. var action = propertiesMap.replace(/\..*$/, ""), callback = Actions[action]; if (callback) { var result = callback(actionArgs, elements, promiseHandler, propertiesMap); if (result !== undefined) { return result; } return elements || promise; } else if (!maybeSequence) { console.error("VelocityJS: First argument (" + propertiesMap + ") was not a property map, a known action, or a registered redirect. Aborting."); return; } } var hasValidDuration = void 0; if (isPlainObject(propertiesMap) || isReverse || maybeSequence) { /** * The options for this set of animations. */ var options = {}; var isSync = defaults$$1.sync; // Private options first - set as non-enumerable, and starting with an // underscore so we can filter them out. if (promise) { defineProperty$1(options, "_promise", promise); defineProperty$1(options, "_rejecter", rejecter); defineProperty$1(options, "_resolver", resolver); } defineProperty$1(options, "_ready", 0); defineProperty$1(options, "_started", 0); defineProperty$1(options, "_completed", 0); defineProperty$1(options, "_total", 0); // Now check the optionsMap if (isPlainObject(optionsMap)) { var validDuration = validateDuration(optionsMap.duration); hasValidDuration = validDuration !== undefined; options.duration = getValue(validDuration, defaults$$1.duration); options.delay = getValue(validateDelay(optionsMap.delay), defaults$$1.delay); // Need the extra fallback here in case it supplies an invalid // easing that we need to overrride with the default. options.easing = validateEasing(getValue(optionsMap.easing, defaults$$1.easing), options.duration) || validateEasing(defaults$$1.easing, options.duration); options.loop = getValue(validateLoop(optionsMap.loop), defaults$$1.loop); options.repeat = options.repeatAgain = getValue(validateRepeat(optionsMap.repeat), defaults$$1.repeat); if (optionsMap.speed != null) { options.speed = getValue(validateSpeed(optionsMap.speed), 1); } if (isBoolean(optionsMap.promise)) { options.promise = optionsMap.promise; } options.queue = getValue(validateQueue(optionsMap.queue), defaults$$1.queue); if (optionsMap.mobileHA && !State.isGingerbread) { /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack) on animating elements. HA is removed from the element at the completion of its animation. */ /* Note: Android Gingerbread doesn't support HA. If a null transform hack (mobileHA) is in fact set, it will prevent other tranform subproperties from taking effect. */ /* Note: You can read more about the use of mobileHA in Velocity's documentation: velocity-animate/#mobileHA. */ options.mobileHA = true; } if (optionsMap.drag === true) { options.drag = true; } if (isNumber(optionsMap.stagger) || isFunction(optionsMap.stagger)) { options.stagger = optionsMap.stagger; } if (!isReverse) { if (optionsMap["display"] != null) { propertiesMap.display = optionsMap["display"]; console.error("Deprecated \"options.display\" used, this is now a property:", optionsMap["display"]); } if (optionsMap["visibility"] != null) { propertiesMap.visibility = optionsMap["visibility"]; console.error("Deprecated \"options.visibility\" used, this is now a property:", optionsMap["visibility"]); } } // TODO: Allow functional options for different options per element var optionsBegin = validateBegin(optionsMap.begin), optionsComplete = validateComplete(optionsMap.complete), optionsProgress = validateProgress(optionsMap.progress), optionsSync = validateSync(optionsMap.sync); if (optionsBegin != null) { options.begin = optionsBegin; } if (optionsComplete != null) { options.complete = optionsComplete; } if (optionsProgress != null) { options.progress = optionsProgress; } if (optionsSync != null) { isSync = optionsSync; } } else if (!syntacticSugar) { // Expand any direct options if possible. var offset = 0; options.duration = validateDuration(arguments.length <= argumentIndex ? undefined : arguments[argumentIndex], true); if (options.duration === undefined) { options.duration = defaults$$1.duration; } else { hasValidDuration = true; offset++; } if (!isFunction(arguments.length <= argumentIndex + offset ? undefined : arguments[argumentIndex + offset])) { // Despite coming before Complete, we can't pass a fn easing var easing = validateEasing(arguments.length <= argumentIndex + offset ? undefined : arguments[argumentIndex + offset], getValue(options && validateDuration(options.duration), defaults$$1.duration), true); if (easing !== undefined) { offset++; options.easing = easing; } } var complete = validateComplete(arguments.length <= argumentIndex + offset ? undefined : arguments[argumentIndex + offset], true); if (complete !== undefined) { options.complete = complete; } options.delay = defaults$$1.delay; options.loop = defaults$$1.loop; options.repeat = options.repeatAgain = defaults$$1.repeat; } if (isReverse && options.queue === false) { throw new Error("VelocityJS: Cannot reverse a queue:false animation."); } if (!hasValidDuration && maybeSequence && maybeSequence.duration) { options.duration = maybeSequence.duration; } // When a set of elements is targeted by a Velocity call, the set is // broken up and each element has the current Velocity call individually // queued onto it. In this way, each element's existing queue is // respected; some elements may already be animating and accordingly // should not have this current Velocity call triggered immediately // unless the sync:true option is used. var rootAnimation = { options: options, elements: elements, _prev: undefined, _next: undefined, _flags: isSync ? 32 /* SYNC */ : 0, percentComplete: 0, ellapsedTime: 0, timeStart: 0 }; animations = []; for (var index = 0; index < elements.length; index++) { var element = elements[index]; var flags = 0; if (isNode(element)) { // TODO: This needs to check for valid animation targets, not just Elements if (isReverse) { var lastAnimation = Data(element).lastAnimationList[options.queue]; propertiesMap = lastAnimation && lastAnimation.tweens; if (!propertiesMap) { console.error("VelocityJS: Attempting to reverse an animation on an element with no previous animation:", element); continue; } flags |= 64 /* REVERSE */ & ~(lastAnimation._flags & 64 /* REVERSE */); // tslint:disable-line:no-bitwise } var animation = Object.assign({}, rootAnimation, { element: element, _flags: rootAnimation._flags | flags }); options._total++; animations.push(animation); if (options.stagger) { if (isFunction(options.stagger)) { var num = optionCallback(options.stagger, element, index, elements.length, elements, "stagger"); if (isNumber(num)) { animation.delay = options.delay + num; } } else { animation.delay = options.delay + options.stagger * index; } } if (options.drag) { animation.duration = options.duration - options.duration * Math.max(1 - (index + 1) / elements.length, 0.75); } if (maybeSequence) { expandSequence(animation, maybeSequence); } else if (isReverse) { // In this case we're using the previous animation, so // it will be expanded correctly when that one runs. animation.tweens = propertiesMap; } else { animation.tweens = Object.create(null); expandProperties(animation, propertiesMap); } queue$1(element, animation, options.queue); } } if (State.isTicking === false) { // If the animation tick isn't running, start it. (Velocity shuts it // off when there are no active calls to process.) tick(false); } if (animations) { defineProperty$1(elements.velocity, "animations", animations); } } /*************** Chaining ***************/ /* Return the elements back to the call chain, with wrapped elements taking precedence in case Velocity was called via the $.fn. extension. */ return elements || promise; } /** * Call an option callback in a try/catch block and report an error if needed. */ function optionCallback(fn, element, index, length, elements, option) { try { return fn.call(element, index, length, elements, option); } catch (e) { console.error("VelocityJS: Exception when calling '" + option + "' callback:", e); } } // Project /** * Used to patch any object to allow Velocity chaining. In order to chain an * object must either be treatable as an array - with a .length * property, and each member a Node, or a Node directly. * * By default Velocity will try to patch window, * jQuery, Zepto, and several classes that return * Nodes or lists of Nodes. */ function patch(proto, global) { try { defineProperty$1(proto, (global ? "V" : "v") + "elocity", Velocity$1); } catch (e) { console.warn("VelocityJS: Error when trying to add prototype.", e); } } // Project var Velocity$2 = Velocity$1; /** * These parts of Velocity absolutely must be included, even if they're unused! */ var VelocityStatic$1; (function (VelocityStatic) { /** * Actions cannot be replaced if they are internal (hasOwnProperty is false * but they still exist). Otherwise they can be replaced by users. * * All external method calls should be using actions rather than sub-calls * of Velocity itself. */ VelocityStatic.Actions = Actions; /** * Our known easing functions. */ VelocityStatic.Easings = Easings; /** * The currently registered sequences. */ VelocityStatic.Sequences = SequencesObject; /** * Current internal state of Velocity. */ VelocityStatic.State = State; // tslint:disable-line:no-shadowed-variable /** * Velocity option defaults, which can be overriden by the user. */ VelocityStatic.defaults = defaults$1; /** * Used to patch any object to allow Velocity chaining. In order to chain an * object must either be treatable as an array - with a .length * property, and each member a Node, or a Node directly. * * By default Velocity will try to patch window, * jQuery, Zepto, and several classes that return * Nodes or lists of Nodes. */ VelocityStatic.patch = patch; /** * Set to true, 1 or 2 (most verbose) to output debug info to console. */ VelocityStatic.debug = false; /** * In mock mode, all animations are forced to complete immediately upon the * next rAF tick. If there are further animations queued then they will each * take one single frame in turn. Loops and repeats will be disabled while * mock = true. */ VelocityStatic.mock = false; /** * Save our version number somewhere visible. */ VelocityStatic.version = VERSION; /** * Added as a fallback for "import {Velocity} from 'velocity-animate';". */ VelocityStatic.Velocity = Velocity$1; // tslint:disable-line:no-shadowed-variable })(VelocityStatic$1 || (VelocityStatic$1 = {})); /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ var IE$1 = function () { if (document.documentMode) { return document.documentMode; } else { for (var i = 7; i > 4; i--) { var div = document.createElement("div"); div.innerHTML = ""; if (div.getElementsByTagName("span").length) { div = null; return i; } } } return undefined; }(); /****************** Unsupported ******************/ if (IE$1 <= 8) { throw new Error("VelocityJS cannot run on Internet Explorer 8 or earlier"); } /****************** Frameworks ******************/ if (window) { /* * Both jQuery and Zepto allow their $.fn object to be extended to allow * wrapped elements to be subjected to plugin calls. If either framework is * loaded, register a "velocity" extension pointing to Velocity's core * animate() method. Velocity also registers itself onto a global container * (window.jQuery || window.Zepto || window) so that certain features are * accessible beyond just a per-element scope. Accordingly, Velocity can * both act on wrapped DOM elements and stand alone for targeting raw DOM * elements. */ var jQuery$1 = window.jQuery, Zepto$1 = window.Zepto; patch(window, true); patch(Element && Element.prototype); patch(NodeList && NodeList.prototype); patch(HTMLCollection && HTMLCollection.prototype); patch(jQuery$1, true); patch(jQuery$1 && jQuery$1.fn); patch(Zepto$1, true); patch(Zepto$1 && Zepto$1.fn); } // Make sure that the values within Velocity are read-only and upatchable. var _loop$1 = function _loop(property) { if (VelocityStatic$1.hasOwnProperty(property)) { switch (typeof property === "undefined" ? "undefined" : _typeof(property)) { case "number": case "boolean": defineProperty$1(Velocity$2, property, { get: function get$$1() { return VelocityStatic$1[property]; }, set: function set$$1(value) { VelocityStatic$1[property] = value; } }, true); break; default: defineProperty$1(Velocity$2, property, VelocityStatic$1[property], true); break; } } }; for (var property$1 in VelocityStatic$1) { _loop$1(property$1); } Object.freeze(Velocity$2); export default Velocity$2; //# sourceMappingURL=velocity.es5.js.map ================================================ FILE: velocity.js ================================================ /** * velocity-animate (C) 2014-2017 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.Velocity = factory()); }(this, (function () { 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var defineProperty = function (obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }; /** * Check if a variable is a boolean. */ function isBoolean(variable) { return variable === true || variable === false; } /** * Check if a variable is a function. */ function isFunction(variable) { return Object.prototype.toString.call(variable) === "[object Function]"; } /** * Check if a variable is an HTMLElement or SVGElement. */ function isNode(variable) { return !!(variable && variable.nodeType); } /** * Check if a variable is a number. */ function isNumber(variable) { return typeof variable === "number"; } /** * Check if a variable is a plain object (and not an instance). */ function isPlainObject(variable) { if (!variable || (typeof variable === "undefined" ? "undefined" : _typeof(variable)) !== "object" || variable.nodeType || Object.prototype.toString.call(variable) !== "[object Object]") { return false; } var proto = Object.getPrototypeOf(variable); return !proto || proto.hasOwnProperty("constructor") && proto.constructor === Object; } /** * Check if a variable is a string. */ function isString(variable) { return typeof variable === "string"; } /** * Check if a variable is the result of calling Velocity. */ function isVelocityResult(variable) { return variable && isNumber(variable.length) && isFunction(variable.velocity); } /** * Check if a variable is an array-like wrapped jQuery, Zepto or similar, where * each indexed value is a Node. */ function isWrapped(variable) { return variable && variable !== window && isNumber(variable.length) && !isString(variable) && !isFunction(variable) && !isNode(variable) && (variable.length === 0 || isNode(variable[0])); } /** * Check is a property is an enumerable member of an object. */ function propertyIsEnumerable(obj, property) { return Object.prototype.propertyIsEnumerable.call(obj, property); } // Project /** * Add a single className to an Element. */ function addClass(element, className) { if (element instanceof Element) { if (element.classList) { element.classList.add(className); } else { removeClass(element, className); element.className += (element.className.length ? " " : "") + className; } } } /** * Clone an array, works for array-like too. */ function cloneArray(arrayLike) { return Array.prototype.slice.call(arrayLike, 0); } /** * The defineProperty() function provides a * shortcut to defining a property that cannot be accidentally iterated across. */ function defineProperty$1(proto, name, value, readonly) { if (proto) { Object.defineProperty(proto, name, { configurable: !readonly, writable: !readonly, value: value }); } } /** * When there are multiple locations for a value pass them all in, then get the * first value that is valid. */ function getValue() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var arg = _step.value; if (arg !== undefined && arg === arg) { return arg; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } /** * Shim to get the current milliseconds - on anything except old IE it'll use * Date.now() and save creating an object. If that doesn't exist then it'll * create one that gets GC. */ var now = Date.now ? Date.now : function () { return new Date().getTime(); }; /** * Remove a single className from an Element. */ function removeClass(element, className) { if (element instanceof Element) { if (element.classList) { element.classList.remove(className); } else { // TODO: Need some jsperf tests on performance - can we get rid of the regex and maybe use split / array manipulation? element.className = element.className.replace(new RegExp("(^|\\s)" + className + "(\\s|$)", "gi"), " "); } } } // Project // Constants var Actions = {}; /** * Used to register an action. This should never be called by users * directly, instead it should be called via an action:
      * Velocity("registerAction", "name", VelocityActionFn); */ function registerAction(args, internal) { var name = args[0], callback = args[1]; if (!isString(name)) { console.warn("VelocityJS: Trying to set 'registerAction' name to an invalid value:", name); } else if (!isFunction(callback)) { console.warn("VelocityJS: Trying to set 'registerAction' callback to an invalid value:", name, callback); } else if (Actions[name] && !propertyIsEnumerable(Actions, name)) { console.warn("VelocityJS: Trying to override internal 'registerAction' callback", name); } else if (internal === true) { defineProperty$1(Actions, name, callback); } else { Actions[name] = callback; } } registerAction(["registerAction", registerAction], true); /** * Without this it will only un-prefix properties that have a valid "normal" * version. */ var DURATION_FAST = 200; var DURATION_NORMAL = 400; var DURATION_SLOW = 600; var FUZZY_MS_PER_SECOND = 980; var DEFAULT_CACHE = true; var DEFAULT_DELAY = 0; var DEFAULT_DURATION = DURATION_NORMAL; var DEFAULT_EASING = "swing"; var DEFAULT_FPSLIMIT = 60; var DEFAULT_LOOP = 0; var DEFAULT_PROMISE = true; var DEFAULT_PROMISE_REJECT_EMPTY = true; var DEFAULT_QUEUE = ""; var DEFAULT_REPEAT = 0; var DEFAULT_SPEED = 1; var DEFAULT_SYNC = true; var CLASSNAME = "velocity-animating"; var Duration = { fast: DURATION_FAST, normal: DURATION_NORMAL, slow: DURATION_SLOW }; // Project // Constants var Easings = {}; /** * Used to register a easing. This should never be called by users * directly, instead it should be called via an action:
      * Velocity("registerEasing", "name", VelocityEasingFn); */ function registerEasing(args) { var name = args[0], callback = args[1]; if (!isString(name)) { console.warn("VelocityJS: Trying to set 'registerEasing' name to an invalid value:", name); } else if (!isFunction(callback)) { console.warn("VelocityJS: Trying to set 'registerEasing' callback to an invalid value:", name, callback); } else if (Easings[name]) { console.warn("VelocityJS: Trying to override 'registerEasing' callback", name); } else { Easings[name] = callback; } } registerAction(["registerEasing", registerEasing], true); /** * Linear easing, used for sequence parts that don't have an actual easing * function. */ function linearEasing(percentComplete, startValue, endValue, property) { return startValue + percentComplete * (endValue - startValue); } /** * Swing is the default for jQuery and Velocity. */ function swingEasing(percentComplete, startValue, endValue) { return startValue + (0.5 - Math.cos(percentComplete * Math.PI) / 2) * (endValue - startValue); } /** * A less exaggerated version of easeInOutElastic. */ function springEasing(percentComplete, startValue, endValue) { return startValue + (1 - Math.cos(percentComplete * 4.5 * Math.PI) * Math.exp(-percentComplete * 6)) * (endValue - startValue); } registerEasing(["linear", linearEasing]); registerEasing(["swing", swingEasing]); registerEasing(["spring", springEasing]); // Project /** * Fix to a range of 0 <= num <= 1. */ function fixRange(num) { return Math.min(Math.max(num, 0), 1); } function A(aA1, aA2) { return 1 - 3 * aA2 + 3 * aA1; } function B(aA1, aA2) { return 3 * aA2 - 6 * aA1; } function C(aA1) { return 3 * aA1; } function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; } function getSlope(aT, aA1, aA2) { return 3 * A(aA1, aA2) * aT * aT + 2 * B(aA1, aA2) * aT + C(aA1); } function generateBezier() { var NEWTON_ITERATIONS = 4, NEWTON_MIN_SLOPE = 0.001, SUBDIVISION_PRECISION = 0.0000001, SUBDIVISION_MAX_ITERATIONS = 10, kSplineTableSize = 11, kSampleStepSize = 1 / (kSplineTableSize - 1), float32ArraySupported = "Float32Array" in window; /* Must contain four args. */ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (args.length !== 4) { return; } /* Args must be numbers. */ for (var i = 0; i < 4; ++i) { if (typeof args[i] !== "number" || isNaN(args[i]) || !isFinite(args[i])) { return; } } /* X values must be in the [0, 1] range. */ var mX1 = fixRange(args[0]); var mY1 = args[1]; var mX2 = fixRange(args[2]); var mY2 = args[3]; var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); function newtonRaphsonIterate(aX, aGuessT) { for (var _i = 0; _i < NEWTON_ITERATIONS; ++_i) { var currentSlope = getSlope(aGuessT, mX1, mX2); if (currentSlope === 0) { return aGuessT; } var currentX = calcBezier(aGuessT, mX1, mX2) - aX; aGuessT -= currentX / currentSlope; } return aGuessT; } function calcSampleValues() { for (var _i2 = 0; _i2 < kSplineTableSize; ++_i2) { mSampleValues[_i2] = calcBezier(_i2 * kSampleStepSize, mX1, mX2); } } function binarySubdivide(aX, aA, aB) { var currentX = void 0, currentT = void 0, i = 0; do { currentT = aA + (aB - aA) / 2; currentX = calcBezier(currentT, mX1, mX2) - aX; if (currentX > 0) { aB = currentT; } else { aA = currentT; } } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); return currentT; } function getTForX(aX) { var lastSample = kSplineTableSize - 1; var intervalStart = 0, currentSample = 1; for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { intervalStart += kSampleStepSize; } --currentSample; var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), guessForT = intervalStart + dist * kSampleStepSize, initialSlope = getSlope(guessForT, mX1, mX2); if (initialSlope >= NEWTON_MIN_SLOPE) { return newtonRaphsonIterate(aX, guessForT); } else if (initialSlope === 0) { return guessForT; } else { return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); } } var precomputed = false; function precompute() { precomputed = true; if (mX1 !== mY1 || mX2 !== mY2) { calcSampleValues(); } } var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")", f = function f(percentComplete, startValue, endValue, property) { if (!precomputed) { precompute(); } if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } if (mX1 === mY1 && mX2 === mY2) { return startValue + percentComplete * (endValue - startValue); } return startValue + calcBezier(getTForX(percentComplete), mY1, mY2) * (endValue - startValue); }; f.getControlPoints = function () { return [{ x: mX1, y: mY1 }, { x: mX2, y: mY2 }]; }; f.toString = function () { return str; }; return f; } /* Common easings */ var easeIn = generateBezier(0.42, 0, 1, 1), easeOut = generateBezier(0, 0, 0.58, 1), easeInOut = generateBezier(0.42, 0, 0.58, 1); registerEasing(["ease", generateBezier(0.25, 0.1, 0.25, 1)]); registerEasing(["easeIn", easeIn]); registerEasing(["ease-in", easeIn]); registerEasing(["easeOut", easeOut]); registerEasing(["ease-out", easeOut]); registerEasing(["easeInOut", easeInOut]); registerEasing(["ease-in-out", easeInOut]); registerEasing(["easeInSine", generateBezier(0.47, 0, 0.745, 0.715)]); registerEasing(["easeOutSine", generateBezier(0.39, 0.575, 0.565, 1)]); registerEasing(["easeInOutSine", generateBezier(0.445, 0.05, 0.55, 0.95)]); registerEasing(["easeInQuad", generateBezier(0.55, 0.085, 0.68, 0.53)]); registerEasing(["easeOutQuad", generateBezier(0.25, 0.46, 0.45, 0.94)]); registerEasing(["easeInOutQuad", generateBezier(0.455, 0.03, 0.515, 0.955)]); registerEasing(["easeInCubic", generateBezier(0.55, 0.055, 0.675, 0.19)]); registerEasing(["easeOutCubic", generateBezier(0.215, 0.61, 0.355, 1)]); registerEasing(["easeInOutCubic", generateBezier(0.645, 0.045, 0.355, 1)]); registerEasing(["easeInQuart", generateBezier(0.895, 0.03, 0.685, 0.22)]); registerEasing(["easeOutQuart", generateBezier(0.165, 0.84, 0.44, 1)]); registerEasing(["easeInOutQuart", generateBezier(0.77, 0, 0.175, 1)]); registerEasing(["easeInQuint", generateBezier(0.755, 0.05, 0.855, 0.06)]); registerEasing(["easeOutQuint", generateBezier(0.23, 1, 0.32, 1)]); registerEasing(["easeInOutQuint", generateBezier(0.86, 0, 0.07, 1)]); registerEasing(["easeInExpo", generateBezier(0.95, 0.05, 0.795, 0.035)]); registerEasing(["easeOutExpo", generateBezier(0.19, 1, 0.22, 1)]); registerEasing(["easeInOutExpo", generateBezier(1, 0, 0, 1)]); registerEasing(["easeInCirc", generateBezier(0.6, 0.04, 0.98, 0.335)]); registerEasing(["easeOutCirc", generateBezier(0.075, 0.82, 0.165, 1)]); registerEasing(["easeInOutCirc", generateBezier(0.785, 0.135, 0.15, 0.86)]); /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ function springAccelerationForState(state) { return -state.tension * state.x - state.friction * state.v; } function springEvaluateStateWithDerivative(initialState, dt, derivative) { var state = { x: initialState.x + derivative.dx * dt, v: initialState.v + derivative.dv * dt, tension: initialState.tension, friction: initialState.friction }; return { dx: state.v, dv: springAccelerationForState(state) }; } function springIntegrateState(state, dt) { var a = { dx: state.v, dv: springAccelerationForState(state) }, b = springEvaluateStateWithDerivative(state, dt * 0.5, a), c = springEvaluateStateWithDerivative(state, dt * 0.5, b), d = springEvaluateStateWithDerivative(state, dt, c), dxdt = 1 / 6 * (a.dx + 2 * (b.dx + c.dx) + d.dx), dvdt = 1 / 6 * (a.dv + 2 * (b.dv + c.dv) + d.dv); state.x = state.x + dxdt * dt; state.v = state.v + dvdt * dt; return state; } function generateSpringRK4(tension, friction, duration) { var initState = { x: -1, v: 0, tension: parseFloat(tension) || 500, friction: parseFloat(friction) || 20 }, path = [0], tolerance = 1 / 10000, DT = 16 / 1000, haveDuration = duration != null; // deliberate "==", as undefined == null != 0 var timeLapsed = 0, dt = void 0, lastState = void 0; /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ if (haveDuration) { /* Run the simulation without a duration. */ timeLapsed = generateSpringRK4(initState.tension, initState.friction); /* Compute the adjusted time delta. */ dt = timeLapsed / duration * DT; } else { dt = DT; } while (true) { /* Next/step function .*/ lastState = springIntegrateState(lastState || initState, dt); /* Store the position. */ path.push(1 + lastState.x); timeLapsed += 16; /* If the change threshold is reached, break. */ if (!(Math.abs(lastState.x) > tolerance && Math.abs(lastState.v) > tolerance)) { break; } } /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the computed path and returns a snapshot of the position according to a given percentComplete. */ return !haveDuration ? timeLapsed : function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return startValue + path[Math.floor(percentComplete * (path.length - 1))] * (endValue - startValue); }; } // Constants var cache = {}; function generateStep(steps) { var fn = cache[steps]; if (fn) { return fn; } return cache[steps] = function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return startValue + Math.round(percentComplete * steps) * (1 / steps) * (endValue - startValue); }; } // Project /** * Parse a duration value and return an ms number. Optionally return a * default value if the number is not valid. */ function parseDuration(duration, def) { if (isNumber(duration)) { return duration; } if (isString(duration)) { return Duration[duration.toLowerCase()] || parseFloat(duration.replace("ms", "").replace("s", "000")); } return def == null ? undefined : parseDuration(def); } /** * Validate a cache option. */ function validateCache(value) { if (isBoolean(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'cache' to an invalid value:", value); } } /** * Validate a begin option. */ function validateBegin(value) { if (isFunction(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'begin' to an invalid value:", value); } } /** * Validate a complete option. */ function validateComplete(value, noError) { if (isFunction(value)) { return value; } if (value != null && !noError) { console.warn("VelocityJS: Trying to set 'complete' to an invalid value:", value); } } /** * Validate a delay option. */ function validateDelay(value) { var parsed = parseDuration(value); if (!isNaN(parsed)) { return parsed; } if (value != null) { console.error("VelocityJS: Trying to set 'delay' to an invalid value:", value); } } /** * Validate a duration option. */ function validateDuration(value, noError) { var parsed = parseDuration(value); if (!isNaN(parsed) && parsed >= 0) { return parsed; } if (value != null && !noError) { console.error("VelocityJS: Trying to set 'duration' to an invalid value:", value); } } /** * Validate a easing option. */ function validateEasing(value, duration, noError) { if (isString(value)) { // Named easing return Easings[value]; } if (isFunction(value)) { return value; } // TODO: We should only do these if the correct function exists - don't force loading. if (Array.isArray(value)) { if (value.length === 1) { // Steps return generateStep(value[0]); } if (value.length === 2) { // springRK4 must be passed the animation's duration. // Note: If the springRK4 array contains non-numbers, // generateSpringRK4() returns an easing function generated with // default tension and friction values. return generateSpringRK4(value[0], value[1], duration); } if (value.length === 4) { // Note: If the bezier array contains non-numbers, generateBezier() // returns undefined. return generateBezier.apply(null, value) || false; } } if (value != null && !noError) { console.error("VelocityJS: Trying to set 'easing' to an invalid value:", value); } } /** * Validate a fpsLimit option. */ function validateFpsLimit(value) { if (value === false) { return 0; } else { var parsed = parseInt(value, 10); if (!isNaN(parsed) && parsed >= 0) { return Math.min(parsed, 60); } } if (value != null) { console.warn("VelocityJS: Trying to set 'fpsLimit' to an invalid value:", value); } } /** * Validate a loop option. */ function validateLoop(value) { switch (value) { case false: return 0; case true: return true; default: var parsed = parseInt(value, 10); if (!isNaN(parsed) && parsed >= 0) { return parsed; } break; } if (value != null) { console.warn("VelocityJS: Trying to set 'loop' to an invalid value:", value); } } /** * Validate a progress option. */ function validateProgress(value) { if (isFunction(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'progress' to an invalid value:", value); } } /** * Validate a promise option. */ function validatePromise(value) { if (isBoolean(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'promise' to an invalid value:", value); } } /** * Validate a promiseRejectEmpty option. */ function validatePromiseRejectEmpty(value) { if (isBoolean(value)) { return value; } if (value != null) { console.warn("VelocityJS: Trying to set 'promiseRejectEmpty' to an invalid value:", value); } } /** * Validate a queue option. */ function validateQueue(value, noError) { if (value === false || isString(value)) { return value; } if (value != null && !noError) { console.warn("VelocityJS: Trying to set 'queue' to an invalid value:", value); } } /** * Validate a repeat option. */ function validateRepeat(value) { switch (value) { case false: return 0; case true: return true; default: var parsed = parseInt(value, 10); if (!isNaN(parsed) && parsed >= 0) { return parsed; } break; } if (value != null) { console.warn("VelocityJS: Trying to set 'repeat' to an invalid value:", value); } } /** * Validate a speed option. */ function validateSpeed(value) { if (isNumber(value)) { return value; } if (value != null) { console.error("VelocityJS: Trying to set 'speed' to an invalid value:", value); } } /** * Validate a sync option. */ function validateSync(value) { if (isBoolean(value)) { return value; } if (value != null) { console.error("VelocityJS: Trying to set 'sync' to an invalid value:", value); } } // Project // NOTE: Add the variable here, then add the default state in "reset" below. var cache$1 = void 0, begin = void 0, complete = void 0, delay = void 0, duration = void 0, easing = void 0, fpsLimit = void 0, loop = void 0, mobileHA = void 0, minFrameTime = void 0, promise = void 0, promiseRejectEmpty = void 0, queue = void 0, repeat = void 0, speed = void 0, sync = void 0; var defaults$1 = function () { function defaults$$1() { classCallCheck(this, defaults$$1); } createClass(defaults$$1, null, [{ key: "reset", value: function reset() { cache$1 = DEFAULT_CACHE; begin = undefined; complete = undefined; delay = DEFAULT_DELAY; duration = DEFAULT_DURATION; easing = validateEasing(DEFAULT_EASING, DEFAULT_DURATION); fpsLimit = DEFAULT_FPSLIMIT; loop = DEFAULT_LOOP; minFrameTime = FUZZY_MS_PER_SECOND / DEFAULT_FPSLIMIT; promise = DEFAULT_PROMISE; promiseRejectEmpty = DEFAULT_PROMISE_REJECT_EMPTY; queue = DEFAULT_QUEUE; repeat = DEFAULT_REPEAT; speed = DEFAULT_SPEED; sync = DEFAULT_SYNC; } }, { key: "cache", get: function get$$1() { return cache$1; }, set: function set$$1(value) { value = validateCache(value); if (value !== undefined) { cache$1 = value; } } }, { key: "begin", get: function get$$1() { return begin; }, set: function set$$1(value) { value = validateBegin(value); if (value !== undefined) { begin = value; } } }, { key: "complete", get: function get$$1() { return complete; }, set: function set$$1(value) { value = validateComplete(value); if (value !== undefined) { complete = value; } } }, { key: "delay", get: function get$$1() { return delay; }, set: function set$$1(value) { value = validateDelay(value); if (value !== undefined) { delay = value; } } }, { key: "duration", get: function get$$1() { return duration; }, set: function set$$1(value) { value = validateDuration(value); if (value !== undefined) { duration = value; } } }, { key: "easing", get: function get$$1() { return easing; }, set: function set$$1(value) { value = validateEasing(value, duration); if (value !== undefined) { easing = value; } } }, { key: "fpsLimit", get: function get$$1() { return fpsLimit; }, set: function set$$1(value) { value = validateFpsLimit(value); if (value !== undefined) { fpsLimit = value; minFrameTime = FUZZY_MS_PER_SECOND / value; } } }, { key: "loop", get: function get$$1() { return loop; }, set: function set$$1(value) { value = validateLoop(value); if (value !== undefined) { loop = value; } } }, { key: "mobileHA", get: function get$$1() { return mobileHA; }, set: function set$$1(value) { if (isBoolean(value)) { mobileHA = value; } } }, { key: "minFrameTime", get: function get$$1() { return minFrameTime; } }, { key: "promise", get: function get$$1() { return promise; }, set: function set$$1(value) { value = validatePromise(value); if (value !== undefined) { promise = value; } } }, { key: "promiseRejectEmpty", get: function get$$1() { return promiseRejectEmpty; }, set: function set$$1(value) { value = validatePromiseRejectEmpty(value); if (value !== undefined) { promiseRejectEmpty = value; } } }, { key: "queue", get: function get$$1() { return queue; }, set: function set$$1(value) { value = validateQueue(value); if (value !== undefined) { queue = value; } } }, { key: "repeat", get: function get$$1() { return repeat; }, set: function set$$1(value) { value = validateRepeat(value); if (value !== undefined) { repeat = value; } } }, { key: "repeatAgain", get: function get$$1() { return repeat; } }, { key: "speed", get: function get$$1() { return speed; }, set: function set$$1(value) { value = validateSpeed(value); if (value !== undefined) { speed = value; } } }, { key: "sync", get: function get$$1() { return sync; }, set: function set$$1(value) { value = validateSync(value); if (value !== undefined) { sync = value; } } }]); return defaults$$1; }(); Object.freeze(defaults$1); // Reset to our default values, currently everything is undefined. defaults$1.reset(); /** * The highest type index for finding the best normalization for a property. */ /** * Unlike "actions", normalizations can always be replaced by users. */ var Normalizations = []; /** * Store a cross-reference to units to be added to specific normalization * functions if the user supplies a unit-less number. * * This is pretty much confined to adding "px" to several css properties. */ var NormalizationUnits = {}; /** * Any normalisations that should never be cached are listed here. * Faster than an array - https://jsperf.com/array-includes-and-find-methods-vs-set-has */ var NoCacheNormalizations = new Set(); /** * An array of classes used for the per-class normalizations. This * translates into a bitwise enum for quick cross-reference, and so that * the element doesn't need multiple instanceof calls every * frame. */ var constructors = []; /** * A cache of the various constructors we've found and mapping to their real * name - saves expensive lookups. */ var constructorCache = new Map(); // Project // Constants var dataName = "velocityData"; /** * Get (and create) the internal data store for an element. */ function Data(element) { // Use a string member so Uglify doesn't mangle it. var data = element[dataName]; if (data) { return data; } var window = element.ownerDocument.defaultView; var types = 0; for (var index = 0; index < constructors.length; index++) { var _constructor = constructors[index]; if (isString(_constructor)) { if (element instanceof window[_constructor]) { types |= 1 << index; // tslint:disable-line:no-bitwise } } else if (element instanceof _constructor) { types |= 1 << index; // tslint:disable-line:no-bitwise } } // Use an intermediate object so it errors on incorrect data. var newData = { types: types, count: 0, computedStyle: null, cache: {}, queueList: {}, lastAnimationList: {}, lastFinishList: {}, window: window }; Object.defineProperty(element, dataName, { value: newData }); return newData; } // Constants var isClient = window && window === window.window, windowScrollAnchor = isClient && window.pageYOffset !== undefined; var State = { isClient: isClient, isMobile: isClient && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), isGingerbread: isClient && /Android 2\.3\.[3-7]/i.test(navigator.userAgent), prefixElement: isClient && document.createElement("div"), windowScrollAnchor: windowScrollAnchor, scrollAnchor: windowScrollAnchor ? window : !isClient || document.documentElement || document.body.parentNode || document.body, scrollPropertyLeft: windowScrollAnchor ? "pageXOffset" : "scrollLeft", scrollPropertyTop: windowScrollAnchor ? "pageYOffset" : "scrollTop", className: CLASSNAME, isTicking: false, first: undefined, last: undefined, firstNew: undefined }; // Project /** * Simple queue management. Un-named queue is directly within the element data, * named queue is within an object within it. */ function animate(animation) { var prev = State.last; animation._prev = prev; animation._next = undefined; if (prev) { prev._next = animation; } else { State.first = animation; } State.last = animation; if (!State.firstNew) { State.firstNew = animation; } var element = animation.element, data = Data(element); if (!data.count++) { //////////////////////// // Feature: Classname // //////////////////////// addClass(element, State.className); } } /** * Add an item to an animation queue. */ function queue$1(element, animation, queueName) { var data = Data(element); if (queueName !== false) { // Store the last animation added so we can use it for the // beginning of the next one. data.lastAnimationList[queueName] = animation; } if (queueName === false) { animate(animation); } else { if (!isString(queueName)) { queueName = ""; } var last = data.queueList[queueName]; if (!last) { if (last === null) { data.queueList[queueName] = animation; } else { data.queueList[queueName] = null; animate(animation); } } else { while (last._next) { last = last._next; } last._next = animation; animation._prev = last; } } } /** * Start the next animation on this element's queue (named or default). * * @returns the next animation that is starting. */ function dequeue(element, queueName, skip) { if (queueName !== false) { if (!isString(queueName)) { queueName = ""; } var data = Data(element), animation = data.queueList[queueName]; if (animation) { data.queueList[queueName] = animation._next || null; if (!skip) { animate(animation); } } else if (animation === null) { delete data.queueList[queueName]; } return animation; } } /** * Remove an animation from the active animation list. If it has a queue set * then remember it as the last animation for that queue, and free the one * that was previously there. If the animation list is completely empty then * mark us as finished. */ function freeAnimationCall(animation) { var next = animation._next, prev = animation._prev, queueName = animation.queue == null ? animation.options.queue : animation.queue; if (State.firstNew === animation) { State.firstNew = next; } if (State.first === animation) { State.first = next; } else if (prev) { prev._next = next; } if (State.last === animation) { State.last = prev; } else if (next) { next._prev = prev; } if (queueName) { var data = Data(animation.element); if (data) { animation._next = animation._prev = undefined; } } } var SequencesObject = {}; // Project /** * Call the complete method of an animation in a separate function so it can * benefit from JIT compiling while still having a try/catch block. */ function callComplete(activeCall) { var callback = activeCall.complete || activeCall.options.complete; if (callback) { try { var elements = activeCall.elements; callback.call(elements, elements, activeCall); } catch (error) { setTimeout(function () { throw error; }, 1); } } } /** * Complete an animation. This might involve restarting (for loop or repeat * options). Once it is finished we also check for any callbacks or Promises * that need updating. */ function completeCall(activeCall) { // TODO: Check if it's not been completed already var options = activeCall.options, queue = getValue(activeCall.queue, options.queue), isLoop = getValue(activeCall.loop, options.loop, defaults$1.loop), isRepeat = getValue(activeCall.repeat, options.repeat, defaults$1.repeat), isStopped = activeCall._flags & 8 /* STOPPED */; // tslint:disable-line:no-bitwise if (!isStopped && (isLoop || isRepeat)) { //////////////////// // Option: Loop // // Option: Repeat // //////////////////// if (isRepeat && isRepeat !== true) { activeCall.repeat = isRepeat - 1; } else if (isLoop && isLoop !== true) { activeCall.loop = isLoop - 1; activeCall.repeat = getValue(activeCall.repeatAgain, options.repeatAgain, defaults$1.repeatAgain); } if (isLoop) { activeCall._flags ^= 64 /* REVERSE */; // tslint:disable-line:no-bitwise } if (queue !== false) { // Can't be called when stopped so no need for an extra check. Data(activeCall.element).lastFinishList[queue] = activeCall.timeStart + getValue(activeCall.duration, options.duration, defaults$1.duration); } activeCall.timeStart = activeCall.ellapsedTime = activeCall.percentComplete = 0; activeCall._flags &= ~4 /* STARTED */; // tslint:disable-line:no-bitwise } else { var element = activeCall.element, data = Data(element); if (! --data.count && !isStopped) { //////////////////////// // Feature: Classname // //////////////////////// removeClass(element, State.className); } ////////////////////// // Option: Complete // ////////////////////// // If this is the last animation in this list then we can check for // and complete calls or Promises. // TODO: When deleting an element we need to adjust these values. if (options && ++options._completed === options._total) { if (!isStopped && options.complete) { // We don't call the complete if the animation is stopped, // and we clear the key to prevent it being called again. callComplete(activeCall); options.complete = null; } var resolver = options._resolver; if (resolver) { // Fulfil the Promise resolver(activeCall.elements); delete options._resolver; } } /////////////////// // Option: Queue // /////////////////// if (queue !== false) { // We only do clever things with queues... if (!isStopped) { // If we're not stopping an animation, we need to remember // what time it finished so that the next animation in // sequence gets the correct start time. data.lastFinishList[queue] = activeCall.timeStart + getValue(activeCall.duration, options.duration, defaults$1.duration); } // Start the next animation in sequence, or delete the queue if // this was the last one. dequeue(element, queue); } // Cleanup any pointers, and remember the last animation etc. freeAnimationCall(activeCall); } } // Project /** * Used to register a normalization. This should never be called by users * directly, instead it should be called via an action:
      * Velocity("registerNormalization", "Element", "name", VelocityNormalizationsFn[, false]); * * The second argument is the class of the animatable object. If this is passed * as a class name (ie, `"Element"` -> `window["Element"]`) then this will work * cross-iframe. If passed as an actual class (ie `Element`) then it will * attempt to find the class on the window and use that name instead. If it * can't find it then it will use the class passed, which allows for custom * animation targets, but will not work cross-iframe boundary. * * The fourth argument can be an explicit false, which prevents * the property from being cached. Please note that this can be dangerous * for performance! */ function registerNormalization(args) { var constructor = args[0], name = args[1], callback = args[2]; if (isString(constructor) && !(window[constructor] instanceof Object) || !isString(constructor) && !(constructor instanceof Object)) { console.warn("VelocityJS: Trying to set 'registerNormalization' constructor to an invalid value:", constructor); } else if (!isString(name)) { console.warn("VelocityJS: Trying to set 'registerNormalization' name to an invalid value:", name); } else if (!isFunction(callback)) { console.warn("VelocityJS: Trying to set 'registerNormalization' callback to an invalid value:", name, callback); } else { var index = constructors.indexOf(constructor), nextArg = 3; if (index < 0 && !isString(constructor)) { if (constructorCache.has(constructor)) { index = constructors.indexOf(constructorCache.get(constructor)); } else { for (var property in window) { if (window[property] === constructor) { index = constructors.indexOf(property); if (index < 0) { index = constructors.push(property) - 1; Normalizations[index] = {}; constructorCache.set(constructor, property); } break; } } } } if (index < 0) { index = constructors.push(constructor) - 1; Normalizations[index] = {}; } Normalizations[index][name] = callback; if (isString(args[nextArg])) { var unit = args[nextArg++]; var units = NormalizationUnits[unit]; if (!units) { units = NormalizationUnits[unit] = []; } units.push(callback); } if (args[nextArg] === false) { NoCacheNormalizations.add(name); } } } /** * Used to check if a normalisation exists on a specific class. */ function hasNormalization(args) { var constructor = args[0], name = args[1]; var index = constructors.indexOf(constructor); if (index < 0 && !isString(constructor)) { if (constructorCache.has(constructor)) { index = constructors.indexOf(constructorCache.get(constructor)); } else { for (var property in window) { if (window[property] === constructor) { index = constructors.indexOf(property); break; } } } } return index >= 0 && Normalizations[index].hasOwnProperty(name); } /** * Get the unit to add to a unitless number based on the normalization used. */ function getNormalizationUnit(fn) { for (var unit in NormalizationUnits) { if (NormalizationUnits[unit].includes(fn)) { return unit; } } return ""; } /** * Get the normalization for an element and propertyName combination. This * value should be cached at asking time, as it may change if the user adds * more normalizations. */ function getNormalization(element, propertyName) { var data = Data(element); var fn = void 0; for (var index = constructors.length - 1, types = data.types; !fn && index >= 0; index--) { if (types & 1 << index) { // tslint:disable-line:no-bitwise fn = Normalizations[index][propertyName]; } } return fn; } registerAction(["registerNormalization", registerNormalization]); registerAction(["hasNormalization", hasNormalization]); // Project /** * The singular setPropertyValue, which routes the logic for all * normalizations. */ function setPropertyValue(element, propertyName, propertyValue, fn) { var noCache = NoCacheNormalizations.has(propertyName), data = !noCache && Data(element); if (noCache || data && data.cache[propertyName] !== propertyValue) { // By setting it to undefined we force a true "get" later if (!noCache) { data.cache[propertyName] = propertyValue || undefined; } fn = fn || getNormalization(element, propertyName); if (fn) { fn(element, propertyValue); } if (Velocity$$1.debug >= 2) { console.info("Set \"" + propertyName + "\": \"" + propertyValue + "\"", element); } } } /** * Remove nested `calc(0px + *)` or `calc(* + (0px + *))` correctly. */ function removeNestedCalc(value) { if (value.indexOf("calc(") >= 0) { var tokens = value.split(/([\(\)])/); var depth = 0; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; switch (token) { case "(": depth++; break; case ")": depth--; break; default: if (depth && token[0] === "0") { tokens[i] = token.replace(/^0[a-z%]+ \+ /, ""); } break; } } return tokens.join("").replace(/(?:calc)?\(([0-9\.]+[a-z%]+)\)/g, "$1"); } return value; } /** * Cache every camelCase match to avoid repeating lookups. */ var cache$2 = {}; /** * Camelcase a property name into its JavaScript notation (e.g. * "background-color" ==> "backgroundColor"). Camelcasing is used to * normalize property names between and across calls. */ function camelCase(property) { var fixed = cache$2[property]; if (fixed) { return fixed; } return cache$2[property] = property.replace(/-([a-z])/g, function ($, letter) { return letter.toUpperCase(); }); } // Constants var rxColor6 = /#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/gi, rxColor3 = /#([a-f\d])([a-f\d])([a-f\d])/gi, rxColorName = /(rgba?\(\s*)?(\b[a-z]+\b)/g, rxRGB = /rgb(a?)\(([^\)]+)\)/gi, rxSpaces = /\s+/g; /** * This is the list of color names -> rgb values. The object is in here so * that the actual name conversion can be in a separate file and not * included for custom builds. */ var ColorNames = {}; /** * Convert a hex list to an rgba value. Designed to be used in replace. */ function makeRGBA(ignore, r, g, b) { return "rgba(" + parseInt(r, 16) + "," + parseInt(g, 16) + "," + parseInt(b, 16) + ",1)"; } /** * Replace any css colour name with its rgba() value. It is possible to use * the name within an "rgba(blue, 0.4)" string this way. */ function fixColors(str) { return str.replace(rxColor6, makeRGBA).replace(rxColor3, function ($0, r, g, b) { return makeRGBA($0, r + r, g + g, b + b); }).replace(rxColorName, function ($0, $1, $2) { if (ColorNames[$2]) { return ($1 ? $1 : "rgba(") + ColorNames[$2] + ($1 ? "" : ",1)"); } return $0; }).replace(rxRGB, function ($0, $1, $2) { return "rgba(" + ($2.replace(rxSpaces, "") + ($1 ? "" : ",1")) + ")"; }); } // Project /** * Figure out the dimensions for this width / height based on the * potential borders and whether we care about them. */ function augmentDimension(element, name, wantInner) { var isBorderBox = getPropertyValue(element, "boxSizing").toString().toLowerCase() === "border-box"; if (isBorderBox === wantInner) { // in box-sizing mode, the CSS width / height accessors already // give the outerWidth / outerHeight. var sides = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"], fields = ["padding" + sides[0], "padding" + sides[1], "border" + sides[0] + "Width", "border" + sides[1] + "Width"]; var augment = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var field = _step.value; var value = parseFloat(getPropertyValue(element, field)); if (!isNaN(value)) { augment += value; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return wantInner ? -augment : augment; } return 0; } // Project /** * Get the width or height of an element, pulled out as it can be used when the * in two locations so don't want to repeat it. */ function getWidthHeight(element, property) { return element.getBoundingClientRect()[property] + augmentDimension(element, property, true) + "px"; } // TODO: This is still a complete mess function computePropertyValue(element, property) { var data = Data(element), // If computedStyle is cached, use it. If not then get the correct one // for the element to support cross-iframe boundaries. computedStyle = data.computedStyle ? data.computedStyle : data.window.getComputedStyle(element, null); var computedValue = 0; if (!data.computedStyle) { data.computedStyle = computedStyle; } if (computedStyle["display"] === "none") { switch (property) { case "width": case "height": // Browsers do not return height and width values for elements // that are set to display:"none". Thus, we temporarily toggle // display to the element type's default value. setPropertyValue(element, "display", "auto"); computedValue = getWidthHeight(element, property); setPropertyValue(element, "display", "none"); return String(computedValue); } } /* IE and Firefox do not return a value for the generic borderColor -- they only return individual values for each border side's color. Also, in all browsers, when border colors aren't all the same, a compound value is returned that Velocity isn't setup to parse. So, as a polyfill for querying individual border side colors, we just return the top border's color and animate all borders from that value. */ /* TODO: There is a borderColor normalisation in legacy/ - figure out where this is needed... */ computedValue = computedStyle[property]; /* Fall back to the property's style value (if defined) when computedValue returns nothing, which can happen when the element hasn't been painted. */ if (!computedValue) { computedValue = element.style[property]; } /* For top, right, bottom, and left (TRBL) values that are set to "auto" on elements of "fixed" or "absolute" position, defer to jQuery for converting "auto" to a numeric value. (For elements with a "static" or "relative" position, "auto" has the same effect as being set to 0, so no conversion is necessary.) */ /* An example of why numeric conversion is necessary: When an element with "position:absolute" has an untouched "left" property, which reverts to "auto", left's value is 0 relative to its parent element, but is often non-zero relative to its *containing* (not parent) element, which is the nearest "position:relative" ancestor or the viewport (and always the viewport in the case of "position:fixed"). */ if (computedValue === "auto") { switch (property) { case "width": case "height": computedValue = getWidthHeight(element, property); break; case "top": case "left": case "right": case "bottom": var position = getPropertyValue(element, "position"); if (position === "fixed" || position === "absolute") { // Note: this has no pixel unit on its returned values, // we re-add it here to conform with // computePropertyValue's behavior. computedValue = element.getBoundingClientRect[property] + "px"; break; } // Deliberate fallthrough! default: computedValue = "0px"; break; } } return computedValue ? String(computedValue) : ""; } /** * Get a property value. This will grab via the cache if it exists, then * via any normalisations. */ function getPropertyValue(element, propertyName, fn, skipCache) { var data = Data(element); var propertyValue = void 0; if (NoCacheNormalizations.has(propertyName)) { skipCache = true; } if (!skipCache && data && data.cache[propertyName] != null) { propertyValue = data.cache[propertyName]; } else { fn = fn || getNormalization(element, propertyName); if (fn) { propertyValue = fn(element); if (data) { data.cache[propertyName] = propertyValue; } } } if (Velocity$$1.debug >= 2) { console.info("Get \"" + propertyName + "\": \"" + propertyValue + "\"", element); } return propertyValue; } // Project // Constants var rxHex = /^#([A-f\d]{3}){1,2}$/i, commands = { function: function _function(value, element, elements, elementArrayIndex, propertyName, tween) { return value.call(element, elementArrayIndex, elements.length, propertyName); }, number: function number(value, element, elements, elementArrayIndex, propertyName, tween) { return String(value) + getNormalizationUnit(tween.fn); }, string: function string(value, element, elements, elementArrayIndex, propertyName, tween) { return fixColors(value); }, undefined: function undefined(value, element, elements, elementArrayIndex, propertyName, tween) { return fixColors(getPropertyValue(element, propertyName, tween.fn) || ""); } }; /** * Expand a VelocityProperty argument into a valid sparse Tween array. This * pre-allocates the array as it is then the correct size and slightly * faster to access. */ function expandProperties(animation, properties) { var tweens = animation.tweens = Object.create(null), elements = animation.elements, element = animation.element, elementArrayIndex = elements.indexOf(element), data = Data(element), queue = getValue(animation.queue, animation.options.queue), duration = getValue(animation.options.duration, defaults$1.duration); for (var property in properties) { if (properties.hasOwnProperty(property)) { var propertyName = camelCase(property), fn = getNormalization(element, propertyName); var valueData = properties[property]; if (!fn && propertyName !== "tween") { if (Velocity$$1.debug) { console.log("Skipping \"" + property + "\" due to a lack of browser support."); } continue; } if (valueData == null) { if (Velocity$$1.debug) { console.log("Skipping \"" + property + "\" due to no value supplied."); } continue; } var tween = tweens[propertyName] = {}; var endValue = void 0, startValue = void 0; tween.fn = fn; if (isFunction(valueData)) { // If we have a function as the main argument then resolve // it first, in case it returns an array that needs to be // split. valueData = valueData.call(element, elementArrayIndex, elements.length, elements); } if (Array.isArray(valueData)) { // valueData is an array in the form of // [ endValue, [, easing] [, startValue] ] var arr1 = valueData[1], arr2 = valueData[2]; endValue = valueData[0]; if (isString(arr1) && (/^[\d-]/.test(arr1) || rxHex.test(arr1)) || isFunction(arr1) || isNumber(arr1)) { startValue = arr1; } else if (isString(arr1) && Easings[arr1] || Array.isArray(arr1)) { tween.easing = validateEasing(arr1, duration); startValue = arr2; } else { startValue = arr1 || arr2; } } else { endValue = valueData; } tween.end = commands[typeof endValue === "undefined" ? "undefined" : _typeof(endValue)](endValue, element, elements, elementArrayIndex, propertyName, tween); if (startValue != null || queue === false || data.queueList[queue] === undefined) { tween.start = commands[typeof startValue === "undefined" ? "undefined" : _typeof(startValue)](startValue, element, elements, elementArrayIndex, propertyName, tween); explodeTween(propertyName, tween, duration); } } } } // TODO: Needs a better match for "translate3d" etc - a number must be preceded by some form of break... var rxToken = /((?:[+\-*/]=)?(?:[+-]?\d*\.\d+|[+-]?\d+)[a-z%]*|(?:.(?!$|[+-]?\d|[+\-*/]=[+-]?\d))+.|.)/g, rxNumber = /^([+\-*/]=)?([+-]?\d*\.\d+|[+-]?\d+)(.*)$/; /** * Find a pattern between multiple strings, return a VelocitySequence with * the pattern and the tokenised values. * * If number then animate. * If a string then must match. * If units then convert between them by wrapping in a calc(). * - If already in a calc then nest another layer. * If in an rgba() then the first three numbers are rounded. */ function findPattern(parts, propertyName) { var partsLength = parts.length, tokens = [], indexes = []; var numbers = void 0; // First tokenise the strings - these have all values, we will pull // numbers later. for (var part = 0; part < partsLength; part++) { if (isString(parts[part])) { if (parts[part] === "") { tokens[part] = [""]; } else { tokens[part] = cloneArray(parts[part].match(rxToken)); } indexes[part] = 0; // If it matches more than one thing then we've got a number. numbers = numbers || tokens[part].length > 1; //console.log(`tokens:`, parts[part], tokens[part]) } else { // We have an incomplete lineup, it will get tried again later... return; } } var sequence = [], pattern = sequence.pattern = [], addString = function addString(text) { if (isString(pattern[pattern.length - 1])) { pattern[pattern.length - 1] += text; } else if (text) { pattern.push(text); for (var _part = 0; _part < partsLength; _part++) { sequence[_part].push(null); } } }, returnStringType = function returnStringType() { if (numbers || pattern.length > 1) { //console.error(`Velocity: Trying to pattern match mis-matched strings "${propertyName}":`, parts); return; } var isDisplay = propertyName === "display", isVisibility = propertyName === "visibility"; for (var _part2 = 0; _part2 < partsLength; _part2++) { var value = parts[_part2]; sequence[_part2][0] = value; // Don't care about duration... sequence[_part2].easing = validateEasing(isDisplay && value === "none" || isVisibility && value === "hidden" || !isDisplay && !isVisibility ? "at-end" : "at-start", 400); } pattern[0] = false; return sequence; }; var more = true; for (var _part3 = 0; _part3 < partsLength; _part3++) { sequence[_part3] = []; } while (more) { var bits = [], units = []; var text = void 0, isUnitless = false, hasNumbers = false; for (var _part4 = 0; _part4 < partsLength; _part4++) { var index = indexes[_part4]++, token = tokens[_part4][index]; if (token) { var num = token.match(rxNumber); // [ignore, change, number, unit] if (num) { // It's a number, possibly with a += change and unit. if (text) { return returnStringType(); } var digits = parseFloat(num[2]), unit = num[3], change = num[1] ? num[1][0] + unit : undefined, changeOrUnit = change || unit; if (digits && !units.includes(changeOrUnit)) { // Will be an empty string at the least. units.push(changeOrUnit); } if (!unit) { if (digits) { hasNumbers = true; } else { isUnitless = true; } } bits[_part4] = change ? [digits, changeOrUnit, true] : [digits, changeOrUnit]; } else if (bits.length) { return returnStringType(); } else { // It's a string. if (!text) { text = token; } else if (text !== token) { return returnStringType(); } } } else if (!_part4) { for (; _part4 < partsLength; _part4++) { var index2 = indexes[_part4]++; if (tokens[_part4][index2]) { return returnStringType(); } } // IMPORTANT: This is the exit point. more = false; break; } else { // Different return; } } if (text) { addString(text); } else if (units.length) { if (units.length === 2 && isUnitless && !hasNumbers) { // If we only have two units, and one is empty, and it's only empty on "0", then treat us as having one unit units.splice(units[0] ? 1 : 0, 1); } if (units.length === 1) { // All the same units, so append number then unit. var _unit = units[0], firstLetter = _unit[0]; switch (firstLetter) { case "+": case "-": case "*": case "/": if (propertyName) { console.error("Velocity: The first property must not contain a relative function \"" + propertyName + "\":", parts); } return; } pattern.push(false); for (var _part5 = 0; _part5 < partsLength; _part5++) { sequence[_part5].push(bits[_part5][0]); } addString(_unit); } else { // Multiple units, so must be inside a calc. addString("calc("); var patternCalc = pattern.length - 1; // Store the beginning of our calc. for (var i = 0; i < units.length; i++) { var _unit2 = units[i], _firstLetter = _unit2[0], isComplex = _firstLetter === "*" || _firstLetter === "/", isMaths = isComplex || _firstLetter === "+" || _firstLetter === "-"; if (isComplex) { // TODO: Not sure this should be done automatically! pattern[patternCalc] += "("; addString(")"); } if (i) { addString(" " + (isMaths ? _firstLetter : "+") + " "); } pattern.push(false); for (var _part6 = 0; _part6 < partsLength; _part6++) { var bit = bits[_part6], value = bit[1] === _unit2 ? bit[0] : bit.length === 3 ? sequence[_part6 - 1][sequence[_part6 - 1].length - 1] : isComplex ? 1 : 0; sequence[_part6].push(value); } addString(isMaths ? _unit2.substring(1) : _unit2); } addString(")"); } } } // We've got here, so a valid sequence - now check and fix RGB rounding // and calc() nesting... // TODO: Nested calc(a + calc(b + c)) -> calc(a + (b + c)) for (var _i = 0, inRGB = 0; _i < pattern.length; _i++) { var _text = pattern[_i]; if (isString(_text)) { if (inRGB && _text.indexOf(",") >= 0) { inRGB++; } else if (_text.indexOf("rgb") >= 0) { inRGB = 1; } } else if (inRGB) { if (inRGB < 4) { pattern[_i] = true; } else { inRGB = 0; } } } return sequence; } /** * Convert a string-based tween with start and end strings, into a pattern * based tween with arrays. */ function explodeTween(propertyName, tween, duration, starting) { var startValue = tween.start, endValue = tween.end; if (!isString(endValue) || !isString(startValue)) { return; } var sequence = findPattern([startValue, endValue], propertyName); if (!sequence && starting) { // This little piece will take a startValue, split out the // various numbers in it, then copy the endValue into the // startValue while replacing the numbers in it to match the // original start numbers as a repeating sequence. // Finally this function will run again with the new // startValue and a now matching pattern. var startNumbers = startValue.match(/\d\.?\d*/g) || ["0"], count = startNumbers.length; var index = 0; sequence = findPattern([endValue.replace(/\d+\.?\d*/g, function () { return startNumbers[index++ % count]; }), endValue], propertyName); } if (sequence) { if (Velocity$$1.debug) { console.log("Velocity: Sequence found:", sequence); } sequence[0].percent = 0; sequence[1].percent = 1; tween.sequence = sequence; switch (tween.easing) { case Easings["at-start"]: case Easings["during"]: case Easings["at-end"]: sequence[0].easing = sequence[1].easing = tween.easing; break; } } } /** * Expand all queued animations that haven't gone yet * * This will automatically expand the properties map for any recently added * animations so that the start and end values are correct. */ function validateTweens(activeCall) { // This might be called on an already-ready animation if (State.firstNew === activeCall) { State.firstNew = activeCall._next; } // Check if we're actually already ready if (activeCall._flags & 1 /* EXPANDED */) { // tslint:disable-line:no-bitwise return; } var element = activeCall.element, tweens = activeCall.tweens, duration = getValue(activeCall.options.duration, defaults$1.duration); // tslint:disable-next-line:forin for (var propertyName in tweens) { var tween = tweens[propertyName]; if (tween.start == null) { // Get the start value as it's not been passed in var startValue = getPropertyValue(activeCall.element, propertyName); if (isString(startValue)) { tween.start = fixColors(startValue); explodeTween(propertyName, tween, duration, true); } else if (!Array.isArray(startValue)) { console.warn("bad type", tween, propertyName, startValue); } } if (Velocity$$1.debug) { console.log("tweensContainer \"" + propertyName + "\": " + JSON.stringify(tween), element); } } activeCall._flags |= 1 /* EXPANDED */; // tslint:disable-line:no-bitwise } // Project /** * Call the begin method of an animation in a separate function so it can * benefit from JIT compiling while still having a try/catch block. */ function beginCall(activeCall) { var callback = activeCall.begin || activeCall.options.begin; if (callback) { try { var elements = activeCall.elements; callback.call(elements, elements, activeCall); } catch (error) { setTimeout(function () { throw error; }, 1); } } } /** * Call the progress method of an animation in a separate function so it can * benefit from JIT compiling while still having a try/catch block. */ function progressCall(activeCall) { var callback = activeCall.progress || activeCall.options.progress; if (callback) { try { var elements = activeCall.elements, percentComplete = activeCall.percentComplete, options = activeCall.options, tweenValue = activeCall.tween; callback.call(elements, elements, percentComplete, Math.max(0, activeCall.timeStart + (activeCall.duration != null ? activeCall.duration : options.duration != null ? options.duration : defaults$1.duration) - lastTick), tweenValue !== undefined ? tweenValue : String(percentComplete * 100), activeCall); } catch (error) { setTimeout(function () { throw error; }, 1); } } } /** * Call callbacks, potentially run async with the main animation thread. */ function asyncCallbacks() { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = progressed[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var activeCall = _step.value; progressCall(activeCall); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } progressed.clear(); var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = completed[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _activeCall = _step2.value; completeCall(_activeCall); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } completed.clear(); } /************** Timing **************/ var FRAME_TIME = 1000 / 60, /** * Animations with a Complete callback. */ completed = new Set(), /** * Animations with a Progress callback. */ progressed = new Set(), /** * Shim for window.performance in case it doesn't exist */ performance = function () { var perf = window.performance || {}; if (typeof perf.now !== "function") { var nowOffset = perf.timing && perf.timing.navigationStart ? perf.timing.navigationStart : now(); perf.now = function () { return now() - nowOffset; }; } return perf; }(), /** * Proxy function for when rAF is not available. * * This should hopefully never be used as the browsers often throttle * this to less than one frame per second in the background, making it * completely unusable. */ rAFProxy = function rAFProxy(callback) { return setTimeout(callback, Math.max(0, FRAME_TIME - (performance.now() - lastTick))); }, /** * Either requestAnimationFrame, or a shim for it. */ rAFShim = window.requestAnimationFrame || rAFProxy; /** * Set if we are currently inside a tick() to prevent double-calling. */ var ticking = void 0, /** * A background WebWorker that sends us framerate messages when we're in * the background. Without this we cannot maintain frame accuracy. */ worker = void 0; /** * The time that the last animation frame ran at. Set from tick(), and used * for missing rAF (ie, when not in focus etc). */ var lastTick = 0; /** * WebWorker background function. * * When we're in the background this will send us a msg every tick, when in * the foreground it won't. * * When running in the background the browser reduces allowed CPU etc, so * we raun at 30fps instead of 60fps. */ function workerFn() { var _this = this; var interval = void 0; this.onmessage = function (e) { switch (e.data) { case true: if (!interval) { interval = setInterval(function () { _this.postMessage(true); }, 1000 / 30); } break; case false: if (interval) { clearInterval(interval); interval = 0; } break; default: _this.postMessage(e.data); break; } }; } try { // Create the worker - this might not be supported, hence the try/catch. worker = new Worker(URL.createObjectURL(new Blob(["(" + workerFn + ")()"]))); // Whenever the worker sends a message we tick() worker.onmessage = function (e) { if (e.data === true) { tick(); } else { asyncCallbacks(); } }; // And watch for going to the background to start the WebWorker running. if (!State.isMobile && document.hidden !== undefined) { document.addEventListener("visibilitychange", function () { worker.postMessage(State.isTicking && document.hidden); }); } } catch (e) {} /* * WebWorkers are not supported in this format. This can happen in IE10 * where it can't create one from a blob this way. We fallback, but make * no guarantees towards accuracy in this case. */ /** * Called on every tick, preferably through rAF. This is reponsible for * initialising any new animations, then starting any that need starting. * Finally it will expand any tweens and set the properties relating to * them. If there are any callbacks relating to the animations then they * will attempt to call at the end (with the exception of "begin"). */ function tick(timestamp) { if (ticking) { // Should never happen - but if we've swapped back from hidden to // visibile then we want to make sure return; } ticking = true; /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on. We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever the browser's next tick sync time occurs, which results in the first elements subjected to Velocity calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */ if (timestamp !== false) { var timeCurrent = performance.now(), deltaTime = lastTick ? timeCurrent - lastTick : FRAME_TIME, defaultSpeed = defaults$1.speed, defaultEasing = defaults$1.easing, defaultDuration = defaults$1.duration; var activeCall = void 0, nextCall = void 0; if (deltaTime >= defaults$1.minFrameTime || !lastTick) { lastTick = timeCurrent; /******************** Call Iteration ********************/ // Expand any tweens that might need it. while (State.firstNew) { validateTweens(State.firstNew); } // Iterate through each active call. for (activeCall = State.first; activeCall && activeCall !== State.firstNew; activeCall = activeCall._next) { var element = activeCall.element, data = Data(element); // Check to see if this element has been deleted midway // through the animation. If it's gone then end this // animation. if (!element.parentNode || !data) { // TODO: Remove safely - decrease count, delete data, remove from arrays freeAnimationCall(activeCall); continue; } // Don't bother getting until we can use these. var options = activeCall.options, flags = activeCall._flags; var timeStart = activeCall.timeStart; // If this is the first time that this call has been // processed by tick() then we assign timeStart now so that // it's value is as close to the real animation start time // as possible. if (!timeStart) { var queue = activeCall.queue != null ? activeCall.queue : options.queue; timeStart = timeCurrent - deltaTime; if (queue !== false) { timeStart = Math.max(timeStart, data.lastFinishList[queue] || 0); } activeCall.timeStart = timeStart; } // If this animation is paused then skip processing unless // it has been set to resume. if (flags & 16 /* PAUSED */) { // tslint:disable-line:no-bitwise // Update the time start to accomodate the paused // completion amount. activeCall.timeStart += deltaTime; continue; } // Check if this animation is ready - if it's synced then it // needs to wait for all other animations in the sync if (!(flags & 2 /* READY */)) { // tslint:disable-line:no-bitwise activeCall._flags |= 2 /* READY */; // tslint:disable-line:no-bitwise options._ready++; } } // Need to split the loop, as ready sync animations must all get // the same start time. for (activeCall = State.first; activeCall && activeCall !== State.firstNew; activeCall = nextCall) { var _flags = activeCall._flags; nextCall = activeCall._next; if (!(_flags & 2 /* READY */) || _flags & 16 /* PAUSED */) { // tslint:disable-line:no-bitwise continue; } var _options = activeCall.options; if (_flags & 32 /* SYNC */ && _options._ready < _options._total) { // tslint:disable-line:no-bitwise activeCall.timeStart += deltaTime; continue; } var speed = activeCall.speed != null ? activeCall.speed : _options.speed != null ? _options.speed : defaultSpeed; var _timeStart = activeCall.timeStart; // Don't bother getting until we can use these. if (!(_flags & 4 /* STARTED */)) { // tslint:disable-line:no-bitwise var delay = activeCall.delay != null ? activeCall.delay : _options.delay; // Make sure anything we've delayed doesn't start // animating yet, there might still be an active delay // after something has been un-paused if (delay) { if (_timeStart + delay / speed > timeCurrent) { continue; } activeCall.timeStart = _timeStart += delay / (delay > 0 ? speed : 1); } activeCall._flags |= 4 /* STARTED */; // tslint:disable-line:no-bitwise // The begin callback is fired once per call, not once // per element, and is passed the full raw DOM element // set as both its context and its first argument. if (_options._started++ === 0) { _options._first = activeCall; if (_options.begin) { // Pass to an external fn with a try/catch block for optimisation beginCall(activeCall); // Only called once, even if reversed or repeated _options.begin = undefined; } } } if (speed !== 1) { // On the first frame we may have a shorter delta // const delta = Math.min(deltaTime, timeCurrent - timeStart); activeCall.timeStart = _timeStart += Math.min(deltaTime, timeCurrent - _timeStart) * (1 - speed); } var activeEasing = activeCall.easing != null ? activeCall.easing : _options.easing != null ? _options.easing : defaultEasing, millisecondsEllapsed = activeCall.ellapsedTime = timeCurrent - _timeStart, duration = activeCall.duration != null ? activeCall.duration : _options.duration != null ? _options.duration : defaultDuration, percentComplete = activeCall.percentComplete = Velocity$$1.mock ? 1 : Math.min(millisecondsEllapsed / duration, 1), tweens = activeCall.tweens, reverse = _flags & 64 /* REVERSE */; // tslint:disable-line:no-bitwise if (activeCall.progress || _options._first === activeCall && _options.progress) { progressed.add(activeCall); } if (percentComplete === 1) { completed.add(activeCall); } // tslint:disable-next-line:forin for (var property in tweens) { // For every element, iterate through each property. var tween = tweens[property], sequence = tween.sequence, pattern = sequence.pattern; var currentValue = "", i = 0; if (pattern) { var easingComplete = (tween.easing || activeEasing)(percentComplete, 0, 1, property); var best = 0; for (var j = 0; j < sequence.length - 1; j++) { if (sequence[j].percent < easingComplete) { best = j; } } var tweenFrom = sequence[best], tweenTo = sequence[best + 1] || tweenFrom, rawPercent = (percentComplete - tweenFrom.percent) / (tweenTo.percent - tweenFrom.percent), tweenPercent = reverse ? 1 - rawPercent : rawPercent, easing = tweenTo.easing || activeEasing || linearEasing; for (; i < pattern.length; i++) { var startValue = tweenFrom[i]; if (startValue == null) { currentValue += pattern[i]; } else { var endValue = tweenTo[i]; if (startValue === endValue) { currentValue += startValue; } else { // All easings must deal with numbers except for our internal ones. var result = easing(tweenPercent, startValue, endValue, property); currentValue += pattern[i] !== true ? result : Math.round(result); } } } if (property !== "tween") { if (percentComplete === 1) { currentValue = removeNestedCalc(currentValue); } // TODO: To solve an IE<=8 positioning bug, the unit type must be dropped when setting a property value of 0 - add normalisations to legacy setPropertyValue(activeCall.element, property, currentValue, tween.fn); } else { // Skip the fake 'tween' property as that is only // passed into the progress callback. activeCall.tween = currentValue; } } else { console.warn("VelocityJS: Missing pattern:", property, JSON.stringify(tween[property])); delete tweens[property]; } } } if (progressed.size || completed.size) { if (!document.hidden) { asyncCallbacks(); } else if (worker) { worker.postMessage(""); } else { setTimeout(asyncCallbacks, 1); } } } } if (State.first) { State.isTicking = true; if (!document.hidden) { rAFShim(tick); } else if (!worker) { rAFProxy(tick); } else if (timestamp === false) { // Make sure we turn on the messages. worker.postMessage(true); } } else { State.isTicking = false; lastTick = 0; if (document.hidden && worker) { // Make sure we turn off the messages. worker.postMessage(false); } } ticking = false; } // Project /** * Check if an animation should be finished, and if so we set the tweens to * the final value for it, then call complete. */ function checkAnimationShouldBeFinished(animation, queueName, defaultQueue) { validateTweens(animation); if (queueName === undefined || queueName === getValue(animation.queue, animation.options.queue, defaultQueue)) { if (!(animation._flags & 4 /* STARTED */)) { // tslint:disable-line:no-bitwise // Copied from tick.ts - ensure that the animation is completely // valid and run begin() before complete(). var options = animation.options; // The begin callback is fired once per call, not once per // element, and is passed the full raw DOM element set as both // its context and its first argument. if (options._started++ === 0) { options._first = animation; if (options.begin) { // Pass to an external fn with a try/catch block for optimisation beginCall(animation); // Only called once, even if reversed or repeated options.begin = undefined; } } animation._flags |= 4 /* STARTED */; // tslint:disable-line:no-bitwise } // tslint:disable-next-line:forin for (var property in animation.tweens) { var tween = animation.tweens[property], sequence = tween.sequence, pattern = sequence.pattern; var currentValue = "", i = 0; if (pattern) { var endValues = sequence[sequence.length - 1]; for (; i < pattern.length; i++) { var endValue = endValues[i]; currentValue += endValue == null ? pattern[i] : endValue; } } setPropertyValue(animation.element, property, currentValue, tween.fn); } completeCall(animation); } } /** * When the finish action is triggered, the elements' currently active call is * immediately finished. When an element is finished, the next item in its * animation queue is immediately triggered. If passed via a chained call * then this will only target the animations in that call, and not the * elements linked to it. * * A queue name may be passed in to specify that only animations on the * named queue are finished. The default queue is named "". In addition the * value of `false` is allowed for the queue name. * * An final argument may be passed in to clear an element's remaining queued * calls. This may only be the value `true`. */ function finish(args, elements, promiseHandler) { var queueName = validateQueue(args[0], true), defaultQueue = defaults$1.queue, finishAll = args[queueName === undefined ? 0 : 1] === true; if (isVelocityResult(elements) && elements.velocity.animations) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = elements.velocity.animations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var animation = _step.value; checkAnimationShouldBeFinished(animation, queueName, defaultQueue); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } else { while (State.firstNew) { validateTweens(State.firstNew); } for (var activeCall = State.first, nextCall; activeCall && (finishAll || activeCall !== State.firstNew); activeCall = nextCall || State.firstNew) { nextCall = activeCall._next; if (!elements || elements.includes(activeCall.element)) { checkAnimationShouldBeFinished(activeCall, queueName, defaultQueue); } } } if (promiseHandler) { if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["finish", finish], true); /** * Used to map getters for the various AnimationFlags. */ var animationFlags = { isExpanded: 1 /* EXPANDED */ , isReady: 2 /* READY */ , isStarted: 4 /* STARTED */ , isStopped: 8 /* STOPPED */ , isPaused: 16 /* PAUSED */ , isSync: 32 /* SYNC */ , isReverse: 64 /* REVERSE */ }; /** * Get or set an option or running AnimationCall data value. If there is no * value passed then it will get, otherwise we will set. * * NOTE: When using "get" this will not touch the Promise as it is never * returned to the user. */ function option(args, elements, promiseHandler, action) { var key = args[0], queue = action.indexOf(".") >= 0 ? action.replace(/^.*\./, "") : undefined, queueName = queue === "false" ? false : validateQueue(queue, true); var animations = void 0, value = args[1]; if (!key) { console.warn("VelocityJS: Cannot access a non-existant key!"); return null; } // If we're chaining the return value from Velocity then we are only // interested in the values related to that call if (isVelocityResult(elements) && elements.velocity.animations) { animations = elements.velocity.animations; } else { animations = []; for (var activeCall = State.first; activeCall; activeCall = activeCall._next) { if (elements.indexOf(activeCall.element) >= 0 && getValue(activeCall.queue, activeCall.options.queue) === queueName) { animations.push(activeCall); } } // If we're dealing with multiple elements that are pointing at a // single running animation, then instead treat them as a single // animation. if (elements.length > 1 && animations.length > 1) { var i = 1, options = animations[0].options; while (i < animations.length) { if (animations[i++].options !== options) { options = null; break; } } // TODO: this needs to check that they're actually a sync:true animation to merge the results, otherwise the individual values may be different if (options) { animations = [animations[0]]; } } } // GET if (value === undefined) { var result = [], flag = animationFlags[key]; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = animations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var animation = _step.value; if (flag === undefined) { // A normal key to get. result.push(getValue(animation[key], animation.options[key])); } else { // A flag that we're checking against. result.push((animation._flags & flag) === 0); // tslint:disable-line:no-bitwise } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } if (elements.length === 1 && animations.length === 1) { // If only a single animation is found and we're only targetting a // single element, then return the value directly return result[0]; } return result; } // SET var isPercentComplete = void 0; switch (key) { case "cache": value = validateCache(value); break; case "begin": value = validateBegin(value); break; case "complete": value = validateComplete(value); break; case "delay": value = validateDelay(value); break; case "duration": value = validateDuration(value); break; case "fpsLimit": value = validateFpsLimit(value); break; case "loop": value = validateLoop(value); break; case "percentComplete": isPercentComplete = true; value = parseFloat(value); break; case "repeat": case "repeatAgain": value = validateRepeat(value); break; default: if (key[0] !== "_") { var num = parseFloat(value); if (value === String(num)) { value = num; } break; } // deliberate fallthrough case "queue": case "promise": case "promiseRejectEmpty": case "easing": case "started": console.warn("VelocityJS: Trying to set a read-only key:", key); return; } if (value === undefined || value !== value) { console.warn("VelocityJS: Trying to set an invalid value:" + key + "=" + value + " (" + args[1] + ")"); return null; } var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = animations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _animation = _step2.value; if (isPercentComplete) { _animation.timeStart = lastTick - getValue(_animation.duration, _animation.options.duration, defaults$1.duration) * value; } else { _animation[key] = value; } } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } if (promiseHandler) { if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["option", option], true); // Project /** * Check if an animation should be paused / resumed. */ function checkAnimation(animation, queueName, defaultQueue, isPaused) { if (queueName === undefined || queueName === getValue(animation.queue, animation.options.queue, defaultQueue)) { if (isPaused) { animation._flags |= 16 /* PAUSED */; // tslint:disable-line:no-bitwise } else { animation._flags &= ~16 /* PAUSED */; // tslint:disable-line:no-bitwise } } } /** * Pause and Resume are call-wide (not on a per element basis). Thus, calling pause or resume on a * single element will cause any calls that contain tweens for that element to be paused/resumed * as well. */ function pauseResume(args, elements, promiseHandler, action) { var isPaused = action.indexOf("pause") === 0, queue = action.indexOf(".") >= 0 ? action.replace(/^.*\./, "") : undefined, queueName = queue === "false" ? false : validateQueue(args[0]), defaultQueue = defaults$1.queue; if (isVelocityResult(elements) && elements.velocity.animations) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = elements.velocity.animations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var animation = _step.value; checkAnimation(animation, queueName, defaultQueue, isPaused); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } else { var activeCall = State.first; while (activeCall) { if (!elements || elements.includes(activeCall.element)) { checkAnimation(activeCall, queueName, defaultQueue, isPaused); } activeCall = activeCall._next; } } if (promiseHandler) { if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["pause", pauseResume], true); registerAction(["resume", pauseResume], true); // Project /** * Get or set a style of Nomralised property value on one or more elements. * If there is no value passed then it will get, otherwise we will set. * * NOTE: When using "get" this will not touch the Promise as it is never * returned to the user. * * This can fail to set, and will reject the Promise if it does so. * * Velocity(elements, "style", "property", "value") => elements; * Velocity(elements, "style", {"property": "value", ...}) => elements; * Velocity(element, "style", "property") => "value"; * Velocity(elements, "style", "property") => ["value", ...]; */ function propertyAction(args, elements, promiseHandler, action) { var property = args[0], value = args[1]; if (!property) { console.warn("VelocityJS: Cannot access a non-existant property!"); return null; } // GET if (value === undefined && !isPlainObject(property)) { if (Array.isArray(property)) { if (elements.length === 1) { var result = {}; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = property[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var prop = _step.value; result[prop] = fixColors(getPropertyValue(elements[0], prop)); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return result; } else { var _result = []; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = elements[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var element = _step2.value; var res = {}; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = property[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var _prop = _step3.value; res[_prop] = fixColors(getPropertyValue(element, _prop)); } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } _result.push(res); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return _result; } } else { // If only a single animation is found and we're only targetting a // single element, then return the value directly if (elements.length === 1) { return fixColors(getPropertyValue(elements[0], property)); } var _result2 = []; var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = elements[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var _element = _step4.value; _result2.push(fixColors(getPropertyValue(_element, property))); } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } return _result2; } } // SET var error = []; if (isPlainObject(property)) { for (var propertyName in property) { if (property.hasOwnProperty(propertyName)) { var _iteratorNormalCompletion5 = true; var _didIteratorError5 = false; var _iteratorError5 = undefined; try { for (var _iterator5 = elements[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { var _element2 = _step5.value; var propertyValue = property[propertyName]; if (isString(propertyValue) || isNumber(propertyValue)) { setPropertyValue(_element2, propertyName, property[propertyName]); } else { error.push("Cannot set a property \"" + propertyName + "\" to an unknown type: " + (typeof propertyValue === "undefined" ? "undefined" : _typeof(propertyValue))); console.warn("VelocityJS: Cannot set a property \"" + propertyName + "\" to an unknown type:", propertyValue); } } } catch (err) { _didIteratorError5 = true; _iteratorError5 = err; } finally { try { if (!_iteratorNormalCompletion5 && _iterator5.return) { _iterator5.return(); } } finally { if (_didIteratorError5) { throw _iteratorError5; } } } } } } else if (isString(value) || isNumber(value)) { var _iteratorNormalCompletion6 = true; var _didIteratorError6 = false; var _iteratorError6 = undefined; try { for (var _iterator6 = elements[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { var _element3 = _step6.value; setPropertyValue(_element3, property, String(value)); } } catch (err) { _didIteratorError6 = true; _iteratorError6 = err; } finally { try { if (!_iteratorNormalCompletion6 && _iterator6.return) { _iterator6.return(); } } finally { if (_didIteratorError6) { throw _iteratorError6; } } } } else { error.push("Cannot set a property \"" + property + "\" to an unknown type: " + (typeof value === "undefined" ? "undefined" : _typeof(value))); console.warn("VelocityJS: Cannot set a property \"" + property + "\" to an unknown type:", value); } if (promiseHandler) { if (error.length) { promiseHandler._rejecter(error.join(", ")); } else if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["property", propertyAction], true); // Project registerAction(["reverse", function (args, elements, promiseHandler, action) { // NOTE: Code needs to split out before here - but this is needed to prevent it being overridden throw new SyntaxError("VelocityJS: The 'reverse' action is built in and private."); }], true); // Project /** * Check if an animation should be stopped, and if so then set the STOPPED * flag on it, then call complete. */ function checkAnimationShouldBeStopped(animation, queueName, defaultQueue) { validateTweens(animation); if (queueName === undefined || queueName === getValue(animation.queue, animation.options.queue, defaultQueue)) { animation._flags |= 8 /* STOPPED */; // tslint:disable-line:no-bitwise completeCall(animation); } } /** * When the stop action is triggered, the elements' currently active call is * immediately stopped. When an element is stopped, the next item in its * animation queue is immediately triggered. If passed via a chained call * then this will only target the animations in that call, and not the * elements linked to it. * * A queue name may be passed in to specify that only animations on the * named queue are stopped. The default queue is named "". In addition the * value of `false` is allowed for the queue name. * * An final argument may be passed in to clear an element's remaining queued * calls. This may only be the value `true`. * * Note: The stop command runs prior to Velocity's Queueing phase since its * behavior is intended to take effect *immediately*, regardless of the * element's current queue state. */ function stop(args, elements, promiseHandler, action) { var queueName = validateQueue(args[0], true), defaultQueue = defaults$1.queue, finishAll = args[queueName === undefined ? 0 : 1] === true; if (isVelocityResult(elements) && elements.velocity.animations) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = elements.velocity.animations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var animation = _step.value; checkAnimationShouldBeStopped(animation, queueName, defaultQueue); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } else { while (State.firstNew) { validateTweens(State.firstNew); } for (var activeCall = State.first, nextCall; activeCall && (finishAll || activeCall !== State.firstNew); activeCall = nextCall || State.firstNew) { nextCall = activeCall._next; if (!elements || elements.includes(activeCall.element)) { checkAnimationShouldBeStopped(activeCall, queueName, defaultQueue); } } } if (promiseHandler) { if (isVelocityResult(elements) && elements.velocity.animations && elements.then) { elements.then(promiseHandler._resolver); } else { promiseHandler._resolver(elements); } } } registerAction(["stop", stop], true); // Project registerAction(["style", propertyAction], true); // Project /** * */ function tweenAction(args, elements, promiseHandler, action) { var requireForcefeeding = void 0; if (!elements) { if (!args.length) { console.info("Velocity(, \"tween\", percentComplete, property, end | [end, , ], ) => value\nVelocity(, \"tween\", percentComplete, {property: end | [end, , ], ...}, ) => {property: value, ...}"); return null; } elements = [document.body]; requireForcefeeding = true; } else if (elements.length !== 1) { // TODO: Allow more than a single element to return an array of results throw new Error("VelocityJS: Cannot tween more than one element!"); } var percentComplete = args[0], fakeAnimation = { elements: elements, element: elements[0], queue: false, options: { duration: 1000 }, tweens: null }, result = {}; var properties = args[1], singleResult = void 0, maybeSequence = void 0, easing = args[2], count = 0; if (isString(args[1])) { if (SequencesObject && SequencesObject[args[1]]) { maybeSequence = SequencesObject[args[1]]; properties = {}; easing = args[2]; } else { singleResult = true; properties = defineProperty({}, args[1], args[2]); easing = args[3]; } } else if (Array.isArray(args[1])) { singleResult = true; properties = { tween: args[1] }; easing = args[2]; } if (!isNumber(percentComplete) || percentComplete < 0 || percentComplete > 1) { throw new Error("VelocityJS: Must tween a percentage from 0 to 1!"); } if (!isPlainObject(properties)) { throw new Error("VelocityJS: Cannot tween an invalid property!"); } if (requireForcefeeding) { for (var property in properties) { if (properties.hasOwnProperty(property) && (!Array.isArray(properties[property]) || properties[property].length < 2)) { throw new Error("VelocityJS: When not supplying an element you must force-feed values: " + property); } } } var activeEasing = validateEasing(getValue(easing, defaults$1.easing), DEFAULT_DURATION); if (maybeSequence) { expandSequence(fakeAnimation, maybeSequence); } else { expandProperties(fakeAnimation, properties); } // tslint:disable-next-line:forin for (var _property in fakeAnimation.tweens) { // For every element, iterate through each property. var propertyTween = fakeAnimation.tweens[_property], sequence = propertyTween.sequence, pattern = sequence.pattern; var currentValue = "", i = 0; count++; if (pattern) { var easingComplete = (propertyTween.easing || activeEasing)(percentComplete, 0, 1, _property); var best = 0; for (var j = 0; j < sequence.length - 1; j++) { if (sequence[j].percent < easingComplete) { best = j; } } var tweenFrom = sequence[best], tweenTo = sequence[best + 1] || tweenFrom, tweenPercent = (percentComplete - tweenFrom.percent) / (tweenTo.percent - tweenFrom.percent), tweenEasing = tweenTo.easing || linearEasing; for (; i < pattern.length; i++) { var startValue = tweenFrom[i]; if (startValue == null) { currentValue += pattern[i]; } else { var endValue = tweenTo[i]; if (startValue === endValue) { currentValue += startValue; } else { // All easings must deal with numbers except for our internal ones. var value = tweenEasing(tweenPercent, startValue, endValue, _property); currentValue += pattern[i] === true ? Math.round(value) : value; } } } result[_property] = currentValue; } } if (singleResult && count === 1) { for (var _property2 in result) { if (result.hasOwnProperty(_property2)) { return result[_property2]; } } } return result; } registerAction(["tween", tweenAction], true); // Project /** * Converting from hex as it makes for a smaller file. */ var colorValues = { aliceblue: 0xF0F8FF, antiquewhite: 0xFAEBD7, aqua: 0x00FFFF, aquamarine: 0x7FFFD4, azure: 0xF0FFFF, beige: 0xF5F5DC, bisque: 0xFFE4C4, black: 0x000000, blanchedalmond: 0xFFEBCD, blue: 0x0000FF, blueviolet: 0x8A2BE2, brown: 0xA52A2A, burlywood: 0xDEB887, cadetblue: 0x5F9EA0, chartreuse: 0x7FFF00, chocolate: 0xD2691E, coral: 0xFF7F50, cornflowerblue: 0x6495ED, cornsilk: 0xFFF8DC, crimson: 0xDC143C, cyan: 0x00FFFF, darkblue: 0x00008B, darkcyan: 0x008B8B, darkgoldenrod: 0xB8860B, darkgray: 0xA9A9A9, darkgrey: 0xA9A9A9, darkgreen: 0x006400, darkkhaki: 0xBDB76B, darkmagenta: 0x8B008B, darkolivegreen: 0x556B2F, darkorange: 0xFF8C00, darkorchid: 0x9932CC, darkred: 0x8B0000, darksalmon: 0xE9967A, darkseagreen: 0x8FBC8F, darkslateblue: 0x483D8B, darkslategray: 0x2F4F4F, darkslategrey: 0x2F4F4F, darkturquoise: 0x00CED1, darkviolet: 0x9400D3, deeppink: 0xFF1493, deepskyblue: 0x00BFFF, dimgray: 0x696969, dimgrey: 0x696969, dodgerblue: 0x1E90FF, firebrick: 0xB22222, floralwhite: 0xFFFAF0, forestgreen: 0x228B22, fuchsia: 0xFF00FF, gainsboro: 0xDCDCDC, ghostwhite: 0xF8F8FF, gold: 0xFFD700, goldenrod: 0xDAA520, gray: 0x808080, grey: 0x808080, green: 0x008000, greenyellow: 0xADFF2F, honeydew: 0xF0FFF0, hotpink: 0xFF69B4, indianred: 0xCD5C5C, indigo: 0x4B0082, ivory: 0xFFFFF0, khaki: 0xF0E68C, lavender: 0xE6E6FA, lavenderblush: 0xFFF0F5, lawngreen: 0x7CFC00, lemonchiffon: 0xFFFACD, lightblue: 0xADD8E6, lightcoral: 0xF08080, lightcyan: 0xE0FFFF, lightgoldenrodyellow: 0xFAFAD2, lightgray: 0xD3D3D3, lightgrey: 0xD3D3D3, lightgreen: 0x90EE90, lightpink: 0xFFB6C1, lightsalmon: 0xFFA07A, lightseagreen: 0x20B2AA, lightskyblue: 0x87CEFA, lightslategray: 0x778899, lightslategrey: 0x778899, lightsteelblue: 0xB0C4DE, lightyellow: 0xFFFFE0, lime: 0x00FF00, limegreen: 0x32CD32, linen: 0xFAF0E6, magenta: 0xFF00FF, maroon: 0x800000, mediumaquamarine: 0x66CDAA, mediumblue: 0x0000CD, mediumorchid: 0xBA55D3, mediumpurple: 0x9370DB, mediumseagreen: 0x3CB371, mediumslateblue: 0x7B68EE, mediumspringgreen: 0x00FA9A, mediumturquoise: 0x48D1CC, mediumvioletred: 0xC71585, midnightblue: 0x191970, mintcream: 0xF5FFFA, mistyrose: 0xFFE4E1, moccasin: 0xFFE4B5, navajowhite: 0xFFDEAD, navy: 0x000080, oldlace: 0xFDF5E6, olive: 0x808000, olivedrab: 0x6B8E23, orange: 0xFFA500, orangered: 0xFF4500, orchid: 0xDA70D6, palegoldenrod: 0xEEE8AA, palegreen: 0x98FB98, paleturquoise: 0xAFEEEE, palevioletred: 0xDB7093, papayawhip: 0xFFEFD5, peachpuff: 0xFFDAB9, peru: 0xCD853F, pink: 0xFFC0CB, plum: 0xDDA0DD, powderblue: 0xB0E0E6, purple: 0x800080, rebeccapurple: 0x663399, red: 0xFF0000, rosybrown: 0xBC8F8F, royalblue: 0x4169E1, saddlebrown: 0x8B4513, salmon: 0xFA8072, sandybrown: 0xF4A460, seagreen: 0x2E8B57, seashell: 0xFFF5EE, sienna: 0xA0522D, silver: 0xC0C0C0, skyblue: 0x87CEEB, slateblue: 0x6A5ACD, slategray: 0x708090, slategrey: 0x708090, snow: 0xFFFAFA, springgreen: 0x00FF7F, steelblue: 0x4682B4, tan: 0xD2B48C, teal: 0x008080, thistle: 0xD8BFD8, tomato: 0xFF6347, turquoise: 0x40E0D0, violet: 0xEE82EE, wheat: 0xF5DEB3, white: 0xFFFFFF, whitesmoke: 0xF5F5F5, yellow: 0xFFFF00, yellowgreen: 0x9ACD32 }; for (var name in colorValues) { if (colorValues.hasOwnProperty(name)) { var color = colorValues[name]; ColorNames[name] = Math.floor(color / 65536) + "," + Math.floor(color / 256 % 256) + "," + color % 256; } } // Project function registerBackIn(name, amount) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return Math.pow(percentComplete, 2) * ((amount + 1) * percentComplete - amount) * (endValue - startValue); }]); } function registerBackOut(name, amount) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return (Math.pow(--percentComplete, 2) * ((amount + 1) * percentComplete + amount) + 1) * (endValue - startValue); }]); } function registerBackInOut(name, amount) { amount *= 1.525; registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } percentComplete *= 2; return (percentComplete < 1 ? Math.pow(percentComplete, 2) * ((amount + 1) * percentComplete - amount) : Math.pow(percentComplete - 2, 2) * ((amount + 1) * (percentComplete - 2) + amount) + 2) * 0.5 * (endValue - startValue); }]); } registerBackIn("easeInBack", 1.7); registerBackOut("easeOutBack", 1.7); registerBackInOut("easeInOutBack", 1.7); // TODO: Expose these as actions to register custom easings? // Project function easeOutBouncePercent(percentComplete) { if (percentComplete < 1 / 2.75) { return 7.5625 * percentComplete * percentComplete; } if (percentComplete < 2 / 2.75) { return 7.5625 * (percentComplete -= 1.5 / 2.75) * percentComplete + 0.75; } if (percentComplete < 2.5 / 2.75) { return 7.5625 * (percentComplete -= 2.25 / 2.75) * percentComplete + 0.9375; } return 7.5625 * (percentComplete -= 2.625 / 2.75) * percentComplete + 0.984375; } function easeInBouncePercent(percentComplete) { return 1 - easeOutBouncePercent(1 - percentComplete); } function easeInBounce(percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return easeInBouncePercent(percentComplete) * (endValue - startValue); } function easeOutBounce(percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return easeOutBouncePercent(percentComplete) * (endValue - startValue); } function easeInOutBounce(percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return (percentComplete < 0.5 ? easeInBouncePercent(percentComplete * 2) * 0.5 : easeOutBouncePercent(percentComplete * 2 - 1) * 0.5 + 0.5) * (endValue - startValue); } registerEasing(["easeInBounce", easeInBounce]); registerEasing(["easeOutBounce", easeOutBounce]); registerEasing(["easeInOutBounce", easeInOutBounce]); // Project // Constants var PI2 = Math.PI * 2; function registerElasticIn(name, amplitude, period) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return -(amplitude * Math.pow(2, 10 * (percentComplete -= 1)) * Math.sin((percentComplete - period / PI2 * Math.asin(1 / amplitude)) * PI2 / period)) * (endValue - startValue); }]); } function registerElasticOut(name, amplitude, period) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } return (amplitude * Math.pow(2, -10 * percentComplete) * Math.sin((percentComplete - period / PI2 * Math.asin(1 / amplitude)) * PI2 / period) + 1) * (endValue - startValue); }]); } function registerElasticInOut(name, amplitude, period) { registerEasing([name, function (percentComplete, startValue, endValue) { if (percentComplete === 0) { return startValue; } if (percentComplete === 1) { return endValue; } var s = period / PI2 * Math.asin(1 / amplitude); percentComplete = percentComplete * 2 - 1; return (percentComplete < 0 ? -0.5 * (amplitude * Math.pow(2, 10 * percentComplete) * Math.sin((percentComplete - s) * PI2 / period)) : amplitude * Math.pow(2, -10 * percentComplete) * Math.sin((percentComplete - s) * PI2 / period) * 0.5 + 1) * (endValue - startValue); }]); } registerElasticIn("easeInElastic", 1, 0.3); registerElasticOut("easeOutElastic", 1, 0.3); registerElasticInOut("easeInOutElastic", 1, 0.3 * 1.5); // TODO: Expose these as actions to register custom easings? // Project /** * Easing function that sets to the specified value immediately after the * animation starts. */ function atStart(percentComplete, startValue, endValue) { return percentComplete === 0 ? startValue : endValue; } /** * Easing function that sets to the specified value while the animation is * running. */ function during(percentComplete, startValue, endValue) { return percentComplete === 0 || percentComplete === 1 ? startValue : endValue; } /** * Easing function that sets to the specified value when the animation ends. */ function atEnd(percentComplete, startValue, endValue) { return percentComplete === 1 ? endValue : startValue; } registerEasing(["at-start", atStart]); registerEasing(["during", during]); registerEasing(["at-end", atEnd]); // Project /** * Get/set the inner/outer dimension. */ function getDimension(name, wantInner) { return function (element, propertyValue) { if (propertyValue === undefined) { return augmentDimension(element, name, wantInner) + "px"; } setPropertyValue(element, name, parseFloat(propertyValue) - augmentDimension(element, name, wantInner) + "px"); }; } registerNormalization(["Element", "innerWidth", getDimension("width", true)]); registerNormalization(["Element", "innerHeight", getDimension("height", true)]); registerNormalization(["Element", "outerWidth", getDimension("width", false)]); registerNormalization(["Element", "outerHeight", getDimension("height", false)]); // Project // Constants var inlineRx = /^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|let|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i, listItemRx = /^(li)$/i, tableRowRx = /^(tr)$/i, tableRx = /^(table)$/i, tableRowGroupRx = /^(tbody)$/i; function display(element, propertyValue) { var style = element.style; if (propertyValue === undefined) { return computePropertyValue(element, "display"); } if (propertyValue === "auto") { var nodeName = element && element.nodeName, data = Data(element); if (inlineRx.test(nodeName)) { propertyValue = "inline"; } else if (listItemRx.test(nodeName)) { propertyValue = "list-item"; } else if (tableRowRx.test(nodeName)) { propertyValue = "table-row"; } else if (tableRx.test(nodeName)) { propertyValue = "table"; } else if (tableRowGroupRx.test(nodeName)) { propertyValue = "table-row-group"; } else { // Default to "block" when no match is found. propertyValue = "block"; } // IMPORTANT: We need to do this as getPropertyValue bypasses the // Normalisation when it exists in the cache. data.cache["display"] = propertyValue; } style.display = propertyValue; } registerNormalization(["Element", "display", display]); // Project function clientWidth(element, propertyValue) { if (propertyValue == null) { return element.clientWidth + "px"; } } function scrollWidth(element, propertyValue) { if (propertyValue == null) { return element.scrollWidth + "px"; } } function clientHeight(element, propertyValue) { if (propertyValue == null) { return element.clientHeight + "px"; } } function scrollHeight(element, propertyValue) { if (propertyValue == null) { return element.scrollHeight + "px"; } } function scroll(direction, end) { return function (element, propertyValue) { if (propertyValue == null) { // Make sure we have these values cached. getPropertyValue(element, "client" + direction, null, true); getPropertyValue(element, "scroll" + direction, null, true); return element["scroll" + end] + "px"; } var value = parseFloat(propertyValue), unit = propertyValue.replace(String(value), ""); switch (unit) { case "": case "px": element["scroll" + end] = value; break; case "%": var client = parseFloat(getPropertyValue(element, "client" + direction)), scrollValue = parseFloat(getPropertyValue(element, "scroll" + direction)); element["scroll" + end] = Math.max(0, scrollValue - client) * value / 100; break; } }; } registerNormalization(["HTMLElement", "scroll", scroll("Height", "Top"), false]); registerNormalization(["HTMLElement", "scrollTop", scroll("Height", "Top"), false]); registerNormalization(["HTMLElement", "scrollLeft", scroll("Width", "Left"), false]); registerNormalization(["HTMLElement", "scrollWidth", scrollWidth]); registerNormalization(["HTMLElement", "clientWidth", clientWidth]); registerNormalization(["HTMLElement", "scrollHeight", scrollHeight]); registerNormalization(["HTMLElement", "clientHeight", clientHeight]); // Project /** * An RegExp pattern for the following list of css words using * http://kemio.com.ar/tools/lst-trie-re.php to generate: * * blockSize * borderBottomLeftRadius * borderBottomRightRadius * borderBottomWidth * borderImageOutset * borderImageWidth * borderLeftWidth * borderRadius * borderRightWidth * borderSpacing * borderTopLeftRadius * borderTopRightRadius * borderTopWidth * borderWidth * bottom * columnGap * columnRuleWidth * columnWidth * flexBasis * fontSize * gridColumnGap * gridGap * gridRowGap * height * inlineSize * left * letterSpacing * margin * marginBottom * marginLeft * marginRight * marginTop * maxBlockSize * maxHeight * maxInlineSize * maxWidth * minBlockSize * minHeight * minInlineSize * minWidth * objectPosition * outlineOffset * outlineWidth * padding * paddingBottom * paddingLeft * paddingRight * paddingTop * perspective * right * shapeMargin * strokeDashoffset * strokeWidth * textIndent * top * transformOrigin * width * wordSpacing */ // tslint:disable-next-line:max-line-length var rxAddPx = /^(b(lockSize|o(rder(Bottom(LeftRadius|RightRadius|Width)|Image(Outset|Width)|LeftWidth|R(adius|ightWidth)|Spacing|Top(LeftRadius|RightRadius|Width)|Width)|ttom))|column(Gap|RuleWidth|Width)|f(lexBasis|ontSize)|grid(ColumnGap|Gap|RowGap)|height|inlineSize|le(ft|tterSpacing)|m(a(rgin(Bottom|Left|Right|Top)|x(BlockSize|Height|InlineSize|Width))|in(BlockSize|Height|InlineSize|Width))|o(bjectPosition|utline(Offset|Width))|p(adding(Bottom|Left|Right|Top)|erspective)|right|s(hapeMargin|troke(Dashoffset|Width))|t(extIndent|op|ransformOrigin)|w(idth|ordSpacing))$/; /** * Return a Normalisation that can be used to set / get a prefixed style * property. */ function getSetPrefixed(propertyName, unprefixed) { return function (element, propertyValue) { if (propertyValue === undefined) { return computePropertyValue(element, propertyName) || computePropertyValue(element, unprefixed); } element.style[propertyName] = element.style[unprefixed] = propertyValue; }; } /** * Return a Normalisation that can be used to set / get a style property. */ function getSetStyle(propertyName) { return function (element, propertyValue) { if (propertyValue === undefined) { return computePropertyValue(element, propertyName); } element.style[propertyName] = propertyValue; }; } /** * Vendor prefixes. Chrome / Safari, Firefox, IE / Edge, Opera. */ var rxVendors = /^(webkit|moz|ms|o)[A-Z]/, prefixElement = State.prefixElement; if (prefixElement) { for (var propertyName in prefixElement.style) { if (rxVendors.test(propertyName)) { var unprefixed = propertyName.replace(/^[a-z]+([A-Z])/, function ($, letter) { return letter.toLowerCase(); }); { var addUnit = rxAddPx.test(unprefixed) ? "px" : undefined; registerNormalization(["Element", unprefixed, getSetPrefixed(propertyName, unprefixed), addUnit]); } } else if (!hasNormalization(["Element", propertyName])) { var _addUnit = rxAddPx.test(propertyName) ? "px" : undefined; registerNormalization(["Element", propertyName, getSetStyle(propertyName), _addUnit]); } } } // Project /** * Get/set an attribute. */ function getAttribute(name) { return function (element, propertyValue) { if (propertyValue === undefined) { return element.getAttribute(name); } element.setAttribute(name, propertyValue); }; } var base = document.createElement("div"), rxSubtype = /^SVG(.*)Element$/, rxElement = /Element$/; Object.getOwnPropertyNames(window).forEach(function (property) { var subtype = rxSubtype.exec(property); if (subtype && subtype[1] !== "SVG") { // Don't do SVGSVGElement. try { var element = subtype[1] ? document.createElementNS("http://www.w3.org/2000/svg", (subtype[1] || "svg").toLowerCase()) : document.createElement("svg"); // tslint:disable-next-line:forin for (var attribute in element) { // Although this isn't a tween without prototypes, we do // want to get hold of all attributes and not just own ones. var value = element[attribute]; if (isString(attribute) && !(attribute[0] === "o" && attribute[1] === "n") && attribute !== attribute.toUpperCase() && !rxElement.test(attribute) && !(attribute in base) && !isFunction(value)) { // TODO: Should this all be set on the generic SVGElement, it would save space and time, but not as powerful registerNormalization([property, attribute, getAttribute(attribute)]); } } } catch (e) { console.error("VelocityJS: Error when trying to identify SVG attributes on " + property + ".", e); } } }); // Project /** * Get/set the width or height. */ function getDimension$1(name) { return function (element, propertyValue) { if (propertyValue === undefined) { // Firefox throws an error if .getBBox() is called on an SVG that isn't attached to the DOM. try { return element.getBBox()[name] + "px"; } catch (e) { return "0px"; } } element.setAttribute(name, propertyValue); }; } registerNormalization(["SVGElement", "width", getDimension$1("width")]); registerNormalization(["SVGElement", "height", getDimension$1("height")]); // Project /** * A fake normalization used to allow the "tween" property easy access. */ function getSetTween(element, propertyValue) { if (propertyValue === undefined) { return ""; } } registerNormalization(["Element", "tween", getSetTween]); // Automatically generated var VERSION = "2.0.6"; // Project var Velocity$$1 = Velocity$1; /** * These parts of Velocity absolutely must be included, even if they're unused! */ var VelocityStatic; (function (VelocityStatic) { /** * Actions cannot be replaced if they are internal (hasOwnProperty is false * but they still exist). Otherwise they can be replaced by users. * * All external method calls should be using actions rather than sub-calls * of Velocity itself. */ VelocityStatic.Actions = Actions; /** * Our known easing functions. */ VelocityStatic.Easings = Easings; /** * The currently registered sequences. */ VelocityStatic.Sequences = SequencesObject; /** * Current internal state of Velocity. */ VelocityStatic.State = State; // tslint:disable-line:no-shadowed-variable /** * Velocity option defaults, which can be overriden by the user. */ VelocityStatic.defaults = defaults$1; /** * Used to patch any object to allow Velocity chaining. In order to chain an * object must either be treatable as an array - with a .length * property, and each member a Node, or a Node directly. * * By default Velocity will try to patch window, * jQuery, Zepto, and several classes that return * Nodes or lists of Nodes. */ VelocityStatic.patch = patch; /** * Set to true, 1 or 2 (most verbose) to output debug info to console. */ VelocityStatic.debug = false; /** * In mock mode, all animations are forced to complete immediately upon the * next rAF tick. If there are further animations queued then they will each * take one single frame in turn. Loops and repeats will be disabled while * mock = true. */ VelocityStatic.mock = false; /** * Save our version number somewhere visible. */ VelocityStatic.version = VERSION; /** * Added as a fallback for "import {Velocity} from 'velocity-animate';". */ VelocityStatic.Velocity = Velocity$1; // tslint:disable-line:no-shadowed-variable })(VelocityStatic || (VelocityStatic = {})); /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ var IE = function () { if (document.documentMode) { return document.documentMode; } else { for (var i = 7; i > 4; i--) { var div = document.createElement("div"); div.innerHTML = ""; if (div.getElementsByTagName("span").length) { div = null; return i; } } } return undefined; }(); /****************** Unsupported ******************/ if (IE <= 8) { throw new Error("VelocityJS cannot run on Internet Explorer 8 or earlier"); } /****************** Frameworks ******************/ if (window) { /* * Both jQuery and Zepto allow their $.fn object to be extended to allow * wrapped elements to be subjected to plugin calls. If either framework is * loaded, register a "velocity" extension pointing to Velocity's core * animate() method. Velocity also registers itself onto a global container * (window.jQuery || window.Zepto || window) so that certain features are * accessible beyond just a per-element scope. Accordingly, Velocity can * both act on wrapped DOM elements and stand alone for targeting raw DOM * elements. */ var jQuery = window.jQuery, Zepto = window.Zepto; patch(window, true); patch(Element && Element.prototype); patch(NodeList && NodeList.prototype); patch(HTMLCollection && HTMLCollection.prototype); patch(jQuery, true); patch(jQuery && jQuery.fn); patch(Zepto, true); patch(Zepto && Zepto.fn); } // Make sure that the values within Velocity are read-only and upatchable. var _loop = function _loop(property) { if (VelocityStatic.hasOwnProperty(property)) { switch (typeof property === "undefined" ? "undefined" : _typeof(property)) { case "number": case "boolean": defineProperty$1(Velocity$$1, property, { get: function get$$1() { return VelocityStatic[property]; }, set: function set$$1(value) { VelocityStatic[property] = value; } }, true); break; default: defineProperty$1(Velocity$$1, property, VelocityStatic[property], true); break; } } }; for (var property in VelocityStatic) { _loop(property); } Object.freeze(Velocity$$1); // Project var rxPercents = /(\d*\.\d+|\d+\.?|from|to)/g; function expandSequence(animation, sequence) { var tweens = animation.tweens = Object.create(null), element = animation.element; for (var propertyName in sequence.tweens) { if (sequence.tweens.hasOwnProperty(propertyName)) { var fn = getNormalization(element, propertyName); if (!fn && propertyName !== "tween") { if (Velocity$$1.debug) { console.log("Skipping [" + propertyName + "] due to a lack of browser support."); } continue; } tweens[propertyName] = { fn: fn, sequence: sequence.tweens[propertyName] }; } } } /** * Used to register a sequence. This should never be called by users * directly, instead it should be called via an action:
      * Velocity("registerSequence", ""name", VelocitySequence); */ function registerSequence(args) { if (isPlainObject(args[0])) { for (var name in args[0]) { if (args[0].hasOwnProperty(name)) { registerSequence([name, args[0][name]]); } } } else if (isString(args[0])) { var _name = args[0], sequence = args[1]; if (!isString(_name)) { console.warn("VelocityJS: Trying to set 'registerSequence' name to an invalid value:", _name); } else if (!isPlainObject(sequence)) { console.warn("VelocityJS: Trying to set 'registerSequence' sequence to an invalid value:", _name, sequence); } else { if (SequencesObject[_name]) { console.warn("VelocityJS: Replacing named sequence:", _name); } var percents = {}, steps = new Array(100), properties = [], sequenceList = SequencesObject[_name] = {}, duration = validateDuration(sequence.duration); sequenceList.tweens = {}; if (isNumber(duration)) { sequenceList.duration = duration; } for (var part in sequence) { if (sequence.hasOwnProperty(part)) { var keys = String(part).match(rxPercents); if (keys) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; var percent = key === "from" ? 0 : key === "to" ? 100 : parseFloat(key); if (percent < 0 || percent > 100) { console.warn("VelocityJS: Trying to use an invalid value as a percentage (0 <= n <= 100):", _name, percent); } else if (isNaN(percent)) { console.warn("VelocityJS: Trying to use an invalid number as a percentage:", _name, part, key); } else { if (!percents[String(percent)]) { percents[String(percent)] = []; } percents[String(percent)].push(part); for (var property in sequence[part]) { if (!properties.includes(property)) { properties.push(property); } } } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } } } var orderedPercents = Object.keys(percents).sort(function (a, b) { var a1 = parseFloat(a), b1 = parseFloat(b); return a1 > b1 ? 1 : a1 < b1 ? -1 : 0; }); orderedPercents.forEach(function (key) { steps.push.apply(percents[key]); }); var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = properties[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _property = _step2.value; var parts = [], propertyName = camelCase(_property); var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = orderedPercents[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var _key = _step3.value; var _iteratorNormalCompletion6 = true; var _didIteratorError6 = false; var _iteratorError6 = undefined; try { for (var _iterator6 = percents[_key][Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { var _value = _step6.value; var stepProperties = sequence[_value]; if (stepProperties[propertyName]) { parts.push(isString(stepProperties[propertyName]) ? stepProperties[propertyName] : stepProperties[propertyName][0]); } } } catch (err) { _didIteratorError6 = true; _iteratorError6 = err; } finally { try { if (!_iteratorNormalCompletion6 && _iterator6.return) { _iterator6.return(); } } finally { if (_didIteratorError6) { throw _iteratorError6; } } } } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } if (parts.length) { var realSequence = findPattern(parts, propertyName); var index = 0; if (realSequence) { var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = orderedPercents[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var _key2 = _step4.value; var _iteratorNormalCompletion5 = true; var _didIteratorError5 = false; var _iteratorError5 = undefined; try { for (var _iterator5 = percents[_key2][Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { var value = _step5.value; var originalProperty = sequence[value][propertyName]; if (originalProperty) { if (Array.isArray(originalProperty) && originalProperty.length > 1 && (isString(originalProperty[1]) || Array.isArray(originalProperty[1]))) { realSequence[index].easing = validateEasing(originalProperty[1], sequenceList.duration || DEFAULT_DURATION); } realSequence[index++].percent = parseFloat(_key2) / 100; } } } catch (err) { _didIteratorError5 = true; _iteratorError5 = err; } finally { try { if (!_iteratorNormalCompletion5 && _iterator5.return) { _iterator5.return(); } } finally { if (_didIteratorError5) { throw _iteratorError5; } } } } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } sequenceList.tweens[propertyName] = realSequence; } } } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } } } registerAction(["registerSequence", registerSequence], true); // Project var globalPromise = void 0; try { globalPromise = Promise; } catch ( /**/_a) {/**/} var noPromiseOption = ", if that is deliberate then pass `promiseRejectEmpty:false` as an option"; /** * Patch a VelocityResult with a Promise. */ function patchPromise(promiseObject, result) { defineProperty$1(result, "promise", promiseObject); defineProperty$1(result, "then", promiseObject.then.bind(promiseObject)); defineProperty$1(result, "catch", promiseObject.catch.bind(promiseObject)); if (promiseObject.finally) { // Semi-standard defineProperty$1(result, "finally", promiseObject.finally.bind(promiseObject)); } } /* tslint:enable:max-line-length */ function Velocity$1() { var /** * A shortcut to the default options. */ defaults$$1 = defaults$1, /** * Cache of the first argument - this is used often enough to be saved. */ args0 = arguments.length <= 0 ? undefined : arguments[0], /** * To allow for expressive CoffeeScript code, Velocity supports an * alternative syntax in which "elements" (or "e"), "properties" (or * "p"), and "options" (or "o") objects are defined on a container * object that's passed in as Velocity's sole argument. * * Note: Some browsers automatically populate arguments with a * "properties" object. We detect it by checking for its default * "names" property. */ // TODO: Confirm which browsers - if <=IE8 the we can drop completely syntacticSugar = isPlainObject(args0) && (args0.p || isPlainObject(args0.properties) && !args0.properties.names || isString(args0.properties)); var /** * When Velocity is called via the utility function (Velocity()), * elements are explicitly passed in as the first parameter. Thus, * argument positioning varies. */ argumentIndex = 0, /** * The list of elements, extended with Promise and Velocity. */ elements = void 0, /** * The properties being animated. This can be a string, in which case it * is either a function for these elements, or it is a "named" animation * sequence to use instead. Named sequences start with either "callout." * or "transition.". When used as a callout the values will be reset * after finishing. When used as a transtition then there is no special * handling after finishing. */ propertiesMap = void 0, /** * Options supplied, this will be mapped and validated into * options. */ optionsMap = void 0, /** * If called via a chain then this contains the last calls * animations. If this does not have a value then any access to the * element's animations needs to be to the currently-running ones. */ animations = void 0, /** * The promise that is returned. */ promise = void 0, // Used when the animation is finished resolver = void 0, // Used when there was an issue with one or more of the Velocity arguments rejecter = void 0; //console.log(`Velocity`, args) // First get the elements, and the animations connected to the last call if // this is chained. // TODO: Clean this up a bit // TODO: Throw error if the chain is called with elements as the first argument. isVelocityResult(this) && ( (isNode(arg0) || isWrapped(arg0)) && arg0 == this) if (isNode(this)) { // This is from a chain such as document.getElementById("").velocity(...) elements = [this]; } else if (isWrapped(this)) { // This might be a chain from something else, but if chained from a // previous Velocity() call then grab the animations it's related to. elements = cloneArray(this); if (isVelocityResult(this)) { animations = this.velocity.animations; } } else if (syntacticSugar) { elements = cloneArray(args0.elements || args0.e); argumentIndex++; } else if (isNode(args0)) { elements = cloneArray([args0]); argumentIndex++; } else if (isWrapped(args0)) { elements = cloneArray(args0); argumentIndex++; } // Allow elements to be chained. if (elements) { defineProperty$1(elements, "velocity", Velocity$1.bind(elements)); if (animations) { defineProperty$1(elements.velocity, "animations", animations); } } // Next get the propertiesMap and options. if (syntacticSugar) { propertiesMap = getValue(args0.properties, args0.p); } else { var _ref; // TODO: Should be possible to call Velocity("pauseAll") - currently not possible propertiesMap = (_ref = argumentIndex++, arguments.length <= _ref ? undefined : arguments[_ref]); } // Get any options map passed in as arguments first, expand any direct // options if possible. var isReverse = propertiesMap === "reverse", isAction = !isReverse && isString(propertiesMap), maybeSequence = isAction && SequencesObject[propertiesMap], opts = syntacticSugar ? getValue(args0.options, args0.o) : arguments.length <= argumentIndex ? undefined : arguments[argumentIndex]; if (isPlainObject(opts)) { optionsMap = opts; } // Create the promise if supported and wanted. if (globalPromise && getValue(optionsMap && optionsMap.promise, defaults$$1.promise)) { promise = new globalPromise(function (resolve, reject) { rejecter = reject; // IMPORTANT: // If a resolver tries to run on a Promise then it will wait until // that Promise resolves - but in this case we're running on our own // Promise, so need to make sure it's not seen as one. Removing // these values for the duration of the resolve. // Due to being an async call, they should be back to "normal" // before the .then() function gets called. resolver = function resolver(result) { if (isVelocityResult(result) && result.promise) { delete result.then; delete result.catch; delete result.finally; resolve(result); patchPromise(result.promise, result); } else { resolve(result); } }; }); if (elements) { patchPromise(promise, elements); } } if (promise) { var optionPromiseRejectEmpty = optionsMap && optionsMap.promiseRejectEmpty, promiseRejectEmpty = getValue(optionPromiseRejectEmpty, defaults$$1.promiseRejectEmpty); if (!elements && !isAction) { if (promiseRejectEmpty) { rejecter("Velocity: No elements supplied" + (isBoolean(optionPromiseRejectEmpty) ? "" : noPromiseOption) + ". Aborting."); } else { resolver(); } } else if (!propertiesMap) { if (promiseRejectEmpty) { rejecter("Velocity: No properties supplied" + (isBoolean(optionPromiseRejectEmpty) ? "" : noPromiseOption) + ". Aborting."); } else { resolver(); } } } if (!elements && !isAction || !propertiesMap) { return promise; } // NOTE: Can't use isAction here due to type inference - there are callbacks // between so the type isn't considered safe. if (isAction) { var actionArgs = [], promiseHandler = promise && { _promise: promise, _resolver: resolver, _rejecter: rejecter }; while (argumentIndex < arguments.length) { var _ref2; actionArgs.push((_ref2 = argumentIndex++, arguments.length <= _ref2 ? undefined : arguments[_ref2])); } // Velocity's behavior is categorized into "actions". If a string is // passed in instead of a propertiesMap then that will call a function // to do something special to the animation linked. // There is one special case - "reverse" - which is handled differently, // by being stored on the animation and then expanded when the animation // starts. var action = propertiesMap.replace(/\..*$/, ""), callback = Actions[action]; if (callback) { var result = callback(actionArgs, elements, promiseHandler, propertiesMap); if (result !== undefined) { return result; } return elements || promise; } else if (!maybeSequence) { console.error("VelocityJS: First argument (" + propertiesMap + ") was not a property map, a known action, or a registered redirect. Aborting."); return; } } var hasValidDuration = void 0; if (isPlainObject(propertiesMap) || isReverse || maybeSequence) { /** * The options for this set of animations. */ var options = {}; var isSync = defaults$$1.sync; // Private options first - set as non-enumerable, and starting with an // underscore so we can filter them out. if (promise) { defineProperty$1(options, "_promise", promise); defineProperty$1(options, "_rejecter", rejecter); defineProperty$1(options, "_resolver", resolver); } defineProperty$1(options, "_ready", 0); defineProperty$1(options, "_started", 0); defineProperty$1(options, "_completed", 0); defineProperty$1(options, "_total", 0); // Now check the optionsMap if (isPlainObject(optionsMap)) { var validDuration = validateDuration(optionsMap.duration); hasValidDuration = validDuration !== undefined; options.duration = getValue(validDuration, defaults$$1.duration); options.delay = getValue(validateDelay(optionsMap.delay), defaults$$1.delay); // Need the extra fallback here in case it supplies an invalid // easing that we need to overrride with the default. options.easing = validateEasing(getValue(optionsMap.easing, defaults$$1.easing), options.duration) || validateEasing(defaults$$1.easing, options.duration); options.loop = getValue(validateLoop(optionsMap.loop), defaults$$1.loop); options.repeat = options.repeatAgain = getValue(validateRepeat(optionsMap.repeat), defaults$$1.repeat); if (optionsMap.speed != null) { options.speed = getValue(validateSpeed(optionsMap.speed), 1); } if (isBoolean(optionsMap.promise)) { options.promise = optionsMap.promise; } options.queue = getValue(validateQueue(optionsMap.queue), defaults$$1.queue); if (optionsMap.mobileHA && !State.isGingerbread) { /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack) on animating elements. HA is removed from the element at the completion of its animation. */ /* Note: Android Gingerbread doesn't support HA. If a null transform hack (mobileHA) is in fact set, it will prevent other tranform subproperties from taking effect. */ /* Note: You can read more about the use of mobileHA in Velocity's documentation: velocity-animate/#mobileHA. */ options.mobileHA = true; } if (optionsMap.drag === true) { options.drag = true; } if (isNumber(optionsMap.stagger) || isFunction(optionsMap.stagger)) { options.stagger = optionsMap.stagger; } if (!isReverse) { if (optionsMap["display"] != null) { propertiesMap.display = optionsMap["display"]; console.error("Deprecated \"options.display\" used, this is now a property:", optionsMap["display"]); } if (optionsMap["visibility"] != null) { propertiesMap.visibility = optionsMap["visibility"]; console.error("Deprecated \"options.visibility\" used, this is now a property:", optionsMap["visibility"]); } } // TODO: Allow functional options for different options per element var optionsBegin = validateBegin(optionsMap.begin), optionsComplete = validateComplete(optionsMap.complete), optionsProgress = validateProgress(optionsMap.progress), optionsSync = validateSync(optionsMap.sync); if (optionsBegin != null) { options.begin = optionsBegin; } if (optionsComplete != null) { options.complete = optionsComplete; } if (optionsProgress != null) { options.progress = optionsProgress; } if (optionsSync != null) { isSync = optionsSync; } } else if (!syntacticSugar) { // Expand any direct options if possible. var offset = 0; options.duration = validateDuration(arguments.length <= argumentIndex ? undefined : arguments[argumentIndex], true); if (options.duration === undefined) { options.duration = defaults$$1.duration; } else { hasValidDuration = true; offset++; } if (!isFunction(arguments.length <= argumentIndex + offset ? undefined : arguments[argumentIndex + offset])) { // Despite coming before Complete, we can't pass a fn easing var easing = validateEasing(arguments.length <= argumentIndex + offset ? undefined : arguments[argumentIndex + offset], getValue(options && validateDuration(options.duration), defaults$$1.duration), true); if (easing !== undefined) { offset++; options.easing = easing; } } var complete = validateComplete(arguments.length <= argumentIndex + offset ? undefined : arguments[argumentIndex + offset], true); if (complete !== undefined) { options.complete = complete; } options.delay = defaults$$1.delay; options.loop = defaults$$1.loop; options.repeat = options.repeatAgain = defaults$$1.repeat; } if (isReverse && options.queue === false) { throw new Error("VelocityJS: Cannot reverse a queue:false animation."); } if (!hasValidDuration && maybeSequence && maybeSequence.duration) { options.duration = maybeSequence.duration; } // When a set of elements is targeted by a Velocity call, the set is // broken up and each element has the current Velocity call individually // queued onto it. In this way, each element's existing queue is // respected; some elements may already be animating and accordingly // should not have this current Velocity call triggered immediately // unless the sync:true option is used. var rootAnimation = { options: options, elements: elements, _prev: undefined, _next: undefined, _flags: isSync ? 32 /* SYNC */ : 0, percentComplete: 0, ellapsedTime: 0, timeStart: 0 }; animations = []; for (var index = 0; index < elements.length; index++) { var element = elements[index]; var flags = 0; if (isNode(element)) { // TODO: This needs to check for valid animation targets, not just Elements if (isReverse) { var lastAnimation = Data(element).lastAnimationList[options.queue]; propertiesMap = lastAnimation && lastAnimation.tweens; if (!propertiesMap) { console.error("VelocityJS: Attempting to reverse an animation on an element with no previous animation:", element); continue; } flags |= 64 /* REVERSE */ & ~(lastAnimation._flags & 64 /* REVERSE */); // tslint:disable-line:no-bitwise } var animation = Object.assign({}, rootAnimation, { element: element, _flags: rootAnimation._flags | flags }); options._total++; animations.push(animation); if (options.stagger) { if (isFunction(options.stagger)) { var num = optionCallback(options.stagger, element, index, elements.length, elements, "stagger"); if (isNumber(num)) { animation.delay = options.delay + num; } } else { animation.delay = options.delay + options.stagger * index; } } if (options.drag) { animation.duration = options.duration - options.duration * Math.max(1 - (index + 1) / elements.length, 0.75); } if (maybeSequence) { expandSequence(animation, maybeSequence); } else if (isReverse) { // In this case we're using the previous animation, so // it will be expanded correctly when that one runs. animation.tweens = propertiesMap; } else { animation.tweens = Object.create(null); expandProperties(animation, propertiesMap); } queue$1(element, animation, options.queue); } } if (State.isTicking === false) { // If the animation tick isn't running, start it. (Velocity shuts it // off when there are no active calls to process.) tick(false); } if (animations) { defineProperty$1(elements.velocity, "animations", animations); } } /*************** Chaining ***************/ /* Return the elements back to the call chain, with wrapped elements taking precedence in case Velocity was called via the $.fn. extension. */ return elements || promise; } /** * Call an option callback in a try/catch block and report an error if needed. */ function optionCallback(fn, element, index, length, elements, option) { try { return fn.call(element, index, length, elements, option); } catch (e) { console.error("VelocityJS: Exception when calling '" + option + "' callback:", e); } } // Project /** * Used to patch any object to allow Velocity chaining. In order to chain an * object must either be treatable as an array - with a .length * property, and each member a Node, or a Node directly. * * By default Velocity will try to patch window, * jQuery, Zepto, and several classes that return * Nodes or lists of Nodes. */ function patch(proto, global) { try { defineProperty$1(proto, (global ? "V" : "v") + "elocity", Velocity$1); } catch (e) { console.warn("VelocityJS: Error when trying to add prototype.", e); } } // Project var Velocity$2 = Velocity$1; /** * These parts of Velocity absolutely must be included, even if they're unused! */ var VelocityStatic$1; (function (VelocityStatic) { /** * Actions cannot be replaced if they are internal (hasOwnProperty is false * but they still exist). Otherwise they can be replaced by users. * * All external method calls should be using actions rather than sub-calls * of Velocity itself. */ VelocityStatic.Actions = Actions; /** * Our known easing functions. */ VelocityStatic.Easings = Easings; /** * The currently registered sequences. */ VelocityStatic.Sequences = SequencesObject; /** * Current internal state of Velocity. */ VelocityStatic.State = State; // tslint:disable-line:no-shadowed-variable /** * Velocity option defaults, which can be overriden by the user. */ VelocityStatic.defaults = defaults$1; /** * Used to patch any object to allow Velocity chaining. In order to chain an * object must either be treatable as an array - with a .length * property, and each member a Node, or a Node directly. * * By default Velocity will try to patch window, * jQuery, Zepto, and several classes that return * Nodes or lists of Nodes. */ VelocityStatic.patch = patch; /** * Set to true, 1 or 2 (most verbose) to output debug info to console. */ VelocityStatic.debug = false; /** * In mock mode, all animations are forced to complete immediately upon the * next rAF tick. If there are further animations queued then they will each * take one single frame in turn. Loops and repeats will be disabled while * mock = true. */ VelocityStatic.mock = false; /** * Save our version number somewhere visible. */ VelocityStatic.version = VERSION; /** * Added as a fallback for "import {Velocity} from 'velocity-animate';". */ VelocityStatic.Velocity = Velocity$1; // tslint:disable-line:no-shadowed-variable })(VelocityStatic$1 || (VelocityStatic$1 = {})); /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ var IE$1 = function () { if (document.documentMode) { return document.documentMode; } else { for (var i = 7; i > 4; i--) { var div = document.createElement("div"); div.innerHTML = ""; if (div.getElementsByTagName("span").length) { div = null; return i; } } } return undefined; }(); /****************** Unsupported ******************/ if (IE$1 <= 8) { throw new Error("VelocityJS cannot run on Internet Explorer 8 or earlier"); } /****************** Frameworks ******************/ if (window) { /* * Both jQuery and Zepto allow their $.fn object to be extended to allow * wrapped elements to be subjected to plugin calls. If either framework is * loaded, register a "velocity" extension pointing to Velocity's core * animate() method. Velocity also registers itself onto a global container * (window.jQuery || window.Zepto || window) so that certain features are * accessible beyond just a per-element scope. Accordingly, Velocity can * both act on wrapped DOM elements and stand alone for targeting raw DOM * elements. */ var jQuery$1 = window.jQuery, Zepto$1 = window.Zepto; patch(window, true); patch(Element && Element.prototype); patch(NodeList && NodeList.prototype); patch(HTMLCollection && HTMLCollection.prototype); patch(jQuery$1, true); patch(jQuery$1 && jQuery$1.fn); patch(Zepto$1, true); patch(Zepto$1 && Zepto$1.fn); } // Make sure that the values within Velocity are read-only and upatchable. var _loop$1 = function _loop(property) { if (VelocityStatic$1.hasOwnProperty(property)) { switch (typeof property === "undefined" ? "undefined" : _typeof(property)) { case "number": case "boolean": defineProperty$1(Velocity$2, property, { get: function get$$1() { return VelocityStatic$1[property]; }, set: function set$$1(value) { VelocityStatic$1[property] = value; } }, true); break; default: defineProperty$1(Velocity$2, property, VelocityStatic$1[property], true); break; } } }; for (var property$1 in VelocityStatic$1) { _loop$1(property$1); } Object.freeze(Velocity$2); return Velocity$2; }))); //# sourceMappingURL=velocity.js.map ================================================ FILE: velocity.ui.js ================================================ /** * velocity-animate (C) 2014-2017 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('velocity-animate')) : typeof define === 'function' && define.amd ? define(['velocity-animate'], factory) : (factory(global.Velocity)); }(this, (function (Velocity) { 'use strict'; Velocity = Velocity && Velocity.hasOwnProperty('default') ? Velocity['default'] : Velocity; Velocity("registerSequence", "bounce", { "duration": 1000, "0,100%": { transformOrigin: "center bottom" }, "0%,20%,53%,80%,100%": { transform: ["translate3d(0,0px,0)", "easeOutCubic"] }, "40%,43%": { transform: ["translate3d(0,-30px,0)", "easeInQuint"] }, "70%": { transform: ["translate3d(0,-15px,0)", "easeInQuint"] }, "90%": { transform: "translate3d(0,-4px,0)" } }); Velocity("registerSequence", "flash", { "duration": 1000, "0%,50%,100%": { opacity: "1" }, "25%,75%": { opacity: "0" } }); Velocity("registerSequence", "headShake", { "duration": 1000, "easing": "easeInOut", "0%": { transform: "translateX(0) rotateY(0)" }, "6.5%": { transform: "translateX(-6px) rotateY(-9deg)" }, "18.5%": { transform: "translateX(5px) rotateY(7deg)" }, "31.5%": { transform: "translateX(-3px) rotateY(-5deg)" }, "43.5%": { transform: "translateX(2px) rotateY(3deg)" }, "50%": { transform: "translateX(0) rotateY(0)" } }); Velocity("registerSequence", "jello", { "duration": 1000, "0%,100%": { transformOrigin: "center" }, "0%,11.1%,100%": { transform: "skewX(0) skewY(0)" }, "22.2%": { transform: "skewX(-12.5deg) skewY(-12.5deg)" }, "33.3%": { transform: "skewX(6.25deg) skewY(6.25deg)" }, "44.4%": { transform: "skewX(-3.125deg) skewY(-3.125deg)" }, "55.5%": { transform: "skewX(1.5625deg) skewY(1.5625deg)" }, "66.6%": { transform: "skewX(-0.78125deg) skewY(-0.78125deg)" }, "77.7%": { transform: "skewX(0.390625deg) skewY(0.390625deg)" }, "88.8%": { transform: "skewX(-0.1953125deg) skewY(-0.1953125deg)" } }); Velocity("registerSequence", "pulse", { "duration": 1000, "0%": { transform: "scale3d(1,1,1)" }, "50%": { transform: "scale3d(1.05,1.05,1.05)" }, "100%": { transform: "scale3d(1,1,1)" } }); Velocity("registerSequence", "rubberBand", { "duration": 1000, "0%": { transform: "scale3d(1,1,1)" }, "30%": { transform: "scale3d(1.25,0.75,1)" }, "40%": { transform: "scale3d(0.75,1.25,1)" }, "50%": { transform: "scale3d(1.15,0.85,1)" }, "65%": { transform: "scale3d(0.95,1.05,1)" }, "75%": { transform: "scale3d(1.05,0.95,1)" }, "100%": { transform: "scale3d(1,1,1)" } }); Velocity("registerSequence", "shake", { "duration": 1000, "0%,100%": { transform: "translate3d(0,0,0)" }, "10%,30%,50%,70%,90%": { transform: "translate3d(-10px,0,0)" }, "20%,40%,60%,80%": { transform: "translate3d(10px,0,0)" } }); Velocity("registerSequence", "swing", { "duration": 1000, "0%,100%": { transform: "rotate3d(0,0,1,0deg)", transformOrigin: "center" }, "20%": { transform: "rotate3d(0,0,1,15deg)" }, "40%": { transform: "rotate3d(0,0,1,-10deg)" }, "60%": { transform: "rotate3d(0,0,1,5deg)" }, "80%": { transform: "rotate3d(0,0,1,-5deg)" } }); Velocity("registerSequence", "tada", { "duration": 1000, "0%": { transform: "scale3d(1,1,1) rotate3d(0,0,0,0)" }, "10%,20%": { transform: "scale3d(0.9,0.9,0.9) rotate3d(0,0,1,-3deg)" }, "30%,50%,70%,90%": { transform: "scale3d(1.1,1.1,1.1) rotate3d(0,0,1,3deg)" }, "40%,60%,80%": { transform: "scale3d(1.1,1.1,1.1) rotate3d(0,0,1,-3deg)" }, "100%": { transform: "scale3d(1, 1, 1) rotate3d(0,0,0,0)" } }); Velocity("registerSequence", "wobble", { "duration": 1000, "0%": { transform: "translate3d(0,0,0) rotate3d(0,0,0,0)" }, "15%": { transform: "translate3d(-25%,0,0) rotate3d(0,0,1,-5deg)" }, "30%": { transform: "translate3d(20%,0,0) rotate3d(0,0,1,3deg)" }, "45%": { transform: "translate3d(-15%,0,0) rotate3d(0,0,1,-3deg)" }, "60%": { transform: "translate3d(10%,0,0) rotate3d(0,0,1,2deg)" }, "75%": { transform: "translate3d(-5%,0,0) rotate3d(0,0,1,-1deg)" }, "100%": { transform: "translate3d(0,0,0) rotate3d(0,0,0,0)" } }); Velocity("registerSequence", "bounceIn", { "duration": 750, "easing": "easeOutCubic", "0%": { opacity: "0", transform: "scale3d(0.3,0.3,0.3)" }, "20%": { transform: "scale3d(1.1,1.1,1.1)" }, "40%": { transform: "scale3d(0.9,0.9,0.9)" }, "60%": { opacity: "1", transform: "scale3d(1.03,1.03,1.03)" }, "80%": { transform: "scale3d(0.97,0.97,0.97)" }, "100%": { opacity: "1", transform: "scale3d(1,1,1)" } }); Velocity("registerSequence", "bounceInDown", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(0,-3000px,0)" }, "60%": { opacity: "1", transform: ["translate3d(0,25px,0)", "easeOutCubic"] }, "75%": { transform: ["translate3d(0,-10px,0)", "easeOutCubic"] }, "90%": { transform: ["translate3d(0,5px,0)", "easeOutCubic"] }, "100%": { transform: ["translate3d(0,0,0)", "easeOutCubic"] } }); Velocity("registerSequence", "bounceInLeft", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(-3000px,0,0)" }, "60%": { opacity: "1", transform: ["translate3d(25px,0,0)", "easeOutCubic"] }, "75%": { transform: ["translate3d(-10px,0,0)", "easeOutCubic"] }, "90%": { transform: ["translate3d(5px,0,0)", "easeOutCubic"] }, "100%": { transform: ["translate3d(0,0,0)", "easeOutCubic"] } }); Velocity("registerSequence", "bounceInRight", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(3000px,0,0)" }, "60%": { opacity: "1", transform: ["translate3d(-25px,0,0)", "easeOutCubic"] }, "75%": { transform: ["translate3d(10px,0,0)", "easeOutCubic"] }, "90%": { transform: ["translate3d(-5px,0,0)", "easeOutCubic"] }, "100%": { transform: ["translate3d(0,0,0)", "easeOutCubic"] } }); Velocity("registerSequence", "bounceInUp", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(0,3000px,0)" }, "60%": { opacity: "1", transform: ["translate3d(0,-25px,0)", "easeOutCubic"] }, "75%": { transform: ["translate3d(0,10px,0)", "easeOutCubic"] }, "90%": { transform: ["translate3d(0,-5px,0)", "easeOutCubic"] }, "100%": { transform: ["translate3d(0,0,0)", "easeOutCubic"] } }); Velocity("registerSequence", "bounceOut", { "duration": 750, "0%": { opacity: "1", transform: "scale3d(1,1,1)" }, "20%": { transform: "scale3d(0.9,0.9,0.9)" }, "50%,55%": { opacity: "1", transform: "scale3d(1.1,1.1,1.1)" }, "to": { opacity: "0", transform: "scale3d(0.3,0.3,0.3)" } }); Velocity("registerSequence", "bounceOutDown", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "20%": { transform: "translate3d(0,10px,0)" }, "40%,45%": { opacity: "1", transform: "translate3d(0,-20px,0)" }, "100%": { opacity: "0", transform: "translate3d(0,2000px,0)" } }); Velocity("registerSequence", "bounceOutLeft", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "20%": { opacity: "1", transform: "translate3d(20px,0,0)" }, "100%": { opacity: "0", transform: "translate3d(-2000px,0,0)" } }); Velocity("registerSequence", "bounceOutRight", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "20%": { opacity: "1", transform: "translate3d(-20px,0,0)" }, "100%": { opacity: "0", transform: "translate3d(2000px,0,0)" } }); Velocity("registerSequence", "bounceOutUp", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "20%": { transform: "translate3d(0,-10px,0)" }, "40%,45%": { opacity: "1", transform: "translate3d(0,20px,0)" }, "100%": { opacity: "0", transform: "translate3d(0,-2000px,0)" } }); Velocity("registerSequence", "fadeIn", { "duration": 1000, "0%": { opacity: "0" }, "100%": { opacity: "1" } }); Velocity("registerSequence", "fadeInDown", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(0,-100%,0)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)" } }); Velocity("registerSequence", "fadeInDownBig", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(0,-2000px,0)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)" } }); Velocity("registerSequence", "fadeInLeft", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(-100%,0,0)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)" } }); Velocity("registerSequence", "fadeInLeftBig", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(-2000px,0,0)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)" } }); Velocity("registerSequence", "fadeInRight", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(100%,0,0)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)" } }); Velocity("registerSequence", "fadeInRightBig", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(2000px,0,0)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)" } }); Velocity("registerSequence", "fadeInUp", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(0,100%,0)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)" } }); Velocity("registerSequence", "fadeInUpBig", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(0,2000px,0)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)" } }); Velocity("registerSequence", "fadeOut", { "duration": 1000, "0%": { opacity: "1" }, "100%": { opacity: "0" } }); Velocity("registerSequence", "fadeOutDown", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "100%": { opacity: "0", transform: "translate3d(0,100%,0)" } }); Velocity("registerSequence", "fadeOutDownBig", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "100%": { opacity: "0", transform: "translate3d(0,2000px,0)" } }); Velocity("registerSequence", "fadeOutLeft", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "100%": { opacity: "0", transform: "translate3d(-100%,0,0)" } }); Velocity("registerSequence", "fadeOutLeftBig", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "100%": { opacity: "0", transform: "translate3d(-2000px,0,0)" } }); Velocity("registerSequence", "fadeOutRight", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "100%": { opacity: "0", transform: "translate3d(100%,0,0)" } }); Velocity("registerSequence", "fadeOutRightBig", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "100%": { opacity: "0", transform: "translate3d(2000px,0,0)" } }); Velocity("registerSequence", "fadeOutUp", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "100%": { opacity: "0", transform: "translate3d(0,-100%,0)" } }); Velocity("registerSequence", "fadeOutUpBig", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)" }, "100%": { opacity: "0", transform: "translate3d(0,-2000px,0)" } }); Velocity("registerSequence", "flip", { "duration": 1000, "0%,100%": { backfaceVisibility: "visible" }, "0%": { transform: ["perspective(400px) translate3d(0,0,0) rotate3d(0,1,0,-360deg) scale3d(1,1,1)", "easeOut"] }, "40%": { transform: ["perspective(400px) translate3d(0,0,150px) rotate3d(0,1,0,-190deg) scale3d(1,1,1)", "easeOut"] }, "50%": { transform: ["perspective(400px) translate3d(0,0,150px) rotate3d(0,1,0,-170deg) scale3d(1,1,1)", "easeIn"] }, "80%": { transform: ["perspective(400px) translate3d(0,0,0) rotate3d(0,1,0,0) scale3d(0.95,0.95,0.95)", "easeIn"] }, "100%": { transform: ["perspective(400px) translate3d(0,0,0) rotate3d(0,0,0,0) scale3d(1,1,1)", "ease-in"] } }); Velocity("registerSequence", "flipInX", { "duration": 1000, "0%,100%": { backfaceVisibility: "visible" }, "0%": { opacity: "0", transform: "perspective(400px) rotate3d(1,0,0,90deg)" }, "40%": { transform: ["perspective(400px) rotate3d(1,0,0,-20deg)", "easeIn"] }, "60%": { opacity: "1", transform: "perspective(400px) rotate3d(1,0,0,10deg)" }, "80%": { transform: "perspective(400px) rotate3d(1,0,0,-5deg)" }, "100%": { transform: "perspective(400px) rotate3d(1,0,0,0)" } }); Velocity("registerSequence", "flipInY", { "duration": 1000, "0%,100%": { backfaceVisibility: "visible" }, "0%": { opacity: "0", transform: "perspective(400px) rotate3d(0,1,0,90deg)" }, "40%": { transform: ["perspective(400px) rotate3d(0,1,0,-20deg)", "easeIn"] }, "60%": { opacity: "1", transform: "perspective(400px) rotate3d(0,1,0,10deg)" }, "80%": { transform: "perspective(400px) rotate3d(0,1,0,-5deg)" }, "100%": { transform: "perspective(400px) rotate3d(0,1,0,0)" } }); Velocity("registerSequence", "flipOutX", { "duration": 750, "0%,100%": { backfaceVisibility: "visible" }, "0%": { transform: "perspective(400px) rotate3d(1,0,0,0)" }, "30%": { opacity: "1", transform: "perspective(400px) rotate3d(1,0,0,-20deg)" }, "100%": { opacity: "0", transform: "perspective(400px) rotate3d(1,0,0,90deg)" } }); Velocity("registerSequence", "flipOutY", { "duration": 750, "0%,100%": { backfaceVisibility: "visible" }, "0%": { transform: "perspective(400px) rotate3d(0,1,0,0)" }, "30%": { opacity: "1", transform: "perspective(400px) rotate3d(0,1,0,-20deg)" }, "100%": { opacity: "0", transform: "perspective(400px) rotate3d(0,1,0,90deg)" } }); Velocity("registerSequence", "lightSpeedIn", { "duration": 1000, "easing": "easeOut", "0%": { opacity: "0", transform: "translate3d(100%,0,0) skewX(-30deg)" }, "60%": { opacity: "1", transform: "translate3d(40%,0,0) skewX(20deg)" }, "80%": { opacity: "1", transform: "translate3d(20%,0,0) skewX(-5deg)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0) skew(0)" } }); Velocity("registerSequence", "lightSpeedOut", { "duration": 1000, "easing": "easeIn", "0%": { opacity: "1", transform: "translate3d(0,0,0) skewX(0)" }, "100%": { opacity: "0", transform: "translate3d(100%,0,0) skewX(30deg)" } }); Velocity("registerSequence", "rotateIn", { "duration": 1000, "0%": { opacity: "0", transform: "rotate3d(0,0,1,-200deg)", transformOrigin: "center" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "center" } }); Velocity("registerSequence", "rotateInDownLeft", { "duration": 1000, "0%": { opacity: "0", transform: "rotate3d(0,0,1,-45deg)", transformOrigin: "left bottom" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "left bottom" } }); Velocity("registerSequence", "rotateInDownRight", { "duration": 1000, "0%": { opacity: "0", transform: "rotate3d(0,0,1,45deg)", transformOrigin: "right bottom" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "right bottom" } }); Velocity("registerSequence", "rotateInUpLeft", { "duration": 1000, "0%": { opacity: "0", transform: "rotate3d(0,0,1,45deg)", transformOrigin: "left bottom" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "left bottom" } }); Velocity("registerSequence", "rotateInUpRight", { "duration": 1000, "0%": { opacity: "0", transform: "rotate3d(0,0,1,-90deg)", transformOrigin: "right bottom" }, "100%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "right bottom" } }); Velocity("registerSequence", "rotateOut", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "center" }, "100%": { opacity: "0", transform: "rotate3d(0,0,1,200deg)", transformOrigin: "center" } }); Velocity("registerSequence", "rotateOutDownLeft", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "left bottom" }, "100%": { opacity: "0", transform: "rotate3d(0,0,1,45deg)", transformOrigin: "left bottom" } }); Velocity("registerSequence", "rotateOutDownRight", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "right bottom" }, "100%": { opacity: "0", transform: "rotate3d(0,0,1,-45deg)", transformOrigin: "right bottom" } }); Velocity("registerSequence", "rotateOutUpLeft", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "left bottom" }, "100%": { opacity: "0", transform: "rotate3d(0,0,1,-45deg)", transformOrigin: "left bottom" } }); Velocity("registerSequence", "rotateOutUpRight", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0)", transformOrigin: "right bottom" }, "100%": { opacity: "0", transform: "rotate3d(0,0,1,90deg)", transformOrigin: "right bottom" } }); Velocity("registerSequence", "slideInDown", { "duration": 1000, "0%": { transform: "translate3d(0,-100%,0)", visibility: "hidden", opacity: "0" }, "100%": { transform: "translate3d(0,0,0)", visibility: "visible", opacity: "1" } }); Velocity("registerSequence", "slideInLeft", { "duration": 1000, "0%": { transform: "translate3d(-100%,0,0)", visibility: "hidden", opacity: "0" }, "100%": { transform: "translate3d(0,0,0)", visibility: "visible", opacity: "1" } }); Velocity("registerSequence", "slideInRight", { "duration": 1000, "0%": { transform: "translate3d(100%,0,0)", visibility: "hidden", opacity: "0" }, "100%": { transform: "translate3d(0,0,0)", visibility: "visible", opacity: "1" } }); Velocity("registerSequence", "slideInUp", { "duration": 1000, "0%": { transform: "translate3d(0,100%,0)", visibility: "hidden", opacity: "0" }, "100%": { transform: "translate3d(0,0,0)", visibility: "visible", opacity: "1" } }); Velocity("registerSequence", "slideOutDown", { "duration": 1000, "0%": { transform: "translate3d(0,0,0)", visibility: "visible", opacity: "1" }, "100%": { transform: "translate3d(0,-100%,0)", visibility: "hidden", opacity: "0" } }); Velocity("registerSequence", "slideOutLeft", { "duration": 1000, "0%": { transform: "translate3d(0,0,0)", visibility: "visible", opacity: "1" }, "100%": { transform: "translate3d(-100%,0,0)", visibility: "hidden", opacity: "0" } }); Velocity("registerSequence", "slideOutRight", { "duration": 1000, "0%": { transform: "translate3d(0,0,0)", visibility: "visible", opacity: "1" }, "100%": { transform: "translate3d(100%,0,0)", visibility: "hidden", opacity: "0" } }); Velocity("registerSequence", "slideOutUp", { "duration": 1000, "0%": { transform: "translate3d(0,0,0)", visibility: "visible", opacity: "1" }, "100%": { transform: "translate3d(0,100%,0)", visibility: "hidden", opacity: "0" } }); Velocity("registerSequence", "hinge", { "duration": 2000, "0%": { opacity: "1", transform: "translate3d(0,0,0) rotate3d(0,0,1,0)", transformOrigin: "top left" }, "20%,60%": { transform: ["translate3d(0,0,0) rotate3d(0,0,1,80deg)", "easeInOut"] }, "40%,80%": { opacity: "1", transform: ["translate3d(0,0,0) rotate3d(0,0,1,60deg)", "easeInOut"] }, "100%": { opacity: "0", transform: ["translate3d(0,700px,0) rotate3d(0,0,1,80deg)", "easeInOut"] } }); Velocity("registerSequence", "jackInTheBox", { "duration": 1000, "0%": { opacity: "0", transform: "scale(0.1) rotate(30deg)", transformOrigin: "center bottom" }, "50%": { transform: "scale(0.5) rotate(-10deg)" }, "70%": { transform: "scale(0.7) rotate(3deg)" }, "100%": { opacity: "1", transform: "scale(1) rotate(0)" } }); Velocity("registerSequence", "rollIn", { "duration": 1000, "0%": { opacity: "0", transform: "translate3d(-100%,0,0) rotate3d(0,0,1,-120deg)" }, "100%": { opacity: "1", transform: "translate3d(0,0,0) rotate3d(0,0,1,0)" } }); Velocity("registerSequence", "rollOut", { "duration": 1000, "0%": { opacity: "1", transform: "translate3d(0,0,0) rotate3d(0,0,1,0)" }, "100%": { opacity: "0", transform: "translate3d(100%,0,0) rotate3d(0,0,1,120deg)" } }); Velocity("registerSequence", "zoomIn", { "duration": 1000, "0%": { opacity: "0", transform: "scale3d(0.3,0.3,0.3)" }, "50%": { opacity: "1" }, "100%": { transform: "scale3d(1,1,1)" } }); Velocity("registerSequence", "zoomInDown", { "duration": 1000, "0%": { opacity: "0", transform: "scale3d(0.1,0.1,0.1) translate3d(0,-1000px,0)" }, "60%": { opacity: "1", transform: ["scale3d(0.475,0.475,0.475) translate3d(0,60px,0)", "easeInCubic"] }, "100%": { transform: ["scale3d(1,1,1) translate3d(0,0,0)", [0.175, 0.885, 0.32, 1]] } }); Velocity("registerSequence", "zoomInLeft", { "duration": 1000, "0%": { opacity: "0", transform: "scale3d(0.1,0.1,0.1) translate3d(-1000px,0,0)" }, "60%": { opacity: "1", transform: ["scale3d(0.475,0.475,0.475) translate3d(10px,0,0)", "easeInCubic"] }, "100%": { transform: ["scale3d(1,1,1) translate3d(0,0,0)", [0.175, 0.885, 0.32, 1]] } }); Velocity("registerSequence", "zoomInRight", { "duration": 1000, "0%": { opacity: "0", transform: "scale3d(0.1,0.1,0.1) translate3d(1000px,0,0)" }, "60%": { opacity: "1", transform: ["scale3d(0.475,0.475,0.475) translate3d(-10px,0,0)", "easeInCubic"] }, "100%": { transform: ["scale3d(1,1,1) translate3d(0,0,0)", [0.175, 0.885, 0.32, 1]] } }); Velocity("registerSequence", "zoomInUp", { "duration": 1000, "0%": { opacity: "0", transform: "scale3d(0.1,0.1,0.1) translate3d(0,1000px,0)" }, "60%": { opacity: "1", transform: ["scale3d(0.475,0.475,0.475) translate3d(0,-60px,0)", "easeInCubic"] }, "100%": { transform: ["scale3d(1,1,1) translate3d(0,0,0)", [0.175, 0.885, 0.32, 1]] } }); Velocity("registerSequence", "zoomOut", { "duration": 1000, "0%": { transform: "scale3d(1,1,1)" }, "50%": { opacity: "1" }, "100%": { opacity: "0", transform: "scale3d(0.3,0.3,0.3)" } }); Velocity("registerSequence", "zoomOutDown", { "duration": 1000, "0%": { transform: "scale3d(1,1,1) translate3d(0,0,0)" }, "40%": { opacity: "1", transform: ["scale3d(0.475,0.475,0.475) translate3d(0,60px,0)", [0.55, 0.055, 0.675, 0.19]] }, "100%": { opacity: "0", transform: ["scale3d(0.1,0.1,0.1) translate3d(0,-1000px,0)", [0.175, 0.885, 0.32, 1]] } }); Velocity("registerSequence", "zoomOutLeft", { "duration": 1000, "0%": { opacity: "1", transform: "scale(1) translate3d(0,0,0)", transformOrigin: "left center" }, "40%": { opacity: "1", transform: "scale(0.475) translate3d(42px,0,0)" }, "100%": { opacity: "0", transform: "scale(0.1) translate3d(-2000px,0,0)", transformOrigin: "left center" } }); Velocity("registerSequence", "zoomOutRight", { "duration": 1000, "0%": { opacity: "1", transform: "scale(1) translate3d(0,0,0)", transformOrigin: "right center" }, "40%": { opacity: "1", transform: "scale(0.475) translate3d(-42px, 0, 0)" }, "100%": { opacity: "0", transform: "scale(0.1) translate3d(2000px, 0, 0)", transformOrigin: "right center" } }); Velocity("registerSequence", "zoomOutUp", { "duration": 1000, "0%": { transform: "scale3d(1,1,1) translate3d(0,0,0)" }, "40%": { opacity: "1", transform: ["scale3d(0.475,0.475,0.475) translate3d(0,-60px,0)", [0.55, 0.055, 0.675, 0.19]] }, "100%": { opacity: "0", transform: ["scale3d(0.1,0.1,0.1) translate3d(0,1000px,0)", [0.175, 0.885, 0.32, 1]] } }); }))); //# sourceMappingURL=velocity.ui.js.map ================================================ FILE: version.ts ================================================ /* * velocity-animate (C) 2014-2017 Julian Shapiro. * * Licensed under the MIT license. See LICENSE file in the project root for details. */ // Automatically generated export const VERSION = "2.0.6";