onsenui
Version:
HTML5 Mobile Framework & UI Components
2 lines • 326 kB
JavaScript
/* onsenui v2.10.1 - 2018-05-28 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ons=e()}(this,function(){"use strict";function t(t){kt.set(t,!0)}function e(t){var e=wt.get(t,[])||[];wt.delete(t),e.forEach(function(t){return t()})}function n(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};if(void 0===kt&&(kt=new WeakMap,wt=new WeakMap),function(t,e){wt.has(t)||wt.set(t,[]),wt.get(t).push(e)}(n,i),function(e){return e.childNodes.length>0&&t(e),kt.has(e)}(n))e(n);else{new MutationObserver(function(i){t(n),e(n)}).observe(n,{childList:!0,characterData:!0}),setImmediate(function(){t(n),e(n)})}}function i(t){t._destroy instanceof Function?t._destroy():t.remove()}function o(t,e){return e={exports:{}},t(e,e.exports),e.exports}function r(t){var e=gi.has(t),n=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(t);return!e&&n}function a(t){var e=t.isConnected;if(void 0!==e)return e;for(var n=t;n&&!(n.__CE_isImportDocument||n instanceof Document);)n=n.parentNode||(window.ShadowRoot&&n instanceof ShadowRoot?n.host:void 0);return!(!n||!(n.__CE_isImportDocument||n instanceof Document))}function s(t,e){for(var n=e;n&&n!==t&&!n.nextSibling;)n=n.parentNode;return n&&n!==t?n.nextSibling:null}function l(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,i=t;i;){if(i.nodeType===Node.ELEMENT_NODE){var o=i;e(o);var r=o.localName;if("link"===r&&"import"===o.getAttribute("rel")){var a=o.import;if(a instanceof Node&&!n.has(a)){n.add(a);for(var u=a.firstChild;u;u=u.nextSibling)l(u,e,n)}i=s(t,o);continue}if("template"===r){i=s(t,o);continue}var c=o.__CE_shadowRoot;if(c)for(var h=c.firstChild;h;h=h.nextSibling)l(h,e,n)}i=function(t,e){return e.firstChild?e.firstChild:s(t,e)}(t,i)}}function u(t,e,n){t[e]=n}var c={},h=function(){var t=window.getComputedStyle(document.documentElement,""),e=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1];return function(t){return"-"+e+"-"+Q.hyphenate(t)}}(),d=function(t,e){return Object.keys(e).forEach(function(n){n in t.style?t.style[n]=e[n]:h(n)in t.style?t.style[h(n)]=e[n]:Q.warn("No such style property: "+n)}),t};d.clear=function(t){for(var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split(/\s+/).reduce(function(t,e){return t.concat([Q.hyphenate(e),h(e)])},[]),n=[],i=t.style.length-1;i>=0;i--)!function(i){var o=t.style[i];(0===e.length||e.some(function(t){return 0===o.indexOf(t)}))&&n.push(o)}(i);n.forEach(function(e){return t.style[e]=""}),""===t.getAttribute("style")&&t.removeAttribute("style")};var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},g=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),m=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},v=function t(e,n,i){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var r=Object.getPrototypeOf(e);return null===r?void 0:t(r,n,i)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(i)},b=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},y=function(t,e){var n={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},k=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},w=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},E=window.HTMLElement,C=new(function(){function t(){p(this,t),this._selectedPlatform=null,this._ignorePlatformSelect=!1}return g(t,[{key:"select",value:function(t){"string"==typeof t&&(this._selectedPlatform=t.trim().toLowerCase())}},{key:"_getSelectedPlatform",value:function(){return this._ignorePlatformSelect?null:this._selectedPlatform}},{key:"_runOnActualPlatform",value:function(t){this._ignorePlatformSelect=!0;var e=t();return this._ignorePlatformSelect=!1,e}},{key:"isWebView",value:function(){if("loading"===document.readyState||"uninitialized"==document.readyState)throw new Error("isWebView() method is available after dom contents loaded.");return!!(window.cordova||window.phonegap||window.PhoneGap)}},{key:"isIPhone",value:function(){return/iPhone/i.test(navigator.userAgent)}},{key:"isIPhoneX",value:function(){return this.isIPhone()&&(375===window.screen.width&&812===window.screen.height||812===window.screen.width&&375===window.screen.height)}},{key:"isIPad",value:function(){return/iPad/i.test(navigator.userAgent)}},{key:"isIPod",value:function(){return/iPod/i.test(navigator.userAgent)}},{key:"isIOS",value:function(){return this._getSelectedPlatform()?"ios"===this._getSelectedPlatform():"object"!==("undefined"==typeof device?"undefined":f(device))||/browser/i.test(device.platform)?/iPhone|iPad|iPod/i.test(navigator.userAgent):/iOS/i.test(device.platform)}},{key:"isIOS7above",value:function(){if("object"===("undefined"==typeof device?"undefined":f(device))&&!/browser/i.test(device.platform))return/iOS/i.test(device.platform)&&parseInt(device.version.split(".")[0])>=7;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){var t=(navigator.userAgent.match(/\b[0-9]+_[0-9]+(?:_[0-9]+)?\b/)||[""])[0].replace(/_/g,".");return parseInt(t.split(".")[0])>=7}return!1}},{key:"isIOSSafari",value:function(){var t=window.navigator,e=t.userAgent;return!(!this.isIOS()||-1===e.indexOf("Safari")||-1===e.indexOf("Version")||t.standalone)}},{key:"isWKWebView",value:function(){var t=/constructor/i.test(E);return!(!(this.isIOS()&&window.webkit&&window.webkit.messageHandlers&&window.indexedDB)||t)}},{key:"isUIWebView",value:function(){return!(!this.isIOS()||this.isIOSSafari()||this.isWKWebView())}},{key:"isAndroidPhone",value:function(){return/Android/i.test(navigator.userAgent)&&/Mobile/i.test(navigator.userAgent)}},{key:"isAndroidTablet",value:function(){return/Android/i.test(navigator.userAgent)&&!/Mobile/i.test(navigator.userAgent)}},{key:"isAndroid",value:function(){return this._getSelectedPlatform()?"android"===this._getSelectedPlatform():/Android/i.test("object"!==("undefined"==typeof device?"undefined":f(device))||/browser/i.test(device.platform)?navigator.userAgent:device.platform)}},{key:"isWP",value:function(){return this._getSelectedPlatform()?"wp"===this._getSelectedPlatform():"object"!==("undefined"==typeof device?"undefined":f(device))||/browser/i.test(device.platform)?/Windows Phone|IEMobile|WPDesktop/i.test(navigator.userAgent):/Win32NT|WinCE/i.test(device.platform)}},{key:"isBlackBerry",value:function(){return this._getSelectedPlatform()?"blackberry"===this._getSelectedPlatform():"object"!==("undefined"==typeof device?"undefined":f(device))||/browser/i.test(device.platform)?/BlackBerry|RIM Tablet OS|BB10/i.test(navigator.userAgent):/BlackBerry/i.test(device.platform)}},{key:"isOpera",value:function(){return this._getSelectedPlatform()?"opera"===this._getSelectedPlatform():!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0}},{key:"isFirefox",value:function(){return this._getSelectedPlatform()?"firefox"===this._getSelectedPlatform():"undefined"!=typeof InstallTrigger}},{key:"isSafari",value:function(){return this._getSelectedPlatform()?"safari"===this._getSelectedPlatform():Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||"[object SafariRemoteNotification]"===(!window["safari"]||safari.pushNotification).toString()}},{key:"isChrome",value:function(){return this._getSelectedPlatform()?"chrome"===this._getSelectedPlatform():!(!window.chrome||window.opera||navigator.userAgent.indexOf(" OPR/")>=0||navigator.userAgent.indexOf(" Edge/")>=0)}},{key:"isIE",value:function(){return this._getSelectedPlatform()?"ie"===this._getSelectedPlatform():!!document.documentMode}},{key:"isEdge",value:function(){return this._getSelectedPlatform()?"edge"===this._getSelectedPlatform():navigator.userAgent.indexOf(" Edge/")>=0}},{key:"getMobileOS",value:function(){return this.isAndroid()?"android":this.isIOS()?"ios":this.isWP()?"wp":"other"}},{key:"getIOSDevice",value:function(){return this.isIPhone()?"iphone":this.isIPad()?"ipad":this.isIPod()?"ipod":"na"}}]),t}()),A=function(t){return Q.throw("In PageAttributeExpression: "+t)},S={_variables:{},defineVariable:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"string"!=typeof t?A("Variable name must be a string"):"string"!=typeof e&&"function"!=typeof e?A("Variable value must be a string or a function"):this._variables.hasOwnProperty(t)&&!n&&A('"'+t+'" is already defined'),this._variables[t]=e},getVariable:function(t){return this._variables.hasOwnProperty(t)?this._variables[t]:null},removeVariable:function(t){delete this._variables[t]},getAllVariables:function(){return this._variables},_parsePart:function(t){var e=void 0,n=!1,i=0,o=[];0===t.length&&A("Unable to parse empty string");for(var r=0;r<t.length;r++)if("$"===(e=t.charAt(r))&&"{"===t.charAt(r+1)){n&&A("Nested interpolation not supported");t.substring(i,r).length>0&&o.push(t.substring(i,r)),i=r,n=!0}else if("}"===e){n||A("} must be preceeded by ${");t.substring(i,r+1).length>0&&o.push(t.substring(i,r+1)),i=r+1,n=!1}return n&&A("Unterminated interpolation"),o.push(t.substring(i,t.length)),o},_replaceToken:function(t){var e=t.match(/^\${(.*?)}$/);if(!e)return t;var n=e[1].trim(),i=this.getVariable(n);if(null!==i){if("string"==typeof i)return i;var o=i();return"string"!=typeof o&&A("Must return a string"),o}A('Variable "'+n+'" does not exist')},_replaceTokens:function(t){return t.map(this._replaceToken.bind(this))},_parseExpression:function(t){return t.split(",").map(function(t){return t.trim()}).map(this._parsePart.bind(this)).map(this._replaceTokens.bind(this)).map(function(t){return t.join("")})},evaluate:function(t){return t?this._parseExpression(t):[]}};S.defineVariable("mobileOS",C.getMobileOS()),S.defineVariable("iOSDevice",C.getIOSDevice()),S.defineVariable("runtime",function(){return C.isWebView()?"cordova":"browser"});var P={};P.config={autoStatusBarFill:!0,animationsDisabled:!1,warningsDisabled:!1},P.nullElement=window.document.createElement("div"),P.isEnabledAutoStatusBarFill=function(){return!!P.config.autoStatusBarFill},P.normalizePageHTML=function(t){return(""+t).trim()},P.waitDOMContentLoaded=function(t){if("loading"===window.document.readyState||"uninitialized"==window.document.readyState){window.document.addEventListener("DOMContentLoaded",function e(){t(),window.document.removeEventListener("DOMContentLoaded",e)})}else setImmediate(t)},P.autoStatusBarFill=function(t){var e=function e(){P.shouldFillStatusBar()&&t(),document.removeEventListener("deviceready",e)};"object"===("undefined"==typeof device?"undefined":f(device))?document.addEventListener("deviceready",e):-1===["complete","interactive"].indexOf(document.readyState)?P.waitDOMContentLoaded(e):e()},P.shouldFillStatusBar=function(){return P.isEnabledAutoStatusBarFill()&&(C.isWebView()&&C.isIOS7above()&&!C.isIPhoneX()||document.body.querySelector(".ons-status-bar-mock.ios"))},P.templateStore={_storage:{},get:function(t){return P.templateStore._storage[t]||null},set:function(t,e){P.templateStore._storage[t]=e}},window.document.addEventListener("_templateloaded",function(t){"ons-template"===t.target.nodeName.toLowerCase()&&P.templateStore.set(t.templateId,t.template)},!1),P.waitDOMContentLoaded(function(){function t(t){for(var e=window.document.querySelectorAll(t),n=0;n<e.length;n++)P.templateStore.set(e[n].getAttribute("id"),e[n].textContent||e[n].content)}t('script[type="text/ons-template"]'),t('script[type="text/template"]'),t('script[type="text/ng-template"]'),t("template")}),P.getTemplateHTMLAsync=function(t){return new Promise(function(e,n){P.waitDOMContentLoaded(function(){var i=P.templateStore.get(t);if(i){if(i instanceof DocumentFragment)return e(i);var o="string"==typeof i?i:i[1];return e(P.normalizePageHTML(o))}var r=window.document.getElementById(t);if(r){var a=r.textContent||r.content;return e(a)}var s=new XMLHttpRequest;s.open("GET",t,!0),s.onload=function(){var i=s.responseText;if(s.status>=400&&s.status<600)n(i);else{var o=Q.createFragment(i);Q.arrayFrom(o.querySelectorAll("script")).forEach(function(t){var e=document.createElement("script");e.type=t.type||"text/javascript",e.appendChild(document.createTextNode(t.text||t.textContent||t.innerHTML)),t.parentNode.replaceChild(e,t)}),P.templateStore.set(t,o),e(o)}},s.onerror=function(){Q.throw("Page template not found: "+t)},s.send(null)})})},P.getPageHTMLAsync=function(t){var e=S.evaluate(t);return function t(n){return"string"!=typeof n?Promise.reject("Must specify a page."):P.getTemplateHTMLAsync(n).catch(function(n){return 0===e.length?Promise.reject(n):t(e.shift())})}(e.shift())};var O=function(){function t(e){p(this,t),this._animators=e.animators,this._baseClass=e.baseClass,this._baseClassName=e.baseClassName||e.baseClass.name,this._animation=e.defaultAnimation||"default",this._animationOptions=e.defaultAnimationOptions||{},this._animators[this._animation]||Q.throw("No such animation: "+this._animation)}return g(t,[{key:"setAnimationOptions",value:function(t){this._animationOptions=t}},{key:"newAnimator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1],n=null;if(t.animation instanceof this._baseClass)return t.animation;var i=null;if("string"==typeof t.animation&&(i=this._animators[t.animation]),!i&&e)n=e;else{i=i||this._animators[this._animation];var o=Q.extend({},this._animationOptions,t.animationOptions||{},P.config.animationsDisabled?{duration:0,delay:0}:{});"function"==typeof(n=new i(o))&&(n=new n(o))}return n instanceof this._baseClass||Q.throw('"animator" is not an instance of '+this._baseClassName),n}}],[{key:"parseAnimationOptionsString",value:function(t){try{if("string"==typeof t){var e=Q.animationOptionsParse(t);if("object"===(void 0===e?"undefined":f(e))&&null!==e)return e;console.error('"animation-options" attribute must be a JSON object string: '+t)}return{}}catch(e){return console.error('"animation-options" attribute must be a JSON object string: '+t),{}}}}]),t}(),x=!0,T={quiet:"material--flat",light:"material--flat",outline:"material--flat",cta:"","large--quiet":"material--flat large","large--cta":"large",noborder:"",tappable:""},L={};L.android=function(t){var e=t.tagName.toLowerCase();if(!Q.hasModifier(t,"material")){var n=(t.getAttribute("modifier")||"").trim().split(/\s+/).map(function(t){return T.hasOwnProperty(t)?T[t]:t});n.unshift("material"),t.setAttribute("modifier",n.join(" ").trim())}-1===["ons-alert-dialog-button","ons-toolbar-button","ons-back-button","ons-button","ons-list-item","ons-fab","ons-speed-dial","ons-speed-dial-item","ons-tab"].indexOf(e)||t.hasAttribute("ripple")||t.querySelector("ons-ripple")||("ons-list-item"===e?t.hasAttribute("tappable")&&(t.setAttribute("ripple",""),t.removeAttribute("tappable")):t.setAttribute("ripple",""))},L.ios=function(t){Q.removeModifier(t,"material")&&(Q.removeModifier(t,"material--flat")&&Q.addModifier(t,Q.removeModifier(t,"large")?"large--quiet":"quiet"),t.getAttribute("modifier")||t.removeAttribute("modifier")),t.hasAttribute("ripple")&&("ons-list-item"===t.tagName.toLowerCase()&&t.setAttribute("tappable",""),t.removeAttribute("ripple"))};var M={android:!0},D=function(t,e){if(x&&!t.hasAttribute("disable-auto-styling")){var n=C.getMobileOS();if(L.hasOwnProperty(n)&&(M.hasOwnProperty(n)||e))return n}return null},I=function(t,e,n){return D(e,n)?t.split(/\s+/).map(function(t){return T.hasOwnProperty(t)?T[t]:t}).join(" "):t},N={isEnabled:function(){return x},enable:function(){return x=!0},disable:function(){return x=!1},prepare:function(t,e){var n=D(t,e);n&&L[n](t)},mapModifier:I,getPlatform:D,restoreModifier:function(t){if("android"===D(t)){var e=t.getAttribute("modifier")||"",n=I(e,t);if(/(^|\s+)material($|\s+)/i.test(e)||(n="material "+n),n!==e)return t.setAttribute("modifier",n.trim()),!0}return!1}},B=function(){function t(){p(this,t)}return g(t,null,[{key:"diff",value:function(e,n){function i(e){var n={};return t.split(e).forEach(function(t){return n[t]=t}),n}e=i((""+e).trim()),n=i((""+n).trim());var o=Object.keys(e).reduce(function(t,e){return n[e]||t.push(e),t},[]);return{added:Object.keys(n).reduce(function(t,n){return e[n]||t.push(n),t},[]),removed:o}}},{key:"applyDiffToClassList",value:function(t,e,n){t.added.map(function(t){return n.replace(/\*/g,t)}).forEach(function(t){return t.split(/\s+/).forEach(function(t){return e.add(t)})}),t.removed.map(function(t){return n.replace(/\*/g,t)}).forEach(function(t){return t.split(/\s+/).forEach(function(t){return e.remove(t)})})}},{key:"applyDiffToElement",value:function(e,n,i){Object.keys(i).forEach(function(o){for(var r=!o||Q.match(n,o)?[n]:Array.prototype.filter.call(n.querySelectorAll(o),function(t){return!Q.findParent(t,n.tagName,function(t){return t===n})}),a=0;a<r.length;a++)t.applyDiffToClassList(e,r[a].classList,i[o])})}},{key:"onModifierChanged",value:function(e,n,i,o){t.applyDiffToElement(t.diff(e,n),i,o),N.restoreModifier(i)}},{key:"refresh",value:function(e,n){t.applyDiffToElement(t.diff("",e.getAttribute("modifier")||""),e,n)}},{key:"initModifier",value:function(e,n){var i=e.getAttribute("modifier");"string"==typeof i&&t.applyDiffToElement({removed:[],added:t.split(i)},e,n)}},{key:"split",value:function(t){return"string"!=typeof t?[]:t.trim().split(/ +/).filter(function(t){return""!==t})}},{key:"addModifier",value:function(e,n){if(e.hasAttribute("modifier")){var i=t.split(e.getAttribute("modifier"));-1==i.indexOf(n)&&(i.push(n),e.setAttribute("modifier",i.join(" ")))}else e.setAttribute("modifier",n)}},{key:"removeModifier",value:function(e,n){if(e.hasAttribute("modifier")){var i=t.split(e.getAttribute("modifier")),o=i.indexOf(n);-1!==o&&(i.splice(o,1),e.setAttribute("modifier",i.join(" ")))}}}]),t}(),j={_ready:!1,_domContentLoaded:!1,_onDOMContentLoaded:function(){j._domContentLoaded=!0,C.isWebView()?window.document.addEventListener("deviceready",function(){j._ready=!0},!1):j._ready=!0},addBackButtonListener:function(t){if(!this._domContentLoaded)throw new Error("This method is available after DOMContentLoaded");this._ready?window.document.addEventListener("backbutton",t,!1):window.document.addEventListener("deviceready",function(){window.document.addEventListener("backbutton",t,!1)})},removeBackButtonListener:function(t){if(!this._domContentLoaded)throw new Error("This method is available after DOMContentLoaded");this._ready?window.document.removeEventListener("backbutton",t,!1):window.document.addEventListener("deviceready",function(){window.document.removeEventListener("backbutton",t,!1)})}};window.addEventListener("DOMContentLoaded",function(){return j._onDOMContentLoaded()},!1);var H={_store:{},_genId:function(){var t=0;return function(){return t++}}(),set:function(t,e){t.dataset.deviceBackButtonHandlerId&&this.remove(t);var n=t.dataset.deviceBackButtonHandlerId=H._genId();this._store[n]=e},remove:function(t){t.dataset.deviceBackButtonHandlerId&&(delete this._store[t.dataset.deviceBackButtonHandlerId],delete t.dataset.deviceBackButtonHandlerId)},get:function(t){if(t.dataset.deviceBackButtonHandlerId){var e=t.dataset.deviceBackButtonHandlerId;if(!this._store[e])throw new Error;return this._store[e]}},has:function(t){if(!t.dataset)return!1;var e=t.dataset.deviceBackButtonHandlerId;return!!this._store[e]}},R=new(function(){function t(){p(this,t),this._isEnabled=!1,this._boundCallback=this._callback.bind(this)}return g(t,[{key:"enable",value:function(){this._isEnabled||(j.addBackButtonListener(this._boundCallback),this._isEnabled=!0)}},{key:"disable",value:function(){this._isEnabled&&(j.removeBackButtonListener(this._boundCallback),this._isEnabled=!1)}},{key:"fireDeviceBackButtonEvent",value:function(){var t=document.createEvent("Event");t.initEvent("backbutton",!0,!0),document.dispatchEvent(t)}},{key:"_callback",value:function(){this._dispatchDeviceBackButtonEvent()}},{key:"createHandler",value:function(t,e){if(!(t instanceof HTMLElement))throw new Error("element must be an instance of HTMLElement");if(!(e instanceof Function))throw new Error("callback must be an instance of Function");var n={_callback:e,_element:t,disable:function(){H.remove(t)},setListener:function(t){this._callback=t},enable:function(){H.set(t,this)},isEnabled:function(){return H.get(t)===this},destroy:function(){H.remove(t),this._callback=this._element=null}};return n.enable(),n}},{key:"_dispatchDeviceBackButtonEvent",value:function(){function t(e){return{_element:e,callParentHandler:function(){for(var e=this._element.parentNode;e;){if(i=H.get(e))return i._callback(t(e));e=e.parentNode}}}}var e=this._captureTree(),n=this._findHandlerLeafElement(e),i=H.get(n);i._callback(t(n))}},{key:"_captureTree",value:function(){function t(e){var n={element:e,children:Array.prototype.concat.apply([],function(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n]);return e}(e.children).map(function(e){if("none"===e.style.display||!1===e._isShown)return[];if(0===e.children.length&&!H.has(e))return[];var n=t(e);return 0!==n.children.length||H.has(n.element)?[n]:[]}))};if(!H.has(n.element))for(var i=0;i<n.children.length;i++){var o=n.children[i];if(H.has(o.element))return o}return n}return t(document.body)}},{key:"_findHandlerLeafElement",value:function(t){function e(t){return 0===t.children.length?t.element:1===t.children.length?e(t.children[0]):t.children.map(function(t){return t.element}).reduce(function(t,e){if(!t)return e;var n=parseInt(window.getComputedStyle(t,"").zIndex,10),i=parseInt(window.getComputedStyle(e,"").zIndex,10);if(!isNaN(n)&&!isNaN(i))return n>i?t:e;throw new Error("Capturing backbutton-handler is failure.")},null)}return e(t)}}]),t}());P.AnimatorFactory=O,P.ModifierUtil=B,P.dbbDispatcher=R;var F=function(t,e){return t.substr(0,e.length)===e},q=function(t,e){return t.substr(t.length-e.length,e.length)===e},z=function(t){return t.slice(1,-1)},V=function(t){return F(t,"{")&&q(t,"}")},W=function(t){return F(t,"[")&&q(t,"]")},U=function(t){return F(t,"'")&&q(t,"'")||F(t,'"')&&q(t,'"')},X=function(t,e,n){throw new Error("Unexpected token '"+t+"' at position "+(n.length-e.length-1)+" in string: '"+n+"'")},Y=function(t,e,n){return"true"===t||"false"===t?"true"===t:U(t)?z(t):isNaN(t)?V(t)?$(z(t)):W(t)?K(z(t)):void X(t,e,n):+t},G=function(t){var e=(t=t.trim()).length;if(":"===t[0]||","===t[0])e=1;else if("{"===t[0]||"["===t[0]){for(var n=t.charCodeAt(0),i=1,o=1;o<t.length;o++)if(t.charCodeAt(o)===n)i++;else if(t.charCodeAt(o)===n+2&&0==--i){e=o+1;break}}else if("'"===t[0]||'"'===t[0]){for(var r=1;r<t.length;r++)if(t[r]===t[0]){e=r+1;break}}else for(var a=1;a<t.length;a++)if(-1!==[" ",",",":"].indexOf(t[a])){e=a;break}return t.slice(0,e)},$=function(t){for(var e=t=t.trim(),n={},i=!0,o=void 0,r=void 0,a=void 0;t.length>0;)if(r=a,a=G(t),t=t.slice(a.length,t.length).trim(),":"===a&&(!i||!r||","===r)||","===a&&i||":"!==a&&","!==a&&r&&","!==r&&":"!==r)X(a,t,e);else if(":"===a&&i&&r){if(r=U(r)?z(r):r,!function(t){return/^[A-Z_$][A-Z0-9_$]*$/i.test(t)}(r))throw new Error("Invalid key token '"+r+"' at position 0 in string: '"+e+"'");o=r,i=!1}else","===a&&!i&&r&&(n[o]=Y(r,t,e),i=!0);return a&&(n[o]=Y(a,t,e)),n},K=function(t){for(var e=t=t.trim(),n=[],i=void 0,o=void 0;t.length>0;)i=o,o=G(t),t=t.slice(o.length,t.length).trim(),","!==o||i&&","!==i?","===o&&n.push(Y(i,t,e)):X(o,t,e);return o&&(","!==o?n.push(Y(o,t,e)):X(o,t,e)),n},Q={},J="[Onsen UI]";Q.globals={fabOffset:0,errorPrefix:J,supportsPassive:!1},C._runOnActualPlatform(function(){Q.globals.actualMobileOS=C.getMobileOS(),Q.globals.isUIWebView=C.isUIWebView(),Q.globals.isWKWebView=C.isWKWebView()});try{var Z=Object.defineProperty({},"passive",{get:function(){Q.globals.supportsPassive=!0}});window.addEventListener("testPassive",null,Z),window.removeEventListener("testPassive",null,Z)}catch(t){}Q.addEventListener=function(t,e,n,i,o){t.addEventListener(e,n,Q.globals.supportsPassive?i:(i||{}).capture)},Q.removeEventListener=function(t,e,n,i,o){t.removeEventListener(e,n,Q.globals.supportsPassive?i:(i||{}).capture)},Q.prepareQuery=function(t){return t instanceof Function?t:function(e){return Q.match(e,t)}},Q.match=function(t,e){return(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector).call(t,e)},Q.findChild=function(t,e){for(var n=Q.prepareQuery(e),i=0;i<t.childNodes.length;i++){var o=t.childNodes[i];if(o.nodeType===Node.ELEMENT_NODE&&n(o))return o}return null},Q.findParent=function(t,e,n){for(var i=Q.prepareQuery(e),o=t.parentNode;;){if(!o||o===document||o instanceof DocumentFragment||n&&n(o))return null;if(i(o))return o;o=o.parentNode}},Q.isAttached=function(t){return document.body.contains(t)},Q.hasAnyComponentAsParent=function(t){for(;t&&document.documentElement!==t;)if((t=t.parentNode)&&t.nodeName.toLowerCase().match(/(ons-navigator|ons-tabbar|ons-modal)/))return!0;return!1},Q.getAllChildNodes=function(t){var e;return(e=[t]).concat.apply(e,w(Array.from(t.children).map(function(t){return Q.getAllChildNodes(t)})))},Q.isPageControl=function(t){return t.nodeName.match(/^ons-(navigator|splitter|tabbar|page)$/i)},Q.propagateAction=function(t,e){for(var n=0;n<t.childNodes.length;n++){var i=t.childNodes[n];i[e]instanceof Function?i[e]():Q.propagateAction(i,e)}},Q.camelize=function(t){return t.toLowerCase().replace(/-([a-z])/g,function(t,e){return e.toUpperCase()})},Q.hyphenate=function(t){return t.replace(/([a-zA-Z])([A-Z])/g,"$1-$2").toLowerCase()},Q.create=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.split("."),i=document.createElement(n.shift()||"div");return n.length&&(i.className=n.join(" ")),d(i,e),i},Q.createElement=function(t){var e=document.createElement("div");t instanceof DocumentFragment?e.appendChild(document.importNode(t,!0)):e.innerHTML=t.trim(),e.children.length>1&&Q.throw("HTML template must contain a single root element");var n=e.children[0];return e.children[0].remove(),n},Q.createFragment=function(t){var e=document.createElement("template");return e.innerHTML=t,document.importNode(e.content,!0)},Q.extend=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];for(var o=0;o<n.length;o++)if(n[o])for(var r=Object.keys(n[o]),a=0;a<r.length;a++){var s=r[a];t[s]=n[o][s]}return t},Q.arrayFrom=function(t){return Array.prototype.slice.apply(t)},Q.parseJSONObjectSafely=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{var n=JSON.parse(""+t);if("object"===(void 0===n?"undefined":f(n))&&null!==n)return n}catch(t){return e}return e},Q.findFromPath=function(t){t=t.split(".");for(var e,n=window;e=t.shift();)n=n[e];return n},Q.getTopPage=function(t){return t&&("ons-page"===t.tagName.toLowerCase()?t:t.topPage)||null},Q.findToolbarPage=function(t){var e=Q.getTopPage(t);if(e){if(e._canAnimateToolbar())return e;for(var n=0;n<e._contentElement.children.length;n++){var i=Q.getTopPage(e._contentElement.children[n]);if(i&&!/ons-tabbar/i.test(e._contentElement.children[n].tagName))return Q.findToolbarPage(i)}}return null},Q.triggerElementEvent=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});return Object.keys(n).forEach(function(t){i[t]=n[t]}),t.dispatchEvent(i),i},Q.hasModifier=function(t,e){return!!t.hasAttribute("modifier")&&RegExp("(^|\\s+)"+e+"($|\\s+)","i").test(t.getAttribute("modifier"))},Q.addModifier=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.autoStyle&&(e=N.mapModifier(e,t,n.forceAutoStyle)),!Q.hasModifier(t,e)&&(t.setAttribute("modifier",((t.getAttribute("modifier")||"")+" "+e).trim()),!0)},Q.removeModifier=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(n.autoStyle&&(e=N.mapModifier(e,t,n.forceAutoStyle)),!t.getAttribute("modifier")||!Q.hasModifier(t,e))return!1;var i=t.getAttribute("modifier").split(/\s+/).filter(function(t){return t&&t!==e});return i.length?t.setAttribute("modifier",i.join(" ")):t.removeAttribute("modifier"),!0},Q.toggleModifier=function(){var t=arguments.length>2?arguments.length<=2?void 0:arguments[2]:{},e="boolean"==typeof t?t:t.force;("boolean"==typeof e?e:!Q.hasModifier.apply(Q,arguments))?Q.addModifier.apply(Q,arguments):Q.removeModifier.apply(Q,arguments)},Q.restoreClass=function(t,e,n){e.split(/\s+/).forEach(function(e){return""!==e&&!t.classList.contains(e)&&t.classList.add(e)}),t.hasAttribute("modifier")&&B.refresh(t,n)},Q.updateParentPosition=function(t){!t._parentUpdated&&t.parentElement&&("static"===window.getComputedStyle(t.parentElement).getPropertyValue("position")&&(t.parentElement.style.position="relative"),t._parentUpdated=!0)},Q.toggleAttribute=function(t,e,n){n?t.setAttribute(e,"boolean"==typeof n?"":n):t.removeAttribute(e)},Q.bindListeners=function(t,e){e.forEach(function(e){var n=e.replace(/^_[a-z]/,"_bound"+e[1].toUpperCase());t[n]=t[n]||t[e].bind(t)})},Q.each=function(t,e){return Object.keys(t).forEach(function(n){return e(n,t[n])})},Q.updateRipple=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};void 0===e&&(e=t.hasAttribute("ripple"));var i=Q.findChild(t,"ons-ripple");if(e){if(!i){var o=document.createElement("ons-ripple");Object.keys(n).forEach(function(t){return o.setAttribute(t,n[t])}),t.insertBefore(o,t.firstChild)}}else i&&i.remove()},Q.animationOptionsParse=function(t){if(t=t.trim(),V(t))return $(z(t));if(W(t))return K(z(t));throw new Error("Provided string must be object or array like: "+t)},Q.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Q.defer=function(){var t={};return t.promise=new Promise(function(e,n){t.resolve=e,t.reject=n}),t},Q.warn=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];if(!P.config.warningsDisabled){var i;(i=console).warn.apply(i,[J].concat(e))}},Q.throw=function(t){throw new Error(J+" "+t)},Q.throwAbstract=function(){return Q.throw("Cannot instantiate abstract class")},Q.throwMember=function(){return Q.throw("Class member must be implemented")},Q.throwPageLoader=function(){return Q.throw("First parameter should be an instance of PageLoader")},Q.throwAnimator=function(t){return Q.throw('"Animator" param must inherit '+t+"Animator")};var tt=function(t){return t.cancelable&&t.preventDefault()};Q.iosPreventScroll=function(t){if("ios"===Q.globals.actualMobileOS){t.on("touchmove",tt),t.on("dragend",function e(n){t.off("touchmove",tt),t.off("dragend",e)})}},Q.iosPageScrollFix=function(t){"ios"===Q.globals.actualMobileOS&&(document.body.classList.toggle("ons-ios-scroll",t),Q.globals.isUIWebView&&!P.config.forceUIWebViewScrollFix||document.body.classList.toggle("ons-ios-scroll-fix",t))},Q.iosMaskScrollFix=function(t,e){if(Q.globals.isUIWebView){t[(e?"add":"remove")+"EventListener"]("touchmove",tt,!1)}},Q.isValidGesture=function(t){return void 0!==t.gesture&&(t.gesture.distance<=15||t.gesture.deltaTime<=100)},Q.checkMissingImport=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach(function(t){c[t]||Q.throw("Ons"+t+" is required but was not imported (Custom Elements)")})};var et={};et.capitalize=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},et.buildTransitionValue=function(t){t.property=t.property||"all",t.duration=t.duration||.4,t.timing=t.timing||"linear";return t.property.split(/ +/).map(function(e){return e+" "+t.duration+"s "+t.timing}).join(", ")},et.onceOnTransitionEnd=function(t,e){if(!t)return function(){};var n=function(n){t==n.target&&(n.stopPropagation(),i(),e())},i=function(){et._transitionEndEvents.forEach(function(e){t.removeEventListener(e,n,!1)})};return et._transitionEndEvents.forEach(function(e){t.addEventListener(e,n,!1)}),i},et._transitionEndEvents="ontransitionend"in window?["transitionend"]:"onwebkittransitionend"in window?["webkitTransitionEnd"]:"webkit"===et.vendorPrefix||"o"===et.vendorPrefix||"moz"===et.vendorPrefix||"ms"===et.vendorPrefix?[et.vendorPrefix+"TransitionEnd","transitionend"]:[],et._cssPropertyDict=function(){for(var t=window.getComputedStyle(document.documentElement,""),e={},n="A".charCodeAt(0),i="z".charCodeAt(0),o=0;o<t.length;o++){var r=t[o].replace(/^[-]+/,"").replace(/[-][a-z]/g,function(t){return t.substr(1).toUpperCase()}).replace(/^moz/,"Moz");n<=r.charCodeAt(0)&&i>=r.charCodeAt(0)&&"cssText"!==r&&"parentText"!==r&&(e[r]=!0)}return e}(),et.hasCssProperty=function(t){return t in et._cssPropertyDict},et.vendorPrefix=function(){var t=window.getComputedStyle(document.documentElement,"");return(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1]}(),et.forceLayoutAtOnce=function(t,e){this.batchImmediate(function(){t.forEach(function(t){t.offsetHeight}),e()})},et.batchImmediate=function(){var t=[];return function(e){0===t.length&&setImmediate(function(){var e=t.slice(0);t=[],e.forEach(function(t){t()})}),t.push(e)}}(),et.batchAnimationFrame=function(){var t=[],e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)};return function(n){0===t.length&&e(function(){var e=t.slice(0);t=[],e.forEach(function(t){t()})}),t.push(n)}}(),et.transitionPropertyName=function(){if(et.hasCssProperty("transitionDuration"))return"transition";if(et.hasCssProperty(et.vendorPrefix+"TransitionDuration"))return et.vendorPrefix+"Transition";throw new Error("Invalid state")}();var nt=function t(e,n){if(!(this instanceof t))return new t(e,n);if(e instanceof HTMLElement)this.elements=[e];else{if("[object Array]"!==Object.prototype.toString.call(e))throw new Error("First argument must be an array or an instance of HTMLElement.");this.elements=e}this.defaults=n,this.transitionQueue=[],this.lastStyleAttributeDict=[]};nt.prototype={transitionQueue:void 0,elements:void 0,defaults:void 0,play:function(t){return"function"==typeof t&&this.transitionQueue.push(function(e){t(),e()}),this.startAnimation(),this},default:function(t,e,n){function i(t,e,n){return void 0!==t.duration&&(e=t.duration),void 0!==t.timing&&(n=t.timing),{css:t.css||t,duration:e,timing:n}}return this.saveStyle().queue(i(t,0,this.defaults.timing)).wait(void 0===n?this.defaults.delay:n).queue(i(e,this.defaults.duration,this.defaults.timing)).restoreStyle()},queue:function(t,e){var n=this.transitionQueue;if(t&&e&&(e.css=t,t=new nt.Transition(e)),t instanceof Function||t instanceof nt.Transition||(t=new nt.Transition(t.css?t:{css:t})),t instanceof Function)n.push(t);else{if(!(t instanceof nt.Transition))throw new Error("Invalid arguments");n.push(t.build())}return this},wait:function(t){return t>0&&this.transitionQueue.push(function(e){setTimeout(e,1e3*t)}),this},saveStyle:function(){return this.transitionQueue.push(function(t){this.elements.forEach(function(t,e){for(var n=this.lastStyleAttributeDict[e]={},i=0;i<t.style.length;i++)n[t.style[i]]=t.style[t.style[i]]}.bind(this)),t()}.bind(this)),this},restoreStyle:function(t){var e=this;if((t=t||{}).transition&&!t.duration)throw new Error('"options.duration" is required when "options.transition" is enabled.');var n=et.transitionPropertyName;if(t.transition||t.duration&&t.duration>0){var i=t.transition||"all "+t.duration+"s "+(t.timing||"linear");this.transitionQueue.push(function(o){var r,a=this.elements,s=function(){a.forEach(function(t){t.style[n]=""})},l=et.onceOnTransitionEnd(a[0],function(){clearTimeout(r),s(),o()});r=setTimeout(function(){l(),s(),o()},1e3*t.duration*1.4),a.forEach(function(t,o){var r=e.lastStyleAttributeDict[o];if(!r)throw new Error("restoreStyle(): The style is not saved. Invoke saveStyle() before.");e.lastStyleAttributeDict[o]=void 0;for(var a,s=0,l=t.style.length;s<l;s++)a=t.style[s],void 0===r[a]&&(r[a]="");t.style[n]=i,Object.keys(r).forEach(function(e){e!==n&&(t.style[e]=r[e])}),t.style[n]=i})})}else this.transitionQueue.push(function(t){e.elements.forEach(function(t,i){t.style[n]="none";var o=e.lastStyleAttributeDict[i];if(!o)throw new Error("restoreStyle(): The style is not saved. Invoke saveStyle() before.");e.lastStyleAttributeDict[i]=void 0;for(var r=0;r<t.style.length;r++)t.style[r],void 0===o[t.style[r]]&&(o[t.style[r]]="");Object.keys(o).forEach(function(e){t.style[e]=o[e]})}),t()});return this},startAnimation:function(){return this._dequeueTransition(),this},_dequeueTransition:function(){var t=this.transitionQueue.shift();if(this._currentTransition)throw new Error("Current transition exists.");this._currentTransition=t;var e=this,n=!1;t&&t.call(this,function(){if(n)throw new Error("Invalid state: This callback is called twice.");n=!0,e._currentTransition=void 0,e._dequeueTransition()})}},nt.runAll=function(){for(var t=0;t<arguments.length;t++)arguments[t].play()},(nt.Transition=function(t){this.options=t||{},this.options.duration=this.options.duration||0,this.options.timing=this.options.timing||"linear",this.options.css=this.options.css||{},this.options.property=this.options.property||"all"}).prototype={build:function(){if(0===Object.keys(this.options.css).length)throw new Error("options.css is required.");var t=function(t){var e={};return Object.keys(t).forEach(function(n){var i=t[n];if(et.hasCssProperty(n))e[n]=i;else{var o=et.vendorPrefix+et.capitalize(n);et.hasCssProperty(o)?e[o]=i:(e[o]=i,e[n]=i)}}),e}(this.options.css);if(this.options.duration>0){var e=et.buildTransitionValue(this.options),n=this;return function(i){var o,r=this.elements,a=1e3*n.options.duration*1.4,s=et.onceOnTransitionEnd(r[0],function(){clearTimeout(o),i()});o=setTimeout(function(){s(),i()},a),r.forEach(function(n){n.style[et.transitionPropertyName]=e,Object.keys(t).forEach(function(e){n.style[e]=t[e]})})}}if(this.options.duration<=0)return function(e){var n=this.elements;n.forEach(function(e){e.style[et.transitionPropertyName]="",Object.keys(t).forEach(function(n){e.style[n]=t[n]})}),n.length>0?et.forceLayoutAtOnce(n,function(){et.batchAnimationFrame(e)}):et.batchAnimationFrame(e)}}};var it,ot,rt,at,st=function t(e,n){return new t.Instance(e,n||{})};st.defaults={behavior:{touchAction:"pan-y",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},st.DOCUMENT=document,st.HAS_POINTEREVENTS=navigator.pointerEnabled||navigator.msPointerEnabled,st.HAS_TOUCHEVENTS="ontouchstart"in window,st.IS_MOBILE=/mobile|tablet|ip(ad|hone|od)|android|silk/i.test(navigator.userAgent),st.NO_MOUSEEVENTS=st.HAS_TOUCHEVENTS&&st.IS_MOBILE||st.HAS_POINTEREVENTS,st.CALCULATE_INTERVAL=25;var lt={},ut=st.DIRECTION_DOWN="down",ct=st.DIRECTION_LEFT="left",ht=st.DIRECTION_UP="up",dt=st.DIRECTION_RIGHT="right",ft=st.POINTER_MOUSE="mouse",pt=st.POINTER_TOUCH="touch",gt=st.POINTER_PEN="pen",mt=st.EVENT_START="start",_t=st.EVENT_MOVE="move",vt=st.EVENT_END="end",bt=st.EVENT_RELEASE="release",yt=st.EVENT_TOUCH="touch";st.READY=!1,st.plugins=st.plugins||{},st.gestures=st.gestures||{},ot=st.utils={extend:function(t,e,n){for(var i in e)!e.hasOwnProperty(i)||void 0!==t[i]&&n||(t[i]=e[i]);return t},on:function(t,e,n,i){Q.addEventListener(t,e,n,i,!0)},off:function(t,e,n,i){Q.removeEventListener(t,e,n,i,!0)},each:function(t,e,n){var i,o;if("forEach"in t)t.forEach(e,n);else if(void 0!==t.length){for(i=0,o=t.length;i<o;i++)if(!1===e.call(n,t[i],i,t))return}else for(i in t)if(t.hasOwnProperty(i)&&!1===e.call(n,t[i],i,t))return},inStr:function(t,e){return t.indexOf(e)>-1},inArray:function(t,e,n){if(n){for(var i=0,o=t.length;i<o;i++)if(Object.keys(e).every(function(n){return t[i][n]===e[n]}))return i;return-1}if(t.indexOf)return t.indexOf(e);for(var i=0,o=t.length;i<o;i++)if(t[i]===e)return i;return-1},toArray:function(t){return Array.prototype.slice.call(t,0)},hasParent:function(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1},getCenter:function(t){var e=[],n=[],i=[],o=[],r=Math.min,a=Math.max;return 1===t.length?{pageX:t[0].pageX,pageY:t[0].pageY,clientX:t[0].clientX,clientY:t[0].clientY}:(ot.each(t,function(t){e.push(t.pageX),n.push(t.pageY),i.push(t.clientX),o.push(t.clientY)}),{pageX:(r.apply(Math,e)+a.apply(Math,e))/2,pageY:(r.apply(Math,n)+a.apply(Math,n))/2,clientX:(r.apply(Math,i)+a.apply(Math,i))/2,clientY:(r.apply(Math,o)+a.apply(Math,o))/2})},getVelocity:function(t,e,n){return{x:Math.abs(e/t)||0,y:Math.abs(n/t)||0}},getAngle:function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return 180*Math.atan2(i,n)/Math.PI},getDirection:function(t,e){return Math.abs(t.clientX-e.clientX)>=Math.abs(t.clientY-e.clientY)?t.clientX-e.clientX>0?ct:dt:t.clientY-e.clientY>0?ht:ut},getDistance:function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},getScale:function(t,e){return t.length>=2&&e.length>=2?this.getDistance(e[0],e[1])/this.getDistance(t[0],t[1]):1},getRotation:function(t,e){return t.length>=2&&e.length>=2?this.getAngle(e[1],e[0])-this.getAngle(t[1],t[0]):0},isVertical:function(t){return t==ht||t==ut},setPrefixedCss:function(t,e,n,i){var o=["","Webkit","Moz","O","ms"];e=ot.toCamelCase(e);for(var r=0;r<o.length;r++){var a=e;if(o[r]&&(a=o[r]+a.slice(0,1).toUpperCase()+a.slice(1)),a in t.style){t.style[a]=(null===i||i)&&n||"";break}}},toggleBehavior:function(t,e,n){if(e&&t&&t.style){ot.each(e,function(e,i){ot.setPrefixedCss(t,i,e,n)});var i=n&&function(){return!1};"none"==e.userSelect&&(t.onselectstart=i),"none"==e.userDrag&&(t.ondragstart=i)}},toCamelCase:function(t){return t.replace(/[_-]([a-z])/g,function(t){return t[1].toUpperCase()})}},it=st.event={preventMouseEvents:!1,started:!1,shouldDetect:!1,on:function(t,e,n,i,o){var r=e.split(" ");ot.each(r,function(e){ot.on(t,e,n,i),o&&o(e)})},off:function(t,e,n,i,o){var r=e.split(" ");ot.each(r,function(e){ot.off(t,e,n,i),o&&o(e)})},onTouch:function(t,e,n,i){var o=this,r=function(i){var r,a=i.type.toLowerCase(),s=st.HAS_POINTEREVENTS,l=ot.inStr(a,"mouse");l&&o.preventMouseEvents||(l&&e==mt&&0===i.button?(o.preventMouseEvents=!1,o.shouldDetect=!0):s&&e==mt?o.shouldDetect=1===i.buttons||at.matchType(pt,i):l||e!=mt||(o.preventMouseEvents=!0,o.shouldDetect=!0),s&&e!=vt&&at.updatePointer(e,i),o.shouldDetect&&(r=o.doDetect.call(o,i,e,t,n)),r==vt&&(o.preventMouseEvents=!1,o.shouldDetect=!1,at.reset()),s&&e==vt&&at.updatePointer(e,i))};return this.on(t,lt[e],r,i),r},doDetect:function(t,e,n,i){var o=this.getTouchList(t,e),r=o.length,a=e,s=o.trigger,l=r;e==mt?s=yt:e==vt&&(s=bt,l=o.length-(t.changedTouches?t.changedTouches.length:1)),l>0&&this.started&&(a=_t),this.started=!0;var u=this.collectEventData(n,a,o,t);return e!=vt&&i.call(rt,u),s&&(u.changedLength=l,u.eventType=s,i.call(rt,u),u.eventType=a,delete u.changedLength),a==vt&&(i.call(rt,u),this.started=!1),a},determineEventTypes:function(){var t;return t=st.HAS_POINTEREVENTS?window.PointerEvent?["pointerdown","pointermove","pointerup pointercancel lostpointercapture"]:["MSPointerDown","MSPointerMove","MSPointerUp MSPointerCancel MSLostPointerCapture"]:st.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],lt[mt]=t[0],lt[_t]=t[1],lt[vt]=t[2],lt},getTouchList:function(t,e){if(st.HAS_POINTEREVENTS)return at.getTouchList();if(t.touches){if(e==_t)return t.touches;var n=[],i=[].concat(ot.toArray(t.touches),ot.toArray(t.changedTouches)),o=[];return ot.each(i,function(t){-1===ot.inArray(n,t.identifier)&&o.push(t),n.push(t.identifier)}),o}return t.identifier=1,[t]},collectEventData:function(t,e,n,i){var o=pt;return ot.inStr(i.type,"mouse")||at.matchType(ft,i)?o=ft:at.matchType(gt,i)&&(o=gt),{center:ot.getCenter(n),timeStamp:Date.now(),target:i.target,touches:n,eventType:e,pointerType:o,srcEvent:i,preventDefault:function(){var t=this.srcEvent;t.preventManipulation&&t.preventManipulation(),t.preventDefault&&t.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return rt.stopDetect()}}}},at=st.PointerEvent={pointers:{},getTouchList:function(){var t=[];return ot.each(this.pointers,function(e){t.push(e)}),t},updatePointer:function(t,e){t==vt||t!=vt&&1!==e.buttons?delete this.pointers[e.pointerId]:(e.identifier=e.pointerId,this.pointers[e.pointerId]=e)},matchType:function(t,e){if(!e.pointerType)return!1;var n=e.pointerType,i={};return i[ft]=n===(e.MSPOINTER_TYPE_MOUSE||ft),i[pt]=n===(e.MSPOINTER_TYPE_TOUCH||pt),i[gt]=n===(e.MSPOINTER_TYPE_PEN||gt),i[t]},reset:function(){this.pointers={}}},rt=st.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(t,e){this.current||(this.stopped=!1,this.current={inst:t,startEvent:ot.extend({},e),lastEvent:!1,lastCalcEvent:!1,futureCalcEvent:!1,lastCalcData:{},name:""},this.detect(e))},detect:function(t){if(this.current&&!this.stopped){t=this.extendEventData(t);var e=this.current.inst,n=e.options;return ot.each(this.gestures,function(i){!this.stopped&&e.enabled&&n[i.name]&&i.handler.call(i,t,e)},this),this.current&&(this.current.lastEvent=t),t.eventType==vt&&this.stopDetect(),t}},stopDetect:function(){this.previous=ot.extend({},this.current),this.current=null,this.stopped=!0},getCalculatedData:function(t,e,n,i,o){var r=this.current,a=!1,s=r.lastCalcEvent,l=r.lastCalcData;s&&t.timeStamp-s.timeStamp>st.CALCULATE_INTERVAL&&(e=s.center,n=t.timeStamp-s.timeStamp,i=t.center.clientX-s.center.clientX,o=t.center.clientY-s.center.clientY,a=!0),t.eventType!=yt&&t.eventType!=bt||(r.futureCalcEvent=t),r.lastCalcEvent&&!a||(l.velocity=ot.getVelocity(n,i,o),l.angle=ot.getAngle(e,t.center),l.direction=ot.getDirection(e,t.center),r.lastCalcEvent=r.futureCalcEvent||t,r.futureCalcEvent=t),t.velocityX=l.velocity.x,t.velocityY=l.velocity.y,t.interimAngle=l.angle,t.interimDirection=l.direction},extendEventData:function(t){var e=this.current,n=e.startEvent,i=e.lastEvent||n;t.eventType!=yt&&t.eventType!=bt||(n.touches=[],ot.each(t.touches,function(t){n.touches.push({clientX:t.clientX,clientY:t.clientY})}));var o=t.timeStamp-n.timeStamp,r=t.center.clientX-n.center.clientX,a=t.center.clientY-n.center.clientY;return this.getCalculatedData(t,i.center,o,r,a),ot.extend(t,{startEvent:n,deltaTime:o,deltaX:r,deltaY:a,distance:ot.getDistance(n.center,t.center),angle:ot.getAngle(n.center,t.center),direction:ot.getDirection(n.center,t.center),scale:ot.getScale(n.touches,t.touches),rotation:ot.getRotation(n.touches,t.touches)}),t},register:function(t){var e=t.defaults||{};return void 0===e[t.name]&&(e[t.name]=!0),ot.extend(st.defaults,e,!0),t.index=t.index||1e3,this.gestures.push(t),this.gestures.sort(function(t,e){return t.index<e.index?-1:t.index>e.index?1:0}),this.gestures}},st.Instance=function(t,e){var n=this,i=e&&e.passive?{passive:!0}:void 0;!function(t){st.READY||(it.determineEventTypes(),ot.each(st.gestures,function(t){rt.register(t)}),it.onTouch(st.DOCUMENT,_t,rt.detect,t),it.onTouch(st.DOCUMENT,vt,rt.detect,t),st.READY=!0)}(i),this.element=t,this.enabled=!0,ot.each(e,function(t,n){delete e[n],e[ot.toCamelCase(n)]=t}),this.options=ot.extend(ot.extend({},st.defaults),e||{}),this.options.listenerOptions=i,this.options.behavior&&ot.toggleBehavior(this.element,this.options.behavior,!0),this.eventStartHandler=it.onTouch(t,mt,function(t){n.enabled&&t.eventType==mt?rt.startDetect(n,t):t.eventType==yt&&rt.detect(t)},i),this.eventHandlers=[]},st.Instance.prototype={on:function(t,e,n){var i=this;return it.on(i.element,t,e,Q.extend({},i.options.listenerOptions,n),function(t){i.eventHandlers.push({gesture:t,handler:e})}),i},off:function(t,e,n){var i=this;return it.off(i.element,t,e,Q.extend({},i.options.listenerOptions,n),function(t){var n=ot.inArray(i.eventHandlers,{gesture:t,handler:e},!0);n>=0&&i.eventHandlers.splice(n,1)}),i},trigger:function(t,e){e||(e={});var n=st.DOCUMENT.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=e;var i=this.element;return ot.hasParent(e.target,i)&&(i=e.target),i.dispatchEvent(n),this},enable:function(t){return this.enabled=t,this},dispose:function(){var t,e;for(ot.toggleBehavior(this.element,this.options.behavior,!1),t=-1;e=this.eventHandlers[++t];)ot.off(this.element,e.gesture,e.handler);return this.eventHandlers=[],it.off(this.element,lt[mt],this.eventStartHandler),null}},function(t){var e=!1;st.gestures.Drag={name:t,index:50,handler:function(n,i){var o=rt.current;if(!(i.options.dragMaxTouches>0&&n.touches.length>i.options.dragMaxTouches))switch(n.eventType){case mt:e=!1;break;case _t:if(n.distance<i.options.dragMinDistance&&o.name!=t)return;var r=o.startEvent.center;if(o.name!=t&&(o.name=t,i.options.dragDistanceCorrection&&n.distance>0)){var a=Math.abs(i.options.dragMinDistance/n.distance);r.pageX+=n.deltaX*a,r.pageY+=n.deltaY*a,r.clientX+=n.deltaX*a,r.clientY+=n.deltaY*a,n=rt.extendEventData(n)}(o.lastEvent.dragLockToAxis||i.options.dragLockToAxis&&i.options.dragLockMinDistance<=n.distance)&&(n.dragLockToAxis=!0);var s=o.lastEvent.direction;n.dragLockToAxis&&s!==n.direction&&(ot.isVertical(s)?n.direction=n.deltaY<0?ht:ut:n.direction=n.deltaX<0?ct:dt),e||(i.trigger(t+"start",n),e=!0),i.trigger(t,n),i.trigger(t+n.direction,n);var l=ot.isVertical(n.direction)