diff --git a/.gitignore b/.gitignore index c86ccd4..c4619c9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .DS_Store .project .settings +tags lib/tests/pid.txt comicbook diff --git a/.travis.yml b/.travis.yml index d747cad..e619f6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: node_js node_js: - - "0.10" -before_script: - - make + - "0.12" +sudo: false diff --git a/Makefile b/Makefile deleted file mode 100755 index 0e8fb9a..0000000 --- a/Makefile +++ /dev/null @@ -1,52 +0,0 @@ - -# -# build package & update examples -# - -build: - @echo "Running jshint..." - @./node_modules/.bin/jshint lib/ComicBook.js --config lib/.jshintrc - @echo "Compiling Handlebars templates..." - @./node_modules/.bin/handlebars templates/*.handlebars -f lib/templates.js - @echo "Compiling and minifying javascript..." - @mkdir -p comicbook/js/pixastic - @cat lib/vendor/pixastic/pixastic.js lib/vendor/pixastic/pixastic.effects.js lib/vendor/pixastic/pixastic.worker.js lib/vendor/handlebars.runtime-1.0.rc.1.min.js lib/templates.js lib/ComicBook.js > comicbook/js/comicbook.js - @cp lib/vendor/pixastic/pixastic.js comicbook/js/pixastic - @cp lib/vendor/pixastic/pixastic.effects.js comicbook/js/pixastic - @cp lib/vendor/pixastic/pixastic.worker.js comicbook/js/pixastic - @cp lib/vendor/pixastic/pixastic.worker.control.js comicbook/js/pixastic - @cp lib/vendor/pixastic/license-gpl-3.0.txt comicbook/js/pixastic - @cp lib/vendor/pixastic/license-mpl.txt comicbook/js/pixastic - @./node_modules/.bin/uglifyjs -nc comicbook/js/comicbook.js > comicbook/js/comicbook.min.js - @echo "Compiling CSS..." - @cat fonts/icomoon-toolbar/style.css css/reset.css css/styles.css css/toolbar.css > comicbook/comicbook.css - @echo "Copying assets..." - @cp -r css/img comicbook/img - @cp -r icons/1_Desktop_Icons/icon_128.png comicbook/img - @cp -r icons/1_Desktop_Icons/icon_196.png comicbook/img - @cp -r fonts/icomoon-toolbar/fonts comicbook - @cp -r fonts/icomoon-toolbar/license.txt comicbook/fonts - @echo "Updating examples" - @cp -r comicbook examples - @echo "Done" - -# -# run jshint & quint tests -# - -test: - @./node_modules/.bin/jshint lib/ComicBook.js --config lib/.jshintrc - @./node_modules/.bin/jshint lib/tests/unit/*.js --config lib/.jshintrc - @node lib/tests/server.js & - @./node_modules/.bin/phantomjs lib/tests/phantom.js "http://localhost:3000/lib/tests" - @kill -9 `cat lib/tests/pid.txt` - @rm lib/tests/pid.txt - -# -# remove prior builds -# - -clean: - @rm -r comicbook - @rm -r examples/comicbook - @rm lib/templates.js diff --git a/README.md b/README.md index b1683e6..0ba9c66 100755 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Comic Book Reader ================= [![Build Status](https://api.travis-ci.org/balaclark/HTML5-Comic-Book-Reader.png)](https://travis-ci.org/balaclark/HTML5-Comic-Book-Reader) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) A canvas based web application for reading comics. You can also see an implementation of this as an offline Chrome packaged application CBZ / CBR comic book reader at: @@ -17,14 +18,40 @@ Development Install Builds require nodejs and npm. Installs have been tested with nodejs 0.10.0, older versions may or may not work. - npm install - make - make test +```sh +npm install +npm run build +npm test +``` + +In order to run the test suite you will need phantomjs installed, if you don't +have it already installed globally: + +```sh +npm install phantomjs@1.9 +npm test +``` + +Contribute +---------- + +Contributions are welcome, use the standard code style and [ES6](https://github.com/lukehoban/es6features#readme). Code is split into modules using browserify. + +[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) + +This project aims to have an absolute minimum of external dependencies (dev dependencies are more acceptable). + +To auto build js and auto run tests use the following commands in seperate terminals. + +```sh +npm run buildjs-watch +npm run test-watch +``` Copyright and License --------------------- -Copyright 2010 Bala Clark +Copyright 2010-2015 Bala Clark Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the diff --git a/TODO b/TODO deleted file mode 100644 index 378b9f2..0000000 --- a/TODO +++ /dev/null @@ -1,21 +0,0 @@ -Fo sho: - - remember reading position / applied effects (per comic) - - offline mode via cache manifest - - firefox marketplace - - create onclose callback, show close button only if set - - trigger preload if requesting valid but not loaded images (can happen if network was interupted) - - loading and generally hackiness of pointer is buggy, fix. - - check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com - -Nice 2 have: - - remove image inhancement lag when navigating by pre-applying enhancements to other pages - - jump to page? - - make page draggable with the cursor - - enable menu items via config, allow for custom items - - split out classes into seperate files - - thumbnail browser - - refactor so we are not using all these loose shared variables and other nastyness - - use custom event emitters instead of hacky code - - properly bind 'this' so we don't have to keep using 'self' - - allow toolbar to be hidden on mobile (maybe show a small translucent button that opens the toolbar when clicked) - - enhancement progress bar diff --git a/app/comic-book.js b/app/comic-book.js new file mode 100644 index 0000000..0574e56 --- /dev/null +++ b/app/comic-book.js @@ -0,0 +1,154 @@ +let EventEmitter = require('events').EventEmitter +let Canvas = require('./view/canvas') +let LoadIndicator = require('./view/load-indicator') +let ProgressBar = require('./view/progress-bar') + +class ComicBook extends EventEmitter { + + constructor (srcs = [], options) { + super() + + this.options = Object.assign({ + // manga mode + rtl: false, + doublePage: false + }, options) + + // requested image srcs + this.srcs = srcs + + // loaded image objects + this.pages = new Map() + + this.preloadBuffer = 4 + + // TODO move this logic into the router + this.currentPageIndex = 0 + + this.canvas = new Canvas() + this.loadIndicator = new LoadIndicator() + this.progressBar = new ProgressBar() + + this.addEventListeners() + } + + addEventListeners () { + this.on('preload:start', this.loadIndicator.show.bind(this.loadIndicator)) + this.on('preload:start', this.progressBar.show.bind(this.progressBar)) + this.on('preload:image', this.updateProgressBar.bind(this)) + this.on('preload:ready', this.loadIndicator.hide.bind(this.loadIndicator)) + this.on('preload:ready', this.drawPage.bind(this)) + this.on('preload:finish', this.progressBar.hide.bind(this.progressBar)) + } + + render () { + this.pageRendered = false + this.el = document.createElement('div') + this.el.appendChild(this.canvas.canvas) + this.el.appendChild(this.progressBar.el) + this.el.appendChild(this.loadIndicator.el) + this.drawPage() + return this + } + + // TODO use a queue, only allow x concurrent downloads at a time + // TODO preload in both directions + // TODO fire ready on forward direction only + preload (startIndex) { + this.emit('preload:start') + + if (startIndex == null || startIndex >= this.srcs.length) { + startIndex = this.currentPageIndex + } + + // reorder srcs to start from the requested index + let _srcs = this.srcs.slice() + let srcs = _srcs.splice(startIndex).concat(_srcs) + + this.currentPageIndex = startIndex + + srcs.forEach((src, pageIndex) => { + + // allow preload to be run multiple times without duplicating requests + if (this.pages.has(pageIndex)) return + + let image = new window.Image() + + image.src = src + image.onload = setImage.bind(this, image, pageIndex) + + function setImage (image, index) { + this.pages.set(index, image) + this.emit('preload:image', image) + + if (this.pages.size >= this.preloadBuffer && !this.pageRendered) { + this.emit('preload:ready') + } + + if (this.pages.size === this.srcs.length) { + this.emit('preload:finish') + } + } + }) + } + + updateProgressBar () { + let percentage = Math.floor((this.pages.size / this.srcs.length) * 100) + this.progressBar.update(percentage) + } + + drawPage (pageIndex) { + if (typeof pageIndex !== 'number') pageIndex = this.currentPageIndex + + let page = this.pages.get(pageIndex) + + // if the requested image hasn't been loaded yet, force another preload run + if (!page) return this.preload(pageIndex) + + let args = [ page ] + + if (this.options.doublePage) { + let page2Index = pageIndex + 1 + let page2 = this.pages.get(page2Index) + + if (page2Index <= (this.pages.size - 1) && !page2) { + return this.preload(page2Index) + } + + args.push(page2) + + if (this.options.rtl) { + args.reverse() + } + } + + args.push(this.options) + + try { + this.canvas.drawImage.apply(this.canvas, args) + this.currentPageIndex = pageIndex + this.pageRendered = true + } catch (e) { + if (e.message !== 'Invalid image') throw e + } + } + + drawNextPage () { + let increment = this.options.doublePage ? 2 : 1 + let index = this.currentPageIndex + increment + if (index >= this.pages.size) { + index = this.pages.size - 1 + } + this.drawPage(index) + } + + drawPreviousPage () { + let increment = this.options.doublePage ? 2 : 1 + let index = this.currentPageIndex - increment + if (index < 0) index = 0 + this.drawPage(index) + } +} + +module.exports = ComicBook + diff --git a/css/img/loading.gif b/app/css/img/loading.gif similarity index 100% rename from css/img/loading.gif rename to app/css/img/loading.gif diff --git a/css/reset.css b/app/css/reset.css similarity index 100% rename from css/reset.css rename to app/css/reset.css diff --git a/css/styles.css b/app/css/styles.css similarity index 94% rename from css/styles.css rename to app/css/styles.css index 864767f..c564cd1 100755 --- a/css/styles.css +++ b/app/css/styles.css @@ -49,6 +49,11 @@ body:not(.mobile) .navigate:hover { opacity: 0.8; background: #000 url("img/loading.gif") no-repeat center; box-shadow: none; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; } #cb-status { diff --git a/css/toolbar.css b/app/css/toolbar.css similarity index 100% rename from css/toolbar.css rename to app/css/toolbar.css diff --git a/app/index.js b/app/index.js new file mode 100644 index 0000000..d704c42 --- /dev/null +++ b/app/index.js @@ -0,0 +1,25 @@ +let ComicBook = window.ComicBook = require('./comic-book') +let debounce = require('lodash.debounce') +let srcs = [ + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_00.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_01.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_02.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_03.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_04.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_05.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_06.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_07.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_08.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_09.jpg', + 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_10.jpg' +] +let comic = window.comic = new ComicBook(srcs, { doublePage: true }) + +comic.render().drawPage(5) + +window.addEventListener('resize', debounce(comic.drawPage.bind(comic), 100)) + +document.addEventListener('DOMContentLoaded', () => { + document.body.appendChild(comic.el) +}, false) + diff --git a/app/lib/make-image.js b/app/lib/make-image.js new file mode 100644 index 0000000..842fbd1 --- /dev/null +++ b/app/lib/make-image.js @@ -0,0 +1,9 @@ + +module.exports = function makeImage (src, cb) { + let image = new window.Image() + image.onload = () => { + cb(image) + } + image.src = src +} + diff --git a/app/view/canvas.js b/app/view/canvas.js new file mode 100644 index 0000000..10b3564 --- /dev/null +++ b/app/view/canvas.js @@ -0,0 +1,137 @@ +let EventEmitter = require('events').EventEmitter + +// TODO replace +function windowWidth () { + return window.innerWidth +} + +class Canvas extends EventEmitter { + + constructor (options) { + super() + this.canvas = document.createElement('canvas') + this.context = this.canvas.getContext('2d') + } + + drawImage (page, page2, opts = {}) { + this.emit('draw:start') + + if (page2 === null || !(page2 instanceof window.Image)) { + opts = page2 || opts + } + + let options = Object.assign({ + doublePage: false, + zoomMode: 'fitWidth' + }, opts) + + if (!(page instanceof window.Image) || (options.doublePage && page2 === null)) { + throw new Error('Invalid image') + } + + let zoomScale + let offsetW = 0 + let offsetH = 0 + let width = page.width + let height = page.height + let doublePageMode = options.doublePage + let canvasWidth + let canvasHeight + let pageWidth + let pageHeight + + // reset the canvas to stop duplicate pages showing + this.canvas.width = 0 + this.canvas.height = 0 + + // show double page spreads on a single page + let isDoublePageSpread = ( + page2 && + (page.width > page.height || page2.width > page2.height) && + doublePageMode + ) + + if (isDoublePageSpread) doublePageMode = false + + if (doublePageMode) { + + // for double page spreads, factor in the width of both pages + if (page2 instanceof window.Image) { + width += page2.width + // if this is the last page and there is no page2, still keep the canvas wide + } else { + width += width + } + } + + // update the page this.scale if a non manual mode has been chosen + switch (options.zoomMode) { + + case 'manual': + document.body.style.overflowX = 'auto' + zoomScale = (doublePageMode) ? this.scale * 2 : this.scale + break + + case 'fitWidth': + document.body.style.overflowX = 'hidden' + + // this.scale up if the window is wider than the page, scale down if the window + // is narrower than the page + zoomScale = (windowWidth() > width) ? ((windowWidth() - width) / windowWidth()) + 1 : windowWidth() / width + this.scale = zoomScale + break + + case 'fitWindow': + document.body.style.overflowX = 'hidden' + + let widthScale = (windowWidth() > width) + ? ((windowWidth() - width) / windowWidth()) + 1 // scale up if the window is wider than the page + : windowWidth() / width // scale down if the window is narrower than the page + let windowHeight = window.innerHeight + let heightScale = (windowHeight > height) + ? ((windowHeight - height) / windowHeight) + 1 // scale up if the window is wider than the page + : windowHeight / height // scale down if the window is narrower than the page + + zoomScale = (widthScale > heightScale) ? heightScale : widthScale + this.scale = zoomScale + break + } + + canvasWidth = page.width * zoomScale + canvasHeight = page.height * zoomScale + + pageWidth = (options.zoomMode === 'manual') ? page.width * this.scale : canvasWidth + pageHeight = (options.zoomMode === 'manual') ? page.height * this.scale : canvasHeight + + canvasHeight = pageHeight + + // make sure the canvas is always at least full screen, even if the page is narrower than the screen + this.canvas.width = (canvasWidth < windowWidth()) ? windowWidth() : canvasWidth + this.canvas.height = (canvasHeight < window.innerHeight) ? window.innerHeight : canvasHeight + + // always keep pages centered + if (options.zoomMode === 'manual' || options.zoomMode === 'fitWindow') { + + // work out a horizontal position + if (canvasWidth < windowWidth()) { + offsetW = (windowWidth() - pageWidth) / 2 + if (options.doublePage) { offsetW = offsetW - pageWidth / 2 } + } + + // work out a vertical position + if (canvasHeight < window.innerHeight) { + offsetH = (window.innerHeight - pageHeight) / 2 + } + } + + // draw the page(s) + this.context.drawImage(page, offsetW, offsetH, pageWidth, pageHeight) + if (options.doublePage && typeof page2 === 'object') { + this.context.drawImage(page2, pageWidth + offsetW, offsetH, pageWidth, pageHeight) + } + + this.emit('draw:finish') + } +} + +module.exports = Canvas diff --git a/app/view/load-indicator.js b/app/view/load-indicator.js new file mode 100644 index 0000000..2a5bcd7 --- /dev/null +++ b/app/view/load-indicator.js @@ -0,0 +1,27 @@ +let EventEmitter = require('events').EventEmitter + +class LoadIndicator extends EventEmitter { + constructor () { + super() + this.render().hide() + } + + render () { + this.el = document.createElement('div') + this.el.id = 'cb-loading-overlay' + return this + } + + show () { + this.el.style.display = 'block' + this.emit('show', this) + } + + hide () { + this.el.style.display = 'none' + this.emit('hide', this) + } +} + +module.exports = LoadIndicator + diff --git a/app/view/progress-bar.js b/app/view/progress-bar.js new file mode 100644 index 0000000..1a78ae3 --- /dev/null +++ b/app/view/progress-bar.js @@ -0,0 +1,29 @@ +let template = require('./template/progress-bar.handlebars') + +class ProgressBar { + constructor () { + this.createElements() + this.hide() + } + + createElements () { + let el = document.createElement('div') + el.innerHTML = template() + this.el = el.firstChild + this.progressEl = this.el.querySelector('.progressbar-value') + } + + update (percentage) { + this.progressEl.style.width = `${percentage}%` + } + + show () { + this.el.style.display = 'block' + } + + hide () { + this.el.style.display = 'none' + } +} + +module.exports = ProgressBar diff --git a/templates/navigateLeft.handlebars b/app/view/template/navigateLeft.handlebars similarity index 100% rename from templates/navigateLeft.handlebars rename to app/view/template/navigateLeft.handlebars diff --git a/templates/navigateRight.handlebars b/app/view/template/navigateRight.handlebars similarity index 100% rename from templates/navigateRight.handlebars rename to app/view/template/navigateRight.handlebars diff --git a/templates/progressbar.handlebars b/app/view/template/progress-bar.handlebars similarity index 100% rename from templates/progressbar.handlebars rename to app/view/template/progress-bar.handlebars diff --git a/templates/toolbar.handlebars b/app/view/template/toolbar.handlebars similarity index 100% rename from templates/toolbar.handlebars rename to app/view/template/toolbar.handlebars diff --git a/fonts/icomoon-toolbar/Read Me.txt b/assets/fonts/icomoon-toolbar/Read Me.txt similarity index 100% rename from fonts/icomoon-toolbar/Read Me.txt rename to assets/fonts/icomoon-toolbar/Read Me.txt diff --git a/fonts/icomoon-toolbar/fonts/toolbar.dev.svg b/assets/fonts/icomoon-toolbar/fonts/toolbar.dev.svg similarity index 100% rename from fonts/icomoon-toolbar/fonts/toolbar.dev.svg rename to assets/fonts/icomoon-toolbar/fonts/toolbar.dev.svg diff --git a/fonts/icomoon-toolbar/fonts/toolbar.eot b/assets/fonts/icomoon-toolbar/fonts/toolbar.eot similarity index 100% rename from fonts/icomoon-toolbar/fonts/toolbar.eot rename to assets/fonts/icomoon-toolbar/fonts/toolbar.eot diff --git a/fonts/icomoon-toolbar/fonts/toolbar.svg b/assets/fonts/icomoon-toolbar/fonts/toolbar.svg similarity index 100% rename from fonts/icomoon-toolbar/fonts/toolbar.svg rename to assets/fonts/icomoon-toolbar/fonts/toolbar.svg diff --git a/fonts/icomoon-toolbar/fonts/toolbar.ttf b/assets/fonts/icomoon-toolbar/fonts/toolbar.ttf similarity index 100% rename from fonts/icomoon-toolbar/fonts/toolbar.ttf rename to assets/fonts/icomoon-toolbar/fonts/toolbar.ttf diff --git a/fonts/icomoon-toolbar/fonts/toolbar.woff b/assets/fonts/icomoon-toolbar/fonts/toolbar.woff similarity index 100% rename from fonts/icomoon-toolbar/fonts/toolbar.woff rename to assets/fonts/icomoon-toolbar/fonts/toolbar.woff diff --git a/fonts/icomoon-toolbar/index.html b/assets/fonts/icomoon-toolbar/index.html similarity index 100% rename from fonts/icomoon-toolbar/index.html rename to assets/fonts/icomoon-toolbar/index.html diff --git a/fonts/icomoon-toolbar/license.txt b/assets/fonts/icomoon-toolbar/license.txt similarity index 100% rename from fonts/icomoon-toolbar/license.txt rename to assets/fonts/icomoon-toolbar/license.txt diff --git a/fonts/icomoon-toolbar/lte-ie7.js b/assets/fonts/icomoon-toolbar/lte-ie7.js similarity index 100% rename from fonts/icomoon-toolbar/lte-ie7.js rename to assets/fonts/icomoon-toolbar/lte-ie7.js diff --git a/fonts/icomoon-toolbar/style.css b/assets/fonts/icomoon-toolbar/style.css similarity index 100% rename from fonts/icomoon-toolbar/style.css rename to assets/fonts/icomoon-toolbar/style.css diff --git a/icons/1_Desktop_Icons/icon_016.png b/assets/icons/1_Desktop_Icons/icon_016.png similarity index 100% rename from icons/1_Desktop_Icons/icon_016.png rename to assets/icons/1_Desktop_Icons/icon_016.png diff --git a/icons/1_Desktop_Icons/icon_032.png b/assets/icons/1_Desktop_Icons/icon_032.png similarity index 100% rename from icons/1_Desktop_Icons/icon_032.png rename to assets/icons/1_Desktop_Icons/icon_032.png diff --git a/icons/1_Desktop_Icons/icon_048.png b/assets/icons/1_Desktop_Icons/icon_048.png similarity index 100% rename from icons/1_Desktop_Icons/icon_048.png rename to assets/icons/1_Desktop_Icons/icon_048.png diff --git a/icons/1_Desktop_Icons/icon_128.png b/assets/icons/1_Desktop_Icons/icon_128.png similarity index 100% rename from icons/1_Desktop_Icons/icon_128.png rename to assets/icons/1_Desktop_Icons/icon_128.png diff --git a/icons/1_Desktop_Icons/icon_196.png b/assets/icons/1_Desktop_Icons/icon_196.png similarity index 100% rename from icons/1_Desktop_Icons/icon_196.png rename to assets/icons/1_Desktop_Icons/icon_196.png diff --git a/icons/1_Desktop_Icons/icon_512.png b/assets/icons/1_Desktop_Icons/icon_512.png similarity index 100% rename from icons/1_Desktop_Icons/icon_512.png rename to assets/icons/1_Desktop_Icons/icon_512.png diff --git a/icons/2_Android_Icons/icon_036.png b/assets/icons/2_Android_Icons/icon_036.png similarity index 100% rename from icons/2_Android_Icons/icon_036.png rename to assets/icons/2_Android_Icons/icon_036.png diff --git a/icons/2_Android_Icons/icon_048.png b/assets/icons/2_Android_Icons/icon_048.png similarity index 100% rename from icons/2_Android_Icons/icon_048.png rename to assets/icons/2_Android_Icons/icon_048.png diff --git a/icons/2_Android_Icons/icon_072.png b/assets/icons/2_Android_Icons/icon_072.png similarity index 100% rename from icons/2_Android_Icons/icon_072.png rename to assets/icons/2_Android_Icons/icon_072.png diff --git a/icons/3_iPhone_Icons/icon_029.png b/assets/icons/3_iPhone_Icons/icon_029.png similarity index 100% rename from icons/3_iPhone_Icons/icon_029.png rename to assets/icons/3_iPhone_Icons/icon_029.png diff --git a/icons/3_iPhone_Icons/icon_048.png b/assets/icons/3_iPhone_Icons/icon_048.png similarity index 100% rename from icons/3_iPhone_Icons/icon_048.png rename to assets/icons/3_iPhone_Icons/icon_048.png diff --git a/icons/3_iPhone_Icons/icon_057.png b/assets/icons/3_iPhone_Icons/icon_057.png similarity index 100% rename from icons/3_iPhone_Icons/icon_057.png rename to assets/icons/3_iPhone_Icons/icon_057.png diff --git a/icons/3_iPhone_Icons/icon_072.png b/assets/icons/3_iPhone_Icons/icon_072.png similarity index 100% rename from icons/3_iPhone_Icons/icon_072.png rename to assets/icons/3_iPhone_Icons/icon_072.png diff --git a/icons/3_iPhone_Icons/icon_512.png b/assets/icons/3_iPhone_Icons/icon_512.png similarity index 100% rename from icons/3_iPhone_Icons/icon_512.png rename to assets/icons/3_iPhone_Icons/icon_512.png diff --git a/dist/comicbook.css b/dist/comicbook.css new file mode 100644 index 0000000..99f3ca8 --- /dev/null +++ b/dist/comicbook.css @@ -0,0 +1,398 @@ +@font-face { + font-family: 'toolbar'; + src:url('fonts/toolbar.eot'); + src:url('fonts/toolbar.eot?#iefix') format('embedded-opentype'), + url('fonts/toolbar.woff') format('woff'), + url('fonts/toolbar.ttf') format('truetype'), + url('fonts/toolbar.svg#toolbar') format('svg'); + font-weight: normal; + font-style: normal; +} + +/* Use the following CSS code if you want to use data attributes for inserting your icons */ +[data-icon]:before { + font-family: 'toolbar'; + content: attr(data-icon); + speak: none; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + -webkit-font-smoothing: antialiased; +} + +/* Use the following CSS code if you want to have a class per icon */ +/* +Instead of a list of all class selectors, +you can use the generic selector below, but it's slower: +[class*="icon-"] { +*/ +.icon-file, .icon-image, .icon-zoom-out, .icon-zoom-in, .icon-expand, .icon-expand-2, .icon-folder-open, .icon-folder, .icon-cog, .icon-menu, .icon-wrench, .icon-settings, .icon-loop, .icon-pin, .icon-first, .icon-last, .icon-arrow-left, .icon-arrow-right, .icon-arrow-left-2, .icon-arrow-right-2, .icon-arrow-left-3, .icon-arrow-right-3, .icon-previous, .icon-next, .icon-droplet, .icon-adjust, .icon-sun, .icon-remove-sign, .icon-remove, .icon-copy { + font-family: 'toolbar'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + -webkit-font-smoothing: antialiased; +} +.icon-file:before { + content: "\e000"; +} +.icon-image:before { + content: "\e001"; +} +.icon-zoom-out:before { + content: "\e002"; +} +.icon-zoom-in:before { + content: "\e003"; +} +.icon-expand:before { + content: "\e004"; +} +.icon-expand-2:before { + content: "\e005"; +} +.icon-folder-open:before { + content: "\e006"; +} +.icon-folder:before { + content: "\e007"; +} +.icon-cog:before { + content: "\e008"; +} +.icon-menu:before { + content: "\e009"; +} +.icon-wrench:before { + content: "\e00a"; +} +.icon-settings:before { + content: "\e00b"; +} +.icon-loop:before { + content: "\e00c"; +} +.icon-pin:before { + content: "\e00d"; +} +.icon-first:before { + content: "\e00e"; +} +.icon-last:before { + content: "\e00f"; +} +.icon-arrow-left:before { + content: "\e011"; +} +.icon-arrow-right:before { + content: "\e010"; +} +.icon-arrow-left-2:before { + content: "\e012"; +} +.icon-arrow-right-2:before { + content: "\e013"; +} +.icon-arrow-left-3:before { + content: "\e014"; +} +.icon-arrow-right-3:before { + content: "\e015"; +} +.icon-previous:before { + content: "\e016"; +} +.icon-next:before { + content: "\e017"; +} +.icon-droplet:before { + content: "\e01a"; +} +.icon-adjust:before { + content: "\f042"; +} +.icon-sun:before { + content: "\e018"; +} +.icon-remove-sign:before { + content: "\f057"; +} +.icon-remove:before { + content: "\f00d"; +} +.icon-copy:before { + content: "\e037"; +} +/* v1.0 | 20080212 */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; + vertical-align: baseline; + background: transparent; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} + +/* remember to define focus styles! */ +:focus { + outline: 0; +} + +/* remember to highlight inserts somehow! */ +ins { + text-decoration: none; +} +del { + text-decoration: line-through; +} + +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: collapse; + border-spacing: 0; +} + +.cb-control { + font-family: helvetica, arial, sans-serif; + font-size: 12px; +} + +.cb-control { + color: #fff; + background-color: #111; + padding: 10px; + position: fixed !important; + box-shadow: 0 0 4px #000; +} + +.navigate { + top: 0; + margin: 0; + cursor: pointer; + width: 128px; + opacity: 0; + background: center no-repeat; + box-shadow: none; + padding: 0 3em; +} + +.navigate > span { + color: #000; + font-size: 10em; + background-color: rgba(255, 255, 255, 0.8); + border-radius: 1em; + top: 35%; + position: relative; +} + +body:not(.mobile) .navigate:hover { + opacity: 1; +} + +.navigate-left { + left: 0; +} + +.navigate-right { + right: 0; +} + +#cb-loading-overlay { + z-index: 100; + opacity: 0.8; + background: #000 url("img/loading.gif") no-repeat center; + box-shadow: none; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; +} + +#cb-status { + z-index: 101; + font-size: 12px; + right: 0; + bottom: 0; + margin: 8px; + border-radius: 4px; +} + +#cb-progress-bar { + width: 200px; +} + +#cb-progress-bar, +#cb-progress-bar .progressbar-value { + height: 3px; +} + +#cb-progress-bar .progressbar-value { + width: 0; + background: #86C441; + border-color: #3E7600; +} + +* { + -webkit-user-select: none; + -webkit-touch-callout: none; + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 12px; + line-height: 20px; + color: #333; +} + +button, input, label { + cursor: pointer; +} + +.pull-left { + float: left; +} + +.pull-right { + float: right; +} + +.toolbar { + color: white; + background-color: black; + background-image: linear-gradient(to bottom, rgb(80, 80, 80), rgb(17, 17, 17)); + overflow: visible; + padding: 0.75em; + position: fixed; + left: 0; + right: 0; + z-index: 99; + margin-bottom: 0; + box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4); + opacity: 0; + transition: opacity 0.2s ease-in-out; +} + +.mobile .toolbar { + opacity: 1; +} + +.toolbar:hover { + opacity: 1; +} + +.toolbar li { + display: inline-block; + position: relative; +} + +.toolbar .separator { + border: solid 1px; + height: 1em; +} + +.toolbar button { + color: white; + border: none; + background-color: transparent; + padding: 0; +} + +.toolbar li > button { + font-size: 1.5em; + padding: 0 12px; +} + +.mobile .toolbar li > button { + padding: 0 9px; +} + +.toolbar li > button:hover { + color: #8CC746; +} + +.toolbar button[data-action=close]:hover { + color: #FF6464; +} + +.toolbar .dropdown { + font-size: 1em; + position: absolute; + width: 212px; + background-color: white; + color: #111; + border-radius: 4px; + box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4); + top: 2em; + padding: 4px 0; + display: none; +} + +body:not(.mobile) .toolbar li:hover > .dropdown { + display: block; +} + +/* dropdown arrow code taken from Twitter Bootstrap 2.3.1 */ +.toolbar .dropdown:after { + position: absolute; + top: -4px; + left: 15px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + border-left: 6px solid transparent; + content: ''; +} + +.toolbar .close { + display: none; +} + +.dropdown .control-group { + padding: 8px; +} + +.dropdown .sliders { + font-size: 1.5em; +} + +.dropdown .control-group span { + float: left; + margin: 0 2px; + clear: both; +} + +.dropdown .control-group input[type=range] { + width: 171px; + float: right; + margin: 0; +} diff --git a/dist/comicbook.js b/dist/comicbook.js new file mode 100644 index 0000000..1301a0d --- /dev/null +++ b/dist/comicbook.js @@ -0,0 +1,2855 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= this.srcs.length) { + startIndex = this.currentPageIndex; + } + + // reorder srcs to start from the requested index + var _srcs = this.srcs.slice(); + var srcs = _srcs.splice(startIndex).concat(_srcs); + + this.currentPageIndex = startIndex; + + srcs.forEach(function (src, pageIndex) { + + // allow preload to be run multiple times without duplicating requests + if (_this.pages.has(pageIndex)) return; + + var image = new window.Image(); + + image.src = src; + image.onload = setImage.bind(_this, image, pageIndex); + + function setImage(image, index) { + this.pages.set(index, image); + this.emit('preload:image', image); + + if (this.pages.size >= this.preloadBuffer && !this.pageRendered) { + this.emit('preload:ready'); + } + + if (this.pages.size === this.srcs.length) { + this.emit('preload:finish'); + } + } + }); + } + }, { + key: 'updateProgressBar', + value: function updateProgressBar() { + var percentage = Math.floor(this.pages.size / this.srcs.length * 100); + this.progressBar.update(percentage); + } + }, { + key: 'drawPage', + value: function drawPage(pageIndex) { + if (typeof pageIndex !== 'number') pageIndex = this.currentPageIndex; + + var page = this.pages.get(pageIndex); + + // if the requested image hasn't been loaded yet, force another preload run + if (!page) return this.preload(pageIndex); + + var args = [page]; + + if (this.options.doublePage) { + var page2Index = pageIndex + 1; + var page2 = this.pages.get(page2Index); + + if (page2Index <= this.pages.size - 1 && !page2) { + return this.preload(page2Index); + } + + args.push(page2); + + if (this.options.rtl) { + args.reverse(); + } + } + + args.push(this.options); + + try { + this.canvas.drawImage.apply(this.canvas, args); + this.currentPageIndex = pageIndex; + this.pageRendered = true; + } catch (e) { + if (e.message !== 'Invalid image') throw e; + } + } + }, { + key: 'drawNextPage', + value: function drawNextPage() { + var increment = this.options.doublePage ? 2 : 1; + var index = this.currentPageIndex + increment; + if (index >= this.pages.size) { + index = this.pages.size - 1; + } + this.drawPage(index); + } + }, { + key: 'drawPreviousPage', + value: function drawPreviousPage() { + var increment = this.options.doublePage ? 2 : 1; + var index = this.currentPageIndex - increment; + if (index < 0) index = 0; + this.drawPage(index); + } + }]); + + return ComicBook; +})(EventEmitter); + +module.exports = ComicBook; + +},{"./view/canvas":3,"./view/load-indicator":4,"./view/progress-bar":5,"babel-runtime/core-js/map":7,"babel-runtime/core-js/object/assign":8,"babel-runtime/helpers/class-call-check":12,"babel-runtime/helpers/create-class":13,"babel-runtime/helpers/get":14,"babel-runtime/helpers/inherits":15,"events":53}],2:[function(require,module,exports){ +'use strict'; + +var ComicBook = window.ComicBook = require('./comic-book'); +var debounce = require('lodash.debounce'); +var srcs = ['https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_00.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_01.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_02.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_03.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_04.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_05.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_06.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_07.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_08.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_09.jpg', 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_10.jpg']; +var comic = window.comic = new ComicBook(srcs, { doublePage: true }); + +comic.render().drawPage(5); + +window.addEventListener('resize', debounce(comic.drawPage.bind(comic), 100)); + +document.addEventListener('DOMContentLoaded', function () { + document.body.appendChild(comic.el); +}, false); + +},{"./comic-book":1,"lodash.debounce":63}],3:[function(require,module,exports){ +'use strict'; + +var _get = require('babel-runtime/helpers/get')['default']; + +var _inherits = require('babel-runtime/helpers/inherits')['default']; + +var _createClass = require('babel-runtime/helpers/create-class')['default']; + +var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default']; + +var _Object$assign = require('babel-runtime/core-js/object/assign')['default']; + +var EventEmitter = require('events').EventEmitter; + +// TODO replace +function windowWidth() { + return window.innerWidth; +} + +var Canvas = (function (_EventEmitter) { + _inherits(Canvas, _EventEmitter); + + function Canvas(options) { + _classCallCheck(this, Canvas); + + _get(Object.getPrototypeOf(Canvas.prototype), 'constructor', this).call(this); + this.canvas = document.createElement('canvas'); + this.context = this.canvas.getContext('2d'); + } + + _createClass(Canvas, [{ + key: 'drawImage', + value: function drawImage(page, page2) { + var opts = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; + + this.emit('draw:start'); + + if (page2 === null || !(page2 instanceof window.Image)) { + opts = page2 || opts; + } + + var options = _Object$assign({ + doublePage: false, + zoomMode: 'fitWidth' + }, opts); + + if (!(page instanceof window.Image) || options.doublePage && page2 === null) { + throw new Error('Invalid image'); + } + + var zoomScale = undefined; + var offsetW = 0; + var offsetH = 0; + var width = page.width; + var height = page.height; + var doublePageMode = options.doublePage; + var canvasWidth = undefined; + var canvasHeight = undefined; + var pageWidth = undefined; + var pageHeight = undefined; + + // reset the canvas to stop duplicate pages showing + this.canvas.width = 0; + this.canvas.height = 0; + + // show double page spreads on a single page + var isDoublePageSpread = page2 && (page.width > page.height || page2.width > page2.height) && doublePageMode; + + if (isDoublePageSpread) doublePageMode = false; + + if (doublePageMode) { + + // for double page spreads, factor in the width of both pages + if (page2 instanceof window.Image) { + width += page2.width + // if this is the last page and there is no page2, still keep the canvas wide + ; + } else { + width += width; + } + } + + // update the page this.scale if a non manual mode has been chosen + switch (options.zoomMode) { + + case 'manual': + document.body.style.overflowX = 'auto'; + zoomScale = doublePageMode ? this.scale * 2 : this.scale; + break; + + case 'fitWidth': + document.body.style.overflowX = 'hidden'; + + // this.scale up if the window is wider than the page, scale down if the window + // is narrower than the page + zoomScale = windowWidth() > width ? (windowWidth() - width) / windowWidth() + 1 : windowWidth() / width; + this.scale = zoomScale; + break; + + case 'fitWindow': + document.body.style.overflowX = 'hidden'; + + var widthScale = windowWidth() > width ? (windowWidth() - width) / windowWidth() + 1 // scale up if the window is wider than the page + : windowWidth() / width; // scale down if the window is narrower than the page + var windowHeight = window.innerHeight; + var heightScale = windowHeight > height ? (windowHeight - height) / windowHeight + 1 // scale up if the window is wider than the page + : windowHeight / height; // scale down if the window is narrower than the page + + zoomScale = widthScale > heightScale ? heightScale : widthScale; + this.scale = zoomScale; + break; + } + + canvasWidth = page.width * zoomScale; + canvasHeight = page.height * zoomScale; + + pageWidth = options.zoomMode === 'manual' ? page.width * this.scale : canvasWidth; + pageHeight = options.zoomMode === 'manual' ? page.height * this.scale : canvasHeight; + + canvasHeight = pageHeight; + + // make sure the canvas is always at least full screen, even if the page is narrower than the screen + this.canvas.width = canvasWidth < windowWidth() ? windowWidth() : canvasWidth; + this.canvas.height = canvasHeight < window.innerHeight ? window.innerHeight : canvasHeight; + + // always keep pages centered + if (options.zoomMode === 'manual' || options.zoomMode === 'fitWindow') { + + // work out a horizontal position + if (canvasWidth < windowWidth()) { + offsetW = (windowWidth() - pageWidth) / 2; + if (options.doublePage) { + offsetW = offsetW - pageWidth / 2; + } + } + + // work out a vertical position + if (canvasHeight < window.innerHeight) { + offsetH = (window.innerHeight - pageHeight) / 2; + } + } + + // draw the page(s) + this.context.drawImage(page, offsetW, offsetH, pageWidth, pageHeight); + if (options.doublePage && typeof page2 === 'object') { + this.context.drawImage(page2, pageWidth + offsetW, offsetH, pageWidth, pageHeight); + } + + this.emit('draw:finish'); + } + }]); + + return Canvas; +})(EventEmitter); + +module.exports = Canvas; + +},{"babel-runtime/core-js/object/assign":8,"babel-runtime/helpers/class-call-check":12,"babel-runtime/helpers/create-class":13,"babel-runtime/helpers/get":14,"babel-runtime/helpers/inherits":15,"events":53}],4:[function(require,module,exports){ +'use strict'; + +var _get = require('babel-runtime/helpers/get')['default']; + +var _inherits = require('babel-runtime/helpers/inherits')['default']; + +var _createClass = require('babel-runtime/helpers/create-class')['default']; + +var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default']; + +var EventEmitter = require('events').EventEmitter; + +var LoadIndicator = (function (_EventEmitter) { + _inherits(LoadIndicator, _EventEmitter); + + function LoadIndicator() { + _classCallCheck(this, LoadIndicator); + + _get(Object.getPrototypeOf(LoadIndicator.prototype), 'constructor', this).call(this); + this.render().hide(); + } + + _createClass(LoadIndicator, [{ + key: 'render', + value: function render() { + this.el = document.createElement('div'); + this.el.id = 'cb-loading-overlay'; + return this; + } + }, { + key: 'show', + value: function show() { + this.el.style.display = 'block'; + this.emit('show', this); + } + }, { + key: 'hide', + value: function hide() { + this.el.style.display = 'none'; + this.emit('hide', this); + } + }]); + + return LoadIndicator; +})(EventEmitter); + +module.exports = LoadIndicator; + +},{"babel-runtime/helpers/class-call-check":12,"babel-runtime/helpers/create-class":13,"babel-runtime/helpers/get":14,"babel-runtime/helpers/inherits":15,"events":53}],5:[function(require,module,exports){ +'use strict'; + +var _createClass = require('babel-runtime/helpers/create-class')['default']; + +var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default']; + +var template = require('./template/progress-bar.handlebars'); + +var ProgressBar = (function () { + function ProgressBar() { + _classCallCheck(this, ProgressBar); + + this.createElements(); + this.hide(); + } + + _createClass(ProgressBar, [{ + key: 'createElements', + value: function createElements() { + var el = document.createElement('div'); + el.innerHTML = template(); + this.el = el.firstChild; + this.progressEl = this.el.querySelector('.progressbar-value'); + } + }, { + key: 'update', + value: function update(percentage) { + this.progressEl.style.width = percentage + '%'; + } + }, { + key: 'show', + value: function show() { + this.el.style.display = 'block'; + } + }, { + key: 'hide', + value: function hide() { + this.el.style.display = 'none'; + } + }]); + + return ProgressBar; +})(); + +module.exports = ProgressBar; + +},{"./template/progress-bar.handlebars":6,"babel-runtime/helpers/class-call-check":12,"babel-runtime/helpers/create-class":13}],6:[function(require,module,exports){ +var templater = require("handlebars/runtime")["default"].template;module.exports = templater({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) { + return "
\n
\n
\n
\n
\n"; +},"useData":true}); +},{"handlebars/runtime":61}],7:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/map"), __esModule: true }; +},{"core-js/library/fn/map":16}],8:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true }; +},{"core-js/library/fn/object/assign":17}],9:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/create"), __esModule: true }; +},{"core-js/library/fn/object/create":18}],10:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/define-property"), __esModule: true }; +},{"core-js/library/fn/object/define-property":19}],11:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/object/get-own-property-descriptor"), __esModule: true }; +},{"core-js/library/fn/object/get-own-property-descriptor":20}],12:[function(require,module,exports){ +"use strict"; + +exports["default"] = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +exports.__esModule = true; +},{}],13:[function(require,module,exports){ +"use strict"; + +var _Object$defineProperty = require("babel-runtime/core-js/object/define-property")["default"]; + +exports["default"] = (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; + }; +})(); + +exports.__esModule = true; +},{"babel-runtime/core-js/object/define-property":10}],14:[function(require,module,exports){ +"use strict"; + +var _Object$getOwnPropertyDescriptor = require("babel-runtime/core-js/object/get-own-property-descriptor")["default"]; + +exports["default"] = function get(_x, _x2, _x3) { + var _again = true; + + _function: while (_again) { + var object = _x, + property = _x2, + receiver = _x3; + desc = parent = getter = undefined; + _again = false; + if (object === null) object = Function.prototype; + + var desc = _Object$getOwnPropertyDescriptor(object, property); + + if (desc === undefined) { + var parent = Object.getPrototypeOf(object); + + if (parent === null) { + return undefined; + } else { + _x = parent; + _x2 = property; + _x3 = receiver; + _again = true; + continue _function; + } + } else if ("value" in desc) { + return desc.value; + } else { + var getter = desc.get; + + if (getter === undefined) { + return undefined; + } + + return getter.call(receiver); + } + } +}; + +exports.__esModule = true; +},{"babel-runtime/core-js/object/get-own-property-descriptor":11}],15:[function(require,module,exports){ +"use strict"; + +var _Object$create = require("babel-runtime/core-js/object/create")["default"]; + +exports["default"] = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = _Object$create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) subClass.__proto__ = superClass; +}; + +exports.__esModule = true; +},{"babel-runtime/core-js/object/create":9}],16:[function(require,module,exports){ +require('../modules/es6.object.to-string'); +require('../modules/es6.string.iterator'); +require('../modules/web.dom.iterable'); +require('../modules/es6.map'); +require('../modules/es7.map.to-json'); +module.exports = require('../modules/$').core.Map; +},{"../modules/$":36,"../modules/es6.map":46,"../modules/es6.object.to-string":49,"../modules/es6.string.iterator":50,"../modules/es7.map.to-json":51,"../modules/web.dom.iterable":52}],17:[function(require,module,exports){ +require('../../modules/es6.object.assign'); +module.exports = require('../../modules/$').core.Object.assign; +},{"../../modules/$":36,"../../modules/es6.object.assign":47}],18:[function(require,module,exports){ +var $ = require('../../modules/$'); +module.exports = function create(P, D){ + return $.create(P, D); +}; +},{"../../modules/$":36}],19:[function(require,module,exports){ +var $ = require('../../modules/$'); +module.exports = function defineProperty(it, key, desc){ + return $.setDesc(it, key, desc); +}; +},{"../../modules/$":36}],20:[function(require,module,exports){ +var $ = require('../../modules/$'); +require('../../modules/es6.object.statics-accept-primitives'); +module.exports = function getOwnPropertyDescriptor(it, key){ + return $.getDesc(it, key); +}; +},{"../../modules/$":36,"../../modules/es6.object.statics-accept-primitives":48}],21:[function(require,module,exports){ +var $ = require('./$'); +function assert(condition, msg1, msg2){ + if(!condition)throw TypeError(msg2 ? msg1 + msg2 : msg1); +} +assert.def = $.assertDefined; +assert.fn = function(it){ + if(!$.isFunction(it))throw TypeError(it + ' is not a function!'); + return it; +}; +assert.obj = function(it){ + if(!$.isObject(it))throw TypeError(it + ' is not an object!'); + return it; +}; +assert.inst = function(it, Constructor, name){ + if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!"); + return it; +}; +module.exports = assert; +},{"./$":36}],22:[function(require,module,exports){ +var $ = require('./$') + , enumKeys = require('./$.enum-keys'); +// 19.1.2.1 Object.assign(target, source, ...) +/* eslint-disable no-unused-vars */ +module.exports = Object.assign || function assign(target, source){ +/* eslint-enable no-unused-vars */ + var T = Object($.assertDefined(target)) + , l = arguments.length + , i = 1; + while(l > i){ + var S = $.ES5Object(arguments[i++]) + , keys = enumKeys(S) + , length = keys.length + , j = 0 + , key; + while(length > j)T[key = keys[j++]] = S[key]; + } + return T; +}; +},{"./$":36,"./$.enum-keys":29}],23:[function(require,module,exports){ +var $ = require('./$') + , TAG = require('./$.wks')('toStringTag') + , toString = {}.toString; +function cof(it){ + return toString.call(it).slice(8, -1); +} +cof.classof = function(it){ + var O, T; + return it == undefined ? it === undefined ? 'Undefined' : 'Null' + : typeof (T = (O = Object(it))[TAG]) == 'string' ? T : cof(O); +}; +cof.set = function(it, tag, stat){ + if(it && !$.has(it = stat ? it : it.prototype, TAG))$.hide(it, TAG, tag); +}; +module.exports = cof; +},{"./$":36,"./$.wks":44}],24:[function(require,module,exports){ +'use strict'; +var $ = require('./$') + , ctx = require('./$.ctx') + , safe = require('./$.uid').safe + , assert = require('./$.assert') + , forOf = require('./$.for-of') + , step = require('./$.iter').step + , $has = $.has + , set = $.set + , isObject = $.isObject + , hide = $.hide + , isExtensible = Object.isExtensible || isObject + , ID = safe('id') + , O1 = safe('O1') + , LAST = safe('last') + , FIRST = safe('first') + , ITER = safe('iter') + , SIZE = $.DESC ? safe('size') : 'size' + , id = 0; + +function fastKey(it, create){ + // return primitive with prefix + if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if(!$has(it, ID)){ + // can't set id to frozen object + if(!isExtensible(it))return 'F'; + // not necessary to add id + if(!create)return 'E'; + // add missing object id + hide(it, ID, ++id); + // return object id with prefix + } return 'O' + it[ID]; +} + +function getEntry(that, key){ + // fast case + var index = fastKey(key), entry; + if(index !== 'F')return that[O1][index]; + // frozen object case + for(entry = that[FIRST]; entry; entry = entry.n){ + if(entry.k == key)return entry; + } +} + +module.exports = { + getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ + var C = wrapper(function(that, iterable){ + assert.inst(that, C, NAME); + set(that, O1, $.create(null)); + set(that, SIZE, 0); + set(that, LAST, undefined); + set(that, FIRST, undefined); + if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); + }); + require('./$.mix')(C.prototype, { + // 23.1.3.1 Map.prototype.clear() + // 23.2.3.2 Set.prototype.clear() + clear: function clear(){ + for(var that = this, data = that[O1], entry = that[FIRST]; entry; entry = entry.n){ + entry.r = true; + if(entry.p)entry.p = entry.p.n = undefined; + delete data[entry.i]; + } + that[FIRST] = that[LAST] = undefined; + that[SIZE] = 0; + }, + // 23.1.3.3 Map.prototype.delete(key) + // 23.2.3.4 Set.prototype.delete(value) + 'delete': function(key){ + var that = this + , entry = getEntry(that, key); + if(entry){ + var next = entry.n + , prev = entry.p; + delete that[O1][entry.i]; + entry.r = true; + if(prev)prev.n = next; + if(next)next.p = prev; + if(that[FIRST] == entry)that[FIRST] = next; + if(that[LAST] == entry)that[LAST] = prev; + that[SIZE]--; + } return !!entry; + }, + // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) + // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) + forEach: function forEach(callbackfn /*, that = undefined */){ + var f = ctx(callbackfn, arguments[1], 3) + , entry; + while(entry = entry ? entry.n : this[FIRST]){ + f(entry.v, entry.k, this); + // revert to the last existing entry + while(entry && entry.r)entry = entry.p; + } + }, + // 23.1.3.7 Map.prototype.has(key) + // 23.2.3.7 Set.prototype.has(value) + has: function has(key){ + return !!getEntry(this, key); + } + }); + if($.DESC)$.setDesc(C.prototype, 'size', { + get: function(){ + return assert.def(this[SIZE]); + } + }); + return C; + }, + def: function(that, key, value){ + var entry = getEntry(that, key) + , prev, index; + // change existing entry + if(entry){ + entry.v = value; + // create new entry + } else { + that[LAST] = entry = { + i: index = fastKey(key, true), // <- index + k: key, // <- key + v: value, // <- value + p: prev = that[LAST], // <- previous entry + n: undefined, // <- next entry + r: false // <- removed + }; + if(!that[FIRST])that[FIRST] = entry; + if(prev)prev.n = entry; + that[SIZE]++; + // add to index + if(index !== 'F')that[O1][index] = entry; + } return that; + }, + getEntry: getEntry, + // add .keys, .values, .entries, [@@iterator] + // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 + setIter: function(C, NAME, IS_MAP){ + require('./$.iter-define')(C, NAME, function(iterated, kind){ + set(this, ITER, {o: iterated, k: kind}); + }, function(){ + var iter = this[ITER] + , kind = iter.k + , entry = iter.l; + // revert to the last existing entry + while(entry && entry.r)entry = entry.p; + // get next entry + if(!iter.o || !(iter.l = entry = entry ? entry.n : iter.o[FIRST])){ + // or finish the iteration + iter.o = undefined; + return step(1); + } + // return step by kind + if(kind == 'keys' )return step(0, entry.k); + if(kind == 'values')return step(0, entry.v); + return step(0, [entry.k, entry.v]); + }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); + } +}; +},{"./$":36,"./$.assert":21,"./$.ctx":27,"./$.for-of":30,"./$.iter":35,"./$.iter-define":34,"./$.mix":37,"./$.uid":42}],25:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var $def = require('./$.def') + , forOf = require('./$.for-of'); +module.exports = function(NAME){ + $def($def.P, NAME, { + toJSON: function toJSON(){ + var arr = []; + forOf(this, false, arr.push, arr); + return arr; + } + }); +}; +},{"./$.def":28,"./$.for-of":30}],26:[function(require,module,exports){ +'use strict'; +var $ = require('./$') + , $def = require('./$.def') + , $iter = require('./$.iter') + , BUGGY = $iter.BUGGY + , forOf = require('./$.for-of') + , assertInstance = require('./$.assert').inst + , INTERNAL = require('./$.uid').safe('internal'); + +module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ + var Base = $.g[NAME] + , C = Base + , ADDER = IS_MAP ? 'set' : 'add' + , proto = C && C.prototype + , O = {}; + if(!$.DESC || !$.isFunction(C) || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){ + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + require('./$.mix')(C.prototype, methods); + } else { + C = wrapper(function(target, iterable){ + assertInstance(target, C, NAME); + target[INTERNAL] = new Base; + if(iterable != undefined)forOf(iterable, IS_MAP, target[ADDER], target); + }); + $.each.call('add,clear,delete,forEach,get,has,set,keys,values,entries'.split(','),function(KEY){ + var chain = KEY == 'add' || KEY == 'set'; + if(KEY in proto)$.hide(C.prototype, KEY, function(a, b){ + var result = this[INTERNAL][KEY](a === 0 ? 0 : a, b); + return chain ? this : result; + }); + }); + if('size' in proto)$.setDesc(C.prototype, 'size', { + get: function(){ + return this[INTERNAL].size; + } + }); + } + + require('./$.cof').set(C, NAME); + + O[NAME] = C; + $def($def.G + $def.W + $def.F, O); + require('./$.species')(C); + + if(!IS_WEAK)common.setIter(C, NAME, IS_MAP); + + return C; +}; +},{"./$":36,"./$.assert":21,"./$.cof":23,"./$.def":28,"./$.for-of":30,"./$.iter":35,"./$.mix":37,"./$.species":40,"./$.uid":42}],27:[function(require,module,exports){ +// Optional / simple context binding +var assertFunction = require('./$.assert').fn; +module.exports = function(fn, that, length){ + assertFunction(fn); + if(~length && that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; + } return function(/* ...args */){ + return fn.apply(that, arguments); + }; +}; +},{"./$.assert":21}],28:[function(require,module,exports){ +var $ = require('./$') + , global = $.g + , core = $.core + , isFunction = $.isFunction; +function ctx(fn, that){ + return function(){ + return fn.apply(that, arguments); + }; +} +// type bitmap +$def.F = 1; // forced +$def.G = 2; // global +$def.S = 4; // static +$def.P = 8; // proto +$def.B = 16; // bind +$def.W = 32; // wrap +function $def(type, name, source){ + var key, own, out, exp + , isGlobal = type & $def.G + , isProto = type & $def.P + , target = isGlobal ? global : type & $def.S + ? global[name] : (global[name] || {}).prototype + , exports = isGlobal ? core : core[name] || (core[name] = {}); + if(isGlobal)source = name; + for(key in source){ + // contains in native + own = !(type & $def.F) && target && key in target; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + if(isGlobal && !isFunction(target[key]))exp = source[key]; + // bind timers to global for call from export context + else if(type & $def.B && own)exp = ctx(out, global); + // wrap global constructors for prevent change them in library + else if(type & $def.W && target[key] == out)!function(C){ + exp = function(param){ + return this instanceof C ? new C(param) : C(param); + }; + exp.prototype = C.prototype; + }(out); + else exp = isProto && isFunction(out) ? ctx(Function.call, out) : out; + // export + exports[key] = exp; + if(isProto)(exports.prototype || (exports.prototype = {}))[key] = out; + } +} +module.exports = $def; +},{"./$":36}],29:[function(require,module,exports){ +var $ = require('./$'); +module.exports = function(it){ + var keys = $.getKeys(it) + , getDesc = $.getDesc + , getSymbols = $.getSymbols; + if(getSymbols)$.each.call(getSymbols(it), function(key){ + if(getDesc(it, key).enumerable)keys.push(key); + }); + return keys; +}; +},{"./$":36}],30:[function(require,module,exports){ +var ctx = require('./$.ctx') + , get = require('./$.iter').get + , call = require('./$.iter-call'); +module.exports = function(iterable, entries, fn, that){ + var iterator = get(iterable) + , f = ctx(fn, that, entries ? 2 : 1) + , step; + while(!(step = iterator.next()).done){ + if(call(iterator, f, step.value, entries) === false){ + return call.close(iterator); + } + } +}; +},{"./$.ctx":27,"./$.iter":35,"./$.iter-call":33}],31:[function(require,module,exports){ +module.exports = function($){ + $.FW = false; + $.path = $.core; + return $; +}; +},{}],32:[function(require,module,exports){ +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window +var $ = require('./$') + , toString = {}.toString + , getNames = $.getNames; + +var windowNames = typeof window == 'object' && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; + +function getWindowNames(it){ + try { + return getNames(it); + } catch(e){ + return windowNames.slice(); + } +} + +module.exports.get = function getOwnPropertyNames(it){ + if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it); + return getNames($.toObject(it)); +}; +},{"./$":36}],33:[function(require,module,exports){ +var assertObject = require('./$.assert').obj; +function close(iterator){ + var ret = iterator['return']; + if(ret !== undefined)assertObject(ret.call(iterator)); +} +function call(iterator, fn, value, entries){ + try { + return entries ? fn(assertObject(value)[0], value[1]) : fn(value); + } catch(e){ + close(iterator); + throw e; + } +} +call.close = close; +module.exports = call; +},{"./$.assert":21}],34:[function(require,module,exports){ +var $def = require('./$.def') + , $redef = require('./$.redef') + , $ = require('./$') + , cof = require('./$.cof') + , $iter = require('./$.iter') + , SYMBOL_ITERATOR = require('./$.wks')('iterator') + , FF_ITERATOR = '@@iterator' + , KEYS = 'keys' + , VALUES = 'values' + , Iterators = $iter.Iterators; +module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){ + $iter.create(Constructor, NAME, next); + function createMethod(kind){ + function $$(that){ + return new Constructor(that, kind); + } + switch(kind){ + case KEYS: return function keys(){ return $$(this); }; + case VALUES: return function values(){ return $$(this); }; + } return function entries(){ return $$(this); }; + } + var TAG = NAME + ' Iterator' + , proto = Base.prototype + , _native = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] + , _default = _native || createMethod(DEFAULT) + , methods, key; + // Fix native + if(_native){ + var IteratorPrototype = $.getProto(_default.call(new Base)); + // Set @@toStringTag to native iterators + cof.set(IteratorPrototype, TAG, true); + // FF fix + if($.FW && $.has(proto, FF_ITERATOR))$iter.set(IteratorPrototype, $.that); + } + // Define iterator + if($.FW || FORCE)$iter.set(proto, _default); + // Plug for library + Iterators[NAME] = _default; + Iterators[TAG] = $.that; + if(DEFAULT){ + methods = { + keys: IS_SET ? _default : createMethod(KEYS), + values: DEFAULT == VALUES ? _default : createMethod(VALUES), + entries: DEFAULT != VALUES ? _default : createMethod('entries') + }; + if(FORCE)for(key in methods){ + if(!(key in proto))$redef(proto, key, methods[key]); + } else $def($def.P + $def.F * $iter.BUGGY, NAME, methods); + } +}; +},{"./$":36,"./$.cof":23,"./$.def":28,"./$.iter":35,"./$.redef":38,"./$.wks":44}],35:[function(require,module,exports){ +'use strict'; +var $ = require('./$') + , cof = require('./$.cof') + , classof = cof.classof + , assert = require('./$.assert') + , assertObject = assert.obj + , SYMBOL_ITERATOR = require('./$.wks')('iterator') + , FF_ITERATOR = '@@iterator' + , Iterators = require('./$.shared')('iterators') + , IteratorPrototype = {}; +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +setIterator(IteratorPrototype, $.that); +function setIterator(O, value){ + $.hide(O, SYMBOL_ITERATOR, value); + // Add iterator for FF iterator protocol + if(FF_ITERATOR in [])$.hide(O, FF_ITERATOR, value); +} + +module.exports = { + // Safari has buggy iterators w/o `next` + BUGGY: 'keys' in [] && !('next' in [].keys()), + Iterators: Iterators, + step: function(done, value){ + return {value: value, done: !!done}; + }, + is: function(it){ + var O = Object(it) + , Symbol = $.g.Symbol; + return (Symbol && Symbol.iterator || FF_ITERATOR) in O + || SYMBOL_ITERATOR in O + || $.has(Iterators, classof(O)); + }, + get: function(it){ + var Symbol = $.g.Symbol + , getIter; + if(it != undefined){ + getIter = it[Symbol && Symbol.iterator || FF_ITERATOR] + || it[SYMBOL_ITERATOR] + || Iterators[classof(it)]; + } + assert($.isFunction(getIter), it, ' is not iterable!'); + return assertObject(getIter.call(it)); + }, + set: setIterator, + create: function(Constructor, NAME, next, proto){ + Constructor.prototype = $.create(proto || IteratorPrototype, {next: $.desc(1, next)}); + cof.set(Constructor, NAME + ' Iterator'); + } +}; +},{"./$":36,"./$.assert":21,"./$.cof":23,"./$.shared":39,"./$.wks":44}],36:[function(require,module,exports){ +'use strict'; +var global = typeof self != 'undefined' ? self : Function('return this')() + , core = {} + , defineProperty = Object.defineProperty + , hasOwnProperty = {}.hasOwnProperty + , ceil = Math.ceil + , floor = Math.floor + , max = Math.max + , min = Math.min; +// The engine works fine with descriptors? Thank's IE8 for his funny defineProperty. +var DESC = !!function(){ + try { + return defineProperty({}, 'a', {get: function(){ return 2; }}).a == 2; + } catch(e){ /* empty */ } +}(); +var hide = createDefiner(1); +// 7.1.4 ToInteger +function toInteger(it){ + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +} +function desc(bitmap, value){ + return { + enumerable : !(bitmap & 1), + configurable: !(bitmap & 2), + writable : !(bitmap & 4), + value : value + }; +} +function simpleSet(object, key, value){ + object[key] = value; + return object; +} +function createDefiner(bitmap){ + return DESC ? function(object, key, value){ + return $.setDesc(object, key, desc(bitmap, value)); + } : simpleSet; +} + +function isObject(it){ + return it !== null && (typeof it == 'object' || typeof it == 'function'); +} +function isFunction(it){ + return typeof it == 'function'; +} +function assertDefined(it){ + if(it == undefined)throw TypeError("Can't call method on " + it); + return it; +} + +var $ = module.exports = require('./$.fw')({ + g: global, + core: core, + html: global.document && document.documentElement, + // http://jsperf.com/core-js-isobject + isObject: isObject, + isFunction: isFunction, + that: function(){ + return this; + }, + // 7.1.4 ToInteger + toInteger: toInteger, + // 7.1.15 ToLength + toLength: function(it){ + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 + }, + toIndex: function(index, length){ + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); + }, + has: function(it, key){ + return hasOwnProperty.call(it, key); + }, + create: Object.create, + getProto: Object.getPrototypeOf, + DESC: DESC, + desc: desc, + getDesc: Object.getOwnPropertyDescriptor, + setDesc: defineProperty, + setDescs: Object.defineProperties, + getKeys: Object.keys, + getNames: Object.getOwnPropertyNames, + getSymbols: Object.getOwnPropertySymbols, + assertDefined: assertDefined, + // Dummy, fix for not array-like ES3 string in es5 module + ES5Object: Object, + toObject: function(it){ + return $.ES5Object(assertDefined(it)); + }, + hide: hide, + def: createDefiner(0), + set: global.Symbol ? simpleSet : hide, + each: [].forEach +}); +/* eslint-disable no-undef */ +if(typeof __e != 'undefined')__e = core; +if(typeof __g != 'undefined')__g = global; +},{"./$.fw":31}],37:[function(require,module,exports){ +var $redef = require('./$.redef'); +module.exports = function(target, src){ + for(var key in src)$redef(target, key, src[key]); + return target; +}; +},{"./$.redef":38}],38:[function(require,module,exports){ +module.exports = require('./$').hide; +},{"./$":36}],39:[function(require,module,exports){ +var $ = require('./$') + , SHARED = '__core-js_shared__' + , store = $.g[SHARED] || ($.g[SHARED] = {}); +module.exports = function(key){ + return store[key] || (store[key] = {}); +}; +},{"./$":36}],40:[function(require,module,exports){ +var $ = require('./$') + , SPECIES = require('./$.wks')('species'); +module.exports = function(C){ + if($.DESC && !(SPECIES in C))$.setDesc(C, SPECIES, { + configurable: true, + get: $.that + }); +}; +},{"./$":36,"./$.wks":44}],41:[function(require,module,exports){ +// true -> String#at +// false -> String#codePointAt +var $ = require('./$'); +module.exports = function(TO_STRING){ + return function(that, pos){ + var s = String($.assertDefined(that)) + , i = $.toInteger(pos) + , l = s.length + , a, b; + if(i < 0 || i >= l)return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l + || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; +},{"./$":36}],42:[function(require,module,exports){ +var sid = 0; +function uid(key){ + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++sid + Math.random()).toString(36)); +} +uid.safe = require('./$').g.Symbol || uid; +module.exports = uid; +},{"./$":36}],43:[function(require,module,exports){ +module.exports = function(){ /* empty */ }; +},{}],44:[function(require,module,exports){ +var global = require('./$').g + , store = require('./$.shared')('wks'); +module.exports = function(name){ + return store[name] || (store[name] = + global.Symbol && global.Symbol[name] || require('./$.uid').safe('Symbol.' + name)); +}; +},{"./$":36,"./$.shared":39,"./$.uid":42}],45:[function(require,module,exports){ +var $ = require('./$') + , setUnscope = require('./$.unscope') + , ITER = require('./$.uid').safe('iter') + , $iter = require('./$.iter') + , step = $iter.step + , Iterators = $iter.Iterators; + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +require('./$.iter-define')(Array, 'Array', function(iterated, kind){ + $.set(this, ITER, {o: $.toObject(iterated), i: 0, k: kind}); +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function(){ + var iter = this[ITER] + , O = iter.o + , kind = iter.k + , index = iter.i++; + if(!O || index >= O.length){ + iter.o = undefined; + return step(1); + } + if(kind == 'keys' )return step(0, index); + if(kind == 'values')return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; + +setUnscope('keys'); +setUnscope('values'); +setUnscope('entries'); +},{"./$":36,"./$.iter":35,"./$.iter-define":34,"./$.uid":42,"./$.unscope":43}],46:[function(require,module,exports){ +'use strict'; +var strong = require('./$.collection-strong'); + +// 23.1 Map Objects +require('./$.collection')('Map', function(get){ + return function Map(){ return get(this, arguments[0]); }; +}, { + // 23.1.3.6 Map.prototype.get(key) + get: function get(key){ + var entry = strong.getEntry(this, key); + return entry && entry.v; + }, + // 23.1.3.9 Map.prototype.set(key, value) + set: function set(key, value){ + return strong.def(this, key === 0 ? 0 : key, value); + } +}, strong, true); +},{"./$.collection":26,"./$.collection-strong":24}],47:[function(require,module,exports){ +// 19.1.3.1 Object.assign(target, source) +var $def = require('./$.def'); +$def($def.S, 'Object', {assign: require('./$.assign')}); +},{"./$.assign":22,"./$.def":28}],48:[function(require,module,exports){ +var $ = require('./$') + , $def = require('./$.def') + , isObject = $.isObject + , toObject = $.toObject; +$.each.call(('freeze,seal,preventExtensions,isFrozen,isSealed,isExtensible,' + + 'getOwnPropertyDescriptor,getPrototypeOf,keys,getOwnPropertyNames').split(',') +, function(KEY, ID){ + var fn = ($.core.Object || {})[KEY] || Object[KEY] + , forced = 0 + , method = {}; + method[KEY] = ID == 0 ? function freeze(it){ + return isObject(it) ? fn(it) : it; + } : ID == 1 ? function seal(it){ + return isObject(it) ? fn(it) : it; + } : ID == 2 ? function preventExtensions(it){ + return isObject(it) ? fn(it) : it; + } : ID == 3 ? function isFrozen(it){ + return isObject(it) ? fn(it) : true; + } : ID == 4 ? function isSealed(it){ + return isObject(it) ? fn(it) : true; + } : ID == 5 ? function isExtensible(it){ + return isObject(it) ? fn(it) : false; + } : ID == 6 ? function getOwnPropertyDescriptor(it, key){ + return fn(toObject(it), key); + } : ID == 7 ? function getPrototypeOf(it){ + return fn(Object($.assertDefined(it))); + } : ID == 8 ? function keys(it){ + return fn(toObject(it)); + } : require('./$.get-names').get; + try { + fn('z'); + } catch(e){ + forced = 1; + } + $def($def.S + $def.F * forced, 'Object', method); +}); +},{"./$":36,"./$.def":28,"./$.get-names":32}],49:[function(require,module,exports){ +'use strict'; +// 19.1.3.6 Object.prototype.toString() +var cof = require('./$.cof') + , tmp = {}; +tmp[require('./$.wks')('toStringTag')] = 'z'; +if(require('./$').FW && cof(tmp) != 'z'){ + require('./$.redef')(Object.prototype, 'toString', function toString(){ + return '[object ' + cof.classof(this) + ']'; + }, true); +} +},{"./$":36,"./$.cof":23,"./$.redef":38,"./$.wks":44}],50:[function(require,module,exports){ +var set = require('./$').set + , $at = require('./$.string-at')(true) + , ITER = require('./$.uid').safe('iter') + , $iter = require('./$.iter') + , step = $iter.step; + +// 21.1.3.27 String.prototype[@@iterator]() +require('./$.iter-define')(String, 'String', function(iterated){ + set(this, ITER, {o: String(iterated), i: 0}); +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function(){ + var iter = this[ITER] + , O = iter.o + , index = iter.i + , point; + if(index >= O.length)return step(1); + point = $at(O, index); + iter.i += point.length; + return step(0, point); +}); +},{"./$":36,"./$.iter":35,"./$.iter-define":34,"./$.string-at":41,"./$.uid":42}],51:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +require('./$.collection-to-json')('Map'); +},{"./$.collection-to-json":25}],52:[function(require,module,exports){ +require('./es6.array.iterator'); +var $ = require('./$') + , Iterators = require('./$.iter').Iterators + , ITERATOR = require('./$.wks')('iterator') + , ArrayValues = Iterators.Array + , NL = $.g.NodeList + , HTC = $.g.HTMLCollection + , NLProto = NL && NL.prototype + , HTCProto = HTC && HTC.prototype; +if($.FW){ + if(NL && !(ITERATOR in NLProto))$.hide(NLProto, ITERATOR, ArrayValues); + if(HTC && !(ITERATOR in HTCProto))$.hide(HTCProto, ITERATOR, ArrayValues); +} +Iterators.NodeList = Iterators.HTMLCollection = ArrayValues; +},{"./$":36,"./$.iter":35,"./$.wks":44,"./es6.array.iterator":45}],53:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; + +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; + + if (!this._events) + this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } + throw TypeError('Uncaught, unspecified "error" event.'); + } + } + + handler = this._events[type]; + + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + len = arguments.length; + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + handler.apply(this, args); + } + } else if (isObject(handler)) { + len = arguments.length; + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); + } + + return true; +}; + +EventEmitter.prototype.addListener = function(type, listener) { + var m; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events) + this._events = {}; + + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); + + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + var m; + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.listenerCount = function(emitter, type) { + var ret; + if (!emitter._events || !emitter._events[type]) + ret = 0; + else if (isFunction(emitter._events[type])) + ret = 1; + else + ret = emitter._events[type].length; + return ret; +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + +},{}],54:[function(require,module,exports){ +'use strict'; + +var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; + +exports.__esModule = true; + +var _import = require('./handlebars/base'); + +var base = _interopRequireWildcard(_import); + +// Each of these augment the Handlebars object. No need to setup here. +// (This is done to easily share code between commonjs and browse envs) + +var _SafeString = require('./handlebars/safe-string'); + +var _SafeString2 = _interopRequireWildcard(_SafeString); + +var _Exception = require('./handlebars/exception'); + +var _Exception2 = _interopRequireWildcard(_Exception); + +var _import2 = require('./handlebars/utils'); + +var Utils = _interopRequireWildcard(_import2); + +var _import3 = require('./handlebars/runtime'); + +var runtime = _interopRequireWildcard(_import3); + +var _noConflict = require('./handlebars/no-conflict'); + +var _noConflict2 = _interopRequireWildcard(_noConflict); + +// For compatibility and usage outside of module systems, make the Handlebars object a namespace +function create() { + var hb = new base.HandlebarsEnvironment(); + + Utils.extend(hb, base); + hb.SafeString = _SafeString2['default']; + hb.Exception = _Exception2['default']; + hb.Utils = Utils; + hb.escapeExpression = Utils.escapeExpression; + + hb.VM = runtime; + hb.template = function (spec) { + return runtime.template(spec, hb); + }; + + return hb; +} + +var inst = create(); +inst.create = create; + +_noConflict2['default'](inst); + +inst['default'] = inst; + +exports['default'] = inst; +module.exports = exports['default']; +},{"./handlebars/base":55,"./handlebars/exception":56,"./handlebars/no-conflict":57,"./handlebars/runtime":58,"./handlebars/safe-string":59,"./handlebars/utils":60}],55:[function(require,module,exports){ +'use strict'; + +var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; + +exports.__esModule = true; +exports.HandlebarsEnvironment = HandlebarsEnvironment; +exports.createFrame = createFrame; + +var _import = require('./utils'); + +var Utils = _interopRequireWildcard(_import); + +var _Exception = require('./exception'); + +var _Exception2 = _interopRequireWildcard(_Exception); + +var VERSION = '3.0.1'; +exports.VERSION = VERSION; +var COMPILER_REVISION = 6; + +exports.COMPILER_REVISION = COMPILER_REVISION; +var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '== 1.x.x', + 5: '== 2.0.0-alpha.x', + 6: '>= 2.0.0-beta.1' +}; + +exports.REVISION_CHANGES = REVISION_CHANGES; +var isArray = Utils.isArray, + isFunction = Utils.isFunction, + toString = Utils.toString, + objectType = '[object Object]'; + +function HandlebarsEnvironment(helpers, partials) { + this.helpers = helpers || {}; + this.partials = partials || {}; + + registerDefaultHelpers(this); +} + +HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: logger, + log: log, + + registerHelper: function registerHelper(name, fn) { + if (toString.call(name) === objectType) { + if (fn) { + throw new _Exception2['default']('Arg not supported with multiple helpers'); + } + Utils.extend(this.helpers, name); + } else { + this.helpers[name] = fn; + } + }, + unregisterHelper: function unregisterHelper(name) { + delete this.helpers[name]; + }, + + registerPartial: function registerPartial(name, partial) { + if (toString.call(name) === objectType) { + Utils.extend(this.partials, name); + } else { + if (typeof partial === 'undefined') { + throw new _Exception2['default']('Attempting to register a partial as undefined'); + } + this.partials[name] = partial; + } + }, + unregisterPartial: function unregisterPartial(name) { + delete this.partials[name]; + } +}; + +function registerDefaultHelpers(instance) { + instance.registerHelper('helperMissing', function () { + if (arguments.length === 1) { + // A missing field in a {{foo}} constuct. + return undefined; + } else { + // Someone is actually trying to call something, blow up. + throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); + } + }); + + instance.registerHelper('blockHelperMissing', function (context, options) { + var inverse = options.inverse, + fn = options.fn; + + if (context === true) { + return fn(this); + } else if (context === false || context == null) { + return inverse(this); + } else if (isArray(context)) { + if (context.length > 0) { + if (options.ids) { + options.ids = [options.name]; + } + + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); + options = { data: data }; + } + + return fn(context, options); + } + }); + + instance.registerHelper('each', function (context, options) { + if (!options) { + throw new _Exception2['default']('Must pass iterator to #each'); + } + + var fn = options.fn, + inverse = options.inverse, + i = 0, + ret = '', + data = undefined, + contextPath = undefined; + + if (options.data && options.ids) { + contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; + } + + if (isFunction(context)) { + context = context.call(this); + } + + if (options.data) { + data = createFrame(options.data); + } + + function execIteration(field, index, last) { + if (data) { + data.key = field; + data.index = index; + data.first = index === 0; + data.last = !!last; + + if (contextPath) { + data.contextPath = contextPath + field; + } + } + + ret = ret + fn(context[field], { + data: data, + blockParams: Utils.blockParams([context[field], field], [contextPath + field, null]) + }); + } + + if (context && typeof context === 'object') { + if (isArray(context)) { + for (var j = context.length; i < j; i++) { + execIteration(i, i, i === context.length - 1); + } + } else { + var priorKey = undefined; + + for (var key in context) { + if (context.hasOwnProperty(key)) { + // We're running the iterations one step out of sync so we can detect + // the last iteration without have to scan the object twice and create + // an itermediate keys array. + if (priorKey) { + execIteration(priorKey, i - 1); + } + priorKey = key; + i++; + } + } + if (priorKey) { + execIteration(priorKey, i - 1, true); + } + } + } + + if (i === 0) { + ret = inverse(this); + } + + return ret; + }); + + instance.registerHelper('if', function (conditional, options) { + if (isFunction(conditional)) { + conditional = conditional.call(this); + } + + // Default behavior is to render the positive path if the value is truthy and not empty. + // The `includeZero` option may be set to treat the condtional as purely not empty based on the + // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. + if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) { + return options.inverse(this); + } else { + return options.fn(this); + } + }); + + instance.registerHelper('unless', function (conditional, options) { + return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); + }); + + instance.registerHelper('with', function (context, options) { + if (isFunction(context)) { + context = context.call(this); + } + + var fn = options.fn; + + if (!Utils.isEmpty(context)) { + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); + options = { data: data }; + } + + return fn(context, options); + } else { + return options.inverse(this); + } + }); + + instance.registerHelper('log', function (message, options) { + var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; + instance.log(level, message); + }); + + instance.registerHelper('lookup', function (obj, field) { + return obj && obj[field]; + }); +} + +var logger = { + methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, + + // State enum + DEBUG: 0, + INFO: 1, + WARN: 2, + ERROR: 3, + level: 1, + + // Can be overridden in the host environment + log: function log(level, message) { + if (typeof console !== 'undefined' && logger.level <= level) { + var method = logger.methodMap[level]; + (console[method] || console.log).call(console, message); // eslint-disable-line no-console + } + } +}; + +exports.logger = logger; +var log = logger.log; + +exports.log = log; + +function createFrame(object) { + var frame = Utils.extend({}, object); + frame._parent = object; + return frame; +} + +/* [args, ]options */ +},{"./exception":56,"./utils":60}],56:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; + +var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + +function Exception(message, node) { + var loc = node && node.loc, + line = undefined, + column = undefined; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, Exception); + } + + if (loc) { + this.lineNumber = line; + this.column = column; + } +} + +Exception.prototype = new Error(); + +exports['default'] = Exception; +module.exports = exports['default']; +},{}],57:[function(require,module,exports){ +(function (global){ +'use strict'; + +exports.__esModule = true; +/*global window */ + +exports['default'] = function (Handlebars) { + /* istanbul ignore next */ + var root = typeof global !== 'undefined' ? global : window, + $Handlebars = root.Handlebars; + /* istanbul ignore next */ + Handlebars.noConflict = function () { + if (root.Handlebars === Handlebars) { + root.Handlebars = $Handlebars; + } + }; +}; + +module.exports = exports['default']; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],58:[function(require,module,exports){ +'use strict'; + +var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; + +exports.__esModule = true; +exports.checkRevision = checkRevision; + +// TODO: Remove this line and break up compilePartial + +exports.template = template; +exports.wrapProgram = wrapProgram; +exports.resolvePartial = resolvePartial; +exports.invokePartial = invokePartial; +exports.noop = noop; + +var _import = require('./utils'); + +var Utils = _interopRequireWildcard(_import); + +var _Exception = require('./exception'); + +var _Exception2 = _interopRequireWildcard(_Exception); + +var _COMPILER_REVISION$REVISION_CHANGES$createFrame = require('./base'); + +function checkRevision(compilerInfo) { + var compilerRevision = compilerInfo && compilerInfo[0] || 1, + currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION; + + if (compilerRevision !== currentRevision) { + if (compilerRevision < currentRevision) { + var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision], + compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision]; + throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); + } + } +} + +function template(templateSpec, env) { + /* istanbul ignore next */ + if (!env) { + throw new _Exception2['default']('No environment passed to template'); + } + if (!templateSpec || !templateSpec.main) { + throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec); + } + + // Note: Using env.VM references rather than local var references throughout this section to allow + // for external users to override these as psuedo-supported APIs. + env.VM.checkRevision(templateSpec.compiler); + + function invokePartialWrapper(partial, context, options) { + if (options.hash) { + context = Utils.extend({}, context, options.hash); + } + + partial = env.VM.resolvePartial.call(this, partial, context, options); + var result = env.VM.invokePartial.call(this, partial, context, options); + + if (result == null && env.compile) { + options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); + result = options.partials[options.name](context, options); + } + if (result != null) { + if (options.indent) { + var lines = result.split('\n'); + for (var i = 0, l = lines.length; i < l; i++) { + if (!lines[i] && i + 1 === l) { + break; + } + + lines[i] = options.indent + lines[i]; + } + result = lines.join('\n'); + } + return result; + } else { + throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); + } + } + + // Just add water + var container = { + strict: function strict(obj, name) { + if (!(name in obj)) { + throw new _Exception2['default']('"' + name + '" not defined in ' + obj); + } + return obj[name]; + }, + lookup: function lookup(depths, name) { + var len = depths.length; + for (var i = 0; i < len; i++) { + if (depths[i] && depths[i][name] != null) { + return depths[i][name]; + } + } + }, + lambda: function lambda(current, context) { + return typeof current === 'function' ? current.call(context) : current; + }, + + escapeExpression: Utils.escapeExpression, + invokePartial: invokePartialWrapper, + + fn: function fn(i) { + return templateSpec[i]; + }, + + programs: [], + program: function program(i, data, declaredBlockParams, blockParams, depths) { + var programWrapper = this.programs[i], + fn = this.fn(i); + if (data || depths || blockParams || declaredBlockParams) { + programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); + } else if (!programWrapper) { + programWrapper = this.programs[i] = wrapProgram(this, i, fn); + } + return programWrapper; + }, + + data: function data(value, depth) { + while (value && depth--) { + value = value._parent; + } + return value; + }, + merge: function merge(param, common) { + var obj = param || common; + + if (param && common && param !== common) { + obj = Utils.extend({}, common, param); + } + + return obj; + }, + + noop: env.VM.noop, + compilerInfo: templateSpec.compiler + }; + + function ret(context) { + var options = arguments[1] === undefined ? {} : arguments[1]; + + var data = options.data; + + ret._setup(options); + if (!options.partial && templateSpec.useData) { + data = initData(context, data); + } + var depths = undefined, + blockParams = templateSpec.useBlockParams ? [] : undefined; + if (templateSpec.useDepths) { + depths = options.depths ? [context].concat(options.depths) : [context]; + } + + return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths); + } + ret.isTop = true; + + ret._setup = function (options) { + if (!options.partial) { + container.helpers = container.merge(options.helpers, env.helpers); + + if (templateSpec.usePartial) { + container.partials = container.merge(options.partials, env.partials); + } + } else { + container.helpers = options.helpers; + container.partials = options.partials; + } + }; + + ret._child = function (i, data, blockParams, depths) { + if (templateSpec.useBlockParams && !blockParams) { + throw new _Exception2['default']('must pass block params'); + } + if (templateSpec.useDepths && !depths) { + throw new _Exception2['default']('must pass parent depths'); + } + + return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); + }; + return ret; +} + +function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { + function prog(context) { + var options = arguments[1] === undefined ? {} : arguments[1]; + + return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths)); + } + prog.program = i; + prog.depth = depths ? depths.length : 0; + prog.blockParams = declaredBlockParams || 0; + return prog; +} + +function resolvePartial(partial, context, options) { + if (!partial) { + partial = options.partials[options.name]; + } else if (!partial.call && !options.name) { + // This is a dynamic partial that returned a string + options.name = partial; + partial = options.partials[partial]; + } + return partial; +} + +function invokePartial(partial, context, options) { + options.partial = true; + + if (partial === undefined) { + throw new _Exception2['default']('The partial ' + options.name + ' could not be found'); + } else if (partial instanceof Function) { + return partial(context, options); + } +} + +function noop() { + return ''; +} + +function initData(context, data) { + if (!data || !('root' in data)) { + data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {}; + data.root = context; + } + return data; +} +},{"./base":55,"./exception":56,"./utils":60}],59:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; +// Build out our basic SafeString type +function SafeString(string) { + this.string = string; +} + +SafeString.prototype.toString = SafeString.prototype.toHTML = function () { + return '' + this.string; +}; + +exports['default'] = SafeString; +module.exports = exports['default']; +},{}],60:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; +exports.extend = extend; + +// Older IE versions do not directly support indexOf so we must implement our own, sadly. +exports.indexOf = indexOf; +exports.escapeExpression = escapeExpression; +exports.isEmpty = isEmpty; +exports.blockParams = blockParams; +exports.appendContextPath = appendContextPath; +var escape = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''', + '`': '`' +}; + +var badChars = /[&<>"'`]/g, + possible = /[&<>"'`]/; + +function escapeChar(chr) { + return escape[chr]; +} + +function extend(obj /* , ...source */) { + for (var i = 1; i < arguments.length; i++) { + for (var key in arguments[i]) { + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + obj[key] = arguments[i][key]; + } + } + } + + return obj; +} + +var toString = Object.prototype.toString; + +exports.toString = toString; +// Sourced from lodash +// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt +/*eslint-disable func-style, no-var */ +var isFunction = function isFunction(value) { + return typeof value === 'function'; +}; +// fallback for older versions of Chrome and Safari +/* istanbul ignore next */ +if (isFunction(/x/)) { + exports.isFunction = isFunction = function (value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; +} +var isFunction; +exports.isFunction = isFunction; +/*eslint-enable func-style, no-var */ + +/* istanbul ignore next */ +var isArray = Array.isArray || function (value) { + return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; +};exports.isArray = isArray; + +function indexOf(array, value) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + return -1; +} + +function escapeExpression(string) { + if (typeof string !== 'string') { + // don't escape SafeStrings, since they're already safe + if (string && string.toHTML) { + return string.toHTML(); + } else if (string == null) { + return ''; + } else if (!string) { + return string + ''; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = '' + string; + } + + if (!possible.test(string)) { + return string; + } + return string.replace(badChars, escapeChar); +} + +function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } +} + +function blockParams(params, ids) { + params.path = ids; + return params; +} + +function appendContextPath(contextPath, id) { + return (contextPath ? contextPath + '.' : '') + id; +} +},{}],61:[function(require,module,exports){ +// Create a simple path alias to allow browserify to resolve +// the runtime on a supported path. +module.exports = require('./dist/cjs/handlebars.runtime')['default']; + +},{"./dist/cjs/handlebars.runtime":54}],62:[function(require,module,exports){ +/** + * lodash 3.9.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** `Object#toString` result references. */ +var funcTag = '[object Function]'; + +/** Used to detect host constructors (Safari > 5). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var fnToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); +} + +module.exports = getNative; + +},{}],63:[function(require,module,exports){ +/** + * lodash 3.1.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var getNative = require('lodash._getnative'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeNow = getNative(Date, 'now'); + +/** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @category Date + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => logs the number of milliseconds it took for the deferred function to be invoked + */ +var now = nativeNow || function() { + return new Date().getTime(); +}; + +/** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed invocations. Provide an options object to indicate that `func` + * should be invoked on the leading and/or trailing edge of the `wait` timeout. + * Subsequent calls to the debounced function return the result of the last + * `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked + * on the trailing edge of the timeout only if the the debounced function is + * invoked more than once during the `wait` timeout. + * + * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options] The options object. + * @param {boolean} [options.leading=false] Specify invoking on the leading + * edge of the timeout. + * @param {number} [options.maxWait] The maximum time `func` is allowed to be + * delayed before it is invoked. + * @param {boolean} [options.trailing=true] Specify invoking on the trailing + * edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // avoid costly calculations while the window size is in flux + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // invoke `sendMail` when the click event is fired, debouncing subsequent calls + * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // ensure `batchLog` is invoked once after 1 second of debounced calls + * var source = new EventSource('/stream'); + * jQuery(source).on('message', _.debounce(batchLog, 250, { + * 'maxWait': 1000 + * })); + * + * // cancel a debounced call + * var todoChanges = _.debounce(batchLog, 1000); + * Object.observe(models.todo, todoChanges); + * + * Object.observe(models, function(changes) { + * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) { + * todoChanges.cancel(); + * } + * }, ['delete']); + * + * // ...at some point `models.todo` is changed + * models.todo.completed = true; + * + * // ...before 1 second has passed `models.todo` is deleted + * // which cancels the debounced `todoChanges` call + * delete models.todo; + */ +function debounce(func, wait, options) { + var args, + maxTimeoutId, + result, + stamp, + thisArg, + timeoutId, + trailingCall, + lastCalled = 0, + maxWait = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = wait < 0 ? 0 : (+wait || 0); + if (options === true) { + var leading = true; + trailing = false; + } else if (isObject(options)) { + leading = !!options.leading; + maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function cancel() { + if (timeoutId) { + clearTimeout(timeoutId); + } + if (maxTimeoutId) { + clearTimeout(maxTimeoutId); + } + lastCalled = 0; + maxTimeoutId = timeoutId = trailingCall = undefined; + } + + function complete(isCalled, id) { + if (id) { + clearTimeout(id); + } + maxTimeoutId = timeoutId = trailingCall = undefined; + if (isCalled) { + lastCalled = now(); + result = func.apply(thisArg, args); + if (!timeoutId && !maxTimeoutId) { + args = thisArg = undefined; + } + } + } + + function delayed() { + var remaining = wait - (now() - stamp); + if (remaining <= 0 || remaining > wait) { + complete(trailingCall, maxTimeoutId); + } else { + timeoutId = setTimeout(delayed, remaining); + } + } + + function maxDelayed() { + complete(trailing, timeoutId); + } + + function debounced() { + args = arguments; + stamp = now(); + thisArg = this; + trailingCall = trailing && (timeoutId || !leading); + + if (maxWait === false) { + var leadingCall = leading && !timeoutId; + } else { + if (!maxTimeoutId && !leading) { + lastCalled = stamp; + } + var remaining = maxWait - (stamp - lastCalled), + isCalled = remaining <= 0 || remaining > maxWait; + + if (isCalled) { + if (maxTimeoutId) { + maxTimeoutId = clearTimeout(maxTimeoutId); + } + lastCalled = stamp; + result = func.apply(thisArg, args); + } + else if (!maxTimeoutId) { + maxTimeoutId = setTimeout(maxDelayed, remaining); + } + } + if (isCalled && timeoutId) { + timeoutId = clearTimeout(timeoutId); + } + else if (!timeoutId && wait !== maxWait) { + timeoutId = setTimeout(delayed, wait); + } + if (leadingCall) { + isCalled = true; + result = func.apply(thisArg, args); + } + if (isCalled && !timeoutId && !maxTimeoutId) { + args = thisArg = undefined; + } + return result; + } + debounced.cancel = cancel; + return debounced; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +module.exports = debounce; + +},{"lodash._getnative":62}]},{},[2]) +//# sourceMappingURL=comicbook.js.map diff --git a/dist/comicbook.js.map b/dist/comicbook.js.map new file mode 100644 index 0000000..c8615a7 --- /dev/null +++ b/dist/comicbook.js.map @@ -0,0 +1,139 @@ +{ + "version": 3, + "sources": [ + "node_modules/browser-pack/_prelude.js", + "/Users/bala/dev/HTML5-Comic-Book-Reader/app/comic-book.js", + "/Users/bala/dev/HTML5-Comic-Book-Reader/app/index.js", + "/Users/bala/dev/HTML5-Comic-Book-Reader/app/view/canvas.js", + "/Users/bala/dev/HTML5-Comic-Book-Reader/app/view/load-indicator.js", + "/Users/bala/dev/HTML5-Comic-Book-Reader/app/view/progress-bar.js", + "app/view/template/progress-bar.handlebars", + "node_modules/babel-runtime/core-js/map.js", + "node_modules/babel-runtime/core-js/object/assign.js", + "node_modules/babel-runtime/core-js/object/create.js", + "node_modules/babel-runtime/core-js/object/define-property.js", + "node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js", + "node_modules/babel-runtime/helpers/class-call-check.js", + "node_modules/babel-runtime/helpers/create-class.js", + "node_modules/babel-runtime/helpers/get.js", + "node_modules/babel-runtime/helpers/inherits.js", + "node_modules/core-js/library/fn/map.js", + "node_modules/core-js/library/fn/object/assign.js", + "node_modules/core-js/library/fn/object/create.js", + "node_modules/core-js/library/fn/object/define-property.js", + "node_modules/core-js/library/fn/object/get-own-property-descriptor.js", + "node_modules/core-js/library/modules/$.assert.js", + "node_modules/core-js/library/modules/$.assign.js", + "node_modules/core-js/library/modules/$.cof.js", + "node_modules/core-js/library/modules/$.collection-strong.js", + "node_modules/core-js/library/modules/$.collection-to-json.js", + "node_modules/core-js/library/modules/$.collection.js", + "node_modules/core-js/library/modules/$.ctx.js", + "node_modules/core-js/library/modules/$.def.js", + "node_modules/core-js/library/modules/$.enum-keys.js", + "node_modules/core-js/library/modules/$.for-of.js", + "node_modules/core-js/library/modules/$.fw.js", + "node_modules/core-js/library/modules/$.get-names.js", + "node_modules/core-js/library/modules/$.iter-call.js", + "node_modules/core-js/library/modules/$.iter-define.js", + "node_modules/core-js/library/modules/$.iter.js", + "node_modules/core-js/library/modules/$.js", + "node_modules/core-js/library/modules/$.mix.js", + "node_modules/core-js/library/modules/$.redef.js", + "node_modules/core-js/library/modules/$.shared.js", + "node_modules/core-js/library/modules/$.species.js", + "node_modules/core-js/library/modules/$.string-at.js", + "node_modules/core-js/library/modules/$.uid.js", + "node_modules/core-js/library/modules/$.unscope.js", + "node_modules/core-js/library/modules/$.wks.js", + "node_modules/core-js/library/modules/es6.array.iterator.js", + "node_modules/core-js/library/modules/es6.map.js", + "node_modules/core-js/library/modules/es6.object.assign.js", + "node_modules/core-js/library/modules/es6.object.statics-accept-primitives.js", + "node_modules/core-js/library/modules/es6.object.to-string.js", + "node_modules/core-js/library/modules/es6.string.iterator.js", + "node_modules/core-js/library/modules/es7.map.to-json.js", + "node_modules/core-js/library/modules/web.dom.iterable.js", + "node_modules/events/events.js", + "node_modules/handlebars/dist/cjs/handlebars.runtime.js", + "node_modules/handlebars/dist/cjs/handlebars/base.js", + "node_modules/handlebars/dist/cjs/handlebars/exception.js", + "node_modules/handlebars/dist/cjs/handlebars/no-conflict.js", + "node_modules/handlebars/dist/cjs/handlebars/runtime.js", + "node_modules/handlebars/dist/cjs/handlebars/safe-string.js", + "node_modules/handlebars/dist/cjs/handlebars/utils.js", + "node_modules/handlebars/runtime.js", + "node_modules/lodash._getnative/index.js", + "node_modules/lodash.debounce/index.js" + ], + "names": [], + "mappings": "AAAA;;;;;;;;;;;;;;;ACAA,IAAI,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAA;AACjD,IAAI,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AACrC,IAAI,aAAa,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACpD,IAAI,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;;IAE1C,SAAS;YAAT,SAAS;;AAED,WAFR,SAAS,CAEA,IAAI,EAAO,OAAO,EAAE;QAApB,IAAI,gBAAJ,IAAI,GAAG,EAAE;;0BAFlB,SAAS;;AAGX,+BAHE,SAAS,6CAGJ;;AAEP,QAAI,CAAC,OAAO,GAAG,eAAc;;AAE3B,SAAG,EAAE,KAAK;AACV,gBAAU,EAAE,KAAK;KAClB,EAAE,OAAO,CAAC,CAAA;;;AAGX,QAAI,CAAC,IAAI,GAAG,IAAI,CAAA;;;AAGhB,QAAI,CAAC,KAAK,GAAG,UAAS,CAAA;;AAEtB,QAAI,CAAC,aAAa,GAAG,CAAC,CAAA;;;AAGtB,QAAI,CAAC,gBAAgB,GAAG,CAAC,CAAA;;AAEzB,QAAI,CAAC,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;AAC1B,QAAI,CAAC,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA;AACxC,QAAI,CAAC,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;;AAEpC,QAAI,CAAC,iBAAiB,EAAE,CAAA;GACzB;;eA3BG,SAAS;;WA6BK,6BAAG;AACnB,UAAI,CAAC,EAA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C,UAAU,CAAC,KAAK,CAAC,KAAK,GAAM,UAAU,MAAG,CAAA;KAC/C;;;WAEI,gBAAG;AACN,UAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAA;KAChC;;;WAEI,gBAAG;AACN,UAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA;KAC/B;;;SAvBG,WAAW;;;AA0BjB,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA;;;AC5B5B;AACA;AACA;;ACFA;;ACAA;;ACAA;;ACAA;;ACAA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;;ACDA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;AACA;;ACJA;;ACAA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;;ACLA;;ACAA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjHA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "file": "generated.js", + "sourceRoot": "", + "sourcesContent": [ + "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o= this.srcs.length) {\n startIndex = this.currentPageIndex\n }\n\n // reorder srcs to start from the requested index\n let _srcs = this.srcs.slice()\n let srcs = _srcs.splice(startIndex).concat(_srcs)\n\n this.currentPageIndex = startIndex\n\n srcs.forEach((src, pageIndex) => {\n\n // allow preload to be run multiple times without duplicating requests\n if (this.pages.has(pageIndex)) return\n\n let image = new window.Image()\n\n image.src = src\n image.onload = setImage.bind(this, image, pageIndex)\n\n function setImage (image, index) {\n this.pages.set(index, image)\n this.emit('preload:image', image)\n\n if (this.pages.size >= this.preloadBuffer && !this.pageRendered) {\n this.emit('preload:ready')\n }\n\n if (this.pages.size === this.srcs.length) {\n this.emit('preload:finish')\n }\n }\n })\n }\n\n updateProgressBar () {\n let percentage = Math.floor((this.pages.size / this.srcs.length) * 100)\n this.progressBar.update(percentage)\n }\n\n drawPage (pageIndex) {\n if (typeof pageIndex !== 'number') pageIndex = this.currentPageIndex\n\n let page = this.pages.get(pageIndex)\n\n // if the requested image hasn't been loaded yet, force another preload run\n if (!page) return this.preload(pageIndex)\n\n let args = [ page ]\n\n if (this.options.doublePage) {\n let page2Index = pageIndex + 1\n let page2 = this.pages.get(page2Index)\n\n if (page2Index <= (this.pages.size - 1) && !page2) {\n return this.preload(page2Index)\n }\n\n args.push(page2)\n\n if (this.options.rtl) {\n args.reverse()\n }\n }\n\n args.push(this.options)\n\n try {\n this.canvas.drawImage.apply(this.canvas, args)\n this.currentPageIndex = pageIndex\n this.pageRendered = true\n } catch (e) {\n if (e.message !== 'Invalid image') throw e\n }\n }\n\n drawNextPage () {\n let increment = this.options.doublePage ? 2 : 1\n let index = this.currentPageIndex + increment\n if (index >= this.pages.size) {\n index = this.pages.size - 1\n }\n this.drawPage(index)\n }\n\n drawPreviousPage () {\n let increment = this.options.doublePage ? 2 : 1\n let index = this.currentPageIndex - increment\n if (index < 0) index = 0\n this.drawPage(index)\n }\n}\n\nmodule.exports = ComicBook\n\n", + "let ComicBook = window.ComicBook = require('./comic-book')\nlet debounce = require('lodash.debounce')\nlet srcs = [\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_00.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_01.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_02.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_03.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_04.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_05.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_06.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_07.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_08.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_09.jpg',\n 'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_10.jpg'\n]\nlet comic = window.comic = new ComicBook(srcs, { doublePage: true })\n\ncomic.render().drawPage(5)\n\nwindow.addEventListener('resize', debounce(comic.drawPage.bind(comic), 100))\n\ndocument.addEventListener('DOMContentLoaded', () => {\n document.body.appendChild(comic.el)\n}, false)\n\n", + "let EventEmitter = require('events').EventEmitter\n\n// TODO replace\nfunction windowWidth () {\n return window.innerWidth\n}\n\nclass Canvas extends EventEmitter {\n\n constructor (options) {\n super()\n this.canvas = document.createElement('canvas')\n this.context = this.canvas.getContext('2d')\n }\n\n drawImage (page, page2, opts = {}) {\n this.emit('draw:start')\n\n if (page2 === null || !(page2 instanceof window.Image)) {\n opts = page2 || opts\n }\n\n let options = Object.assign({\n doublePage: false,\n zoomMode: 'fitWidth'\n }, opts)\n\n if (!(page instanceof window.Image) || (options.doublePage && page2 === null)) {\n throw new Error('Invalid image')\n }\n\n let zoomScale\n let offsetW = 0\n let offsetH = 0\n let width = page.width\n let height = page.height\n let doublePageMode = options.doublePage\n let canvasWidth\n let canvasHeight\n let pageWidth\n let pageHeight\n\n // reset the canvas to stop duplicate pages showing\n this.canvas.width = 0\n this.canvas.height = 0\n\n // show double page spreads on a single page\n let isDoublePageSpread = (\n page2 &&\n (page.width > page.height || page2.width > page2.height) &&\n doublePageMode\n )\n\n if (isDoublePageSpread) doublePageMode = false\n\n if (doublePageMode) {\n\n // for double page spreads, factor in the width of both pages\n if (page2 instanceof window.Image) {\n width += page2.width\n // if this is the last page and there is no page2, still keep the canvas wide\n } else {\n width += width\n }\n }\n\n // update the page this.scale if a non manual mode has been chosen\n switch (options.zoomMode) {\n\n case 'manual':\n document.body.style.overflowX = 'auto'\n zoomScale = (doublePageMode) ? this.scale * 2 : this.scale\n break\n\n case 'fitWidth':\n document.body.style.overflowX = 'hidden'\n\n // this.scale up if the window is wider than the page, scale down if the window\n // is narrower than the page\n zoomScale = (windowWidth() > width) ? ((windowWidth() - width) / windowWidth()) + 1 : windowWidth() / width\n this.scale = zoomScale\n break\n\n case 'fitWindow':\n document.body.style.overflowX = 'hidden'\n\n let widthScale = (windowWidth() > width)\n ? ((windowWidth() - width) / windowWidth()) + 1 // scale up if the window is wider than the page\n : windowWidth() / width // scale down if the window is narrower than the page\n let windowHeight = window.innerHeight\n let heightScale = (windowHeight > height)\n ? ((windowHeight - height) / windowHeight) + 1 // scale up if the window is wider than the page\n : windowHeight / height // scale down if the window is narrower than the page\n\n zoomScale = (widthScale > heightScale) ? heightScale : widthScale\n this.scale = zoomScale\n break\n }\n\n canvasWidth = page.width * zoomScale\n canvasHeight = page.height * zoomScale\n\n pageWidth = (options.zoomMode === 'manual') ? page.width * this.scale : canvasWidth\n pageHeight = (options.zoomMode === 'manual') ? page.height * this.scale : canvasHeight\n\n canvasHeight = pageHeight\n\n // make sure the canvas is always at least full screen, even if the page is narrower than the screen\n this.canvas.width = (canvasWidth < windowWidth()) ? windowWidth() : canvasWidth\n this.canvas.height = (canvasHeight < window.innerHeight) ? window.innerHeight : canvasHeight\n\n // always keep pages centered\n if (options.zoomMode === 'manual' || options.zoomMode === 'fitWindow') {\n\n // work out a horizontal position\n if (canvasWidth < windowWidth()) {\n offsetW = (windowWidth() - pageWidth) / 2\n if (options.doublePage) { offsetW = offsetW - pageWidth / 2 }\n }\n\n // work out a vertical position\n if (canvasHeight < window.innerHeight) {\n offsetH = (window.innerHeight - pageHeight) / 2\n }\n }\n\n // draw the page(s)\n this.context.drawImage(page, offsetW, offsetH, pageWidth, pageHeight)\n if (options.doublePage && typeof page2 === 'object') {\n this.context.drawImage(page2, pageWidth + offsetW, offsetH, pageWidth, pageHeight)\n }\n\n this.emit('draw:finish')\n }\n}\n\nmodule.exports = Canvas\n", + "let EventEmitter = require('events').EventEmitter\n\nclass LoadIndicator extends EventEmitter {\n constructor () {\n super()\n this.render().hide()\n }\n\n render () {\n this.el = document.createElement('div')\n this.el.id = 'cb-loading-overlay'\n return this\n }\n\n show () {\n this.el.style.display = 'block'\n this.emit('show', this)\n }\n\n hide () {\n this.el.style.display = 'none'\n this.emit('hide', this)\n }\n}\n\nmodule.exports = LoadIndicator\n\n", + "let template = require('./template/progress-bar.handlebars')\n\nclass ProgressBar {\n constructor () {\n this.createElements()\n this.hide()\n }\n\n createElements () {\n let el = document.createElement('div')\n el.innerHTML = template()\n this.el = el.firstChild\n this.progressEl = this.el.querySelector('.progressbar-value')\n }\n\n update (percentage) {\n this.progressEl.style.width = `${percentage}%`\n }\n\n show () {\n this.el.style.display = 'block'\n }\n\n hide () {\n this.el.style.display = 'none'\n }\n}\n\nmodule.exports = ProgressBar\n", + "var templater = require(\"handlebars/runtime\")[\"default\"].template;module.exports = templater({\"compiler\":[6,\">= 2.0.0-beta.1\"],\"main\":function(depth0,helpers,partials,data) {\n return \"
\\n\t
\\n\t\t
\\n\t
\\n
\\n\";\n},\"useData\":true});", + "module.exports = { \"default\": require(\"core-js/library/fn/map\"), __esModule: true };", + "module.exports = { \"default\": require(\"core-js/library/fn/object/assign\"), __esModule: true };", + "module.exports = { \"default\": require(\"core-js/library/fn/object/create\"), __esModule: true };", + "module.exports = { \"default\": require(\"core-js/library/fn/object/define-property\"), __esModule: true };", + "module.exports = { \"default\": require(\"core-js/library/fn/object/get-own-property-descriptor\"), __esModule: true };", + "\"use strict\";\n\nexports[\"default\"] = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nexports.__esModule = true;", + "\"use strict\";\n\nvar _Object$defineProperty = require(\"babel-runtime/core-js/object/define-property\")[\"default\"];\n\nexports[\"default\"] = (function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n\n _Object$defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n})();\n\nexports.__esModule = true;", + "\"use strict\";\n\nvar _Object$getOwnPropertyDescriptor = require(\"babel-runtime/core-js/object/get-own-property-descriptor\")[\"default\"];\n\nexports[\"default\"] = function get(_x, _x2, _x3) {\n var _again = true;\n\n _function: while (_again) {\n var object = _x,\n property = _x2,\n receiver = _x3;\n desc = parent = getter = undefined;\n _again = false;\n if (object === null) object = Function.prototype;\n\n var desc = _Object$getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n _x = parent;\n _x2 = property;\n _x3 = receiver;\n _again = true;\n continue _function;\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n }\n};\n\nexports.__esModule = true;", + "\"use strict\";\n\nvar _Object$create = require(\"babel-runtime/core-js/object/create\")[\"default\"];\n\nexports[\"default\"] = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = _Object$create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) subClass.__proto__ = superClass;\n};\n\nexports.__esModule = true;", + "require('../modules/es6.object.to-string');\nrequire('../modules/es6.string.iterator');\nrequire('../modules/web.dom.iterable');\nrequire('../modules/es6.map');\nrequire('../modules/es7.map.to-json');\nmodule.exports = require('../modules/$').core.Map;", + "require('../../modules/es6.object.assign');\nmodule.exports = require('../../modules/$').core.Object.assign;", + "var $ = require('../../modules/$');\nmodule.exports = function create(P, D){\n return $.create(P, D);\n};", + "var $ = require('../../modules/$');\nmodule.exports = function defineProperty(it, key, desc){\n return $.setDesc(it, key, desc);\n};", + "var $ = require('../../modules/$');\nrequire('../../modules/es6.object.statics-accept-primitives');\nmodule.exports = function getOwnPropertyDescriptor(it, key){\n return $.getDesc(it, key);\n};", + "var $ = require('./$');\nfunction assert(condition, msg1, msg2){\n if(!condition)throw TypeError(msg2 ? msg1 + msg2 : msg1);\n}\nassert.def = $.assertDefined;\nassert.fn = function(it){\n if(!$.isFunction(it))throw TypeError(it + ' is not a function!');\n return it;\n};\nassert.obj = function(it){\n if(!$.isObject(it))throw TypeError(it + ' is not an object!');\n return it;\n};\nassert.inst = function(it, Constructor, name){\n if(!(it instanceof Constructor))throw TypeError(name + \": use the 'new' operator!\");\n return it;\n};\nmodule.exports = assert;", + "var $ = require('./$')\n , enumKeys = require('./$.enum-keys');\n// 19.1.2.1 Object.assign(target, source, ...)\n/* eslint-disable no-unused-vars */\nmodule.exports = Object.assign || function assign(target, source){\n/* eslint-enable no-unused-vars */\n var T = Object($.assertDefined(target))\n , l = arguments.length\n , i = 1;\n while(l > i){\n var S = $.ES5Object(arguments[i++])\n , keys = enumKeys(S)\n , length = keys.length\n , j = 0\n , key;\n while(length > j)T[key = keys[j++]] = S[key];\n }\n return T;\n};", + "var $ = require('./$')\n , TAG = require('./$.wks')('toStringTag')\n , toString = {}.toString;\nfunction cof(it){\n return toString.call(it).slice(8, -1);\n}\ncof.classof = function(it){\n var O, T;\n return it == undefined ? it === undefined ? 'Undefined' : 'Null'\n : typeof (T = (O = Object(it))[TAG]) == 'string' ? T : cof(O);\n};\ncof.set = function(it, tag, stat){\n if(it && !$.has(it = stat ? it : it.prototype, TAG))$.hide(it, TAG, tag);\n};\nmodule.exports = cof;", + "'use strict';\nvar $ = require('./$')\n , ctx = require('./$.ctx')\n , safe = require('./$.uid').safe\n , assert = require('./$.assert')\n , forOf = require('./$.for-of')\n , step = require('./$.iter').step\n , $has = $.has\n , set = $.set\n , isObject = $.isObject\n , hide = $.hide\n , isExtensible = Object.isExtensible || isObject\n , ID = safe('id')\n , O1 = safe('O1')\n , LAST = safe('last')\n , FIRST = safe('first')\n , ITER = safe('iter')\n , SIZE = $.DESC ? safe('size') : 'size'\n , id = 0;\n\nfunction fastKey(it, create){\n // return primitive with prefix\n if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if(!$has(it, ID)){\n // can't set id to frozen object\n if(!isExtensible(it))return 'F';\n // not necessary to add id\n if(!create)return 'E';\n // add missing object id\n hide(it, ID, ++id);\n // return object id with prefix\n } return 'O' + it[ID];\n}\n\nfunction getEntry(that, key){\n // fast case\n var index = fastKey(key), entry;\n if(index !== 'F')return that[O1][index];\n // frozen object case\n for(entry = that[FIRST]; entry; entry = entry.n){\n if(entry.k == key)return entry;\n }\n}\n\nmodule.exports = {\n getConstructor: function(wrapper, NAME, IS_MAP, ADDER){\n var C = wrapper(function(that, iterable){\n assert.inst(that, C, NAME);\n set(that, O1, $.create(null));\n set(that, SIZE, 0);\n set(that, LAST, undefined);\n set(that, FIRST, undefined);\n if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);\n });\n require('./$.mix')(C.prototype, {\n // 23.1.3.1 Map.prototype.clear()\n // 23.2.3.2 Set.prototype.clear()\n clear: function clear(){\n for(var that = this, data = that[O1], entry = that[FIRST]; entry; entry = entry.n){\n entry.r = true;\n if(entry.p)entry.p = entry.p.n = undefined;\n delete data[entry.i];\n }\n that[FIRST] = that[LAST] = undefined;\n that[SIZE] = 0;\n },\n // 23.1.3.3 Map.prototype.delete(key)\n // 23.2.3.4 Set.prototype.delete(value)\n 'delete': function(key){\n var that = this\n , entry = getEntry(that, key);\n if(entry){\n var next = entry.n\n , prev = entry.p;\n delete that[O1][entry.i];\n entry.r = true;\n if(prev)prev.n = next;\n if(next)next.p = prev;\n if(that[FIRST] == entry)that[FIRST] = next;\n if(that[LAST] == entry)that[LAST] = prev;\n that[SIZE]--;\n } return !!entry;\n },\n // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)\n // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)\n forEach: function forEach(callbackfn /*, that = undefined */){\n var f = ctx(callbackfn, arguments[1], 3)\n , entry;\n while(entry = entry ? entry.n : this[FIRST]){\n f(entry.v, entry.k, this);\n // revert to the last existing entry\n while(entry && entry.r)entry = entry.p;\n }\n },\n // 23.1.3.7 Map.prototype.has(key)\n // 23.2.3.7 Set.prototype.has(value)\n has: function has(key){\n return !!getEntry(this, key);\n }\n });\n if($.DESC)$.setDesc(C.prototype, 'size', {\n get: function(){\n return assert.def(this[SIZE]);\n }\n });\n return C;\n },\n def: function(that, key, value){\n var entry = getEntry(that, key)\n , prev, index;\n // change existing entry\n if(entry){\n entry.v = value;\n // create new entry\n } else {\n that[LAST] = entry = {\n i: index = fastKey(key, true), // <- index\n k: key, // <- key\n v: value, // <- value\n p: prev = that[LAST], // <- previous entry\n n: undefined, // <- next entry\n r: false // <- removed\n };\n if(!that[FIRST])that[FIRST] = entry;\n if(prev)prev.n = entry;\n that[SIZE]++;\n // add to index\n if(index !== 'F')that[O1][index] = entry;\n } return that;\n },\n getEntry: getEntry,\n // add .keys, .values, .entries, [@@iterator]\n // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11\n setIter: function(C, NAME, IS_MAP){\n require('./$.iter-define')(C, NAME, function(iterated, kind){\n set(this, ITER, {o: iterated, k: kind});\n }, function(){\n var iter = this[ITER]\n , kind = iter.k\n , entry = iter.l;\n // revert to the last existing entry\n while(entry && entry.r)entry = entry.p;\n // get next entry\n if(!iter.o || !(iter.l = entry = entry ? entry.n : iter.o[FIRST])){\n // or finish the iteration\n iter.o = undefined;\n return step(1);\n }\n // return step by kind\n if(kind == 'keys' )return step(0, entry.k);\n if(kind == 'values')return step(0, entry.v);\n return step(0, [entry.k, entry.v]);\n }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);\n }\n};", + "// https://github.com/DavidBruant/Map-Set.prototype.toJSON\nvar $def = require('./$.def')\n , forOf = require('./$.for-of');\nmodule.exports = function(NAME){\n $def($def.P, NAME, {\n toJSON: function toJSON(){\n var arr = [];\n forOf(this, false, arr.push, arr);\n return arr;\n }\n });\n};", + "'use strict';\nvar $ = require('./$')\n , $def = require('./$.def')\n , $iter = require('./$.iter')\n , BUGGY = $iter.BUGGY\n , forOf = require('./$.for-of')\n , assertInstance = require('./$.assert').inst\n , INTERNAL = require('./$.uid').safe('internal');\n\nmodule.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){\n var Base = $.g[NAME]\n , C = Base\n , ADDER = IS_MAP ? 'set' : 'add'\n , proto = C && C.prototype\n , O = {};\n if(!$.DESC || !$.isFunction(C) || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){\n // create collection constructor\n C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);\n require('./$.mix')(C.prototype, methods);\n } else {\n C = wrapper(function(target, iterable){\n assertInstance(target, C, NAME);\n target[INTERNAL] = new Base;\n if(iterable != undefined)forOf(iterable, IS_MAP, target[ADDER], target);\n });\n $.each.call('add,clear,delete,forEach,get,has,set,keys,values,entries'.split(','),function(KEY){\n var chain = KEY == 'add' || KEY == 'set';\n if(KEY in proto)$.hide(C.prototype, KEY, function(a, b){\n var result = this[INTERNAL][KEY](a === 0 ? 0 : a, b);\n return chain ? this : result;\n });\n });\n if('size' in proto)$.setDesc(C.prototype, 'size', {\n get: function(){\n return this[INTERNAL].size;\n }\n });\n }\n\n require('./$.cof').set(C, NAME);\n\n O[NAME] = C;\n $def($def.G + $def.W + $def.F, O);\n require('./$.species')(C);\n\n if(!IS_WEAK)common.setIter(C, NAME, IS_MAP);\n\n return C;\n};", + "// Optional / simple context binding\nvar assertFunction = require('./$.assert').fn;\nmodule.exports = function(fn, that, length){\n assertFunction(fn);\n if(~length && that === undefined)return fn;\n switch(length){\n case 1: return function(a){\n return fn.call(that, a);\n };\n case 2: return function(a, b){\n return fn.call(that, a, b);\n };\n case 3: return function(a, b, c){\n return fn.call(that, a, b, c);\n };\n } return function(/* ...args */){\n return fn.apply(that, arguments);\n };\n};", + "var $ = require('./$')\n , global = $.g\n , core = $.core\n , isFunction = $.isFunction;\nfunction ctx(fn, that){\n return function(){\n return fn.apply(that, arguments);\n };\n}\n// type bitmap\n$def.F = 1; // forced\n$def.G = 2; // global\n$def.S = 4; // static\n$def.P = 8; // proto\n$def.B = 16; // bind\n$def.W = 32; // wrap\nfunction $def(type, name, source){\n var key, own, out, exp\n , isGlobal = type & $def.G\n , isProto = type & $def.P\n , target = isGlobal ? global : type & $def.S\n ? global[name] : (global[name] || {}).prototype\n , exports = isGlobal ? core : core[name] || (core[name] = {});\n if(isGlobal)source = name;\n for(key in source){\n // contains in native\n own = !(type & $def.F) && target && key in target;\n if(own && key in exports)continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n if(isGlobal && !isFunction(target[key]))exp = source[key];\n // bind timers to global for call from export context\n else if(type & $def.B && own)exp = ctx(out, global);\n // wrap global constructors for prevent change them in library\n else if(type & $def.W && target[key] == out)!function(C){\n exp = function(param){\n return this instanceof C ? new C(param) : C(param);\n };\n exp.prototype = C.prototype;\n }(out);\n else exp = isProto && isFunction(out) ? ctx(Function.call, out) : out;\n // export\n exports[key] = exp;\n if(isProto)(exports.prototype || (exports.prototype = {}))[key] = out;\n }\n}\nmodule.exports = $def;", + "var $ = require('./$');\nmodule.exports = function(it){\n var keys = $.getKeys(it)\n , getDesc = $.getDesc\n , getSymbols = $.getSymbols;\n if(getSymbols)$.each.call(getSymbols(it), function(key){\n if(getDesc(it, key).enumerable)keys.push(key);\n });\n return keys;\n};", + "var ctx = require('./$.ctx')\n , get = require('./$.iter').get\n , call = require('./$.iter-call');\nmodule.exports = function(iterable, entries, fn, that){\n var iterator = get(iterable)\n , f = ctx(fn, that, entries ? 2 : 1)\n , step;\n while(!(step = iterator.next()).done){\n if(call(iterator, f, step.value, entries) === false){\n return call.close(iterator);\n }\n }\n};", + "module.exports = function($){\n $.FW = false;\n $.path = $.core;\n return $;\n};", + "// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\r\nvar $ = require('./$')\r\n , toString = {}.toString\r\n , getNames = $.getNames;\r\n\r\nvar windowNames = typeof window == 'object' && Object.getOwnPropertyNames\r\n ? Object.getOwnPropertyNames(window) : [];\r\n\r\nfunction getWindowNames(it){\r\n try {\r\n return getNames(it);\r\n } catch(e){\r\n return windowNames.slice();\r\n }\r\n}\r\n\r\nmodule.exports.get = function getOwnPropertyNames(it){\r\n if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it);\r\n return getNames($.toObject(it));\r\n};", + "var assertObject = require('./$.assert').obj;\nfunction close(iterator){\n var ret = iterator['return'];\n if(ret !== undefined)assertObject(ret.call(iterator));\n}\nfunction call(iterator, fn, value, entries){\n try {\n return entries ? fn(assertObject(value)[0], value[1]) : fn(value);\n } catch(e){\n close(iterator);\n throw e;\n }\n}\ncall.close = close;\nmodule.exports = call;", + "var $def = require('./$.def')\n , $redef = require('./$.redef')\n , $ = require('./$')\n , cof = require('./$.cof')\n , $iter = require('./$.iter')\n , SYMBOL_ITERATOR = require('./$.wks')('iterator')\n , FF_ITERATOR = '@@iterator'\n , KEYS = 'keys'\n , VALUES = 'values'\n , Iterators = $iter.Iterators;\nmodule.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){\n $iter.create(Constructor, NAME, next);\n function createMethod(kind){\n function $$(that){\n return new Constructor(that, kind);\n }\n switch(kind){\n case KEYS: return function keys(){ return $$(this); };\n case VALUES: return function values(){ return $$(this); };\n } return function entries(){ return $$(this); };\n }\n var TAG = NAME + ' Iterator'\n , proto = Base.prototype\n , _native = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]\n , _default = _native || createMethod(DEFAULT)\n , methods, key;\n // Fix native\n if(_native){\n var IteratorPrototype = $.getProto(_default.call(new Base));\n // Set @@toStringTag to native iterators\n cof.set(IteratorPrototype, TAG, true);\n // FF fix\n if($.FW && $.has(proto, FF_ITERATOR))$iter.set(IteratorPrototype, $.that);\n }\n // Define iterator\n if($.FW || FORCE)$iter.set(proto, _default);\n // Plug for library\n Iterators[NAME] = _default;\n Iterators[TAG] = $.that;\n if(DEFAULT){\n methods = {\n keys: IS_SET ? _default : createMethod(KEYS),\n values: DEFAULT == VALUES ? _default : createMethod(VALUES),\n entries: DEFAULT != VALUES ? _default : createMethod('entries')\n };\n if(FORCE)for(key in methods){\n if(!(key in proto))$redef(proto, key, methods[key]);\n } else $def($def.P + $def.F * $iter.BUGGY, NAME, methods);\n }\n};", + "'use strict';\nvar $ = require('./$')\n , cof = require('./$.cof')\n , classof = cof.classof\n , assert = require('./$.assert')\n , assertObject = assert.obj\n , SYMBOL_ITERATOR = require('./$.wks')('iterator')\n , FF_ITERATOR = '@@iterator'\n , Iterators = require('./$.shared')('iterators')\n , IteratorPrototype = {};\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nsetIterator(IteratorPrototype, $.that);\nfunction setIterator(O, value){\n $.hide(O, SYMBOL_ITERATOR, value);\n // Add iterator for FF iterator protocol\n if(FF_ITERATOR in [])$.hide(O, FF_ITERATOR, value);\n}\n\nmodule.exports = {\n // Safari has buggy iterators w/o `next`\n BUGGY: 'keys' in [] && !('next' in [].keys()),\n Iterators: Iterators,\n step: function(done, value){\n return {value: value, done: !!done};\n },\n is: function(it){\n var O = Object(it)\n , Symbol = $.g.Symbol;\n return (Symbol && Symbol.iterator || FF_ITERATOR) in O\n || SYMBOL_ITERATOR in O\n || $.has(Iterators, classof(O));\n },\n get: function(it){\n var Symbol = $.g.Symbol\n , getIter;\n if(it != undefined){\n getIter = it[Symbol && Symbol.iterator || FF_ITERATOR]\n || it[SYMBOL_ITERATOR]\n || Iterators[classof(it)];\n }\n assert($.isFunction(getIter), it, ' is not iterable!');\n return assertObject(getIter.call(it));\n },\n set: setIterator,\n create: function(Constructor, NAME, next, proto){\n Constructor.prototype = $.create(proto || IteratorPrototype, {next: $.desc(1, next)});\n cof.set(Constructor, NAME + ' Iterator');\n }\n};", + "'use strict';\nvar global = typeof self != 'undefined' ? self : Function('return this')()\n , core = {}\n , defineProperty = Object.defineProperty\n , hasOwnProperty = {}.hasOwnProperty\n , ceil = Math.ceil\n , floor = Math.floor\n , max = Math.max\n , min = Math.min;\n// The engine works fine with descriptors? Thank's IE8 for his funny defineProperty.\nvar DESC = !!function(){\n try {\n return defineProperty({}, 'a', {get: function(){ return 2; }}).a == 2;\n } catch(e){ /* empty */ }\n}();\nvar hide = createDefiner(1);\n// 7.1.4 ToInteger\nfunction toInteger(it){\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n}\nfunction desc(bitmap, value){\n return {\n enumerable : !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable : !(bitmap & 4),\n value : value\n };\n}\nfunction simpleSet(object, key, value){\n object[key] = value;\n return object;\n}\nfunction createDefiner(bitmap){\n return DESC ? function(object, key, value){\n return $.setDesc(object, key, desc(bitmap, value));\n } : simpleSet;\n}\n\nfunction isObject(it){\n return it !== null && (typeof it == 'object' || typeof it == 'function');\n}\nfunction isFunction(it){\n return typeof it == 'function';\n}\nfunction assertDefined(it){\n if(it == undefined)throw TypeError(\"Can't call method on \" + it);\n return it;\n}\n\nvar $ = module.exports = require('./$.fw')({\n g: global,\n core: core,\n html: global.document && document.documentElement,\n // http://jsperf.com/core-js-isobject\n isObject: isObject,\n isFunction: isFunction,\n that: function(){\n return this;\n },\n // 7.1.4 ToInteger\n toInteger: toInteger,\n // 7.1.15 ToLength\n toLength: function(it){\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n },\n toIndex: function(index, length){\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n },\n has: function(it, key){\n return hasOwnProperty.call(it, key);\n },\n create: Object.create,\n getProto: Object.getPrototypeOf,\n DESC: DESC,\n desc: desc,\n getDesc: Object.getOwnPropertyDescriptor,\n setDesc: defineProperty,\n setDescs: Object.defineProperties,\n getKeys: Object.keys,\n getNames: Object.getOwnPropertyNames,\n getSymbols: Object.getOwnPropertySymbols,\n assertDefined: assertDefined,\n // Dummy, fix for not array-like ES3 string in es5 module\n ES5Object: Object,\n toObject: function(it){\n return $.ES5Object(assertDefined(it));\n },\n hide: hide,\n def: createDefiner(0),\n set: global.Symbol ? simpleSet : hide,\n each: [].forEach\n});\n/* eslint-disable no-undef */\nif(typeof __e != 'undefined')__e = core;\nif(typeof __g != 'undefined')__g = global;", + "var $redef = require('./$.redef');\r\nmodule.exports = function(target, src){\r\n for(var key in src)$redef(target, key, src[key]);\r\n return target;\r\n};", + "module.exports = require('./$').hide;", + "var $ = require('./$')\r\n , SHARED = '__core-js_shared__'\r\n , store = $.g[SHARED] || ($.g[SHARED] = {});\r\nmodule.exports = function(key){\r\n return store[key] || (store[key] = {});\r\n};", + "var $ = require('./$')\n , SPECIES = require('./$.wks')('species');\nmodule.exports = function(C){\n if($.DESC && !(SPECIES in C))$.setDesc(C, SPECIES, {\n configurable: true,\n get: $.that\n });\n};", + "// true -> String#at\n// false -> String#codePointAt\nvar $ = require('./$');\nmodule.exports = function(TO_STRING){\n return function(that, pos){\n var s = String($.assertDefined(that))\n , i = $.toInteger(pos)\n , l = s.length\n , a, b;\n if(i < 0 || i >= l)return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l\n || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};", + "var sid = 0;\nfunction uid(key){\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++sid + Math.random()).toString(36));\n}\nuid.safe = require('./$').g.Symbol || uid;\nmodule.exports = uid;", + "module.exports = function(){ /* empty */ };", + "var global = require('./$').g\n , store = require('./$.shared')('wks');\nmodule.exports = function(name){\n return store[name] || (store[name] =\n global.Symbol && global.Symbol[name] || require('./$.uid').safe('Symbol.' + name));\n};", + "var $ = require('./$')\n , setUnscope = require('./$.unscope')\n , ITER = require('./$.uid').safe('iter')\n , $iter = require('./$.iter')\n , step = $iter.step\n , Iterators = $iter.Iterators;\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nrequire('./$.iter-define')(Array, 'Array', function(iterated, kind){\n $.set(this, ITER, {o: $.toObject(iterated), i: 0, k: kind});\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function(){\n var iter = this[ITER]\n , O = iter.o\n , kind = iter.k\n , index = iter.i++;\n if(!O || index >= O.length){\n iter.o = undefined;\n return step(1);\n }\n if(kind == 'keys' )return step(0, index);\n if(kind == 'values')return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\nsetUnscope('keys');\nsetUnscope('values');\nsetUnscope('entries');", + "'use strict';\nvar strong = require('./$.collection-strong');\n\n// 23.1 Map Objects\nrequire('./$.collection')('Map', function(get){\n return function Map(){ return get(this, arguments[0]); };\n}, {\n // 23.1.3.6 Map.prototype.get(key)\n get: function get(key){\n var entry = strong.getEntry(this, key);\n return entry && entry.v;\n },\n // 23.1.3.9 Map.prototype.set(key, value)\n set: function set(key, value){\n return strong.def(this, key === 0 ? 0 : key, value);\n }\n}, strong, true);", + "// 19.1.3.1 Object.assign(target, source)\nvar $def = require('./$.def');\n$def($def.S, 'Object', {assign: require('./$.assign')});", + "var $ = require('./$')\n , $def = require('./$.def')\n , isObject = $.isObject\n , toObject = $.toObject;\n$.each.call(('freeze,seal,preventExtensions,isFrozen,isSealed,isExtensible,' +\n 'getOwnPropertyDescriptor,getPrototypeOf,keys,getOwnPropertyNames').split(',')\n, function(KEY, ID){\n var fn = ($.core.Object || {})[KEY] || Object[KEY]\n , forced = 0\n , method = {};\n method[KEY] = ID == 0 ? function freeze(it){\n return isObject(it) ? fn(it) : it;\n } : ID == 1 ? function seal(it){\n return isObject(it) ? fn(it) : it;\n } : ID == 2 ? function preventExtensions(it){\n return isObject(it) ? fn(it) : it;\n } : ID == 3 ? function isFrozen(it){\n return isObject(it) ? fn(it) : true;\n } : ID == 4 ? function isSealed(it){\n return isObject(it) ? fn(it) : true;\n } : ID == 5 ? function isExtensible(it){\n return isObject(it) ? fn(it) : false;\n } : ID == 6 ? function getOwnPropertyDescriptor(it, key){\n return fn(toObject(it), key);\n } : ID == 7 ? function getPrototypeOf(it){\n return fn(Object($.assertDefined(it)));\n } : ID == 8 ? function keys(it){\n return fn(toObject(it));\n } : require('./$.get-names').get;\n try {\n fn('z');\n } catch(e){\n forced = 1;\n }\n $def($def.S + $def.F * forced, 'Object', method);\n});", + "'use strict';\n// 19.1.3.6 Object.prototype.toString()\nvar cof = require('./$.cof')\n , tmp = {};\ntmp[require('./$.wks')('toStringTag')] = 'z';\nif(require('./$').FW && cof(tmp) != 'z'){\n require('./$.redef')(Object.prototype, 'toString', function toString(){\n return '[object ' + cof.classof(this) + ']';\n }, true);\n}", + "var set = require('./$').set\n , $at = require('./$.string-at')(true)\n , ITER = require('./$.uid').safe('iter')\n , $iter = require('./$.iter')\n , step = $iter.step;\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./$.iter-define')(String, 'String', function(iterated){\n set(this, ITER, {o: String(iterated), i: 0});\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function(){\n var iter = this[ITER]\n , O = iter.o\n , index = iter.i\n , point;\n if(index >= O.length)return step(1);\n point = $at(O, index);\n iter.i += point.length;\n return step(0, point);\n});", + "// https://github.com/DavidBruant/Map-Set.prototype.toJSON\nrequire('./$.collection-to-json')('Map');", + "require('./es6.array.iterator');\nvar $ = require('./$')\n , Iterators = require('./$.iter').Iterators\n , ITERATOR = require('./$.wks')('iterator')\n , ArrayValues = Iterators.Array\n , NL = $.g.NodeList\n , HTC = $.g.HTMLCollection\n , NLProto = NL && NL.prototype\n , HTCProto = HTC && HTC.prototype;\nif($.FW){\n if(NL && !(ITERATOR in NLProto))$.hide(NLProto, ITERATOR, ArrayValues);\n if(HTC && !(ITERATOR in HTCProto))$.hide(HTCProto, ITERATOR, ArrayValues);\n}\nIterators.NodeList = Iterators.HTMLCollection = ArrayValues;", + "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n }\n throw TypeError('Uncaught, unspecified \"error\" event.');\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n len = arguments.length;\n args = new Array(len - 1);\n for (i = 1; i < len; i++)\n args[i - 1] = arguments[i];\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n len = arguments.length;\n args = new Array(len - 1);\n for (i = 1; i < len; i++)\n args[i - 1] = arguments[i];\n\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n var m;\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n var ret;\n if (!emitter._events || !emitter._events[type])\n ret = 0;\n else if (isFunction(emitter._events[type]))\n ret = 1;\n else\n ret = emitter._events[type].length;\n return ret;\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n", + "'use strict';\n\nvar _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };\n\nexports.__esModule = true;\n\nvar _import = require('./handlebars/base');\n\nvar base = _interopRequireWildcard(_import);\n\n// Each of these augment the Handlebars object. No need to setup here.\n// (This is done to easily share code between commonjs and browse envs)\n\nvar _SafeString = require('./handlebars/safe-string');\n\nvar _SafeString2 = _interopRequireWildcard(_SafeString);\n\nvar _Exception = require('./handlebars/exception');\n\nvar _Exception2 = _interopRequireWildcard(_Exception);\n\nvar _import2 = require('./handlebars/utils');\n\nvar Utils = _interopRequireWildcard(_import2);\n\nvar _import3 = require('./handlebars/runtime');\n\nvar runtime = _interopRequireWildcard(_import3);\n\nvar _noConflict = require('./handlebars/no-conflict');\n\nvar _noConflict2 = _interopRequireWildcard(_noConflict);\n\n// For compatibility and usage outside of module systems, make the Handlebars object a namespace\nfunction create() {\n var hb = new base.HandlebarsEnvironment();\n\n Utils.extend(hb, base);\n hb.SafeString = _SafeString2['default'];\n hb.Exception = _Exception2['default'];\n hb.Utils = Utils;\n hb.escapeExpression = Utils.escapeExpression;\n\n hb.VM = runtime;\n hb.template = function (spec) {\n return runtime.template(spec, hb);\n };\n\n return hb;\n}\n\nvar inst = create();\ninst.create = create;\n\n_noConflict2['default'](inst);\n\ninst['default'] = inst;\n\nexports['default'] = inst;\nmodule.exports = exports['default'];", + "'use strict';\n\nvar _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };\n\nexports.__esModule = true;\nexports.HandlebarsEnvironment = HandlebarsEnvironment;\nexports.createFrame = createFrame;\n\nvar _import = require('./utils');\n\nvar Utils = _interopRequireWildcard(_import);\n\nvar _Exception = require('./exception');\n\nvar _Exception2 = _interopRequireWildcard(_Exception);\n\nvar VERSION = '3.0.1';\nexports.VERSION = VERSION;\nvar COMPILER_REVISION = 6;\n\nexports.COMPILER_REVISION = COMPILER_REVISION;\nvar REVISION_CHANGES = {\n 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it\n 2: '== 1.0.0-rc.3',\n 3: '== 1.0.0-rc.4',\n 4: '== 1.x.x',\n 5: '== 2.0.0-alpha.x',\n 6: '>= 2.0.0-beta.1'\n};\n\nexports.REVISION_CHANGES = REVISION_CHANGES;\nvar isArray = Utils.isArray,\n isFunction = Utils.isFunction,\n toString = Utils.toString,\n objectType = '[object Object]';\n\nfunction HandlebarsEnvironment(helpers, partials) {\n this.helpers = helpers || {};\n this.partials = partials || {};\n\n registerDefaultHelpers(this);\n}\n\nHandlebarsEnvironment.prototype = {\n constructor: HandlebarsEnvironment,\n\n logger: logger,\n log: log,\n\n registerHelper: function registerHelper(name, fn) {\n if (toString.call(name) === objectType) {\n if (fn) {\n throw new _Exception2['default']('Arg not supported with multiple helpers');\n }\n Utils.extend(this.helpers, name);\n } else {\n this.helpers[name] = fn;\n }\n },\n unregisterHelper: function unregisterHelper(name) {\n delete this.helpers[name];\n },\n\n registerPartial: function registerPartial(name, partial) {\n if (toString.call(name) === objectType) {\n Utils.extend(this.partials, name);\n } else {\n if (typeof partial === 'undefined') {\n throw new _Exception2['default']('Attempting to register a partial as undefined');\n }\n this.partials[name] = partial;\n }\n },\n unregisterPartial: function unregisterPartial(name) {\n delete this.partials[name];\n }\n};\n\nfunction registerDefaultHelpers(instance) {\n instance.registerHelper('helperMissing', function () {\n if (arguments.length === 1) {\n // A missing field in a {{foo}} constuct.\n return undefined;\n } else {\n // Someone is actually trying to call something, blow up.\n throw new _Exception2['default']('Missing helper: \"' + arguments[arguments.length - 1].name + '\"');\n }\n });\n\n instance.registerHelper('blockHelperMissing', function (context, options) {\n var inverse = options.inverse,\n fn = options.fn;\n\n if (context === true) {\n return fn(this);\n } else if (context === false || context == null) {\n return inverse(this);\n } else if (isArray(context)) {\n if (context.length > 0) {\n if (options.ids) {\n options.ids = [options.name];\n }\n\n return instance.helpers.each(context, options);\n } else {\n return inverse(this);\n }\n } else {\n if (options.data && options.ids) {\n var data = createFrame(options.data);\n data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);\n options = { data: data };\n }\n\n return fn(context, options);\n }\n });\n\n instance.registerHelper('each', function (context, options) {\n if (!options) {\n throw new _Exception2['default']('Must pass iterator to #each');\n }\n\n var fn = options.fn,\n inverse = options.inverse,\n i = 0,\n ret = '',\n data = undefined,\n contextPath = undefined;\n\n if (options.data && options.ids) {\n contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';\n }\n\n if (isFunction(context)) {\n context = context.call(this);\n }\n\n if (options.data) {\n data = createFrame(options.data);\n }\n\n function execIteration(field, index, last) {\n if (data) {\n data.key = field;\n data.index = index;\n data.first = index === 0;\n data.last = !!last;\n\n if (contextPath) {\n data.contextPath = contextPath + field;\n }\n }\n\n ret = ret + fn(context[field], {\n data: data,\n blockParams: Utils.blockParams([context[field], field], [contextPath + field, null])\n });\n }\n\n if (context && typeof context === 'object') {\n if (isArray(context)) {\n for (var j = context.length; i < j; i++) {\n execIteration(i, i, i === context.length - 1);\n }\n } else {\n var priorKey = undefined;\n\n for (var key in context) {\n if (context.hasOwnProperty(key)) {\n // We're running the iterations one step out of sync so we can detect\n // the last iteration without have to scan the object twice and create\n // an itermediate keys array.\n if (priorKey) {\n execIteration(priorKey, i - 1);\n }\n priorKey = key;\n i++;\n }\n }\n if (priorKey) {\n execIteration(priorKey, i - 1, true);\n }\n }\n }\n\n if (i === 0) {\n ret = inverse(this);\n }\n\n return ret;\n });\n\n instance.registerHelper('if', function (conditional, options) {\n if (isFunction(conditional)) {\n conditional = conditional.call(this);\n }\n\n // Default behavior is to render the positive path if the value is truthy and not empty.\n // The `includeZero` option may be set to treat the condtional as purely not empty based on the\n // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.\n if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) {\n return options.inverse(this);\n } else {\n return options.fn(this);\n }\n });\n\n instance.registerHelper('unless', function (conditional, options) {\n return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });\n });\n\n instance.registerHelper('with', function (context, options) {\n if (isFunction(context)) {\n context = context.call(this);\n }\n\n var fn = options.fn;\n\n if (!Utils.isEmpty(context)) {\n if (options.data && options.ids) {\n var data = createFrame(options.data);\n data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);\n options = { data: data };\n }\n\n return fn(context, options);\n } else {\n return options.inverse(this);\n }\n });\n\n instance.registerHelper('log', function (message, options) {\n var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;\n instance.log(level, message);\n });\n\n instance.registerHelper('lookup', function (obj, field) {\n return obj && obj[field];\n });\n}\n\nvar logger = {\n methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },\n\n // State enum\n DEBUG: 0,\n INFO: 1,\n WARN: 2,\n ERROR: 3,\n level: 1,\n\n // Can be overridden in the host environment\n log: function log(level, message) {\n if (typeof console !== 'undefined' && logger.level <= level) {\n var method = logger.methodMap[level];\n (console[method] || console.log).call(console, message); // eslint-disable-line no-console\n }\n }\n};\n\nexports.logger = logger;\nvar log = logger.log;\n\nexports.log = log;\n\nfunction createFrame(object) {\n var frame = Utils.extend({}, object);\n frame._parent = object;\n return frame;\n}\n\n/* [args, ]options */", + "'use strict';\n\nexports.__esModule = true;\n\nvar errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];\n\nfunction Exception(message, node) {\n var loc = node && node.loc,\n line = undefined,\n column = undefined;\n if (loc) {\n line = loc.start.line;\n column = loc.start.column;\n\n message += ' - ' + line + ':' + column;\n }\n\n var tmp = Error.prototype.constructor.call(this, message);\n\n // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.\n for (var idx = 0; idx < errorProps.length; idx++) {\n this[errorProps[idx]] = tmp[errorProps[idx]];\n }\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, Exception);\n }\n\n if (loc) {\n this.lineNumber = line;\n this.column = column;\n }\n}\n\nException.prototype = new Error();\n\nexports['default'] = Exception;\nmodule.exports = exports['default'];", + "'use strict';\n\nexports.__esModule = true;\n/*global window */\n\nexports['default'] = function (Handlebars) {\n /* istanbul ignore next */\n var root = typeof global !== 'undefined' ? global : window,\n $Handlebars = root.Handlebars;\n /* istanbul ignore next */\n Handlebars.noConflict = function () {\n if (root.Handlebars === Handlebars) {\n root.Handlebars = $Handlebars;\n }\n };\n};\n\nmodule.exports = exports['default'];", + "'use strict';\n\nvar _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };\n\nexports.__esModule = true;\nexports.checkRevision = checkRevision;\n\n// TODO: Remove this line and break up compilePartial\n\nexports.template = template;\nexports.wrapProgram = wrapProgram;\nexports.resolvePartial = resolvePartial;\nexports.invokePartial = invokePartial;\nexports.noop = noop;\n\nvar _import = require('./utils');\n\nvar Utils = _interopRequireWildcard(_import);\n\nvar _Exception = require('./exception');\n\nvar _Exception2 = _interopRequireWildcard(_Exception);\n\nvar _COMPILER_REVISION$REVISION_CHANGES$createFrame = require('./base');\n\nfunction checkRevision(compilerInfo) {\n var compilerRevision = compilerInfo && compilerInfo[0] || 1,\n currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION;\n\n if (compilerRevision !== currentRevision) {\n if (compilerRevision < currentRevision) {\n var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision],\n compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision];\n throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');\n } else {\n // Use the embedded version info since the runtime doesn't know about this revision yet\n throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');\n }\n }\n}\n\nfunction template(templateSpec, env) {\n /* istanbul ignore next */\n if (!env) {\n throw new _Exception2['default']('No environment passed to template');\n }\n if (!templateSpec || !templateSpec.main) {\n throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec);\n }\n\n // Note: Using env.VM references rather than local var references throughout this section to allow\n // for external users to override these as psuedo-supported APIs.\n env.VM.checkRevision(templateSpec.compiler);\n\n function invokePartialWrapper(partial, context, options) {\n if (options.hash) {\n context = Utils.extend({}, context, options.hash);\n }\n\n partial = env.VM.resolvePartial.call(this, partial, context, options);\n var result = env.VM.invokePartial.call(this, partial, context, options);\n\n if (result == null && env.compile) {\n options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);\n result = options.partials[options.name](context, options);\n }\n if (result != null) {\n if (options.indent) {\n var lines = result.split('\\n');\n for (var i = 0, l = lines.length; i < l; i++) {\n if (!lines[i] && i + 1 === l) {\n break;\n }\n\n lines[i] = options.indent + lines[i];\n }\n result = lines.join('\\n');\n }\n return result;\n } else {\n throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');\n }\n }\n\n // Just add water\n var container = {\n strict: function strict(obj, name) {\n if (!(name in obj)) {\n throw new _Exception2['default']('\"' + name + '\" not defined in ' + obj);\n }\n return obj[name];\n },\n lookup: function lookup(depths, name) {\n var len = depths.length;\n for (var i = 0; i < len; i++) {\n if (depths[i] && depths[i][name] != null) {\n return depths[i][name];\n }\n }\n },\n lambda: function lambda(current, context) {\n return typeof current === 'function' ? current.call(context) : current;\n },\n\n escapeExpression: Utils.escapeExpression,\n invokePartial: invokePartialWrapper,\n\n fn: function fn(i) {\n return templateSpec[i];\n },\n\n programs: [],\n program: function program(i, data, declaredBlockParams, blockParams, depths) {\n var programWrapper = this.programs[i],\n fn = this.fn(i);\n if (data || depths || blockParams || declaredBlockParams) {\n programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);\n } else if (!programWrapper) {\n programWrapper = this.programs[i] = wrapProgram(this, i, fn);\n }\n return programWrapper;\n },\n\n data: function data(value, depth) {\n while (value && depth--) {\n value = value._parent;\n }\n return value;\n },\n merge: function merge(param, common) {\n var obj = param || common;\n\n if (param && common && param !== common) {\n obj = Utils.extend({}, common, param);\n }\n\n return obj;\n },\n\n noop: env.VM.noop,\n compilerInfo: templateSpec.compiler\n };\n\n function ret(context) {\n var options = arguments[1] === undefined ? {} : arguments[1];\n\n var data = options.data;\n\n ret._setup(options);\n if (!options.partial && templateSpec.useData) {\n data = initData(context, data);\n }\n var depths = undefined,\n blockParams = templateSpec.useBlockParams ? [] : undefined;\n if (templateSpec.useDepths) {\n depths = options.depths ? [context].concat(options.depths) : [context];\n }\n\n return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);\n }\n ret.isTop = true;\n\n ret._setup = function (options) {\n if (!options.partial) {\n container.helpers = container.merge(options.helpers, env.helpers);\n\n if (templateSpec.usePartial) {\n container.partials = container.merge(options.partials, env.partials);\n }\n } else {\n container.helpers = options.helpers;\n container.partials = options.partials;\n }\n };\n\n ret._child = function (i, data, blockParams, depths) {\n if (templateSpec.useBlockParams && !blockParams) {\n throw new _Exception2['default']('must pass block params');\n }\n if (templateSpec.useDepths && !depths) {\n throw new _Exception2['default']('must pass parent depths');\n }\n\n return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);\n };\n return ret;\n}\n\nfunction wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {\n function prog(context) {\n var options = arguments[1] === undefined ? {} : arguments[1];\n\n return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));\n }\n prog.program = i;\n prog.depth = depths ? depths.length : 0;\n prog.blockParams = declaredBlockParams || 0;\n return prog;\n}\n\nfunction resolvePartial(partial, context, options) {\n if (!partial) {\n partial = options.partials[options.name];\n } else if (!partial.call && !options.name) {\n // This is a dynamic partial that returned a string\n options.name = partial;\n partial = options.partials[partial];\n }\n return partial;\n}\n\nfunction invokePartial(partial, context, options) {\n options.partial = true;\n\n if (partial === undefined) {\n throw new _Exception2['default']('The partial ' + options.name + ' could not be found');\n } else if (partial instanceof Function) {\n return partial(context, options);\n }\n}\n\nfunction noop() {\n return '';\n}\n\nfunction initData(context, data) {\n if (!data || !('root' in data)) {\n data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {};\n data.root = context;\n }\n return data;\n}", + "'use strict';\n\nexports.__esModule = true;\n// Build out our basic SafeString type\nfunction SafeString(string) {\n this.string = string;\n}\n\nSafeString.prototype.toString = SafeString.prototype.toHTML = function () {\n return '' + this.string;\n};\n\nexports['default'] = SafeString;\nmodule.exports = exports['default'];", + "'use strict';\n\nexports.__esModule = true;\nexports.extend = extend;\n\n// Older IE versions do not directly support indexOf so we must implement our own, sadly.\nexports.indexOf = indexOf;\nexports.escapeExpression = escapeExpression;\nexports.isEmpty = isEmpty;\nexports.blockParams = blockParams;\nexports.appendContextPath = appendContextPath;\nvar escape = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n '\\'': ''',\n '`': '`'\n};\n\nvar badChars = /[&<>\"'`]/g,\n possible = /[&<>\"'`]/;\n\nfunction escapeChar(chr) {\n return escape[chr];\n}\n\nfunction extend(obj /* , ...source */) {\n for (var i = 1; i < arguments.length; i++) {\n for (var key in arguments[i]) {\n if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {\n obj[key] = arguments[i][key];\n }\n }\n }\n\n return obj;\n}\n\nvar toString = Object.prototype.toString;\n\nexports.toString = toString;\n// Sourced from lodash\n// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt\n/*eslint-disable func-style, no-var */\nvar isFunction = function isFunction(value) {\n return typeof value === 'function';\n};\n// fallback for older versions of Chrome and Safari\n/* istanbul ignore next */\nif (isFunction(/x/)) {\n exports.isFunction = isFunction = function (value) {\n return typeof value === 'function' && toString.call(value) === '[object Function]';\n };\n}\nvar isFunction;\nexports.isFunction = isFunction;\n/*eslint-enable func-style, no-var */\n\n/* istanbul ignore next */\nvar isArray = Array.isArray || function (value) {\n return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;\n};exports.isArray = isArray;\n\nfunction indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}\n\nfunction escapeExpression(string) {\n if (typeof string !== 'string') {\n // don't escape SafeStrings, since they're already safe\n if (string && string.toHTML) {\n return string.toHTML();\n } else if (string == null) {\n return '';\n } else if (!string) {\n return string + '';\n }\n\n // Force a string conversion as this will be done by the append regardless and\n // the regex test will do this transparently behind the scenes, causing issues if\n // an object's to string has escaped characters in it.\n string = '' + string;\n }\n\n if (!possible.test(string)) {\n return string;\n }\n return string.replace(badChars, escapeChar);\n}\n\nfunction isEmpty(value) {\n if (!value && value !== 0) {\n return true;\n } else if (isArray(value) && value.length === 0) {\n return true;\n } else {\n return false;\n }\n}\n\nfunction blockParams(params, ids) {\n params.path = ids;\n return params;\n}\n\nfunction appendContextPath(contextPath, id) {\n return (contextPath ? contextPath + '.' : '') + id;\n}", + "// Create a simple path alias to allow browserify to resolve\n// the runtime on a supported path.\nmodule.exports = require('./dist/cjs/handlebars.runtime')['default'];\n", + "/**\n * lodash 3.9.1 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = getNative;\n", + "/**\n * lodash 3.1.1 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar getNative = require('lodash._getnative');\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeNow = getNative(Date, 'now');\n\n/**\n * Gets the number of milliseconds that have elapsed since the Unix epoch\n * (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @category Date\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => logs the number of milliseconds it took for the deferred function to be invoked\n */\nvar now = nativeNow || function() {\n return new Date().getTime();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed invocations. Provide an options object to indicate that `func`\n * should be invoked on the leading and/or trailing edge of the `wait` timeout.\n * Subsequent calls to the debounced function return the result of the last\n * `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify invoking on the leading\n * edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n * delayed before it is invoked.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // avoid costly calculations while the window size is in flux\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // invoke `sendMail` when the click event is fired, debouncing subsequent calls\n * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // ensure `batchLog` is invoked once after 1 second of debounced calls\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', _.debounce(batchLog, 250, {\n * 'maxWait': 1000\n * }));\n *\n * // cancel a debounced call\n * var todoChanges = _.debounce(batchLog, 1000);\n * Object.observe(models.todo, todoChanges);\n *\n * Object.observe(models, function(changes) {\n * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {\n * todoChanges.cancel();\n * }\n * }, ['delete']);\n *\n * // ...at some point `models.todo` is changed\n * models.todo.completed = true;\n *\n * // ...before 1 second has passed `models.todo` is deleted\n * // which cancels the debounced `todoChanges` call\n * delete models.todo;\n */\nfunction debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n maxWait = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = wait < 0 ? 0 : (+wait || 0);\n if (options === true) {\n var leading = true;\n trailing = false;\n } else if (isObject(options)) {\n leading = !!options.leading;\n maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n lastCalled = 0;\n maxTimeoutId = timeoutId = trailingCall = undefined;\n }\n\n function complete(isCalled, id) {\n if (id) {\n clearTimeout(id);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n }\n }\n\n function delayed() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0 || remaining > wait) {\n complete(trailingCall, maxTimeoutId);\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n }\n\n function maxDelayed() {\n complete(trailing, timeoutId);\n }\n\n function debounced() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0 || remaining > maxWait;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n return result;\n }\n debounced.cancel = cancel;\n return debounced;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = debounce;\n" + ] +} \ No newline at end of file diff --git a/dist/comicbook.min.css b/dist/comicbook.min.css new file mode 100644 index 0000000..55041af --- /dev/null +++ b/dist/comicbook.min.css @@ -0,0 +1 @@ +@font-face{font-family:'toolbar';src:url('fonts/toolbar.eot');src:url('fonts/toolbar.eot?#iefix') format('embedded-opentype'),url('fonts/toolbar.woff') format('woff'),url('fonts/toolbar.ttf') format('truetype'),url('fonts/toolbar.svg#toolbar') format('svg');font-weight:normal;font-style:normal}[data-icon]:before{font-family:'toolbar';content:attr(data-icon);speak:none;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased}.icon-file,.icon-image,.icon-zoom-out,.icon-zoom-in,.icon-expand,.icon-expand-2,.icon-folder-open,.icon-folder,.icon-cog,.icon-menu,.icon-wrench,.icon-settings,.icon-loop,.icon-pin,.icon-first,.icon-last,.icon-arrow-left,.icon-arrow-right,.icon-arrow-left-2,.icon-arrow-right-2,.icon-arrow-left-3,.icon-arrow-right-3,.icon-previous,.icon-next,.icon-droplet,.icon-adjust,.icon-sun,.icon-remove-sign,.icon-remove,.icon-copy{font-family:'toolbar';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased}.icon-file:before{content:"\e000"}.icon-image:before{content:"\e001"}.icon-zoom-out:before{content:"\e002"}.icon-zoom-in:before{content:"\e003"}.icon-expand:before{content:"\e004"}.icon-expand-2:before{content:"\e005"}.icon-folder-open:before{content:"\e006"}.icon-folder:before{content:"\e007"}.icon-cog:before{content:"\e008"}.icon-menu:before{content:"\e009"}.icon-wrench:before{content:"\e00a"}.icon-settings:before{content:"\e00b"}.icon-loop:before{content:"\e00c"}.icon-pin:before{content:"\e00d"}.icon-first:before{content:"\e00e"}.icon-last:before{content:"\e00f"}.icon-arrow-left:before{content:"\e011"}.icon-arrow-right:before{content:"\e010"}.icon-arrow-left-2:before{content:"\e012"}.icon-arrow-right-2:before{content:"\e013"}.icon-arrow-left-3:before{content:"\e014"}.icon-arrow-right-3:before{content:"\e015"}.icon-previous:before{content:"\e016"}.icon-next:before{content:"\e017"}.icon-droplet:before{content:"\e01a"}.icon-adjust:before{content:"\f042"}.icon-sun:before{content:"\e018"}.icon-remove-sign:before{content:"\f057"}.icon-remove:before{content:"\f00d"}.icon-copy:before{content:"\e037"}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}.cb-control{font-family:helvetica,arial,sans-serif;font-size:12px}.cb-control{color:#fff;background-color:#111;padding:10px;position:fixed!important;box-shadow:0 0 4px #000}.navigate{top:0;margin:0;cursor:pointer;width:128px;opacity:0;background:center no-repeat;box-shadow:none;padding:0 3em}.navigate>span{color:#000;font-size:10em;background-color:rgba(255,255,255,0.8);border-radius:1em;top:35%;position:relative}body:not(.mobile) .navigate:hover{opacity:1}.navigate-left{left:0}.navigate-right{right:0}#cb-loading-overlay{z-index:100;opacity:.8;background:#000 url("img/loading.gif") no-repeat center;box-shadow:none;position:fixed;left:0;right:0;top:0;bottom:0}#cb-status{z-index:101;font-size:12px;right:0;bottom:0;margin:8px;border-radius:4px}#cb-progress-bar{width:200px}#cb-progress-bar,#cb-progress-bar .progressbar-value{height:3px}#cb-progress-bar .progressbar-value{width:0;background:#86c441;border-color:#3e7600}*{-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;line-height:20px;color:#333}button,input,label{cursor:pointer}.pull-left{float:left}.pull-right{float:right}.toolbar{color:white;background-color:black;background-image:linear-gradient(to bottom,#505050,#111);overflow:visible;padding:.75em;position:fixed;left:0;right:0;z-index:99;margin-bottom:0;box-shadow:0 1px 10px rgba(0,0,0,0.4);opacity:0;transition:opacity .2s ease-in-out}.mobile .toolbar{opacity:1}.toolbar:hover{opacity:1}.toolbar li{display:inline-block;position:relative}.toolbar .separator{border:solid 1px;height:1em}.toolbar button{color:white;border:0;background-color:transparent;padding:0}.toolbar li>button{font-size:1.5em;padding:0 12px}.mobile .toolbar li>button{padding:0 9px}.toolbar li>button:hover{color:#8cc746}.toolbar button[data-action=close]:hover{color:#ff6464}.toolbar .dropdown{font-size:1em;position:absolute;width:212px;background-color:white;color:#111;border-radius:4px;box-shadow:0 1px 10px rgba(0,0,0,0.4);top:2em;padding:4px 0;display:none}body:not(.mobile) .toolbar li:hover>.dropdown{display:block}.toolbar .dropdown:after{position:absolute;top:-4px;left:15px;display:inline-block;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;content:''}.toolbar .close{display:none}.dropdown .control-group{padding:8px}.dropdown .sliders{font-size:1.5em}.dropdown .control-group span{float:left;margin:0 2px;clear:both}.dropdown .control-group input[type=range]{width:171px;float:right;margin:0} \ No newline at end of file diff --git a/dist/comicbook.min.js b/dist/comicbook.min.js new file mode 100644 index 0000000..c830cfb --- /dev/null +++ b/dist/comicbook.min.js @@ -0,0 +1,3 @@ +!function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return i(r?r:e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s=this.srcs.length)&&(e=this.currentPageIndex);var r=this.srcs.slice(),n=r.splice(e).concat(r);this.currentPageIndex=e,n.forEach(function(e,r){function n(e,t){this.pages.set(t,e),this.emit("preload:image",e),this.pages.size>=this.preloadBuffer&&!this.pageRendered&&this.emit("preload:ready"),this.pages.size===this.srcs.length&&this.emit("preload:finish")}if(!t.pages.has(r)){var i=new window.Image;i.src=e,i.onload=n.bind(t,i,r)}})}},{key:"updateProgressBar",value:function(){var e=Math.floor(this.pages.size/this.srcs.length*100);this.progressBar.update(e)}},{key:"drawPage",value:function(e){"number"!=typeof e&&(e=this.currentPageIndex);var t=this.pages.get(e);if(!t)return this.preload(e);var r=[t];if(this.options.doublePage){var n=e+1,i=this.pages.get(n);if(n<=this.pages.size-1&&!i)return this.preload(n);r.push(i),this.options.rtl&&r.reverse()}r.push(this.options);try{this.canvas.drawImage.apply(this.canvas,r),this.currentPageIndex=e,this.pageRendered=!0}catch(e){if("Invalid image"!==e.message)throw e}}},{key:"drawNextPage",value:function(){var e=this.options.doublePage?2:1,t=this.currentPageIndex+e;t>=this.pages.size&&(t=this.pages.size-1),this.drawPage(t)}},{key:"drawPreviousPage",value:function(){var e=this.options.doublePage?2:1,t=this.currentPageIndex-e;0>t&&(t=0),this.drawPage(t)}}]),t}(c);t.exports=h},{"./view/canvas":3,"./view/load-indicator":4,"./view/progress-bar":5,"babel-runtime/core-js/map":7,"babel-runtime/core-js/object/assign":8,"babel-runtime/helpers/class-call-check":12,"babel-runtime/helpers/create-class":13,"babel-runtime/helpers/get":14,"babel-runtime/helpers/inherits":15,events:53}],2:[function(e,t,r){"use strict";var n=window.ComicBook=e("./comic-book"),i=e("lodash.debounce"),o=["https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_00.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_01.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_02.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_03.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_04.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_05.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_06.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_07.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_08.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_09.jpg","https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_10.jpg"],s=window.comic=new n(o,{doublePage:!0});s.render().drawPage(5),window.addEventListener("resize",i(s.drawPage.bind(s),100)),document.addEventListener("DOMContentLoaded",function(){document.body.appendChild(s.el)},!1)},{"./comic-book":1,"lodash.debounce":63}],3:[function(e,t,r){"use strict";function n(){return window.innerWidth}var i=e("babel-runtime/helpers/get").default,o=e("babel-runtime/helpers/inherits").default,s=e("babel-runtime/helpers/create-class").default,a=e("babel-runtime/helpers/class-call-check").default,u=e("babel-runtime/core-js/object/assign").default,c=e("events").EventEmitter,l=function(e){function t(e){a(this,t),i(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d")}return o(t,e),s(t,[{key:"drawImage",value:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];this.emit("draw:start"),null!==t&&t instanceof window.Image||(r=t||r);var i=u({doublePage:!1,zoomMode:"fitWidth"},r);if(!(e instanceof window.Image)||i.doublePage&&null===t)throw new Error("Invalid image");var o=void 0,s=0,a=0,c=e.width,l=e.height,f=i.doublePage,d=void 0,h=void 0,p=void 0,v=void 0;this.canvas.width=0,this.canvas.height=0;var m=t&&(e.width>e.height||t.width>t.height)&&f;switch(m&&(f=!1),f&&(c+=t instanceof window.Image?t.width:c),i.zoomMode){case"manual":document.body.style.overflowX="auto",o=f?2*this.scale:this.scale;break;case"fitWidth":document.body.style.overflowX="hidden",o=n()>c?(n()-c)/n()+1:n()/c,this.scale=o;break;case"fitWindow":document.body.style.overflowX="hidden";var g=n()>c?(n()-c)/n()+1:n()/c,b=window.innerHeight,y=b>l?(b-l)/b+1:b/l;o=g>y?y:g,this.scale=o}d=e.width*o,h=e.height*o,p="manual"===i.zoomMode?e.width*this.scale:d,v="manual"===i.zoomMode?e.height*this.scale:h,h=v,this.canvas.width=d= 2.0.0-beta.1"],main:function(e,t,r,n){return'
\n
\n
\n
\n
\n'},useData:!0})},{"handlebars/runtime":61}],7:[function(e,t,r){t.exports={default:e("core-js/library/fn/map"),__esModule:!0}},{"core-js/library/fn/map":16}],8:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":17}],9:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":18}],10:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/define-property"),__esModule:!0}},{"core-js/library/fn/object/define-property":19}],11:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/get-own-property-descriptor"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-descriptor":20}],12:[function(e,t,r){"use strict";r.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r.__esModule=!0},{}],13:[function(e,t,r){"use strict";var n=e("babel-runtime/core-js/object/define-property").default;r.default=function(){function e(e,t){for(var r=0;rs;)for(var a,u=n.ES5Object(arguments[s++]),c=i(u),l=c.length,f=0;l>f;)r[a=c[f++]]=u[a];return r}},{"./$":36,"./$.enum-keys":29}],23:[function(e,t,r){function n(e){return s.call(e).slice(8,-1)}var i=e("./$"),o=e("./$.wks")("toStringTag"),s={}.toString;n.classof=function(e){var t,r;return void 0==e?void 0===e?"Undefined":"Null":"string"==typeof(r=(t=Object(e))[o])?r:n(t)},n.set=function(e,t,r){e&&!i.has(e=r?e:e.prototype,o)&&i.hide(e,o,t)},t.exports=n},{"./$":36,"./$.wks":44}],24:[function(e,t,r){"use strict";function n(e,t){if(!h(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!f(e,m)){if(!v(e))return"F";if(!t)return"E";p(e,m,++x)}return"O"+e[m]}function i(e,t){var r,i=n(t);if("F"!==i)return e[g][i];for(r=e[y];r;r=r.n)if(r.k==t)return r}var o=e("./$"),s=e("./$.ctx"),a=e("./$.uid").safe,u=e("./$.assert"),c=e("./$.for-of"),l=e("./$.iter").step,f=o.has,d=o.set,h=o.isObject,p=o.hide,v=Object.isExtensible||h,m=a("id"),g=a("O1"),b=a("last"),y=a("first"),w=a("iter"),$=o.DESC?a("size"):"size",x=0;t.exports={getConstructor:function(t,r,n,a){var l=t(function(e,t){u.inst(e,l,r),d(e,g,o.create(null)),d(e,$,0),d(e,b,void 0),d(e,y,void 0),void 0!=t&&c(t,n,e[a],e)});return e("./$.mix")(l.prototype,{clear:function(){for(var e=this,t=e[g],r=e[y];r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete t[r.i];e[y]=e[b]=void 0,e[$]=0},delete:function(e){var t=this,r=i(t,e);if(r){var n=r.n,o=r.p;delete t[g][r.i],r.r=!0,o&&(o.n=n),n&&(n.p=o),t[y]==r&&(t[y]=n),t[b]==r&&(t[b]=o),t[$]--}return!!r},forEach:function(e){for(var t,r=s(e,arguments[1],3);t=t?t.n:this[y];)for(r(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!i(this,e)}}),o.DESC&&o.setDesc(l.prototype,"size",{get:function(){return u.def(this[$])}}),l},def:function(e,t,r){var o,s,a=i(e,t);return a?a.v=r:(e[b]=a={i:s=n(t,!0),k:t,v:r,p:o=e[b],n:void 0,r:!1},e[y]||(e[y]=a),o&&(o.n=a),e[$]++,"F"!==s&&(e[g][s]=a)),e},getEntry:i,setIter:function(t,r,n){e("./$.iter-define")(t,r,function(e,t){d(this,w,{o:e,k:t})},function(){for(var e=this[w],t=e.k,r=e.l;r&&r.r;)r=r.p;return e.o&&(e.l=r=r?r.n:e.o[y])?"keys"==t?l(0,r.k):"values"==t?l(0,r.v):l(0,[r.k,r.v]):(e.o=void 0,l(1))},n?"entries":"values",!n,!0)}}},{"./$":36,"./$.assert":21,"./$.ctx":27,"./$.for-of":30,"./$.iter":35,"./$.iter-define":34,"./$.mix":37,"./$.uid":42}],25:[function(e,t,r){var n=e("./$.def"),i=e("./$.for-of");t.exports=function(e){n(n.P,e,{toJSON:function(){var e=[];return i(this,!1,e.push,e),e}})}},{"./$.def":28,"./$.for-of":30}],26:[function(e,t,r){"use strict";var n=e("./$"),i=e("./$.def"),o=e("./$.iter"),s=o.BUGGY,a=e("./$.for-of"),u=e("./$.assert").inst,c=e("./$.uid").safe("internal");t.exports=function(t,r,o,l,f,d){var h=n.g[t],p=h,v=f?"set":"add",m=p&&p.prototype,g={};return n.DESC&&n.isFunction(p)&&(d||!s&&m.forEach&&m.entries)?(p=r(function(e,r){u(e,p,t),e[c]=new h,void 0!=r&&a(r,f,e[v],e)}),n.each.call("add,clear,delete,forEach,get,has,set,keys,values,entries".split(","),function(e){var t="add"==e||"set"==e;e in m&&n.hide(p.prototype,e,function(r,n){var i=this[c][e](0===r?0:r,n);return t?this:i})}),"size"in m&&n.setDesc(p.prototype,"size",{get:function(){return this[c].size}})):(p=l.getConstructor(r,t,f,v),e("./$.mix")(p.prototype,o)),e("./$.cof").set(p,t),g[t]=p,i(i.G+i.W+i.F,g),e("./$.species")(p),d||l.setIter(p,t,f),p}},{"./$":36,"./$.assert":21,"./$.cof":23,"./$.def":28,"./$.for-of":30,"./$.iter":35,"./$.mix":37,"./$.species":40,"./$.uid":42}],27:[function(e,t,r){var n=e("./$.assert").fn;t.exports=function(e,t,r){if(n(e),~r&&void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"./$.assert":21}],28:[function(e,t,r){function n(e,t){return function(){return e.apply(t,arguments)}}function i(e,t,r){var o,c,l,f,d=e&i.G,h=e&i.P,p=d?s:e&i.S?s[t]:(s[t]||{}).prototype,v=d?a:a[t]||(a[t]={});d&&(r=t);for(o in r)c=!(e&i.F)&&p&&o in p,c&&o in v||(l=c?p[o]:r[o],d&&!u(p[o])?f=r[o]:e&i.B&&c?f=n(l,s):e&i.W&&p[o]==l?!function(e){f=function(t){return this instanceof e?new e(t):e(t)},f.prototype=e.prototype}(l):f=h&&u(l)?n(Function.call,l):l,v[o]=f,h&&((v.prototype||(v.prototype={}))[o]=l))}var o=e("./$"),s=o.g,a=o.core,u=o.isFunction;i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,t.exports=i},{"./$":36}],29:[function(e,t,r){var n=e("./$");t.exports=function(e){var t=n.getKeys(e),r=n.getDesc,i=n.getSymbols;return i&&n.each.call(i(e),function(n){r(e,n).enumerable&&t.push(n)}),t}},{"./$":36}],30:[function(e,t,r){var n=e("./$.ctx"),i=e("./$.iter").get,o=e("./$.iter-call");t.exports=function(e,t,r,s){for(var a,u=i(e),c=n(r,s,t?2:1);!(a=u.next()).done;)if(o(u,c,a.value,t)===!1)return o.close(u)}},{"./$.ctx":27,"./$.iter":35,"./$.iter-call":33}],31:[function(e,t,r){t.exports=function(e){return e.FW=!1,e.path=e.core,e}},{}],32:[function(e,t,r){function n(e){try{return s(e)}catch(e){return a.slice()}}var i=e("./$"),o={}.toString,s=i.getNames,a="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.get=function(e){return a&&"[object Window]"==o.call(e)?n(e):s(i.toObject(e))}},{"./$":36}],33:[function(e,t,r){function n(e){var t=e.return;void 0!==t&&o(t.call(e))}function i(e,t,r,i){try{return i?t(o(r)[0],r[1]):t(r)}catch(t){throw n(e),t}}var o=e("./$.assert").obj;i.close=n,t.exports=i},{"./$.assert":21}],34:[function(e,t,r){var n=e("./$.def"),i=e("./$.redef"),o=e("./$"),s=e("./$.cof"),a=e("./$.iter"),u=e("./$.wks")("iterator"),c="@@iterator",l="keys",f="values",d=a.Iterators;t.exports=function(e,t,r,h,p,v,m){function g(e){function t(t){return new r(t,e)}switch(e){case l:return function(){return t(this)};case f:return function(){return t(this)}}return function(){return t(this)}}a.create(r,t,h);var b,y,w=t+" Iterator",$=e.prototype,x=$[u]||$[c]||p&&$[p],_=x||g(p);if(x){var j=o.getProto(_.call(new e));s.set(j,w,!0),o.FW&&o.has($,c)&&a.set(j,o.that)}if((o.FW||m)&&a.set($,_),d[t]=_,d[w]=o.that,p)if(b={keys:v?_:g(l),values:p==f?_:g(f),entries:p!=f?_:g("entries")},m)for(y in b)y in $||i($,y,b[y]);else n(n.P+n.F*a.BUGGY,t,b)}},{"./$":36,"./$.cof":23,"./$.def":28,"./$.iter":35,"./$.redef":38,"./$.wks":44}],35:[function(e,t,r){"use strict";function n(e,t){i.hide(e,c,t),l in[]&&i.hide(e,l,t)}var i=e("./$"),o=e("./$.cof"),s=o.classof,a=e("./$.assert"),u=a.obj,c=e("./$.wks")("iterator"),l="@@iterator",f=e("./$.shared")("iterators"),d={};n(d,i.that),t.exports={BUGGY:"keys"in[]&&!("next"in[].keys()),Iterators:f,step:function(e,t){return{value:t,done:!!e}},is:function(e){var t=Object(e),r=i.g.Symbol;return(r&&r.iterator||l)in t||c in t||i.has(f,s(t))},get:function(e){var t,r=i.g.Symbol;return void 0!=e&&(t=e[r&&r.iterator||l]||e[c]||f[s(e)]),a(i.isFunction(t),e," is not iterable!"),u(t.call(e))},set:n,create:function(e,t,r,n){e.prototype=i.create(n||d,{next:i.desc(1,r)}),o.set(e,t+" Iterator")}}},{"./$":36,"./$.assert":21,"./$.cof":23,"./$.shared":39,"./$.wks":44}],36:[function(e,t,r){"use strict";function n(e){return isNaN(e=+e)?0:(e>0?v:p)(e)}function i(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}function o(e,t,r){return e[t]=r,e}function s(e){return b?function(t,r,n){return w.setDesc(t,r,i(e,n))}:o}function a(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function u(e){return"function"==typeof e}function c(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}var l="undefined"!=typeof self?self:Function("return this")(),f={},d=Object.defineProperty,h={}.hasOwnProperty,p=Math.ceil,v=Math.floor,m=Math.max,g=Math.min,b=!!function(){try{return 2==d({},"a",{get:function(){return 2}}).a}catch(e){}}(),y=s(1),w=t.exports=e("./$.fw")({g:l,core:f,html:l.document&&document.documentElement,isObject:a,isFunction:u,that:function(){return this},toInteger:n,toLength:function(e){return e>0?g(n(e),9007199254740991):0},toIndex:function(e,t){return e=n(e),0>e?m(e+t,0):g(e,t)},has:function(e,t){return h.call(e,t)},create:Object.create,getProto:Object.getPrototypeOf,DESC:b,desc:i,getDesc:Object.getOwnPropertyDescriptor,setDesc:d,setDescs:Object.defineProperties,getKeys:Object.keys,getNames:Object.getOwnPropertyNames,getSymbols:Object.getOwnPropertySymbols,assertDefined:c,ES5Object:Object,toObject:function(e){return w.ES5Object(c(e))},hide:y,def:s(0),set:l.Symbol?o:y,each:[].forEach});"undefined"!=typeof __e&&(__e=f),"undefined"!=typeof __g&&(__g=l)},{"./$.fw":31}],37:[function(e,t,r){var n=e("./$.redef");t.exports=function(e,t){for(var r in t)n(e,r,t[r]);return e}},{"./$.redef":38}],38:[function(e,t,r){t.exports=e("./$").hide},{"./$":36}],39:[function(e,t,r){var n=e("./$"),i="__core-js_shared__",o=n.g[i]||(n.g[i]={});t.exports=function(e){return o[e]||(o[e]={})}},{"./$":36}],40:[function(e,t,r){var n=e("./$"),i=e("./$.wks")("species");t.exports=function(e){!n.DESC||i in e||n.setDesc(e,i,{configurable:!0,get:n.that})}},{"./$":36,"./$.wks":44}],41:[function(e,t,r){var n=e("./$");t.exports=function(e){return function(t,r){var i,o,s=String(n.assertDefined(t)),a=n.toInteger(r),u=s.length;return 0>a||a>=u?e?"":void 0:(i=s.charCodeAt(a),55296>i||i>56319||a+1===u||(o=s.charCodeAt(a+1))<56320||o>57343?e?s.charAt(a):i:e?s.slice(a,a+2):(i-55296<<10)+(o-56320)+65536)}}},{"./$":36}],42:[function(e,t,r){function n(e){return"Symbol(".concat(void 0===e?"":e,")_",(++i+Math.random()).toString(36))}var i=0;n.safe=e("./$").g.Symbol||n,t.exports=n},{"./$":36}],43:[function(e,t,r){t.exports=function(){}},{}],44:[function(e,t,r){var n=e("./$").g,i=e("./$.shared")("wks");t.exports=function(t){return i[t]||(i[t]=n.Symbol&&n.Symbol[t]||e("./$.uid").safe("Symbol."+t))}},{"./$":36,"./$.shared":39,"./$.uid":42}],45:[function(e,t,r){var n=e("./$"),i=e("./$.unscope"),o=e("./$.uid").safe("iter"),s=e("./$.iter"),a=s.step,u=s.Iterators;e("./$.iter-define")(Array,"Array",function(e,t){n.set(this,o,{o:n.toObject(e),i:0,k:t})},function(){var e=this[o],t=e.o,r=e.k,n=e.i++;return!t||n>=t.length?(e.o=void 0,a(1)):"keys"==r?a(0,n):"values"==r?a(0,t[n]):a(0,[n,t[n]])},"values"),u.Arguments=u.Array,i("keys"),i("values"),i("entries")},{"./$":36,"./$.iter":35,"./$.iter-define":34,"./$.uid":42,"./$.unscope":43}],46:[function(e,t,r){"use strict";var n=e("./$.collection-strong");e("./$.collection")("Map",function(e){return function(){return e(this,arguments[0])}},{get:function(e){var t=n.getEntry(this,e);return t&&t.v},set:function(e,t){return n.def(this,0===e?0:e,t)}},n,!0)},{"./$.collection":26,"./$.collection-strong":24}],47:[function(e,t,r){var n=e("./$.def");n(n.S,"Object",{assign:e("./$.assign")})},{"./$.assign":22,"./$.def":28}],48:[function(e,t,r){var n=e("./$"),i=e("./$.def"),o=n.isObject,s=n.toObject;n.each.call("freeze,seal,preventExtensions,isFrozen,isSealed,isExtensible,getOwnPropertyDescriptor,getPrototypeOf,keys,getOwnPropertyNames".split(","),function(t,r){var a=(n.core.Object||{})[t]||Object[t],u=0,c={};c[t]=0==r?function(e){return o(e)?a(e):e}:1==r?function(e){return o(e)?a(e):e}:2==r?function(e){return o(e)?a(e):e}:3==r?function(e){return o(e)?a(e):!0}:4==r?function(e){return o(e)?a(e):!0}:5==r?function(e){return o(e)?a(e):!1}:6==r?function(e,t){return a(s(e),t)}:7==r?function(e){return a(Object(n.assertDefined(e)))}:8==r?function(e){return a(s(e))}:e("./$.get-names").get;try{a("z")}catch(e){u=1}i(i.S+i.F*u,"Object",c)})},{"./$":36,"./$.def":28,"./$.get-names":32}],49:[function(e,t,r){"use strict";var n=e("./$.cof"),i={};i[e("./$.wks")("toStringTag")]="z",e("./$").FW&&"z"!=n(i)&&e("./$.redef")(Object.prototype,"toString",function(){return"[object "+n.classof(this)+"]"},!0)},{"./$":36,"./$.cof":23,"./$.redef":38,"./$.wks":44}],50:[function(e,t,r){var n=e("./$").set,i=e("./$.string-at")(!0),o=e("./$.uid").safe("iter"),s=e("./$.iter"),a=s.step;e("./$.iter-define")(String,"String",function(e){n(this,o,{o:String(e),i:0})},function(){var e,t=this[o],r=t.o,n=t.i;return n>=r.length?a(1):(e=i(r,n),t.i+=e.length,a(0,e))})},{"./$":36,"./$.iter":35,"./$.iter-define":34,"./$.string-at":41,"./$.uid":42}],51:[function(e,t,r){e("./$.collection-to-json")("Map")},{"./$.collection-to-json":25}],52:[function(e,t,r){e("./es6.array.iterator");var n=e("./$"),i=e("./$.iter").Iterators,o=e("./$.wks")("iterator"),s=i.Array,a=n.g.NodeList,u=n.g.HTMLCollection,c=a&&a.prototype,l=u&&u.prototype;n.FW&&(!a||o in c||n.hide(c,o,s),!u||o in l||n.hide(l,o,s)),i.NodeList=i.HTMLCollection=s},{"./$":36,"./$.iter":35,"./$.wks":44,"./es6.array.iterator":45}],53:[function(e,t,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,o,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],a(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=new Array(n-1),u=1;n>u;u++)o[u-1]=arguments[u];r.apply(this,o)}else if(s(r)){for(n=arguments.length,o=new Array(n-1),u=1;n>u;u++)o[u-1]=arguments[u];for(c=r.slice(),n=c.length,u=0;n>u;u++)c[u].apply(this,o)}return!0},n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned){var r;r=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,t){var r,n,o,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],o=r.length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(a=o;a-->0;)if(r[a]===t||r[a].listener&&r[a].listener===t){n=a;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],i(r))this.removeListener(e,r);else for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var r;return r=e._events&&e._events[t]?i(e._events[t])?1:e._events[t].length:0}},{}],54:[function(e,t,r){"use strict";function n(){var e=new s.HandlebarsEnvironment;return d.extend(e,s),e.SafeString=u.default,e.Exception=l.default,e.Utils=d,e.escapeExpression=d.escapeExpression,e.VM=p,e.template=function(t){return p.template(t,e)},e}var i=function(e){return e&&e.__esModule?e:{default:e}};r.__esModule=!0;var o=e("./handlebars/base"),s=i(o),a=e("./handlebars/safe-string"),u=i(a),c=e("./handlebars/exception"),l=i(c),f=e("./handlebars/utils"),d=i(f),h=e("./handlebars/runtime"),p=i(h),v=e("./handlebars/no-conflict"),m=i(v),g=n();g.create=n,m.default(g),g.default=g,r.default=g,t.exports=r.default},{"./handlebars/base":55,"./handlebars/exception":56,"./handlebars/no-conflict":57,"./handlebars/runtime":58,"./handlebars/safe-string":59,"./handlebars/utils":60}],55:[function(e,t,r){"use strict";function n(e,t){this.helpers=e||{},this.partials=t||{},i(this)}function i(e){e.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new l.default('Missing helper: "'+arguments[arguments.length-1].name+'"')}),e.registerHelper("blockHelperMissing",function(t,r){var n=r.inverse,i=r.fn;if(t===!0)return i(this);if(t===!1||null==t)return n(this);if(p(t))return t.length>0?(r.ids&&(r.ids=[r.name]),e.helpers.each(t,r)):n(this);if(r.data&&r.ids){var s=o(r.data);s.contextPath=u.appendContextPath(r.data.contextPath,r.name),r={data:s}}return i(t,r)}),e.registerHelper("each",function(e,t){function r(t,r,i){c&&(c.key=t,c.index=r,c.first=0===r,c.last=!!i,f&&(c.contextPath=f+t)),a+=n(e[t],{data:c,blockParams:u.blockParams([e[t],t],[f+t,null])})}if(!t)throw new l.default("Must pass iterator to #each");var n=t.fn,i=t.inverse,s=0,a="",c=void 0,f=void 0;if(t.data&&t.ids&&(f=u.appendContextPath(t.data.contextPath,t.ids[0])+"."),v(e)&&(e=e.call(this)),t.data&&(c=o(t.data)),e&&"object"==typeof e)if(p(e))for(var d=e.length;d>s;s++)r(s,s,s===e.length-1);else{var h=void 0;for(var m in e)e.hasOwnProperty(m)&&(h&&r(h,s-1),h=m,s++);h&&r(h,s-1,!0)}return 0===s&&(a=i(this)),a}),e.registerHelper("if",function(e,t){return v(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||u.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper("unless",function(t,r){return e.helpers.if.call(this,t,{fn:r.inverse,inverse:r.fn,hash:r.hash})}),e.registerHelper("with",function(e,t){v(e)&&(e=e.call(this));var r=t.fn;if(u.isEmpty(e))return t.inverse(this);if(t.data&&t.ids){var n=o(t.data);n.contextPath=u.appendContextPath(t.data.contextPath,t.ids[0]),t={data:n}}return r(e,t)}),e.registerHelper("log",function(t,r){var n=r.data&&null!=r.data.level?parseInt(r.data.level,10):1;e.log(n,t)}),e.registerHelper("lookup",function(e,t){return e&&e[t]})}function o(e){var t=u.extend({},e);return t._parent=e,t}var s=function(e){return e&&e.__esModule?e:{default:e}};r.__esModule=!0,r.HandlebarsEnvironment=n,r.createFrame=o;var a=e("./utils"),u=s(a),c=e("./exception"),l=s(c),f="3.0.1";r.VERSION=f;var d=6;r.COMPILER_REVISION=d; +var h={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};r.REVISION_CHANGES=h;var p=u.isArray,v=u.isFunction,m=u.toString,g="[object Object]";n.prototype={constructor:n,logger:b,log:y,registerHelper:function(e,t){if(m.call(e)===g){if(t)throw new l.default("Arg not supported with multiple helpers");u.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(m.call(e)===g)u.extend(this.partials,e);else{if("undefined"==typeof t)throw new l.default("Attempting to register a partial as undefined");this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]}};var b={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:1,log:function(e,t){if("undefined"!=typeof console&&b.level<=e){var r=b.methodMap[e];(console[r]||console.log).call(console,t)}}};r.logger=b;var y=b.log;r.log=y},{"./exception":56,"./utils":60}],56:[function(e,t,r){"use strict";function n(e,t){var r=t&&t.loc,o=void 0,s=void 0;r&&(o=r.start.line,s=r.start.column,e+=" - "+o+":"+s);for(var a=Error.prototype.constructor.call(this,e),u=0;ut){var n=v.REVISION_CHANGES[r],i=v.REVISION_CHANGES[t];throw new p.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+n+") or downgrade your runtime to an older version ("+i+").")}throw new p.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function i(e,t){function r(r,n,i){i.hash&&(n=d.extend({},n,i.hash)),r=t.VM.resolvePartial.call(this,r,n,i);var o=t.VM.invokePartial.call(this,r,n,i);if(null==o&&t.compile&&(i.partials[i.name]=t.compile(r,e.compilerOptions,t),o=i.partials[i.name](n,i)),null!=o){if(i.indent){for(var s=o.split("\n"),a=0,u=s.length;u>a&&(s[a]||a+1!==u);a++)s[a]=i.indent+s[a];o=s.join("\n")}return o}throw new p.default("The partial "+i.name+" could not be compiled when running in runtime-only mode")}function n(t){var r=void 0===arguments[1]?{}:arguments[1],o=r.data;n._setup(r),!r.partial&&e.useData&&(o=c(t,o));var s=void 0,a=e.useBlockParams?[]:void 0;return e.useDepths&&(s=r.depths?[t].concat(r.depths):[t]),e.main.call(i,t,i.helpers,i.partials,o,a,s)}if(!t)throw new p.default("No environment passed to template");if(!e||!e.main)throw new p.default("Unknown template object: "+typeof e);t.VM.checkRevision(e.compiler);var i={strict:function(e,t){if(!(t in e))throw new p.default('"'+t+'" not defined in '+e);return e[t]},lookup:function(e,t){for(var r=e.length,n=0;r>n;n++)if(e[n]&&null!=e[n][t])return e[n][t]},lambda:function(e,t){return"function"==typeof e?e.call(t):e},escapeExpression:d.escapeExpression,invokePartial:r,fn:function(t){return e[t]},programs:[],program:function(e,t,r,n,i){var s=this.programs[e],a=this.fn(e);return t||i||n||r?s=o(this,e,a,t,r,n,i):s||(s=this.programs[e]=o(this,e,a)),s},data:function(e,t){for(;e&&t--;)e=e._parent;return e},merge:function(e,t){var r=e||t;return e&&t&&e!==t&&(r=d.extend({},t,e)),r},noop:t.VM.noop,compilerInfo:e.compiler};return n.isTop=!0,n._setup=function(r){r.partial?(i.helpers=r.helpers,i.partials=r.partials):(i.helpers=i.merge(r.helpers,t.helpers),e.usePartial&&(i.partials=i.merge(r.partials,t.partials)))},n._child=function(t,r,n,s){if(e.useBlockParams&&!n)throw new p.default("must pass block params");if(e.useDepths&&!s)throw new p.default("must pass parent depths");return o(i,t,e[t],r,0,n,s)},n}function o(e,t,r,n,i,o,s){function a(t){var i=void 0===arguments[1]?{}:arguments[1];return r.call(e,t,e.helpers,e.partials,i.data||n,o&&[i.blockParams].concat(o),s&&[t].concat(s))}return a.program=t,a.depth=s?s.length:0,a.blockParams=i||0,a}function s(e,t,r){return e?e.call||r.name||(r.name=e,e=r.partials[e]):e=r.partials[r.name],e}function a(e,t,r){if(r.partial=!0,void 0===e)throw new p.default("The partial "+r.name+" could not be found");return e instanceof Function?e(t,r):void 0}function u(){return""}function c(e,t){return t&&"root"in t||(t=t?v.createFrame(t):{},t.root=e),t}var l=function(e){return e&&e.__esModule?e:{default:e}};r.__esModule=!0,r.checkRevision=n,r.template=i,r.wrapProgram=o,r.resolvePartial=s,r.invokePartial=a,r.noop=u;var f=e("./utils"),d=l(f),h=e("./exception"),p=l(h),v=e("./base")},{"./base":55,"./exception":56,"./utils":60}],59:[function(e,t,r){"use strict";function n(e){this.string=e}r.__esModule=!0,n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},r.default=n,t.exports=r.default},{}],60:[function(e,t,r){"use strict";function n(e){return l[e]}function i(e){for(var t=1;tr;r++)if(e[r]===t)return r;return-1}function s(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}return d.test(e)?e.replace(f,n):e}function a(e){return e||0===e?v(e)&&0===e.length?!0:!1:!0}function u(e,t){return e.path=t,e}function c(e,t){return(e?e+".":"")+t}r.__esModule=!0,r.extend=i,r.indexOf=o,r.escapeExpression=s,r.isEmpty=a,r.blockParams=u,r.appendContextPath=c;var l={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},f=/[&<>"'`]/g,d=/[&<>"'`]/,h=Object.prototype.toString;r.toString=h;var p=function(e){return"function"==typeof e};p(/x/)&&(r.isFunction=p=function(e){return"function"==typeof e&&"[object Function]"===h.call(e)});var p;r.isFunction=p;var v=Array.isArray||function(e){return e&&"object"==typeof e?"[object Array]"===h.call(e):!1};r.isArray=v},{}],61:[function(e,t,r){t.exports=e("./dist/cjs/handlebars.runtime").default},{"./dist/cjs/handlebars.runtime":54}],62:[function(e,t,r){function n(e){return!!e&&"object"==typeof e}function i(e,t){var r=null==e?void 0:e[t];return a(r)?r:void 0}function o(e){return s(e)&&h.call(e)==u}function s(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function a(e){return null==e?!1:o(e)?p.test(f.call(e)):n(e)&&c.test(e)}var u="[object Function]",c=/^\[object .+?Constructor\]$/,l=Object.prototype,f=Function.prototype.toString,d=l.hasOwnProperty,h=l.toString,p=RegExp("^"+f.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=i},{}],63:[function(e,t,r){function n(e,t,r){function n(){g&&clearTimeout(g),h&&clearTimeout(h),y=0,h=g=b=void 0}function o(t,r){r&&clearTimeout(r),h=g=b=void 0,t&&(y=c(),p=e.apply(m,d),g||h||(d=m=void 0))}function u(){var e=t-(c()-v);0>=e||e>t?o(b,h):g=setTimeout(u,e)}function l(){o($,g)}function f(){if(d=arguments,v=c(),m=this,b=$&&(g||!x),w===!1)var r=x&&!g;else{h||x||(y=v);var n=w-(v-y),i=0>=n||n>w;i?(h&&(h=clearTimeout(h)),y=v,p=e.apply(m,d)):h||(h=setTimeout(l,n))}return i&&g?g=clearTimeout(g):g||t===w||(g=setTimeout(u,t)),r&&(i=!0,p=e.apply(m,d)),!i||g||h||(d=m=void 0),p}var d,h,p,v,m,g,b,y=0,w=!1,$=!0;if("function"!=typeof e)throw new TypeError(s);if(t=0>t?0:+t||0,r===!0){var x=!0;$=!1}else i(r)&&(x=!!r.leading,w="maxWait"in r&&a(+r.maxWait||0,t),$="trailing"in r?!!r.trailing:$);return f.cancel=n,f}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var o=e("lodash._getnative"),s="Expected a function",a=Math.max,u=o(Date,"now"),c=u||function(){return(new Date).getTime()};t.exports=n},{"lodash._getnative":62}]},{},[2]); +//# sourceMappingURL=dist/comicbook.min.js.map \ No newline at end of file diff --git a/dist/comicbook.min.js.map b/dist/comicbook.min.js.map new file mode 100644 index 0000000..be361cf --- /dev/null +++ b/dist/comicbook.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dist/comicbook.min.js","sources":["dist/comicbook.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length",1,"module","_get","_inherits","_createClass","_classCallCheck","_Object$assign","_Map","EventEmitter","Canvas","LoadIndicator","ProgressBar","ComicBook","_EventEmitter","srcs","options","undefined","this","Object","getPrototypeOf","prototype","rtl","doublePage","pages","preloadBuffer","currentPageIndex","canvas","loadIndicator","progressBar","addEventListeners","key","value","on","show","bind","updateProgressBar","hide","drawPage","pageRendered","el","document","createElement","appendChild","startIndex","_this","emit","_srcs","slice","splice","concat","forEach","src","pageIndex","setImage","image","index","set","size","has","window","Image","onload","percentage","Math","floor","update","page","get","preload","args","page2Index","page2","push","reverse","drawImage","apply","message","increment","./view/canvas","./view/load-indicator","./view/progress-bar","babel-runtime/core-js/map","babel-runtime/core-js/object/assign","babel-runtime/helpers/class-call-check","babel-runtime/helpers/create-class","babel-runtime/helpers/get","babel-runtime/helpers/inherits","events",2,"debounce","comic","render","addEventListener","body","./comic-book","lodash.debounce",3,"windowWidth","innerWidth","context","getContext","opts","arguments","zoomMode","zoomScale","offsetW","offsetH","width","height","doublePageMode","canvasWidth","canvasHeight","pageWidth","pageHeight","isDoublePageSpread","style","overflowX","scale","widthScale","windowHeight","innerHeight","heightScale",4,"id","display",5,"template","createElements","innerHTML","firstChild","progressEl","querySelector","./template/progress-bar.handlebars",6,"templater","compiler","main","depth0","helpers","partials","data","useData","handlebars/runtime",7,"default","__esModule","core-js/library/fn/map",8,"core-js/library/fn/object/assign",9,"core-js/library/fn/object/create",10,"core-js/library/fn/object/define-property",11,"core-js/library/fn/object/get-own-property-descriptor",12,"instance","Constructor","TypeError",13,"_Object$defineProperty","defineProperties","target","props","descriptor","enumerable","configurable","writable","protoProps","staticProps","babel-runtime/core-js/object/define-property",14,"_Object$getOwnPropertyDescriptor","_x","_x2","_x3","_again","object","property","receiver","desc","parent","getter","Function","babel-runtime/core-js/object/get-own-property-descriptor",15,"_Object$create","subClass","superClass","constructor","__proto__","babel-runtime/core-js/object/create",16,"core","Map","../modules/$","../modules/es6.map","../modules/es6.object.to-string","../modules/es6.string.iterator","../modules/es7.map.to-json","../modules/web.dom.iterable",17,"assign","../../modules/$","../../modules/es6.object.assign",18,"$","P","D","create",19,"it","setDesc",20,"getDesc","../../modules/es6.object.statics-accept-primitives",21,"assert","condition","msg1","msg2","def","assertDefined","fn","isFunction","obj","isObject","inst","name","./$",22,"enumKeys","source","T","S","ES5Object","keys","j","./$.enum-keys",23,"cof","toString","TAG","classof","O","tag","stat","./$.wks",24,"fastKey","$has","ID","isExtensible","getEntry","that","entry","O1","FIRST","k","ctx","safe","forOf","step","LAST","ITER","SIZE","DESC","getConstructor","wrapper","NAME","IS_MAP","ADDER","C","iterable","clear","p","delete","next","prev","callbackfn","v","setIter","iterated","kind","iter","./$.assert","./$.ctx","./$.for-of","./$.iter","./$.iter-define","./$.mix","./$.uid",25,"$def","toJSON","arr","./$.def",26,"$iter","BUGGY","assertInstance","INTERNAL","methods","common","IS_WEAK","Base","g","proto","entries","each","split","KEY","chain","b","result","G","W","F","./$.cof","./$.species",27,"assertFunction","c",28,"type","own","out","exp","isGlobal","isProto","global","B","param",29,"getKeys","getSymbols",30,"iterator","done","close","./$.iter-call",31,"FW","path",32,"getWindowNames","getNames","windowNames","getOwnPropertyNames","toObject",33,"ret","assertObject",34,"$redef","SYMBOL_ITERATOR","FF_ITERATOR","KEYS","VALUES","Iterators","DEFAULT","IS_SET","FORCE","createMethod","$$","_native","_default","IteratorPrototype","getProto","values","./$.redef",35,"setIterator","is","Symbol","getIter","./$.shared",36,"toInteger","isNaN","ceil","bitmap","simpleSet","createDefiner","self","defineProperty","hasOwnProperty","max","min","html","documentElement","toLength","toIndex","getOwnPropertyDescriptor","setDescs","getOwnPropertySymbols","__e","__g","./$.fw",37,38,39,"SHARED","store",40,"SPECIES",41,"TO_STRING","pos","String","charCodeAt","charAt",42,"uid","sid","random",43,44,45,"setUnscope","Array","Arguments","./$.unscope",46,"strong","./$.collection","./$.collection-strong",47,"./$.assign",48,"forced","method","./$.get-names",49,"tmp",50,"$at","point","./$.string-at",51,"./$.collection-to-json",52,"ITERATOR","ArrayValues","NL","NodeList","HTC","HTMLCollection","NLProto","HTCProto","./es6.array.iterator",53,"_events","_maxListeners","arg","isNumber","isUndefined","defaultMaxListeners","setMaxListeners","er","handler","len","listeners","error","addListener","listener","m","newListener","warned","console","trace","once","removeListener","fired","list","position","removeAllListeners","listenerCount","emitter",54,"hb","base","HandlebarsEnvironment","Utils","extend","SafeString","_SafeString2","Exception","_Exception2","escapeExpression","VM","runtime","spec","_interopRequireWildcard","_import","_SafeString","_Exception","_import2","_import3","_noConflict","_noConflict2","./handlebars/base","./handlebars/exception","./handlebars/no-conflict","./handlebars/runtime","./handlebars/safe-string","./handlebars/utils",55,"registerDefaultHelpers","registerHelper","inverse","isArray","ids","createFrame","contextPath","appendContextPath","execIteration","field","last","first","blockParams","priorKey","conditional","hash","includeZero","isEmpty","level","parseInt","log","frame","_parent","VERSION","COMPILER_REVISION","REVISION_CHANGES","objectType","logger","unregisterHelper","registerPartial","partial","unregisterPartial","methodMap","DEBUG","INFO","WARN","ERROR","./exception","./utils",56,"node","loc","line","column","start","idx","errorProps","captureStackTrace","lineNumber",57,"Handlebars","root","$Handlebars","noConflict",58,"checkRevision","compilerInfo","compilerRevision","currentRevision","_COMPILER_REVISION$REVISION_CHANGES$createFrame","runtimeVersions","compilerVersions","templateSpec","env","invokePartialWrapper","resolvePartial","invokePartial","compile","compilerOptions","indent","lines","join","_setup","initData","depths","useBlockParams","useDepths","container","strict","lookup","lambda","current","programs","program","declaredBlockParams","programWrapper","wrapProgram","depth","merge","noop","isTop","usePartial","_child","prog","./base",59,"string","toHTML",60,"escapeChar","chr","escape","indexOf","array","possible","test","replace","badChars","params","&","<",">","\"","'","`",61,"./dist/cjs/handlebars.runtime",62,"isObjectLike","getNative","isNative","objToString","funcTag","reIsNative","fnToString","reIsHostCtor","objectProto","RegExp",63,"func","wait","cancel","timeoutId","clearTimeout","maxTimeoutId","lastCalled","trailingCall","complete","isCalled","now","thisArg","delayed","remaining","stamp","setTimeout","maxDelayed","trailing","debounced","leading","maxWait","leadingCall","FUNC_ERROR_TEXT","nativeMax","nativeNow","Date","getTime","lodash._getnative"],"mappings":"CAAA,QAAUA,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATC,UAAqBA,OAAQ,KAAIF,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGI,EAAE,MAAOA,GAAEJ,GAAE,EAAI,IAAIK,GAAE,GAAIC,OAAM,uBAAuBN,EAAE,IAAK,MAAMK,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEX,EAAEG,IAAIS,WAAYb,GAAEI,GAAG,GAAGU,KAAKF,EAAEC,QAAQ,SAASd,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIa,EAAEA,EAAEC,QAAQd,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGS,QAAkD,IAAI,GAA1CL,GAAkB,kBAATD,UAAqBA,QAAgBH,EAAE,EAAEA,EAAEF,EAAEa,OAAOX,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKa,GAAG,SAAST,EAAQU,EAAOJ,GACvd,YAEA,IAAIK,GAAOX,EAAQ,6BAAsC,QAErDY,EAAYZ,EAAQ,kCAA2C,QAE/Da,EAAeb,EAAQ,sCAA+C,QAEtEc,EAAk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lB,KAAKoU,IACjBkR,EAAYlC,EAAUmC,KAAM,OAgB5Bf,EAAMc,GAAa,WACrB,OAAO,GAAIC,OAAOC,UAyMpBtpB,GAAOJ,QAAU4F,IAEd+jB,oBAAoB,UAAU","sourceRoot":"./"} \ No newline at end of file diff --git a/dist/img/loading.gif b/dist/img/loading.gif new file mode 100644 index 0000000..95350aa Binary files /dev/null and b/dist/img/loading.gif differ diff --git a/examples/basic.html b/examples/basic.html old mode 100755 new mode 100644 index 87c4be8..1807eff --- a/examples/basic.html +++ b/examples/basic.html @@ -1,62 +1,11 @@ - + - - - - - - + + Basic Example + + + + - Comic Book Reader - - - - - - - - - - - - - - + diff --git a/examples/bitjs/README.txt b/examples/bitjs/README.txt deleted file mode 100755 index 9de777a..0000000 --- a/examples/bitjs/README.txt +++ /dev/null @@ -1 +0,0 @@ -bitjs: Binary Tools for JavaScript diff --git a/examples/bitjs/archive.js b/examples/bitjs/archive.js deleted file mode 100755 index ae6f1e5..0000000 --- a/examples/bitjs/archive.js +++ /dev/null @@ -1,340 +0,0 @@ -/** - * archive.js - * - * Provides base functionality for unarchiving. - * - * Licensed under the MIT License - * - * Copyright(c) 2011 Google Inc. - */ - -var bitjs = bitjs || {}; -bitjs.archive = bitjs.archive || {}; - -(function() { - -// =========================================================================== -// Stolen from Closure because it's the best way to do Java-like inheritance. -bitjs.base = function(me, opt_methodName, var_args) { - var caller = arguments.callee.caller; - if (caller.superClass_) { - // This is a constructor. Call the superclass constructor. - return caller.superClass_.constructor.apply( - me, Array.prototype.slice.call(arguments, 1)); - } - - var args = Array.prototype.slice.call(arguments, 2); - var foundCaller = false; - for (var ctor = me.constructor; - ctor; ctor = ctor.superClass_ && ctor.superClass_.constructor) { - if (ctor.prototype[opt_methodName] === caller) { - foundCaller = true; - } else if (foundCaller) { - return ctor.prototype[opt_methodName].apply(me, args); - } - } - - // If we did not find the caller in the prototype chain, - // then one of two things happened: - // 1) The caller is an instance method. - // 2) This method was not called by the right caller. - if (me[opt_methodName] === caller) { - return me.constructor.prototype[opt_methodName].apply(me, args); - } else { - throw Error( - 'goog.base called from a method of one name ' + - 'to a method of a different name'); - } -}; -bitjs.inherits = function(childCtor, parentCtor) { - /** @constructor */ - function tempCtor() {}; - tempCtor.prototype = parentCtor.prototype; - childCtor.superClass_ = parentCtor.prototype; - childCtor.prototype = new tempCtor(); - childCtor.prototype.constructor = childCtor; -}; -// =========================================================================== - -/** - * An unarchive event. - * - * @param {string} type The event type. - * @constructor - */ -bitjs.archive.UnarchiveEvent = function(type) { - /** - * The event type. - * - * @type {string} - */ - this.type = type; -}; - -/** - * The UnarchiveEvent types. - */ -bitjs.archive.UnarchiveEvent.Type = { - START: 'start', - PROGRESS: 'progress', - EXTRACT: 'extract', - FINISH: 'finish', - INFO: 'info', - ERROR: 'error' -}; - -/** - * Useful for passing info up to the client (for debugging). - * - * @param {string} msg The info message. - */ -bitjs.archive.UnarchiveInfoEvent = function(msg) { - bitjs.base(this, bitjs.archive.UnarchiveEvent.Type.INFO); - - /** - * The information message. - * - * @type {string} - */ - this.msg = msg; -}; -bitjs.inherits(bitjs.archive.UnarchiveInfoEvent, bitjs.archive.UnarchiveEvent); - -/** - * An unrecoverable error has occured. - * - * @param {string} msg The error message. - */ -bitjs.archive.UnarchiveErrorEvent = function(msg) { - bitjs.base(this, bitjs.archive.UnarchiveEvent.Type.ERROR); - - /** - * The information message. - * - * @type {string} - */ - this.msg = msg; -}; -bitjs.inherits(bitjs.archive.UnarchiveErrorEvent, bitjs.archive.UnarchiveEvent); - -/** - * Start event. - * - * @param {string} msg The info message. - */ -bitjs.archive.UnarchiveStartEvent = function() { - bitjs.base(this, bitjs.archive.UnarchiveEvent.Type.START); -}; -bitjs.inherits(bitjs.archive.UnarchiveStartEvent, bitjs.archive.UnarchiveEvent); - -/** - * Finish event. - * - * @param {string} msg The info message. - */ -bitjs.archive.UnarchiveFinishEvent = function() { - bitjs.base(this, bitjs.archive.UnarchiveEvent.Type.FINISH); -}; -bitjs.inherits(bitjs.archive.UnarchiveFinishEvent, bitjs.archive.UnarchiveEvent); - -/** - * Progress event. - */ -bitjs.archive.UnarchiveProgressEvent = function( - currentFilename, - currentFileNumber, - currentBytesUnarchivedInFile, - currentBytesUnarchived, - totalUncompressedBytesInArchive, - totalFilesInArchive) { - bitjs.base(this, bitjs.archive.UnarchiveEvent.Type.PROGRESS); - - this.currentFilename = currentFilename; - this.currentFileNumber = currentFileNumber; - this.currentBytesUnarchivedInFile = currentBytesUnarchivedInFile; - this.totalFilesInArchive = totalFilesInArchive; - this.currentBytesUnarchived = currentBytesUnarchived; - this.totalUncompressedBytesInArchive = totalUncompressedBytesInArchive; -}; -bitjs.inherits(bitjs.archive.UnarchiveProgressEvent, bitjs.archive.UnarchiveEvent); - -/** - * All extracted files returned by an Unarchiver will implement - * the following interface: - * - * interface UnarchivedFile { - * string filename - * TypedArray fileData - * } - * - */ - -/** - * Extract event. - */ -bitjs.archive.UnarchiveExtractEvent = function(unarchivedFile) { - bitjs.base(this, bitjs.archive.UnarchiveEvent.Type.EXTRACT); - - /** - * @type {UnarchivedFile} - */ - this.unarchivedFile = unarchivedFile; -}; -bitjs.inherits(bitjs.archive.UnarchiveExtractEvent, bitjs.archive.UnarchiveEvent); - - -/** - * Base class for all Unarchivers. - * - * @param {ArrayBuffer} arrayBuffer The Array Buffer. - * @param {string} opt_pathToBitJS Optional string for where the BitJS files are located. - * @constructor - */ -bitjs.archive.Unarchiver = function(arrayBuffer, opt_pathToBitJS) { - /** - * The ArrayBuffer object. - * @type {ArrayBuffer} - * @protected - */ - this.ab = arrayBuffer; - - /** - * The path to the BitJS files. - * @type {string} - * @private - */ - this.pathToBitJS_ = opt_pathToBitJS || ''; - - /** - * A map from event type to an array of listeners. - * @type {Map.} - */ - this.listeners_ = {}; - for (var type in bitjs.archive.UnarchiveEvent.Type) { - this.listeners_[bitjs.archive.UnarchiveEvent.Type[type]] = []; - } -}; - -/** - * Private web worker initialized during start(). - * @type {Worker} - * @private - */ -bitjs.archive.Unarchiver.prototype.worker_ = null; - -/** - * This method must be overridden by the subclass to return the script filename. - * @return {string} The script filename. - * @protected. - */ -bitjs.archive.Unarchiver.prototype.getScriptFileName = function() { - throw 'Subclasses of AbstractUnarchiver must overload getScriptFileName()'; -}; - -/** - * Adds an event listener for UnarchiveEvents. - * - * @param {string} Event type. - * @param {function} An event handler function. - */ -bitjs.archive.Unarchiver.prototype.addEventListener = function(type, listener) { - if (type in this.listeners_) { - if (this.listeners_[type].indexOf(listener) == -1) { - this.listeners_[type].push(listener); - } - } -}; - -/** - * Removes an event listener. - * - * @param {string} Event type. - * @param {EventListener|function} An event listener or handler function. - */ -bitjs.archive.Unarchiver.prototype.removeEventListener = function(type, listener) { - if (type in this.listeners_) { - var index = this.listeners_[type].indexOf(listener); - if (index != -1) { - this.listeners_[type].splice(index, 1); - } - } -}; - -/** - * Receive an event and pass it to the listener functions. - * - * @param {bitjs.archive.UnarchiveEvent} e - * @private - */ -bitjs.archive.Unarchiver.prototype.handleWorkerEvent_ = function(e) { - if ((e instanceof bitjs.archive.UnarchiveEvent || e.type) && - this.listeners_[e.type] instanceof Array) { - this.listeners_[e.type].forEach(function (listener) { listener(e) }); - } else { - console.log(e); - } -}; - -/** - * Starts the unarchive in a separate Web Worker thread and returns immediately. - */ - bitjs.archive.Unarchiver.prototype.start = function() { - var me = this; - var scriptFileName = this.pathToBitJS_ + this.getScriptFileName(); - if (scriptFileName) { - this.worker_ = new Worker(scriptFileName); - - this.worker_.onerror = function(e) { - console.log('Worker error: message = ' + e.message); - throw e; - }; - - this.worker_.onmessage = function(e) { - if (typeof e.data == 'string') { - // Just log any strings the workers pump our way. - console.log(e.data); - } else { - // Assume that it is an UnarchiveEvent. Some browsers preserve the 'type' - // so that instanceof UnarchiveEvent returns true, but others do not. - me.handleWorkerEvent_(e.data); - } - }; - - this.worker_.postMessage({file: this.ab}); - } -} - -/** - * Unzipper - * @extends {bitjs.archive.Unarchiver} - * @constructor - */ -bitjs.archive.Unzipper = function(arrayBuffer, opt_pathToBitJS) { - bitjs.base(this, arrayBuffer, opt_pathToBitJS); -}; -bitjs.inherits(bitjs.archive.Unzipper, bitjs.archive.Unarchiver); -bitjs.archive.Unzipper.prototype.getScriptFileName = function() { return 'unzip.js' }; - -/** - * Unrarrer - * @extends {bitjs.archive.Unarchiver} - * @constructor - */ -bitjs.archive.Unrarrer = function(arrayBuffer, opt_pathToBitJS) { - bitjs.base(this, arrayBuffer, opt_pathToBitJS); -}; -bitjs.inherits(bitjs.archive.Unrarrer, bitjs.archive.Unarchiver); -bitjs.archive.Unrarrer.prototype.getScriptFileName = function() { return 'unrar.js' }; - -/** - * Untarrer - * @extends {bitjs.archive.Unarchiver} - * @constructor - */ -bitjs.archive.Untarrer = function(arrayBuffer, opt_pathToBitJS) { - bitjs.base(this, arrayBuffer, opt_pathToBitJS); -}; -bitjs.inherits(bitjs.archive.Untarrer, bitjs.archive.Unarchiver); -bitjs.archive.Untarrer.prototype.getScriptFileName = function() { return 'untar.js' }; - -})(); \ No newline at end of file diff --git a/examples/bitjs/drive.html b/examples/bitjs/drive.html deleted file mode 100755 index 1ad7b7d..0000000 --- a/examples/bitjs/drive.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - diff --git a/examples/bitjs/io.js b/examples/bitjs/io.js deleted file mode 100755 index 0abd637..0000000 --- a/examples/bitjs/io.js +++ /dev/null @@ -1,310 +0,0 @@ -/* - * io.js - * - * Provides readers for bit/byte streams (reading) and a byte buffer (writing). - * - * Licensed under the MIT License - * - * Copyright(c) 2011 Google Inc. - * Copyright(c) 2011 antimatter15 - */ - -var bitjs = bitjs || {}; -bitjs.io = bitjs.io || {}; - -(function() { - -// mask for getting the Nth bit (zero-based) -bitjs.BIT = [ 0x01, 0x02, 0x04, 0x08, - 0x10, 0x20, 0x40, 0x80, - 0x100, 0x200, 0x400, 0x800, - 0x1000, 0x2000, 0x4000, 0x8000]; - -// mask for getting N number of bits (0-8) -var BITMASK = [0, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF ]; - - -/** - * This bit stream peeks and consumes bits out of a binary stream. - * - * {ArrayBuffer} ab An ArrayBuffer object or a Uint8Array. - * {boolean} rtl Whether the stream reads bits from the byte starting - * from bit 7 to 0 (true) or bit 0 to 7 (false). - * {Number} opt_offset The offset into the ArrayBuffer - * {Number} opt_length The length of this BitStream - */ -bitjs.io.BitStream = function(ab, rtl, opt_offset, opt_length) { - if (!ab || !ab.toString || ab.toString() !== "[object ArrayBuffer]") { - throw "Error! BitArray constructed with an invalid ArrayBuffer object"; - } - - var offset = opt_offset || 0; - var length = opt_length || ab.byteLength; - this.bytes = new Uint8Array(ab, offset, length); - this.bytePtr = 0; // tracks which byte we are on - this.bitPtr = 0; // tracks which bit we are on (can have values 0 through 7) - this.peekBits = rtl ? this.peekBits_rtl : this.peekBits_ltr; -}; - -// byte0 byte1 byte2 byte3 -// 7......0 | 7......0 | 7......0 | 7......0 -// -// The bit pointer starts at bit0 of byte0 and moves left until it reaches -// bit7 of byte0, then jumps to bit0 of byte1, etc. -bitjs.io.BitStream.prototype.peekBits_ltr = function(n, movePointers) { - if (n <= 0 || typeof n != typeof 1) { - return 0; - } - - var movePointers = movePointers || false, - bytePtr = this.bytePtr, - bitPtr = this.bitPtr, - result = 0, - bitsIn = 0, - bytes = this.bytes; - - // keep going until we have no more bits left to peek at - // TODO: Consider putting all bits from bytes we will need into a variable and then - // shifting/masking it to just extract the bits we want. - // This could be considerably faster when reading more than 3 or 4 bits at a time. - while (n > 0) { - if (bytePtr >= bytes.length) { - throw "Error! Overflowed the bit stream! n=" + n + ", bytePtr=" + bytePtr + ", bytes.length=" + - bytes.length + ", bitPtr=" + bitPtr; - return -1; - } - - var numBitsLeftInThisByte = (8 - bitPtr); - if (n >= numBitsLeftInThisByte) { - var mask = (BITMASK[numBitsLeftInThisByte] << bitPtr); - result |= (((bytes[bytePtr] & mask) >> bitPtr) << bitsIn); - - bytePtr++; - bitPtr = 0; - bitsIn += numBitsLeftInThisByte; - n -= numBitsLeftInThisByte; - } - else { - var mask = (BITMASK[n] << bitPtr); - result |= (((bytes[bytePtr] & mask) >> bitPtr) << bitsIn); - - bitPtr += n; - bitsIn += n; - n = 0; - } - } - - if (movePointers) { - this.bitPtr = bitPtr; - this.bytePtr = bytePtr; - } - - return result; -}; - -// byte0 byte1 byte2 byte3 -// 7......0 | 7......0 | 7......0 | 7......0 -// -// The bit pointer starts at bit7 of byte0 and moves right until it reaches -// bit0 of byte0, then goes to bit7 of byte1, etc. -bitjs.io.BitStream.prototype.peekBits_rtl = function(n, movePointers) { - if (n <= 0 || typeof n != typeof 1) { - return 0; - } - - var movePointers = movePointers || false, - bytePtr = this.bytePtr, - bitPtr = this.bitPtr, - result = 0, - bytes = this.bytes; - - // keep going until we have no more bits left to peek at - // TODO: Consider putting all bits from bytes we will need into a variable and then - // shifting/masking it to just extract the bits we want. - // This could be considerably faster when reading more than 3 or 4 bits at a time. - while (n > 0) { - - if (bytePtr >= bytes.length) { - throw "Error! Overflowed the bit stream! n=" + n + ", bytePtr=" + bytePtr + ", bytes.length=" + - bytes.length + ", bitPtr=" + bitPtr; - return -1; - } - - var numBitsLeftInThisByte = (8 - bitPtr); - if (n >= numBitsLeftInThisByte) { - result <<= numBitsLeftInThisByte; - result |= (BITMASK[numBitsLeftInThisByte] & bytes[bytePtr]); - bytePtr++; - bitPtr = 0; - n -= numBitsLeftInThisByte; - } - else { - result <<= n; - result |= ((bytes[bytePtr] & (BITMASK[n] << (8 - n - bitPtr))) >> (8 - n - bitPtr)); - - bitPtr += n; - n = 0; - } - } - - if (movePointers) { - this.bitPtr = bitPtr; - this.bytePtr = bytePtr; - } - - return result; -}; - -//some voodoo magic -bitjs.io.BitStream.prototype.getBits = function() { - return (((((this.bytes[this.bytePtr] & 0xff) << 16) + - ((this.bytes[this.bytePtr+1] & 0xff) << 8) + - ((this.bytes[this.bytePtr+2] & 0xff))) >>> (8-this.bitPtr)) & 0xffff); -}; - -bitjs.io.BitStream.prototype.readBits = function(n) { - return this.peekBits(n, true); -}; - -// This returns n bytes as a sub-array, advancing the pointer if movePointers -// is true. -// Only use this for uncompressed blocks as this throws away remaining bits in -// the current byte. -bitjs.io.BitStream.prototype.peekBytes = function(n, movePointers) { - if (n <= 0 || typeof n != typeof 1) { - return 0; - } - - // from http://tools.ietf.org/html/rfc1951#page-11 - // "Any bits of input up to the next byte boundary are ignored." - while (this.bitPtr != 0) { - this.readBits(1); - } - - var movePointers = movePointers || false; - var bytePtr = this.bytePtr, - bitPtr = this.bitPtr; - - var result = this.bytes.subarray(bytePtr, bytePtr + n); - - if (movePointers) { - this.bytePtr += n; - } - - return result; -}; - -bitjs.io.BitStream.prototype.readBytes = function( n ) { - return this.peekBytes(n, true); -}; - - -/** - * This object allows you to peek and consume bytes as numbers and strings - * out of an ArrayBuffer. - * - * This object is much easier to write than the above BitStream since - * everything is byte-aligned. - * - * {ArrayBuffer} ab The ArrayBuffer object. - * {Number} opt_offset The offset into the ArrayBuffer - * {Number} opt_length The length of this BitStream - */ -bitjs.io.ByteStream = function(ab, opt_offset, opt_length) { - var offset = opt_offset || 0; - var length = opt_length || ab.byteLength; - this.bytes = new Uint8Array(ab, offset, length); - this.ptr = 0; -}; - -// peeks at the next n bytes as an unsigned number but does not advance the pointer -// TODO: This apparently cannot read more than 4 bytes as a number? -bitjs.io.ByteStream.prototype.peekNumber = function( n ) { - // TODO: return error if n would go past the end of the stream? - if (n <= 0 || typeof n != typeof 1) - return -1; - - var result = 0; - // read from last byte to first byte and roll them in - var curByte = this.ptr + n - 1; - while (curByte >= this.ptr) { - result <<= 8; - result |= this.bytes[curByte]; - --curByte; - } - return result; -}; - -// returns the next n bytes as an unsigned number (or -1 on error) -// and advances the stream pointer n bytes -bitjs.io.ByteStream.prototype.readNumber = function( n ) { - var num = this.peekNumber( n ); - this.ptr += n; - return num; -}; - -// This returns n bytes as a sub-array, advancing the pointer if movePointers -// is true. -bitjs.io.ByteStream.prototype.peekBytes = function(n, movePointers) { - if (n <= 0 || typeof n != typeof 1) { - return 0; - } - - var result = this.bytes.subarray(this.ptr, this.ptr + n); - - if (movePointers) { - this.ptr += n; - } - - return result; -}; - -bitjs.io.ByteStream.prototype.readBytes = function( n ) { - return this.peekBytes(n, true); -}; - -// peeks at the next n bytes as a string but does not advance the pointer -bitjs.io.ByteStream.prototype.peekString = function( n ) { - if (n <= 0 || typeof n != typeof 1) { - return 0; - } - - var result = ""; - for (var p = this.ptr, end = this.ptr + n; p < end; ++p) { - result += String.fromCharCode(this.bytes[p]); - } - return result; -}; - -// returns the next n bytes as a string -// and advances the stream pointer n bytes -bitjs.io.ByteStream.prototype.readString = function(n) { - var strToReturn = this.peekString(n); - this.ptr += n; - return strToReturn; -}; - - -/** - * A write-only Byte buffer which uses a Uint8 Typed Array as a backing store. - */ -bitjs.io.ByteBuffer = function(numBytes) { - if (typeof numBytes != typeof 1 || numBytes <= 0) { - throw "Error! ByteBuffer initialized with '" + numBytes + "'"; - } - this.data = new Uint8Array(numBytes); - this.ptr = 0; -}; - -bitjs.io.ByteBuffer.prototype.insertByte = function(b) { - // TODO: throw if byte is invalid? - this.data[this.ptr++] = b; -}; - -bitjs.io.ByteBuffer.prototype.insertBytes = function(bytes) { - // TODO: throw if bytes is invalid? - this.data.set(bytes, this.ptr); - this.ptr += bytes.length; -}; - -})(); diff --git a/examples/bitjs/unrar.js b/examples/bitjs/unrar.js deleted file mode 100755 index e7133dc..0000000 --- a/examples/bitjs/unrar.js +++ /dev/null @@ -1,906 +0,0 @@ -/** - * unrar.js - * - * Copyright(c) 2011 Google Inc. - * Copyright(c) 2011 antimatter15 - * - * Reference Documentation: - * - * http://kthoom.googlecode.com/hg/docs/unrar.html - */ - -// This file expects to be invoked as a Worker (see onmessage below). -importScripts('io.js'); -importScripts('archive.js'); - -// Progress variables. -var currentFilename = ""; -var currentFileNumber = 0; -var currentBytesUnarchivedInFile = 0; -var currentBytesUnarchived = 0; -var totalUncompressedBytesInArchive = 0; -var totalFilesInArchive = 0; - -// Helper functions. -var info = function(str) { - postMessage(new bitjs.archive.UnarchiveInfoEvent(str)); -}; -var err = function(str) { - postMessage(new bitjs.archive.UnarchiveErrorEvent(str)); -}; -var postProgress = function() { - postMessage(new bitjs.archive.UnarchiveProgressEvent( - currentFilename, - currentFileNumber, - currentBytesUnarchivedInFile, - currentBytesUnarchived, - totalUncompressedBytesInArchive, - totalFilesInArchive)); -}; - -// shows a byte value as its hex representation -var nibble = "0123456789ABCDEF"; -var byteValueToHexString = function(num) { - return nibble[num>>4] + nibble[num&0xF]; -}; -var twoByteValueToHexString = function(num) { - return nibble[(num>>12)&0xF] + nibble[(num>>8)&0xF] + nibble[(num>>4)&0xF] + nibble[num&0xF]; -}; - - -// Volume Types -var MARK_HEAD = 0x72, - MAIN_HEAD = 0x73, - FILE_HEAD = 0x74, - COMM_HEAD = 0x75, - AV_HEAD = 0x76, - SUB_HEAD = 0x77, - PROTECT_HEAD = 0x78, - SIGN_HEAD = 0x79, - NEWSUB_HEAD = 0x7a, - ENDARC_HEAD = 0x7b; - -// bstream is a bit stream -var RarVolumeHeader = function(bstream) { - - var headPos = bstream.bytePtr; - // byte 1,2 - info("Rar Volume Header @"+bstream.bytePtr); - - this.crc = bstream.readBits(16); - info(" crc=" + this.crc); - - // byte 3 - this.headType = bstream.readBits(8); - info(" headType=" + this.headType); - - // Get flags - // bytes 4,5 - this.flags = {}; - this.flags.value = bstream.peekBits(16); - - info(" flags=" + twoByteValueToHexString(this.flags.value)); - switch (this.headType) { - case MAIN_HEAD: - this.flags.MHD_VOLUME = !!bstream.readBits(1); - this.flags.MHD_COMMENT = !!bstream.readBits(1); - this.flags.MHD_LOCK = !!bstream.readBits(1); - this.flags.MHD_SOLID = !!bstream.readBits(1); - this.flags.MHD_PACK_COMMENT = !!bstream.readBits(1); - this.flags.MHD_NEWNUMBERING = this.flags.MHD_PACK_COMMENT; - this.flags.MHD_AV = !!bstream.readBits(1); - this.flags.MHD_PROTECT = !!bstream.readBits(1); - this.flags.MHD_PASSWORD = !!bstream.readBits(1); - this.flags.MHD_FIRSTVOLUME = !!bstream.readBits(1); - this.flags.MHD_ENCRYPTVER = !!bstream.readBits(1); - bstream.readBits(6); // unused - break; - case FILE_HEAD: - this.flags.LHD_SPLIT_BEFORE = !!bstream.readBits(1); // 0x0001 - this.flags.LHD_SPLIT_AFTER = !!bstream.readBits(1); // 0x0002 - this.flags.LHD_PASSWORD = !!bstream.readBits(1); // 0x0004 - this.flags.LHD_COMMENT = !!bstream.readBits(1); // 0x0008 - this.flags.LHD_SOLID = !!bstream.readBits(1); // 0x0010 - bstream.readBits(3); // unused - this.flags.LHD_LARGE = !!bstream.readBits(1); // 0x0100 - this.flags.LHD_UNICODE = !!bstream.readBits(1); // 0x0200 - this.flags.LHD_SALT = !!bstream.readBits(1); // 0x0400 - this.flags.LHD_VERSION = !!bstream.readBits(1); // 0x0800 - this.flags.LHD_EXTTIME = !!bstream.readBits(1); // 0x1000 - this.flags.LHD_EXTFLAGS = !!bstream.readBits(1); // 0x2000 - bstream.readBits(2); // unused - info(" LHD_SPLIT_BEFORE = " + this.flags.LHD_SPLIT_BEFORE); - break; - default: - bstream.readBits(16); - } - - // byte 6,7 - this.headSize = bstream.readBits(16); - info(" headSize=" + this.headSize); - switch (this.headType) { - case MAIN_HEAD: - this.highPosAv = bstream.readBits(16); - this.posAv = bstream.readBits(32); - if (this.flags.MHD_ENCRYPTVER) { - this.encryptVer = bstream.readBits(8); - } - info("Found MAIN_HEAD with highPosAv=" + this.highPosAv + ", posAv=" + this.posAv); - break; - case FILE_HEAD: - this.packSize = bstream.readBits(32); - this.unpackedSize = bstream.readBits(32); - this.hostOS = bstream.readBits(8); - this.fileCRC = bstream.readBits(32); - this.fileTime = bstream.readBits(32); - this.unpVer = bstream.readBits(8); - this.method = bstream.readBits(8); - this.nameSize = bstream.readBits(16); - this.fileAttr = bstream.readBits(32); - - if (this.flags.LHD_LARGE) { - info("Warning: Reading in LHD_LARGE 64-bit size values"); - this.HighPackSize = bstream.readBits(32); - this.HighUnpSize = bstream.readBits(32); - } else { - this.HighPackSize = 0; - this.HighUnpSize = 0; - if (this.unpackedSize == 0xffffffff) { - this.HighUnpSize = 0x7fffffff - this.unpackedSize = 0xffffffff; - } - } - this.fullPackSize = 0; - this.fullUnpackSize = 0; - this.fullPackSize |= this.HighPackSize; - this.fullPackSize <<= 32; - this.fullPackSize |= this.packSize; - - // read in filename - - this.filename = bstream.readBytes(this.nameSize); - for (var _i = 0, _s = ''; _i < this.filename.length; _i++) { - _s += String.fromCharCode(this.filename[_i]); - } - - this.filename = _s; - - if (this.flags.LHD_SALT) { - info("Warning: Reading in 64-bit salt value"); - this.salt = bstream.readBits(64); // 8 bytes - } - - if (this.flags.LHD_EXTTIME) { - // 16-bit flags - var extTimeFlags = bstream.readBits(16); - - // this is adapted straight out of arcread.cpp, Archive::ReadHeader() - for (var I = 0; I < 4; ++I) { - var rmode = extTimeFlags >> ((3-I)*4); - if ((rmode & 8)==0) - continue; - if (I!=0) - bstream.readBits(16); - var count = (rmode&3); - for (var J = 0; J < count; ++J) - bstream.readBits(8); - } - } - - if (this.flags.LHD_COMMENT) { - info("Found a LHD_COMMENT"); - } - - - while(headPos + this.headSize > bstream.bytePtr) bstream.readBits(1); - - info("Found FILE_HEAD with packSize=" + this.packSize + ", unpackedSize= " + this.unpackedSize + ", hostOS=" + this.hostOS + ", unpVer=" + this.unpVer + ", method=" + this.method + ", filename=" + this.filename); - - break; - default: - info("Found a header of type 0x" + byteValueToHexString(this.headType)); - // skip the rest of the header bytes (for now) - bstream.readBytes( this.headSize - 7 ); - break; - } -}; - -var BLOCK_LZ = 0, - BLOCK_PPM = 1; - -var rLDecode = [0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224], - rLBits = [0,0,0,0,0,0,0,0,1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5], - rDBitLengthCounts = [4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,14,0,12], - rSDDecode = [0,4,8,16,32,64,128,192], - rSDBits = [2,2,3, 4, 5, 6, 6, 6]; - -var rDDecode = [0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, - 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, - 4096, 6144, 8192, 12288, 16384, 24576, 32768, 49152, 65536, 98304, - 131072, 196608, 262144, 327680, 393216, 458752, 524288, 589824, - 655360, 720896, 786432, 851968, 917504, 983040]; - -var rDBits = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, - 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, - 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16]; - -var rLOW_DIST_REP_COUNT = 16; - -var rNC = 299, - rDC = 60, - rLDC = 17, - rRC = 28, - rBC = 20, - rHUFF_TABLE_SIZE = (rNC+rDC+rRC+rLDC); - -var UnpBlockType = BLOCK_LZ; -var UnpOldTable = new Array(rHUFF_TABLE_SIZE); - -var BD = { //bitdecode - DecodeLen: new Array(16), - DecodePos: new Array(16), - DecodeNum: new Array(rBC) -}; -var LD = { //litdecode - DecodeLen: new Array(16), - DecodePos: new Array(16), - DecodeNum: new Array(rNC) -}; -var DD = { //distdecode - DecodeLen: new Array(16), - DecodePos: new Array(16), - DecodeNum: new Array(rDC) -}; -var LDD = { //low dist decode - DecodeLen: new Array(16), - DecodePos: new Array(16), - DecodeNum: new Array(rLDC) -}; -var RD = { //rep decode - DecodeLen: new Array(16), - DecodePos: new Array(16), - DecodeNum: new Array(rRC) -}; - -var rBuffer; - -// read in Huffman tables for RAR -function RarReadTables(bstream) { - var BitLength = new Array(rBC), - Table = new Array(rHUFF_TABLE_SIZE); - - // before we start anything we need to get byte-aligned - bstream.readBits( (8 - bstream.bitPtr) & 0x7 ); - - if (bstream.readBits(1)) { - info("Error! PPM not implemented yet"); - return; - } - - if (!bstream.readBits(1)) { //discard old table - for (var i = UnpOldTable.length; i--;) UnpOldTable[i] = 0; - } - - // read in bit lengths - for (var I = 0; I < rBC; ++I) { - - var Length = bstream.readBits(4); - if (Length == 15) { - var ZeroCount = bstream.readBits(4); - if (ZeroCount == 0) { - BitLength[I] = 15; - } - else { - ZeroCount += 2; - while (ZeroCount-- > 0 && I < rBC) - BitLength[I++] = 0; - --I; - } - } - else { - BitLength[I] = Length; - } - } - - // now all 20 bit lengths are obtained, we construct the Huffman Table: - - RarMakeDecodeTables(BitLength, 0, BD, rBC); - - var TableSize = rHUFF_TABLE_SIZE; - //console.log(DecodeLen, DecodePos, DecodeNum); - for (var i = 0; i < TableSize;) { - var num = RarDecodeNumber(bstream, BD); - if (num < 16) { - Table[i] = (num + UnpOldTable[i]) & 0xf; - i++; - } else if(num < 18) { - var N = (num == 16) ? (bstream.readBits(3) + 3) : (bstream.readBits(7) + 11); - - while (N-- > 0 && i < TableSize) { - Table[i] = Table[i - 1]; - i++; - } - } else { - var N = (num == 18) ? (bstream.readBits(3) + 3) : (bstream.readBits(7) + 11); - - while (N-- > 0 && i < TableSize) { - Table[i++] = 0; - } - } - } - - RarMakeDecodeTables(Table, 0, LD, rNC); - RarMakeDecodeTables(Table, rNC, DD, rDC); - RarMakeDecodeTables(Table, rNC + rDC, LDD, rLDC); - RarMakeDecodeTables(Table, rNC + rDC + rLDC, RD, rRC); - - for (var i = UnpOldTable.length; i--;) { - UnpOldTable[i] = Table[i]; - } - return true; -} - - -function RarDecodeNumber(bstream, dec) { - var DecodeLen = dec.DecodeLen, DecodePos = dec.DecodePos, DecodeNum = dec.DecodeNum; - var bitField = bstream.getBits() & 0xfffe; - //some sort of rolled out binary search - var bits = ((bitField < DecodeLen[8])? - ((bitField < DecodeLen[4])? - ((bitField < DecodeLen[2])? - ((bitField < DecodeLen[1])?1:2) - :((bitField < DecodeLen[3])?3:4)) - :(bitField < DecodeLen[6])? - ((bitField < DecodeLen[5])?5:6) - :((bitField < DecodeLen[7])?7:8)) - :((bitField < DecodeLen[12])? - ((bitField < DecodeLen[10])? - ((bitField < DecodeLen[9])?9:10) - :((bitField < DecodeLen[11])?11:12)) - :(bitField < DecodeLen[14])? - ((bitField < DecodeLen[13])?13:14) - :15)); - bstream.readBits(bits); - var N = DecodePos[bits] + ((bitField - DecodeLen[bits -1]) >>> (16 - bits)); - - return DecodeNum[N]; -} - - - -function RarMakeDecodeTables(BitLength, offset, dec, size) { - var DecodeLen = dec.DecodeLen, DecodePos = dec.DecodePos, DecodeNum = dec.DecodeNum; - var LenCount = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], - TmpPos = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], - N = 0, M = 0; - for (var i = DecodeNum.length; i--;) DecodeNum[i] = 0; - for (var i = 0; i < size; i++) { - LenCount[BitLength[i + offset] & 0xF]++; - } - LenCount[0] = 0; - TmpPos[0] = 0; - DecodePos[0] = 0; - DecodeLen[0] = 0; - - for (var I = 1; I < 16; ++I) { - N = 2 * (N+LenCount[I]); - M = (N << (15-I)); - if (M > 0xFFFF) - M = 0xFFFF; - DecodeLen[I] = M; - DecodePos[I] = DecodePos[I-1] + LenCount[I-1]; - TmpPos[I] = DecodePos[I]; - } - for (I = 0; I < size; ++I) - if (BitLength[I + offset] != 0) - DecodeNum[ TmpPos[ BitLength[offset + I] & 0xF ]++] = I; - -} - -// TODO: implement -function Unpack15(bstream, Solid) { - info("ERROR! RAR 1.5 compression not supported"); -} - -function Unpack20(bstream, Solid) { - var destUnpSize = rBuffer.data.length; - var oldDistPtr = 0; - - RarReadTables20(bstream); - while (destUnpSize > rBuffer.ptr) { - var num = RarDecodeNumber(bstream, LD); - if (num < 256) { - rBuffer.insertByte(num); - continue; - } - if (num > 269) { - var Length = rLDecode[num -= 270] + 3; - if ((Bits = rLBits[num]) > 0) { - Length += bstream.readBits(Bits); - } - var DistNumber = RarDecodeNumber(bstream, DD); - var Distance = rDDecode[DistNumber] + 1; - if ((Bits = rDBits[DistNumber]) > 0) { - Distance += bstream.readBits(Bits); - } - if (Distance >= 0x2000) { - Length++; - if(Distance >= 0x40000) Length++; - } - lastLength = Length; - lastDist = rOldDist[oldDistPtr++ & 3] = Distance; - RarCopyString(Length, Distance); - continue; - } - if (num == 269) { - RarReadTables20(bstream); - - RarUpdateProgress() - - continue; - } - if (num == 256) { - lastDist = rOldDist[oldDistPtr++ & 3] = lastDist; - RarCopyString(lastLength, lastDist); - continue; - } - if (num < 261) { - var Distance = rOldDist[(oldDistPtr - (num - 256)) & 3]; - var LengthNumber = RarDecodeNumber(bstream, RD); - var Length = rLDecode[LengthNumber] +2; - if ((Bits = rLBits[LengthNumber]) > 0) { - Length += bstream.readBits(Bits); - } - if (Distance >= 0x101) { - Length++; - if (Distance >= 0x2000) { - Length++ - if (Distance >= 0x40000) Length++; - } - } - lastLength = Length; - lastDist = rOldDist[oldDistPtr++ & 3] = Distance; - RarCopyString(Length, Distance); - continue; - } - if (num < 270) { - var Distance = rSDDecode[num -= 261] + 1; - if ((Bits = rSDBits[num]) > 0) { - Distance += bstream.readBits(Bits); - } - lastLength = 2; - lastDist = rOldDist[oldDistPtr++ & 3] = Distance; - RarCopyString(2, Distance); - continue; - } - - } - RarUpdateProgress() -} - -function RarUpdateProgress() { - var change = rBuffer.ptr - currentBytesUnarchivedInFile; - currentBytesUnarchivedInFile = rBuffer.ptr; - currentBytesUnarchived += change; - postProgress(); -} - - -var rNC20 = 298, - rDC20 = 48, - rRC20 = 28, - rBC20 = 19, - rMC20 = 257; - -var UnpOldTable20 = new Array(rMC20 * 4); - -function RarReadTables20(bstream) { - var BitLength = new Array(rBC20); - var Table = new Array(rMC20 * 4); - var TableSize, N, I; - var AudioBlock = bstream.readBits(1); - if (!bstream.readBits(1)) - for (var i = UnpOldTable20.length; i--;) UnpOldTable20[i] = 0; - TableSize = rNC20 + rDC20 + rRC20; - for (var I = 0; I < rBC20; I++) - BitLength[I] = bstream.readBits(4); - RarMakeDecodeTables(BitLength, 0, BD, rBC20); - I = 0; - while (I < TableSize) { - var num = RarDecodeNumber(bstream, BD); - if (num < 16) { - Table[I] = num + UnpOldTable20[I] & 0xf; - I++; - } else if(num == 16) { - N = bstream.readBits(2) + 3; - while (N-- > 0 && I < TableSize) { - Table[I] = Table[I - 1]; - I++; - } - } else { - if (num == 17) { - N = bstream.readBits(3) + 3; - } else { - N = bstream.readBits(7) + 11; - } - while (N-- > 0 && I < TableSize) { - Table[I++] = 0; - } - } - } - RarMakeDecodeTables(Table, 0, LD, rNC20); - RarMakeDecodeTables(Table, rNC20, DD, rDC20); - RarMakeDecodeTables(Table, rNC20 + rDC20, RD, rRC20); - for (var i = UnpOldTable20.length; i--;) UnpOldTable20[i] = Table[i]; -} - -var lowDistRepCount = 0, prevLowDist = 0; - -var rOldDist = [0,0,0,0]; -var lastDist; -var lastLength; - - -function Unpack29(bstream, Solid) { - // lazy initialize rDDecode and rDBits - - var DDecode = new Array(rDC); - var DBits = new Array(rDC); - - var Dist=0,BitLength=0,Slot=0; - - for (var I = 0; I < rDBitLengthCounts.length; I++,BitLength++) { - for (var J = 0; J < rDBitLengthCounts[I]; J++,Slot++,Dist+=(1<= 271) { - var Length = rLDecode[num -= 271] + 3; - if ((Bits = rLBits[num]) > 0) { - Length += bstream.readBits(Bits); - } - var DistNumber = RarDecodeNumber(bstream, DD); - var Distance = DDecode[DistNumber]+1; - if ((Bits = DBits[DistNumber]) > 0) { - if (DistNumber > 9) { - if (Bits > 4) { - Distance += ((bstream.getBits() >>> (20 - Bits)) << 4); - bstream.readBits(Bits - 4); - //todo: check this - } - if (lowDistRepCount > 0) { - lowDistRepCount--; - Distance += prevLowDist; - } else { - var LowDist = RarDecodeNumber(bstream, LDD); - if (LowDist == 16) { - lowDistRepCount = rLOW_DIST_REP_COUNT - 1; - Distance += prevLowDist; - } else { - Distance += LowDist; - prevLowDist = LowDist; - } - } - } else { - Distance += bstream.readBits(Bits); - } - } - if (Distance >= 0x2000) { - Length++; - if (Distance >= 0x40000) { - Length++; - } - } - RarInsertOldDist(Distance); - RarInsertLastMatch(Length, Distance); - RarCopyString(Length, Distance); - continue; - } - if (num == 256) { - if (!RarReadEndOfBlock(bstream)) break; - - continue; - } - if (num == 257) { - //console.log("READVMCODE"); - if (!RarReadVMCode(bstream)) break; - continue; - } - if (num == 258) { - if (lastLength != 0) { - RarCopyString(lastLength, lastDist); - } - continue; - } - if (num < 263) { - var DistNum = num - 259; - var Distance = rOldDist[DistNum]; - - for (var I = DistNum; I > 0; I--) { - rOldDist[I] = rOldDist[I-1]; - } - rOldDist[0] = Distance; - - var LengthNumber = RarDecodeNumber(bstream, RD); - var Length = rLDecode[LengthNumber] + 2; - if ((Bits = rLBits[LengthNumber]) > 0) { - Length += bstream.readBits(Bits); - } - RarInsertLastMatch(Length, Distance); - RarCopyString(Length, Distance); - continue; - } - if (num < 272) { - var Distance = rSDDecode[num -= 263] + 1; - if ((Bits = rSDBits[num]) > 0) { - Distance += bstream.readBits(Bits); - } - RarInsertOldDist(Distance); - RarInsertLastMatch(2, Distance); - RarCopyString(2, Distance); - continue; - } - - } - RarUpdateProgress() -} - -function RarReadEndOfBlock(bstream) { - - RarUpdateProgress() - - - var NewTable = false, NewFile = false; - if (bstream.readBits(1)) { - NewTable = true; - } else { - NewFile = true; - NewTable = !!bstream.readBits(1); - } - //tablesRead = !NewTable; - return !(NewFile || NewTable && !RarReadTables(bstream)); -} - - -function RarReadVMCode(bstream) { - var FirstByte = bstream.readBits(8); - var Length = (FirstByte & 7) + 1; - if (Length == 7) { - Length = bstream.readBits(8) + 7; - } else if(Length == 8) { - Length = bstream.readBits(16); - } - var vmCode = []; - for(var I = 0; I < Length; I++) { - //do something here with cheking readbuf - vmCode.push(bstream.readBits(8)); - } - return RarAddVMCode(FirstByte, vmCode, Length); -} - -function RarAddVMCode(firstByte, vmCode, length) { - //console.log(vmCode); - if (vmCode.length > 0) { - info("Error! RarVM not supported yet!"); - } - return true; -} - -function RarInsertLastMatch(length, distance) { - lastDist = distance; - lastLength = length; -} - -function RarInsertOldDist(distance) { - rOldDist.splice(3,1); - rOldDist.splice(0,0,distance); -} - -//this is the real function, the other one is for debugging -function RarCopyString(length, distance) { - var destPtr = rBuffer.ptr - distance; - if(destPtr < 0){ - var l = rOldBuffers.length; - while(destPtr < 0){ - destPtr = rOldBuffers[--l].data.length + destPtr - } - //TODO: lets hope that it never needs to read beyond file boundaries - while(length--) rBuffer.insertByte(rOldBuffers[l].data[destPtr++]); - - } - if (length > distance) { - while(length--) rBuffer.insertByte(rBuffer.data[destPtr++]); - } else { - rBuffer.insertBytes(rBuffer.data.subarray(destPtr, destPtr + length)); - } - -} - -var rOldBuffers = [] -// v must be a valid RarVolume -function unpack(v) { - - // TODO: implement what happens when unpVer is < 15 - var Ver = v.header.unpVer <= 15 ? 15 : v.header.unpVer, - Solid = v.header.LHD_SOLID, - bstream = new bitjs.io.BitStream(v.fileData.buffer, true /* rtl */, v.fileData.byteOffset, v.fileData.byteLength ); - - rBuffer = new bitjs.io.ByteBuffer(v.header.unpackedSize); - - info("Unpacking "+v.filename+" RAR v"+Ver); - - switch(Ver) { - case 15: // rar 1.5 compression - Unpack15(bstream, Solid); - break; - case 20: // rar 2.x compression - case 26: // files larger than 2GB - Unpack20(bstream, Solid); - break; - case 29: // rar 3.x compression - case 36: // alternative hash - Unpack29(bstream, Solid); - break; - } // switch(method) - - rOldBuffers.push(rBuffer); - //TODO: clear these old buffers when there's over 4MB of history - return rBuffer.data; -} - -// bstream is a bit stream -var RarLocalFile = function(bstream) { - - this.header = new RarVolumeHeader(bstream); - this.filename = this.header.filename; - - if (this.header.headType != FILE_HEAD && this.header.headType != ENDARC_HEAD) { - this.isValid = false; - info("Error! RAR Volume did not include a FILE_HEAD header "); - } - else { - // read in the compressed data - this.fileData = null; - if (this.header.packSize > 0) { - this.fileData = bstream.readBytes(this.header.packSize); - this.isValid = true; - } - } -}; - -RarLocalFile.prototype.unrar = function() { - - if (!this.header.flags.LHD_SPLIT_BEFORE) { - // unstore file - if (this.header.method == 0x30) { - info("Unstore "+this.filename); - this.isValid = true; - - currentBytesUnarchivedInFile += this.fileData.length; - currentBytesUnarchived += this.fileData.length; - } else { - this.isValid = true; - this.fileData = unpack(this); - } - } -} - -var unrar = function(arrayBuffer) { - currentFilename = ""; - currentFileNumber = 0; - currentBytesUnarchivedInFile = 0; - currentBytesUnarchived = 0; - totalUncompressedBytesInArchive = 0; - totalFilesInArchive = 0; - - postMessage(new bitjs.archive.UnarchiveStartEvent()); - var bstream = new bitjs.io.BitStream(arrayBuffer, false /* rtl */); - - var header = new RarVolumeHeader(bstream); - if (header.crc == 0x6152 && - header.headType == 0x72 && - header.flags.value == 0x1A21 && - header.headSize == 7) { - info("Found RAR signature"); - - var mhead = new RarVolumeHeader(bstream); - if (mhead.headType != MAIN_HEAD) { - info("Error! RAR did not include a MAIN_HEAD header"); - } - else { - var localFiles = [], - localFile = null; - do { - try { - localFile = new RarLocalFile(bstream); - info("RAR localFile isValid=" + localFile.isValid + ", volume packSize=" + localFile.header.packSize); - if (localFile && localFile.isValid && localFile.header.packSize > 0) { - totalUncompressedBytesInArchive += localFile.header.unpackedSize; - localFiles.push(localFile); - } else if (localFile.header.packSize == 0 && localFile.header.unpackedSize == 0) { - localFile.isValid = true; - } - } catch(err) { - break; - } - //info("bstream" + bstream.bytePtr+"/"+bstream.bytes.length); - } while( localFile.isValid ); - totalFilesInArchive = localFiles.length; - - // now we have all information but things are unpacked - // TODO: unpack - localFiles = localFiles.sort(function(a,b) { - // extract the number at the end of both filenames - var aname = a.filename; - var bname = b.filename; - return aname > bname ? 1 : -1; - /* - var aindex = aname.length, bindex = bname.length; - - // Find the last number character from the back of the filename. - while (aname[aindex-1] < '0' || aname[aindex-1] > '9') --aindex; - while (bname[bindex-1] < '0' || bname[bindex-1] > '9') --bindex; - - // Find the first number character from the back of the filename - while (aname[aindex-1] >= '0' && aname[aindex-1] <= '9') --aindex; - while (bname[bindex-1] >= '0' && bname[bindex-1] <= '9') --bindex; - - // parse them into numbers and return comparison - var anum = parseInt(aname.substr(aindex), 10), - bnum = parseInt(bname.substr(bindex), 10); - return bnum - anum;*/ - }); - - info(localFiles.map(function(a){return a.filename}).join(', ')); - for (var i = 0; i < localFiles.length; ++i) { - var localfile = localFiles[i]; - - // update progress - currentFilename = localfile.header.filename; - currentBytesUnarchivedInFile = 0; - - // actually do the unzipping - localfile.unrar(); - - if (localfile.isValid) { - postMessage(new bitjs.archive.UnarchiveExtractEvent(localfile)); - postProgress(); - } - } - - postProgress(); - } - } - else { - err("Invalid RAR file"); - } - postMessage(new bitjs.archive.UnarchiveFinishEvent()); -}; - -// event.data.file has the ArrayBuffer. -onmessage = function(event) { - var ab = event.data.file; - unrar(ab, true); -}; diff --git a/examples/bitjs/untar.js b/examples/bitjs/untar.js deleted file mode 100755 index 3b16764..0000000 --- a/examples/bitjs/untar.js +++ /dev/null @@ -1,182 +0,0 @@ -/** - * untar.js - * - * Copyright(c) 2011 Google Inc. - * - * Reference Documentation: - * - * TAR format: http://www.gnu.org/software/automake/manual/tar/Standard.html - */ - -// This file expects to be invoked as a Worker (see onmessage below). -importScripts('io.js'); -importScripts('archive.js'); - -// Progress variables. -var currentFilename = ""; -var currentFileNumber = 0; -var currentBytesUnarchivedInFile = 0; -var currentBytesUnarchived = 0; -var totalUncompressedBytesInArchive = 0; -var totalFilesInArchive = 0; - -// Helper functions. -var info = function(str) { - postMessage(new bitjs.archive.UnarchiveInfoEvent(str)); -}; -var err = function(str) { - postMessage(new bitjs.archive.UnarchiveErrorEvent(str)); -}; -var postProgress = function() { - postMessage(new bitjs.archive.UnarchiveProgressEvent( - currentFilename, - currentFileNumber, - currentBytesUnarchivedInFile, - currentBytesUnarchived, - totalUncompressedBytesInArchive, - totalFilesInArchive)); -}; - -// Removes all characters from the first zero-byte in the string onwards. -var readCleanString = function(bstr, numBytes) { - var str = bstr.readString(numBytes); - var zIndex = str.indexOf(String.fromCharCode(0)); - return zIndex != -1 ? str.substr(0, zIndex) : str; -}; - -// takes a ByteStream and parses out the local file information -var TarLocalFile = function(bstream) { - this.isValid = false; - - // Read in the header block - this.name = readCleanString(bstream, 100); - this.mode = readCleanString(bstream, 8); - this.uid = readCleanString(bstream, 8); - this.gid = readCleanString(bstream, 8); - this.size = parseInt(readCleanString(bstream, 12), 8); - this.mtime = readCleanString(bstream, 12); - this.chksum = readCleanString(bstream, 8); - this.typeflag = readCleanString(bstream, 1); - this.linkname = readCleanString(bstream, 100); - this.maybeMagic = readCleanString(bstream, 6); - - if (this.maybeMagic == "ustar") { - this.version = readCleanString(bstream, 2); - this.uname = readCleanString(bstream, 32); - this.gname = readCleanString(bstream, 32); - this.devmajor = readCleanString(bstream, 8); - this.devminor = readCleanString(bstream, 8); - this.prefix = readCleanString(bstream, 155); - - if (this.prefix.length) { - this.name = this.prefix + this.name; - } - bstream.readBytes(12); // 512 - 500 - } else { - bstream.readBytes(255); // 512 - 257 - } - - // Done header, now rest of blocks are the file contents. - this.filename = this.name; - this.fileData = null; - - info("Untarring file '" + this.filename + "'"); - info(" size = " + this.size); - info(" typeflag = " + this.typeflag); - - // A regular file. - if (this.typeflag == 0) { - info(" This is a regular file."); - var sizeInBytes = parseInt(this.size); - this.fileData = new Uint8Array(bstream.bytes.buffer, bstream.ptr, this.size); - if (this.name.length > 0 && this.size > 0 && this.fileData && this.fileData.buffer) { - this.isValid = true; - } - - bstream.readBytes(this.size); - - // Round up to 512-byte blocks. - var remaining = 512 - this.size % 512; - if (remaining > 0 && remaining < 512) { - bstream.readBytes(remaining); - } - } else if (this.typeflag == 5) { - info(" This is a directory.") - } -}; - -// Takes an ArrayBuffer of a tar file in -// returns null on error -// returns an array of DecompressedFile objects on success -var untar = function(arrayBuffer) { - currentFilename = ""; - currentFileNumber = 0; - currentBytesUnarchivedInFile = 0; - currentBytesUnarchived = 0; - totalUncompressedBytesInArchive = 0; - totalFilesInArchive = 0; - - postMessage(new bitjs.archive.UnarchiveStartEvent()); - var bstream = new bitjs.io.ByteStream(arrayBuffer); - var localFiles = []; - - // While we don't encounter an empty block, keep making TarLocalFiles. - while (bstream.peekNumber(4) != 0) { - var oneLocalFile = new TarLocalFile(bstream); - if (oneLocalFile && oneLocalFile.isValid) { - localFiles.push(oneLocalFile); - totalUncompressedBytesInArchive += oneLocalFile.size; - } - } - totalFilesInArchive = localFiles.length; - - // got all local files, now sort them - localFiles.sort(function(a,b) { - // extract the number at the end of both filenames - var aname = a.filename; - var bname = b.filename; - var aindex = aname.length, bindex = bname.length; - - // Find the last number character from the back of the filename. - while (aname[aindex-1] < '0' || aname[aindex-1] > '9') --aindex; - while (bname[bindex-1] < '0' || bname[bindex-1] > '9') --bindex; - - // Find the first number character from the back of the filename - while (aname[aindex-1] >= '0' && aname[aindex-1] <= '9') --aindex; - while (bname[bindex-1] >= '0' && bname[bindex-1] <= '9') --bindex; - - // parse them into numbers and return comparison - var anum = parseInt(aname.substr(aindex), 10), - bnum = parseInt(bname.substr(bindex), 10); - return anum - bnum; - }); - - // report # files and total length - if (localFiles.length > 0) { - postProgress(); - } - - // now do the shipping of each file - for (var i = 0; i < localFiles.length; ++i) { - var localfile = localFiles[i]; - info("Sending file '" + localfile.filename + "' up"); - - // update progress - currentFilename = localfile.filename; - currentFileNumber = i; - currentBytesUnarchivedInFile = localfile.size; - currentBytesUnarchived += localfile.size; - postMessage(new bitjs.archive.UnarchiveExtractEvent(localfile)); - postProgress(); - } - - postProgress(); - - postMessage(new bitjs.archive.UnarchiveFinishEvent()); -}; - -// event.data.file has the ArrayBuffer. -onmessage = function(event) { - var ab = event.data.file; - untar(ab); -}; diff --git a/examples/bitjs/unzip.js b/examples/bitjs/unzip.js deleted file mode 100755 index 99e223d..0000000 --- a/examples/bitjs/unzip.js +++ /dev/null @@ -1,631 +0,0 @@ -/** - * unzip.js - * - * Copyright(c) 2011 Google Inc. - * Copyright(c) 2011 antimatter15 - * - * Reference Documentation: - * - * ZIP format: http://www.pkware.com/documents/casestudies/APPNOTE.TXT - * DEFLATE format: http://tools.ietf.org/html/rfc1951 - */ - -// This file expects to be invoked as a Worker (see onmessage below). -importScripts('io.js'); -importScripts('archive.js'); - -// Progress variables. -var currentFilename = ""; -var currentFileNumber = 0; -var currentBytesUnarchivedInFile = 0; -var currentBytesUnarchived = 0; -var totalUncompressedBytesInArchive = 0; -var totalFilesInArchive = 0; - -// Helper functions. -var info = function(str) { - postMessage(new bitjs.archive.UnarchiveInfoEvent(str)); -}; -var err = function(str) { - postMessage(new bitjs.archive.UnarchiveErrorEvent(str)); -}; -var postProgress = function() { - postMessage(new bitjs.archive.UnarchiveProgressEvent( - currentFilename, - currentFileNumber, - currentBytesUnarchivedInFile, - currentBytesUnarchived, - totalUncompressedBytesInArchive, - totalFilesInArchive)); -}; - -var zLocalFileHeaderSignature = 0x04034b50; -var zArchiveExtraDataSignature = 0x08064b50; -var zCentralFileHeaderSignature = 0x02014b50; -var zDigitalSignatureSignature = 0x05054b50; -var zEndOfCentralDirSignature = 0x06064b50; -var zEndOfCentralDirLocatorSignature = 0x07064b50; - -// takes a ByteStream and parses out the local file information -var ZipLocalFile = function(bstream) { - if (typeof bstream != typeof {} || !bstream.readNumber || typeof bstream.readNumber != typeof function(){}) { - return null; - } - - bstream.readNumber(4); // swallow signature - this.version = bstream.readNumber(2); - this.generalPurpose = bstream.readNumber(2); - this.compressionMethod = bstream.readNumber(2); - this.lastModFileTime = bstream.readNumber(2); - this.lastModFileDate = bstream.readNumber(2); - this.crc32 = bstream.readNumber(4); - this.compressedSize = bstream.readNumber(4); - this.uncompressedSize = bstream.readNumber(4); - this.fileNameLength = bstream.readNumber(2); - this.extraFieldLength = bstream.readNumber(2); - - this.filename = null; - if (this.fileNameLength > 0) { - this.filename = bstream.readString(this.fileNameLength); - } - - info("Zip Local File Header:"); - info(" version=" + this.version); - info(" general purpose=" + this.generalPurpose); - info(" compression method=" + this.compressionMethod); - info(" last mod file time=" + this.lastModFileTime); - info(" last mod file date=" + this.lastModFileDate); - info(" crc32=" + this.crc32); - info(" compressed size=" + this.compressedSize); - info(" uncompressed size=" + this.uncompressedSize); - info(" file name length=" + this.fileNameLength); - info(" extra field length=" + this.extraFieldLength); - info(" filename = '" + this.filename + "'"); - - this.extraField = null; - if (this.extraFieldLength > 0) { - this.extraField = bstream.readString(this.extraFieldLength); - info(" extra field=" + this.extraField); - } - - // read in the compressed data - this.fileData = null; - if (this.compressedSize > 0) { - this.fileData = new Uint8Array(bstream.bytes.buffer, bstream.ptr, this.compressedSize); - bstream.ptr += this.compressedSize; - } - - // TODO: deal with data descriptor if present (we currently assume no data descriptor!) - // "This descriptor exists only if bit 3 of the general purpose bit flag is set" - // But how do you figure out how big the file data is if you don't know the compressedSize - // from the header?!? - if ((this.generalPurpose & bitjs.BIT[3]) != 0) { - this.crc32 = bstream.readNumber(4); - this.compressedSize = bstream.readNumber(4); - this.uncompressedSize = bstream.readNumber(4); - } -}; - -// determine what kind of compressed data we have and decompress -ZipLocalFile.prototype.unzip = function() { - - // Zip Version 1.0, no compression (store only) - if (this.compressionMethod == 0 ) { - info("ZIP v"+this.version+", store only: " + this.filename + " (" + this.compressedSize + " bytes)"); - currentBytesUnarchivedInFile = this.compressedSize; - currentBytesUnarchived += this.compressedSize; - } - // version == 20, compression method == 8 (DEFLATE) - else if (this.compressionMethod == 8) { - info("ZIP v2.0, DEFLATE: " + this.filename + " (" + this.compressedSize + " bytes)"); - this.fileData = inflate(this.fileData, this.uncompressedSize); - } - else { - err("UNSUPPORTED VERSION/FORMAT: ZIP v" + this.version + ", compression method=" + this.compressionMethod + ": " + this.filename + " (" + this.compressedSize + " bytes)"); - this.fileData = null; - } -}; - - -// Takes an ArrayBuffer of a zip file in -// returns null on error -// returns an array of DecompressedFile objects on success -var unzip = function(arrayBuffer) { - postMessage(new bitjs.archive.UnarchiveStartEvent()); - - currentFilename = ""; - currentFileNumber = 0; - currentBytesUnarchivedInFile = 0; - currentBytesUnarchived = 0; - totalUncompressedBytesInArchive = 0; - totalFilesInArchive = 0; - currentBytesUnarchived = 0; - - var bstream = new bitjs.io.ByteStream(arrayBuffer); - // detect local file header signature or return null - if (bstream.peekNumber(4) == zLocalFileHeaderSignature) { - var localFiles = []; - // loop until we don't see any more local files - while (bstream.peekNumber(4) == zLocalFileHeaderSignature) { - var oneLocalFile = new ZipLocalFile(bstream); - // this should strip out directories/folders - if (oneLocalFile && oneLocalFile.uncompressedSize > 0 && oneLocalFile.fileData) { - localFiles.push(oneLocalFile); - totalUncompressedBytesInArchive += oneLocalFile.uncompressedSize; - } - } - totalFilesInArchive = localFiles.length; - - // got all local files, now sort them - localFiles.sort(function(a,b) { - // extract the number at the end of both filenames - var aname = a.filename; - var bname = b.filename; - var aindex = aname.length, bindex = bname.length; - - // Find the last number character from the back of the filename. - while (aname[aindex-1] < '0' || aname[aindex-1] > '9') --aindex; - while (bname[bindex-1] < '0' || bname[bindex-1] > '9') --bindex; - - // Find the first number character from the back of the filename - while (aname[aindex-1] >= '0' && aname[aindex-1] <= '9') --aindex; - while (bname[bindex-1] >= '0' && bname[bindex-1] <= '9') --bindex; - - // parse them into numbers and return comparison - var anum = parseInt(aname.substr(aindex), 10), - bnum = parseInt(bname.substr(bindex), 10); - return anum - bnum; - }); - - // archive extra data record - if (bstream.peekNumber(4) == zArchiveExtraDataSignature) { - info(" Found an Archive Extra Data Signature"); - - // skipping this record for now - bstream.readNumber(4); - var archiveExtraFieldLength = bstream.readNumber(4); - bstream.readString(archiveExtraFieldLength); - } - - // central directory structure - // TODO: handle the rest of the structures (Zip64 stuff) - if (bstream.peekNumber(4) == zCentralFileHeaderSignature) { - info(" Found a Central File Header"); - - // read all file headers - while (bstream.peekNumber(4) == zCentralFileHeaderSignature) { - bstream.readNumber(4); // signature - bstream.readNumber(2); // version made by - bstream.readNumber(2); // version needed to extract - bstream.readNumber(2); // general purpose bit flag - bstream.readNumber(2); // compression method - bstream.readNumber(2); // last mod file time - bstream.readNumber(2); // last mod file date - bstream.readNumber(4); // crc32 - bstream.readNumber(4); // compressed size - bstream.readNumber(4); // uncompressed size - var fileNameLength = bstream.readNumber(2); // file name length - var extraFieldLength = bstream.readNumber(2); // extra field length - var fileCommentLength = bstream.readNumber(2); // file comment length - bstream.readNumber(2); // disk number start - bstream.readNumber(2); // internal file attributes - bstream.readNumber(4); // external file attributes - bstream.readNumber(4); // relative offset of local header - - bstream.readString(fileNameLength); // file name - bstream.readString(extraFieldLength); // extra field - bstream.readString(fileCommentLength); // file comment - } - } - - // digital signature - if (bstream.peekNumber(4) == zDigitalSignatureSignature) { - info(" Found a Digital Signature"); - - bstream.readNumber(4); - var sizeOfSignature = bstream.readNumber(2); - bstream.readString(sizeOfSignature); // digital signature data - } - - // report # files and total length - if (localFiles.length > 0) { - postProgress(); - } - - // now do the unzipping of each file - for (var i = 0; i < localFiles.length; ++i) { - var localfile = localFiles[i]; - - // update progress - currentFilename = localfile.filename; - currentFileNumber = i; - currentBytesUnarchivedInFile = 0; - - // actually do the unzipping - localfile.unzip(); - - if (localfile.fileData != null) { - postMessage(new bitjs.archive.UnarchiveExtractEvent(localfile)); - postProgress(); - } - } - postProgress(); - postMessage(new bitjs.archive.UnarchiveFinishEvent()); - } -} - -// returns a table of Huffman codes -// each entry's index is its code and its value is a JavaScript object -// containing {length: 6, symbol: X} -function getHuffmanCodes(bitLengths) { - // ensure bitLengths is an array containing at least one element - if (typeof bitLengths != typeof [] || bitLengths.length < 1) { - err("Error! getHuffmanCodes() called with an invalid array"); - return null; - } - - // Reference: http://tools.ietf.org/html/rfc1951#page-8 - var numLengths = bitLengths.length, - bl_count = [], - MAX_BITS = 1; - - // Step 1: count up how many codes of each length we have - for (var i = 0; i < numLengths; ++i) { - var length = bitLengths[i]; - // test to ensure each bit length is a positive, non-zero number - if (typeof length != typeof 1 || length < 0) { - err("bitLengths contained an invalid number in getHuffmanCodes(): " + length + " of type " + (typeof length)); - return null; - } - // increment the appropriate bitlength count - if (bl_count[length] == undefined) bl_count[length] = 0; - // a length of zero means this symbol is not participating in the huffman coding - if (length > 0) bl_count[length]++; - - if (length > MAX_BITS) MAX_BITS = length; - } - - // Step 2: Find the numerical value of the smallest code for each code length - var next_code = [], - code = 0; - for (var bits = 1; bits <= MAX_BITS; ++bits) { - var length = bits-1; - // ensure undefined lengths are zero - if (bl_count[length] == undefined) bl_count[length] = 0; - code = (code + bl_count[bits-1]) << 1; - next_code[bits] = code; - } - - // Step 3: Assign numerical values to all codes - var table = {}, tableLength = 0; - for (var n = 0; n < numLengths; ++n) { - var len = bitLengths[n]; - if (len != 0) { - table[next_code[len]] = { length: len, symbol: n }; //, bitstring: binaryValueToString(next_code[len],len) }; - tableLength++; - next_code[len]++; - } - } - table.maxLength = tableLength; - - return table; -} - -/* - The Huffman codes for the two alphabets are fixed, and are not - represented explicitly in the data. The Huffman code lengths - for the literal/length alphabet are: - - Lit Value Bits Codes - --------- ---- ----- - 0 - 143 8 00110000 through - 10111111 - 144 - 255 9 110010000 through - 111111111 - 256 - 279 7 0000000 through - 0010111 - 280 - 287 8 11000000 through - 11000111 -*/ -// fixed Huffman codes go from 7-9 bits, so we need an array whose index can hold up to 9 bits -var fixedHCtoLiteral = null; -var fixedHCtoDistance = null; -function getFixedLiteralTable() { - // create once - if (!fixedHCtoLiteral) { - var bitlengths = new Array(288); - for (var i = 0; i <= 143; ++i) bitlengths[i] = 8; - for (i = 144; i <= 255; ++i) bitlengths[i] = 9; - for (i = 256; i <= 279; ++i) bitlengths[i] = 7; - for (i = 280; i <= 287; ++i) bitlengths[i] = 8; - - // get huffman code table - fixedHCtoLiteral = getHuffmanCodes(bitlengths); - } - return fixedHCtoLiteral; -} -function getFixedDistanceTable() { - // create once - if (!fixedHCtoDistance) { - var bitlengths = new Array(32); - for (var i = 0; i < 32; ++i) { bitlengths[i] = 5; } - - // get huffman code table - fixedHCtoDistance = getHuffmanCodes(bitlengths); - } - return fixedHCtoDistance; -} - -// extract one bit at a time until we find a matching Huffman Code -// then return that symbol -function decodeSymbol(bstream, hcTable) { - var code = 0, len = 0; - var match = false; - - // loop until we match - for (;;) { - // read in next bit - var bit = bstream.readBits(1); - code = (code<<1) | bit; - ++len; - - // check against Huffman Code table and break if found - if (hcTable.hasOwnProperty(code) && hcTable[code].length == len) { - - break; - } - if (len > hcTable.maxLength) { - err("Bit stream out of sync, didn't find a Huffman Code, length was " + len + - " and table only max code length of " + hcTable.maxLength); - break; - } - } - return hcTable[code].symbol; -} - - -var CodeLengthCodeOrder = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; - /* - Extra Extra Extra - Code Bits Length(s) Code Bits Lengths Code Bits Length(s) - ---- ---- ------ ---- ---- ------- ---- ---- ------- - 257 0 3 267 1 15,16 277 4 67-82 - 258 0 4 268 1 17,18 278 4 83-98 - 259 0 5 269 2 19-22 279 4 99-114 - 260 0 6 270 2 23-26 280 4 115-130 - 261 0 7 271 2 27-30 281 5 131-162 - 262 0 8 272 2 31-34 282 5 163-194 - 263 0 9 273 3 35-42 283 5 195-226 - 264 0 10 274 3 43-50 284 5 227-257 - 265 1 11,12 275 3 51-58 285 0 258 - 266 1 13,14 276 3 59-66 - - */ -var LengthLookupTable = [ - [0,3], [0,4], [0,5], [0,6], - [0,7], [0,8], [0,9], [0,10], - [1,11], [1,13], [1,15], [1,17], - [2,19], [2,23], [2,27], [2,31], - [3,35], [3,43], [3,51], [3,59], - [4,67], [4,83], [4,99], [4,115], - [5,131], [5,163], [5,195], [5,227], - [0,258] -]; - /* - Extra Extra Extra - Code Bits Dist Code Bits Dist Code Bits Distance - ---- ---- ---- ---- ---- ------ ---- ---- -------- - 0 0 1 10 4 33-48 20 9 1025-1536 - 1 0 2 11 4 49-64 21 9 1537-2048 - 2 0 3 12 5 65-96 22 10 2049-3072 - 3 0 4 13 5 97-128 23 10 3073-4096 - 4 1 5,6 14 6 129-192 24 11 4097-6144 - 5 1 7,8 15 6 193-256 25 11 6145-8192 - 6 2 9-12 16 7 257-384 26 12 8193-12288 - 7 2 13-16 17 7 385-512 27 12 12289-16384 - 8 3 17-24 18 8 513-768 28 13 16385-24576 - 9 3 25-32 19 8 769-1024 29 13 24577-32768 - */ -var DistLookupTable = [ - [0,1], [0,2], [0,3], [0,4], - [1,5], [1,7], - [2,9], [2,13], - [3,17], [3,25], - [4,33], [4,49], - [5,65], [5,97], - [6,129], [6,193], - [7,257], [7,385], - [8,513], [8,769], - [9,1025], [9,1537], - [10,2049], [10,3073], - [11,4097], [11,6145], - [12,8193], [12,12289], - [13,16385], [13,24577] -]; - -function inflateBlockData(bstream, hcLiteralTable, hcDistanceTable, buffer) { - /* - loop (until end of block code recognized) - decode literal/length value from input stream - if value < 256 - copy value (literal byte) to output stream - otherwise - if value = end of block (256) - break from loop - otherwise (value = 257..285) - decode distance from input stream - - move backwards distance bytes in the output - stream, and copy length bytes from this - position to the output stream. - */ - var numSymbols = 0, blockSize = 0; - for (;;) { - var symbol = decodeSymbol(bstream, hcLiteralTable); - ++numSymbols; - if (symbol < 256) { - // copy literal byte to output - buffer.insertByte(symbol); - blockSize++; - } - else { - // end of block reached - if (symbol == 256) { - break; - } - else { - var lengthLookup = LengthLookupTable[symbol-257], - length = lengthLookup[1] + bstream.readBits(lengthLookup[0]), - distLookup = DistLookupTable[decodeSymbol(bstream, hcDistanceTable)], - distance = distLookup[1] + bstream.readBits(distLookup[0]); - - // now apply length and distance appropriately and copy to output - - // TODO: check that backward distance < data.length? - - // http://tools.ietf.org/html/rfc1951#page-11 - // "Note also that the referenced string may overlap the current - // position; for example, if the last 2 bytes decoded have values - // X and Y, a string reference with - // adds X,Y,X,Y,X to the output stream." - // - // loop for each character - var ch = buffer.ptr - distance; - blockSize += length; - if(length > distance) { - var data = buffer.data; - while (length--) { - buffer.insertByte(data[ch++]); - } - } else { - buffer.insertBytes(buffer.data.subarray(ch, ch + length)) - } - - } // length-distance pair - } // length-distance pair or end-of-block - } // loop until we reach end of block - return blockSize; -} - -// {Uint8Array} compressedData A Uint8Array of the compressed file data. -// compression method 8 -// deflate: http://tools.ietf.org/html/rfc1951 -function inflate(compressedData, numDecompressedBytes) { - // Bit stream representing the compressed data. - var bstream = new bitjs.io.BitStream(compressedData.buffer, - false /* rtl */, - compressedData.byteOffset, - compressedData.byteLength); - var buffer = new bitjs.io.ByteBuffer(numDecompressedBytes); - var numBlocks = 0, blockSize = 0; - - // block format: http://tools.ietf.org/html/rfc1951#page-9 - do { - var bFinal = bstream.readBits(1), - bType = bstream.readBits(2); - blockSize = 0; - ++numBlocks; - // no compression - if (bType == 0) { - // skip remaining bits in this byte - while (bstream.bitPtr != 0) bstream.readBits(1); - var len = bstream.readBits(16), - nlen = bstream.readBits(16); - // TODO: check if nlen is the ones-complement of len? - - if(len > 0) buffer.insertBytes(bstream.readBytes(len)); - blockSize = len; - } - // fixed Huffman codes - else if(bType == 1) { - blockSize = inflateBlockData(bstream, getFixedLiteralTable(), getFixedDistanceTable(), buffer); - } - // dynamic Huffman codes - else if(bType == 2) { - var numLiteralLengthCodes = bstream.readBits(5) + 257; - var numDistanceCodes = bstream.readBits(5) + 1, - numCodeLengthCodes = bstream.readBits(4) + 4; - - // populate the array of code length codes (first de-compaction) - var codeLengthsCodeLengths = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; - for (var i = 0; i < numCodeLengthCodes; ++i) { - codeLengthsCodeLengths[ CodeLengthCodeOrder[i] ] = bstream.readBits(3); - } - - // get the Huffman Codes for the code lengths - var codeLengthsCodes = getHuffmanCodes(codeLengthsCodeLengths); - - // now follow this mapping - /* - 0 - 15: Represent code lengths of 0 - 15 - 16: Copy the previous code length 3 - 6 times. - The next 2 bits indicate repeat length - (0 = 3, ... , 3 = 6) - Example: Codes 8, 16 (+2 bits 11), - 16 (+2 bits 10) will expand to - 12 code lengths of 8 (1 + 6 + 5) - 17: Repeat a code length of 0 for 3 - 10 times. - (3 bits of length) - 18: Repeat a code length of 0 for 11 - 138 times - (7 bits of length) - */ - // to generate the true code lengths of the Huffman Codes for the literal - // and distance tables together - var literalCodeLengths = []; - var prevCodeLength = 0; - while (literalCodeLengths.length < numLiteralLengthCodes + numDistanceCodes) { - var symbol = decodeSymbol(bstream, codeLengthsCodes); - if (symbol <= 15) { - literalCodeLengths.push(symbol); - prevCodeLength = symbol; - } - else if (symbol == 16) { - var repeat = bstream.readBits(2) + 3; - while (repeat--) { - literalCodeLengths.push(prevCodeLength); - } - } - else if (symbol == 17) { - var repeat = bstream.readBits(3) + 3; - while (repeat--) { - literalCodeLengths.push(0); - } - } - else if (symbol == 18) { - var repeat = bstream.readBits(7) + 11; - while (repeat--) { - literalCodeLengths.push(0); - } - } - } - - // now split the distance code lengths out of the literal code array - var distanceCodeLengths = literalCodeLengths.splice(numLiteralLengthCodes, numDistanceCodes); - - // now generate the true Huffman Code tables using these code lengths - var hcLiteralTable = getHuffmanCodes(literalCodeLengths), - hcDistanceTable = getHuffmanCodes(distanceCodeLengths); - blockSize = inflateBlockData(bstream, hcLiteralTable, hcDistanceTable, buffer); - } - // error - else { - err("Error! Encountered deflate block of type 3"); - return null; - } - - // update progress - currentBytesUnarchivedInFile += blockSize; - currentBytesUnarchived += blockSize; - postProgress(); - - } while (bFinal != 1); - // we are done reading blocks if the bFinal bit was set for this block - - // return the buffer data bytes - return buffer.data; -} - -// event.data.file has the ArrayBuffer. -onmessage = function(event) { - unzip(event.data.file, true); -}; diff --git a/examples/dev.html b/examples/dev.html deleted file mode 100755 index 5504794..0000000 --- a/examples/dev.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - Comic Book Reader (Dev) - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/file.html b/examples/file.html deleted file mode 100644 index 29c526f..0000000 --- a/examples/file.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - Comic Book Reader - - - - - - - - - - - - - -
- - - -
- - -
- - - - - - diff --git a/examples/goldenboy.cbz b/examples/goldenboy.cbz deleted file mode 100644 index ec6dba6..0000000 Binary files a/examples/goldenboy.cbz and /dev/null differ diff --git a/examples/goldenboy/goldenboy_00.jpg b/examples/goldenboy/goldenboy_00.jpg deleted file mode 100644 index 348a9ed..0000000 Binary files a/examples/goldenboy/goldenboy_00.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_01.jpg b/examples/goldenboy/goldenboy_01.jpg deleted file mode 100644 index 070e2c8..0000000 Binary files a/examples/goldenboy/goldenboy_01.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_02.jpg b/examples/goldenboy/goldenboy_02.jpg deleted file mode 100644 index 98ed740..0000000 Binary files a/examples/goldenboy/goldenboy_02.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_03.jpg b/examples/goldenboy/goldenboy_03.jpg deleted file mode 100644 index d7657a6..0000000 Binary files a/examples/goldenboy/goldenboy_03.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_04.jpg b/examples/goldenboy/goldenboy_04.jpg deleted file mode 100644 index 70c23b1..0000000 Binary files a/examples/goldenboy/goldenboy_04.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_05.jpg b/examples/goldenboy/goldenboy_05.jpg deleted file mode 100644 index 9856078..0000000 Binary files a/examples/goldenboy/goldenboy_05.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_06.jpg b/examples/goldenboy/goldenboy_06.jpg deleted file mode 100644 index 3d81518..0000000 Binary files a/examples/goldenboy/goldenboy_06.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_07.jpg b/examples/goldenboy/goldenboy_07.jpg deleted file mode 100644 index a413000..0000000 Binary files a/examples/goldenboy/goldenboy_07.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_08.jpg b/examples/goldenboy/goldenboy_08.jpg deleted file mode 100644 index c3b7586..0000000 Binary files a/examples/goldenboy/goldenboy_08.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_09.jpg b/examples/goldenboy/goldenboy_09.jpg deleted file mode 100644 index 5684801..0000000 Binary files a/examples/goldenboy/goldenboy_09.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_10.jpg b/examples/goldenboy/goldenboy_10.jpg deleted file mode 100644 index 3b98022..0000000 Binary files a/examples/goldenboy/goldenboy_10.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_11.jpg b/examples/goldenboy/goldenboy_11.jpg deleted file mode 100644 index 7c18353..0000000 Binary files a/examples/goldenboy/goldenboy_11.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_12.jpg b/examples/goldenboy/goldenboy_12.jpg deleted file mode 100644 index 522a5da..0000000 Binary files a/examples/goldenboy/goldenboy_12.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_13.jpg b/examples/goldenboy/goldenboy_13.jpg deleted file mode 100644 index a212a77..0000000 Binary files a/examples/goldenboy/goldenboy_13.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_14.jpg b/examples/goldenboy/goldenboy_14.jpg deleted file mode 100644 index 1839320..0000000 Binary files a/examples/goldenboy/goldenboy_14.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_15.jpg b/examples/goldenboy/goldenboy_15.jpg deleted file mode 100644 index 92afab6..0000000 Binary files a/examples/goldenboy/goldenboy_15.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_16.jpg b/examples/goldenboy/goldenboy_16.jpg deleted file mode 100644 index b1dacc0..0000000 Binary files a/examples/goldenboy/goldenboy_16.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_17.jpg b/examples/goldenboy/goldenboy_17.jpg deleted file mode 100644 index 0318aaf..0000000 Binary files a/examples/goldenboy/goldenboy_17.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_18.jpg b/examples/goldenboy/goldenboy_18.jpg deleted file mode 100644 index 894c9fd..0000000 Binary files a/examples/goldenboy/goldenboy_18.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_19.jpg b/examples/goldenboy/goldenboy_19.jpg deleted file mode 100644 index 88b41f2..0000000 Binary files a/examples/goldenboy/goldenboy_19.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_20.jpg b/examples/goldenboy/goldenboy_20.jpg deleted file mode 100644 index 595a1e4..0000000 Binary files a/examples/goldenboy/goldenboy_20.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_21.jpg b/examples/goldenboy/goldenboy_21.jpg deleted file mode 100644 index 95582ec..0000000 Binary files a/examples/goldenboy/goldenboy_21.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_22.jpg b/examples/goldenboy/goldenboy_22.jpg deleted file mode 100644 index 6a2f777..0000000 Binary files a/examples/goldenboy/goldenboy_22.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_23.jpg b/examples/goldenboy/goldenboy_23.jpg deleted file mode 100644 index 69b458b..0000000 Binary files a/examples/goldenboy/goldenboy_23.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_24.jpg b/examples/goldenboy/goldenboy_24.jpg deleted file mode 100644 index a287f6e..0000000 Binary files a/examples/goldenboy/goldenboy_24.jpg and /dev/null differ diff --git a/examples/goldenboy/goldenboy_25.jpg b/examples/goldenboy/goldenboy_25.jpg deleted file mode 100644 index cb814d6..0000000 Binary files a/examples/goldenboy/goldenboy_25.jpg and /dev/null differ diff --git a/lib/.jshintrc b/lib/.jshintrc deleted file mode 100644 index e310d21..0000000 --- a/lib/.jshintrc +++ /dev/null @@ -1,21 +0,0 @@ -{ - "predef": [ - "jQuery", - "Handlebars", - "Pixastic" - ], - "forin": true, - "noarg": true, - "noempty": true, - "eqeqeq": true, - "bitwise": true, - "strict": true, - "undef": true, - "unused": true, - "curly": true, - "browser": true, - "maxerr": 50, - "quotmark": "single", - "trailing": false, - "indent": 2 -} diff --git a/lib/ComicBook.js b/lib/ComicBook.js deleted file mode 100755 index c9499d0..0000000 --- a/lib/ComicBook.js +++ /dev/null @@ -1,879 +0,0 @@ -/* exported ComicBook */ - -var ComicBook = (function ($) { - - 'use strict'; - - /** - * Merge two arrays. Any properties in b will replace the same properties in - * a. New properties from b will be added to a. - * - * @param a {Object} - * @param b {Object} - */ - function merge(a, b) { - - var prop; - - if (typeof b === 'undefined') { b = {}; } - - for (prop in a) { - if (a.hasOwnProperty(prop)) { - if (prop in b) { continue; } - b[prop] = a[prop]; - } - } - - return b; - } - - /** - * Exception class. Always throw an instance of this when throwing exceptions. - * - * @param {String} type - * @param {Object} object - * @returns {ComicBookException} - */ - var ComicBookException = { - INVALID_ACTION: 'invalid action', - INVALID_PAGE: 'invalid page', - INVALID_PAGE_TYPE: 'invalid page type', - UNDEFINED_CONTROL: 'undefined control', - INVALID_ZOOM_MODE: 'invalid zoom mode', - INVALID_NAVIGATION_EVENT: 'invalid navigation event' - }; - - function ComicBook(id, srcs, opts) { - - var self = this; - var canvas_id = id; // canvas element id - this.srcs = srcs; // array of image srcs for pages - - var defaults = { - displayMode: 'double', // single / double - zoomMode: 'fitWindow', // manual / fitWidth / fitWindow - manga: false, // true / false - enhance: {}, - keyboard: { - next: 78, - previous: 80, - toolbar: 84, - toggleLayout: 76 - }, - libPath: '/lib/', - forward_buffer: 3 - }; - - this.isMobile = false; - - // mobile enhancements - if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(navigator.userAgent)) { - this.isMobile = true; - document.body.classList.add('mobile'); - defaults.displayMode = 'single'; - - window.addEventListener('load', function () { - setTimeout(function () { - window.scrollTo(0, 1); - }, 0); - }); - } - - var options = merge(defaults, opts); // options array for internal use - - var no_pages = srcs.length; - var pages = []; // array of preloaded Image objects - var canvas; // the HTML5 canvas object - var context; // the 2d drawing context - var loaded = []; // the images that have been loaded so far - var scale = 1; // page zoom scale, 1 = 100% - var is_double_page_spread = false; - var controlsRendered = false; // have the user controls been inserted into the dom yet? - var page_requested = false; // used to request non preloaded pages - var shiv = false; - - /** - * Gets the window.innerWidth - scrollbars - */ - function windowWidth() { - - var height = window.innerHeight + 1; - - if (shiv === false) { - shiv = $(document.createElement('div')) - .attr('id', 'cb-width-shiv') - .css({ - width: '100%', - position: 'absolute', - top: 0, - zIndex: '-1000' - }); - - $('body').append(shiv); - } - - shiv.height(height); - - return shiv.innerWidth(); - } - - /** - * enables the back button - */ - function checkHash() { - - var hash = getHash(); - - if (hash !== pointer && loaded.indexOf(hash) > -1) { - pointer = hash; - self.draw(); - } - } - - function getHash() { - var hash = parseInt(location.hash.substring(1),10) - 1 || 0; - if (hash < 0) { - setHash(0); - hash = 0; - } - return hash; - } - - function setHash(pageNo) { - location.hash = pageNo; - } - - // page hash on first load - var hash = getHash(); - - // the current page, can pass a default as a url hash - var pointer = (hash < srcs.length) ? hash : 0; - - /** - * Setup the canvas element for use throughout the class. - * - * @see #ComicBook.prototype.draw - * @see #ComicBook.prototype.enhance - */ - function init() { - - // setup canvas - canvas = document.getElementById(canvas_id); - context = canvas.getContext('2d'); - - // render user controls - if (controlsRendered === false) { - self.renderControls(); - controlsRendered = true; - } - - // add page controls - window.addEventListener('keydown', self.navigation, false); - window.addEventListener('hashchange', checkHash, false); - } - - window.addEventListener('touchstart', function (e) { - var $el = $(e.target); - if ($el.attr('id') === 'comic') { - self.toggleToolbar(); - } - if ($el.data('toggle') === 'dropdown' ) { - $el.siblings('.dropdown').toggle(); - } - }, false); - - /** - * Render Handlebars templates. Templates with data-trigger & data-action will - * have the specified events bound. - */ - ComicBook.prototype.renderControls = function () { - - var controls = {}, $toolbar; - - $.each(Handlebars.templates, function (name, template) { - - var $template = $(template().trim()); - controls[name] = $template; - - // add event listeners to controls that specify callbacks - $template.find('*').andSelf().filter('[data-action][data-trigger]').each(function () { - - var $this = $(this); - var trigger = $this.data('trigger'); - var action = $this.data('action'); - - // trigger a direct method if exists - if (typeof self[$this.data('action')] === 'function') { - $this.on(trigger, self[action]); - } - - // throw an event to be caught outside if the app code - $this.on(trigger, function (e) { - $(self).trigger(trigger, e); - }); - }); - - $(canvas).before($template); - }); - - this.controls = controls; - - $toolbar = this.getControl('toolbar'); - $toolbar - .find('.manga-' + options.manga).show().end() - .find('.manga-' + !options.manga).hide().end() - .find('.layout').hide().end().find('.layout-' + options.displayMode).show(); - - }; - - ComicBook.prototype.getControl = function (control) { - if (typeof this.controls[control] !== 'object') { - throw ComicBookException.UNDEFINED_CONTROL + ' ' + control; - } - return this.controls[control]; - }; - - ComicBook.prototype.showControl = function (control) { - this.getControl(control).show().addClass('open'); - }; - - ComicBook.prototype.hideControl = function (control) { - this.getControl(control).removeClass('open').hide(); - }; - - ComicBook.prototype.toggleControl = function (control) { - this.getControl(control).toggle().toggleClass('open'); - }; - - ComicBook.prototype.toggleLayout = function() { - - var $toolbar = self.getControl('toolbar'); - var displayMode = (options.displayMode === 'single') ? 'double' : 'single'; - - options.displayMode = displayMode; - - $toolbar.find('.layout').hide().end().find('.layout-' + options.displayMode).show(); - - self.drawPage(); - }; - - /** - * Get the image for a given page. - * - * @return Image - */ - ComicBook.prototype.getPage = function (i) { - - if (i < 0 || i > srcs.length-1) { - throw ComicBookException.INVALID_PAGE + ' ' + i; - } - - if (typeof pages[i] === 'object') { - return pages[i]; - } else { - page_requested = i; - this.showControl('loadingOverlay'); - } - }; - - /** - * @see #preload - */ - ComicBook.prototype.draw = function () { - - init(); - - // resize navigation controls - $('.navigate').outerHeight(window.innerHeight); - $('#cb-loading-overlay').outerWidth(windowWidth()).height(window.innerHeight); - - // preload images if needed - if (pages.length !== no_pages) { - this.preload(); - } else { - this.drawPage(); - } - }; - - /** - * Zoom the canvas - * - * @param new_scale {Number} Scale the canvas to this ratio - */ - ComicBook.prototype.zoom = function (new_scale) { - options.zoomMode = 'manual'; - scale = new_scale; - if (typeof this.getPage(pointer) === 'object') { this.drawPage(); } - }; - - ComicBook.prototype.zoomIn = function () { - self.zoom(scale + 0.1); - }; - - ComicBook.prototype.zoomOut = function () { - self.zoom(scale - 0.1); - }; - - ComicBook.prototype.fitWidth = function () { - options.zoomMode = 'fitWidth'; - self.drawPage(); - }; - - ComicBook.prototype.fitWindow = function () { - options.zoomMode = 'fitWindow'; - self.drawPage(); - }; - - /** - * Preload all images, draw the page only after a given number have been loaded. - * - * @see #drawPage - */ - ComicBook.prototype.preload = function () { - - var i = pointer; // the current page counter for this method - var rendered = false; - var queue = []; - - this.showControl('loadingOverlay'); - - function loadImage(i) { - - var page = new Image(); - page.src = srcs[i]; - - page.onload = function () { - - pages[i] = this; - loaded.push(i); - - $('#cb-progress-bar .progressbar-value').css('width', Math.floor((loaded.length / no_pages) * 100) + '%'); - - // double page mode needs an extra page added - var buffer = (options.displayMode === 'double' && pointer < srcs.length-1) ? 1 : 0; - - // start rendering the comic when the requested page is ready - if ((rendered === false && ($.inArray(pointer + buffer, loaded) !== -1) || - (typeof page_requested === 'number' && $.inArray(page_requested, loaded) !== -1)) - ) { - // if the user is waiting for a page to be loaded, render that one instead of the default pointer - if (typeof page_requested === 'number') { - pointer = page_requested-1; - page_requested = false; - } - - self.drawPage(); - self.hideControl('loadingOverlay'); - rendered = true; - } - - if (queue.length) { - loadImage(queue[0]); - queue.splice(0,1); - } else { - $('#cb-status').delay(500).fadeOut(); - } - }; - } - - // loads pages in both directions so you don't have to wait for all pages - // to be loaded before you can scroll backwards - function preload(start, stop) { - - var j = 0; - var count = 1; - var forward = start; - var backward = start-1; - - while (forward <= stop) { - - if (count > options.forward_buffer && backward > -1) { - queue.push(backward); - backward--; - count = 0; - } else { - queue.push(forward); - forward++; - } - count++; - } - - while (backward > -1) { - queue.push(backward); - backward--; - } - - loadImage(queue[j]); - } - - preload(i, srcs.length-1); - }; - - ComicBook.prototype.pageLoaded = function (page_no) { - return (typeof loaded[page_no-1] !== 'undefined'); - }; - - /** - * Draw the current page in the canvas - */ - ComicBook.prototype.drawPage = function(page_no, reset_scroll) { - - var scrollY; - - reset_scroll = (typeof reset_scroll !== 'undefined') ? reset_scroll : true; - scrollY = reset_scroll ? 0 : window.scrollY; - - // if a specific page is given try to render it, if not bail and wait for preload() to render it - if (typeof page_no === 'number' && page_no < srcs.length && page_no > 0) { - pointer = page_no-1; - if (!this.pageLoaded(page_no)) { - this.showControl('loadingOverlay'); - return; - } - } - - if (pointer < 0) { pointer = 0; } - - var zoom_scale; - var offsetW = 0, offsetH = 0; - - var page = self.getPage(pointer); - var page2 = false; - - if (options.displayMode === 'double' && pointer < srcs.length-1) { - page2 = self.getPage(pointer + 1); - } - - if (typeof page !== 'object') { - throw ComicBookException.INVALID_PAGE_TYPE + ' ' + typeof page; - } - - var width = page.width, height = page.height; - - // reset the canvas to stop duplicate pages showing - canvas.width = 0; - canvas.height = 0; - - // show double page spreads on a single page - is_double_page_spread = ( - typeof page2 === 'object' && - (page.width > page.height || page2.width > page2.height) && - options.displayMode === 'double' - ); - if (is_double_page_spread) { options.displayMode = 'single'; } - - if (options.displayMode === 'double') { - - // for double page spreads, factor in the width of both pages - if (typeof page2 === 'object') { width += page2.width; } - - // if this is the last page and there is no page2, still keep the canvas wide - else { width += width; } - } - - // update the page scale if a non manual mode has been chosen - switch (options.zoomMode) { - - case 'manual': - document.body.style.overflowX = 'auto'; - zoom_scale = (options.displayMode === 'double') ? scale * 2 : scale; - break; - - case 'fitWidth': - document.body.style.overflowX = 'hidden'; - - // scale up if the window is wider than the page, scale down if the window - // is narrower than the page - zoom_scale = (windowWidth() > width) ? ((windowWidth() - width) / windowWidth()) + 1 : windowWidth() / width; - - // update the interal scale var so switching zoomModes while zooming will be smooth - scale = zoom_scale; - break; - - case 'fitWindow': - document.body.style.overflowX = 'hidden'; - - var width_scale = (windowWidth() > width) ? - ((windowWidth() - width) / windowWidth()) + 1 // scale up if the window is wider than the page - : windowWidth() / width; // scale down if the window is narrower than the page - var windowHeight = window.innerHeight; - var height_scale = (windowHeight > height) ? - ((windowHeight - height) / windowHeight) + 1 // scale up if the window is wider than the page - : windowHeight / height; // scale down if the window is narrower than the page - - zoom_scale = (width_scale > height_scale) ? height_scale : width_scale; - scale = zoom_scale; - break; - - default: - throw ComicBookException.INVALID_ZOOM_MODE + ' ' + options.zoomMode; - } - - var canvas_width = page.width * zoom_scale; - var canvas_height = page.height * zoom_scale; - - var page_width = (options.zoomMode === 'manual') ? page.width * scale : canvas_width; - var page_height = (options.zoomMode === 'manual') ? page.height * scale : canvas_height; - - canvas_height = page_height; - - // make sure the canvas is always at least full screen, even if the page is more narrow than the screen - canvas.width = (canvas_width < windowWidth()) ? windowWidth() : canvas_width; - canvas.height = (canvas_height < window.innerHeight) ? window.innerHeight : canvas_height; - - // always keep pages centered - if (options.zoomMode === 'manual' || options.zoomMode === 'fitWindow') { - - // work out a horizontal position - if (canvas_width < windowWidth()) { - offsetW = (windowWidth() - page_width) / 2; - if (options.displayMode === 'double') { offsetW = offsetW - page_width / 2; } - } - - // work out a vertical position - if (canvas_height < window.innerHeight) { - offsetH = (window.innerHeight - page_height) / 2; - } - } - - // in manga double page mode reverse the page(s) - if (options.manga && options.displayMode === 'double' && typeof page2 === 'object') { - var tmpPage = page; - var tmpPage2 = page2; - page = tmpPage2; - page2 = tmpPage; - } - - // draw the page(s) - context.drawImage(page, offsetW, offsetH, page_width, page_height); - if (options.displayMode === 'double' && typeof page2 === 'object') { - context.drawImage(page2, page_width + offsetW, offsetH, page_width, page_height); - } - - this.pixastic = new Pixastic(context, options.libPath + 'pixastic/'); - - // apply any image enhancements previously defined - $.each(options.enhance, function(action, options) { - self.enhance[action](options); - }); - - var current_page = - (options.displayMode === 'double' && - pointer + 2 <= srcs.length) ? (pointer + 1) + '-' + (pointer + 2) : pointer + 1; - - this.getControl('toolbar') - .find('#current-page').text(current_page) - .end() - .find('#page-count').text(srcs.length); - - // revert page mode back to double if it was auto switched for a double page spread - if (is_double_page_spread) { options.displayMode = 'double'; } - - // disable the fit width button if needed - $('button.cb-fit-width').attr('disabled', (options.zoomMode === 'fitWidth')); - $('button.cb-fit-window').attr('disabled', (options.zoomMode === 'fitWindow')); - - // disable prev/next buttons if not needed - $('.navigate').show(); - if (pointer === 0) { - if (options.manga) { - $('.navigate-left').show(); - $('.navigate-right').hide(); - } else { - $('.navigate-left').hide(); - $('.navigate-right').show(); - } - } - - if (pointer === srcs.length-1 || (typeof page2 === 'object' && pointer === srcs.length-2)) { - if (options.manga) { - $('.navigate-left').hide(); - $('.navigate-right').show(); - } else { - $('.navigate-left').show(); - $('.navigate-right').hide(); - } - } - - if (pointer !== getHash()){ - $(this).trigger('navigate'); - } - - // update hash location - if (getHash() !== pointer) { - setHash(pointer + 1); - } - }; - - /** - * Increment the counter and draw the page in the canvas - * - * @see #drawPage - */ - ComicBook.prototype.drawNextPage = function () { - - var page; - - try { - page = self.getPage(pointer+1); - } catch (e) {} - - if (!page) { return false; } - - if (pointer + 1 < pages.length) { - pointer += (options.displayMode === 'single' || is_double_page_spread) ? 1 : 2; - try { - self.drawPage(); - } catch (e) {} - } - - // make sure the top of the page is in view - window.scroll(0, 0); - }; - - /** - * Decrement the counter and draw the page in the canvas - * - * @see #drawPage - */ - ComicBook.prototype.drawPrevPage = function () { - - var page; - - try { - page = self.getPage(pointer-1); - } catch (e) {} - - if (!page) { return false; } - - is_double_page_spread = (page.width > page.height); // need to run double page check again here as we are going backwards - - if (pointer > 0) { - pointer -= (options.displayMode === 'single' || is_double_page_spread) ? 1 : 2; - self.drawPage(); - } - - // make sure the top of the page is in view - window.scroll(0, 0); - }; - - ComicBook.prototype.brightness = function () { - self.enhance.brightness({ brightness: $(this).val() }); - }; - - ComicBook.prototype.contrast = function () { - self.enhance.brightness({ contrast: $(this).val() }); - }; - - ComicBook.prototype.sharpen = function () { - self.enhance.sharpen({ strength: $(this).val() }); - }; - - ComicBook.prototype.desaturate = function () { - if ($(this).is(':checked')) { - self.enhance.desaturate(); - } else { - self.enhance.resaturate(); - } - }; - - ComicBook.prototype.resetEnhancements = function () { - self.enhance.reset(); - }; - - /** - * Apply image enhancements to the canvas. - * - * Powered by the awesome Pixastic: http://www.pixastic.com/ - * - * TODO: reset & apply all image enhancements each time before applying new one - * TODO: abstract this into an 'Enhance' object, separate from ComicBook? - */ - ComicBook.prototype.enhance = { - - /** - * Reset enhancements. - * This can reset a specific enhancement if the method name is passed, or - * it will reset all. - * - * @param method {string} the specific enhancement to reset - */ - reset: function (method) { - if (!method) { - options.enhance = {}; - } else { - delete options.enhance[method]; - } - self.drawPage(null, false); - }, - - /** - * Pixastic progress callback - * @param {float} progress - */ - // progress: function (progress) { - progress: function () { - // console.info(Math.floor(progress * 100)); - }, - - /** - * Pixastic on complete callback - */ - done: function () { - - }, - - /** - * Adjust brightness / contrast - * - * params - * brightness (int) -150 to 150 - * contrast: (float) -1 to infinity - * - * @param {Object} params Brightness & contrast levels - * @param {Boolean} reset Reset before applying more enhancements? - */ - brightness: function (params, reset) { - - if (reset !== false) { this.reset('brightness'); } - - // merge user options with defaults - var opts = merge({ brightness: 0, contrast: 0 }, params); - - // remember options for later - options.enhance.brightness = opts; - - // run the enhancement - self.pixastic.brightness({ - brightness: opts.brightness, - contrast: opts.contrast - }).done(this.done, this.progress); - }, - - /** - * Force black and white - */ - desaturate: function () { - options.enhance.desaturate = {}; - self.pixastic.desaturate().done(this.done, this.progress); - }, - - /** - * Undo desaturate - */ - resaturate: function() { - delete options.enhance.desaturate; - self.drawPage(null, false); - }, - - /** - * Sharpen - * - * options: - * strength: number (-1 to infinity) - * - * @param {Object} options - */ - sharpen: function (params) { - - this.desharpen(); - - var opts = merge({ strength: 0 }, params); - - options.enhance.sharpen = opts; - - self.pixastic.sharpen3x3({ - strength: opts.strength - }).done(this.done, this.progress); - }, - - desharpen: function() { - delete options.enhance.sharpen; - self.drawPage(null, false); - } - }; - - ComicBook.prototype.navigation = function (e) { - - // disable navigation when the overlay is showing - if ($('#cb-loading-overlay').is(':visible')) { return false; } - - var side = false; - - switch (e.type) { - - case 'click': - side = e.currentTarget.getAttribute('data-navigate-side'); - break; - - case 'keydown': - - // navigation - if (e.keyCode === options.keyboard.previous) { side = 'left'; } - if (e.keyCode === options.keyboard.next) { side = 'right'; } - - // display controls - if (e.keyCode === options.keyboard.toolbar) { - self.toggleToolbar(); - } - if (e.keyCode === options.keyboard.toggleLayout) { - self.toggleLayout(); - } - break; - - default: - throw ComicBookException.INVALID_NAVIGATION_EVENT + ' ' + e.type; - } - - if (side) { - - e.stopPropagation(); - - // western style (left to right) - if (!options.manga) { - if (side === 'left') { self.drawPrevPage(); } - if (side === 'right') { self.drawNextPage(); } - } - // manga style (right to left) - else { - if (side === 'left') { self.drawNextPage(); } - if (side === 'right') { self.drawPrevPage(); } - } - - return false; - } - }; - - ComicBook.prototype.toggleReadingMode = function () { - options.manga = !options.manga; - self.getControl('toolbar') - .find('.manga-' + options.manga).show().end() - .find('.manga-' + !options.manga).hide(); - }; - - ComicBook.prototype.toggleToolbar = function () { - self.toggleControl('toolbar'); - }; - - ComicBook.prototype.destroy = function () { - - $.each(this.controls, function (name, $control) { - $control.remove(); - }); - - canvas.width = 0; - canvas.height = 0; - - window.removeEventListener('keydown', this.navigation, false); - window.removeEventListener('hashchange', checkHash, false); - - setHash(''); - - // $(this).trigger('destroy'); - }; - - } - - return ComicBook; - -})(jQuery); diff --git a/lib/tests/img/1.png b/lib/tests/img/1.png deleted file mode 100755 index a8d2c9a..0000000 Binary files a/lib/tests/img/1.png and /dev/null differ diff --git a/lib/tests/img/2.png b/lib/tests/img/2.png deleted file mode 100755 index c41255b..0000000 Binary files a/lib/tests/img/2.png and /dev/null differ diff --git a/lib/tests/img/3.png b/lib/tests/img/3.png deleted file mode 100755 index c8e349a..0000000 Binary files a/lib/tests/img/3.png and /dev/null differ diff --git a/lib/tests/img/4.png b/lib/tests/img/4.png deleted file mode 100755 index 0a334c2..0000000 Binary files a/lib/tests/img/4.png and /dev/null differ diff --git a/lib/tests/img/5.png b/lib/tests/img/5.png deleted file mode 100755 index fa53250..0000000 Binary files a/lib/tests/img/5.png and /dev/null differ diff --git a/lib/tests/img/6.png b/lib/tests/img/6.png deleted file mode 100755 index f18c20c..0000000 Binary files a/lib/tests/img/6.png and /dev/null differ diff --git a/lib/tests/index.html b/lib/tests/index.html deleted file mode 100644 index fc2ecef..0000000 --- a/lib/tests/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - Comic Book Reader Test Suite - - - - - - - - - - - - - - - - - -
-
-
-
- - diff --git a/lib/tests/phantom.js b/lib/tests/phantom.js deleted file mode 100644 index 3a5de31..0000000 --- a/lib/tests/phantom.js +++ /dev/null @@ -1,63 +0,0 @@ -// Simple phantom.js integration script -// Taken from Twitter Bootstrap - -function waitFor(testFx, onReady, timeOutMillis) { - var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 5001 //< Default Max Timout is 5s - , start = new Date().getTime() - , condition = false - , interval = setInterval(function () { - if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) { - // If not time-out yet and condition not yet fulfilled - condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()) //< defensive code - } else { - if (!condition) { - // If condition still not fulfilled (timeout but condition is 'false') - console.log("'waitFor()' timeout") - phantom.exit(1) - } else { - // Condition fulfilled (timeout and/or condition is 'true') - typeof(onReady) === "string" ? eval(onReady) : onReady() //< Do what it's supposed to do once the condition is fulfilled - clearInterval(interval) //< Stop this interval - } - } - }, 100) //< repeat check every 100ms -} - - -if (phantom.args.length === 0 || phantom.args.length > 2) { - console.log('Usage: phantom.js URL') - phantom.exit() -} - -var page = new WebPage() - -// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this") -page.onConsoleMessage = function(msg) { - console.log(msg) -}; - -page.open(phantom.args[0], function(status){ - if (status !== "success") { - console.log("Unable to access network") - phantom.exit() - } else { - waitFor(function(){ - return page.evaluate(function(){ - var el = document.getElementById('qunit-testresult') - if (el && el.innerText.match('completed')) { - return true - } - return false - }) - }, function(){ - var failedNum = page.evaluate(function(){ - var el = document.getElementById('qunit-testresult') - try { - return el.getElementsByClassName('failed')[0].innerHTML - } catch (e) { } - return 10000 - }); - phantom.exit((parseInt(failedNum, 10) > 0) ? 1 : 0) - }) - } -}) diff --git a/lib/tests/server.js b/lib/tests/server.js deleted file mode 100755 index 3964d86..0000000 --- a/lib/tests/server.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Simple connect server for phantom.js - * Adapted from Twitter Bootstrap - */ - -var connect = require('connect'), - http = require('http'), - fs = require('fs'), - app = connect(), - pid_path = __dirname + '/pid.txt'; - -// clean up after failed test runs -if (fs.existsSync(pid_path)) { - try { - var pid = fs.readFileSync(pid_path, { encoding: 'utf-8' }); - process.kill(pid, 'SIGHUP'); - } catch (e) {} - fs.unlinkSync(pid_path); -} - -app.use(connect.static(__dirname + '/../../')); - -http.createServer(app).listen(3000); - -fs.writeFileSync(pid_path, process.pid, 'utf-8'); diff --git a/lib/tests/unit/ComicBook.js b/lib/tests/unit/ComicBook.js deleted file mode 100644 index fc93ddd..0000000 --- a/lib/tests/unit/ComicBook.js +++ /dev/null @@ -1,62 +0,0 @@ -/* global $: false, module: false, test: false, equal: false, ComicBook: false console: false */ - -$(function () { - - 'use strict'; - - var $fixture; - var book; - - function initBook() { - - $fixture = $('#qunit-fixture'); - $fixture.append(''); - - book = new ComicBook( - 'comic', - ['img/1.png','img/2.png','img/3.png','img/4.png','img/5.png','img/6.png'], - { libPath: '../vendor/' } - ); - } - - module('not yet rendered comic', { - setup: initBook - }); - - test('controls shouldn\'t be renderd yet', function () { - equal($('.cb-control, .toolbar').length, 0, 'book not drawn yet, nothing should be rendered'); - }); - - module('rendered comic', { - - setup: function () { - initBook(); - book.draw(); - }, - - teardown: function () { - } - }); - - test('all controls should be rendered', function () { - equal($('.cb-control, .toolbar').length, 5, 'All toolbar elements should have rendered after book.draw'); - }); - - // navigate on keyboard - // don't navigate if nothing left - // show current page - // customise keyboard control - // dropdown menus - // apply effects - // maximise - // minimise - // fit width - // single page / double page - // single page should allow double page spreads - // preloading - // update hash - // resume based on hash - // load from middle of page - // emit custom events based on data-attributes - // destroy -}); diff --git a/lib/tests/unit/logger.js b/lib/tests/unit/logger.js deleted file mode 100644 index 96514d5..0000000 --- a/lib/tests/unit/logger.js +++ /dev/null @@ -1,24 +0,0 @@ -/* jshint strict: false */ -/* global console: false, QUnit: false */ - -// Logging setup for phantom integration -// Taken from Twitter Bootstrap - -QUnit.begin = function () { - console.log('Starting test suite'); - console.log('================================================\n'); -}; - -QUnit.moduleDone = function (opts) { - if (opts.failed === 0) { - console.log('\u2714 All tests passed in "' + opts.name + '" module'); - } else { - console.log('\u2716 ' + opts.failed + ' tests failed in "' + opts.name + '" module'); - } -}; - -QUnit.done = function (opts) { - console.log('\n================================================'); - console.log('Tests completed in ' + opts.runtime + ' milliseconds'); - console.log(opts.passed + ' tests of ' + opts.total + ' passed, ' + opts.failed + ' failed.'); -}; diff --git a/lib/tests/vendor/qunit-1.11.0.css b/lib/tests/vendor/qunit-1.11.0.css deleted file mode 100644 index d7fc0c8..0000000 --- a/lib/tests/vendor/qunit-1.11.0.css +++ /dev/null @@ -1,244 +0,0 @@ -/** - * QUnit v1.11.0 - A JavaScript Unit Testing Framework - * - * http://qunitjs.com - * - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -/** Font Family and Sizes */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { - font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; -} - -#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } -#qunit-tests { font-size: smaller; } - - -/** Resets */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { - margin: 0; - padding: 0; -} - - -/** Header */ - -#qunit-header { - padding: 0.5em 0 0.5em 1em; - - color: #8699a4; - background-color: #0d3349; - - font-size: 1.5em; - line-height: 1em; - font-weight: normal; - - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -webkit-border-top-right-radius: 5px; - -webkit-border-top-left-radius: 5px; -} - -#qunit-header a { - text-decoration: none; - color: #c2ccd1; -} - -#qunit-header a:hover, -#qunit-header a:focus { - color: #fff; -} - -#qunit-testrunner-toolbar label { - display: inline-block; - padding: 0 .5em 0 .1em; -} - -#qunit-banner { - height: 5px; -} - -#qunit-testrunner-toolbar { - padding: 0.5em 0 0.5em 2em; - color: #5E740B; - background-color: #eee; - overflow: hidden; -} - -#qunit-userAgent { - padding: 0.5em 0 0.5em 2.5em; - background-color: #2b81af; - color: #fff; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} - -#qunit-modulefilter-container { - float: right; -} - -/** Tests: Pass/Fail */ - -#qunit-tests { - list-style-position: inside; -} - -#qunit-tests li { - padding: 0.4em 0.5em 0.4em 2.5em; - border-bottom: 1px solid #fff; - list-style-position: inside; -} - -#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { - display: none; -} - -#qunit-tests li strong { - cursor: pointer; -} - -#qunit-tests li a { - padding: 0.5em; - color: #c2ccd1; - text-decoration: none; -} -#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; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - -.qunit-collapsed { - display: none; -} - -#qunit-tests table { - border-collapse: collapse; - margin-top: .2em; -} - -#qunit-tests th { - text-align: right; - vertical-align: top; - padding: 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 { - background-color: #e0f2be; - color: #374e0c; - text-decoration: none; -} - -#qunit-tests ins { - background-color: #ffcaca; - color: #500; - text-decoration: none; -} - -/*** Test Counts */ - -#qunit-tests b.counts { color: black; } -#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: #999999; } - -#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; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-bottom-right-radius: 5px; - -webkit-border-bottom-left-radius: 5px; -} - -#qunit-tests .fail { color: #000000; background-color: #EE5757; } -#qunit-tests .fail .test-name, -#qunit-tests .fail .module-name { color: #000000; } - -#qunit-tests .fail .test-actual { color: #EE5757; } -#qunit-tests .fail .test-expected { color: green; } - -#qunit-banner.qunit-fail { background-color: #EE5757; } - - -/** Result */ - -#qunit-testresult { - padding: 0.5em 0.5em 0.5em 2.5em; - - color: #2b81af; - background-color: #D2E0E6; - - border-bottom: 1px solid white; -} -#qunit-testresult .module-name { - font-weight: bold; -} - -/** Fixture */ - -#qunit-fixture { - position: absolute; - top: -10000px; - left: -10000px; - width: 1000px; - height: 1000px; -} diff --git a/lib/tests/vendor/qunit-1.11.0.js b/lib/tests/vendor/qunit-1.11.0.js deleted file mode 100644 index 302545f..0000000 --- a/lib/tests/vendor/qunit-1.11.0.js +++ /dev/null @@ -1,2152 +0,0 @@ -/** - * QUnit v1.11.0 - A JavaScript Unit Testing Framework - * - * http://qunitjs.com - * - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -(function( window ) { - -var QUnit, - assert, - config, - onErrorFnPrev, - testId = 0, - fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - // Keep a local reference to Date (GH-283) - Date = window.Date, - defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - var x = "qunit-test-string"; - try { - sessionStorage.setItem( x, x ); - sessionStorage.removeItem( x ); - return true; - } catch( e ) { - return false; - } - }()) - }, - /** - * Provides a normalized error string, correcting an issue - * with IE 7 (and prior) where Error.prototype.toString is - * not properly implemented - * - * Based on http://es5.github.com/#x15.11.4.4 - * - * @param {String|Error} error - * @return {String} error message - */ - errorString = function( error ) { - var name, message, - errorString = error.toString(); - if ( errorString.substring( 0, 7 ) === "[object" ) { - name = error.name ? error.name.toString() : "Error"; - 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 errorString; - } - }, - /** - * 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). - */ - objectValues = function( obj ) { - // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. - /*jshint newcap: false */ - var key, val, - vals = QUnit.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 Test( settings ) { - extend( this, settings ); - this.assertions = []; - this.testNumber = ++Test.count; -} - -Test.count = 0; - -Test.prototype = { - init: function() { - var a, b, li, - tests = id( "qunit-tests" ); - - if ( tests ) { - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml; - - // `a` initialized at top of scope - a = document.createElement( "a" ); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ testNumber: this.testNumber }); - - li = document.createElement( "li" ); - li.appendChild( b ); - li.appendChild( a ); - li.className = "running"; - li.id = this.id = "qunit-test-output" + testId++; - - tests.appendChild( li ); - } - }, - setup: function() { - if ( this.module !== config.previousModule ) { - if ( config.previousModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } else if ( config.autorun ) { - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } - - config.current = this; - - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment ); - - this.started = +new Date(); - runLoggingCallbacks( "testStart", QUnit, { - name: this.testName, - module: this.module - }); - - // allow utility functions to access the current test environment - // TODO why?? - QUnit.current_testEnvironment = this.testEnvironment; - - if ( !config.pollution ) { - saveGlobal(); - } - if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment ); - return; - } - try { - this.testEnvironment.setup.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - }, - run: function() { - config.current = this; - - var running = id( "qunit-testresult" ); - - if ( running ) { - running.innerHTML = "Running:
" + this.nameHtml; - } - - if ( this.async ) { - QUnit.stop(); - } - - this.callbackStarted = +new Date(); - - if ( config.notrycatch ) { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - return; - } - - try { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - } catch( e ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - - QUnit.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 ) { - QUnit.start(); - } - } - }, - teardown: function() { - config.current = this; - if ( config.notrycatch ) { - if ( typeof this.callbackRuntime === "undefined" ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - } - this.testEnvironment.teardown.call( this.testEnvironment ); - return; - } else { - try { - this.testEnvironment.teardown.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - } - checkPollution(); - }, - finish: function() { - config.current = this; - if ( config.requireExpects && this.expected === null ) { - QUnit.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 ) { - QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); - } else if ( this.expected === null && !this.assertions.length ) { - QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); - } - - var i, assertion, a, b, time, li, ol, - test = this, - good = 0, - bad = 0, - tests = id( "qunit-tests" ); - - this.runtime = +new Date() - this.started; - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - ol = document.createElement( "ol" ); - ol.className = "qunit-assert-list"; - - for ( i = 0; i < this.assertions.length; i++ ) { - assertion = this.assertions[i]; - - li = document.createElement( "li" ); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if ( bad ) { - sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); - } else { - sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); - } - } - - if ( bad === 0 ) { - addClass( ol, "qunit-collapsed" ); - } - - // `b` initialized at top of scope - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.parentNode.lastChild, - collapsed = hasClass( next, "qunit-collapsed" ); - ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); - }); - - addEvent(b, "dblclick", function( e ) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ testNumber: test.testNumber }); - } - }); - - // `time` initialized at top of scope - time = document.createElement( "span" ); - time.className = "runtime"; - time.innerHTML = this.runtime + " ms"; - - // `li` initialized at top of scope - li = id( this.id ); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - a = li.firstChild; - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( time ); - li.appendChild( ol ); - - } else { - for ( i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - runLoggingCallbacks( "testDone", QUnit, { - name: this.testName, - module: this.module, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length, - duration: this.runtime - }); - - QUnit.reset(); - - config.current = undefined; - }, - - queue: function() { - var bad, - test = this; - - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - - // `bad` initialized at top of scope - // defer when previous test run passed, if storage is available - bad = QUnit.config.reorder && defined.sessionStorage && - +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); - - if ( bad ) { - run(); - } else { - synchronize( run, true ); - } - } -}; - -// Root QUnit object. -// `QUnit` initialized at top of scope -QUnit = { - - // call on start of module test to prepend name to all tests - module: function( name, testEnvironment ) { - config.currentModule = name; - config.currentModuleTestEnvironment = testEnvironment; - config.modules[name] = true; - }, - - asyncTest: function( testName, expected, callback ) { - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - QUnit.test( testName, expected, callback, true ); - }, - - test: function( testName, expected, callback, async ) { - var test, - nameHtml = "" + escapeText( testName ) + ""; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - if ( config.currentModule ) { - nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; - } - - test = new Test({ - nameHtml: nameHtml, - testName: testName, - expected: expected, - async: async, - callback: callback, - module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnvironment, - stack: sourceFromStacktrace( 2 ) - }); - - if ( !validTest( test ) ) { - return; - } - - test.queue(); - }, - - // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - expect: function( asserts ) { - if (arguments.length === 1) { - config.current.expected = asserts; - } else { - return config.current.expected; - } - }, - - start: function( count ) { - // QUnit hasn't been initialized yet. - // Note: RequireJS (et al) may delay onLoad - if ( config.semaphore === undefined ) { - QUnit.begin(function() { - // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first - setTimeout(function() { - QUnit.start( count ); - }); - }); - return; - } - - config.semaphore -= count || 1; - // don't start until equal number of stop-calls - if ( config.semaphore > 0 ) { - return; - } - // ignore if start is called more often then stop - if ( config.semaphore < 0 ) { - config.semaphore = 0; - QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); - return; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - window.setTimeout(function() { - if ( config.semaphore > 0 ) { - return; - } - if ( config.timeout ) { - clearTimeout( config.timeout ); - } - - config.blocking = false; - process( true ); - }, 13); - } else { - config.blocking = false; - process( true ); - } - }, - - stop: function( count ) { - config.semaphore += count || 1; - config.blocking = true; - - if ( config.testTimeout && defined.setTimeout ) { - clearTimeout( config.timeout ); - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - config.semaphore = 1; - QUnit.start(); - }, config.testTimeout ); - } - } -}; - -// `assert` initialized at top of scope -// Asssert helpers -// All of these must either call QUnit.push() or manually do: -// - runLoggingCallbacks( "log", .. ); -// - config.current.assertions.push({ .. }); -// We attach it to the QUnit object *after* we expose the public API, -// otherwise `assert` will become a global variable in browsers (#341). -assert = { - /** - * Asserts rough true-ish result. - * @name ok - * @function - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function( result, msg ) { - if ( !config.current ) { - throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - result = !!result; - - var source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: msg - }; - - msg = escapeText( msg || (result ? "okay" : "failed" ) ); - msg = "" + msg + ""; - - if ( !result ) { - source = sourceFromStacktrace( 2 ); - if ( source ) { - details.source = source; - msg += "
Source:
" + escapeText( source ) + "
"; - } - } - runLoggingCallbacks( "log", QUnit, details ); - config.current.assertions.push({ - result: result, - message: msg - }); - }, - - /** - * Assert that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * @name equal - * @function - * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); - */ - equal: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected == actual, actual, expected, message ); - }, - - /** - * @name notEqual - * @function - */ - notEqual: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected != actual, actual, expected, message ); - }, - - /** - * @name propEqual - * @function - */ - propEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notPropEqual - * @function - */ - notPropEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name deepEqual - * @function - */ - deepEqual: function( actual, expected, message ) { - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notDeepEqual - * @function - */ - notDeepEqual: function( actual, expected, message ) { - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name strictEqual - * @function - */ - strictEqual: function( actual, expected, message ) { - QUnit.push( expected === actual, actual, expected, message ); - }, - - /** - * @name notStrictEqual - * @function - */ - notStrictEqual: function( actual, expected, message ) { - QUnit.push( expected !== actual, actual, expected, message ); - }, - - "throws": function( block, expected, message ) { - var actual, - expectedOutput = expected, - ok = false; - - // 'expected' is optional - if ( typeof expected === "string" ) { - message = expected; - expected = null; - } - - config.current.ignoreGlobalErrors = true; - try { - block.call( config.current.testEnvironment ); - } catch (e) { - actual = e; - } - config.current.ignoreGlobalErrors = false; - - if ( actual ) { - // we don't want to validate thrown error - if ( !expected ) { - ok = true; - expectedOutput = null; - // expected is a regexp - } else if ( QUnit.objectType( expected ) === "regexp" ) { - ok = expected.test( errorString( actual ) ); - // expected is a constructor - } else if ( actual instanceof expected ) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if ( expected.call( {}, actual ) === true ) { - expectedOutput = null; - ok = true; - } - - QUnit.push( ok, actual, expectedOutput, message ); - } else { - QUnit.pushFailure( message, null, 'No exception was thrown.' ); - } - } -}; - -/** - * @deprecate since 1.8.0 - * Kept assertion helpers in root for backwards compatibility. - */ -extend( QUnit, assert ); - -/** - * @deprecated since 1.9.0 - * Kept root "raises()" for backwards compatibility. - * (Note that we don't introduce assert.raises). - */ -QUnit.raises = assert[ "throws" ]; - -/** - * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 - * Kept to avoid TypeErrors for undefined methods. - */ -QUnit.equals = function() { - QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); -}; -QUnit.same = function() { - QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); -}; - -// We want access to the constructor's prototype -(function() { - function F() {} - F.prototype = QUnit; - QUnit = new F(); - // Make F QUnit's constructor so that we can add to the prototype later - QUnit.constructor = F; -}()); - -/** - * Config object: Maintain internal state - * Later exposed as QUnit.config - * `config` initialized at top of scope - */ -config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // 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, - - // when enabled, all tests must call expect() - requireExpects: false, - - // add checkboxes that are persisted in the query-string - // when enabled, the id is set to `true` as a `QUnit.config` property - urlConfig: [ - { - id: "noglobals", - label: "Check for Globals", - tooltip: "Enabling this will test if any test introduces new properties on the `window` object. 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." - } - ], - - // Set of all modules. - modules: {}, - - // logging callback queues - begin: [], - done: [], - log: [], - testStart: [], - testDone: [], - moduleStart: [], - moduleDone: [] -}; - -// Export global variables, unless an 'exports' object exists, -// in that case we assume we're in CommonJS (dealt with on the bottom of the script) -if ( typeof exports === "undefined" ) { - extend( window, QUnit ); - - // Expose QUnit object - window.QUnit = QUnit; -} - -// Initialize more QUnit.config and QUnit.urlParams -(function() { - var i, - location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - - QUnit.urlParams = urlParams; - - // String search anywhere in moduleName+testName - config.filter = urlParams.filter; - - // Exact match of the module name - config.module = urlParams.module; - - config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = location.protocol === "file:"; -}()); - -// Extend QUnit object, -// these after set here because they should not be exposed as global functions -extend( QUnit, { - assert: assert, - - config: config, - - // Initialize the configuration options - init: function() { - extend( config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date(), - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 1 - }); - - var tests, banner, result, - qunit = id( "qunit" ); - - if ( qunit ) { - qunit.innerHTML = - "

" + escapeText( document.title ) + "

" + - "

" + - "
" + - "

" + - "
    "; - } - - tests = id( "qunit-tests" ); - banner = id( "qunit-banner" ); - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = "Running...
     "; - } - }, - - // Resets the test setup. Useful for tests that modify the DOM. - reset: function() { - var fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } - }, - - // Trigger an event on an element. - // @example triggerEvent( document.body, "click" ); - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent( "MouseEvents" ); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - - elem.dispatchEvent( event ); - } else if ( elem.fireEvent ) { - elem.fireEvent( "on" + type ); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) === type; - }, - - objectType: function( 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 "Date": - case "RegExp": - case "Function": - return type.toLowerCase(); - } - if ( typeof obj === "object" ) { - return "object"; - } - return undefined; - }, - - push: function( result, actual, expected, message ) { - if ( !config.current ) { - throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); - } - - var output, source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeText( message ) || ( result ? "okay" : "failed" ); - message = "" + message + ""; - output = message; - - if ( !result ) { - expected = escapeText( QUnit.jsDump.parse(expected) ); - actual = escapeText( QUnit.jsDump.parse(actual) ); - output += ""; - - if ( actual !== expected ) { - output += ""; - output += ""; - } - - source = sourceFromStacktrace(); - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
    Expected:
    " + expected + "
    Result:
    " + actual + "
    Diff:
    " + QUnit.diff( expected, actual ) + "
    Source:
    " + escapeText( source ) + "
    "; - } - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - pushFailure: function( message, source, actual ) { - if ( !config.current ) { - throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - - var output, - details = { - module: config.current.module, - name: config.current.testName, - result: false, - message: message - }; - - message = escapeText( message ) || "error"; - message = "" + message + ""; - output = message; - - output += ""; - - if ( actual ) { - output += ""; - } - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
    Result:
    " + escapeText( actual ) + "
    Source:
    " + escapeText( source ) + "
    "; - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: false, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var key, - querystring = "?"; - - for ( key in params ) { - if ( !hasOwn.call( params, key ) ) { - continue; - } - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - return window.location.protocol + "//" + window.location.host + - window.location.pathname + querystring.slice( 0, -1 ); - }, - - extend: extend, - id: id, - addEvent: addEvent - // load, equiv, jsDump, diff: Attached later -}); - -/** - * @deprecated: Created for backwards compatibility with test runner that set the hook function - * into QUnit.{hook}, instead of invoking it and passing the hook function. - * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. - * Doing this allows us to tell if the following methods have been overwritten on the actual - * QUnit object. - */ -extend( QUnit.constructor.prototype, { - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: registerLoggingCallback( "begin" ), - - // done: { failed, passed, total, runtime } - done: registerLoggingCallback( "done" ), - - // log: { result, actual, expected, message } - log: registerLoggingCallback( "log" ), - - // testStart: { name } - testStart: registerLoggingCallback( "testStart" ), - - // testDone: { name, failed, passed, total, duration } - testDone: registerLoggingCallback( "testDone" ), - - // moduleStart: { name } - moduleStart: registerLoggingCallback( "moduleStart" ), - - // moduleDone: { name, failed, passed, total } - moduleDone: registerLoggingCallback( "moduleDone" ) -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - runLoggingCallbacks( "begin", QUnit, {} ); - - // Initialize the config, saving the execution queue - var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, - urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter, - numModules = 0, - moduleFilterHtml = "", - urlConfigHtml = "", - oldconfig = extend( {}, config ); - - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - len = config.urlConfig.length; - - for ( i = 0; i < len; i++ ) { - val = config.urlConfig[i]; - if ( typeof val === "string" ) { - val = { - id: val, - label: val, - tooltip: "[no tooltip available]" - }; - } - config[ val.id ] = QUnit.urlParams[ val.id ]; - urlConfigHtml += ""; - } - - moduleFilterHtml += ""; - - // `userAgent` initialized at top of scope - userAgent = id( "qunit-userAgent" ); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - // `banner` initialized at top of scope - banner = id( "qunit-header" ); - if ( banner ) { - banner.innerHTML = "" + banner.innerHTML + " "; - } - - // `toolbar` initialized at top of scope - toolbar = id( "qunit-testrunner-toolbar" ); - if ( toolbar ) { - // `filter` initialized at top of scope - filter = document.createElement( "input" ); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - - addEvent( filter, "click", function() { - var tmp, - ol = document.getElementById( "qunit-tests" ); - - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace( / hidepass /, " " ); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); - } else { - sessionStorage.removeItem( "qunit-filter-passed-tests" ); - } - } - }); - - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { - filter.checked = true; - // `ol` initialized at top of scope - ol = document.getElementById( "qunit-tests" ); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - // `label` initialized at top of scope - label = document.createElement( "label" ); - label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." ); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - urlConfigCheckboxesContainer = document.createElement("span"); - urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; - urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input"); - // For oldIE support: - // * Add handlers to the individual elements instead of the container - // * Use "click" instead of "change" - // * Fallback from event.target to event.srcElement - addEvents( urlConfigCheckboxes, "click", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - toolbar.appendChild( urlConfigCheckboxesContainer ); - - if (numModules > 1) { - moduleFilter = document.createElement( 'span' ); - moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); - moduleFilter.innerHTML = moduleFilterHtml; - addEvent( moduleFilter.lastChild, "change", function() { - var selectBox = moduleFilter.getElementsByTagName("select")[0], - selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - - window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); - }); - toolbar.appendChild(moduleFilter); - } - } - - // `main` initialized at top of scope - main = id( "qunit-fixture" ); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( config.autostart ) { - QUnit.start(); - } -}; - -addEvent( window, "load", QUnit.load ); - -// `onErrorFnPrev` initialized at top of scope -// Preserve other handlers -onErrorFnPrev = window.onerror; - -// Cover uncaught exceptions -// Returning true will surpress the default browser handler, -// returning false will let it run. -window.onerror = function ( error, filePath, linerNr ) { - var ret = false; - if ( onErrorFnPrev ) { - ret = onErrorFnPrev( error, filePath, linerNr ); - } - - // Treat return value as window.onerror itself does, - // Only do our handling if not surpressed. - if ( ret !== true ) { - if ( QUnit.config.current ) { - if ( QUnit.config.current.ignoreGlobalErrors ) { - return true; - } - QUnit.pushFailure( error, filePath + ":" + linerNr ); - } else { - QUnit.test( "global failure", extend( function() { - QUnit.pushFailure( error, filePath + ":" + linerNr ); - }, { validTest: validTest } ) ); - } - return false; - } - - return ret; -}; - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - - var i, key, - banner = id( "qunit-banner" ), - tests = id( "qunit-tests" ), - runtime = +new Date() - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - "Tests completed in ", - runtime, - " milliseconds.
    ", - "", - passed, - " assertions of ", - config.stats.all, - " passed, ", - config.stats.bad, - " failed." - ].join( "" ); - - if ( banner ) { - banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - ( config.stats.bad ? "\u2716" : "\u2714" ), - document.title.replace( /^[\u2714\u2716] /i, "" ) - ].join( " " ); - } - - // clear own sessionStorage items if all tests passed - if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - // `key` & `i` initialized at top of scope - for ( i = 0; i < sessionStorage.length; i++ ) { - key = sessionStorage.key( i++ ); - if ( key.indexOf( "qunit-test-" ) === 0 ) { - sessionStorage.removeItem( key ); - } - } - } - - // scroll back to top to show results - if ( window.scrollTo ) { - window.scrollTo(0, 0); - } - - runLoggingCallbacks( "done", QUnit, { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - }); -} - -/** @return Boolean: true if this test should be ran */ -function validTest( test ) { - var include, - filter = config.filter && config.filter.toLowerCase(), - module = config.module && config.module.toLowerCase(), - fullName = (test.module + ": " + test.testName).toLowerCase(); - - // Internally-generated tests are always valid - if ( test.callback && test.callback.validTest === validTest ) { - delete test.callback.validTest; - return true; - } - - if ( config.testNumber ) { - return test.testNumber === config.testNumber; - } - - if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { - return false; - } - - if ( !filter ) { - return true; - } - - 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; -} - -// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) -// Later Safari and IE10 are supposed to support error.stack as well -// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack -function extractStacktrace( e, offset ) { - offset = offset === undefined ? 3 : offset; - - var stack, include, i; - - if ( e.stacktrace ) { - // Opera - return e.stacktrace.split( "\n" )[ offset + 3 ]; - } else if ( e.stack ) { - // Firefox, Chrome - 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 ]; - } else if ( e.sourceURL ) { - // Safari, PhantomJS - // hopefully one day Safari provides actual stacktraces - // exclude useless self-reference for generated Error objects - if ( /qunit.js$/.test( e.sourceURL ) ) { - return; - } - // for actual exceptions, this is useful - return e.sourceURL + ":" + e.line; - } -} -function sourceFromStacktrace( offset ) { - try { - throw new Error(); - } catch ( e ) { - return extractStacktrace( e, offset ); - } -} - -/** - * 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 synchronize( callback, last ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process( last ); - } -} - -function process( last ) { - function next() { - process( last ); - } - var start = new Date().getTime(); - config.depth = config.depth ? config.depth + 1 : 1; - - while ( config.queue.length && !config.blocking ) { - if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { - config.queue.shift()(); - } else { - window.setTimeout( next, 13 ); - break; - } - } - config.depth--; - if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( !hasOwn.call( window, key ) || /^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 ) { - QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// 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; -} - -function extend( a, b ) { - for ( var prop in b ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - - // Avoid "Member not found" error in IE8 caused by setting window.constructor - } else if ( prop !== "constructor" || a !== window ) { - a[ prop ] = b[ prop ]; - } - } - - return a; -} - -/** - * @param {HTMLElement} elem - * @param {string} type - * @param {Function} fn - */ -function addEvent( elem, type, fn ) { - // Standards-based browsers - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - // IE - } else { - elem.attachEvent( "on" + type, fn ); - } -} - -/** - * @param {Array|NodeList} elems - * @param {string} type - * @param {Function} fn - */ -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 + " ") > -1; -} - -function addClass( elem, name ) { - if ( !hasClass( elem, name ) ) { - elem.className += (elem.className ? " " : "") + name; - } -} - -function removeClass( elem, name ) { - var set = " " + elem.className + " "; - // Class name may appear multiple times - while ( set.indexOf(" " + name + " ") > -1 ) { - set = set.replace(" " + name + " " , " "); - } - // If possible, trim it for prettiness, but not neccecarily - elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); -} - -function id( name ) { - return !!( typeof document !== "undefined" && document && document.getElementById ) && - document.getElementById( name ); -} - -function registerLoggingCallback( key ) { - return function( callback ) { - config[key].push( callback ); - }; -} - -// Supports deprecated method of completely overwriting logging callbacks -function runLoggingCallbacks( key, scope, args ) { - var i, callbacks; - if ( QUnit.hasOwnProperty( key ) ) { - QUnit[ key ].call(scope, args ); - } else { - callbacks = config[ key ]; - for ( i = 0; i < callbacks.length; i++ ) { - callbacks[ i ].call( scope, args ); - } - } -} - -// Test for equality any JavaScript type. -// Author: Philippe Rathé -QUnit.equiv = (function() { - - // Call the o related callback with the given arguments. - function bindCallbacks( o, callbacks, args ) { - var prop = QUnit.objectType( o ); - if ( prop ) { - if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { - return callbacks[ prop ].apply( callbacks, args ); - } else { - return callbacks[ prop ]; // or undefined - } - } - } - - // the real equiv function - var innerEquiv, - // stack to decide between skip/abort functions - callers = [], - // stack to avoiding loops from circular referencing - parents = [], - - getProto = Object.getPrototypeOf || function ( obj ) { - return obj.__proto__; - }, - callbacks = (function () { - - // for string, boolean, number and null - function useStrictEquality( b, a ) { - /*jshint eqeqeq:false */ - if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotaion VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function( b ) { - return isNaN( b ); - }, - - "date": function( b, a ) { - return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function( b, a ) { - return QUnit.objectType( b ) === "regexp" && - // the regex itself - a.source === b.source && - // and its modifers - a.global === b.global && - // (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline && - a.sticky === b.sticky; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array": function( b, a ) { - var i, j, len, loop; - - // b could be an object literal here - if ( QUnit.objectType( b ) !== "array" ) { - return false; - } - - len = a.length; - if ( len !== b.length ) { - // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push( a ); - for ( i = 0; i < len; i++ ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - loop = true;// dont rewalk array - } - } - if ( !loop && !innerEquiv(a[i], b[i]) ) { - parents.pop(); - return false; - } - } - parents.pop(); - return true; - }, - - "object": function( b, a ) { - var i, j, loop, - // Default to true - eq = true, - aProperties = [], - bProperties = []; - - // comparing constructors is more strict than using - // instanceof - if ( a.constructor !== b.constructor ) { - // Allow objects with no prototype to be equivalent to - // objects with Object as their constructor. - if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || - ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { - return false; - } - } - - // stack constructor before traversing properties - callers.push( a.constructor ); - // track reference to avoid circular references - parents.push( a ); - - for ( i in a ) { // be strict: don't ensures hasOwnProperty - // and go deep - loop = false; - for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - // don't go down the same path twice - loop = true; - } - } - aProperties.push(i); // collect a's properties - - if (!loop && !innerEquiv( a[i], b[i] ) ) { - eq = false; - break; - } - } - - callers.pop(); // unstack, we are done - parents.pop(); - - for ( i in b ) { - bProperties.push( i ); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); - } - }; - }()); - - innerEquiv = function() { // can take multiple arguments - var args = [].slice.apply( arguments ); - if ( args.length < 2 ) { - return true; // end transition - } - - return (function( a, b ) { - if ( a === b ) { - return true; // catch the most you can - } else if ( a === null || b === null || typeof a === "undefined" || - typeof b === "undefined" || - QUnit.objectType(a) !== QUnit.objectType(b) ) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } - - // apply transition with (1..n) arguments - }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); - }; - - return innerEquiv; -}()); - -/** - * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | - * http://flesler.blogspot.com Licensed under BSD - * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 - * - * @projectDescription Advanced and extensible data dumping for Javascript. - * @version 1.0.0 - * @author Ariel Flesler - * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} - */ -QUnit.jsDump = (function() { - function quote( str ) { - return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; - } - function literal( o ) { - return o + ""; - } - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.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); - this.up(); - while ( i-- ) { - ret[i] = this.parse( arr[i] , undefined , stack); - } - this.down(); - return join( "[", ret, "]" ); - } - - var reName = /^function (\w+)/, - jsDump = { - // type is used mostly internally, you can fix a (custom)type in advance - parse: function( obj, type, stack ) { - stack = stack || [ ]; - var inStack, res, - parser = this.parsers[ type || this.typeOf(obj) ]; - - type = typeof parser; - inStack = inArray( obj, stack ); - - if ( inStack !== -1 ) { - return "recursion(" + (inStack - stack.length) + ")"; - } - if ( type === "function" ) { - stack.push( obj ); - res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - return ( type === "string" ) ? parser : this.parsers.error; - }, - typeOf: function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if ( typeof obj === "undefined" ) { - type = "undefined"; - } else if ( QUnit.is( "regexp", obj) ) { - type = "regexp"; - } else if ( QUnit.is( "date", obj) ) { - type = "date"; - } else if ( QUnit.is( "function", obj) ) { - type = "function"; - } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { - type = "window"; - } else if ( obj.nodeType === 9 ) { - type = "document"; - } else if ( obj.nodeType ) { - type = "node"; - } else if ( - // native arrays - toString.call( obj ) === "[object Array]" || - // NodeList objects - ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) - ) { - type = "array"; - } else if ( obj.constructor === Error.prototype.constructor ) { - type = "error"; - } else { - type = typeof obj; - } - return type; - }, - separator: function() { - return this.multiline ? this.HTML ? "
    " : "\n" : this.HTML ? " " : " "; - }, - // extra can be a number, shortcut for increasing-calling-decreasing - indent: function( 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( a ) { - this._depth_ += a || 1; - }, - down: function( a ) { - this._depth_ -= a || 1; - }, - setParser: function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote: quote, - literal: literal, - join: join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers: { - window: "[Window]", - document: "[Document]", - error: function(error) { - return "Error(\"" + error.message + "\")"; - }, - unknown: "[Unknown]", - "null": "null", - "undefined": "undefined", - "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, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); - return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); - }, - array: array, - nodelist: array, - "arguments": array, - object: function( map, stack ) { - var ret = [ ], keys, key, val, i; - QUnit.jsDump.up(); - keys = []; - for ( key in map ) { - keys.push( key ); - } - keys.sort(); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - val = map[ key ]; - ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); - } - QUnit.jsDump.down(); - return join( "{", ret, "}" ); - }, - node: function( node ) { - var len, i, val, - open = QUnit.jsDump.HTML ? "<" : "<", - close = QUnit.jsDump.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 + "=" + QUnit.jsDump.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( 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 an html attribute value - attribute: quote, - string: quote, - date: quote, - regexp: literal, - number: literal, - "boolean": literal - }, - // 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 jsDump; -}()); - -// from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -/* - * Javascript Diff Algorithm - * By John Resig (http://ejohn.org/) - * Modified by Chu Alan "sprite" - * - * Released under the MIT license. - * - * More Info: - * http://ejohn.org/projects/javascript-diff-algorithm/ - * - * Usage: QUnit.diff(expected, actual) - * - * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" - */ -QUnit.diff = (function() { - /*jshint eqeqeq:false, eqnull:true */ - function diff( o, n ) { - var i, - ns = {}, - os = {}; - - for ( i = 0; i < n.length; i++ ) { - if ( !hasOwn.call( ns, n[i] ) ) { - ns[ n[i] ] = { - rows: [], - o: null - }; - } - ns[ n[i] ].rows.push( i ); - } - - for ( i = 0; i < o.length; i++ ) { - if ( !hasOwn.call( os, o[i] ) ) { - os[ o[i] ] = { - rows: [], - n: null - }; - } - os[ o[i] ].rows.push( i ); - } - - for ( i in ns ) { - if ( !hasOwn.call( ns, i ) ) { - continue; - } - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; - } - } - - for ( i = 0; i < n.length - 1; i++ ) { - if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && - n[ i + 1 ] == o[ n[i].row + 1 ] ) { - - n[ i + 1 ] = { - text: n[ i + 1 ], - row: n[i].row + 1 - }; - o[ n[i].row + 1 ] = { - text: o[ n[i].row + 1 ], - row: i + 1 - }; - } - } - - for ( i = n.length - 1; i > 0; i-- ) { - if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && - n[ i - 1 ] == o[ n[i].row - 1 ]) { - - n[ i - 1 ] = { - text: n[ i - 1 ], - row: n[i].row - 1 - }; - o[ n[i].row - 1 ] = { - text: o[ n[i].row - 1 ], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function( o, n ) { - o = o.replace( /\s+$/, "" ); - n = n.replace( /\s+$/, "" ); - - var i, pre, - str = "", - out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), - oSpace = o.match(/\s+/g), - nSpace = n.match(/\s+/g); - - if ( oSpace == null ) { - oSpace = [ " " ]; - } - else { - oSpace.push( " " ); - } - - if ( nSpace == null ) { - nSpace = [ " " ]; - } - else { - nSpace.push( " " ); - } - - if ( out.n.length === 0 ) { - for ( i = 0; i < out.o.length; i++ ) { - str += "" + out.o[i] + oSpace[i] + ""; - } - } - else { - if ( out.n[0].text == null ) { - for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { - str += "" + out.o[n] + oSpace[n] + ""; - } - } - - for ( i = 0; i < out.n.length; i++ ) { - if (out.n[i].text == null) { - str += "" + out.n[i] + nSpace[i] + ""; - } - else { - // `pre` initialized at top of scope - pre = ""; - - for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { - pre += "" + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -}()); - -// for CommonJS enviroments, export everything -if ( typeof exports !== "undefined" ) { - extend( exports, QUnit ); -} - -// get at whatever the global object is, like window in browsers -}( (function() {return this;}.call()) )); diff --git a/lib/vendor/handlebars.runtime-1.0.rc.1.min.js b/lib/vendor/handlebars.runtime-1.0.rc.1.min.js deleted file mode 100755 index cd031ac..0000000 --- a/lib/vendor/handlebars.runtime-1.0.rc.1.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// lib/handlebars/base.js -/*jshint eqnull:true*/this.Handlebars={},function(e){e.VERSION="1.0.rc.1",e.helpers={},e.partials={},e.registerHelper=function(e,t,n){n&&(t.not=n),this.helpers[e]=t},e.registerPartial=function(e,t){this.partials[e]=t},e.registerHelper("helperMissing",function(e){if(arguments.length===2)return undefined;throw new Error("Could not find property '"+e+"'")});var t=Object.prototype.toString,n="[object Function]";e.registerHelper("blockHelperMissing",function(r,i){var s=i.inverse||function(){},o=i.fn,u="",a=t.call(r);return a===n&&(r=r.call(this)),r===!0?o(this):r===!1||r==null?s(this):a==="[object Array]"?r.length>0?e.helpers.each(r,i):s(this):o(r)}),e.K=function(){},e.createFrame=Object.create||function(t){e.K.prototype=t;var n=new e.K;return e.K.prototype=null,n},e.registerHelper("each",function(t,n){var r=n.fn,i=n.inverse,s=0,o="",u;n.data&&(u=e.createFrame(n.data));if(t&&typeof t=="object")if(t instanceof Array)for(var a=t.length;s":">",'"':""","'":"'","`":"`"},t=/[&<>"'`]/g,n=/[&<>"'`]/,r=function(t){return e[t]||"&"};Handlebars.Utils={escapeExpression:function(e){return e instanceof Handlebars.SafeString?e.toString():e==null||e===!1?"":n.test(e)?e.replace(t,r):e},isEmpty:function(e){return typeof e=="undefined"?!0:e===null?!0:e===!1?!0:Object.prototype.toString.call(e)==="[object Array]"&&e.length===0?!0:!1}}}(),Handlebars.VM={template:function(e){var t={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(e,t,n){var r=this.programs[e];return n?Handlebars.VM.program(t,n):r?r:(r=this.programs[e]=Handlebars.VM.program(t),r)},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(n,r){return r=r||{},e.call(t,Handlebars,n,r.helpers,r.partials,r.data)}},programWithDepth:function(e,t,n){var r=Array.prototype.slice.call(arguments,2);return function(n,i){return i=i||{},e.apply(this,[n,i.data||t].concat(r))}},program:function(e,t){return function(n,r){return r=r||{},e(n,r.data||t)}},noop:function(){return""},invokePartial:function(e,t,n,r,i,s){var o={helpers:r,partials:i,data:s};if(e===undefined)throw new Handlebars.Exception("The partial "+t+" could not be found");if(e instanceof Function)return e(n,o);if(!Handlebars.compile)throw new Handlebars.Exception("The partial "+t+" could not be compiled when running in runtime-only mode");return i[t]=Handlebars.compile(e,{data:s!==undefined}),i[t](n,o)}},Handlebars.template=Handlebars.VM.template; \ No newline at end of file diff --git a/lib/vendor/jquery-2.0.0.min.js b/lib/vendor/jquery-2.0.0.min.js deleted file mode 100755 index b18e05a..0000000 --- a/lib/vendor/jquery-2.0.0.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! jQuery v2.0.0 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license -//@ sourceMappingURL=jquery.min.map -*/ -(function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],f="2.0.0",p=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=f.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=j(e);if(n){if(s){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],o=0,s=e.length;for(n=!!n;s>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s=j(e),a=[];if(s)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(a[a.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(a[a.length]=r);return p.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===x.type(n)){i=!0;for(a in n)x.access(e,t,a,n[a],!0,o,s)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(x(e),n)})),t))for(;u>a;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=s[o];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}t=x(o),function(e,undefined){var t,n,r,i,o,s,a,u,l,c,f,p,h,d,g,m,y="sizzle"+-new Date,v=e.document,b={},w=0,T=0,C=ot(),k=ot(),N=ot(),E=!1,S=function(){return 0},j=typeof undefined,D=1<<31,A=[],L=A.pop,q=A.push,H=A.push,O=A.slice,F=A.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",R="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=M.replace("w","w#"),$="\\["+R+"*("+M+")"+R+"*(?:([*^$|!~]?=)"+R+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+R+"*\\]",B=":("+M+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",I=RegExp("^"+R+"+|((?:^|[^\\\\])(?:\\\\.)*)"+R+"+$","g"),z=RegExp("^"+R+"*,"+R+"*"),_=RegExp("^"+R+"*([>+~]|"+R+")"+R+"*"),X=RegExp(R+"*[+~]"),U=RegExp("="+R+"*([^\\]'\"]*)"+R+"*\\]","g"),Y=RegExp(B),V=RegExp("^"+W+"$"),G={ID:RegExp("^#("+M+")"),CLASS:RegExp("^\\.("+M+")"),TAG:RegExp("^("+M.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+B),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+R+"*(even|odd|(([+-]|)(\\d*)n|)"+R+"*(?:([+-]|)"+R+"*(\\d+)|))"+R+"*\\)|)","i"),"boolean":RegExp("^(?:"+P+")$","i"),needsContext:RegExp("^"+R+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+R+"*((?:-\\d)?\\d*)"+R+"*\\)|)(?=[^-]|$)","i")},J=/^[^{]+\{\s*\[native \w/,Q=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,et=/'|\\/g,tt=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,nt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{H.apply(A=O.call(v.childNodes),v.childNodes),A[v.childNodes.length].nodeType}catch(rt){H={apply:A.length?function(e,t){q.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function it(e){return J.test(e+"")}function ot(){var e,t=[];return e=function(n,i){return t.push(n+=" ")>r.cacheLength&&delete e[t.shift()],e[n]=i}}function st(e){return e[y]=!0,e}function at(e){var t=c.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ut(e,t,n,r){var i,o,s,a,u,f,d,g,x,w;if((t?t.ownerDocument||t:v)!==c&&l(t),t=t||c,n=n||[],!e||"string"!=typeof e)return n;if(1!==(a=t.nodeType)&&9!==a)return[];if(p&&!r){if(i=Q.exec(e))if(s=i[1]){if(9===a){if(o=t.getElementById(s),!o||!o.parentNode)return n;if(o.id===s)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(s))&&m(t,o)&&o.id===s)return n.push(o),n}else{if(i[2])return H.apply(n,t.getElementsByTagName(e)),n;if((s=i[3])&&b.getElementsByClassName&&t.getElementsByClassName)return H.apply(n,t.getElementsByClassName(s)),n}if(b.qsa&&(!h||!h.test(e))){if(g=d=y,x=t,w=9===a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){f=gt(e),(d=t.getAttribute("id"))?g=d.replace(et,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=f.length;while(u--)f[u]=g+mt(f[u]);x=X.test(e)&&t.parentNode||t,w=f.join(",")}if(w)try{return H.apply(n,x.querySelectorAll(w)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(I,"$1"),t,n,r)}o=ut.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},l=ut.setDocument=function(e){var t=e?e.ownerDocument||e:v;return t!==c&&9===t.nodeType&&t.documentElement?(c=t,f=t.documentElement,p=!o(t),b.getElementsByTagName=at(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),b.attributes=at(function(e){return e.className="i",!e.getAttribute("className")}),b.getElementsByClassName=at(function(e){return e.innerHTML="
    ",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),b.sortDetached=at(function(e){return 1&e.compareDocumentPosition(c.createElement("div"))}),b.getById=at(function(e){return f.appendChild(e).id=y,!t.getElementsByName||!t.getElementsByName(y).length}),b.getById?(r.find.ID=function(e,t){if(typeof t.getElementById!==j&&p){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){return e.getAttribute("id")===t}}):(r.find.ID=function(e,t){if(typeof t.getElementById!==j&&p){var n=t.getElementById(e);return n?n.id===e||typeof n.getAttributeNode!==j&&n.getAttributeNode("id").value===e?[n]:undefined:[]}},r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=b.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==j?t.getElementsByTagName(e):undefined}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=b.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==j&&p?t.getElementsByClassName(e):undefined},d=[],h=[],(b.qsa=it(t.querySelectorAll))&&(at(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+R+"*(?:value|"+P+")"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){var t=c.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&h.push("[*^$]="+R+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(b.matchesSelector=it(g=f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){b.disconnectedMatch=g.call(e,"div"),g.call(e,"[s!='']:x"),d.push("!=",B)}),h=h.length&&RegExp(h.join("|")),d=d.length&&RegExp(d.join("|")),m=it(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},S=f.compareDocumentPosition?function(e,n){if(e===n)return E=!0,0;var r=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);return r?1&r||!b.sortDetached&&n.compareDocumentPosition(e)===r?e===t||m(v,e)?-1:n===t||m(v,n)?1:u?F.call(u,e)-F.call(u,n):0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],l=[n];if(e===n)return E=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:u?F.call(u,e)-F.call(u,n):0;if(o===s)return lt(e,n);r=e;while(r=r.parentNode)a.unshift(r);r=n;while(r=r.parentNode)l.unshift(r);while(a[i]===l[i])i++;return i?lt(a[i],l[i]):a[i]===v?-1:l[i]===v?1:0},c):c},ut.matches=function(e,t){return ut(e,null,null,t)},ut.matchesSelector=function(e,t){if((e.ownerDocument||e)!==c&&l(e),t=t.replace(U,"='$1']"),!(!b.matchesSelector||!p||d&&d.test(t)||h&&h.test(t)))try{var n=g.call(e,t);if(n||b.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return ut(t,c,null,[e]).length>0},ut.contains=function(e,t){return(e.ownerDocument||e)!==c&&l(e),m(e,t)},ut.attr=function(e,t){(e.ownerDocument||e)!==c&&l(e);var n=r.attrHandle[t.toLowerCase()],i=n&&n(e,t,!p);return i===undefined?b.attributes||!p?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null:i},ut.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ut.uniqueSort=function(e){var t,n=[],r=0,i=0;if(E=!b.detectDuplicates,u=!b.sortStable&&e.slice(0),e.sort(S),E){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return e};function lt(e,t){var n=t&&e,r=n&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ct(e,t,n){var r;return n?undefined:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}function ft(e,t,n){var r;return n?undefined:r=e.getAttribute(t,"type"===t.toLowerCase()?1:2)}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function dt(e){return st(function(t){return t=+t,st(function(n,r){var i,o=e([],n.length,t),s=o.length;while(s--)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}i=ut.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r];r++)n+=i(t);return n},r=ut.selectors={cacheLength:50,createPseudo:st,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(tt,nt),e[3]=(e[4]||e[5]||"").replace(tt,nt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ut.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ut.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return G.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&Y.test(n)&&(t=gt(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(tt,nt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=RegExp("(^|"+R+")"+e+"("+R+"|$)"))&&C(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ut.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,h,d,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,v=a&&t.nodeName.toLowerCase(),x=!u&&!a;if(m){if(o){while(g){f=t;while(f=f[g])if(a?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&x){c=m[y]||(m[y]={}),l=c[e]||[],h=l[0]===w&&l[1],p=l[0]===w&&l[2],f=h&&m.childNodes[h];while(f=++h&&f&&f[g]||(p=h=0)||d.pop())if(1===f.nodeType&&++p&&f===t){c[e]=[w,h,p];break}}else if(x&&(l=(t[y]||(t[y]={}))[e])&&l[0]===w)p=l[1];else while(f=++h&&f&&f[g]||(p=h=0)||d.pop())if((a?f.nodeName.toLowerCase()===v:1===f.nodeType)&&++p&&(x&&((f[y]||(f[y]={}))[e]=[w,p]),f===t))break;return p-=i,p===r||0===p%r&&p/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ut.error("unsupported pseudo: "+e);return i[y]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?st(function(e,n){var r,o=i(e,t),s=o.length;while(s--)r=F.call(e,o[s]),e[r]=!(n[r]=o[s])}):function(e){return i(e,0,n)}):i}},pseudos:{not:st(function(e){var t=[],n=[],r=s(e.replace(I,"$1"));return r[y]?st(function(e,t,n,i){var o,s=r(e,null,i,[]),a=e.length;while(a--)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:st(function(e){return function(t){return ut(e,t).length>0}}),contains:st(function(e){return function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:st(function(e){return V.test(e||"")||ut.error("unsupported lang: "+e),e=e.replace(tt,nt).toLowerCase(),function(t){var n;do if(n=p?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===c.activeElement&&(!c.hasFocus||c.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Z.test(e.nodeName)},input:function(e){return K.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:dt(function(){return[0]}),last:dt(function(e,t){return[t-1]}),eq:dt(function(e,t,n){return[0>n?n+t:n]}),even:dt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:dt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:dt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:dt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=pt(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=ht(t);function gt(e,t){var n,i,o,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);a=e,u=[],l=r.preFilter;while(a){(!n||(i=z.exec(a)))&&(i&&(a=a.slice(i[0].length)||a),u.push(o=[])),n=!1,(i=_.exec(a))&&(n=i.shift(),o.push({value:n,type:i[0].replace(I," ")}),a=a.slice(n.length));for(s in r.filter)!(i=G[s].exec(a))||l[s]&&!(i=l[s](i))||(n=i.shift(),o.push({value:n,type:s,matches:i}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ut.error(e):k(e,u).slice(0)}function mt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,r){var i=t.dir,o=r&&"parentNode"===i,s=T++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,r,a){var u,l,c,f=w+" "+s;if(a){while(t=t[i])if((1===t.nodeType||o)&&e(t,r,a))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[y]||(t[y]={}),(l=c[i])&&l[0]===f){if((u=l[1])===!0||u===n)return u===!0}else if(l=c[i]=[f],l[1]=e(t,r,a)||n,l[1]===!0)return!0}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,s=[],a=0,u=e.length,l=null!=t;for(;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function bt(e,t,n,r,i,o){return r&&!r[y]&&(r=bt(r)),i&&!i[y]&&(i=bt(i,o)),st(function(o,s,a,u){var l,c,f,p=[],h=[],d=s.length,g=o||Ct(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xt(g,p,e,a,u),y=n?i||(o?e:d||r)?[]:s:m;if(n&&n(m,y,a,u),r){l=xt(y,h),r(l,[],a,u),c=l.length;while(c--)(f=l[c])&&(y[h[c]]=!(m[h[c]]=f))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(f=y[c])&&l.push(m[c]=f);i(null,y=[],l,u)}c=y.length;while(c--)(f=y[c])&&(l=i?F.call(o,f):p[c])>-1&&(o[l]=!(s[l]=f))}}else y=xt(y===s?y.splice(d,y.length):y),i?i(null,s,y,u):H.apply(s,y)})}function wt(e){var t,n,i,o=e.length,s=r.relative[e[0].type],u=s||r.relative[" "],l=s?1:0,c=yt(function(e){return e===t},u,!0),f=yt(function(e){return F.call(t,e)>-1},u,!0),p=[function(e,n,r){return!s&&(r||n!==a)||((t=n).nodeType?c(e,n,r):f(e,n,r))}];for(;o>l;l++)if(n=r.relative[e[l].type])p=[yt(vt(p),n)];else{if(n=r.filter[e[l].type].apply(null,e[l].matches),n[y]){for(i=++l;o>i;i++)if(r.relative[e[i].type])break;return bt(l>1&&vt(p),l>1&&mt(e.slice(0,l-1)).replace(I,"$1"),n,i>l&&wt(e.slice(l,i)),o>i&&wt(e=e.slice(i)),o>i&&mt(e))}p.push(n)}return vt(p)}function Tt(e,t){var i=0,o=t.length>0,s=e.length>0,u=function(u,l,f,p,h){var d,g,m,y=[],v=0,x="0",b=u&&[],T=null!=h,C=a,k=u||s&&r.find.TAG("*",h&&l.parentNode||l),N=w+=null==C?1:Math.random()||.1;for(T&&(a=l!==c&&l,n=i);null!=(d=k[x]);x++){if(s&&d){g=0;while(m=e[g++])if(m(d,l,f)){p.push(d);break}T&&(w=N,n=++i)}o&&((d=!m&&d)&&v--,u&&b.push(d))}if(v+=x,o&&x!==v){g=0;while(m=t[g++])m(b,y,l,f);if(u){if(v>0)while(x--)b[x]||y[x]||(y[x]=L.call(p));y=xt(y)}H.apply(p,y),T&&!u&&y.length>0&&v+t.length>1&&ut.uniqueSort(p)}return T&&(w=N,a=C),b};return o?st(u):u}s=ut.compile=function(e,t){var n,r=[],i=[],o=N[e+" "];if(!o){t||(t=gt(e)),n=t.length;while(n--)o=wt(t[n]),o[y]?r.push(o):i.push(o);o=N(e,Tt(i,r))}return o};function Ct(e,t,n){var r=0,i=t.length;for(;i>r;r++)ut(e,t[r],n);return n}function kt(e,t,n,i){var o,a,u,l,c,f=gt(e);if(!i&&1===f.length){if(a=f[0]=f[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&p&&r.relative[a[1].type]){if(t=(r.find.ID(u.matches[0].replace(tt,nt),t)||[])[0],!t)return n;e=e.slice(a.shift().value.length)}o=G.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],r.relative[l=u.type])break;if((c=r.find[l])&&(i=c(u.matches[0].replace(tt,nt),X.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=i.length&&mt(a),!e)return H.apply(n,i),n;break}}}return s(e,f)(i,t,!p,n,X.test(e)),n}r.pseudos.nth=r.pseudos.eq;function Nt(){}Nt.prototype=r.filters=r.pseudos,r.setFilters=new Nt,b.sortStable=y.split("").sort(S).join("")===y,l(),[0,0].sort(S),b.detectDuplicates=E,at(function(e){if(e.innerHTML="","#"!==e.firstChild.getAttribute("href")){var t="type|href|height|width".split("|"),n=t.length;while(n--)r.attrHandle[t[n]]=ft}}),at(function(e){if(null!=e.getAttribute("disabled")){var t=P.split("|"),n=t.length;while(n--)r.attrHandle[t[n]]=ct}}),x.find=ut,x.expr=ut.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ut.uniqueSort,x.text=ut.getText,x.isXMLDoc=ut.isXML,x.contains=ut.contains}(e);var D={};function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,o,s,a=[],u=!e.once&&[],l=function(f){for(t=e.memory&&f,n=!0,s=i||0,i=0,o=a.length,r=!0;a&&o>s;s++)if(a[s].apply(f[0],f[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,a&&(u?u.length&&l(u.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var n=a.length;(function s(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&c.has(n)||a.push(n):n&&n.length&&"string"!==r&&s(n)})})(arguments),r?o=a.length:t&&(i=n,l(t))}return this},remove:function(){return a&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,a,n))>-1)a.splice(n,1),r&&(o>=n&&o--,s>=n&&s--)}),this},has:function(e){return e?x.inArray(e,a)>-1:!(!a||!a.length)},empty:function(){return a=[],o=0,this},disable:function(){return a=u=t=undefined,this},disabled:function(){return!a},lock:function(){return u=undefined,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!a||n&&!u||(r?u.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var s=o[0],a=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),s=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},a,u,l;if(r>1)for(a=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),a=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=a.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",a=o.getElementsByTagName("body")[0];a&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(x.isEmptyObject(o))this.cache[i]=t;else for(r in t)o[r]=t[r]},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){return t===undefined||t&&"string"==typeof t&&n===undefined?this.get(e,t):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i=this.key(e),o=this.cache[i];if(t===undefined)this.cache[i]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):t in o?r=[t]:(r=x.camelCase(t),r=r in o?[r]:r.match(w)||[]),n=r.length;while(n--)delete o[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){delete this.cache[this.key(e)]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],o=0,s=null;if(e===undefined){if(this.length&&(s=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=x.camelCase(r.substring(5)),P(i,r,s[r]));q.set(i,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),s=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t); -x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(s--)n=q.get(o[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var R,M,W=/[\t\r\n]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,i="boolean"==typeof t;return x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,s=0,a=x(this),u=t,l=e.match(w)||[];while(o=l[s++])u=i?u:!a.hasClass(o),a[u?"addClass":"removeClass"](o)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i,o=x(this);1===this.nodeType&&(i=r?e.call(this,n,o.val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,s=o?null:[],a=o?i+1:r.length,u=0>i?a:o?i:0;for(;a>u;u++)if(n=r[u],!(!n.selected&&u!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),s=i.length;while(s--)r=i[s],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,t,n){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===r?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.boolean.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=x.find.attr(e,t),null==o?undefined:o):null!==n?i&&"set"in i&&(o=i.set(e,n,t))!==undefined?o:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.boolean.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!x.isXMLDoc(e),o&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.boolean.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],o=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,o}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}x.event={global:{},add:function(e,t,n,i,o){var s,a,u,l,c,f,p,h,d,g,m,y=q.get(e);if(y){n.handler&&(s=n,n=s.handler,o=s.selector),n.guid||(n.guid=x.guid++),(l=y.events)||(l=y.events={}),(a=y.handle)||(a=y.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(a.elem,arguments)},a.elem=e),t=(t||"").match(w)||[""],c=t.length;while(c--)u=X.exec(t[c])||[],d=m=u[1],g=(u[2]||"").split(".").sort(),d&&(p=x.event.special[d]||{},d=(o?p.delegateType:p.bindType)||d,p=x.event.special[d]||{},f=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&x.expr.match.needsContext.test(o),namespace:g.join(".")},s),(h=l[d])||(h=l[d]=[],h.delegateCount=0,p.setup&&p.setup.call(e,i,g,a)!==!1||e.addEventListener&&e.addEventListener(d,a,!1)),p.add&&(p.add.call(e,f),f.handler.guid||(f.handler.guid=n.guid)),o?h.splice(h.delegateCount++,0,f):h.push(f),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,h,d,g,m=q.hasData(e)&&q.get(e);if(m&&(u=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(a=X.exec(t[l])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){f=x.event.special[h]||{},h=(r?f.delegateType:f.bindType)||h,p=u[h]||[],a=a[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&f.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)x.event.remove(e,h+t[l],n,r,!0);x.isEmptyObject(u)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,a,u,l,c,f,p,h=[r||o],d=y.call(t,"type")?t.type:t,g=y.call(t,"namespace")?t.namespace.split("."):[];if(a=u=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(g=d.split("."),d=g.shift(),g.sort()),c=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),p=x.event.special[d]||{},i||!p.trigger||p.trigger.apply(r,n)!==!1)){if(!i&&!p.noBubble&&!x.isWindow(r)){for(l=p.delegateType||d,_.test(l+d)||(a=a.parentNode);a;a=a.parentNode)h.push(a),u=a;u===(r.ownerDocument||o)&&h.push(u.defaultView||u.parentWindow||e)}s=0;while((a=h[s++])&&!t.isPropagationStopped())t.type=s>1?l:p.bindType||d,f=(q.get(a,"events")||{})[t.type]&&q.get(a,"handle"),f&&f.apply(a,n),f=c&&a[c],f&&x.acceptData(a)&&f.apply&&f.apply(a,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||p._default&&p._default.apply(h.pop(),n)!==!1||!x.acceptData(r)||c&&x.isFunction(r[d])&&!x.isWindow(r)&&(u=r[c],u&&(r[c]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,u&&(r[c]=u)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,o,s=[],a=d.call(arguments),u=(q.get(this,"events")||{})[e.type]||[],l=x.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),t=0;while((i=s[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((x.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;a>n;n++)o=t[n],i=o.selector+" ",r[i]===undefined&&(r[i]=o.needsContext?x(i,this).index(u)>=0:x.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return t.length>a&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return 3===e.target.nodeType&&(e.target=e.target.parentNode),s.filter?s.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=x.expr.match.needsContext,Q={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return t=this,this.pushStack(x(e).filter(function(){for(r=0;i>r;r++)if(x.contains(t[r],this))return!0}));for(n=[],r=0;i>r;r++)x.find(e,this[r],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(Z(this,e||[],!0))},filter:function(e){return this.pushStack(Z(this,e||[],!1))},is:function(e){return!!e&&("string"==typeof e?J.test(e)?x(e,this.context).index(this[0])>=0:x.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],s=J.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(s?s.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function K(e,t){while((e=e[t])&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return K(e,"nextSibling")},prev:function(e){return K(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(Q[e]||x.unique(i),"p"===e[0]&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function Z(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}var et=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,tt=/<([\w:]+)/,nt=/<|&#?\w+;/,rt=/<(?:script|style|link)/i,it=/^(?:checkbox|radio)$/i,ot=/checked\s*(?:[^=]|=\s*.checked.)/i,st=/^$|\/(?:java|ecma)script/i,at=/^true\/(.*)/,ut=/^\s*\s*$/g,lt={option:[1,""],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};lt.optgroup=lt.option,lt.tbody=lt.tfoot=lt.colgroup=lt.caption=lt.col=lt.thead,lt.th=lt.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===undefined?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=ct(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=ct(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(gt(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&ht(gt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(gt(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!rt.test(e)&&!lt[(tt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(et,"<$1>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(x.cleanData(gt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=p.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,f=this,h=c-1,d=e[0],g=x.isFunction(d);if(g||!(1>=c||"string"!=typeof d||x.support.checkClone)&&ot.test(d))return this.each(function(r){var i=f.eq(r);g&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(r=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),i=r.firstChild,1===r.childNodes.length&&(r=i),i)){for(o=x.map(gt(r,"script"),ft),s=o.length;c>l;l++)a=r,l!==h&&(a=x.clone(a,!0,!0),s&&x.merge(o,gt(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,x.map(o,pt),l=0;s>l;l++)a=o[l],st.test(a.type||"")&&!q.access(a,"globalEval")&&x.contains(u,a)&&(a.src?x._evalUrl(a.src):x.globalEval(a.textContent.replace(ut,"")))}return this}}),x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=[],i=x(e),o=i.length-1,s=0;for(;o>=s;s++)n=s===o?this:this.clone(!0),x(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}}),x.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=x.contains(e.ownerDocument,e);if(!(x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(s=gt(a),o=gt(e),r=0,i=o.length;i>r;r++)mt(o[r],s[r]);if(t)if(n)for(o=o||gt(e),s=s||gt(a),r=0,i=o.length;i>r;r++)dt(o[r],s[r]);else dt(e,a);return s=gt(a,"script"),s.length>0&&ht(s,!u&>(e,"script")),a},buildFragment:function(e,t,n,r){var i,o,s,a,u,l,c=0,f=e.length,p=t.createDocumentFragment(),h=[];for(;f>c;c++)if(i=e[c],i||0===i)if("object"===x.type(i))x.merge(h,i.nodeType?[i]:i);else if(nt.test(i)){o=o||p.appendChild(t.createElement("div")),s=(tt.exec(i)||["",""])[1].toLowerCase(),a=lt[s]||lt._default,o.innerHTML=a[1]+i.replace(et,"<$1>")+a[2],l=a[0];while(l--)o=o.firstChild;x.merge(h,o.childNodes),o=p.firstChild,o.textContent=""}else h.push(t.createTextNode(i));p.textContent="",c=0;while(i=h[c++])if((!r||-1===x.inArray(i,r))&&(u=x.contains(i.ownerDocument,i),o=gt(p.appendChild(i),"script"),u&&ht(o),n)){l=0;while(i=o[l++])st.test(i.type||"")&&n.push(i)}return p},cleanData:function(e){var t,n,r,i=e.length,o=0,s=x.event.special;for(;i>o;o++){if(n=e[o],x.acceptData(n)&&(t=q.access(n)))for(r in t.events)s[r]?x.event.remove(n,r):x.removeEvent(n,r,t.handle);L.discard(n),q.discard(n)}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"text",async:!1,global:!1,success:x.globalEval})}});function ct(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function pt(e){var t=at.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function ht(e,t){var n=e.length,r=0;for(;n>r;r++)q.set(e[r],"globalEval",!t||q.get(t[r],"globalEval"))}function dt(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(q.hasData(e)&&(o=q.access(e),s=x.extend({},o),l=o.events,q.set(t,s),l)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)x.event.add(t,i,l[i][n])}L.hasData(e)&&(a=L.access(e),u=x.extend({},a),L.set(t,u))}}function gt(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x.nodeName(e,t)?x.merge([e],n):n}function mt(e,t){var n=t.nodeName.toLowerCase();"input"===n&&it.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}x.fn.extend({wrapAll:function(e){var t;return x.isFunction(e)?this.each(function(t){x(this).wrapAll(e.call(this,t))}):(this[0]&&(t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var yt,vt,xt=/^(none|table(?!-c[ea]).+)/,bt=/^margin/,wt=RegExp("^("+b+")(.*)$","i"),Tt=RegExp("^("+b+")(?!px)[a-z%]+$","i"),Ct=RegExp("^([+-])=("+b+")","i"),kt={BODY:"block"},Nt={position:"absolute",visibility:"hidden",display:"block"},Et={letterSpacing:0,fontWeight:400},St=["Top","Right","Bottom","Left"],jt=["Webkit","O","Moz","ms"];function Dt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=jt.length;while(i--)if(t=jt[i]+n,t in e)return t;return r}function At(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function Lt(t){return e.getComputedStyle(t,null)}function qt(e,t){var n,r,i,o=[],s=0,a=e.length;for(;a>s;s++)r=e[s],r.style&&(o[s]=q.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&At(r)&&(o[s]=q.access(r,"olddisplay",Pt(r.nodeName)))):o[s]||(i=At(r),(n&&"none"!==n||!i)&&q.set(r,"olddisplay",i?n:x.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}x.fn.extend({css:function(e,t){return x.access(this,function(e,t,n){var r,i,o={},s=0;if(x.isArray(t)){for(r=Lt(e),i=t.length;i>s;s++)o[t[s]]=x.css(e,t[s],!1,r);return o}return n!==undefined?x.style(e,t,n):x.css(e,t)},e,t,arguments.length>1)},show:function(){return qt(this,!0)},hide:function(){return qt(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:At(this))?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=yt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=x.camelCase(t),u=e.style;return t=x.cssProps[a]||(x.cssProps[a]=Dt(u,a)),s=x.cssHooks[t]||x.cssHooks[a],n===undefined?s&&"get"in s&&(i=s.get(e,!1,r))!==undefined?i:u[t]:(o=typeof n,"string"===o&&(i=Ct.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(x.css(e,t)),o="number"),null==n||"number"===o&&isNaN(n)||("number"!==o||x.cssNumber[a]||(n+="px"),x.support.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&(n=s.set(e,n,r))===undefined||(u[t]=n)),undefined)}},css:function(e,t,n,r){var i,o,s,a=x.camelCase(t);return t=x.cssProps[a]||(x.cssProps[a]=Dt(e.style,a)),s=x.cssHooks[t]||x.cssHooks[a],s&&"get"in s&&(i=s.get(e,!0,n)),i===undefined&&(i=yt(e,t,r)),"normal"===i&&t in Et&&(i=Et[t]),""===n||n?(o=parseFloat(i),n===!0||x.isNumeric(o)?o||0:i):i}}),yt=function(e,t,n){var r,i,o,s=n||Lt(e),a=s?s.getPropertyValue(t)||s[t]:undefined,u=e.style;return s&&(""!==a||x.contains(e.ownerDocument,e)||(a=x.style(e,t)),Tt.test(a)&&bt.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=s.width,u.width=r,u.minWidth=i,u.maxWidth=o)),a};function Ht(e,t,n){var r=wt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Ot(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;for(;4>o;o+=2)"margin"===n&&(s+=x.css(e,n+St[o],!0,i)),r?("content"===n&&(s-=x.css(e,"padding"+St[o],!0,i)),"margin"!==n&&(s-=x.css(e,"border"+St[o]+"Width",!0,i))):(s+=x.css(e,"padding"+St[o],!0,i),"padding"!==n&&(s+=x.css(e,"border"+St[o]+"Width",!0,i)));return s}function Ft(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Lt(e),s=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=yt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Tt.test(i))return i;r=s&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+Ot(e,t,n||(s?"border":"content"),r,o)+"px"}function Pt(e){var t=o,n=kt[e];return n||(n=Rt(e,t),"none"!==n&&n||(vt=(vt||x("