Template:SJTU-Software/amazeuiMinJS

/*! Amaze UI v2.4.2 | by Amaze UI Team | (c) 2015 AllMobilize, Inc. | Licensed under MIT | 2015-07-06T10:25:45+0800 */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.AMUI = f()}})(function(){var define,module,exports;return (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<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ 'use strict';

var $ = (window.jQuery); var UI = _dereq_(2); _dereq_(30); _dereq_(3); _dereq_(4); _dereq_(5); _dereq_(6); _dereq_(7); _dereq_(8); _dereq_(9); _dereq_(10); _dereq_(11); _dereq_(12); _dereq_(13); _dereq_(14); _dereq_(15); _dereq_(16); _dereq_(17); _dereq_(18); _dereq_(19); _dereq_(20); _dereq_(21); _dereq_(22); _dereq_(23); _dereq_(24); _dereq_(25); _dereq_(26); _dereq_(27); _dereq_(28); _dereq_(29); _dereq_(31); _dereq_(32); _dereq_(33); _dereq_(34); _dereq_(35); _dereq_(36); _dereq_(37); _dereq_(38); _dereq_(39); _dereq_(40); _dereq_(41); _dereq_(42); _dereq_(43); _dereq_(44); _dereq_(45); _dereq_(46); _dereq_(47); _dereq_(48); _dereq_(49); _dereq_(50); _dereq_(51); _dereq_(52);

module.exports = $.AMUI = UI;

},{"10":10,"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"2":2,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"26":26,"27":27,"28":28,"29":29,"3":3,"30":30,"31":31,"32":32,"33":33,"34":34,"35":35,"36":36,"37":37,"38":38,"39":39,"4":4,"40":40,"41":41,"42":42,"43":43,"44":44,"45":45,"46":46,"47":47,"48":48,"49":49,"5":5,"50":50,"51":51,"52":52,"6":6,"7":7,"8":8,"9":9}],2:[function(_dereq_,module,exports){ 'use strict';

/* jshint -W040 */

var $ = (window.jQuery);

if (typeof $ === 'undefined') {

 throw new Error('Amaze UI 2.x requires jQuery :-(\n' +
 '\u7231\u4e0a\u4e00\u5339\u91ce\u9a6c\uff0c\u53ef\u4f60' +
 '\u7684\u5bb6\u91cc\u6ca1\u6709\u8349\u539f\u2026');

}

var UI = $.AMUI || {}; var $win = $(window); var doc = window.document; var $html = $('html');

UI.VERSION = '2.4.2';

UI.support = {};

UI.support.transition = (function() {

 var transitionEnd = (function() {
   // https://developer.mozilla.org/en-US/docs/Web/Events/transitionend#Browser_compatibility
   var element = doc.body || doc.documentElement;
   var transEndEventNames = {
     WebkitTransition: 'webkitTransitionEnd',
     MozTransition: 'transitionend',
     OTransition: 'oTransitionEnd otransitionend',
     transition: 'transitionend'
   };
   for (var name in transEndEventNames) {
     if (element.style[name] !== undefined) {
       return transEndEventNames[name];
     }
   }
 })();
 return transitionEnd && {end: transitionEnd};

})();

UI.support.animation = (function() {

 var animationEnd = (function() {
   var element = doc.body || doc.documentElement;
   var animEndEventNames = {
     WebkitAnimation: 'webkitAnimationEnd',
     MozAnimation: 'animationend',
     OAnimation: 'oAnimationEnd oanimationend',
     animation: 'animationend'
   };
   for (var name in animEndEventNames) {
     if (element.style[name] !== undefined) {
       return animEndEventNames[name];
     }
   }
 })();
 return animationEnd && {end: animationEnd};

})();

/* jshint -W069 */ UI.support.touch = ( ('ontouchstart' in window && navigator.userAgent.toLowerCase().match(/mobile|tablet/)) || (window.DocumentTouch && document instanceof window.DocumentTouch) || (window.navigator['msPointerEnabled'] && window.navigator['msMaxTouchPoints'] > 0) || //IE 10 (window.navigator['pointerEnabled'] && window.navigator['maxTouchPoints'] > 0) || //IE >=11 false);

// https://developer.mozilla.org/zh-CN/docs/DOM/MutationObserver UI.support.mutationobserver = (window.MutationObserver || window.WebKitMutationObserver || null);

// https://github.com/Modernizr/Modernizr/blob/924c7611c170ef2dc502582e5079507aff61e388/feature-detects/forms/validation.js#L20 UI.support.formValidation = (typeof document.createElement('form').

 checkValidity === 'function');

UI.utils = {};

/**

* Debounce function
* @param {function} func  Function to be debounced
* @param {number} wait Function execution threshold in milliseconds
* @param {bool} immediate  Whether the function should be called at
*                          the beginning of the delay instead of the
*                          end. Default is false.
* @desc Executes a function when it stops being invoked for n seconds
* @via  _.debounce() http://underscorejs.org
*/

UI.utils.debounce = function(func, wait, immediate) {

 var timeout;
 return function() {
   var context = this;
   var args = arguments;
   var later = function() {
     timeout = null;
     if (!immediate) {
       func.apply(context, args);
     }
   };
   var callNow = immediate && !timeout;
   clearTimeout(timeout);
   timeout = setTimeout(later, wait);
   if (callNow) {
     func.apply(context, args);
   }
 };

};

UI.utils.isInView = function(element, options) {

 var $element = $(element);
 var visible = !!($element.width() || $element.height()) &&
   $element.css('display') !== 'none';
 if (!visible) {
   return false;
 }
 var windowLeft = $win.scrollLeft();
 var windowTop = $win.scrollTop();
 var offset = $element.offset();
 var left = offset.left;
 var top = offset.top;
 options = $.extend({topOffset: 0, leftOffset: 0}, options);
 return (top + $element.height() >= windowTop &&
 top - options.topOffset <= windowTop + $win.height() &&
 left + $element.width() >= windowLeft &&
 left - options.leftOffset <= windowLeft + $win.width());

};

/* jshint -W054 */ UI.utils.parseOptions = UI.utils.options = function(string) {

 if ($.isPlainObject(string)) {
   return string;
 }
 var start = (string ? string.indexOf('{') : -1);
 var options = {};
 if (start != -1) {
   try {
     options = (new Function(,
       'var json = ' + string.substr(start) +
       '; return JSON.parse(JSON.stringify(json));'))();
   } catch (e) {
   }
 }
 return options;

};

/* jshint +W054 */

UI.utils.generateGUID = function(namespace) {

 var uid = namespace + '-' || 'am-';
 do {
   uid += Math.random().toString(36).substring(2, 7);
 } while (document.getElementById(uid));
 return uid;

};

/**

* Plugin AMUI Component to jQuery
*
* @param {String} name - plugin name
* @param {Function} Component - plugin constructor
* @param {Object} [pluginOption]
* @param {String} pluginOption.dataOptions
* @param {Function} pluginOption.methodCall - custom method call
* @param {Function} pluginOption.before
* @param {Function} pluginOption.after
* @since v2.4.1
*/

UI.plugin = function UIPlugin(name, Component, pluginOption) {

 var old = $.fn[name];
 pluginOption = pluginOption || {};
 $.fn[name] = function(option) {
   var allArgs = Array.prototype.slice.call(arguments, 0);
   var args = allArgs.slice(1);
   var propReturn;
   var $set = this.each(function() {
     var $this = $(this);
     var dataName = 'amui.' + name;
     var dataOptionsName = pluginOption.dataOptions || ('data-am-' + name);
     var instance = $this.data(dataName);
     var options = $.extend({},
       UI.utils.parseOptions($this.attr(dataOptionsName)),
       typeof option === 'object' && option);
     if (!instance && option === 'destroy') {
       return;
     }
     if (!instance) {
       $this.data(dataName, (instance = new Component(this, options)));
     }
     // custom method call
     if (pluginOption.methodCall) {
       pluginOption.methodCall.call($this, allArgs, instance);
     } else {
       // before method call
       pluginOption.before &&
       pluginOption.before.call($this, allArgs, instance);
       if (typeof option === 'string') {
         propReturn = typeof instance[option] === 'function' ?
           instance[option].apply(instance, args) : instance[option];
       }
       // after method call
       pluginOption.after && pluginOption.after.call($this, allArgs, instance);
     }
   });
   return (propReturn === undefined) ? $set : propReturn;
 };
 $.fn[name].Constructor = Component;
 // no conflict
 $.fn[name].noConflict = function() {
   $.fn[name] = old;
   console.log(this);
   return this;
 };
 UI[name] = Component;

};

// http://blog.alexmaccaw.com/css-transitions $.fn.emulateTransitionEnd = function(duration) {

 var called = false;
 var $el = this;
 $(this).one(UI.support.transition.end, function() {
   called = true;
 });
 var callback = function() {
   if (!called) {
     $($el).trigger(UI.support.transition.end);
   }
   $el.transitionEndTimmer = undefined;
 };
 this.transitionEndTimmer = setTimeout(callback, duration);
 return this;

};

$.fn.redraw = function() {

 return this.each(function() {
   /* jshint unused:false */
   var redraw = this.offsetHeight;
 });

};

/* jshint unused:true */

$.fn.transitionEnd = function(callback) {

 var endEvent = UI.support.transition.end;
 var dom = this;
 function fireCallBack(e) {
   callback.call(this, e);
   endEvent && dom.off(endEvent, fireCallBack);
 }
 if (callback && endEvent) {
   dom.on(endEvent, fireCallBack);
 }
 return this;

};

$.fn.removeClassRegEx = function() {

 return this.each(function(regex) {
   var classes = $(this).attr('class');
   if (!classes || !regex) {
     return false;
   }
   var classArray = [];
   classes = classes.split(' ');
   for (var i = 0, len = classes.length; i < len; i++) {
     if (!classes[i].match(regex)) {
       classArray.push(classes[i]);
     }
   }
   $(this).attr('class', classArray.join(' '));
 });

};

// $.fn.alterClass = function(removals, additions) {

 var self = this;
 if (removals.indexOf('*') === -1) {
   // Use native jQuery methods if there is no wildcard matching
   self.removeClass(removals);
   return !additions ? self : self.addClass(additions);
 }
 var classPattern = new RegExp('\\s' +
 removals.
   replace(/\*/g, '[A-Za-z0-9-_]+').
   split(' ').
   join('\\s|\\s') +
 '\\s', 'g');
 self.each(function(i, it) {
   var cn = ' ' + it.className + ' ';
   while (classPattern.test(cn)) {
     cn = cn.replace(classPattern, ' ');
   }
   it.className = $.trim(cn);
 });
 return !additions ? self : self.addClass(additions);

};

// handle multiple browsers for requestAnimationFrame() // http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ // https://github.com/gnarf/jquery-requestAnimationFrame UI.utils.rAF = (function() {

 return window.requestAnimationFrame ||
   window.webkitRequestAnimationFrame ||
   window.mozRequestAnimationFrame ||
   window.oRequestAnimationFrame ||
     // if all else fails, use setTimeout
   function(callback) {
     return window.setTimeout(callback, 1000 / 60); // shoot for 60 fps
   };

})();

// handle multiple browsers for cancelAnimationFrame() UI.utils.cancelAF = (function() {

 return window.cancelAnimationFrame ||
   window.webkitCancelAnimationFrame ||
   window.mozCancelAnimationFrame ||
   window.oCancelAnimationFrame ||
   function(id) {
     window.clearTimeout(id);
   };

})();

// via http://davidwalsh.name/detect-scrollbar-width UI.utils.measureScrollbar = function() {

 if (document.body.clientWidth >= window.innerWidth) {
   return 0;
 }
 // if ($html.width() >= window.innerWidth) return;
 // var scrollbarWidth = window.innerWidth - $html.width();
var $measure = $('
');
 $(document.body).append($measure);
 var scrollbarWidth = $measure[0].offsetWidth - $measure[0].clientWidth;
 $measure.remove();
 return scrollbarWidth;

};

UI.utils.imageLoader = function($image, callback) {

 function loaded() {
   callback($image[0]);
 }
 function bindLoad() {
   this.one('load', loaded);
   if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
     var src = this.attr('src');
     var param = src.match(/\?/) ? '&' : '?';
     param += 'random=' + (new Date()).getTime();
     this.attr('src', src + param);
   }
 }
 if (!$image.attr('src')) {
   loaded();
   return;
 }
 if ($image[0].complete || $image[0].readyState === 4) {
   loaded();
 } else {
   bindLoad.call($image);
 }

};

/**

* https://github.com/cho45/micro-template.js
* (c) cho45 http://cho45.github.com/mit-license
*/

/* jshint -W109 */ UI.template = function(id, data) {

 var me = UI.template;
 if (!me.cache[id]) {
   me.cache[id] = (function() {
     var name = id;
     var string = /^[\w\-]+$/.test(id) ?
       me.get(id) : (name = 'template(string)', id); // no warnings
     var line = 1;
     var body = ('try { ' + (me.variable ?
     'var ' + me.variable + ' = this.stash;' : 'with (this.stash) { ') +
     "this.ret += '" +
     string.
       replace(/<%/g, '\x11').replace(/%>/g, '\x13'). // if you want other tag, just edit this line
       replace(/'(?![^\x11\x13]+?\x13)/g, '\\x27').
       replace(/^\s*|\s*$/g, ).
       replace(/\n/g, function() {
         return "';\nthis.line = " + (++line) + "; this.ret += '\\n";
       }).
       replace(/\x11-(.+?)\x13/g, "' + ($1) + '").
       replace(/\x11=(.+?)\x13/g, "' + this.escapeHTML($1) + '").
       replace(/\x11(.+?)\x13/g, "'; $1; this.ret += '") +
     "'; " + (me.variable ? "" : "}") + "return this.ret;" +
     "} catch (e) { throw 'TemplateError: ' + e + ' (on " + name +
     "' + ' line ' + this.line + ')'; } " +
     "//@ sourceURL=" + name + "\n" // source map
     ).replace(/this\.ret \+= ;/g, );
     /* jshint -W054 */
     var func = new Function(body);
     var map = {
       '&': '&',
       '<': '<',
       '>': '>',
       '\x22': '"',
       '\x27': '''
     };
     var escapeHTML = function(string) {
       return ( + string).replace(/[&<>\'\"]/g, function(_) {
         return map[_];
       });
     };
     return function(stash) {
       return func.call(me.context = {
         escapeHTML: escapeHTML,
         line: 1,
         ret: ,
         stash: stash
       });
     };
   })();
 }
 return data ? me.cache[id](data) : me.cache[id];

}; /* jshint +W109 */ /* jshint +W054 */

UI.template.cache = {};

UI.template.get = function(id) {

 if (id) {
   var element = document.getElementById(id);
   return element && element.innerHTML || ;
 }

};

// Dom mutation watchers UI.DOMWatchers = []; UI.DOMReady = false; UI.ready = function(callback) {

 UI.DOMWatchers.push(callback);
 if (UI.DOMReady) {
   // console.log('Ready call');
   callback(document);
 }

};

UI.DOMObserve = function(elements, options, callback) {

 var Observer = UI.support.mutationobserver;
 if (!Observer) {
   return;
 }
 options = $.isPlainObject(options) ?
   options : {childList: true, subtree: true};
 callback = typeof callback === 'function' && callback || function() {
 };
 $(elements).each(function() {
   var element = this;
   var $element = $(element);
   if ($element.data('am.observer')) {
     return;
   }
   try {
     var observer = new Observer(UI.utils.debounce(
       function(mutations, instance) {
       callback.call(element, mutations, instance);
       // trigger this event manually if MutationObserver not supported
       $element.trigger('changed.dom.amui');
     }, 50));
     observer.observe(element, options);
     $element.data('am.observer', observer);
   } catch (e) {
   }
 });

};

$.fn.DOMObserve = function(options, callback) {

 return this.each(function() {
   UI.DOMObserve(this, options, callback);
 });

};

if (UI.support.touch) {

 $html.addClass('am-touch');

}

$(document).on('changed.dom.amui', function(e) {

 var element = e.target;
 // TODO: just call changed element's watcher
 //       every watcher callback should have a key
// use like this:
 //       get keys via $(element).data('amObserve')
 //       call functions store with these keys
 $.each(UI.DOMWatchers, function(i, watcher) {
   watcher(element);
 });

});

$(function() {

 var $body = $('body');
 UI.DOMReady = true;
 // Run default init
 $.each(UI.DOMWatchers, function(i, watcher) {
   watcher(document);
 });
 // watches DOM
 UI.DOMObserve('[data-am-observe]');
 $html.removeClass('no-js').addClass('js');
 UI.support.animation && $html.addClass('cssanimations');
 // iOS standalone mode
 if (window.navigator.standalone) {
   $html.addClass('am-standalone');
 }
 $('.am-topbar-fixed-top').length &&
 $body.addClass('am-with-topbar-fixed-top');
 $('.am-topbar-fixed-bottom').length &&
 $body.addClass('am-with-topbar-fixed-bottom');
 // Remove responsive classes in .am-layout
 var $layout = $('.am-layout');
 $layout.find('[class*="md-block-grid"]').alterClass('md-block-grid-*');
 $layout.find('[class*="lg-block-grid"]').alterClass('lg-block-grid');
 // widgets not in .am-layout
 $('[data-am-widget]').each(function() {
   var $widget = $(this);
   // console.log($widget.parents('.am-layout').length)
   if ($widget.parents('.am-layout').length === 0) {
     $widget.addClass('am-no-layout');
   }
 });

});

module.exports = UI;

},{}],3:[function(_dereq_,module,exports){ 'use strict';

var UI = _dereq_(2);

/* jshint -W101, -W106 */ /**

* Add to Homescreen v3.2.2
* (c) 2015 Matteo Spinelli
* @license: http://cubiq.org/license
*/

// Check for addEventListener browser support (prevent errors in IE<9) var _eventListener = 'addEventListener' in window;

// Check if document is loaded, needed by autostart var _DOMReady = false; if (document.readyState === 'complete') {

 _DOMReady = true;

} else if (_eventListener) {

 window.addEventListener('load', loaded, false);

}

function loaded() {

 window.removeEventListener('load', loaded, false);
 _DOMReady = true;

}

// regex used to detect if app has been added to the homescreen var _reSmartURL = /\/ath(\/)?$/; var _reQueryString = /([\?&]ath=[^&]*$|&ath=[^&]*(&))/;

// singleton var _instance; function ath(options) {

 _instance = _instance || new ath.Class(options);
 return _instance;

}

// message in all supported languages ath.intl = {

 en_us: {
   ios: 'To add this web app to the home screen: tap %icon and then Add to Home Screen.',
   android: 'To add this web app to the home screen open the browser option menu and tap on Add to homescreen. The menu can be accessed by pressing the menu hardware button if your device has one, or by tapping the top right menu icon icon.'
 },
 zh_cn: {
   ios: '如要把应用程式加至主屏幕,请点击%icon, 然后加至主屏幕',
   android: 'To add this web app to the home screen open the browser option menu and tap on Add to homescreen. The menu can be accessed by pressing the menu hardware button if your device has one, or by tapping the top right menu icon icon.'
 },
 zh_tw: {
   ios: '如要把應用程式加至主屏幕, 請點擊%icon, 然後加至主屏幕.',
   android: 'To add this web app to the home screen open the browser option menu and tap on Add to homescreen. The menu can be accessed by pressing the menu hardware button if your device has one, or by tapping the top right menu icon icon.'
 }

};

// Add 2 characters language support (Android mostly) for (var lang in ath.intl) {

 ath.intl[lang.substr(0, 2)] = ath.intl[lang];

}

// default options ath.defaults = {

 appID: 'org.cubiq.addtohome',		// local storage name (no need to change)
 fontSize: 15,				// base font size, used to properly resize the popup based on viewport scale factor
 debug: false,				// override browser checks
 logging: false,				// log reasons for showing or not showing to js console; defaults to true when debug is true
 modal: false,				// prevent further actions until the message is closed
 mandatory: false,			// you can't proceed if you don't add the app to the homescreen
 autostart: true,			// show the message automatically
 skipFirstVisit: false,		// show only to returning visitors (ie: skip the first time you visit)
 startDelay: 1,				// display the message after that many seconds from page load
 lifespan: 15,				// life of the message in seconds
 displayPace: 1440,			// minutes before the message is shown again (0: display every time, default 24 hours)
 maxDisplayCount: 0,			// absolute maximum number of times the message will be shown to the user (0: no limit)
 icon: true,					// add touch icon to the message
 message: ,				// the message can be customized
 validLocation: [],			// list of pages where the message will be shown (array of regexes)
 onInit: null,				// executed on instance creation
 onShow: null,				// executed when the message is shown
 onRemove: null,				// executed when the message is removed
 onAdd: null,				// when the application is launched the first time from the homescreen (guesstimate)
 onPrivate: null,			// executed if user is in private mode
 privateModeOverride: false,	// show the message even in private mode (very rude)
 detectHomescreen: false		// try to detect if the site has been added to the homescreen (false | true | 'hash' | 'queryString' | 'smartURL')

};

// browser info and capability var _ua = window.navigator.userAgent;

var _nav = window.navigator; _extend(ath, {

 hasToken: document.location.hash == '#ath' || _reSmartURL.test(document.location.href) || _reQueryString.test(document.location.search),
 isRetina: window.devicePixelRatio && window.devicePixelRatio > 1,
 isIDevice: (/iphone|ipod|ipad/i).test(_ua),
 isMobileChrome: _ua.indexOf('Android') > -1 && (/Chrome\/[.0-9]*/).test(_ua) && _ua.indexOf("Version") == -1,
 isMobileIE: _ua.indexOf('Windows Phone') > -1,
 language: _nav.language && _nav.language.toLowerCase().replace('-', '_') || 

});

// falls back to en_us if language is unsupported ath.language = ath.language && ath.language in ath.intl ? ath.language : 'en_us';

ath.isMobileSafari = ath.isIDevice && _ua.indexOf('Safari') > -1 && _ua.indexOf('CriOS') < 0; ath.OS = ath.isIDevice ? 'ios' : ath.isMobileChrome ? 'android' : ath.isMobileIE ? 'windows' : 'unsupported';

ath.OSVersion = _ua.match(/(OS|Android) (\d+[_\.]\d+)/); ath.OSVersion = ath.OSVersion && ath.OSVersion[2] ? +ath.OSVersion[2].replace('_', '.') : 0;

ath.isStandalone = 'standalone' in window.navigator && window.navigator.standalone; ath.isTablet = (ath.isMobileSafari && _ua.indexOf('iPad') > -1) || (ath.isMobileChrome && _ua.indexOf('Mobile') < 0);

ath.isCompatible = (ath.isMobileSafari && ath.OSVersion >= 6) || ath.isMobileChrome; // TODO: add winphone

var _defaultSession = {

 lastDisplayTime: 0,			// last time we displayed the message
 returningVisitor: false,	// is this the first time you visit
 displayCount: 0,			// number of times the message has been shown
 optedout: false,			// has the user opted out
 added: false				// has been actually added to the homescreen

};

ath.removeSession = function(appID) {

 try {
   if (!localStorage) {
     throw new Error('localStorage is not defined');
   }
   localStorage.removeItem(appID || ath.defaults.appID);
 } catch (e) {
   // we are most likely in private mode
 }

};

ath.doLog = function(logStr) {

 if (this.options.logging) {
   console.log(logStr);
 }

};

ath.Class = function(options) {

 // class methods
 this.doLog = ath.doLog;
 // merge default options with user config
 this.options = _extend({}, ath.defaults);
 _extend(this.options, options);
 // override defaults that are dependent on each other
 if (options.debug && (typeof options.logging === "undefined")) {
   this.options.logging = true;
 }
 // IE<9 so exit (I hate you, really)
 if (!_eventListener) {
   return;
 }
 // normalize some options
 this.options.mandatory = this.options.mandatory && ( 'standalone' in window.navigator || this.options.debug );
 this.options.modal = this.options.modal || this.options.mandatory;
 if (this.options.mandatory) {
   this.options.startDelay = -0.5;		// make the popup hasty
 }
 this.options.detectHomescreen = this.options.detectHomescreen === true ? 'hash' : this.options.detectHomescreen;
 // setup the debug environment
 if (this.options.debug) {
   ath.isCompatible = true;
   ath.OS = typeof this.options.debug == 'string' ? this.options.debug : ath.OS == 'unsupported' ? 'android' : ath.OS;
   ath.OSVersion = ath.OS == 'ios' ? '8' : '4';
 }
 // the element the message will be appended to
 this.container = document.documentElement;
 // load session
 this.session = this.getItem(this.options.appID);
 this.session = this.session ? JSON.parse(this.session) : undefined;
 // user most likely came from a direct link containing our token, we don't need it and we remove it
 if (ath.hasToken && ( !ath.isCompatible || !this.session )) {
   ath.hasToken = false;
   _removeToken();
 }
 // the device is not supported
 if (!ath.isCompatible) {
   this.doLog("Add to homescreen: not displaying callout because device not supported");
   return;
 }
 this.session = this.session || _defaultSession;
 // check if we can use the local storage
 try {
   if (!localStorage) {
     throw new Error('localStorage is not defined');
   }
   localStorage.setItem(this.options.appID, JSON.stringify(this.session));
   ath.hasLocalStorage = true;
 } catch (e) {
   // we are most likely in private mode
   ath.hasLocalStorage = false;
   if (this.options.onPrivate) {
     this.options.onPrivate.call(this);
   }
 }
 // check if this is a valid location
 var isValidLocation = !this.options.validLocation.length;
 for (var i = this.options.validLocation.length; i--;) {
   if (this.options.validLocation[i].test(document.location.href)) {
     isValidLocation = true;
     break;
   }
 }
 // check compatibility with old versions of add to homescreen. Opt-out if an old session is found
 if (this.getItem('addToHome')) {
   this.optOut();
 }
 // critical errors:
 if (this.session.optedout) {
   this.doLog("Add to homescreen: not displaying callout because user opted out");
   return;
 }
 if (this.session.added) {
   this.doLog("Add to homescreen: not displaying callout because already added to the homescreen");
   return;
 }
 if (!isValidLocation) {
   this.doLog("Add to homescreen: not displaying callout because not a valid location");
   return;
 }
 // check if the app is in stand alone mode
 if (ath.isStandalone) {
   // execute the onAdd event if we haven't already
   if (!this.session.added) {
     this.session.added = true;
     this.updateSession();
     if (this.options.onAdd && ath.hasLocalStorage) {	// double check on localstorage to avoid multiple calls to the custom event
       this.options.onAdd.call(this);
     }
   }
   this.doLog("Add to homescreen: not displaying callout because in standalone mode");
   return;
 }
 // (try to) check if the page has been added to the homescreen
 if (this.options.detectHomescreen) {
   // the URL has the token, we are likely coming from the homescreen
   if (ath.hasToken) {
     _removeToken();		// we don't actually need the token anymore, we remove it to prevent redistribution
     // this is called the first time the user opens the app from the homescreen
     if (!this.session.added) {
       this.session.added = true;
       this.updateSession();
       if (this.options.onAdd && ath.hasLocalStorage) {	// double check on localstorage to avoid multiple calls to the custom event
         this.options.onAdd.call(this);
       }
     }
     this.doLog("Add to homescreen: not displaying callout because URL has token, so we are likely coming from homescreen");
     return;
   }
   // URL doesn't have the token, so add it
   if (this.options.detectHomescreen == 'hash') {
     history.replaceState(, window.document.title, document.location.href + '#ath');
   } else if (this.options.detectHomescreen == 'smartURL') {
     history.replaceState(, window.document.title, document.location.href.replace(/(\/)?$/, '/ath$1'));
   } else {
     history.replaceState(, window.document.title, document.location.href + (document.location.search ? '&' : '?' ) + 'ath=');
   }
 }
 // check if this is a returning visitor
 if (!this.session.returningVisitor) {
   this.session.returningVisitor = true;
   this.updateSession();
   // we do not show the message if this is your first visit
   if (this.options.skipFirstVisit) {
     this.doLog("Add to homescreen: not displaying callout because skipping first visit");
     return;
   }
 }
 // we do no show the message in private mode
 if (!this.options.privateModeOverride && !ath.hasLocalStorage) {
   this.doLog("Add to homescreen: not displaying callout because browser is in private mode");
   return;
 }
 // all checks passed, ready to display
 this.ready = true;
 if (this.options.onInit) {
   this.options.onInit.call(this);
 }
 if (this.options.autostart) {
   this.doLog("Add to homescreen: autostart displaying callout");
   this.show();
 }

};

ath.Class.prototype = {

 // event type to method conversion
 events: {
   load: '_delayedShow',
   error: '_delayedShow',
   orientationchange: 'resize',
   resize: 'resize',
   scroll: 'resize',
   click: 'remove',
   touchmove: '_preventDefault',
   transitionend: '_removeElements',
   webkitTransitionEnd: '_removeElements',
   MSTransitionEnd: '_removeElements'
 },
 handleEvent: function(e) {
   var type = this.events[e.type];
   if (type) {
     this[type](e);
   }
 },
 show: function(force) {
   // in autostart mode wait for the document to be ready
   if (this.options.autostart && !_DOMReady) {
     setTimeout(this.show.bind(this), 50);
     // we are not displaying callout because DOM not ready, but don't log that because
     // it would log too frequently
     return;
   }
   // message already on screen
   if (this.shown) {
     this.doLog("Add to homescreen: not displaying callout because already shown on screen");
     return;
   }
   var now = Date.now();
   var lastDisplayTime = this.session.lastDisplayTime;
   if (force !== true) {
     // this is needed if autostart is disabled and you programmatically call the show() method
     if (!this.ready) {
       this.doLog("Add to homescreen: not displaying callout because not ready");
       return;
     }
     // we obey the display pace (prevent the message to popup too often)
     if (now - lastDisplayTime < this.options.displayPace * 60000) {
       this.doLog("Add to homescreen: not displaying callout because displayed recently");
       return;
     }
     // obey the maximum number of display count
     if (this.options.maxDisplayCount && this.session.displayCount >= this.options.maxDisplayCount) {
       this.doLog("Add to homescreen: not displaying callout because displayed too many times already");
       return;
     }
   }
   this.shown = true;
   // increment the display count
   this.session.lastDisplayTime = now;
   this.session.displayCount++;
   this.updateSession();
   // try to get the highest resolution application icon
   if (!this.applicationIcon) {
     if (ath.OS == 'ios') {
       this.applicationIcon = document.querySelector('head link[rel^=apple-touch-icon][sizes="152x152"],head link[rel^=apple-touch-icon][sizes="144x144"],head link[rel^=apple-touch-icon][sizes="120x120"],head link[rel^=apple-touch-icon][sizes="114x114"],head link[rel^=apple-touch-icon]');
     } else {
       this.applicationIcon = document.querySelector('head link[rel^="shortcut icon"][sizes="196x196"],head link[rel^=apple-touch-icon]');
     }
   }
   var message = ;
   if (typeof this.options.message == 'object' && ath.language in this.options.message) {		// use custom language message
     message = this.options.message[ath.language][ath.OS];
   } else if (typeof this.options.message == 'object' && ath.OS in this.options.message) {		// use custom os message
     message = this.options.message[ath.OS];
   } else if (this.options.message in ath.intl) {				// you can force the locale
     message = ath.intl[this.options.message][ath.OS];
   } else if (this.options.message !== ) {						// use a custom message
     message = this.options.message;
   } else if (ath.OS in ath.intl[ath.language]) {				// otherwise we use our message
     message = ath.intl[ath.language][ath.OS];
   }
   // add the action icon
message = '

' + message.replace('%icon', 'icon') + '

';
   // create the message container
   this.viewport = document.createElement('div');
   this.viewport.className = 'ath-viewport';
   if (this.options.modal) {
     this.viewport.className += ' ath-modal';
   }
   if (this.options.mandatory) {
     this.viewport.className += ' ath-mandatory';
   }
   this.viewport.style.position = 'absolute';
   // create the actual message element
   this.element = document.createElement('div');
   this.element.className = 'ath-container ath-' + ath.OS + ' ath-' + ath.OS + (ath.OSVersion + ).substr(0, 1) + ' ath-' + (ath.isTablet ? 'tablet' : 'phone');
   this.element.style.cssText = '-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0s;-webkit-transition-timing-function:ease-out;transition-property:transform,opacity;transition-duration:0s;transition-timing-function:ease-out;';
   this.element.style.webkitTransform = 'translate3d(0,-' + window.innerHeight + 'px,0)';
   this.element.style.transform = 'translate3d(0,-' + window.innerHeight + 'px,0)';
   // add the application icon
   if (this.options.icon && this.applicationIcon) {
     this.element.className += ' ath-icon';
     this.img = document.createElement('img');
     this.img.className = 'ath-application-icon';
     this.img.addEventListener('load', this, false);
     this.img.addEventListener('error', this, false);
     this.img.src = this.applicationIcon.href;
     this.element.appendChild(this.img);
   }
   this.element.innerHTML += message;
   // we are not ready to show, place the message out of sight
   this.viewport.style.left = '-99999em';
   // attach all elements to the DOM
   this.viewport.appendChild(this.element);
   this.container.appendChild(this.viewport);
   // if we don't have to wait for an image to load, show the message right away
   if (this.img) {
     this.doLog("Add to homescreen: not displaying callout because waiting for img to load");
   } else {
     this._delayedShow();
   }
 },
 _delayedShow: function(e) {
   setTimeout(this._show.bind(this), this.options.startDelay * 1000 + 500);
 },
 _show: function() {
   var that = this;
   // update the viewport size and orientation
   this.updateViewport();
   // reposition/resize the message on orientation change
   window.addEventListener('resize', this, false);
   window.addEventListener('scroll', this, false);
   window.addEventListener('orientationchange', this, false);
   if (this.options.modal) {
     // lock any other interaction
     document.addEventListener('touchmove', this, true);
   }
   // Enable closing after 1 second
   if (!this.options.mandatory) {
     setTimeout(function() {
       that.element.addEventListener('click', that, true);
     }, 1000);
   }
   // kick the animation
   setTimeout(function() {
     that.element.style.webkitTransitionDuration = '1.2s';
     that.element.style.transitionDuration = '1.2s';
     that.element.style.webkitTransform = 'translate3d(0,0,0)';
     that.element.style.transform = 'translate3d(0,0,0)';
   }, 0);
   // set the destroy timer
   if (this.options.lifespan) {
     this.removeTimer = setTimeout(this.remove.bind(this), this.options.lifespan * 1000);
   }
   // fire the custom onShow event
   if (this.options.onShow) {
     this.options.onShow.call(this);
   }
 },
 remove: function() {
   clearTimeout(this.removeTimer);
   // clear up the event listeners
   if (this.img) {
     this.img.removeEventListener('load', this, false);
     this.img.removeEventListener('error', this, false);
   }
   window.removeEventListener('resize', this, false);
   window.removeEventListener('scroll', this, false);
   window.removeEventListener('orientationchange', this, false);
   document.removeEventListener('touchmove', this, true);
   this.element.removeEventListener('click', this, true);
   // remove the message element on transition end
   this.element.addEventListener('transitionend', this, false);
   this.element.addEventListener('webkitTransitionEnd', this, false);
   this.element.addEventListener('MSTransitionEnd', this, false);
   // start the fade out animation
   this.element.style.webkitTransitionDuration = '0.3s';
   this.element.style.opacity = '0';
 },
 _removeElements: function() {
   this.element.removeEventListener('transitionend', this, false);
   this.element.removeEventListener('webkitTransitionEnd', this, false);
   this.element.removeEventListener('MSTransitionEnd', this, false);
   // remove the message from the DOM
   this.container.removeChild(this.viewport);
   this.shown = false;
   // fire the custom onRemove event
   if (this.options.onRemove) {
     this.options.onRemove.call(this);
   }
 },
 updateViewport: function() {
   if (!this.shown) {
     return;
   }
   this.viewport.style.width = window.innerWidth + 'px';
   this.viewport.style.height = window.innerHeight + 'px';
   this.viewport.style.left = window.scrollX + 'px';
   this.viewport.style.top = window.scrollY + 'px';
   var clientWidth = document.documentElement.clientWidth;
   this.orientation = clientWidth > document.documentElement.clientHeight ? 'landscape' : 'portrait';
   var screenWidth = ath.OS == 'ios' ? this.orientation == 'portrait' ? screen.width : screen.height : screen.width;
   this.scale = screen.width > clientWidth ? 1 : screenWidth / window.innerWidth;
   this.element.style.fontSize = this.options.fontSize / this.scale + 'px';
 },
 resize: function() {
   clearTimeout(this.resizeTimer);
   this.resizeTimer = setTimeout(this.updateViewport.bind(this), 100);
 },
 updateSession: function() {
   if (ath.hasLocalStorage === false) {
     return;
   }
   if (localStorage) {
     localStorage.setItem(this.options.appID, JSON.stringify(this.session));
   }
 },
 clearSession: function() {
   this.session = _defaultSession;
   this.updateSession();
 },
 getItem: function(item) {
   try {
     if (!localStorage) {
       throw new Error('localStorage is not defined');
     }
     return localStorage.getItem(item);
   } catch (e) {
     // Preventing exception for some browsers when fetching localStorage key
     ath.hasLocalStorage = false;
   }
 },
 optOut: function() {
   this.session.optedout = true;
   this.updateSession();
 },
 optIn: function() {
   this.session.optedout = false;
   this.updateSession();
 },
 clearDisplayCount: function() {
   this.session.displayCount = 0;
   this.updateSession();
 },
 _preventDefault: function(e) {
   e.preventDefault();
   e.stopPropagation();
 }

};

// utility function _extend(target, obj) {

 for (var i in obj) {
   target[i] = obj[i];
 }
 return target;

}

function _removeToken() {

 if (document.location.hash == '#ath') {
   history.replaceState(, window.document.title, document.location.href.split('#')[0]);
 }
 if (_reSmartURL.test(document.location.href)) {
   history.replaceState(, window.document.title, document.location.href.replace(_reSmartURL, '$1'));
 }
 if (_reQueryString.test(document.location.search)) {
   history.replaceState(, window.document.title, document.location.href.replace(_reQueryString, '$2'));
 }

}

/* jshint +W101, +W106 */

ath.VERSION = '3.2.2';

module.exports = UI.addToHomescreen = ath;

},{"2":2}],4:[function(_dereq_,module,exports){ 'use strict';

var $ = (window.jQuery); var UI = _dereq_(2);

/**

* @via https://github.com/Minwe/bootstrap/blob/master/js/alert.js
* @copyright Copyright 2013 Twitter, Inc.
* @license Apache 2.0
*/

// Alert Class // NOTE: removeElement option is unavailable now var Alert = function(element, options) {

 var _this = this;
 this.options = $.extend({}, Alert.DEFAULTS, options);
 this.$element = $(element);
 this.$element
   .addClass('am-fade am-in')
   .on('click.alert.amui', '.am-close', function() {
     _this.close();
   });

};

Alert.DEFAULTS = {

 removeElement: true

};

Alert.prototype.close = function() {

 var $element = this.$element;
 $element.trigger('close.alert.amui').removeClass('am-in');
 function processAlert() {
   $element.trigger('closed.alert.amui').remove();
 }
 UI.support.transition && $element.hasClass('am-fade') ?
   $element
     .one(UI.support.transition.end, processAlert)
     .emulateTransitionEnd(200) :
   processAlert();

};

// plugin UI.plugin('alert', Alert);

// Init code $(document).on('click.alert.amui.data-api', '[data-am-alert]', function(e) {

 var $target = $(e.target);
 $target.is('.am-close') && $(this).alert('close');

});

module.exports = Alert;

},{"2":2}],5:[function(_dereq_,module,exports){ 'use strict';

var $ = (window.jQuery); var UI = _dereq_(2);

/**

* @via https://github.com/twbs/bootstrap/blob/master/js/button.js
* @copyright (c) 2011-2014 Twitter, Inc
* @license The MIT License
*/

var Button = function(element, options) {

 this.$element = $(element);
 this.options = $.extend({}, Button.DEFAULTS, options);
 this.isLoading = false;
 this.hasSpinner = false;

};

Button.DEFAULTS = {

 loadingText: 'loading...',
 disabledClassName: 'am-disabled',
 spinner: undefined

};

Button.prototype.setState = function(state, stateText) {

 var $element = this.$element;
 var disabled = 'disabled';
 var data = $element.data();
 var options = this.options;
 var val = $element.is('input') ? 'val' : 'html';
 var stateClassName = 'am-btn-' + state + ' ' + options.disabledClassName;
 state += 'Text';
 if (!options.resetText) {
   options.resetText = $element[val]();
 }
 // add spinner for element with html()
 if (UI.support.animation && options.spinner &&
   val === 'html' && !this.hasSpinner) {
   options.loadingText = '' + options.loadingText;
   this.hasSpinner = true;
 }
 stateText = stateText ||
   (data[state] === undefined ? options[state] : data[state]);
 $element[val](stateText);
 // push to event loop to allow forms to submit
 setTimeout($.proxy(function() {
   // TODO: add stateClass for other states
   if (state === 'loadingText') {
     $element.addClass(stateClassName).attr(disabled, disabled);
     this.isLoading = true;
   } else if (this.isLoading) {
     $element.removeClass(stateClassName).removeAttr(disabled);
     this.isLoading = false;
   }
 }, this), 0);

};

Button.prototype.toggle = function() {

 var changed = true;
 var $element = this.$element;
 var $parent = this.$element.parent('[class*="am-btn-group"]');
 if ($parent.length) {
   var $input = this.$element.find('input');
   if ($input.prop('type') == 'radio') {
     if ($input.prop('checked') && $element.hasClass('am-active')) {
       changed = false;
     } else {
       $parent.find('.am-active').removeClass('am-active');
     }
   }
   if (changed) {
     $input.prop('checked',
       !$element.hasClass('am-active')).trigger('change');
   }
 }
 if (changed) {
   $element.toggleClass('am-active');
   if (!$element.hasClass('am-active')) {
     $element.blur();
   }
 }

};

UI.plugin('button', Button, {

 dataOptions: 'data-am-loading',
 methodCall: function(args, instance) {
   if (args[0] === 'toggle') {
     instance.toggle();
   } else if (typeof args[0] === 'string') {
     instance.setState.apply(instance, args);
   }
 }

});

// Init code $(document).on('click.button.amui.data-api', '[data-am-button]', function(e) {

 e.preventDefault();
 var $btn = $(e.target);
 if (!$btn.hasClass('am-btn')) {
   $btn = $btn.closest('.am-btn');
 }
 $btn.button('toggle');

});

UI.ready(function(context) {

 $('[data-am-loading]', context).button();

});

module.exports = UI.button = Button;

},{"2":2}],6:[function(_dereq_,module,exports){ 'use strict';

var $ = (window.jQuery); var UI = _dereq_(2);

/**

* @via https://github.com/twbs/bootstrap/blob/master/js/collapse.js
* @copyright (c) 2011-2014 Twitter, Inc
* @license The MIT License
*/

var Collapse = function(element, options) {

 this.$element = $(element);
 this.options = $.extend({}, Collapse.DEFAULTS, options);
 this.transitioning = null;
 if (this.options.parent) {
   this.$parent = $(this.options.parent);
 }
 if (this.options.toggle) {
   this.toggle();
 }

};

Collapse.DEFAULTS = {

 toggle: true

};

Collapse.prototype.open = function() {

 if (this.transitioning || this.$element.hasClass('am-in')) {
   return;
 }
 var startEvent = $.Event('open.collapse.amui');
 this.$element.trigger(startEvent);
 if (startEvent.isDefaultPrevented()) {
   return;
 }
 var actives = this.$parent && this.$parent.find('> .am-panel > .am-in');
 if (actives && actives.length) {
   var hasData = actives.data('amui.collapse');
   if (hasData && hasData.transitioning) {
     return;
   }
   Plugin.call(actives, 'close');
   hasData || actives.data('amui.collapse', null);
 }
 this.$element
   .removeClass('am-collapse')
   .addClass('am-collapsing').height(0);
 this.transitioning = 1;
 var complete = function() {
   this.$element
     .removeClass('am-collapsing')
     .addClass('am-collapse am-in')
     .height()
     .trigger('opened.collapse.amui');
   this.transitioning = 0;
 };
 if (!UI.support.transition) {
   return complete.call(this);
 }
 var scrollHeight = this.$element[0].scrollHeight;
 this.$element
   .one(UI.support.transition.end, $.proxy(complete, this))
   .emulateTransitionEnd(300)
   .css({height: scrollHeight}); // 当折叠的容器有 padding 时,如果用 height() 只能设置内容的宽度

};

Collapse.prototype.close = function() {

 if (this.transitioning || !this.$element.hasClass('am-in')) {
   return;
 }
 var startEvent = $.Event('close.collapse.amui');
 this.$element.trigger(startEvent);
 if (startEvent.isDefaultPrevented()) {
   return;
 }
 this.$element.height(this.$element.height()).redraw();
 this.$element.addClass('am-collapsing').
   removeClass('am-collapse am-in');
 this.transitioning = 1;
 var complete = function() {
   this.transitioning = 0;
   this.$element
     .trigger('closed.collapse.amui')
     .removeClass('am-collapsing')
     .addClass('am-collapse');
   // css({height: '0'});
 };
 if (!UI.support.transition) {
   return complete.call(this);
 }
 this.$element.height(0)
   .one(UI.support.transition.end, $.proxy(complete, this))
   .emulateTransitionEnd(300);

};

Collapse.prototype.toggle = function() {

 this[this.$element.hasClass('am-in') ? 'close' : 'open']();

};

// Collapse Plugin function Plugin(option) {

 return this.each(function() {
   var $this = $(this);
   var data = $this.data('amui.collapse');
   var options = $.extend({}, Collapse.DEFAULTS,
     UI.utils.options($this.attr('data-am-collapse')),
     typeof option == 'object' && option);
   if (!data && options.toggle && option === 'open') {
     option = !option;
   }
   if (!data) {
     $this.data('amui.collapse', (data = new Collapse(this, options)));
   }
   if (typeof option == 'string') {
     data[option]();
   }
 });

}

$.fn.collapse = Plugin;

// Init code $(document).on('click.collapse.amui.data-api', '[data-am-collapse]',

 function(e) {
   var href;
   var $this = $(this);
   var options = UI.utils.options($this.attr('data-am-collapse'));
   var target = options.target ||
     e.preventDefault() ||
     (href = $this.attr('href')) &&
     href.replace(/.*(?=#[^\s]+$)/, );
   var $target = $(target);
   var data = $target.data('amui.collapse');
   var option = data ? 'toggle' : options;
   var parent = options.parent;
   var $parent = parent && $(parent);
   if (!data || !data.transitioning) {
     if ($parent) {
       // '[data-am-collapse*="{parent: \ + parent + '"]
       $parent.find('[data-am-collapse]').not($this).addClass('am-collapsed');
     }
     $this[$target.hasClass('am-in') ?
       'addClass' : 'removeClass']('am-collapsed');
   }
   Plugin.call($target, option);
 });

module.exports = UI.collapse = Collapse;

// TODO: 更好的 target 选择方式 // 折叠的容器必须没有 border/padding 才能正常处理,否则动画会有一些小问题 // 寻找更好的未知高度 transition 动画解决方案,max-height 之类的就算了

},{"2":2}],7:[function(_dereq_,module,exports){ 'use strict';

var $ = (window.jQuery); var UI = _dereq_(2); var $doc = $(document);

/**

* bootstrap-datepicker.js
* @via http://www.eyecon.ro/bootstrap-datepicker
* @license http://www.apache.org/licenses/LICENSE-2.0
*/

var Datepicker = function(element, options) {

 this.$element = $(element);
 this.options = $.extend({}, Datepicker.DEFAULTS, options);
 this.format = DPGlobal.parseFormat(this.options.format);
 this.$element.data('date', this.options.date);
 this.language = this.getLocale(this.options.locale);
 this.theme = this.options.theme;
 this.$picker = $(DPGlobal.template).appendTo('body').on({
   click: $.proxy(this.click, this)
   // mousedown: $.proxy(this.mousedown, this)
 });
 this.isInput = this.$element.is('input');
 this.component = this.$element.is('.am-datepicker-date') ?
   this.$element.find('.am-datepicker-add-on') : false;
 if (this.isInput) {
   this.$element.on({
     'click.datepicker.amui': $.proxy(this.open, this),
     // blur: $.proxy(this.close, this),
     'keyup.datepicker.amui': $.proxy(this.update, this)
   });
 } else {
   if (this.component) {
     this.component.on('click.datepicker.amui', $.proxy(this.open, this));
   } else {
     this.$element.on('click.datepicker.amui', $.proxy(this.open, this));
   }
 }
 this.minViewMode = this.options.minViewMode;
 if (typeof this.minViewMode === 'string') {
   switch (this.minViewMode) {
     case 'months':
       this.minViewMode = 1;
       break;
     case 'years':
       this.minViewMode = 2;
       break;
     default:
       this.minViewMode = 0;
       break;
   }
 }
 this.viewMode = this.options.viewMode;
 if (typeof this.viewMode === 'string') {
   switch (this.viewMode) {
     case 'months':
       this.viewMode = 1;
       break;
     case 'years':
       this.viewMode = 2;
       break;
     default:
       this.viewMode = 0;
       break;
   }
 }
 this.startViewMode = this.viewMode;
 this.weekStart = ((this.options.weekStart ||
 Datepicker.locales[this.language].weekStart || 0) % 7);
 this.weekEnd = ((this.weekStart + 6) % 7);
 this.onRender = this.options.onRender;
 this.setTheme();
 this.fillDow();
 this.fillMonths();
 this.update();
 this.showMode();

};

Datepicker.DEFAULTS = {

 locale: 'zh_CN',
 format: 'yyyy-mm-dd',
 weekStart: undefined,
 viewMode: 0,
 minViewMode: 0,
 date: ,
 theme: ,
 autoClose: 1,
 onRender: function(date) {
   return ;
 }

};

Datepicker.prototype.open = function(e) {

 this.$picker.show();
 this.height = this.component ?
   this.component.outerHeight() : this.$element.outerHeight();
 this.place();
 $(window).on('resize.datepicker.amui', $.proxy(this.place, this));
 if (e) {
   e.stopPropagation();
   e.preventDefault();
 }
 var that = this;
 $doc.on('mousedown.datapicker.amui touchstart.datepicker.amui', function(ev) {
   if ($(ev.target).closest('.am-datepicker').length === 0) {
     that.close();
   }
 });
 this.$element.trigger({
   type: 'open.datepicker.amui',
   date: this.date
 });

};

Datepicker.prototype.close = function() {

 this.$picker.hide();
 $(window).off('resize.datepicker.amui', this.place);
 this.viewMode = this.startViewMode;
 this.showMode();
 if (!this.isInput) {
   $(document).off('mousedown.datapicker.amui touchstart.datepicker.amui',
     this.close);
 }
 // this.set();
 this.$element.trigger({
   type: 'close.datepicker.amui',
   date: this.date
 });

};

Datepicker.prototype.set = function() {

 var formated = DPGlobal.formatDate(this.date, this.format);
 if (!this.isInput) {
   if (this.component) {
     this.$element.find('input').prop('value', formated);
   }
   this.$element.data('date', formated);
 } else {
   this.$element.prop('value', formated);
 }

};

Datepicker.prototype.setValue = function(newDate) {

 if (typeof newDate === 'string') {
   this.date = DPGlobal.parseDate(newDate, this.format);
 } else {
   this.date = new Date(newDate);
 }
 this.set();
 this.viewDate = new Date(this.date.getFullYear(),
   this.date.getMonth(), 1, 0, 0, 0, 0);
 this.fill();

};

Datepicker.prototype.place = function() {

 var offset = this.component ?
   this.component.offset() : this.$element.offset();
 var $width = this.component ?
   this.component.width() : this.$element.width();
 var top = offset.top + this.height;
 var left = offset.left;
 var right = $doc.width() - offset.left - $width;
 var isOutView = this.isOutView();
 this.$picker.removeClass('am-datepicker-right');
 this.$picker.removeClass('am-datepicker-up');
 if ($doc.width() > 640) {
   if (isOutView.outRight) {
     this.$picker.addClass('am-datepicker-right');
     this.$picker.css({
       top: top,
       left: 'auto',
       right: right
     });
     return;
   }
   if (isOutView.outBottom) {
     this.$picker.addClass('am-datepicker-up');
     top = offset.top - this.$picker.outerHeight(true);
   }
 } else {
   left = 0;
 }
 this.$picker.css({
   top: top,
   left: left
 });

};

Datepicker.prototype.update = function(newDate) {

 this.date = DPGlobal.parseDate(
   typeof newDate === 'string' ? newDate : (this.isInput ?
     this.$element.prop('value') : this.$element.data('date')),
   this.format
 );
 this.viewDate = new Date(this.date.getFullYear(),
   this.date.getMonth(), 1, 0, 0, 0, 0);
 this.fill();

};

// Days of week Datepicker.prototype.fillDow = function() {

 var dowCount = this.weekStart;
 var html = '<tr>';
 while (dowCount < this.weekStart + 7) {
   // NOTE: do % then add 1
   html += '<th class="am-datepicker-dow">' +
   Datepicker.locales[this.language].daysMin[(dowCount++) % 7] +
   '</th>';
 }
 html += '</tr>';
 this.$picker.find('.am-datepicker-days thead').append(html);

};

Datepicker.prototype.fillMonths = function() {

 var html = ;
 var i = 0;
 while (i < 12) {
   html += '' +
   Datepicker.locales[this.language].monthsShort[i++] + '';
 }
 this.$picker.find('.am-datepicker-months td').append(html);

};

Datepicker.prototype.fill = function() {

 var d = new Date(this.viewDate);
 var year = d.getFullYear();
 var month = d.getMonth();
 var currentDate = this.date.valueOf();
 var prevMonth = new Date(year, month - 1, 28, 0, 0, 0, 0);
 var day = DPGlobal
   .getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
 var daysSelect = this.$picker
   .find('.am-datepicker-days .am-datepicker-select');
 if (this.language === 'zh_CN') {
   daysSelect.text(year + Datepicker.locales[this.language].year[0] +
   ' ' + Datepicker.locales[this.language].months[month]);
 } else {
   daysSelect.text(Datepicker.locales[this.language].months[month] +
   ' ' + year);
 }
 prevMonth.setDate(day);
 prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7) % 7);
 var nextMonth = new Date(prevMonth);
 nextMonth.setDate(nextMonth.getDate() + 42);
 nextMonth = nextMonth.valueOf();
 var html = [];
 var className;
 var prevY;
 var prevM;
 while (prevMonth.valueOf() < nextMonth) {
   if (prevMonth.getDay() === this.weekStart) {
     html.push('<tr>');
   }
   className = this.onRender(prevMonth);
   prevY = prevMonth.getFullYear();
   prevM = prevMonth.getMonth();
   if ((prevM < month && prevY === year) || prevY < year) {
     className += ' am-datepicker-old';
   } else if ((prevM > month && prevY === year) || prevY > year) {
     className += ' am-datepicker-new';
   }
   if (prevMonth.valueOf() === currentDate) {
     className += ' am-active';
   }
   html.push('<td class="am-datepicker-day ' +
   className + '">' + prevMonth.getDate() + '</td>');
   if (prevMonth.getDay() === this.weekEnd) {
     html.push('</tr>');
   }
   prevMonth.setDate(prevMonth.getDate() + 1);
 }
 this.$picker.find('.am-datepicker-days tbody')
   .empty().append(html.join());
 var currentYear = this.date.getFullYear();
 var months = this.$picker.find('.am-datepicker-months')
   .find('.am-datepicker-select')
   .text(year);
 months = months.end()
   .find('span').removeClass('am-active').removeClass('am-disabled');
 var monthLen = 0;
 while (monthLen < 12) {
   if (this.onRender(d.setFullYear(year, monthLen))) {
     months.eq(monthLen).addClass('am-disabled');
   }
   monthLen++;
 }
 if (currentYear === year) {
   months.eq(this.date.getMonth())
       .removeClass('am-disabled')
       .addClass('am-active');
 }
 html = ;
 year = parseInt(year / 10, 10) * 10;
 var yearCont = this.$picker
   .find('.am-datepicker-years')
   .find('.am-datepicker-select')
   .text(year + '-' + (year + 9))
   .end()
   .find('td');
 var yearClassName;
 year -= 1;
 for (var i = -1; i < 11; i++) {
   yearClassName = this.onRender(d.setFullYear(year));
   html += '' + year + '';
   year += 1;
 }
 yearCont.html(html);

};

Datepicker.prototype.click = function(event) {

 event.stopPropagation();
 event.preventDefault();
 var month;
 var year;
 var $dayActive = this.$picker.find('.am-datepicker-days').find('.am-active');
 var $months = this.$picker.find('.am-datepicker-months');
 var $monthIndex = $months.find('.am-active').index();
 var $target = $(event.target).closest('span, td, th');
 if ($target.length === 1) {
   switch ($target[0].nodeName.toLowerCase()) {
     case 'th':
       switch ($target[0].className) {
         case 'am-datepicker-switch':
           this.showMode(1);
           break;
         case 'am-datepicker-prev':
         case 'am-datepicker-next':
           this.viewDate['set' + DPGlobal.modes[this.viewMode].navFnc].call(
             this.viewDate,
             this.viewDate
               ['get' + DPGlobal.modes[this.viewMode].navFnc]
               .call(this.viewDate) +
             DPGlobal.modes[this.viewMode].navStep *
             ($target[0].className === 'am-datepicker-prev' ? -1 : 1)
           );
           this.fill();
           this.set();
           break;
       }
       break;
     case 'span':
       if ($target.is('.am-disabled')) {
         return;
       }
       if ($target.is('.am-datepicker-month')) {
         month = $target.parent().find('span').index($target);
         if ($target.is('.am-active')) {
           this.viewDate.setMonth(month, $dayActive.text());
         } else {
           this.viewDate.setMonth(month);
         }
       } else {
         year = parseInt($target.text(), 10) || 0;
         if ($target.is('.am-active')) {
           this.viewDate.setFullYear(year, $monthIndex, $dayActive.text());
         } else {
           this.viewDate.setFullYear(year);
         }
       }
       if (this.viewMode !== 0) {
         this.date = new Date(this.viewDate);
         this.$element.trigger({
           type: 'changeDate.datepicker.amui',
           date: this.date,
           viewMode: DPGlobal.modes[this.viewMode].clsName
         });
       }
       this.showMode(-1);
       this.fill();
       this.set();
       break;
     case 'td':
       if ($target.is('.am-datepicker-day') && !$target.is('.am-disabled')) {
         var day = parseInt($target.text(), 10) || 1;
         month = this.viewDate.getMonth();
         if ($target.is('.am-datepicker-old')) {
           month -= 1;
         } else if ($target.is('.am-datepicker-new')) {
           month += 1;
         }
         year = this.viewDate.getFullYear();
         this.date = new Date(year, month, day, 0, 0, 0, 0);
         this.viewDate = new Date(year, month, Math.min(28, day), 0, 0, 0, 0);
         this.fill();
         this.set();
         this.$element.trigger({
           type: 'changeDate.datepicker.amui',
           date: this.date,
           viewMode: DPGlobal.modes[this.viewMode].clsName
         });
         this.options.autoClose && this.close();
       }
       break;
   }
 }

};

Datepicker.prototype.mousedown = function(event) {

 event.stopPropagation();
 event.preventDefault();

};

Datepicker.prototype.showMode = function(dir) {

 if (dir) {
   this.viewMode = Math.max(this.minViewMode,
     Math.min(2, this.viewMode + dir));
 }
 this.$picker.find('>div').hide().
   filter('.am-datepicker-' + DPGlobal.modes[this.viewMode].clsName).show();

};

Datepicker.prototype.isOutView = function() {

 var offset = this.component ?
   this.component.offset() : this.$element.offset();
 var isOutView = {
   outRight: false,
   outBottom: false
 };
 var $picker = this.$picker;
 var width = offset.left + $picker.outerWidth(true);
 var height = offset.top + $picker.outerHeight(true) +
   this.$element.innerHeight();
 if (width > $doc.width()) {
   isOutView.outRight = true;
 }
 if (height > $doc.height()) {
   isOutView.outBottom = true;
 }
 return isOutView;

};

Datepicker.prototype.getLocale = function(locale) {

 if (!locale) {
   locale = navigator.language && navigator.language.split('-');
   locale[1] = locale[1].toUpperCase();
   locale = locale.join('_');
 }
 if (!Datepicker.locales[locale]) {
   locale = 'en_US';
 }
 return locale;

};

Datepicker.prototype.setTheme = function() {

 if (this.theme) {
   this.$picker.addClass('am-datepicker-' + this.theme);
 }

};

// Datepicker locales Datepicker.locales = {

 en_US: {
   days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
     'Friday', 'Saturday'],
   daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
   daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
   months: ['January', 'February', 'March', 'April', 'May', 'June',
     'July', 'August', 'September', 'October', 'November', 'December'],
   monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
     'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
   weekStart: 0
 },
 zh_CN: {
   days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
   daysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
   daysMin: ['日', '一', '二', '三', '四', '五', '六'],
   months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月',
     '八月', '九月', '十月', '十一月', '十二月'],
   monthsShort: ['一月', '二月', '三月', '四月', '五月', '六月',
     '七月', '八月', '九月', '十月', '十一月', '十二月'],
   weekStart: 1,
   year: ['年']
 }

};

var DPGlobal = {

 modes: [
   {
     clsName: 'days',
     navFnc: 'Month',
     navStep: 1
   },
   {
     clsName: 'months',
     navFnc: 'FullYear',
     navStep: 1
   },
   {
     clsName: 'years',
     navFnc: 'FullYear',
     navStep: 10
   }
 ],
 isLeapYear: function(year) {
   return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
 },
 getDaysInMonth: function(year, month) {
   return [31, (DPGlobal.isLeapYear(year) ? 29 : 28),
     31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
 },
 parseFormat: function(format) {
   var separator = format.match(/[.\/\-\s].*?/);
   var parts = format.split(/\W+/);
   if (!separator || !parts || parts.length === 0) {
     throw new Error('Invalid date format.');
   }
   return {
     separator: separator,
     parts: parts
   };
 },
 parseDate: function(date, format) {
   var parts = date.split(format.separator);
   var val;
   date = new Date();
   date.setHours(0);
   date.setMinutes(0);
   date.setSeconds(0);
   date.setMilliseconds(0);
   if (parts.length === format.parts.length) {
     var year = date.getFullYear();
     var day = date.getDate();
     var month = date.getMonth();
     for (var i = 0, cnt = format.parts.length; i < cnt; i++) {
       val = parseInt(parts[i], 10) || 1;
       switch (format.parts[i]) {
         case 'dd':
         case 'd':
           day = val;
           date.setDate(val);
           break;
         case 'mm':
         case 'm':
           month = val - 1;
           date.setMonth(val - 1);
           break;
         case 'yy':
           year = 2000 + val;
           date.setFullYear(2000 + val);
           break;
         case 'yyyy':
           year = val;
           date.setFullYear(val);
           break;
       }
     }
     date = new Date(year, month, day, 0, 0, 0);
   }
   return date;
 },
 formatDate: function(date, format) {
   var val = {
     d: date.getDate(),
     m: date.getMonth() + 1,
     yy: date.getFullYear().toString().substring(2),
     yyyy: date.getFullYear()
   };
   var dateArray = [];
   val.dd = (val.d < 10 ? '0' : ) + val.d;
   val.mm = (val.m < 10 ? '0' : ) + val.m;
   for (var i = 0, cnt = format.parts.length; i < cnt; i++) {
     dateArray.push(val[format.parts[i]]);
   }
   return dateArray.join(format.separator);
 },
 headTemplate: '<thead>' +
 '<tr class="am-datepicker-header">' +
 '<th class="am-datepicker-prev">' +
 '</th>' +
 '<th colspan="5" class="am-datepicker-switch">' +
'
</th>' +
 '<th class="am-datepicker-next">' +
 '</th></tr></thead>',
 contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'

};

DPGlobal.template = '
' + '
' + '
' + '' + DPGlobal.headTemplate + '<tbody></tbody>' + '
' + '
' + '
' + '' + DPGlobal.headTemplate + DPGlobal.contTemplate + '
' + '
' + '
' + '' + DPGlobal.headTemplate + DPGlobal.contTemplate + '
' + '
' + '
';

// jQuery plugin UI.plugin('datepicker', Datepicker);

// Init code UI.ready(function(context) {

 $('[data-am-datepicker]').datepicker();

});

module.exports = UI.datepicker = Datepicker;

// TODO: 1. 载入动画 // 2. less 优化

},{"2":2}],8:[function(_dereq_,module,exports){ 'use strict';

var $ = (window.jQuery); var UI = _dereq_(2); var $doc = $(document); var transition = UI.support.transition;

var Dimmer = function() {

 this.id = UI.utils.generateGUID('am-dimmer');
 this.$element = $(Dimmer.DEFAULTS.tpl, {
   id: this.id
 });
 this.inited = false;
 this.scrollbarWidth = 0;
 this.$used = $([]);

};

Dimmer.DEFAULTS = {

tpl: '
'

};

Dimmer.prototype.init = function() {

 if (!this.inited) {
   $(document.body).append(this.$element);
   this.inited = true;
   $doc.trigger('init.dimmer.amui');
   this.$element.on('touchmove.dimmer.amui', function(e) {
     e.preventDefault();
   });
 }
 return this;

};

Dimmer.prototype.open = function(relatedElement) {

 if (!this.inited) {
   this.init();
 }
 var $element = this.$element;
 // 用于多重调用
 if (relatedElement) {
   this.$used = this.$used.add($(relatedElement));
 }
 this.checkScrollbar().setScrollbar();
 $element.show().trigger('open.dimmer.amui');
 transition && $element.off(transition.end);
 setTimeout(function() {
   $element.addClass('am-active');
 }, 0);
 return this;

};

Dimmer.prototype.close = function(relatedElement, force) {

 this.$used = this.$used.not($(relatedElement));
 if (!force && this.$used.length) {
   return this;
 }
 var $element = this.$element;
 $element.removeClass('am-active').trigger('close.dimmer.amui');
 function complete() {
   $element.hide();
   this.resetScrollbar();
 }
 // transition ? $element.one(transition.end, $.proxy(complete, this)) :
 complete.call(this);
 return this;

};

Dimmer.prototype.checkScrollbar = function() {

 this.scrollbarWidth = UI.utils.measureScrollbar();
 return this;

};

Dimmer.prototype.setScrollbar = function() {

 var $body = $(document.body);
 var bodyPaddingRight = parseInt(($body.css('padding-right') || 0), 10);
 if (this.scrollbarWidth) {
   $body.css('padding-right', bodyPaddingRight + this.scrollbarWidth);
 }
 $body.addClass('am-dimmer-active');
 return this;

};

Dimmer.prototype.resetScrollbar = function() {

 $(document.body).css('padding-right', ).removeClass('am-dimmer-active');
 return this;

};

module.exports = UI.dimmer = new Dimmer();

},{"2":2}],9:[function(_dereq_,module,exports){ 'use strict';

var $ = (window.jQuery); var UI = _dereq_(2); var animation = UI.support.animation;

/**

* @via https://github.com/Minwe/bootstrap/blob/master/js/dropdown.js
* @copyright (c) 2011-2014 Twitter, Inc
* @license The MIT License
*/

// var toggle = '[data-am-dropdown] > .am-dropdown-toggle';

var Dropdown = function(element, options) {

 this.options = $.extend({}, Dropdown.DEFAULTS, options);
 options = this.options;
 this.$element = $(element);
 this.$toggle = this.$element.find(options.selector.toggle);
 this.$dropdown = this.$element.find(options.selector.dropdown);
 this.$boundary = (options.boundary === window) ? $(window) :
   this.$element.closest(options.boundary);
 this.$justify = (options.justify && $(options.justify).length &&
 $(options.justify)) || undefined;
 !this.$boundary.length && (this.$boundary = $(window));
 this.active = this.$element.hasClass('am-active') ? true : false;
 this.animating = null;
 this.events();

};

Dropdown.DEFAULTS = {

 animation: 'am-animation-slide-top-fixed',
 boundary: window,
 justify: undefined,
 selector: {
   dropdown: '.am-dropdown-content',
   toggle: '.am-dropdown-toggle'
 },
 trigger: 'click'

};

Dropdown.prototype.toggle = function() {

 this.clear();
 if (this.animating) {
   return;
 }
 this[this.active ? 'close' : 'open']();

};

Dropdown.prototype.open = function(e) {

 var $toggle = this.$toggle;
 var $element = this.$element;
 var $dropdown = this.$dropdown;
 if ($toggle.is('.am-disabled, :disabled')) {
   return;
 }
 if (this.active) {
   return;
 }
 $element.trigger('open.dropdown.amui').addClass('am-active');
 $toggle.trigger('focus');
 this.checkDimensions();
 var complete = $.proxy(function() {
   $element.trigger('opened.dropdown.amui');
   this.active = true;
   this.animating = 0;
 }, this);
 if (animation) {
   this.animating = 1;
   $dropdown.addClass(this.options.animation).
     on(animation.end + '.open.dropdown.amui', $.proxy(function() {
       complete();
       $dropdown.removeClass(this.options.animation);
     }, this));
 } else {
   complete();
 }

};

Dropdown.prototype.close = function() {

 if (!this.active) {
   return;
 }
 // fix #165
 // var animationName = this.options.animation + ' am-animation-reverse';
 var animationName = 'am-dropdown-animation';
 var $element = this.$element;
 var $dropdown = this.$dropdown;
 $element.trigger('close.dropdown.amui');
 var complete = $.proxy(function complete() {
   $element.
     removeClass('am-active').
     trigger('closed.dropdown.amui');
   this.active = false;
   this.animating = 0;
   this.$toggle.blur();
 }, this);
 if (animation) {
   $dropdown.removeClass(this.options.animation);
   $dropdown.addClass(animationName);
   this.animating = 1;
   // animation
   $dropdown.one(animation.end + '.close.dropdown.amui', function() {
     $dropdown.removeClass(animationName);
     complete();
   });
 } else {
   complete();
 }

};

Dropdown.prototype.checkDimensions = function() {

 if (!this.$dropdown.length) {
   return;
 }
 var $dropdown = this.$dropdown;
 var offset = $dropdown.offset();
 var width = $dropdown.outerWidth();
 var boundaryWidth = this.$boundary.width();
 var boundaryOffset = $.isWindow(this.boundary) && this.$boundary.offset() ?
   this.$boundary.offset().left : 0;
 if (this.$justify) {
   // jQuery.fn.width() is really...
   $dropdown.css({'min-width': this.$justify.css('width')});
 }
 if ((width + (offset.left - boundaryOffset)) > boundaryWidth) {
   this.$element.addClass('am-dropdown-flip');
 }

};

Dropdown.prototype.clear = function() {

 $('[data-am-dropdown]').not(this.$element).each(function() {
   var data = $(this).data('amui.dropdown');
   data && data.close();
 });

};

Dropdown.prototype.events = function() {

 var eventNS = 'dropdown.amui';
 // triggers = this.options.trigger.split(' '),
 var $toggle = this.$toggle;
 $toggle.on('click.' + eventNS, $.proxy(function(e) {
   e.preventDefault();
   this.toggle();
 }, this));
 /*for (var i = triggers.length; i--;) {
  var trigger = triggers[i];
  if (trigger === 'click') {
  $toggle.on('click.' + eventNS, $.proxy(this.toggle, this))
  }
  if (trigger === 'focus' || trigger === 'hover') {
  var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin';
  var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';
  this.$element.on(eventIn + '.' + eventNS, $.proxy(this.open, this))
  .on(eventOut + '.' + eventNS, $.proxy(this.close, this));
  }
  }*/
 $(document).on('keydown.dropdown.amui', $.proxy(function(e) {
   e.keyCode === 27 && this.active && this.close();
 }, this)).on('click.outer.dropdown.amui', $.proxy(function(e) {
   // var $target = $(e.target);
   if (this.active &&
     (this.$element[0] === e.target || !this.$element.find(e.target).length)) {
     this.close();
   }
 }, this));

};

// Dropdown Plugin UI.plugin('dropdown', Dropdown);

// Init code UI.ready(function(context) {

 $('[data-am-dropdown]', context).dropdown();

});

$(document).on('click.dropdown.amui.data-api', '.am-dropdown form',

 function(e) {
   e.stopPropagation();
 });

module.exports = UI.dropdown = Dropdown;

// TODO: 1. 处理链接 focus // 2. 增加 mouseenter / mouseleave 选项 // 3. 宽度适应

},{"2":2}],10:[function(_dereq_,module,exports){ var $ = (window.jQuery); var UI = _dereq_(2);

// MODIFIED: // - LINE 226: add `` // - namespace // - Init code // TODO: start after x ms when pause on actions

/*

* jQuery FlexSlider v2.4.0
* Copyright 2012 WooThemes
* Contributing Author: Tyler Smith
*/

// FlexSlider: Object Instance $.flexslider = function(el, options) {

 var slider = $(el);
 // making variables public
 slider.vars = $.extend({}, $.flexslider.defaults, options);
 var namespace = slider.vars.namespace,
   msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
   touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
 // depricating this idea, as devices are being released with both of these events
 //eventType = (touch) ? "touchend" : "click",
   eventType = "click touchend MSPointerUp keyup",
   watchedEvent = "",
   watchedEventClearTimer,
   vertical = slider.vars.direction === "vertical",
   reverse = slider.vars.reverse,
   carousel = (slider.vars.itemWidth > 0),
   fade = slider.vars.animation === "fade",
   asNav = slider.vars.asNavFor !== "",
   methods = {},
   focused = true;
 // Store a reference to the slider object
 $.data(el, 'flexslider', slider);
 // Private slider methods
 methods = {
   init: function() {
     slider.animating = false;
     // Get current slide and make sure it is a number
     slider.currentSlide = parseInt((slider.vars.startAt ? slider.vars.startAt : 0), 10);
     if (isNaN(slider.currentSlide)) {
       slider.currentSlide = 0;
     }
     slider.animatingTo = slider.currentSlide;
     slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
     slider.containerSelector = slider.vars.selector.substr(0, slider.vars.selector.search(' '));
     slider.slides = $(slider.vars.selector, slider);
     slider.container = $(slider.containerSelector, slider);
     slider.count = slider.slides.length;
     // SYNC:
     slider.syncExists = $(slider.vars.sync).length > 0;
     // SLIDE:
     if (slider.vars.animation === "slide") {
       slider.vars.animation = "swing";
     }
     slider.prop = (vertical) ? "top" : "marginLeft";
     slider.args = {};
     // SLIDESHOW:
     slider.manualPause = false;
     slider.stopped = false;
     //PAUSE WHEN INVISIBLE
     slider.started = false;
     slider.startTimeout = null;
     // TOUCH/USECSS:
     slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
       var obj = document.createElement('div'),
         props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
       for (var i in props) {
         if (obj.style[props[i]] !== undefined) {
           slider.pfx = props[i].replace('Perspective', ).toLowerCase();
           slider.prop = "-" + slider.pfx + "-transform";
           return true;
         }
       }
       return false;
     }());
     slider.ensureAnimationEnd = ;
     // CONTROLSCONTAINER:
     if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
     // MANUAL:
     if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
     // RANDOMIZE:
     if (slider.vars.randomize) {
       slider.slides.sort(function() {
         return (Math.round(Math.random()) - 0.5);
       });
       slider.container.empty().append(slider.slides);
     }
     slider.doMath();
     // INIT
     slider.setup("init");
     // CONTROLNAV:
     if (slider.vars.controlNav) {
       methods.controlNav.setup();
     }
     // DIRECTIONNAV:
     if (slider.vars.directionNav) {
       methods.directionNav.setup();
     }
     // KEYBOARD:
     if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
       $(document).bind('keyup', function(event) {
         var keycode = event.keyCode;
         if (!slider.animating && (keycode === 39 || keycode === 37)) {
           var target = (keycode === 39) ? slider.getTarget('next') :
             (keycode === 37) ? slider.getTarget('prev') : false;
           slider.flexAnimate(target, slider.vars.pauseOnAction);
         }
       });
     }
     // MOUSEWHEEL:
     if (slider.vars.mousewheel) {
       slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
         event.preventDefault();
         var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
         slider.flexAnimate(target, slider.vars.pauseOnAction);
       });
     }
     // PAUSEPLAY
     if (slider.vars.pausePlay) {
       methods.pausePlay.setup();
     }
     //PAUSE WHEN INVISIBLE
     if (slider.vars.slideshow && slider.vars.pauseInvisible) {
       methods.pauseInvisible.init();
     }
     // SLIDSESHOW
     if (slider.vars.slideshow) {
       if (slider.vars.pauseOnHover) {
         slider.hover(function() {
           if (!slider.manualPlay && !slider.manualPause) {slider.pause();}
         }, function() {
           if (!slider.manualPause && !slider.manualPlay && !slider.stopped) {slider.play();}
         });
       }
       // initialize animation
       // If we're visible, or we don't use PageVisibility API
       if (!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
         (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
       }
     }
     // ASNAV:
     if (asNav) {methods.asNav.setup();}
     // TOUCH
     if (touch && slider.vars.touch) {methods.touch();}
     // FADE&&SMOOTHHEIGHT || SLIDE:
     if (!fade || (fade && slider.vars.smoothHeight)) {$(window).bind("resize orientationchange focus", methods.resize);}
     slider.find("img").attr("draggable", "false");
     // API: start() Callback
     setTimeout(function() {
       slider.vars.start(slider);
     }, 200);
   },
   asNav: {
     setup: function() {
       slider.asNav = true;
       slider.animatingTo = Math.floor(slider.currentSlide / slider.move);
       slider.currentItem = slider.currentSlide;
       slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
       if (!msGesture) {
         slider.slides.on(eventType, function(e) {
           e.preventDefault();
           var $slide = $(this),
             target = $slide.index();
           var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
           if (posFromLeft <= 0 && $slide.hasClass(namespace + 'active-slide')) {
             slider.flexAnimate(slider.getTarget("prev"), true);
           } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
             slider.direction = (slider.currentItem < target) ? "next" : "prev";
             slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
           }
         });
       } else {
         el._slider = slider;
         slider.slides.each(function() {
           var that = this;
           that._gesture = new MSGesture();
           that._gesture.target = that;
           that.addEventListener("MSPointerDown", function(e) {
             e.preventDefault();
             if (e.currentTarget._gesture) {
               e.currentTarget._gesture.addPointer(e.pointerId);
             }
           }, false);
           that.addEventListener("MSGestureTap", function(e) {
             e.preventDefault();
             var $slide = $(this),
               target = $slide.index();
             if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
               slider.direction = (slider.currentItem < target) ? "next" : "prev";
               slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
             }
           });
         });
       }
     }
   },
   controlNav: {
     setup: function() {
       if (!slider.manualControls) {
         methods.controlNav.setupPaging();
       } else { // MANUALCONTROLS:
         methods.controlNav.setupManual();
       }
     },
     setupPaging: function() {
       var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
         j = 1,
         item,
         slide;
slider.controlNavScaffold = $('
    ');
           if (slider.pagingCount > 1) {
             for (var i = 0; i < slider.pagingCount; i++) {
               slide = slider.slides.eq(i);
               item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr('data-thumb') + '"/>' : '<a>' + j + '</a>';
               if ('thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions) {
                 var captn = slide.attr('data-thumbcaption');
                 if ( != captn && undefined != captn) {item += '' + captn + ''};
               }
    
    // slider.controlNavScaffold.append('
  1. ' + item + '
  2. '); slider.controlNavScaffold.append('
  3. ' + item + '
  4. ');
               j++;
             }
           }
    
           // CONTROLSCONTAINER:
           (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
           methods.controlNav.set();
    
           methods.controlNav.active();
    
           slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
             event.preventDefault();
    
             if (watchedEvent === "" || watchedEvent === event.type) {
               var $this = $(this),
                 target = slider.controlNav.index($this);
    
               if (!$this.hasClass(namespace + 'active')) {
                 slider.direction = (target > slider.currentSlide) ? "next" : "prev";
                 slider.flexAnimate(target, slider.vars.pauseOnAction);
               }
             }
    
             // setup flags to prevent event duplication
             if (watchedEvent === "") {
               watchedEvent = event.type;
             }
             methods.setToClearWatchedEvent();
    
           });
         },
         setupManual: function() {
           slider.controlNav = slider.manualControls;
           methods.controlNav.active();
    
           slider.controlNav.bind(eventType, function(event) {
             event.preventDefault();
    
             if (watchedEvent === "" || watchedEvent === event.type) {
               var $this = $(this),
                 target = slider.controlNav.index($this);
    
               if (!$this.hasClass(namespace + 'active')) {
                 (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
                 slider.flexAnimate(target, slider.vars.pauseOnAction);
               }
             }
    
             // setup flags to prevent event duplication
             if (watchedEvent === "") {
               watchedEvent = event.type;
             }
             methods.setToClearWatchedEvent();
           });
         },
         set: function() {
           var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
           slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
         },
         active: function() {
           slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
         },
         update: function(action, pos) {
           if (slider.pagingCount > 1 && action === "add") {
    
    slider.controlNavScaffold.append($('
  5. <a>' + slider.count + '</a>
  6. '));
           } else if (slider.pagingCount === 1) {
             slider.controlNavScaffold.find('li').remove();
           } else {
             slider.controlNav.eq(pos).closest('li').remove();
           }
           methods.controlNav.set();
           (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
         }
       },
       directionNav: {
         setup: function() {
    
    var directionNavScaffold = $('
    • <a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a>
    • <a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a>
    ');
           // CONTROLSCONTAINER:
           if (slider.controlsContainer) {
             $(slider.controlsContainer).append(directionNavScaffold);
             slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
           } else {
             slider.append(directionNavScaffold);
             slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
           }
    
           methods.directionNav.update();
    
           slider.directionNav.bind(eventType, function(event) {
             event.preventDefault();
             var target;
    
             if (watchedEvent === "" || watchedEvent === event.type) {
               target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
               slider.flexAnimate(target, slider.vars.pauseOnAction);
             }
    
             // setup flags to prevent event duplication
             if (watchedEvent === "") {
               watchedEvent = event.type;
             }
             methods.setToClearWatchedEvent();
           });
         },
         update: function() {
           var disabledClass = namespace + 'disabled';
           if (slider.pagingCount === 1) {
             slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
           } else if (!slider.vars.animationLoop) {
             if (slider.animatingTo === 0) {
               slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
             } else if (slider.animatingTo === slider.last) {
               slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
             } else {
               slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
             }
           } else {
             slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
           }
         }
       },
       pausePlay: {
         setup: function() {
    
    var pausePlayScaffold = $('
    <a></a>
    ');
           // CONTROLSCONTAINER:
           if (slider.controlsContainer) {
             slider.controlsContainer.append(pausePlayScaffold);
             slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
           } else {
             slider.append(pausePlayScaffold);
             slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
           }
    
           methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
    
           slider.pausePlay.bind(eventType, function(event) {
             event.preventDefault();
    
             if (watchedEvent === "" || watchedEvent === event.type) {
               if ($(this).hasClass(namespace + 'pause')) {
                 slider.manualPause = true;
                 slider.manualPlay = false;
                 slider.pause();
               } else {
                 slider.manualPause = false;
                 slider.manualPlay = true;
                 slider.play();
               }
             }
    
             // setup flags to prevent event duplication
             if (watchedEvent === "") {
               watchedEvent = event.type;
             }
             methods.setToClearWatchedEvent();
           });
         },
         update: function(state) {
           (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
         }
       },
       touch: function() {
         var startX,
           startY,
           offset,
           cwidth,
           dx,
           startT,
           scrolling = false,
           localX = 0,
           localY = 0,
           accDx = 0;
    
         if (!msGesture) {
           el.addEventListener('touchstart', onTouchStart, false);
    
           function onTouchStart(e) {
             if (slider.animating) {
               e.preventDefault();
             } else if (( window.navigator.msPointerEnabled ) || e.touches.length === 1) {
               slider.pause();
               // CAROUSEL:
               cwidth = (vertical) ? slider.h : slider.w;
               startT = Number(new Date());
               // CAROUSEL:
    
               // Local vars for X and Y points.
               localX = e.touches[0].pageX;
               localY = e.touches[0].pageY;
    
               offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
                 (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
                   (carousel && slider.currentSlide === slider.last) ? slider.limit :
                     (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
                       (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
               startX = (vertical) ? localY : localX;
               startY = (vertical) ? localX : localY;
    
               el.addEventListener('touchmove', onTouchMove, false);
               el.addEventListener('touchend', onTouchEnd, false);
             }
           }
    
           function onTouchMove(e) {
             // Local vars for X and Y points.
    
             localX = e.touches[0].pageX;
             localY = e.touches[0].pageY;
    
             dx = (vertical) ? startX - localY : startX - localX;
             scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
    
             var fxms = 500;
    
             if (!scrolling || Number(new Date()) - startT > fxms) {
               e.preventDefault();
               if (!fade && slider.transitions) {
                 if (!slider.vars.animationLoop) {
                   dx = dx / ((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx) / cwidth + 2) : 1);
                 }
                 slider.setProps(offset + dx, "setTouch");
               }
             }
           }
    
           function onTouchEnd(e) {
             // finish the touch by undoing the touch session
             el.removeEventListener('touchmove', onTouchMove, false);
    
             if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
               var updateDx = (reverse) ? -dx : dx,
                 target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
    
               if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth / 2)) {
                 slider.flexAnimate(target, slider.vars.pauseOnAction);
               } else {
                 if (!fade) {slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);}
               }
             }
             el.removeEventListener('touchend', onTouchEnd, false);
    
             startX = null;
             startY = null;
             dx = null;
             offset = null;
           }
         } else {
           el.style.msTouchAction = "none";
           el._gesture = new MSGesture();
           el._gesture.target = el;
           el.addEventListener("MSPointerDown", onMSPointerDown, false);
           el._slider = slider;
           el.addEventListener("MSGestureChange", onMSGestureChange, false);
           el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
    
           function onMSPointerDown(e) {
             e.stopPropagation();
             if (slider.animating) {
               e.preventDefault();
             } else {
               slider.pause();
               el._gesture.addPointer(e.pointerId);
               accDx = 0;
               cwidth = (vertical) ? slider.h : slider.w;
               startT = Number(new Date());
               // CAROUSEL:
    
               offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
                 (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
                   (carousel && slider.currentSlide === slider.last) ? slider.limit :
                     (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
                       (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
             }
           }
    
           function onMSGestureChange(e) {
             e.stopPropagation();
             var slider = e.target._slider;
             if (!slider) {
               return;
             }
             var transX = -e.translationX,
               transY = -e.translationY;
    
             //Accumulate translations.
             accDx = accDx + ((vertical) ? transY : transX);
             dx = accDx;
             scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
    
             if (e.detail === e.MSGESTURE_FLAG_INERTIA) {
               setImmediate(function() {
                 el._gesture.stop();
               });
    
               return;
             }
    
             if (!scrolling || Number(new Date()) - startT > 500) {
               e.preventDefault();
               if (!fade && slider.transitions) {
                 if (!slider.vars.animationLoop) {
                   dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
                 }
                 slider.setProps(offset + dx, "setTouch");
               }
             }
           }
    
           function onMSGestureEnd(e) {
             e.stopPropagation();
             var slider = e.target._slider;
             if (!slider) {
               return;
             }
             if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
               var updateDx = (reverse) ? -dx : dx,
                 target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
    
               if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth / 2)) {
                 slider.flexAnimate(target, slider.vars.pauseOnAction);
               } else {
                 if (!fade) {slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);}
               }
             }
    
             startX = null;
             startY = null;
             dx = null;
             offset = null;
             accDx = 0;
           }
         }
       },
       resize: function() {
         if (!slider.animating && slider.is(':visible')) {
           if (!carousel) {slider.doMath()};
    
           if (fade) {
             // SMOOTH HEIGHT:
             methods.smoothHeight();
           } else if (carousel) { //CAROUSEL:
             slider.slides.width(slider.computedW);
             slider.update(slider.pagingCount);
             slider.setProps();
           }
           else if (vertical) { //VERTICAL:
             slider.viewport.height(slider.h);
             slider.setProps(slider.h, "setTotal");
           } else {
             // SMOOTH HEIGHT:
             if (slider.vars.smoothHeight) {methods.smoothHeight();}
             slider.newSlides.width(slider.computedW);
             slider.setProps(slider.computedW, "setTotal");
           }
         }
       },
       smoothHeight: function(dur) {
         if (!vertical || fade) {
           var $obj = (fade) ? slider : slider.viewport;
           (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
         }
       },
       sync: function(action) {
         var $obj = $(slider.vars.sync).data("flexslider"),
           target = slider.animatingTo;
    
         switch (action) {
           case "animate":
             $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true);
             break;
           case "play":
             if (!$obj.playing && !$obj.asNav) {
               $obj.play();
             }
             break;
           case "pause":
             $obj.pause();
             break;
         }
       },
       uniqueID: function($clone) {
         // Append _clone to current level and children elements with id attributes
         $clone.filter('[id]').add($clone.find('[id]')).each(function() {
           var $this = $(this);
           $this.attr('id', $this.attr('id') + '_clone');
         });
         return $clone;
       },
       pauseInvisible: {
         visProp: null,
         init: function() {
           var visProp = methods.pauseInvisible.getHiddenProp();
           if (visProp) {
             var evtname = visProp.replace(/[H|h]idden/,) + 'visibilitychange';
             document.addEventListener(evtname, function() {
               if (methods.pauseInvisible.isHidden()) {
                 if(slider.startTimeout) {
                   clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
                 } else {
                   slider.pause(); //Or just pause
                 }
               }
               else {
                 if(slider.started) {
                   slider.play(); //Initiated before, just play
                 } else {
                   if (slider.vars.initDelay > 0) {
                     setTimeout(slider.play, slider.vars.initDelay);
                   } else {
                     slider.play(); //Didn't init before: simply init or wait for it
                   }
                 }
               }
             });
           }
         },
         isHidden: function() {
           var prop = methods.pauseInvisible.getHiddenProp();
           if (!prop) {
             return false;
           }
           return document[prop];
         },
         getHiddenProp: function() {
           var prefixes = ['webkit','moz','ms','o'];
           // if 'hidden' is natively supported just return it
           if ('hidden' in document) {
             return 'hidden';
           }
           // otherwise loop over all the known prefixes until we find one
           for (var i = 0; i < prefixes.length; i++ ) {
             if ((prefixes[i] + 'Hidden') in document) {
               return prefixes[i] + 'Hidden';
             }
           }
           // otherwise it's not supported
           return null;
         }
       },
       setToClearWatchedEvent: function() {
         clearTimeout(watchedEventClearTimer);
         watchedEventClearTimer = setTimeout(function() {
           watchedEvent = "";
         }, 3000);
       }
     };
    
     // public methods
     slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
       if (!slider.vars.animationLoop && target !== slider.currentSlide) {
         slider.direction = (target > slider.currentSlide) ? "next" : "prev";
       }
    
       if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
    
       if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
         if (asNav && withSync) {
           var master = $(slider.vars.asNavFor).data('flexslider');
           slider.atEnd = target === 0 || target === slider.count - 1;
           master.flexAnimate(target, true, false, true, fromNav);
           slider.direction = (slider.currentItem < target) ? "next" : "prev";
           master.direction = slider.direction;
    
           if (Math.ceil((target + 1) / slider.visible) - 1 !== slider.currentSlide && target !== 0) {
             slider.currentItem = target;
             slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
             target = Math.floor(target / slider.visible);
           } else {
             slider.currentItem = target;
             slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
             return false;
           }
         }
    
         slider.animating = true;
         slider.animatingTo = target;
    
         // SLIDESHOW:
         if (pause) {slider.pause();}
    
         // API: before() animation Callback
         slider.vars.before(slider);
    
         // SYNC:
         if (slider.syncExists && !fromNav) {methods.sync("animate");}
    
         // CONTROLNAV
         if (slider.vars.controlNav) {methods.controlNav.active();}
    
         // !CAROUSEL:
         // CANDIDATE: slide active class (for add/remove slide)
         if (!carousel) {slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');}
    
         // INFINITE LOOP:
         // CANDIDATE: atEnd
         slider.atEnd = target === 0 || target === slider.last;
    
         // DIRECTIONNAV:
         if (slider.vars.directionNav) {methods.directionNav.update();}
    
         if (target === slider.last) {
           // API: end() of cycle Callback
           slider.vars.end(slider);
           // SLIDESHOW && !INFINITE LOOP:
           if (!slider.vars.animationLoop) {slider.pause();}
         }
    
         // SLIDE:
         if (!fade) {
           var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
             margin, slideString, calcNext;
    
           // INFINITE LOOP / REVERSE:
           if (carousel) {
             //margin = (slider.vars.itemWidth > slider.w) ? slider.vars.itemMargin * 2 : slider.vars.itemMargin;
             margin = slider.vars.itemMargin;
             calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
             slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
           } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
             slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
           } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
             slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
           } else {
             slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
           }
           slider.setProps(slideString, "", slider.vars.animationSpeed);
           if (slider.transitions) {
             if (!slider.vars.animationLoop || !slider.atEnd) {
               slider.animating = false;
               slider.currentSlide = slider.animatingTo;
             }
    
             // Unbind previous transitionEnd events and re-bind new transitionEnd event
             slider.container.unbind("webkitTransitionEnd transitionend");
             slider.container.bind("webkitTransitionEnd transitionend", function() {
               clearTimeout(slider.ensureAnimationEnd);
               slider.wrapup(dimension);
             });
    
             // Insurance for the ever-so-fickle transitionEnd event
             clearTimeout(slider.ensureAnimationEnd);
             slider.ensureAnimationEnd = setTimeout(function() {
               slider.wrapup(dimension);
             }, slider.vars.animationSpeed + 100);
    
           } else {
             slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
               slider.wrapup(dimension);
             });
           }
         } else { // FADE:
           if (!touch) {
             //slider.slides.eq(slider.currentSlide).fadeOut(slider.vars.animationSpeed, slider.vars.easing);
             //slider.slides.eq(target).fadeIn(slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
    
             slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
             slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
    
           } else {
             slider.slides.eq(slider.currentSlide).css({
               "opacity": 0,
               "zIndex": 1
             });
             slider.slides.eq(target).css({"opacity": 1, "zIndex": 2});
             slider.wrapup(dimension);
           }
         }
         // SMOOTH HEIGHT:
         if (slider.vars.smoothHeight) {methods.smoothHeight(slider.vars.animationSpeed)};
       }
     };
     slider.wrapup = function(dimension) {
       // SLIDE:
       if (!fade && !carousel) {
         if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
           slider.setProps(dimension, "jumpEnd");
         } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
           slider.setProps(dimension, "jumpStart");
         }
       }
       slider.animating = false;
       slider.currentSlide = slider.animatingTo;
       // API: after() animation Callback
       slider.vars.after(slider);
     };
    
     // SLIDESHOW:
     slider.animateSlides = function() {
       if (!slider.animating && focused) {slider.flexAnimate(slider.getTarget("next"));}
     };
     // SLIDESHOW:
     slider.pause = function() {
       clearInterval(slider.animatedSlides);
       slider.animatedSlides = null;
       slider.playing = false;
       // PAUSEPLAY:
       if (slider.vars.pausePlay) {methods.pausePlay.update("play");}
       // SYNC:
       if (slider.syncExists) {methods.sync("pause");}
     };
     // SLIDESHOW:
     slider.play = function() {
       if (slider.playing) {clearInterval(slider.animatedSlides);}
       slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
       slider.started = slider.playing = true;
       // PAUSEPLAY:
       if (slider.vars.pausePlay) {methods.pausePlay.update("pause");}
       // SYNC:
       if (slider.syncExists) {methods.sync("play");}
     };
     // STOP:
     slider.stop = function() {
       slider.pause();
       slider.stopped = true;
     };
     slider.canAdvance = function(target, fromNav) {
       // ASNAV:
       var last = (asNav) ? slider.pagingCount - 1 : slider.last;
       return (fromNav) ? true :
         (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
           (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
             (target === slider.currentSlide && !asNav) ? false :
               (slider.vars.animationLoop) ? true :
                 (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
                   (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
                     true;
     };
     slider.getTarget = function(dir) {
       slider.direction = dir;
       if (dir === "next") {
         return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
       } else {
         return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
       }
     };
    
     // SLIDE:
     slider.setProps = function(pos, special, dur) {
       var target = (function() {
         var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
           posCalc = (function() {
             if (carousel) {
               return (special === "setTouch") ? pos :
                 (reverse && slider.animatingTo === slider.last) ? 0 :
                   (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
                     (slider.animatingTo === slider.last) ? slider.limit : posCheck;
             } else {
               switch (special) {
                 case "setTotal":
                   return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
                 case "setTouch":
                   return (reverse) ? pos : pos;
                 case "jumpEnd":
                   return (reverse) ? pos : slider.count * pos;
                 case "jumpStart":
                   return (reverse) ? slider.count * pos : pos;
                 default:
                   return pos;
               }
             }
           }());
    
         return (posCalc * -1) + "px";
       }());
    
       if (slider.transitions) {
         target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
         dur = (dur !== undefined) ? (dur / 1000) + "s" : "0s";
         slider.container.css("-" + slider.pfx + "-transition-duration", dur);
         slider.container.css("transition-duration", dur);
       }
    
       slider.args[slider.prop] = target;
       if (slider.transitions || dur === undefined) {slider.container.css(slider.args);}
    
       slider.container.css('transform', target);
     };
    
     slider.setup = function(type) {
       // SLIDE:
       if (!fade) {
         var sliderOffset, arr;
    
         if (type === "init") {
    
    slider.viewport = $('
    ').css({
             "overflow": "hidden",
             "position": "relative"
           }).appendTo(slider).append(slider.container);
           // INFINITE LOOP:
           slider.cloneCount = 0;
           slider.cloneOffset = 0;
           // REVERSE:
           if (reverse) {
             arr = $.makeArray(slider.slides).reverse();
             slider.slides = $(arr);
             slider.container.empty().append(slider.slides);
           }
         }
         // INFINITE LOOP && !CAROUSEL:
         if (slider.vars.animationLoop && !carousel) {
           slider.cloneCount = 2;
           slider.cloneOffset = 1;
           // clear out old clones
           if (type !== "init") { slider.container.find('.clone').remove(); }
           slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
             .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
         }
         slider.newSlides = $(slider.vars.selector, slider);
    
         sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
         // VERTICAL:
         if (vertical && !carousel) {
           slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
           setTimeout(function() {
             slider.newSlides.css({"display": "block"});
             slider.doMath();
             slider.viewport.height(slider.h);
             slider.setProps(sliderOffset * slider.h, "init");
           }, (type === "init") ? 100 : 0);
         } else {
           slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
           slider.setProps(sliderOffset * slider.computedW, "init");
           setTimeout(function() {
             slider.doMath();
             slider.newSlides.css({
               "width": slider.computedW,
               "float": "left",
               "display": "block"
             });
             // SMOOTH HEIGHT:
             if (slider.vars.smoothHeight) {methods.smoothHeight();}
           }, (type === "init") ? 100 : 0);
         }
       } else { // FADE:
         slider.slides.css({
           "width": "100%",
           "float": "left",
           "marginRight": "-100%",
           "position": "relative"
         });
         if (type === "init") {
           if (!touch) {
             //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
             if (slider.vars.fadeFirstSlide == false) {
               slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
             } else {
               slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
             }
           } else {
             slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
           }
         }
         // SMOOTH HEIGHT:
         if (slider.vars.smoothHeight) {methods.smoothHeight();}
       }
       // !CAROUSEL:
       // CANDIDATE: active slide
       if (!carousel) {slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");}
    
       //FlexSlider: init() Callback
       slider.vars.init(slider);
     };
    
     slider.doMath = function() {
       var slide = slider.slides.first(),
         slideMargin = slider.vars.itemMargin,
         minItems = slider.vars.minItems,
         maxItems = slider.vars.maxItems;
    
       slider.w = (slider.viewport === undefined) ? slider.width() : slider.viewport.width();
       slider.h = slide.height();
       slider.boxPadding = slide.outerWidth() - slide.width();
    
       // CAROUSEL:
       if (carousel) {
         slider.itemT = slider.vars.itemWidth + slideMargin;
         slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
         slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
         slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1))) / minItems :
           (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1))) / maxItems :
             (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
    
         slider.visible = Math.floor(slider.w / (slider.itemW));
         slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
         slider.pagingCount = Math.ceil(((slider.count - slider.visible) / slider.move) + 1);
         slider.last = slider.pagingCount - 1;
         slider.limit = (slider.pagingCount === 1) ? 0 :
           (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
       } else {
         slider.itemW = slider.w;
         slider.pagingCount = slider.count;
         slider.last = slider.count - 1;
       }
       slider.computedW = slider.itemW - slider.boxPadding;
     };
    
     slider.update = function(pos, action) {
       slider.doMath();
    
       // update currentSlide and slider.animatingTo if necessary
       if (!carousel) {
         if (pos < slider.currentSlide) {
           slider.currentSlide += 1;
         } else if (pos <= slider.currentSlide && pos !== 0) {
           slider.currentSlide -= 1;
         }
         slider.animatingTo = slider.currentSlide;
       }
    
       // update controlNav
       if (slider.vars.controlNav && !slider.manualControls) {
         if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
           methods.controlNav.update("add");
         } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
           if (carousel && slider.currentSlide > slider.last) {
             slider.currentSlide -= 1;
             slider.animatingTo -= 1;
           }
           methods.controlNav.update("remove", slider.last);
         }
       }
       // update directionNav
       if (slider.vars.directionNav) {methods.directionNav.update();}
    
     };
    
     slider.addSlide = function(obj, pos) {
       var $obj = $(obj);
    
       slider.count += 1;
       slider.last = slider.count - 1;
    
       // append new slide
       if (vertical && reverse) {
         (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
       } else {
         (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
       }
    
       // update currentSlide, animatingTo, controlNav, and directionNav
       slider.update(pos, "add");
    
       // update slider.slides
       slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
       // re-setup the slider to accomdate new slide
       slider.setup();
    
       //FlexSlider: added() Callback
       slider.vars.added(slider);
     };
     slider.removeSlide = function(obj) {
       var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
    
       // update count
       slider.count -= 1;
       slider.last = slider.count - 1;
    
       // remove slide
       if (isNaN(obj)) {
         $(obj, slider.slides).remove();
       } else {
         (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
       }
    
       // update currentSlide, animatingTo, controlNav, and directionNav
       slider.doMath();
       slider.update(pos, "remove");
    
       // update slider.slides
       slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
       // re-setup the slider to accomdate new slide
       slider.setup();
    
       // FlexSlider: removed() Callback
       slider.vars.removed(slider);
     };
    
     //FlexSlider: Initialize
     methods.init();
    

    };

    // Ensure the slider isn't focussed if the window loses focus. $(window).blur(function(e) {

     focused = false;
    

    }).focus(function(e) {

     focused = true;
    

    });

    // FlexSlider: Default Settings $.flexslider.defaults = {

     namespace: 'am-',             // {NEW} String: Prefix string attached to the class of every element generated by the plugin
     selector: '.am-slides > li',       // {NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
     animation: 'slide',              // String: Select your animation type, 'fade' or 'slide'
     easing: 'swing',                // {NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
     direction: 'horizontal',        // String: Select the sliding direction, "horizontal" or "vertical"
     reverse: false,                 // {NEW} Boolean: Reverse the animation direction
     animationLoop: true,            // Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
     smoothHeight: false,            // {NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
     startAt: 0,                     // Integer: The slide that the slider should start on. Array notation (0 = first slide)
     slideshow: true,                // Boolean: Animate slider automatically
     slideshowSpeed: 5000,           // Integer: Set the speed of the slideshow cycling, in milliseconds
     animationSpeed: 600,            // Integer: Set the speed of animations, in milliseconds
     initDelay: 0,                   // {NEW} Integer: Set an initialization delay, in milliseconds
     randomize: false,               // Boolean: Randomize slide order
     fadeFirstSlide: true,           // Boolean: Fade in the first slide when animation type is "fade"
     thumbCaptions: false,           // Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
    
     // Usability features
     pauseOnAction: true,            // Boolean: Pause the slideshow when interacting with control elements, highly recommended.
     pauseOnHover: false,            // Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
     pauseInvisible: true,   		// {NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
     useCSS: true,                   // {NEW} Boolean: Slider will use CSS3 transitions if available
     touch: true,                    // {NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
     video: false,                   // {NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
    
     // Primary Controls
     controlNav: true,               // Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
     directionNav: true,             // Boolean: Create navigation for previous/next navigation? (true/false)
     prevText: ' ',           // String: Set the text for the "previous" directionNav item
     nextText: ' ',               // String: Set the text for the "next" directionNav item
    
     // Secondary Navigation
     keyboard: true,                 // Boolean: Allow slider navigating via keyboard left/right keys
     multipleKeyboard: false,        // {NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
     mousewheel: false,              // {UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
     pausePlay: false,               // Boolean: Create pause/play dynamic element
     pauseText: 'Pause',             // String: Set the text for the 'pause' pausePlay item
     playText: 'Play',               // String: Set the text for the 'play' pausePlay item
    
     //  Special properties
     controlsContainer: ,          // {UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $('.flexslider-container'). Property is ignored if given element is not found.
     manualControls: ,             // {UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
     sync: ,                       // {NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
     asNavFor: ,                   // {NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
    
     // Carousel Options
     itemWidth: 0,                   // {NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
     itemMargin: 0,                  // {NEW} Integer: Margin between carousel items.
     minItems: 1,                    // {NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
     maxItems: 0,                    // {NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
     move: 0,                        // {NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
     allowOneSlide: true,           // {NEW} Boolean: Whether or not to allow a slider comprised of a single slide
    
     // Callback API
     start: function() {
     },            // Callback: function(slider) - Fires when the slider loads the first slide
     before: function() {
     },           // Callback: function(slider) - Fires asynchronously with each slider animation
     after: function() {
     },            // Callback: function(slider) - Fires after each slider animation completes
     end: function() {
     },              // Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
     added: function() {
     },            // {NEW} Callback: function(slider) - Fires after a slide is added
     removed: function() {
     },           // {NEW} Callback: function(slider) - Fires after a slide is removed
     init: function() {
     }             // {NEW} Callback: function(slider) - Fires after the slider is initially setup
    

    };

    // FlexSlider: Plugin Function $.fn.flexslider = function(options) {

     var args = Array.prototype.slice.call(arguments, 1);
     if (options === undefined) {options = {};}
    
     if (typeof options === 'object') {
       return this.each(function() {
         var $this = $(this);
         var selector = (options.selector) ? options.selector : '.am-slides > li';
         var $slides = $this.find(selector);
    
         if (($slides.length === 1 && options.allowOneSlide === true) || $slides.length === 0) {
           $slides.fadeIn(400);
           if (options.start) {options.start($this);}
         } else if ($this.data('flexslider') === undefined) {
           new $.flexslider(this, options);
         }
       });
     } else {
       // Helper strings to quickly pecdrform functions on the slider
       var $slider = $(this).data('flexslider');
       var methodReturn;
       switch (options) {
         case 'next':
           $slider.flexAnimate($slider.getTarget('next'), true);
           break;
         case 'prev':
         case 'previous':
           $slider.flexAnimate($slider.getTarget('prev'), true);
           break;
         default:
           if (typeof options === 'number') {
             $slider.flexAnimate(options, true);
           } else if (typeof options === 'string') {
             methodReturn = (typeof $slider[options] === 'function') ?
               $slider[options].apply($slider, args) : $slider[options];
           }
       }
    
       return methodReturn === undefined ? this : methodReturn;
     }
    

    };

    // Init code UI.ready(function(context) {

     $('[data-am-flexslider]', context).each(function(i, item) {
       var $slider = $(item);
       var options = UI.utils.parseOptions($slider.data('amFlexslider'));
    
       options.before = function(slider) {
         if (slider._pausedTimer) {
           window.clearTimeout(slider._pausedTimer);
           slider._pausedTimer = null;
         }
       };
    
       options.after = function(slider) {
         var pauseTime = slider.vars.playAfterPaused;
         if (pauseTime && !isNaN(pauseTime) && !slider.playing) {
           if (!slider.manualPause && !slider.manualPlay && !slider.stopped) {
             slider._pausedTimer = window.setTimeout(function() {
               slider.play();
             }, pauseTime);
           }
         }
       };
    
       $slider.flexslider(options);
     });
    

    });

    module.exports = $.flexslider;

    },{"2":2}],11:[function(_dereq_,module,exports){ 'use strict';

    var $ = (window.jQuery); var UI = _dereq_(2);

    /* jshint unused: false */ /* jshint -W101, -W116, -W109 */

    /*! iScroll v5.1.3

    * (c) 2008-2014 Matteo Spinelli
    * http://cubiq.org/license
    */
    

    var rAF = window.requestAnimationFrame ||

     window.webkitRequestAnimationFrame ||
     window.mozRequestAnimationFrame ||
     window.oRequestAnimationFrame ||
     window.msRequestAnimationFrame ||
     function(callback) {
       window.setTimeout(callback, 1000 / 60);
     };
    

    var utils = (function() {

     var me = {};
    
     var _elementStyle = document.createElement('div').style;
     var _vendor = (function() {
       var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'],
         transform,
         i = 0,
         l = vendors.length;
    
       for (; i < l; i++) {
         transform = vendors[i] + 'ransform';
         if (transform in _elementStyle) return vendors[i].substr(0, vendors[i].length - 1);
       }
    
       return false;
     })();
    
     function _prefixStyle(style) {
       if (_vendor === false) return false;
       if (_vendor === ) return style;
       return _vendor + style.charAt(0).toUpperCase() + style.substr(1);
     }
    
     me.getTime = Date.now || function getTime() {
       return new Date().getTime();
     };
    
     me.extend = function(target, obj) {
       for (var i in obj) {
         target[i] = obj[i];
       }
     };
    
     me.addEvent = function(el, type, fn, capture) {
       el.addEventListener(type, fn, !!capture);
     };
    
     me.removeEvent = function(el, type, fn, capture) {
       el.removeEventListener(type, fn, !!capture);
     };
    
     me.prefixPointerEvent = function(pointerEvent) {
       return window.MSPointerEvent ?
       'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10) :
         pointerEvent;
     };
    
     me.momentum = function(current, start, time, lowerMargin, wrapperSize, deceleration) {
       var distance = current - start,
         speed = Math.abs(distance) / time,
         destination,
         duration;
    
       deceleration = deceleration === undefined ? 0.0006 : deceleration;
    
       destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
       duration = speed / deceleration;
    
       if (destination < lowerMargin) {
         destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin;
         distance = Math.abs(destination - current);
         duration = distance / speed;
       } else if (destination > 0) {
         destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0;
         distance = Math.abs(current) + destination;
         duration = distance / speed;
       }
    
       return {
         destination: Math.round(destination),
         duration: duration
       };
     };
    
     var _transform = _prefixStyle('transform');
    
     me.extend(me, {
       hasTransform: _transform !== false,
       hasPerspective: _prefixStyle('perspective') in _elementStyle,
       hasTouch: 'ontouchstart' in window,
       hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed
       hasTransition: _prefixStyle('transition') in _elementStyle
     });
    
     // This should find all Android browsers lower than build 535.19 (both stock browser and webview)
     me.isBadAndroid = /Android /.test(window.navigator.appVersion) && !(/Chrome\/\d/.test(window.navigator.appVersion));
    
     me.extend(me.style = {}, {
       transform: _transform,
       transitionTimingFunction: _prefixStyle('transitionTimingFunction'),
       transitionDuration: _prefixStyle('transitionDuration'),
       transitionDelay: _prefixStyle('transitionDelay'),
       transformOrigin: _prefixStyle('transformOrigin')
     });
    
     me.hasClass = function(e, c) {
       var re = new RegExp("(^|\\s)" + c + "(\\s|$)");
       return re.test(e.className);
     };
    
     me.addClass = function(e, c) {
       if (me.hasClass(e, c)) {
         return;
       }
    
       var newclass = e.className.split(' ');
       newclass.push(c);
       e.className = newclass.join(' ');
     };
    
     me.removeClass = function(e, c) {
       if (!me.hasClass(e, c)) {
         return;
       }
    
       var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g');
       e.className = e.className.replace(re, ' ');
     };
    
     me.offset = function(el) {
       var left = -el.offsetLeft,
         top = -el.offsetTop;
    
       // jshint -W084
       while (el = el.offsetParent) {
         left -= el.offsetLeft;
         top -= el.offsetTop;
       }
       // jshint +W084
    
       return {
         left: left,
         top: top
       };
     };
    
     me.preventDefaultException = function(el, exceptions) {
       for (var i in exceptions) {
         if (exceptions[i].test(el[i])) {
           return true;
         }
       }
    
       return false;
     };
    
     me.extend(me.eventType = {}, {
       touchstart: 1,
       touchmove: 1,
       touchend: 1,
    
       mousedown: 2,
       mousemove: 2,
       mouseup: 2,
    
       pointerdown: 3,
       pointermove: 3,
       pointerup: 3,
    
       MSPointerDown: 3,
       MSPointerMove: 3,
       MSPointerUp: 3
     });
    
     me.extend(me.ease = {}, {
       quadratic: {
         style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
         fn: function(k) {
           return k * ( 2 - k );
         }
       },
       circular: {
         style: 'cubic-bezier(0.1, 0.57, 0.1, 1)',	// Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1)
         fn: function(k) {
           return Math.sqrt(1 - ( --k * k ));
         }
       },
       back: {
         style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
         fn: function(k) {
           var b = 4;
           return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1;
         }
       },
       bounce: {
         style: ,
         fn: function(k) {
           if (( k /= 1 ) < ( 1 / 2.75 )) {
             return 7.5625 * k * k;
           } else if (k < ( 2 / 2.75 )) {
             return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
           } else if (k < ( 2.5 / 2.75 )) {
             return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
           } else {
             return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
           }
         }
       },
       elastic: {
         style: ,
         fn: function(k) {
           var f = 0.22,
             e = 0.4;
    
           if (k === 0) {
             return 0;
           }
           if (k == 1) {
             return 1;
           }
    
           return ( e * Math.pow(2, -10 * k) * Math.sin(( k - f / 4 ) * ( 2 * Math.PI ) / f) + 1 );
         }
       }
     });
    
     me.tap = function(e, eventName) {
       var ev = document.createEvent('Event');
       ev.initEvent(eventName, true, true);
       ev.pageX = e.pageX;
       ev.pageY = e.pageY;
       e.target.dispatchEvent(ev);
     };
    
     me.click = function(e) {
       var target = e.target,
         ev;
    
       if (!(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName)) {
         ev = document.createEvent('MouseEvents');
         ev.initMouseEvent('click', true, true, e.view, 1,
           target.screenX, target.screenY, target.clientX, target.clientY,
           e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
           0, null);
    
         ev._constructed = true;
         target.dispatchEvent(ev);
       }
     };
    
     return me;
    

    })();

    function IScroll(el, options) {

     this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
     this.scroller = this.wrapper.children[0];
     this.scrollerStyle = this.scroller.style;		// cache style for better performance
    
     this.options = {
    
       // INSERT POINT: OPTIONS
    
       startX: 0,
       startY: 0,
       scrollY: true,
       directionLockThreshold: 5,
       momentum: true,
    
       bounce: true,
       bounceTime: 600,
       bounceEasing: ,
    
       preventDefault: true,
       preventDefaultException: {tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/},
    
       HWCompositing: true,
       useTransition: true,
       useTransform: true
     };
    
     for (var i in options) {
       this.options[i] = options[i];
     }
    
     // Normalize options
     this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : ;
    
     this.options.useTransition = utils.hasTransition && this.options.useTransition;
     this.options.useTransform = utils.hasTransform && this.options.useTransform;
    
     this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough;
     this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault;
    
     // If you want eventPassthrough I have to lock one of the axes
     this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY;
     this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX;
    
     // With eventPassthrough we also need lockDirection mechanism
     this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
     this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;
    
     this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing;
    
     this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling;
    
     if (this.options.tap === true) {
       this.options.tap = 'tap';
     }
    
     // INSERT POINT: NORMALIZATION
    
     // Some defaults
     this.x = 0;
     this.y = 0;
     this.directionX = 0;
     this.directionY = 0;
     this._events = {};
    
     // INSERT POINT: DEFAULTS
    
     this._init();
     this.refresh();
    
     this.scrollTo(this.options.startX, this.options.startY);
     this.enable();
    

    }

    IScroll.prototype = {

     version: '5.1.3',
    
     _init: function() {
       this._initEvents();
    
       // INSERT POINT: _init
    
     },
    
     destroy: function() {
       this._initEvents(true);
    
       this._execEvent('destroy');
     },
    
     _transitionEnd: function(e) {
       if (e.target != this.scroller || !this.isInTransition) {
         return;
       }
    
       this._transitionTime();
       if (!this.resetPosition(this.options.bounceTime)) {
         this.isInTransition = false;
         this._execEvent('scrollEnd');
       }
     },
    
     _start: function(e) {
       // React to left mouse button only
       if (utils.eventType[e.type] != 1) {
         if (e.button !== 0) {
           return;
         }
       }
    
       if (!this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated)) {
         return;
       }
    
       if (this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException)) {
         e.preventDefault();
       }
    
       var point = e.touches ? e.touches[0] : e,
         pos;
    
       this.initiated = utils.eventType[e.type];
       this.moved = false;
       this.distX = 0;
       this.distY = 0;
       this.directionX = 0;
       this.directionY = 0;
       this.directionLocked = 0;
    
       this._transitionTime();
    
       this.startTime = utils.getTime();
    
       if (this.options.useTransition && this.isInTransition) {
         this.isInTransition = false;
         pos = this.getComputedPosition();
         this._translate(Math.round(pos.x), Math.round(pos.y));
         this._execEvent('scrollEnd');
       } else if (!this.options.useTransition && this.isAnimating) {
         this.isAnimating = false;
         this._execEvent('scrollEnd');
       }
    
       this.startX = this.x;
       this.startY = this.y;
       this.absStartX = this.x;
       this.absStartY = this.y;
       this.pointX = point.pageX;
       this.pointY = point.pageY;
    
       this._execEvent('beforeScrollStart');
     },
    
     _move: function(e) {
       if (!this.enabled || utils.eventType[e.type] !== this.initiated) {
         return;
       }
    
       if (this.options.preventDefault) {	// increases performance on Android? TODO: check!
         e.preventDefault();
       }
    
       var point = e.touches ? e.touches[0] : e,
         deltaX = point.pageX - this.pointX,
         deltaY = point.pageY - this.pointY,
         timestamp = utils.getTime(),
         newX, newY,
         absDistX, absDistY;
    
       this.pointX = point.pageX;
       this.pointY = point.pageY;
    
       this.distX += deltaX;
       this.distY += deltaY;
       absDistX = Math.abs(this.distX);
       absDistY = Math.abs(this.distY);
    
       // We need to move at least 10 pixels for the scrolling to initiate
       if (timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10)) {
         return;
       }
    
       // If you are scrolling in one direction lock the other
       if (!this.directionLocked && !this.options.freeScroll) {
         if (absDistX > absDistY + this.options.directionLockThreshold) {
           this.directionLocked = 'h';		// lock horizontally
         } else if (absDistY >= absDistX + this.options.directionLockThreshold) {
           this.directionLocked = 'v';		// lock vertically
         } else {
           this.directionLocked = 'n';		// no lock
         }
       }
    
       if (this.directionLocked == 'h') {
         if (this.options.eventPassthrough == 'vertical') {
           e.preventDefault();
         } else if (this.options.eventPassthrough == 'horizontal') {
           this.initiated = false;
           return;
         }
    
         deltaY = 0;
       } else if (this.directionLocked == 'v') {
         if (this.options.eventPassthrough == 'horizontal') {
           e.preventDefault();
         } else if (this.options.eventPassthrough == 'vertical') {
           this.initiated = false;
           return;
         }
    
         deltaX = 0;
       }
    
       deltaX = this.hasHorizontalScroll ? deltaX : 0;
       deltaY = this.hasVerticalScroll ? deltaY : 0;
    
       newX = this.x + deltaX;
       newY = this.y + deltaY;
    
       // Slow down if outside of the boundaries
       if (newX > 0 || newX < this.maxScrollX) {
         newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX;
       }
       if (newY > 0 || newY < this.maxScrollY) {
         newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY;
       }
    
       this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
       this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
    
       if (!this.moved) {
         this._execEvent('scrollStart');
       }
    
       this.moved = true;
    
       this._translate(newX, newY);
    
       /* REPLACE START: _move */
    
       if (timestamp - this.startTime > 300) {
         this.startTime = timestamp;
         this.startX = this.x;
         this.startY = this.y;
       }
    
       /* REPLACE END: _move */
    
     },
    
     _end: function(e) {
       if (!this.enabled || utils.eventType[e.type] !== this.initiated) {
         return;
       }
    
       if (this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException)) {
         e.preventDefault();
       }
    
       var point = e.changedTouches ? e.changedTouches[0] : e,
         momentumX,
         momentumY,
         duration = utils.getTime() - this.startTime,
         newX = Math.round(this.x),
         newY = Math.round(this.y),
         distanceX = Math.abs(newX - this.startX),
         distanceY = Math.abs(newY - this.startY),
         time = 0,
         easing = ;
    
       this.isInTransition = 0;
       this.initiated = 0;
       this.endTime = utils.getTime();
    
       // reset if we are outside of the boundaries
       if (this.resetPosition(this.options.bounceTime)) {
         return;
       }
    
       this.scrollTo(newX, newY);	// ensures that the last position is rounded
    
       // we scrolled less than 10 pixels
       if (!this.moved) {
         if (this.options.tap) {
           utils.tap(e, this.options.tap);
         }
    
         if (this.options.click) {
           utils.click(e);
         }
    
         this._execEvent('scrollCancel');
         return;
       }
    
       if (this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100) {
         this._execEvent('flick');
         return;
       }
    
       // start momentum animation if needed
       if (this.options.momentum && duration < 300) {
         momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : {
           destination: newX,
           duration: 0
         };
         momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : {
           destination: newY,
           duration: 0
         };
         newX = momentumX.destination;
         newY = momentumY.destination;
         time = Math.max(momentumX.duration, momentumY.duration);
         this.isInTransition = 1;
       }
    
       // INSERT POINT: _end
    
       if (newX != this.x || newY != this.y) {
         // change easing function when scroller goes out of the boundaries
         if (newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY) {
           easing = utils.ease.quadratic;
         }
    
         this.scrollTo(newX, newY, time, easing);
         return;
       }
    
       this._execEvent('scrollEnd');
     },
    
     _resize: function() {
       var that = this;
    
       clearTimeout(this.resizeTimeout);
    
       this.resizeTimeout = setTimeout(function() {
         that.refresh();
       }, this.options.resizePolling);
     },
    
     resetPosition: function(time) {
       var x = this.x,
         y = this.y;
    
       time = time || 0;
    
       if (!this.hasHorizontalScroll || this.x > 0) {
         x = 0;
       } else if (this.x < this.maxScrollX) {
         x = this.maxScrollX;
       }
    
       if (!this.hasVerticalScroll || this.y > 0) {
         y = 0;
       } else if (this.y < this.maxScrollY) {
         y = this.maxScrollY;
       }
    
       if (x == this.x && y == this.y) {
         return false;
       }
    
       this.scrollTo(x, y, time, this.options.bounceEasing);
    
       return true;
     },
    
     disable: function() {
       this.enabled = false;
     },
    
     enable: function() {
       this.enabled = true;
     },
    
     refresh: function() {
       var rf = this.wrapper.offsetHeight;		// Force reflow
    
       this.wrapperWidth = this.wrapper.clientWidth;
       this.wrapperHeight = this.wrapper.clientHeight;
    
       /* REPLACE START: refresh */
    
       this.scrollerWidth = this.scroller.offsetWidth;
       this.scrollerHeight = this.scroller.offsetHeight;
    
       this.maxScrollX = this.wrapperWidth - this.scrollerWidth;
       this.maxScrollY = this.wrapperHeight - this.scrollerHeight;
    
       /* REPLACE END: refresh */
    
       this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0;
       this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0;
    
       if (!this.hasHorizontalScroll) {
         this.maxScrollX = 0;
         this.scrollerWidth = this.wrapperWidth;
       }
    
       if (!this.hasVerticalScroll) {
         this.maxScrollY = 0;
         this.scrollerHeight = this.wrapperHeight;
       }
    
       this.endTime = 0;
       this.directionX = 0;
       this.directionY = 0;
    
       this.wrapperOffset = utils.offset(this.wrapper);
    
       this._execEvent('refresh');
    
       this.resetPosition();
    
       // INSERT POINT: _refresh
    
     },
    
     on: function(type, fn) {
       if (!this._events[type]) {
         this._events[type] = [];
       }
    
       this._events[type].push(fn);
     },
    
     off: function(type, fn) {
       if (!this._events[type]) {
         return;
       }
    
       var index = this._events[type].indexOf(fn);
    
       if (index > -1) {
         this._events[type].splice(index, 1);
       }
     },
    
     _execEvent: function(type) {
       if (!this._events[type]) {
         return;
       }
    
       var i = 0,
         l = this._events[type].length;
    
       if (!l) {
         return;
       }
    
       for (; i < l; i++) {
         this._events[type][i].apply(this, [].slice.call(arguments, 1));
       }
     },
    
     scrollBy: function(x, y, time, easing) {
       x = this.x + x;
       y = this.y + y;
       time = time || 0;
    
       this.scrollTo(x, y, time, easing);
     },
    
     scrollTo: function(x, y, time, easing) {
       easing = easing || utils.ease.circular;
    
       this.isInTransition = this.options.useTransition && time > 0;
    
       if (!time || (this.options.useTransition && easing.style)) {
         this._transitionTimingFunction(easing.style);
         this._transitionTime(time);
         this._translate(x, y);
       } else {
         this._animate(x, y, time, easing.fn);
       }
     },
    
     scrollToElement: function(el, time, offsetX, offsetY, easing) {
       el = el.nodeType ? el : this.scroller.querySelector(el);
    
       if (!el) {
         return;
       }
    
       var pos = utils.offset(el);
    
       pos.left -= this.wrapperOffset.left;
       pos.top -= this.wrapperOffset.top;
    
       // if offsetX/Y are true we center the element to the screen
       if (offsetX === true) {
         offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2);
       }
       if (offsetY === true) {
         offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2);
       }
    
       pos.left -= offsetX || 0;
       pos.top -= offsetY || 0;
    
       pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left;
       pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top;
    
       time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x - pos.left), Math.abs(this.y - pos.top)) : time;
    
       this.scrollTo(pos.left, pos.top, time, easing);
     },
    
     _transitionTime: function(time) {
       time = time || 0;
    
       this.scrollerStyle[utils.style.transitionDuration] = time + 'ms';
    
       if (!time && utils.isBadAndroid) {
         this.scrollerStyle[utils.style.transitionDuration] = '0.001s';
       }
    
       // INSERT POINT: _transitionTime
    
     },
    
     _transitionTimingFunction: function(easing) {
       this.scrollerStyle[utils.style.transitionTimingFunction] = easing;
    
       // INSERT POINT: _transitionTimingFunction
    
     },
    
     _translate: function(x, y) {
       if (this.options.useTransform) {
    
         /* REPLACE START: _translate */
    
         this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ;
    
         /* REPLACE END: _translate */
    
       } else {
         x = Math.round(x);
         y = Math.round(y);
         this.scrollerStyle.left = x + 'px';
         this.scrollerStyle.top = y + 'px';
       }
    
       this.x = x;
       this.y = y;
    
       // INSERT POINT: _translate
    
     },
    
     _initEvents: function(remove) {
       var eventType = remove ? utils.removeEvent : utils.addEvent,
         target = this.options.bindToWrapper ? this.wrapper : window;
    
       eventType(window, 'orientationchange', this);
       eventType(window, 'resize', this);
    
       if (this.options.click) {
         eventType(this.wrapper, 'click', this, true);
       }
    
       if (!this.options.disableMouse) {
         eventType(this.wrapper, 'mousedown', this);
         eventType(target, 'mousemove', this);
         eventType(target, 'mousecancel', this);
         eventType(target, 'mouseup', this);
       }
    
       if (utils.hasPointer && !this.options.disablePointer) {
         eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this);
         eventType(target, utils.prefixPointerEvent('pointermove'), this);
         eventType(target, utils.prefixPointerEvent('pointercancel'), this);
         eventType(target, utils.prefixPointerEvent('pointerup'), this);
       }
    
       if (utils.hasTouch && !this.options.disableTouch) {
         eventType(this.wrapper, 'touchstart', this);
         eventType(target, 'touchmove', this);
         eventType(target, 'touchcancel', this);
         eventType(target, 'touchend', this);
       }
    
       eventType(this.scroller, 'transitionend', this);
       eventType(this.scroller, 'webkitTransitionEnd', this);
       eventType(this.scroller, 'oTransitionEnd', this);
       eventType(this.scroller, 'MSTransitionEnd', this);
     },
    
     getComputedPosition: function() {
       var matrix = window.getComputedStyle(this.scroller, null),
         x, y;
    
       if (this.options.useTransform) {
         matrix = matrix[utils.style.transform].split(')')[0].split(', ');
         x = +(matrix[12] || matrix[4]);
         y = +(matrix[13] || matrix[5]);
       } else {
         x = +matrix.left.replace(/[^-\d.]/g, );
         y = +matrix.top.replace(/[^-\d.]/g, );
       }
    
       return {x: x, y: y};
     },
    
     _animate: function(destX, destY, duration, easingFn) {
       var that = this,
         startX = this.x,
         startY = this.y,
         startTime = utils.getTime(),
         destTime = startTime + duration;
    
       function step() {
         var now = utils.getTime(),
           newX, newY,
           easing;
    
         if (now >= destTime) {
           that.isAnimating = false;
           that._translate(destX, destY);
    
           if (!that.resetPosition(that.options.bounceTime)) {
             that._execEvent('scrollEnd');
           }
    
           return;
         }
    
         now = ( now - startTime ) / duration;
         easing = easingFn(now);
         newX = ( destX - startX ) * easing + startX;
         newY = ( destY - startY ) * easing + startY;
         that._translate(newX, newY);
    
         if (that.isAnimating) {
           rAF(step);
         }
       }
    
       this.isAnimating = true;
       step();
     },
     handleEvent: function(e) {
       switch (e.type) {
         case 'touchstart':
         case 'pointerdown':
         case 'MSPointerDown':
         case 'mousedown':
           this._start(e);
           break;
         case 'touchmove':
         case 'pointermove':
         case 'MSPointerMove':
         case 'mousemove':
           this._move(e);
           break;
         case 'touchend':
         case 'pointerup':
         case 'MSPointerUp':
         case 'mouseup':
         case 'touchcancel':
         case 'pointercancel':
         case 'MSPointerCancel':
         case 'mousecancel':
           this._end(e);
           break;
         case 'orientationchange':
         case 'resize':
           this._resize();
           break;
         case 'transitionend':
         case 'webkitTransitionEnd':
         case 'oTransitionEnd':
         case 'MSTransitionEnd':
           this._transitionEnd(e);
           break;
         case 'wheel':
         case 'DOMMouseScroll':
         case 'mousewheel':
           this._wheel(e);
           break;
         case 'keydown':
           this._key(e);
           break;
         case 'click':
           if (!e._constructed) {
             e.preventDefault();
             e.stopPropagation();
           }
           break;
       }
     }
    

    };

    IScroll.utils = utils;

    module.exports = UI.iScroll = IScroll;

    /* jshint unused: true */ /* jshint +W101, +W116, +W109 */

    },{"2":2}],12:[function(_dereq_,module,exports){ 'use strict';

    var $ = (window.jQuery); var UI = _dereq_(2); var dimmer = _dereq_(8); var $doc = $(document); var supportTransition = UI.support.transition;

    /**

    * @reference https://github.com/nolimits4web/Framework7/blob/master/src/js/modals.js
    * @license https://github.com/nolimits4web/Framework7/blob/master/LICENSE
    */
    

    var Modal = function(element, options) {

     this.options = $.extend({}, Modal.DEFAULTS, options || {});
     this.$element = $(element);
     this.$dialog =   this.$element.find('.am-modal-dialog');
    
     if (!this.$element.attr('id')) {
       this.$element.attr('id', UI.utils.generateGUID('am-modal'));
     }
    
     this.isPopup = this.$element.hasClass('am-popup');
     this.isActions = this.$element.hasClass('am-modal-actions');
     this.isPrompt = this.$element.hasClass('am-modal-prompt');
     this.isLoading = this.$element.hasClass('am-modal-loading');
     this.active = this.transitioning = this.relatedTarget = null;
    
     this.events();
    

    };

    Modal.DEFAULTS = {

     className: {
       active: 'am-modal-active',
       out: 'am-modal-out'
     },
     selector: {
       modal: '.am-modal',
       active: '.am-modal-active'
     },
     closeViaDimmer: true,
     cancelable: true,
     onConfirm: function() {
     },
     onCancel: function() {
     },
     closeOnCancel: true,
     closeOnConfirm: true,
     height: undefined,
     width: undefined,
     duration: 300, // must equal the CSS transition duration
     transitionEnd: supportTransition && supportTransition.end + '.modal.amui'
    

    };

    Modal.prototype.toggle = function(relatedTarget) {

     return this.active ? this.close() : this.open(relatedTarget);
    

    };

    Modal.prototype.open = function(relatedTarget) {

     var $element = this.$element;
     var options = this.options;
     var isPopup = this.isPopup;
     var width = options.width;
     var height = options.height;
     var style = {};
    
     if (this.active) {
       return;
     }
    
     if (!this.$element.length) {
       return;
     }
    
     // callback hook
     relatedTarget && (this.relatedTarget = relatedTarget);
    
     // 判断如果还在动画,就先触发之前的closed事件
     if (this.transitioning) {
       clearTimeout($element.transitionEndTimmer);
       $element.transitionEndTimmer = null;
       $element.trigger(options.transitionEnd).off(options.transitionEnd);
     }
    
     isPopup && this.$element.show();
    
     this.active = true;
    
     $element.trigger($.Event('open.modal.amui', {relatedTarget: relatedTarget}));
    
     dimmer.open($element);
    
     $element.show().redraw();
    
     // apply Modal width/height if set
     if (!isPopup && !this.isActions) {
       if (width) {
         width = parseInt(width, 10);
         style.width =  width + 'px';
         style.marginLeft =  -parseInt(width / 2) + 'px';
       }
    
       if (height) {
         height = parseInt(height, 10);
         // style.height = height + 'px';
         style.marginTop = -parseInt(height / 2) + 'px';
    
         // the background color is styled to $dialog
         // so the height should set to $dialog
         this.$dialog.css({height: height + 'px'});
       } else {
         style.marginTop = -parseInt($element.height() / 2, 10) + 'px';
       }
    
       $element.css(style);
     }
    
     $element.
       removeClass(options.className.out).
       addClass(options.className.active);
    
     this.transitioning = 1;
    
     var complete = function() {
       $element.trigger($.Event('opened.modal.amui',
         {relatedTarget: relatedTarget}));
       this.transitioning = 0;
    
       // Prompt auto focus
       if (this.isPrompt) {
         this.$dialog.find('input').eq(0).focus();
       }
     };
    
     if (!supportTransition) {
       return complete.call(this);
     }
    
     $element.
       one(options.transitionEnd, $.proxy(complete, this)).
       emulateTransitionEnd(options.duration);
    

    };

    Modal.prototype.close = function(relatedTarget) {

     if (!this.active) {
       return;
     }
    
     var $element = this.$element;
     var options = this.options;
     var isPopup = this.isPopup;
    
     // 判断如果还在动画,就先触发之前的opened事件
     if (this.transitioning) {
       clearTimeout($element.transitionEndTimmer);
       $element.transitionEndTimmer = null;
       $element.trigger(options.transitionEnd).off(options.transitionEnd);
       dimmer.close($element, true);
     }
    
     this.$element.trigger($.Event('close.modal.amui',
       {relatedTarget: relatedTarget}));
    
     this.transitioning = 1;
    
     var complete = function() {
       $element.trigger('closed.modal.amui');
       isPopup && $element.removeClass(options.className.out);
       $element.hide();
       this.transitioning = 0;
       // 不强制关闭 Dimmer,以便多个 Modal 可以共享 Dimmer
       dimmer.close($element, false);
       this.active = false;
     };
    
     $element.removeClass(options.className.active).
       addClass(options.className.out);
    
     if (!supportTransition) {
       return complete.call(this);
     }
    
     $element.one(options.transitionEnd, $.proxy(complete, this)).
       emulateTransitionEnd(options.duration);
    

    };

    Modal.prototype.events = function() {

     var options = this.options;
     var _this = this;
     var $element = this.$element;
     var $ipt = $element.find('.am-modal-prompt-input');
     var $confirm = $element.find('[data-am-modal-confirm]');
     var $cancel = $element.find('[data-am-modal-cancel]');
     var getData = function() {
       var data = [];
       $ipt.each(function() {
         data.push($(this).val());
       });
    
       return (data.length === 0) ? undefined :
         ((data.length === 1) ? data[0] : data);
     };
    
     // close via Esc key
     if (this.options.cancelable) {
       $element.on('keyup.modal.amui', function(e) {
           if (_this.active && e.which === 27) {
             $element.trigger('cancel.modal.amui');
             _this.close();
           }
         });
     }
    
     // Close Modal when dimmer clicked
     if (this.options.closeViaDimmer && !this.isLoading) {
       dimmer.$element.on('click.dimmer.modal.amui', function(e) {
         _this.close();
       });
     }
    
     // Close Modal when button clicked
     $element.find('[data-am-modal-close], .am-modal-btn').
       on('click.close.modal.amui', function(e) {
         e.preventDefault();
         var $this = $(this);
    
         if ($this.is($confirm)) {
           console.log('sdafdf');
           options.closeOnConfirm && _this.close();
         } else if ($this.is($cancel)) {
           options.closeOnCancel && _this.close();
         } else {
           _this.close();
         }
       });
    
     $confirm.on('click.confirm.modal.amui',
       function() {
         $element.trigger($.Event('confirm.modal.amui', {
           trigger: this
         }));
       });
    
     $cancel.on('click.cancel.modal.amui', function() {
         $element.trigger($.Event('cancel.modal.amui', {
           trigger: this
         }));
       });
    
     $element.on('confirm.modal.amui', function(e) {
       e.data = getData();
       _this.options.onConfirm.call(_this, e);
     }).on('cancel.modal.amui', function(e) {
       e.data = getData();
       _this.options.onCancel.call(_this, e);
     });
    

    };

    function Plugin(option, relatedTarget) {

     return this.each(function() {
       var $this = $(this);
       var data = $this.data('amui.modal');
       var options = typeof option == 'object' && option;
    
       if (!data) {
         $this.data('amui.modal', (data = new Modal(this, options)));
       }
    
       if (typeof option == 'string') {
         data[option] && data[option](relatedTarget);
       } else {
         data.toggle(option && option.relatedTarget || undefined);
       }
     });
    

    }

    $.fn.modal = Plugin;

    // Init $doc.on('click.modal.amui.data-api', '[data-am-modal]', function() {

     var $this = $(this);
     var options = UI.utils.parseOptions($this.attr('data-am-modal'));
     var $target = $(options.target ||
     (this.href && this.href.replace(/.*(?=#[^\s]+$)/, )));
     var option = $target.data('amui.modal') ? 'toggle' : options;
    
     Plugin.call($target, option, this);
    

    });

    module.exports = UI.modal = Modal;

    },{"2":2,"8":8}],13:[function(_dereq_,module,exports){ 'use strict';

    var $ = (window.jQuery); var UI = _dereq_(2); _dereq_(30);

    var $win = $(window); var $doc = $(document); var scrollPos;

    /**

    * @via https://github.com/uikit/uikit/blob/master/src/js/offcanvas.js
    * @license https://github.com/uikit/uikit/blob/master/LICENSE.md
    */
    

    var OffCanvas = function(element, options) {

     this.$element = $(element);
     this.options = $.extend({}, OffCanvas.DEFAULTS, options);
     this.active = null;
     this.bindEvents();
    

    };

    OffCanvas.DEFAULTS = {

     duration: 300,
     effect: 'overlay' // {push|overlay}, push is too expensive
    

    };

    OffCanvas.prototype.open = function(relatedElement) {

     var _this = this;
     var $element = this.$element;
    
     if (!$element.length || $element.hasClass('am-active')) {
       return;
     }
    
     var effect = this.options.effect;
     var $html = $('html');
     var $body = $('body');
     var $bar = $element.find('.am-offcanvas-bar').first();
     var dir = $bar.hasClass('am-offcanvas-bar-flip') ? -1 : 1;
    
     $bar.addClass('am-offcanvas-bar-' + effect);
    
     scrollPos = {x: window.scrollX, y: window.scrollY};
    
     $element.addClass('am-active');
    
     $body.css({
       width: window.innerWidth,
       height: $win.height()
     }).addClass('am-offcanvas-page');
    
     if (effect !== 'overlay') {
       $body.css({
         'margin-left': $bar.outerWidth() * dir
       }).width(); // force redraw
     }
    
     $html.css('margin-top', scrollPos.y * -1);
    
     setTimeout(function() {
       $bar.addClass('am-offcanvas-bar-active').width();
     }, 0);
    
     $element.trigger('open.offcanvas.amui');
    
     this.active = 1;
    
     // Close OffCanvas when none content area clicked
     $element.on('click.offcanvas.amui', function(e) {
       var $target = $(e.target);
    
       if ($target.hasClass('am-offcanvas-bar')) {
         return;
       }
    
       if ($target.parents('.am-offcanvas-bar').first().length) {
         return;
       }
    
       // https://developer.mozilla.org/zh-CN/docs/DOM/event.stopImmediatePropagation
       e.stopImmediatePropagation();
    
       _this.close();
     });
    
     $html.on('keydown.offcanvas.amui', function(e) {
       (e.keyCode === 27) && _this.close();
     });
    

    };

    OffCanvas.prototype.close = function(relatedElement) {

     var _this = this;
     var $html = $('html');
     var $body = $('body');
     var $element = this.$element;
     var $bar = $element.find('.am-offcanvas-bar').first();
    
     if (!$element.length || !this.active || !$element.hasClass('am-active')) {
       return;
     }
    
     $element.trigger('close.offcanvas.amui');
    
     function complete() {
       $body
         .removeClass('am-offcanvas-page')
         .css({
           width: ,
           height: ,
           'margin-left': ,
           'margin-right': 
         });
       $element.removeClass('am-active');
       $bar.removeClass('am-offcanvas-bar-active');
       $html.css('margin-top', );
       window.scrollTo(scrollPos.x, scrollPos.y);
       $element.trigger('closed.offcanvas.amui');
       _this.active = 0;
     }
    
     if (UI.support.transition) {
       setTimeout(function() {
         $bar.removeClass('am-offcanvas-bar-active');
       }, 0);
    
       $body.css('margin-left', ).one(UI.support.transition.end, function() {
         complete();
       }).emulateTransitionEnd(this.options.duration);
     } else {
       complete();
     }
    
     $element.off('click.offcanvas.amui');
     $html.off('.offcanvas.amui');
    

    };

    OffCanvas.prototype.bindEvents = function() {

     var _this = this;
     $doc.on('click.offcanvas.amui', '[data-am-dismiss="offcanvas"]', function(e) {
         e.preventDefault();
         _this.close();
       });
    
     $win.on('resize.offcanvas.amui orientationchange.offcanvas.amui',
       function() {
         _this.active && _this.close();
       });
    
     this.$element.hammer().on('swipeleft swipeleft', function(e) {
       e.preventDefault();
       _this.close();
     });
    
     return this;
    

    };

    function Plugin(option, relatedElement) {

     var args = Array.prototype.slice.call(arguments, 1);
    
     return this.each(function() {
       var $this = $(this);
       var data = $this.data('amui.offcanvas');
       var options = $.extend({}, typeof option == 'object' && option);
    
       if (!data) {
         $this.data('amui.offcanvas', (data = new OffCanvas(this, options)));
         (!option || typeof option == 'object') && data.open(relatedElement);
       }
    
       if (typeof option == 'string') {
         data[option] && data[option].apply(data, args);
       }
     });
    

    }

    $.fn.offCanvas = Plugin;

    // Init code $doc.on('click.offcanvas.amui', '[data-am-offcanvas]', function(e) {

     e.preventDefault();
     var $this = $(this);
     var options = UI.utils.parseOptions($this.data('amOffcanvas'));
     var $target = $(options.target ||
     (this.href && this.href.replace(/.*(?=#[^\s]+$)/, )));
     var option = $target.data('amui.offcanvas') ? 'open' : options;
    
     Plugin.call($target, option, this);
    

    });

    module.exports = UI.offcanvas = OffCanvas;

    // TODO: 优化动画效果 // http://dbushell.github.io/Responsive-Off-Canvas-Menu/step4.html

    },{"2":2,"30":30}],14:[function(_dereq_,module,exports){ 'use strict';

    var $ = (window.jQuery); var UI = _dereq_(2);

    /**

    * @via https://github.com/manuelstofer/pinchzoom/blob/master/src/pinchzoom.js
    * @license the MIT License.
    */
    

    var definePinchZoom = function($) {

     /**
      * Pinch zoom using jQuery
      * @version 0.0.2
      * @author Manuel Stofer <mst@rtp.ch>
      * @param el
      * @param options
      * @constructor
      */
     var PinchZoom = function(el, options) {
         this.el = $(el);
         this.zoomFactor = 1;
         this.lastScale = 1;
         this.offset = {
           x: 0,
           y: 0
         };
         this.options = $.extend({}, this.defaults, options);
         this.setupMarkup();
         this.bindEvents();
         this.update();
         // default enable.
         this.enable();
    
       },
       sum = function(a, b) {
         return a + b;
       },
       isCloseTo = function(value, expected) {
         return value > expected - 0.01 && value < expected + 0.01;
       };
    
     PinchZoom.prototype = {
    
       defaults: {
         tapZoomFactor: 2,
         zoomOutFactor: 1.3,
         animationDuration: 300,
         animationInterval: 5,
         maxZoom: 5,
         minZoom: 0.5,
         lockDragAxis: false,
         use2d: false,
         zoomStartEventName: 'pz_zoomstart',
         zoomEndEventName: 'pz_zoomend',
         dragStartEventName: 'pz_dragstart',
         dragEndEventName: 'pz_dragend',
         doubleTapEventName: 'pz_doubletap'
       },
    
       /**
        * Event handler for 'dragstart'
        * @param event
        */
       handleDragStart: function(event) {
         this.el.trigger(this.options.dragStartEventName);
         this.stopAnimation();
         this.lastDragPosition = false;
         this.hasInteraction = true;
         this.handleDrag(event);
       },
    
       /**
        * Event handler for 'drag'
        * @param event
        */
       handleDrag: function(event) {
    
         if (this.zoomFactor > 1.0) {
           var touch = this.getTouches(event)[0];
           this.drag(touch, this.lastDragPosition);
           this.offset = this.sanitizeOffset(this.offset);
           this.lastDragPosition = touch;
         }
       },
    
       handleDragEnd: function() {
         this.el.trigger(this.options.dragEndEventName);
         this.end();
       },
    
       /**
        * Event handler for 'zoomstart'
        * @param event
        */
       handleZoomStart: function(event) {
         this.el.trigger(this.options.zoomStartEventName);
         this.stopAnimation();
         this.lastScale = 1;
         this.nthZoom = 0;
         this.lastZoomCenter = false;
         this.hasInteraction = true;
       },
    
       /**
        * Event handler for 'zoom'
        * @param event
        */
       handleZoom: function(event, newScale) {
    
         // a relative scale factor is used
         var touchCenter = this.getTouchCenter(this.getTouches(event)),
           scale = newScale / this.lastScale;
         this.lastScale = newScale;
    
         // the first touch events are thrown away since they are not precise
         this.nthZoom += 1;
         if (this.nthZoom > 3) {
    
           this.scale(scale, touchCenter);
           this.drag(touchCenter, this.lastZoomCenter);
         }
         this.lastZoomCenter = touchCenter;
       },
    
       handleZoomEnd: function() {
         this.el.trigger(this.options.zoomEndEventName);
         this.end();
       },
    
       /**
        * Event handler for 'doubletap'
        * @param event
        */
       handleDoubleTap: function(event) {
         var center = this.getTouches(event)[0],
           zoomFactor = this.zoomFactor > 1 ? 1 : this.options.tapZoomFactor,
           startZoomFactor = this.zoomFactor,
           updateProgress = (function(progress) {
             this.scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);
           }).bind(this);
    
         if (this.hasInteraction) {
           return;
         }
         if (startZoomFactor > zoomFactor) {
           center = this.getCurrentZoomCenter();
         }
    
         this.animate(this.options.animationDuration, this.options.animationInterval, updateProgress, this.swing);
         this.el.trigger(this.options.doubleTapEventName);
       },
    
       /**
        * Max / min values for the offset
        * @param offset
        * @return {Object} the sanitized offset
        */
       sanitizeOffset: function(offset) {
         var maxX = (this.zoomFactor - 1) * this.getContainerX(),
           maxY = (this.zoomFactor - 1) * this.getContainerY(),
           maxOffsetX = Math.max(maxX, 0),
           maxOffsetY = Math.max(maxY, 0),
           minOffsetX = Math.min(maxX, 0),
           minOffsetY = Math.min(maxY, 0);
    
         return {
           x: Math.min(Math.max(offset.x, minOffsetX), maxOffsetX),
           y: Math.min(Math.max(offset.y, minOffsetY), maxOffsetY)
         };
       },
    
       /**
        * Scale to a specific zoom factor (not relative)
        * @param zoomFactor
        * @param center
        */
       scaleTo: function(zoomFactor, center) {
         this.scale(zoomFactor / this.zoomFactor, center);
       },
    
       /**
        * Scales the element from specified center
        * @param scale
        * @param center
        */
       scale: function(scale, center) {
         scale = this.scaleZoomFactor(scale);
         this.addOffset({
           x: (scale - 1) * (center.x + this.offset.x),
           y: (scale - 1) * (center.y + this.offset.y)
         });
       },
    
       /**
        * Scales the zoom factor relative to current state
        * @param scale
        * @return the actual scale (can differ because of max min zoom factor)
        */
       scaleZoomFactor: function(scale) {
         var originalZoomFactor = this.zoomFactor;
         this.zoomFactor *= scale;
         this.zoomFactor = Math.min(this.options.maxZoom, Math.max(this.zoomFactor, this.options.minZoom));
         return this.zoomFactor / originalZoomFactor;
       },
    
       /**
        * Drags the element
        * @param center
        * @param lastCenter
        */
       drag: function(center, lastCenter) {
         if (lastCenter) {
           if (this.options.lockDragAxis) {
             // lock scroll to position that was changed the most
             if (Math.abs(center.x - lastCenter.x) > Math.abs(center.y - lastCenter.y)) {
               this.addOffset({
                 x: -(center.x - lastCenter.x),
                 y: 0
               });
             }
             else {
               this.addOffset({
                 y: -(center.y - lastCenter.y),
                 x: 0
               });
             }
           }
           else {
             this.addOffset({
               y: -(center.y - lastCenter.y),
               x: -(center.x - lastCenter.x)
             });
           }
         }
       },
    
       /**
        * Calculates the touch center of multiple touches
        * @param touches
        * @return {Object}
        */
       getTouchCenter: function(touches) {
         return this.getVectorAvg(touches);
       },
    
       /**
        * Calculates the average of multiple vectors (x, y values)
        */
       getVectorAvg: function(vectors) {
         return {
           x: vectors.map(function(v) {
             return v.x;
           }).reduce(sum) / vectors.length,
           y: vectors.map(function(v) {
             return v.y;
           }).reduce(sum) / vectors.length
         };
       },
    
       /**
        * Adds an offset
        * @param offset the offset to add
        * @return return true when the offset change was accepted
        */
       addOffset: function(offset) {
         this.offset = {
           x: this.offset.x + offset.x,
           y: this.offset.y + offset.y
         };
       },
    
       sanitize: function() {
         if (this.zoomFactor < this.options.zoomOutFactor) {
           this.zoomOutAnimation();
         } else if (this.isInsaneOffset(this.offset)) {
           this.sanitizeOffsetAnimation();
         }
       },
    
       /**
        * Checks if the offset is ok with the current zoom factor
        * @param offset
        * @return {Boolean}
        */
       isInsaneOffset: function(offset) {
         var sanitizedOffset = this.sanitizeOffset(offset);
         return sanitizedOffset.x !== offset.x ||
           sanitizedOffset.y !== offset.y;
       },
    
       /**
        * Creates an animation moving to a sane offset
        */
       sanitizeOffsetAnimation: function() {
         var targetOffset = this.sanitizeOffset(this.offset),
           startOffset = {
             x: this.offset.x,
             y: this.offset.y
           },
           updateProgress = (function(progress) {
             this.offset.x = startOffset.x + progress * (targetOffset.x - startOffset.x);
             this.offset.y = startOffset.y + progress * (targetOffset.y - startOffset.y);
             this.update();
           }).bind(this);
    
         this.animate(
           this.options.animationDuration,
           this.options.animationInterval,
           updateProgress,
           this.swing
         );
       },
    
       /**
        * Zooms back to the original position,
        * (no offset and zoom factor 1)
        */
       zoomOutAnimation: function() {
         var startZoomFactor = this.zoomFactor,
           zoomFactor = 1,
           center = this.getCurrentZoomCenter(),
           updateProgress = (function(progress) {
             this.scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);
           }).bind(this);
    
         this.animate(
           this.options.animationDuration,
           this.options.animationInterval,
           updateProgress,
           this.swing
         );
       },
    
       /**
        * Updates the aspect ratio
        */
       updateAspectRatio: function() {
         // this.setContainerY(this.getContainerX() / this.getAspectRatio());
         // @modified
         this.setContainerY()
       },
    
       /**
        * Calculates the initial zoom factor (for the element to fit into the container)
        * @return the initial zoom factor
        */
       getInitialZoomFactor: function() {
         // use .offsetWidth instead of width()
         // because jQuery-width() return the original width but Zepto-width() will calculate width with transform.
         // the same as .height()
         return this.container[0].offsetWidth / this.el[0].offsetWidth;
       },
    
       /**
        * Calculates the aspect ratio of the element
        * @return the aspect ratio
        */
       getAspectRatio: function() {
         return this.el[0].offsetWidth / this.el[0].offsetHeight;
       },
    
       /**
        * Calculates the virtual zoom center for the current offset and zoom factor
        * (used for reverse zoom)
        * @return {Object} the current zoom center
        */
       getCurrentZoomCenter: function() {
    
         // uses following formula to calculate the zoom center x value
         // offset_left / offset_right = zoomcenter_x / (container_x - zoomcenter_x)
         var length = this.container[0].offsetWidth * this.zoomFactor,
           offsetLeft = this.offset.x,
           offsetRight = length - offsetLeft - this.container[0].offsetWidth,
           widthOffsetRatio = offsetLeft / offsetRight,
           centerX = widthOffsetRatio * this.container[0].offsetWidth / (widthOffsetRatio + 1),
    
         // the same for the zoomcenter y
           height = this.container[0].offsetHeight * this.zoomFactor,
           offsetTop = this.offset.y,
           offsetBottom = height - offsetTop - this.container[0].offsetHeight,
           heightOffsetRatio = offsetTop / offsetBottom,
           centerY = heightOffsetRatio * this.container[0].offsetHeight / (heightOffsetRatio + 1);
    
         // prevents division by zero
         if (offsetRight === 0) {
           centerX = this.container[0].offsetWidth;
         }
         if (offsetBottom === 0) {
           centerY = this.container[0].offsetHeight;
         }
    
         return {
           x: centerX,
           y: centerY
         };
       },
    
       canDrag: function() {
         return !isCloseTo(this.zoomFactor, 1);
       },
    
       /**
        * Returns the touches of an event relative to the container offset
        * @param event
        * @return array touches
        */
       getTouches: function(event) {
         var position = this.container.offset();
         return Array.prototype.slice.call(event.touches).map(function(touch) {
           return {
             x: touch.pageX - position.left,
             y: touch.pageY - position.top
           };
         });
       },
    
       /**
        * Animation loop
        * does not support simultaneous animations
        * @param duration
        * @param interval
        * @param framefn
        * @param timefn
        * @param callback
        */
       animate: function(duration, interval, framefn, timefn, callback) {
         var startTime = new Date().getTime(),
           renderFrame = (function() {
             if (!this.inAnimation) {
               return;
             }
             var frameTime = new Date().getTime() - startTime,
               progress = frameTime / duration;
             if (frameTime >= duration) {
               framefn(1);
               if (callback) {
                 callback();
               }
               this.update();
               this.stopAnimation();
               this.update();
             } else {
               if (timefn) {
                 progress = timefn(progress);
               }
               framefn(progress);
               this.update();
               setTimeout(renderFrame, interval);
             }
           }).bind(this);
         this.inAnimation = true;
         renderFrame();
       },
    
       /**
        * Stops the animation
        */
       stopAnimation: function() {
         this.inAnimation = false;
       },
    
       /**
        * Swing timing function for animations
        * @param p
        * @return {Number}
        */
       swing: function(p) {
         return -Math.cos(p * Math.PI) / 2 + 0.5;
       },
    
       getContainerX: function() {
         // return this.container[0].offsetWidth;
         // @modified
         return window.innerWidth
       },
    
       getContainerY: function() {
         // return this.container[0].offsetHeight;
         // @modified
         return window.innerHeight
       },
    
       setContainerY: function(y) {
         // return this.container.height(y);
         // @modified
         var t = window.innerHeight;
         return this.el.css({height: t}), this.container.height(t);
       },
    
       /**
        * Creates the expected html structure
        */
       setupMarkup: function() {
    
    this.container = $('
    ');
         this.el.before(this.container);
         this.container.append(this.el);
    
         this.container.css({
           'overflow': 'hidden',
           'position': 'relative'
         });
    
         // Zepto doesn't recognize `webkitTransform..` style
         this.el.css({
           '-webkit-transform-origin': '0% 0%',
           '-moz-transform-origin': '0% 0%',
           '-ms-transform-origin': '0% 0%',
           '-o-transform-origin': '0% 0%',
           'transform-origin': '0% 0%',
           'position': 'absolute'
         });
       },
    
       end: function() {
         this.hasInteraction = false;
         this.sanitize();
         this.update();
       },
    
       /**
        * Binds all required event listeners
        */
       bindEvents: function() {
         detectGestures(this.container.get(0), this);
         // Zepto and jQuery both know about `on`
         $(window).on('resize', this.update.bind(this));
         $(this.el).find('img').on('load', this.update.bind(this));
       },
    
       /**
        * Updates the css values according to the current zoom factor and offset
        */
       update: function() {
    
         if (this.updatePlaned) {
           return;
         }
         this.updatePlaned = true;
    
         setTimeout((function() {
           this.updatePlaned = false;
           this.updateAspectRatio();
    
           var zoomFactor = this.getInitialZoomFactor() * this.zoomFactor,
             offsetX = -this.offset.x / zoomFactor,
             offsetY = -this.offset.y / zoomFactor,
             transform3d = 'scale3d(' + zoomFactor + ', ' + zoomFactor + ',1) ' +
               'translate3d(' + offsetX + 'px,' + offsetY + 'px,0px)',
             transform2d = 'scale(' + zoomFactor + ', ' + zoomFactor + ') ' +
               'translate(' + offsetX + 'px,' + offsetY + 'px)',
             removeClone = (function() {
               if (this.clone) {
                 this.clone.remove();
                 delete this.clone;
               }
             }).bind(this);
    
           // Scale 3d and translate3d are faster (at least on ios)
           // but they also reduce the quality.
           // PinchZoom uses the 3d transformations during interactions
           // after interactions it falls back to 2d transformations
           if (!this.options.use2d || this.hasInteraction || this.inAnimation) {
             this.is3d = true;
             removeClone();
             this.el.css({
               '-webkit-transform': transform3d,
               '-o-transform': transform2d,
               '-ms-transform': transform2d,
               '-moz-transform': transform2d,
               'transform': transform3d
             });
           } else {
    
             // When changing from 3d to 2d transform webkit has some glitches.
             // To avoid this, a copy of the 3d transformed element is displayed in the
             // foreground while the element is converted from 3d to 2d transform
             if (this.is3d) {
               this.clone = this.el.clone();
               this.clone.css('pointer-events', 'none');
               this.clone.appendTo(this.container);
               setTimeout(removeClone, 200);
             }
             this.el.css({
               '-webkit-transform': transform2d,
               '-o-transform': transform2d,
               '-ms-transform': transform2d,
               '-moz-transform': transform2d,
               'transform': transform2d
             });
             this.is3d = false;
           }
         }).bind(this), 0);
       },
    
       /**
        * Enables event handling for gestures
        */
       enable: function() {
         this.enabled = true;
       },
    
       /**
        * Disables event handling for gestures
        */
       disable: function() {
         this.enabled = false;
       }
     };
    
     var detectGestures = function(el, target) {
       var interaction = null,
         fingers = 0,
         lastTouchStart = null,
         startTouches = null,
    
         setInteraction = function(newInteraction, event) {
           if (interaction !== newInteraction) {
    
             if (interaction && !newInteraction) {
               switch (interaction) {
                 case "zoom":
                   target.handleZoomEnd(event);
                   break;
                 case 'drag':
                   target.handleDragEnd(event);
                   break;
               }
             }
    
             switch (newInteraction) {
               case 'zoom':
                 target.handleZoomStart(event);
                 break;
               case 'drag':
                 target.handleDragStart(event);
                 break;
             }
           }
           interaction = newInteraction;
         },
    
         updateInteraction = function(event) {
           if (fingers === 2) {
             setInteraction('zoom');
           } else if (fingers === 1 && target.canDrag()) {
             setInteraction('drag', event);
           } else {
             setInteraction(null, event);
           }
         },
    
         targetTouches = function(touches) {
           return Array.prototype.slice.call(touches).map(function(touch) {
             return {
               x: touch.pageX,
               y: touch.pageY
             };
           });
         },
    
         getDistance = function(a, b) {
           var x, y;
           x = a.x - b.x;
           y = a.y - b.y;
           return Math.sqrt(x * x + y * y);
         },
    
         calculateScale = function(startTouches, endTouches) {
           var startDistance = getDistance(startTouches[0], startTouches[1]),
             endDistance = getDistance(endTouches[0], endTouches[1]);
           return endDistance / startDistance;
         },
    
         cancelEvent = function(event) {
           event.stopPropagation();
           event.preventDefault();
         },
    
         detectDoubleTap = function(event) {
           var time = (new Date()).getTime();
    
           if (fingers > 1) {
             lastTouchStart = null;
           }
    
           if (time - lastTouchStart < 300) {
             cancelEvent(event);
    
             target.handleDoubleTap(event);
             switch (interaction) {
               case "zoom":
                 target.handleZoomEnd(event);
                 break;
               case 'drag':
                 target.handleDragEnd(event);
                 break;
             }
           }
    
           if (fingers === 1) {
             lastTouchStart = time;
           }
         },
         firstMove = true;
    
       el.addEventListener('touchstart', function(event) {
         if (target.enabled) {
           firstMove = true;
           fingers = event.touches.length;
           detectDoubleTap(event);
         }
       });
    
       el.addEventListener('touchmove', function(event) {
         if (target.enabled) {
           if (firstMove) {
             updateInteraction(event);
             if (interaction) {
               cancelEvent(event);
             }
             startTouches = targetTouches(event.touches);
           } else {
             switch (interaction) {
               case 'zoom':
                 target.handleZoom(event, calculateScale(startTouches, targetTouches(event.touches)));
                 break;
               case 'drag':
                 target.handleDrag(event);
                 break;
             }
             if (interaction) {
               cancelEvent(event);
               target.update();
             }
           }
    
           firstMove = false;
         }
       });
    
       el.addEventListener('touchend', function(event) {
         if (target.enabled) {
           fingers = event.touches.length;
           updateInteraction(event);
         }
       });
     };
    
     return PinchZoom;
    

    };

    module.exports = UI.pichzoom = definePinchZoom($);

    },{"2":2}],15:[function(_dereq_,module,exports){ 'use strict';

    var $ = (window.jQuery); var UI = _dereq_(2); var $w = $(window);

    /**

    * @reference https://github.com/nolimits4web/Framework7/blob/master/src/js/modals.js
    * @license https://github.com/nolimits4web/Framework7/blob/master/LICENSE
    */
    

    var Popover = function(element, options) {

     this.options = $.extend({}, Popover.DEFAULTS, options);
     this.$element = $(element);
     this.active = null;
     this.$popover = (this.options.target && $(this.options.target)) || null;
    
     this.init();
     this._bindEvents();
    

    };

    Popover.DEFAULTS = {

     theme: undefined,
     trigger: 'click',
     content: ,
     open: false,
     target: undefined,
    
    tpl: '
    ' + '
    ' + '
    '

    };

    Popover.prototype.init = function() {

     var _this = this;
     var $element = this.$element;
     var $popover;
    
     if (!this.options.target) {
       this.$popover = this.getPopover();
       this.setContent();
     }
    
     $popover = this.$popover;
    
     $popover.appendTo($('body'));
    
     this.sizePopover();
    
     function sizePopover() {
       _this.sizePopover();
     }
    
     // TODO: 监听页面内容变化,重新调整位置
    
     $element.on('open.popover.amui', function() {
       $(window).on('resize.popover.amui', UI.utils.debounce(sizePopover, 50));
     });
    
     $element.on('close.popover.amui', function() {
       $(window).off('resize.popover.amui', sizePopover);
     });
    
     this.options.open && this.open();
    

    };

    Popover.prototype.sizePopover = function sizePopover() {

     var $element = this.$element;
     var $popover = this.$popover;
    
     if (!$popover || !$popover.length) {
       return;
     }
    
     var popWidth = $popover.outerWidth();
     var popHeight = $popover.outerHeight();
     var $popCaret = $popover.find('.am-popover-caret');
     var popCaretSize = ($popCaret.outerWidth() / 2) || 8;
     // 取不到 $popCaret.outerHeight() 的值,所以直接加 8
     var popTotalHeight = popHeight + 8; // $popCaret.outerHeight();
    
     var triggerWidth = $element.outerWidth();
     var triggerHeight = $element.outerHeight();
     var triggerOffset = $element.offset();
     var triggerRect = $element[0].getBoundingClientRect();
    
     var winHeight = $w.height();
     var winWidth = $w.width();
     var popTop = 0;
     var popLeft = 0;
     var diff = 0;
     var spacing = 2;
     var popPosition = 'top';
    
     $popover.css({left: , top: }).removeClass('am-popover-left ' +
     'am-popover-right am-popover-top am-popover-bottom');
    
     // $popCaret.css({left: , top: });
    
     if (popTotalHeight - spacing < triggerRect.top + spacing) {
       // Popover on the top of trigger
       popTop = triggerOffset.top - popTotalHeight - spacing;
     } else if (popTotalHeight <
       winHeight - triggerRect.top - triggerRect.height) {
       // On bottom
       popPosition = 'bottom';
       popTop = triggerOffset.top + triggerHeight + popCaretSize + spacing;
     } else { // On middle
       popPosition = 'middle';
       popTop = triggerHeight / 2 + triggerOffset.top - popHeight / 2;
     }
    
     // Horizontal Position
     if (popPosition === 'top' || popPosition === 'bottom') {
       popLeft = triggerWidth / 2 + triggerOffset.left - popWidth / 2;
    
       diff = popLeft;
    
       if (popLeft < 5) {
         popLeft = 5;
       }
    
       if (popLeft + popWidth > winWidth) {
         popLeft = (winWidth - popWidth - 20);
         // console.log('left %d, win %d, popw %d', popLeft, winWidth, popWidth);
       }
    
       if (popPosition === 'top') {
         // This is the Popover position, NOT caret position
         // Popover on the Top of trigger, caret on the bottom of Popover
         $popover.addClass('am-popover-top');
       }
    
       if (popPosition === 'bottom') {
         $popover.addClass('am-popover-bottom');
       }
    
       diff = diff - popLeft;
       // $popCaret.css({left: (popWidth / 2 - popCaretSize + diff) + 'px'});
    
     } else if (popPosition === 'middle') {
       popLeft = triggerOffset.left - popWidth - popCaretSize;
       $popover.addClass('am-popover-left');
       if (popLeft < 5) {
         popLeft = triggerOffset.left + triggerWidth + popCaretSize;
         $popover.removeClass('am-popover-left').addClass('am-popover-right');
       }
    
       if (popLeft + popWidth > winWidth) {
         popLeft = winWidth - popWidth - 5;
         $popover.removeClass('am-popover-left').addClass('am-popover-right');
       }
       // $popCaret.css({top: (popHeight / 2 - popCaretSize / 2) + 'px'});
     }
    
     // Apply position style
     $popover.css({top: popTop + 'px', left: popLeft + 'px'});
    

    };

    Popover.prototype.toggle = function() {

     return this[this.active ? 'close' : 'open']();
    

    };

    Popover.prototype.open = function() {

     var $popover = this.$popover;
    
     this.$element.trigger('open.popover.amui');
     this.sizePopover();
     $popover.show().addClass('am-active');
     this.active = true;
    

    };

    Popover.prototype.close = function() {

     var $popover = this.$popover;
    
     this.$element.trigger('close.popover.amui');
    
     $popover
       .removeClass('am-active')
       .trigger('closed.popover.amui')
       .hide();
    
     this.active = false;
    

    };

    Popover.prototype.getPopover = function() {

     var uid = UI.utils.generateGUID('am-popover');
     var theme = [];
    
     if (this.options.theme) {
       $.each(this.options.theme.split(','), function(i, item) {
         theme.push('am-popover-' + $.trim(item));
       });
     }
    
     return $(this.options.tpl).attr('id', uid).addClass(theme.join(' '));
    

    };

    Popover.prototype.setContent = function(content) {

     content = content || this.options.content;
     this.$popover && this.$popover.find('.am-popover-inner')
       .empty().html(content);
    

    };

    Popover.prototype._bindEvents = function() {

     var eventNS = 'popover.amui';
     var triggers = this.options.trigger.split(' ');
    
     for (var i = triggers.length; i--;) {
       var trigger = triggers[i];
    
       if (trigger === 'click') {
         this.$element.on('click.' + eventNS, $.proxy(this.toggle, this));
       } else { // hover or focus
         var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin';
         var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';
    
         this.$element.on(eventIn + '.' + eventNS, $.proxy(this.open, this));
         this.$element.on(eventOut + '.' + eventNS, $.proxy(this.close, this));
       }
     }
    

    };

    UI.plugin('popover', Popover);

    // Init code UI.ready(function(context) {

     $('[data-am-popover]', context).popover();
    

    });

    module.exports = Popover;

    },{"2":2}],16:[function(_dereq_,module,exports){ 'use strict';

    var $ = (window.jQuery); var UI = _dereq_(2);

    var Progress = (function() {

     /**
      * NProgress (c) 2013, Rico Sta. Cruz
      * @via http://ricostacruz.com/nprogress
      */
    
     var NProgress = {};
    
     NProgress.version = '0.2.0';
    
     var Settings = NProgress.settings = {
       minimum: 0.08,
       easing: 'ease',
       positionUsing: ,
       speed: 200,
       trickle: true,
       trickleRate: 0.02,
       trickleSpeed: 800,
       showSpinner: true,
       parent: 'body',
       barSelector: '[role="nprogress-bar"]',
       spinnerSelector: '[role="nprogress-spinner"]',
    
    template: '
    ' + '
    ' + '
    ' + '
    '
     };
    
     /**
      * Updates configuration.
      *
      *     NProgress.configure({
      *       minimum: 0.1
      *     });
      */
     NProgress.configure = function(options) {
       var key, value;
       for (key in options) {
         value = options[key];
         if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
       }
    
       return this;
     };
    
     /**
      * Last number.
      */
    
     NProgress.status = null;
    
     /**
      * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
      *
      *     NProgress.set(0.4);
      *     NProgress.set(1.0);
      */
    
     NProgress.set = function(n) {
       var started = NProgress.isStarted();
    
       n = clamp(n, Settings.minimum, 1);
       NProgress.status = (n === 1 ? null : n);
    
       var progress = NProgress.render(!started),
         bar      = progress.querySelector(Settings.barSelector),
         speed    = Settings.speed,
         ease     = Settings.easing;
    
       progress.offsetWidth; /* Repaint */
    
       queue(function(next) {
         // Set positionUsing if it hasn't already been set
         if (Settings.positionUsing === ) Settings.positionUsing = NProgress.getPositioningCSS();
    
         // Add transition
         css(bar, barPositionCSS(n, speed, ease));
    
         if (n === 1) {
           // Fade out
           css(progress, {
             transition: 'none',
             opacity: 1
           });
           progress.offsetWidth; /* Repaint */
    
           setTimeout(function() {
             css(progress, {
               transition: 'all ' + speed + 'ms linear',
               opacity: 0
             });
             setTimeout(function() {
               NProgress.remove();
               next();
             }, speed);
           }, speed);
         } else {
           setTimeout(next, speed);
         }
       });
    
       return this;
     };
    
     NProgress.isStarted = function() {
       return typeof NProgress.status === 'number';
     };
    
     /**
      * Shows the progress bar.
      * This is the same as setting the status to 0%, except that it doesn't go backwards.
      *
      *     NProgress.start();
      *
      */
     NProgress.start = function() {
       if (!NProgress.status) NProgress.set(0);
    
       var work = function() {
         setTimeout(function() {
           if (!NProgress.status) return;
           NProgress.trickle();
           work();
         }, Settings.trickleSpeed);
       };
    
       if (Settings.trickle) work();
    
       return this;
     };
    
     /**
      * Hides the progress bar.
      * This is the *sort of* the same as setting the status to 100%, with the
      * difference being `done()` makes some placebo effect of some realistic motion.
      *
      *     NProgress.done();
      *
      * If `true` is passed, it will show the progress bar even if its hidden.
      *
      *     NProgress.done(true);
      */
    
     NProgress.done = function(force) {
       if (!force && !NProgress.status) return this;
    
       return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
     };
    
     /**
      * Increments by a random amount.
      */
    
     NProgress.inc = function(amount) {
       var n = NProgress.status;
    
       if (!n) {
         return NProgress.start();
       } else {
         if (typeof amount !== 'number') {
           amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
         }
    
         n = clamp(n + amount, 0, 0.994);
         return NProgress.set(n);
       }
     };
    
     NProgress.trickle = function() {
       return NProgress.inc(Math.random() * Settings.trickleRate);
     };
    
     /**
      * Waits for all supplied jQuery promises and
      * increases the progress as the promises resolve.
      *
      * @param $promise jQUery Promise
      */
     (function() {
       var initial = 0, current = 0;
    
       NProgress.promise = function($promise) {
         if (!$promise || $promise.state() === "resolved") {
           return this;
         }
    
         if (current === 0) {
           NProgress.start();
         }
    
         initial++;
         current++;
    
         $promise.always(function() {
           current--;
           if (current === 0) {
             initial = 0;
             NProgress.done();
           } else {
             NProgress.set((initial - current) / initial);
           }
         });
    
         return this;
       };
    
     })();
    
     /**
      * (Internal) renders the progress bar markup based on the `template`
      * setting.
      */
    
     NProgress.render = function(fromStart) {
       if (NProgress.isRendered()) return document.getElementById('nprogress');
    
       addClass(document.documentElement, 'nprogress-busy');
    
       var progress = document.createElement('div');
       progress.id = 'nprogress';
       progress.innerHTML = Settings.template;
    
       var bar      = progress.querySelector(Settings.barSelector),
         perc     = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
         parent   = document.querySelector(Settings.parent),
         spinner;
    
       css(bar, {
         transition: 'all 0 linear',
         transform: 'translate3d(' + perc + '%,0,0)'
       });
    
       if (!Settings.showSpinner) {
         spinner = progress.querySelector(Settings.spinnerSelector);
         spinner && removeElement(spinner);
       }
    
       if (parent != document.body) {
         addClass(parent, 'nprogress-custom-parent');
       }
    
       parent.appendChild(progress);
       return progress;
     };
    
     /**
      * Removes the element. Opposite of render().
      */
    
     NProgress.remove = function() {
       removeClass(document.documentElement, 'nprogress-busy');
       removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');
       var progress = document.getElementById('nprogress');
       progress && removeElement(progress);
     };
    
     /**
      * Checks if the progress bar is rendered.
      */
    
     NProgress.isRendered = function() {
       return !!document.getElementById('nprogress');
     };
    
     /**
      * Determine which positioning CSS rule to use.
      */
    
     NProgress.getPositioningCSS = function() {
       // Sniff on document.body.style
       var bodyStyle = document.body.style;
    
       // Sniff prefixes
       var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
         ('MozTransform' in bodyStyle) ? 'Moz' :
           ('msTransform' in bodyStyle) ? 'ms' :
             ('OTransform' in bodyStyle) ? 'O' : ;
    
       if (vendorPrefix + 'Perspective' in bodyStyle) {
         // Modern browsers with 3D support, e.g. Webkit, IE10
         return 'translate3d';
       } else if (vendorPrefix + 'Transform' in bodyStyle) {
         // Browsers without 3D support, e.g. IE9
         return 'translate';
       } else {
         // Browsers without translate() support, e.g. IE7-8
         return 'margin';
       }
     };
    
     /**
      * Helpers
      */
    
     function clamp(n, min, max) {
       if (n < min) return min;
       if (n > max) return max;
       return n;
     }
    
     /**
      * (Internal) converts a percentage (`0..1`) to a bar translateX
      * percentage (`-100%..0%`).
      */
    
     function toBarPerc(n) {
       return (-1 + n) * 100;
     }
    


     /**
      * (Internal) returns the correct CSS for changing the bar's
      * position given an n percentage, and speed and ease from Settings
      */
    
     function barPositionCSS(n, speed, ease) {
       var barCSS;
    
       if (Settings.positionUsing === 'translate3d') {
         barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
       } else if (Settings.positionUsing === 'translate') {
         barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
       } else {
         barCSS = { 'margin-left': toBarPerc(n)+'%' };
       }
    
       barCSS.transition = 'all '+speed+'ms '+ease;
    
       return barCSS;
     }
    
     /**
      * (Internal) Queues a function to be executed.
      */
    
     var queue = (function() {
       var pending = [];
    
       function next() {
         var fn = pending.shift();
         if (fn) {
           fn(next);
         }
       }
    
       return function(fn) {
         pending.push(fn);
         if (pending.length == 1) next();
       };
     })();
    
     /**
      * (Internal) Applies css properties to an element, similar to the jQuery
      * css method.
      *
      * While this helper does assist with vendor prefixed property names, it
      * does not perform any manipulation of values prior to setting styles.
      */
    
     var css = (function() {
       var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
         cssProps    = {};
    
       function camelCase(string) {
         return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
           return letter.toUpperCase();
         });
       }
    
       function getVendorProp(name) {
         var style = document.body.style;
         if (name in style) return name;
    
         var i = cssPrefixes.length,
           capName = name.charAt(0).toUpperCase() + name.slice(1),
           vendorName;
         while (i--) {
           vendorName = cssPrefixes[i] + capName;
           if (vendorName in style) return vendorName;
         }
    
         return name;
       }
    
       function getStyleProp(name) {
         name = camelCase(name);
         return cssProps[name] || (cssProps[name] = getVendorProp(name));
       }
    
       function applyCss(element, prop, value) {
         prop = getStyleProp(prop);
         element.style[prop] = value;
       }
    
       return function(element, properties) {
         var args = arguments,
           prop,
           value;
    
         if (args.length == 2) {
           for (prop in properties) {
             value = properties[prop];
             if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
           }
         } else {
           applyCss(element, args[1], args[2]);
         }
       }
     })();
    
     /**
      * (Internal) Determines if an element or space separated list of class names contains a class name.
      */
    
     function hasClass(element, name) {
       var list = typeof element == 'string' ? element : classList(element);
       return list.indexOf(' ' + name + ' ') >= 0;
     }
    
     /**
      * (Internal) Adds a class to an element.
      */
    
     function addClass(element, name) {
       var oldList = classList(element),
         newList = oldList + name;
    
       if (hasClass(oldList, name)) return;
    
       // Trim the opening space.
       element.className = newList.substring(1);
     }
    
     /**
      * (Internal) Removes a class from an element.
      */
    
     function removeClass(element, name) {
       var oldList = classList(element),
         newList;
    
       if (!hasClass(element, name)) return;
    
       // Replace the class name.
       newList = oldList.replace(' ' + name + ' ', ' ');
    
       // Trim the opening and closing spaces.
       element.className = newList.substring(1, newList.length - 1);
     }
    
     /**
      * (Internal) Gets a space separated list of the class names on the element.
      * The list is wrapped with a single space on each end to facilitate finding
      * matches within the list.
      */
    
     function classList(element) {
       return (' ' + (element.className || ) + ' ').replace(/\s+/gi, ' ');
     }
    
     /**
      * (Internal) Removes an element from the DOM.
      */
    
     function removeElement(element) {
       element && element.parentNode && element.parentNode.removeChild(element);
     }
    
     return NProgress;
    

    })();

    module.exports = UI.progress = Progress;

    },{"2":2}],17:[function(_dereq_,module,exports){ 'use strict';

    var $ = (window.jQuery); var UI = _dereq_(2); var PinchZoom = _dereq_(14); var Hammer = _dereq_(30); var animation = UI.support.animation; var transition = UI.support.transition;

    /**

    * PureView
    * @desc Image browser for Mobile
    * @param element
    * @param options
    * @constructor
    */
    

    var PureView = function(element, options) {

     this.$element = $(element);
     this.$body = $(document.body);
     this.options = $.extend({}, PureView.DEFAULTS, options);
     this.$pureview = $(this.options.tpl).attr('id',
       UI.utils.generateGUID('am-pureview'));
    
     this.$slides = null;
     this.transitioning = null;
     this.scrollbarWidth = 0;
    
     this.init();
    

    };

    PureView.DEFAULTS = {

    tpl: '
    ' + '
      ' + '
        ' + '
      • <a href=""></a>
      • ' + '
      • <a href=""></a>
      ' + '
        ' + '
        ' +
         '' +
        
        '
        / ' + '
        ' + '
        ' +
         '<a href="javascript: void(0)" class="am-icon-chevron-left" ' +
        
        'data-am-close="pureview"></a>
        ' + '
        ',
         className: {
           prevSlide: 'am-pureview-slide-prev',
           nextSlide: 'am-pureview-slide-next',
           onlyOne: 'am-pureview-only',
           active: 'am-active',
           barActive: 'am-pureview-bar-active',
           activeBody: 'am-pureview-active'
         },
        
         selector: {
           slider: '.am-pureview-slider',
           close: '[data-am-close="pureview"]',
           total: '.am-pureview-total',
           current: '.am-pureview-current',
           title: '.am-pureview-title',
           actions: '.am-pureview-actions',
           bar: '.am-pureview-bar',
           pinchZoom: '.am-pinch-zoom',
           nav: '.am-pureview-nav'
         },
        
         shareBtn: false,
        
         // press to toggle Toolbar
         toggleToolbar: true,
        
         // 从何处获取图片,img 可以使用 data-rel 指定大图
         target: 'img',
        
         // 微信 Webview 中调用微信的图片浏览器
         // 实现图片保存、分享好友、收藏图片等功能
         weChatImagePreview: true
        

        };

        PureView.prototype.init = function() {

         var _this = this;
         var options = this.options;
         var $element = this.$element;
         var $pureview = this.$pureview;
        
         this.refreshSlides();
        
         $('body').append($pureview);
        
         this.$title = $pureview.find(options.selector.title);
         this.$current = $pureview.find(options.selector.current);
         this.$bar = $pureview.find(options.selector.bar);
         this.$actions = $pureview.find(options.selector.actions);
        
         if (options.shareBtn) {
           this.$actions.append('<a href="javascript: void(0)" ' +
           'class="am-icon-share-square-o" data-am-toggle="share"></a>');
         }
        
         this.$element.on('click.pureview.amui', options.target, function(e) {
           e.preventDefault();
           var clicked = _this.$images.index(this);
        
           // Invoke WeChat ImagePreview in WeChat
           // TODO: detect WeChat before init
           if (options.weChatImagePreview && window.WeixinJSBridge) {
             window.WeixinJSBridge.invoke('imagePreview', {
               current: _this.imgUrls[clicked],
               urls: _this.imgUrls
             });
           } else {
             _this.open(clicked);
           }
         });
        
         $pureview.find('.am-pureview-direction').
           on('click.direction.pureview.amui', 'li', function(e) {
             e.preventDefault();
        
             if ($(this).is('.am-pureview-prev')) {
               _this.prevSlide();
             } else {
               _this.nextSlide();
             }
           });
        
         // Nav Contorl
         $pureview.find(options.selector.nav).on('click.nav.pureview.amui', 'li',
           function() {
             var index = _this.$navItems.index($(this));
             _this.activate(_this.$slides.eq(index));
           });
        
         // Close Icon
         $pureview.find(options.selector.close).
           on('click.close.pureview.amui', function(e) {
             e.preventDefault();
             _this.close();
           });
        
         this.$slider.hammer().on('swipeleft.pureview.amui', function(e) {
           e.preventDefault();
           _this.nextSlide();
         }).on('swiperight.pureview.amui', function(e) {
           e.preventDefault();
           _this.prevSlide();
         }).on('press.pureview.amui', function(e) {
           e.preventDefault();
           options.toggleToolbar && _this.toggleToolBar();
         });
        
         this.$slider.data('hammer').get('swipe').set({
           direction: Hammer.DIRECTION_HORIZONTAL,
           velocity: 0.35
         });
        
         // Observe DOM
         $element.DOMObserve({
           childList: true,
           subtree: true
         }, function(mutations, observer) {
           // _this.refreshSlides();
           // console.log('mutations[0].type);
         });
        
         // NOTE:
         // trigger this event manually if MutationObserver not supported
         //   when new images appended, or call refreshSlides()
         // if (!UI.support.mutationobserver) $element.trigger('changed.dom.amui')
         $element.on('changed.dom.amui', function(e) {
           e.stopPropagation();
           _this.refreshSlides();
         });
        
         $(document).on('keydown.pureview.amui', $.proxy(function(e) {
           var keyCode = e.keyCode;
           if (keyCode == 37) {
             this.prevSlide();
           } else if (keyCode == 39) {
             this.nextSlide();
           } else if (keyCode == 27) {
             this.close();
           }
         }, this));
        

        };

        PureView.prototype.refreshSlides = function() {

         // update images collections
         this.$images = this.$element.find(this.options.target);
         var _this = this;
         var options = this.options;
         var $pureview = this.$pureview;
         var $slides = $([]);
         var $navItems = $([]);
         var $images = this.$images;
         var total = $images.length;
         this.$slider = $pureview.find(options.selector.slider);
         this.$nav = $pureview.find(options.selector.nav);
         var viewedFlag = 'data-am-pureviewed';
         // for WeChat Image Preview
         this.imgUrls = this.imgUrls || [];
        
         if (!total) {
           return;
         }
        
         if (total === 1) {
           $pureview.addClass(options.className.onlyOne);
         }
        
         $images.not('[' + viewedFlag + ']').each(function(i, item) {
           var src;
           var title;
        
           // get image URI from link's href attribute
           if (item.nodeName === 'A') {
             src = item.href; // to absolute path
             title = item.title || ;
           } else {
             // NOTE: `data-rel` should be a full URL, otherwise,
             //        WeChat images preview will not work
             src = $(item).data('rel') || item.src; // <img src= data-rel= />
             title = $(item).attr('alt') || ;
           }
        
           // add pureviewed flag
           item.setAttribute(viewedFlag, '1');
        
           // hide bar: wechat_webview_type=1
           // http://tmt.io/wechat/  not working?
           _this.imgUrls.push(src);
        
        $slides = $slides.add($('
      1. ')); $navItems = $navItems.add($('
      2. ' + (i + 1) + '
      3. '));
         });
        
         $pureview.find(options.selector.total).text(total);
        
         this.$slider.append($slides);
         this.$nav.append($navItems);
         this.$navItems = this.$nav.find('li');
         this.$slides = this.$slider.find('li');
        

        };

        PureView.prototype.loadImage = function($slide, callback) {

         var appendedFlag = 'image-appended';
        
         if (!$slide.data(appendedFlag)) {
           var $img = $('<img>', {
             src: $slide.data('src'),
             alt: $slide.data('title')
           });
        
        $slide.html($img).wrapInner('
        ').redraw();
           var $pinchWrapper = $slide.find(this.options.selector.pinchZoom);
           $pinchWrapper.data('amui.pinchzoom', new PinchZoom($pinchWrapper[0], {}));
           $slide.data('image-appended', true);
         }
        
         callback && callback.call(this);
        

        };

        PureView.prototype.activate = function($slide) {

         var options = this.options;
         var $slides = this.$slides;
         var activeIndex = $slides.index($slide);
         var title = $slide.data('title') || ;
         var active = options.className.active;
        
         if ($slides.find('.' + active).is($slide)) {
           return;
         }
        
         if (this.transitioning) {
           return;
         }
        
         this.loadImage($slide, function() {
           UI.utils.imageLoader($slide.find('img'), function(image) {
             $slide.find('.am-pinch-zoom').addClass('am-pureview-loaded');
             $(image).addClass('am-img-loaded');
           });
         });
        
         this.transitioning = 1;
        
         this.$title.text(title);
         this.$current.text(activeIndex + 1);
         $slides.removeClass();
         $slide.addClass(active);
         $slides.eq(activeIndex - 1).addClass(options.className.prevSlide);
         $slides.eq(activeIndex + 1).addClass(options.className.nextSlide);
        
         this.$navItems.removeClass().
           eq(activeIndex).addClass(options.className.active);
        
         if (transition) {
           $slide.one(transition.end, $.proxy(function() {
             this.transitioning = 0;
           }, this)).emulateTransitionEnd(300);
         } else {
           this.transitioning = 0;
         }
        
         // TODO: pre-load next image
        

        };

        PureView.prototype.nextSlide = function() {

         if (this.$slides.length === 1) {
           return;
         }
        
         var $slides = this.$slides;
         var $active = $slides.filter('.am-active');
         var activeIndex = $slides.index($active);
         var rightSpring = 'am-animation-right-spring';
        
         if (activeIndex + 1 >= $slides.length) { // last one
           animation && $active.addClass(rightSpring).on(animation.end, function() {
             $active.removeClass(rightSpring);
           });
         } else {
           this.activate($slides.eq(activeIndex + 1));
         }
        

        };

        PureView.prototype.prevSlide = function() {

         if (this.$slides.length === 1) {
           return;
         }
        
         var $slides = this.$slides;
         var $active = $slides.filter('.am-active');
         var activeIndex = this.$slides.index(($active));
         var leftSpring = 'am-animation-left-spring';
        
         if (activeIndex === 0) { // first one
           animation && $active.addClass(leftSpring).on(animation.end, function() {
             $active.removeClass(leftSpring);
           });
         } else {
           this.activate($slides.eq(activeIndex - 1));
         }
        

        };

        PureView.prototype.toggleToolBar = function() {

         this.$pureview.toggleClass(this.options.className.barActive);
        

        };

        PureView.prototype.open = function(index) {

         var active = index || 0;
         this.checkScrollbar();
         this.setScrollbar();
         this.activate(this.$slides.eq(active));
         this.$pureview.show().redraw().addClass(this.options.className.active);
         this.$body.addClass(this.options.className.activeBody);
        

        };

        PureView.prototype.close = function() {

         var options = this.options;
        
         this.$pureview.removeClass(options.className.active);
         this.$slides.removeClass();
        
         function resetBody() {
           this.$pureview.hide();
           this.$body.removeClass(options.className.activeBody);
           this.resetScrollbar();
         }
        
         if (transition) {
           this.$pureview.one(transition.end, $.proxy(resetBody, this)).
             emulateTransitionEnd(300);
         } else {
           resetBody.call(this);
         }
        

        };

        PureView.prototype.checkScrollbar = function() {

         this.scrollbarWidth = UI.utils.measureScrollbar();
        

        };

        PureView.prototype.setScrollbar = function() {

         var bodyPaddingRight = parseInt((this.$body.css('padding-right') || 0), 10);
         if (this.scrollbarWidth) {
           this.$body.css('padding-right', bodyPaddingRight + this.scrollbarWidth);
         }
        

        };

        PureView.prototype.resetScrollbar = function() {

         this.$body.css('padding-right', );
        

        };

        UI.plugin('pureview', PureView);

        // Init code UI.ready(function(context) {

         $('[data-am-pureview]', context).pureview();
        

        });

        module.exports = PureView;

        // TODO: 1. 动画改进 // 2. 改变图片的时候恢复 Zoom // 3. 选项 // 4. 图片高度问题:由于 PinchZoom 的原因,过高的图片如果设置看了滚动,则放大以后显示不全

        },{"14":14,"2":2,"30":30}],18:[function(_dereq_,module,exports){ 'use strict';

        var $ = (window.jQuery); var UI = _dereq_(2);

        /**

        * @via https://github.com/uikit/uikit/blob/master/src/js/scrollspy.js
        * @license https://github.com/uikit/uikit/blob/master/LICENSE.md
        */
        

        var ScrollSpy = function(element, options) {

         if (!UI.support.animation) {
           return;
         }
        
         this.options = $.extend({}, ScrollSpy.DEFAULTS, options);
         this.$element = $(element);
        
         var checkViewRAF = function() {
           UI.utils.rAF.call(window, $.proxy(this.checkView, this));
         }.bind(this);
        
         this.$window = $(window).on('scroll.scrollspy.amui', checkViewRAF)
           .on('resize.scrollspy.amui orientationchange.scrollspy.amui',
           UI.utils.debounce(checkViewRAF, 50));
        
         this.timer = this.inViewState = this.initInView = null;
        
         checkViewRAF();
        

        };

        ScrollSpy.DEFAULTS = {

         animation: 'fade',
         className: {
           inView: 'am-scrollspy-inview',
           init: 'am-scrollspy-init'
         },
         repeat: true,
         delay: 0,
         topOffset: 0,
         leftOffset: 0
        

        };

        ScrollSpy.prototype.checkView = function() {

         var $element = this.$element;
         var options = this.options;
         var inView = UI.utils.isInView($element, options);
         var animation = options.animation ?
         ' am-animation-' + options.animation : ;
        
         if (inView && !this.inViewState) {
           if (this.timer) {
             clearTimeout(this.timer);
           }
        
           if (!this.initInView) {
             $element.addClass(options.className.init);
             this.offset = $element.offset();
             this.initInView = true;
        
             $element.trigger('init.scrollspy.amui');
           }
        
           this.timer = setTimeout(function() {
             if (inView) {
               $element.addClass(options.className.inView + animation).width();
             }
           }, options.delay);
        
           this.inViewState = true;
           $element.trigger('inview.scrollspy.amui');
         }
        
         if (!inView && this.inViewState && options.repeat) {
           $element.removeClass(options.className.inView + animation);
        
           this.inViewState = false;
        
           $element.trigger('outview.scrollspy.amui');
         }
        

        };

        ScrollSpy.prototype.check = function() {

         UI.utils.rAF.call(window, $.proxy(this.checkView, this));
        

        };

        // Sticky Plugin UI.plugin('scrollspy', ScrollSpy);

        // Init code UI.ready(function(context) {

         $('[data-am-scrollspy]', context).scrollspy();
        

        });

        module.exports = ScrollSpy;

        },{"2":2}],19:[function(_dereq_,module,exports){ 'use strict';

        var $ = (window.jQuery); var UI = _dereq_(2); _dereq_(22);

        /**

        * @via https://github.com/uikit/uikit/
        * @license https://github.com/uikit/uikit/blob/master/LICENSE.md
        */
        

        // ScrollSpyNav Class var ScrollSpyNav = function(element, options) {

         this.options = $.extend({}, ScrollSpyNav.DEFAULTS, options);
         this.$element = $(element);
         this.anchors = [];
        
         this.$links = this.$element.find('a[href^="#"]').each(function(i, link) {
           this.anchors.push($(link).attr('href'));
         }.bind(this));
        
         this.$targets = $(this.anchors.join(', '));
        
         var processRAF = function() {
           UI.utils.rAF.call(window, $.proxy(this.process, this));
         }.bind(this);
        
         this.$window = $(window).on('scroll.scrollspynav.amui', processRAF)
           .on('resize.scrollspynav.amui orientationchange.scrollspynav.amui',
           UI.utils.debounce(processRAF, 50));
        
         processRAF();
         this.scrollProcess();
        

        };

        ScrollSpyNav.DEFAULTS = {

         className: {
           active: 'am-active'
         },
         closest: false,
         smooth: true,
         offsetTop: 0
        

        };

        ScrollSpyNav.prototype.process = function() {

         var scrollTop = this.$window.scrollTop();
         var options = this.options;
         var inViews = [];
         var $links = this.$links;
        
         var $targets = this.$targets;
        
         $targets.each(function(i, target) {
           if (UI.utils.isInView(target, options)) {
             inViews.push(target);
           }
         });
        
         // console.log(inViews.length);
        
         if (inViews.length) {
           var $target;
        
           $.each(inViews, function(i, item) {
             if ($(item).offset().top >= scrollTop) {
               $target = $(item);
               return false; // break
             }
           });
        
           if (!$target) {
             return;
           }
        
           if (options.closest) {
             $links.closest(options.closest).removeClass(options.className.active);
             $links.filter('a[href="#' + $target.attr('id') + '"]').
               closest(options.closest).addClass(options.className.active);
           } else {
             $links.removeClass(options.className.active).
               filter('a[href="#' + $target.attr('id') + '"]').
               addClass(options.className.active);
           }
         }
        

        };

        ScrollSpyNav.prototype.scrollProcess = function() {

         var $links = this.$links;
         var options = this.options;
        
         // smoothScroll
         if (options.smooth && $.fn.smoothScroll) {
           $links.on('click', function(e) {
             e.preventDefault();
        
             var $this = $(this);
             var $target = $($this.attr('href'));
        
             if (!$target) {
               return;
             }
        
             var offsetTop = options.offsetTop &&
               !isNaN(parseInt(options.offsetTop)) && parseInt(options.offsetTop) || 0;
        
             $(window).smoothScroll({position: $target.offset().top - offsetTop});
           });
         }
        

        };

        // ScrollSpyNav Plugin UI.plugin('scrollspynav', ScrollSpyNav);

        // Init code UI.ready(function(context) {

         $('[data-am-scrollspy-nav]', context).scrollspynav();
        

        });

        module.exports = ScrollSpyNav;

        // TODO: 1. 算法改进 // 2. 多级菜单支持 // 3. smooth scroll pushState

        },{"2":2,"22":22}],20:[function(_dereq_,module,exports){ 'use strict';

        var $ = (window.jQuery); var UI = _dereq_(2);

        // Make jQuery :contains Case-Insensitive $.expr[':'].containsNC = function(elem, i, match, array) {

         return (elem.textContent || elem.innerText || ).toLowerCase().
             indexOf((match[3] || ).toLowerCase()) >= 0;
        

        };

        /**

        * Selected
        * @desc HTML select replacer
        * @via https://github.com/silviomoreto/bootstrap-select
        * @license https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE
        * @param element
        * @param options
        * @constructor
        */
        

        var Selected = function(element, options) {

         this.$element = $(element);
         this.options = $.extend({}, Selected.DEFAULTS, options);
         this.$originalOptions = this.$element.find('option');
         this.multiple = element.multiple;
         this.$selector = null;
         this.initialized = false;
         this.init();
        

        };

        Selected.DEFAULTS = {

         btnWidth: null,
         btnSize: null,
         btnStyle: 'default',
         dropUp: 0,
         maxHeight: null,
         placeholder: '点击选择...',
         selectedClass: 'am-checked',
         disabledClass: 'am-disabled',
         searchBox: false,
         tpl: '<div class="am-selected am-dropdown ' +
         '<%= dropUp ? \'am-dropdown-up\': \'\' %>" id="<%= id %>" data-am-dropdown>' +
         '  <button type="button" class="am-selected-btn am-btn am-dropdown-toggle">' +
         '    ' +
         '    <i class="am-selected-icon am-icon-caret-' +
         '<%= dropUp ? \'up\' : \'down\' %>"></i>' +
         '  </button>' +
        
        '
        ' + '

        ' + '返回

        ' +
         '   <% if (searchBox) { %>' +
        
        ' ' +
         '   <% } %>' +
        
        '
          ' + ' <% for (var i = 0; i < options.length; i++) { %>' + ' <% var option = options[i] %>' + ' <% if (option.header) { %>' + ' <li data-group="<%= option.group %>" class="am-selected-list-header">' + ' <%= option.text %>' +
           '       <% } else { %>' +
           '       <li class="<%= option.classNames%>" ' +
           '         data-index="<%= option.index %>" ' +
           '         data-group="<%= option.group || 0 %>" ' +
           '         data-value="<%= option.value %>" >' +
           '         <%= option.text %>' +
          
          ' ' +
           '      <% } %>' +
           '      <% } %>' +
          
          '
        ' + '
        ' + '
        ' + '
        ',
         listTpl:   '<% for (var i = 0; i < options.length; i++) { %>' +
         '       <% var option = options[i] %>' +
         '       <% if (option.header) { %>' +
         '  <li data-group="<%= option.group %>" class="am-selected-list-header">' +
         '       <%= option.text %></li>' +
         '       <% } else { %>' +
         '       <li class="<%= option.classNames %>" ' +
         '         data-index="<%= option.index %>" ' +
         '         data-group="<%= option.group || 0 %>" ' +
         '         data-value="<%= option.value %>" >' +
         '         <%= option.text %>' +
         '         </li>' +
         '      <% } %>' +
         '      <% } %>'
        

        };

        Selected.prototype.init = function() {

         var _this = this;
         var $element = this.$element;
         var options = this.options;
        
         $element.hide();
        
         var data = {
           id: UI.utils.generateGUID('am-selected'),
           multiple: this.multiple,
           options: [],
           searchBox: options.searchBox,
           dropUp: options.dropUp,
           placeholder: options.placeholder
         };
        
         this.$selector = $(UI.template(this.options.tpl, data));
         // set select button styles
         this.$selector.css({width: this.options.btnWidth});
        
         this.$list = this.$selector.find('.am-selected-list');
         this.$searchField = this.$selector.find('.am-selected-search input');
         this.$hint = this.$selector.find('.am-selected-hint');
        
         var $selectorBtn = this.$selector.find('.am-selected-btn');
         var btnClassNames = [];
        
         options.btnSize && btnClassNames.push('am-btn-' + options.btnSize);
         options.btnStyle && btnClassNames.push('am-btn-' + options.btnStyle);
         $selectorBtn.addClass(btnClassNames.join(' '));
        
         this.$selector.dropdown({
           justify: $selectorBtn
         });
        
         // set list height
         if (options.maxHeight) {
           this.$selector.find('.am-selected-list').css({
             'max-height': options.maxHeight,
             'overflow-y': 'scroll'
           });
         }
        
         // set hint text
         var hint = [];
         var min = $element.attr('minchecked');
         var max = $element.attr('maxchecked');
        
         if ($element[0].required) {
           hint.push('必选');
         }
        
         if (min || max) {
           min && hint.push('至少选择 ' + min + ' 项');
           max && hint.push('至多选择 ' + max + ' 项');
         }
        
         this.$hint.text(hint.join(','));
        
         // render dropdown list
         this.renderOptions();
        
         // append $selector after <select>
         this.$element.after(this.$selector);
         this.dropdown = this.$selector.data('amui.dropdown');
         this.$status = this.$selector.find('.am-selected-status');
        
         // #try to fixes #476
         setTimeout(function() {
           _this.syncData();
           _this.initialized = true;
         }, 0);
        
         this.bindEvents();
        

        };

        Selected.prototype.renderOptions = function() {

         var $element = this.$element;
         var options = this.options;
         var optionItems = [];
         var $optgroup = $element.find('optgroup');
         this.$originalOptions = this.$element.find('option');
        
         // 单选框使用 JS 禁用已经选择的 option 以后,
         // 浏览器会重新选定第一个 option,但有一定延迟,致使 JS 获取 value 时返回 null
         if (!this.multiple && ($element.val() === null)) {
           this.$originalOptions.length &&
           (this.$originalOptions.get(0).selected = true);
         }
        
         function pushOption(index, item, group) {
           var classNames = ;
           item.disabled && (classNames += options.disabledClass);
           !item.disabled && item.selected && (classNames += options.selectedClass);
        
           optionItems.push({
             group: group,
             index: index,
             classNames: classNames,
             text: item.text,
             value: item.value
           });
         }
        
         // select with option groups
         if ($optgroup.length) {
           $optgroup.each(function(i) {
             // push group name
             optionItems.push({
               header: true,
               group: i + 1,
               text: this.label
             });
        
             $optgroup.eq(i).find('option').each(function(index, item) {
               pushOption(index, item, i);
             });
           });
         } else {
           // without option groups
           this.$originalOptions.each(function(index, item) {
             pushOption(index, item, null);
           });
         }
        
         this.$list.html(UI.template(options.listTpl, {options: optionItems}));
         this.$shadowOptions = this.$list.find('> li').
           not('.am-selected-list-header');
        

        };

        Selected.prototype.setChecked = function(item) {

         var options = this.options;
         var $item = $(item);
         var isChecked = $item.hasClass(options.selectedClass);
         if (!this.multiple) {
           if (!isChecked) {
             this.dropdown.close();
             this.$shadowOptions.not($item).removeClass(options.selectedClass);
           } else {
             return;
           }
         }
        
         $item.toggleClass(options.selectedClass);
        
         this.syncData(item);
        

        };

        /**

        * syncData
        * @desc if `item` set, only sync `item` related option
        * @param {Object} item
        */
        

        Selected.prototype.syncData = function(item) {

         var _this = this;
         var options = this.options;
         var status = [];
         var $checked = $([]);
        
         this.$shadowOptions.filter('.' + options.selectedClass).each(function() {
           var $this = $(this);
           status.push($this.find('.am-selected-text').text());
        
           if (!item) {
             $checked = $checked.add(_this.$originalOptions.
               filter('[value="' + $this.data('value') + '"]').
               prop('selected', true));
           }
         });
        
         if (item) {
           var $item = $(item);
           this.$originalOptions.filter('[value="' + $item.data('value') + '"]').
             prop('selected', $item.hasClass(options.selectedClass));
         } else {
           this.$originalOptions.not($checked).prop('selected', false);
         }
        
         // nothing selected
         if (!this.$element.val()) {
           status = [options.placeholder];
         }
        
         this.$status.text(status.join(', '));
        
         // Do not trigger change event on initializing
         this.initialized && this.$element.trigger('change');
        

        };

        Selected.prototype.bindEvents = function() {

         var _this = this;
         var header = 'am-selected-list-header';
         var handleKeyup = UI.utils.debounce(function(e) {
           _this.$shadowOptions.not('.' + header).hide().
            filter(':containsNC("' + e.target.value + '")').show();
         }, 100);
        
         this.$list.on('click', '> li', function(e) {
           var $this = $(this);
           !$this.hasClass(_this.options.disabledClass) &&
             !$this.hasClass(header) && _this.setChecked(this);
         });
        
         // simple search with jQuery :contains
         this.$searchField.on('keyup.selected.amui', handleKeyup);
        
         // empty search keywords
         this.$selector.on('closed.dropdown.amui', function() {
           _this.$searchField.val();
           _this.$shadowOptions.css({display: });
         });
        
         // observe DOM
         if (UI.support.mutationobserver) {
           this.observer = new UI.support.mutationobserver(function() {
             _this.$element.trigger('changed.selected.amui');
           });
        
           this.observer.observe(this.$element[0], {
             childList: true,
             attributes: true,
             subtree: true,
             characterData: true
           });
         }
        
         // custom event
         this.$element.on('changed.selected.amui', function() {
           _this.renderOptions();
           _this.syncData();
         });
        

        };

        Selected.prototype.destroy = function() {

         this.$element.removeData('amui.selected').show();
         this.$selector.remove();
        

        };

        UI.plugin('selected', Selected);

        // Conflict with jQuery form // https://github.com/malsup/form/blob/6bf24a5f6d8be65f4e5491863180c09356d9dadd/jquery.form.js#L1240-L1258 // https://github.com/allmobilize/amazeui/issues/379 // $.fn.selected = $.fn.selectIt = Plugin;

        UI.ready(function(context) {

         $('[data-am-selected]', context).selected();
        

        });

        module.exports = Selected;

        },{"2":2}],21:[function(_dereq_,module,exports){ 'use strict';

        _dereq_(12); var $ = (window.jQuery); var UI = _dereq_(2); var QRCode = _dereq_(31); var doc = document; var $doc = $(doc);

        var Share = function(options) {

         this.options = $.extend({}, Share.DEFAULTS, options || {});
         this.$element = null;
         this.$wechatQr = null;
         this.pics = null;
         this.inited = false;
         this.active = false;
         // this.init();
        

        };

        Share.DEFAULTS = {

         sns: ['weibo', 'qq', 'qzone', 'tqq', 'wechat', 'renren'],
         title: '分享到',
         cancel: '取消',
         closeOnShare: true,
         id: UI.utils.generateGUID('am-share'),
         desc: 'Hi,孤夜观天象,发现一个不错的西西,分享一下下 ;-)',
         via: 'Amaze UI',
         tpl: '<div class="am-share am-modal-actions" id="<%= id %>">' +
        
        '' + '