!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";function e(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}function n(e){return!(!e||"undefined"==typeof e.length)}function t(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],c(e,this)}function r(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){var o;try{o=t(e._value)}catch(r){return void f(n.promise,r)}i(n.promise,o)}else(1===e._state?i:f)(n.promise,e._value)})):e._deferreds.push(n)}function i(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if(n instanceof o)return e._state=3,e._value=n,void u(e);if("function"==typeof t)return void c(function(e,n){return function(){e.apply(n,arguments)}}(t,n),e)}e._state=1,e._value=n,u(e)}catch(r){f(e,r)}}function f(e,n){e._state=2,e._value=n,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;t>n;n++)r(e,e._deferreds[n]);e._deferreds=null}function c(e,n){var t=!1;try{e(function(e){t||(t=!0,i(n,e))},function(e){t||(t=!0,f(n,e))})}catch(o){if(t)return;t=!0,f(n,o)}}var a=setTimeout;o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,n){var o=new this.constructor(t);return r(this,new function(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}(e,n,o)),o},o.prototype["finally"]=e,o.all=function(e){return new o(function(t,o){function r(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(n){r(e,n)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))return o(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(n){n(e)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(e){return new o(function(t,r){if(!n(e))return r(new TypeError("Promise.race accepts an array"));for(var i=0,f=e.length;f>i;i++)o.resolve(e[i]).then(t,r)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=o});

!function(){"use strict";function o(){var o=window,t=document;if(!("scrollBehavior"in t.documentElement.style&&!0!==o.__forceSmoothScrollPolyfill__)){var l,e=o.HTMLElement||o.Element,r=468,i={scroll:o.scroll||o.scrollTo,scrollBy:o.scrollBy,elementScroll:e.prototype.scroll||n,scrollIntoView:e.prototype.scrollIntoView},s=o.performance&&o.performance.now?o.performance.now.bind(o.performance):Date.now,c=(l=o.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(l)?1:0);o.scroll=o.scrollTo=function(){void 0!==arguments[0]&&(!0!==f(arguments[0])?h.call(o,t.body,void 0!==arguments[0].left?~~arguments[0].left:o.scrollX||o.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:o.scrollY||o.pageYOffset):i.scroll.call(o,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:o.scrollX||o.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:o.scrollY||o.pageYOffset))},o.scrollBy=function(){void 0!==arguments[0]&&(f(arguments[0])?i.scrollBy.call(o,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):h.call(o,t.body,~~arguments[0].left+(o.scrollX||o.pageXOffset),~~arguments[0].top+(o.scrollY||o.pageYOffset)))},e.prototype.scroll=e.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==f(arguments[0])){var o=arguments[0].left,t=arguments[0].top;h.call(this,this,void 0===o?this.scrollLeft:~~o,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},e.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==f(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},e.prototype.scrollIntoView=function(){if(!0!==f(arguments[0])){var l=function(o){for(;o!==t.body&&!1===(e=p(l=o,"Y")&&a(l,"Y"),r=p(l,"X")&&a(l,"X"),e||r);)o=o.parentNode||o.host;var l,e,r;return o}(this),e=l.getBoundingClientRect(),r=this.getBoundingClientRect();l!==t.body?(h.call(this,l,l.scrollLeft+r.left-e.left,l.scrollTop+r.top-e.top),"fixed"!==o.getComputedStyle(l).position&&o.scrollBy({left:e.left,top:e.top,behavior:"smooth"})):o.scrollBy({left:r.left,top:r.top,behavior:"smooth"})}else i.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function n(o,t){this.scrollLeft=o,this.scrollTop=t}function f(o){if(null===o||"object"!=typeof o||void 0===o.behavior||"auto"===o.behavior||"instant"===o.behavior)return!0;if("object"==typeof o&&"smooth"===o.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+o.behavior+" is not a valid value for enumeration ScrollBehavior.")}function p(o,t){return"Y"===t?o.clientHeight+c<o.scrollHeight:"X"===t?o.clientWidth+c<o.scrollWidth:void 0}function a(t,l){var e=o.getComputedStyle(t,null)["overflow"+l];return"auto"===e||"scroll"===e}function d(t){var l,e,i,c,n=(s()-t.startTime)/r;c=n=n>1?1:n,l=.5*(1-Math.cos(Math.PI*c)),e=t.startX+(t.x-t.startX)*l,i=t.startY+(t.y-t.startY)*l,t.method.call(t.scrollable,e,i),e===t.x&&i===t.y||o.requestAnimationFrame(d.bind(o,t))}function h(l,e,r){var c,f,p,a,h=s();l===t.body?(c=o,f=o.scrollX||o.pageXOffset,p=o.scrollY||o.pageYOffset,a=i.scroll):(c=l,f=l.scrollLeft,p=l.scrollTop,a=n),d({scrollable:c,method:a,startTime:h,startX:f,startY:p,x:e,y:r})}}"object"==typeof exports&&"undefined"!=typeof module?module.exports={polyfill:o}:o()}();
/*!
 * ionic.bundle.js is a concatenation of:
 * ionic.js, angular.js, angular-animate.js,
 * angular-sanitize.js, angular-ui-router.js,
 * and ionic-angular.js
 */

/*!
 * Copyright 2015 Drifty Co.
 * http://drifty.com/
 *
 * Ionic, v1.3.1
 * A powerful HTML5 mobile app framework.
 * http://ionicframework.com/
 *
 * By @maxlynch, @benjsperry, @adamdbradley <3
 *
 * Licensed under the MIT license. Please see LICENSE for more information.
 *
 */

!function(){function e(e,t,n){t!==!1?X.addEventListener(e,J[e],n):X.removeEventListener(e,J[e])}function t(e){var t=w(e.target),i=T(t);if(ionic.tap.requiresNativeClick(i)||$)return!1;var r=ionic.tap.pointerCoord(e);n("click",i,r.x,r.y),h(i)}function n(e,t,n,i){var r=document.createEvent("MouseEvents");r.initMouseEvent(e,!0,!0,window,1,0,0,n,i,!1,!1,!1,!1,0,null),r.isIonicTap=!0,t.dispatchEvent(r)}function i(e){return"submit"==e.target.type&&0===e.detail?null:ionic.scroll.isScrolling&&ionic.tap.containsOrIsTextInput(e.target)||!e.isIonicTap&&!ionic.tap.requiresNativeClick(e.target)?(e.stopPropagation(),ionic.tap.isLabelWithTextInput(e.target)||e.preventDefault(),!1):void 0}function r(t){return t.isIonicTap||p(t)?null:B?(t.stopPropagation(),ionic.Platform.isEdge()||ionic.tap.isTextInput(t.target)&&K===t.target||b(t.target.tagName)||ionic.tap.isVideo(t.target)||t.preventDefault(),!1):($=!1,q=ionic.tap.pointerCoord(t),e("mousemove"),void ionic.activator.start(t))}function a(n){return B?(n.stopPropagation(),n.preventDefault(),!1):p(n)||b(n.target.tagName)?!1:(_(n)||t(n),e("mousemove",!1),ionic.activator.end(),void($=!1))}function o(t){return _(t)?(e("mousemove",!1),ionic.activator.end(),$=!0,!1):void 0}function s(t){if(!p(t)&&($=!1,u(),q=ionic.tap.pointerCoord(t),e(j),ionic.activator.start(t),ionic.Platform.isIOS()&&ionic.tap.isLabelWithTextInput(t.target))){var n=T(w(t.target));n!==F&&t.preventDefault()}}function l(e){p(e)||(u(),_(e)||(t(e),b(e.target.tagName)&&e.preventDefault()),K=e.target,d())}function c(t){return _(t)?($=!0,e(j,!1),ionic.activator.end(),!1):void 0}function d(){e(j,!1),ionic.activator.end(),$=!1}function u(){B=!0,clearTimeout(W),W=setTimeout(function(){B=!1},600)}function p(e){return e.isTapHandled?!0:(e.isTapHandled=!0,ionic.tap.isElementTapDisabled(e.target)?!0:ionic.scroll.isScrolling&&ionic.tap.containsOrIsTextInput(e.target)?(e.preventDefault(),!0):void 0)}function h(e){U=null;var t=!1;"SELECT"==e.tagName?(n("mousedown",e,0,0),e.focus&&e.focus(),t=!0):v()===e?t=!0:/^(input|textarea|ion-label)$/i.test(e.tagName)||e.isContentEditable?(t=!0,e.focus&&e.focus(),e.value=e.value,B&&(U=e)):f(),t&&(v(e),ionic.trigger("ionic.focusin",{target:e},!0))}function f(){var e=v();e&&(/^(input|textarea|select)$/i.test(e.tagName)||e.isContentEditable)&&e.blur(),v(null)}function m(e){B&&ionic.tap.isTextInput(v())&&ionic.tap.isTextInput(U)&&U!==e.target&&(U.focus(),U=null),ionic.scroll.isScrolling=!1}function g(){v(null)}function v(e){return arguments.length&&(F=e),F||document.activeElement}function _(e){if(!e||1!==e.target.nodeType||!q||0===q.x&&0===q.y)return!1;var t=ionic.tap.pointerCoord(e),n=!(!e.target.classList||!e.target.classList.contains||"function"!=typeof e.target.classList.contains),i=n&&e.target.classList.contains("button")?Q:Z;return Math.abs(q.x-t.x)>i||Math.abs(q.y-t.y)>i}function w(e,t){for(var n=e,i=0;6>i&&n;i++){if("LABEL"===n.tagName)return n;n=n.parentElement}return t!==!1?e:void 0}function T(e){if(e&&"LABEL"===e.tagName){if(e.control)return e.control;if(e.querySelector){var t=e.querySelector("input,textarea,select");if(t)return t}}return e}function b(e){return/^(select|option)$/i.test(e)}function S(){ionic.keyboard.isInitialized||(V()?(window.addEventListener("native.keyboardshow",pe),window.addEventListener("native.keyboardhide",x)):document.body.addEventListener("focusout",x),document.body.addEventListener("ionic.focusin",ue),document.body.addEventListener("focusin",ue),window.navigator.msPointerEnabled?document.removeEventListener("MSPointerDown",S):document.removeEventListener("touchstart",S),ionic.keyboard.isInitialized=!0)}function y(e){clearTimeout(re),(!ionic.keyboard.isOpen||ionic.keyboard.isClosing)&&(ionic.keyboard.isOpening=!0,ionic.keyboard.isClosing=!1),ionic.keyboard.height=e.keyboardHeight,le?C(O,!0):C(I,!0)}function E(e){return clearTimeout(re),e.target&&!e.target.readOnly&&ionic.tap.isKeyboardElement(e.target)&&(ne=ionic.DomUtil.getParentWithClass(e.target,de))?(ee=e.target,ne.classList.contains("overflow-scroll")||(document.body.scrollTop=0,ne.scrollTop=0,ionic.requestAnimationFrame(function(){document.body.scrollTop=0,ne.scrollTop=0}),window.navigator.msPointerEnabled?document.addEventListener("MSPointerMove",L,!1):document.addEventListener("touchmove",L,!1)),(!ionic.keyboard.isOpen||ionic.keyboard.isClosing)&&(ionic.keyboard.isOpening=!0,ionic.keyboard.isClosing=!1),document.addEventListener("keydown",M,!1),void(ionic.keyboard.isOpen||V()?ionic.keyboard.isOpen&&I():C(I,!0))):(ee&&(te=ee),void(ee=null))}function x(){clearTimeout(re),(ionic.keyboard.isOpen||ionic.keyboard.isOpening)&&(ionic.keyboard.isClosing=!0,ionic.keyboard.isOpening=!1),re=setTimeout(function(){ionic.requestAnimationFrame(function(){le?C(function(){O(),P()},!1):C(P,!1)})},50)}function D(){ionic.keyboard.isLandscape=!ionic.keyboard.isLandscape,ionic.Platform.isIOS()&&O(),ionic.Platform.isAndroid()&&(ionic.keyboard.isOpen&&V()?le=!0:C(O,!1))}function M(e){ionic.scroll.isScrolling&&L(e)}function L(e){"TEXTAREA"!==e.target.tagName&&e.preventDefault()}function C(e,t){clearInterval(ie);var n,i=0,r=G(),a=r;return n=ionic.Platform.isAndroid()&&ionic.Platform.version()<4.4?30:ionic.Platform.isAndroid()?10:1,ie=setInterval(function(){a=G(),(!(++i<n)||(N(a)||z(a))&&ionic.keyboard.height)&&(V()||(ionic.keyboard.height=Math.abs(r-window.innerHeight)),ionic.keyboard.isOpen=t,clearInterval(ie),e())},50),n}function P(){clearTimeout(re),ionic.keyboard.isOpen=!1,ionic.keyboard.isClosing=!1,(ee||te)&&ionic.trigger("resetScrollView",{target:ee||te},!0),ionic.requestAnimationFrame(function(){document.body.classList.remove(ce)}),window.navigator.msPointerEnabled?document.removeEventListener("MSPointerMove",L):document.removeEventListener("touchmove",L),document.removeEventListener("keydown",M),ionic.Platform.isAndroid()&&(V()&&cordova.plugins.Keyboard.close(),ee&&ee.blur()),ee=null,te=null}function I(){ionic.keyboard.isOpen=!0,ionic.keyboard.isOpening=!1;var e={keyboardHeight:k(),viewportHeight:ae};if(ee){e.target=ee;var t=ee.getBoundingClientRect();e.elementTop=Math.round(t.top),e.elementBottom=Math.round(t.bottom),e.windowHeight=e.viewportHeight-e.keyboardHeight,e.isElementUnderKeyboard=e.elementBottom>e.windowHeight,ionic.trigger("scrollChildIntoView",e,!0)}return setTimeout(function(){document.body.classList.add(ce)},400),e}function k(){if(ionic.keyboard.height)return ionic.keyboard.height;if(ionic.Platform.isAndroid()){if(ionic.Platform.isFullScreen)return 275;var e=window.innerHeight;return ae>e?ae-e:0}return ionic.Platform.isIOS()?ionic.keyboard.isLandscape?206:ionic.Platform.isWebView()?260:216:275}function N(e){return!!(!ionic.keyboard.isLandscape&&oe&&Math.abs(oe-e)<2)}function z(e){return!!(ionic.keyboard.isLandscape&&se&&Math.abs(se-e)<2)}function O(){le=!1,ae=G(),ionic.keyboard.isLandscape&&!se?se=ae:ionic.keyboard.isLandscape||oe||(oe=ae),ee&&ionic.trigger("resetScrollView",{target:ee},!0),ionic.keyboard.isOpen&&ionic.tap.isTextInput(ee)&&I()}function A(){var e=G();e/window.innerWidth<1&&(ionic.keyboard.isLandscape=!0),ae=e,ionic.keyboard.isLandscape&&!se?se=ae:ionic.keyboard.isLandscape||oe||(oe=ae)}function G(){var e=window.innerHeight;return ionic.Platform.isAndroid()&&ionic.Platform.isFullScreen||!ionic.keyboard.isOpen&&!ionic.keyboard.isOpening||ionic.keyboard.isClosing?e:e+k()}function V(){return!!(window.cordova&&cordova.plugins&&cordova.plugins.Keyboard)}function R(){var e;for(e=0;e<document.head.children.length;e++)if("viewport"==document.head.children[e].name){he=document.head.children[e];break}if(he){var t,n=he.content.toLowerCase().replace(/\s+/g,"").split(",");for(e=0;e<n.length;e++)n[e]&&(t=n[e].split("="),fe[t[0]]=t.length>1?t[1]:"_");H()}}function H(){var e=fe.width,t=fe.height,n=ionic.Platform,i=n.version(),r="device-width",a="device-height",o=ionic.viewport.orientation();delete fe.height,fe.width=r,n.isIPad()?i>7?delete fe.width:n.isWebView()?90==o?fe.height="0":7==i&&(fe.height=a):7>i&&(fe.height="0"):n.isIOS()&&(n.isWebView()?i>7?delete fe.width:7>i?t&&(fe.height="0"):7==i&&(fe.height=a):7>i&&t&&(fe.height="0")),(e!==fe.width||t!==fe.height)&&Y()}function Y(){var e,t=[];for(e in fe)fe[e]&&t.push(e+("_"==fe[e]?"":"="+fe[e]));he.content=t.join(", ")}window.ionic=window.ionic||{},window.ionic.views={},window.ionic.version="1.3.1",function(e){e.DelegateService=function(e){function t(){return!0}if(e.indexOf("$getByHandle")>-1)throw new Error("Method '$getByHandle' is implicitly added to each delegate service. Do not list it as a method.");return["$log",function(n){function i(e,t){this._instances=e,this.handle=t}function r(){this._instances=[]}function a(e){return function(){var t,i=this.handle,r=arguments,a=0;return this._instances.forEach(function(n){if((!i||i==n.$$delegateHandle)&&n.$$filterFn(n)){a++;var o=n[e].apply(n,r);1===a&&(t=o)}}),!a&&i?n.warn('Delegate for handle "'+i+'" could not find a corresponding element with delegate-handle="'+i+'"! '+e+"() was not called!\nPossible cause: If you are calling "+e+'() immediately, and your element with delegate-handle="'+i+'" is a child of your controller, then your element may not be compiled yet. Put a $timeout around your call to '+e+"() and try again."):t}}return e.forEach(function(e){i.prototype[e]=a(e)}),r.prototype=i.prototype,r.prototype._registerInstance=function(e,n,i){var r=this._instances;return e.$$delegateHandle=n,e.$$filterFn=i||t,r.push(e),function(){var t=r.indexOf(e);-1!==t&&r.splice(t,1)}},r.prototype.$getByHandle=function(e){return new i(this._instances,e)},new r}]}}(window.ionic),function(e,t,n){function i(){a=!0;for(var e=0;e<r.length;e++)n.requestAnimationFrame(r[e]);r=[],t.removeEventListener("DOMContentLoaded",i)}var r=[],a="complete"===t.readyState||"interactive"===t.readyState;a||t.addEventListener("DOMContentLoaded",i),e._rAF=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||function(t){e.setTimeout(t,16)}}();var o=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelRequestAnimationFrame;n.DomUtil={requestAnimationFrame:function(t){return e._rAF(t)},cancelAnimationFrame:function(e){o(e)},animationFrameThrottle:function(e){var t,i,r;return function(){t=arguments,r=this,i||(i=!0,n.requestAnimationFrame(function(){e.apply(r,t),i=!1}))}},contains:function(e,t){for(var n=t;n;){if(n===e)return!0;n=n.parentNode}},getPositionInParent:function(e){return{left:e.offsetLeft,top:e.offsetTop}},getOffsetTop:function(e){var t=0;if(e.offsetParent){do t+=e.offsetTop,e=e.offsetParent;while(e);return t}},ready:function(e){a?n.requestAnimationFrame(e):r.push(e)},getTextBounds:function(n){if(t.createRange){var i=t.createRange();if(i.selectNodeContents(n),i.getBoundingClientRect){var r=i.getBoundingClientRect();if(r){var a=e.scrollX,o=e.scrollY;return{top:r.top+o,left:r.left+a,right:r.left+a+r.width,bottom:r.top+o+r.height,width:r.width,height:r.height}}}}return null},getChildIndex:function(e,t){if(t)for(var n,i=e.parentNode.children,r=0,a=0,o=i.length;o>r;r++)if(n=i[r],n.nodeName&&n.nodeName.toLowerCase()==t){if(n==e)return a;a++}return Array.prototype.slice.call(e.parentNode.children).indexOf(e)},swapNodes:function(e,t){t.parentNode.insertBefore(e,t)},elementIsDescendant:function(e,t,n){var i=e;do{if(i===t)return!0;i=i.parentNode}while(i&&i!==n);return!1},getParentWithClass:function(e,t,n){for(n=n||10;e.parentNode&&n--;){if(e.parentNode.classList&&e.parentNode.classList.contains(t))return e.parentNode;e=e.parentNode}return null},getParentOrSelfWithClass:function(e,t,n){for(n=n||10;e&&n--;){if(e.classList&&e.classList.contains(t))return e;e=e.parentNode}return null},rectContains:function(e,t,n,i,r,a){return n>e||e>r?!1:i>t||t>a?!1:!0},blurAll:function(){return t.activeElement&&t.activeElement!=t.body?(t.activeElement.blur(),t.activeElement):null},cachedAttr:function(e,t,n){if(e=e&&e.length&&e[0]||e,e&&e.setAttribute){var i="$attr-"+t;return arguments.length>2?e[i]!==n&&(e.setAttribute(t,n),e[i]=n):"undefined"==typeof e[i]&&(e[i]=e.getAttribute(t)),e[i]}},cachedStyles:function(e,t){if(e=e&&e.length&&e[0]||e,e&&e.style)for(var n in t)e["$style-"+n]!==t[n]&&(e.style[n]=e["$style-"+n]=t[n])}},n.requestAnimationFrame=n.DomUtil.requestAnimationFrame,n.cancelAnimationFrame=n.DomUtil.cancelAnimationFrame,n.animationFrameThrottle=n.DomUtil.animationFrameThrottle}(window,document,ionic),function(e){e.CustomEvent=function(){if("function"==typeof window.CustomEvent)return CustomEvent;var e=function(e,t){var n;t=t||{bubbles:!1,cancelable:!1,detail:void 0};try{n=document.createEvent("CustomEvent"),n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail)}catch(i){n=document.createEvent("Event");for(var r in t)n[r]=t[r];n.initEvent(e,t.bubbles,t.cancelable)}return n};return e.prototype=window.Event.prototype,e}(),e.EventController={VIRTUALIZED_EVENTS:["tap","swipe","swiperight","swipeleft","drag","hold","release"],trigger:function(t,n,i,r){var a=new e.CustomEvent(t,{detail:n,bubbles:!!i,cancelable:!!r});n&&n.target&&n.target.dispatchEvent&&n.target.dispatchEvent(a)||window.dispatchEvent(a)},on:function(t,n,i){for(var r=i||window,a=0,o=this.VIRTUALIZED_EVENTS.length;o>a;a++)if(t==this.VIRTUALIZED_EVENTS[a]){var s=new e.Gesture(i);return s.on(t,n),s}r.addEventListener(t,n)},off:function(e,t,n){n.removeEventListener(e,t)},onGesture:function(t,n,i,r){var a=new e.Gesture(i,r);return a.on(t,n),a},offGesture:function(e,t,n){e&&e.off(t,n)},handlePopState:function(){}},e.on=function(){e.EventController.on.apply(e.EventController,arguments)},e.off=function(){e.EventController.off.apply(e.EventController,arguments)},e.trigger=e.EventController.trigger,e.onGesture=function(){return e.EventController.onGesture.apply(e.EventController.onGesture,arguments)},e.offGesture=function(){return e.EventController.offGesture.apply(e.EventController.offGesture,arguments)}}(window.ionic),function(e){function t(){if(!e.Gestures.READY){e.Gestures.event.determineEventTypes();for(var t in e.Gestures.gestures)e.Gestures.gestures.hasOwnProperty(t)&&e.Gestures.detection.register(e.Gestures.gestures[t]);e.Gestures.event.onTouch(e.Gestures.DOCUMENT,e.Gestures.EVENT_MOVE,e.Gestures.detection.detect),e.Gestures.event.onTouch(e.Gestures.DOCUMENT,e.Gestures.EVENT_END,e.Gestures.detection.detect),e.Gestures.READY=!0}}e.Gesture=function(t,n){return new e.Gestures.Instance(t,n||{})},e.Gestures={},e.Gestures.defaults={stop_browser_behavior:"disable-user-behavior"},e.Gestures.HAS_POINTEREVENTS=window.navigator.pointerEnabled||window.navigator.msPointerEnabled,e.Gestures.HAS_TOUCHEVENTS="ontouchstart"in window,e.Gestures.MOBILE_REGEX=/mobile|tablet|ip(ad|hone|od)|android|silk/i,e.Gestures.NO_MOUSEEVENTS=e.Gestures.HAS_TOUCHEVENTS&&window.navigator.userAgent.match(e.Gestures.MOBILE_REGEX),e.Gestures.EVENT_TYPES={},e.Gestures.DIRECTION_DOWN="down",e.Gestures.DIRECTION_LEFT="left",e.Gestures.DIRECTION_UP="up",e.Gestures.DIRECTION_RIGHT="right",e.Gestures.POINTER_MOUSE="mouse",e.Gestures.POINTER_TOUCH="touch",e.Gestures.POINTER_PEN="pen",e.Gestures.EVENT_START="start",e.Gestures.EVENT_MOVE="move",e.Gestures.EVENT_END="end",e.Gestures.DOCUMENT=window.document,e.Gestures.plugins={},e.Gestures.READY=!1,e.Gestures.Instance=function(n,i){var r=this;return null===n?this:(t(),this.element=n,this.enabled=!0,this.options=e.Gestures.utils.extend(e.Gestures.utils.extend({},e.Gestures.defaults),i||{}),this.options.stop_browser_behavior&&e.Gestures.utils.stopDefaultBrowserBehavior(this.element,this.options.stop_browser_behavior),e.Gestures.event.onTouch(n,e.Gestures.EVENT_START,function(t){r.enabled&&e.Gestures.detection.startDetect(r,t)}),this)},e.Gestures.Instance.prototype={on:function(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)this.element.addEventListener(n[i],t,!1);return this},off:function(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)this.element.removeEventListener(n[i],t,!1);return this},trigger:function(t,n){var i=e.Gestures.DOCUMENT.createEvent("Event");i.initEvent(t,!0,!0),i.gesture=n;var r=this.element;return e.Gestures.utils.hasParent(n.target,r)&&(r=n.target),r.dispatchEvent(i),this},enable:function(e){return this.enabled=e,this}};var n=null,i=!1,r=!1;e.Gestures.event={bindDom:function(e,t,n){for(var i=t.split(" "),r=0;r<i.length;r++)e.addEventListener(i[r],n,!1)},onTouch:function(t,a,o){var s=this;this.bindDom(t,e.Gestures.EVENT_TYPES[a],function(l){var c=l.type.toLowerCase();if(!c.match(/mouse/)||!r){c.match(/touch/)||c.match(/pointerdown/)||c.match(/mouse/)&&1===l.which?i=!0:c.match(/mouse/)&&1!==l.which&&(i=!1),c.match(/touch|pointer/)&&(r=!0);var d=0;i&&(e.Gestures.HAS_POINTEREVENTS&&a!=e.Gestures.EVENT_END?d=e.Gestures.PointerEvent.updatePointer(a,l):c.match(/touch/)?d=l.touches.length:r||(d=c.match(/up/)?0:1),d>0&&a==e.Gestures.EVENT_END?a=e.Gestures.EVENT_MOVE:d||(a=e.Gestures.EVENT_END),(d||null===n)&&(n=l),o.call(e.Gestures.detection,s.collectEventData(t,a,s.getTouchList(n,a),l)),e.Gestures.HAS_POINTEREVENTS&&a==e.Gestures.EVENT_END&&(d=e.Gestures.PointerEvent.updatePointer(a,l))),d||(n=null,i=!1,r=!1,e.Gestures.PointerEvent.reset())}})},determineEventTypes:function(){var t;t=e.Gestures.HAS_POINTEREVENTS?e.Gestures.PointerEvent.getEvents():e.Gestures.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],e.Gestures.EVENT_TYPES[e.Gestures.EVENT_START]=t[0],e.Gestures.EVENT_TYPES[e.Gestures.EVENT_MOVE]=t[1],e.Gestures.EVENT_TYPES[e.Gestures.EVENT_END]=t[2]},getTouchList:function(t){return e.Gestures.HAS_POINTEREVENTS?e.Gestures.PointerEvent.getTouchList():t.touches?t.touches:(t.identifier=1,[t])},collectEventData:function(t,n,i,r){var a=e.Gestures.POINTER_TOUCH;return(r.type.match(/mouse/)||e.Gestures.PointerEvent.matchType(e.Gestures.POINTER_MOUSE,r))&&(a=e.Gestures.POINTER_MOUSE),{center:e.Gestures.utils.getCenter(i),timeStamp:(new Date).getTime(),target:r.target,touches:i,eventType:n,pointerType:a,srcEvent:r,preventDefault:function(){this.srcEvent.preventManipulation&&this.srcEvent.preventManipulation(),this.srcEvent.preventDefault},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return e.Gestures.detection.stopDetect()}}}},e.Gestures.PointerEvent={pointers:{},getTouchList:function(){var e=this,t=[];return Object.keys(e.pointers).sort().forEach(function(n){t.push(e.pointers[n])}),t},updatePointer:function(t,n){return t==e.Gestures.EVENT_END?this.pointers={}:(n.identifier=n.pointerId,this.pointers[n.pointerId]=n),Object.keys(this.pointers).length},matchType:function(t,n){if(!n.pointerType)return!1;var i={};return i[e.Gestures.POINTER_MOUSE]=n.pointerType==n.MSPOINTER_TYPE_MOUSE||n.pointerType==e.Gestures.POINTER_MOUSE,i[e.Gestures.POINTER_TOUCH]=n.pointerType==n.MSPOINTER_TYPE_TOUCH||n.pointerType==e.Gestures.POINTER_TOUCH,i[e.Gestures.POINTER_PEN]=n.pointerType==n.MSPOINTER_TYPE_PEN||n.pointerType==e.Gestures.POINTER_PEN,i[t]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={}}},e.Gestures.utils={extend:function(e,t,n){for(var i in t)void 0!==e[i]&&n||(e[i]=t[i]);return e},hasParent:function(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1},getCenter:function(e){for(var t=[],n=[],i=0,r=e.length;r>i;i++)t.push(e[i].pageX),n.push(e[i].pageY);return{pageX:(Math.min.apply(Math,t)+Math.max.apply(Math,t))/2,pageY:(Math.min.apply(Math,n)+Math.max.apply(Math,n))/2}},getVelocity:function(e,t,n){return{x:Math.abs(t/e)||0,y:Math.abs(n/e)||0}},getAngle:function(e,t){var n=t.pageY-e.pageY,i=t.pageX-e.pageX;return 180*Math.atan2(n,i)/Math.PI},getDirection:function(t,n){var i=Math.abs(t.pageX-n.pageX),r=Math.abs(t.pageY-n.pageY);return i>=r?t.pageX-n.pageX>0?e.Gestures.DIRECTION_LEFT:e.Gestures.DIRECTION_RIGHT:t.pageY-n.pageY>0?e.Gestures.DIRECTION_UP:e.Gestures.DIRECTION_DOWN},getDistance:function(e,t){var n=t.pageX-e.pageX,i=t.pageY-e.pageY;return Math.sqrt(n*n+i*i)},getScale:function(e,t){return e.length>=2&&t.length>=2?this.getDistance(t[0],t[1])/this.getDistance(e[0],e[1]):1},getRotation:function(e,t){return e.length>=2&&t.length>=2?this.getAngle(t[1],t[0])-this.getAngle(e[1],e[0]):0},isVertical:function(t){return t==e.Gestures.DIRECTION_UP||t==e.Gestures.DIRECTION_DOWN},stopDefaultBrowserBehavior:function(e,t){e&&e.classList&&(e.classList.add(t),e.onselectstart=function(){return!1})}},e.Gestures.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(t,n){this.current||(this.stopped=!1,this.current={inst:t,startEvent:e.Gestures.utils.extend({},n),lastEvent:!1,name:""},this.detect(n))},detect:function(t){if(!this.current||this.stopped)return null;t=this.extendEventData(t);for(var n=this.current.inst.options,i=0,r=this.gestures.length;r>i;i++){var a=this.gestures[i];if(!this.stopped&&n[a.name]!==!1&&a.handler.call(a,t,this.current.inst)===!1){this.stopDetect();break}}return this.current&&(this.current.lastEvent=t),t.eventType==e.Gestures.EVENT_END&&!t.touches.length-1&&this.stopDetect(),t},stopDetect:function(){this.previous=e.Gestures.utils.extend({},this.current),this.current=null,this.stopped=!0},extendEventData:function(t){var n=this.current.startEvent;if(n&&(t.touches.length!=n.touches.length||t.touches===n.touches)){n.touches=[];for(var i=0,r=t.touches.length;r>i;i++)n.touches.push(e.Gestures.utils.extend({},t.touches[i]))}var a=t.timeStamp-n.timeStamp,o=t.center.pageX-n.center.pageX,s=t.center.pageY-n.center.pageY,l=e.Gestures.utils.getVelocity(a,o,s);return e.Gestures.utils.extend(t,{deltaTime:a,deltaX:o,deltaY:s,velocityX:l.x,velocityY:l.y,distance:e.Gestures.utils.getDistance(n.center,t.center),angle:e.Gestures.utils.getAngle(n.center,t.center),direction:e.Gestures.utils.getDirection(n.center,t.center),scale:e.Gestures.utils.getScale(n.touches,t.touches),rotation:e.Gestures.utils.getRotation(n.touches,t.touches),startEvent:n}),t},register:function(t){var n=t.defaults||{};return void 0===n[t.name]&&(n[t.name]=!0),e.Gestures.utils.extend(e.Gestures.defaults,n,!0),t.index=t.index||1e3,this.gestures.push(t),this.gestures.sort(function(e,t){return e.index<t.index?-1:e.index>t.index?1:0}),this.gestures}},e.Gestures.gestures=e.Gestures.gestures||{},e.Gestures.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:9},timer:null,handler:function(t,n){switch(t.eventType){case e.Gestures.EVENT_START:clearTimeout(this.timer),e.Gestures.detection.current.name=this.name,this.timer=setTimeout(function(){"hold"==e.Gestures.detection.current.name&&(e.tap.cancelClick(),n.trigger("hold",t))},n.options.hold_timeout);break;case e.Gestures.EVENT_MOVE:t.distance>n.options.hold_threshold&&clearTimeout(this.timer);break;case e.Gestures.EVENT_END:clearTimeout(this.timer)}}},e.Gestures.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,tap_always:!0,doubletap_distance:20,doubletap_interval:300},handler:function(t,n){if(t.eventType==e.Gestures.EVENT_END&&"touchcancel"!=t.srcEvent.type){var i=e.Gestures.detection.previous,r=!1;if(t.deltaTime>n.options.tap_max_touchtime||t.distance>n.options.tap_max_distance)return;i&&"tap"==i.name&&t.timeStamp-i.lastEvent.timeStamp<n.options.doubletap_interval&&t.distance<n.options.doubletap_distance&&(n.trigger("doubletap",t),r=!0),(!r||n.options.tap_always)&&(e.Gestures.detection.current.name="tap",n.trigger("tap",t))}}},e.Gestures.gestures.Swipe={name:"swipe",index:40,defaults:{swipe_max_touches:1,swipe_velocity:.4},handler:function(t,n){if(t.eventType==e.Gestures.EVENT_END){if(n.options.swipe_max_touches>0&&t.touches.length>n.options.swipe_max_touches)return;(t.velocityX>n.options.swipe_velocity||t.velocityY>n.options.swipe_velocity)&&(n.trigger(this.name,t),n.trigger(this.name+t.direction,t))}}},e.Gestures.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,correct_for_drag_min_distance:!0,drag_max_touches:1,drag_block_horizontal:!0,drag_block_vertical:!0,drag_lock_to_axis:!1,drag_lock_min_distance:25,prevent_default_directions:[]},triggered:!1,handler:function(t,n){if("touchstart"==t.srcEvent.type||"touchend"==t.srcEvent.type?this.preventedFirstMove=!1:this.preventedFirstMove||"touchmove"!=t.srcEvent.type||(n.options.prevent_default_directions.length>0&&-1!=n.options.prevent_default_directions.indexOf(t.direction)&&t.srcEvent.preventDefault(),this.preventedFirstMove=!0),e.Gestures.detection.current.name!=this.name&&this.triggered)return n.trigger(this.name+"end",t),void(this.triggered=!1);if(!(n.options.drag_max_touches>0&&t.touches.length>n.options.drag_max_touches))switch(t.eventType){case e.Gestures.EVENT_START:this.triggered=!1;break;case e.Gestures.EVENT_MOVE:if(t.distance<n.options.drag_min_distance&&e.Gestures.detection.current.name!=this.name)return;if(e.Gestures.detection.current.name!=this.name&&(e.Gestures.detection.current.name=this.name,n.options.correct_for_drag_min_distance)){var i=Math.abs(n.options.drag_min_distance/t.distance);e.Gestures.detection.current.startEvent.center.pageX+=t.deltaX*i,e.Gestures.detection.current.startEvent.center.pageY+=t.deltaY*i,t=e.Gestures.detection.extendEventData(t)}(e.Gestures.detection.current.lastEvent.drag_locked_to_axis||n.options.drag_lock_to_axis&&n.options.drag_lock_min_distance<=t.distance)&&(t.drag_locked_to_axis=!0);var r=e.Gestures.detection.current.lastEvent.direction;t.drag_locked_to_axis&&r!==t.direction&&(e.Gestures.utils.isVertical(r)?t.direction=t.deltaY<0?e.Gestures.DIRECTION_UP:e.Gestures.DIRECTION_DOWN:t.direction=t.deltaX<0?e.Gestures.DIRECTION_LEFT:e.Gestures.DIRECTION_RIGHT),this.triggered||(n.trigger(this.name+"start",t),this.triggered=!0),n.trigger(this.name,t),n.trigger(this.name+t.direction,t),(n.options.drag_block_vertical&&e.Gestures.utils.isVertical(t.direction)||n.options.drag_block_horizontal&&!e.Gestures.utils.isVertical(t.direction))&&t.preventDefault();break;case e.Gestures.EVENT_END:this.triggered&&n.trigger(this.name+"end",t),this.triggered=!1}}},e.Gestures.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1},triggered:!1,handler:function(t,n){if(e.Gestures.detection.current.name!=this.name&&this.triggered)return n.trigger(this.name+"end",t),void(this.triggered=!1);if(!(t.touches.length<2))switch(n.options.transform_always_block&&t.preventDefault(),t.eventType){case e.Gestures.EVENT_START:this.triggered=!1;break;case e.Gestures.EVENT_MOVE:var i=Math.abs(1-t.scale),r=Math.abs(t.rotation);if(i<n.options.transform_min_scale&&r<n.options.transform_min_rotation)return;e.Gestures.detection.current.name=this.name,this.triggered||(n.trigger(this.name+"start",t),this.triggered=!0),n.trigger(this.name,t),r>n.options.transform_min_rotation&&n.trigger("rotate",t),i>n.options.transform_min_scale&&(n.trigger("pinch",t),n.trigger("pinch"+(t.scale<1?"in":"out"),t));break;case e.Gestures.EVENT_END:this.triggered&&n.trigger(this.name+"end",t),this.triggered=!1}}},e.Gestures.gestures.Touch={name:"touch",index:-(1/0),defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(t,n){return n.options.prevent_mouseevents&&t.pointerType==e.Gestures.POINTER_MOUSE?void t.stopDetect():(n.options.prevent_default&&t.preventDefault(),void(t.eventType==e.Gestures.EVENT_START&&n.trigger(this.name,t)))}},e.Gestures.gestures.Release={name:"release",index:1/0,handler:function(t,n){t.eventType==e.Gestures.EVENT_END&&n.trigger(this.name,t)}}}(window.ionic),function(e,t,n){function i(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),n=t.exec(location.search);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))}function r(){setTimeout(function(){!f.isReady&&f.isWebView()},_)}function a(){f.isWebView()?t.addEventListener("deviceready",o,!1):o(),s&&e.removeEventListener("load",a,!1)}function o(){f.isReady=!0,f.detect();for(var e=0;e<v.length;e++)v[e]();v=[],n.trigger("platformready",{target:t}),h(function(){t.body.classList.add("platform-ready")})}var s,l="ios",c="android",d="windowsphone",u="edge",p="crosswalk",h=n.requestAnimationFrame,f=n.Platform={navigator:e.navigator,isReady:!1,isFullScreen:!1,platforms:null,grade:null,ua:navigator.userAgent,ready:function(e){f.isReady?e():v.push(e)},detect:function(){f._checkPlatforms(),h(function(){for(var e=0;e<f.platforms.length;e++)t.body.classList.add("platform-"+f.platforms[e])})},setGrade:function(e){var n=f.grade;f.grade=e,h(function(){n&&t.body.classList.remove("grade-"+n),t.body.classList.add("grade-"+e)})},device:function(){return e.device||{}},_checkPlatforms:function(){f.platforms=[];var t="a";f.isWebView()?(f.platforms.push("webview"),e.cordova||e.PhoneGap||e.phonegap?f.platforms.push("cordova"):"object"==typeof e.forge&&f.platforms.push("trigger")):f.platforms.push("browser"),f.isIPad()&&f.platforms.push("ipad");var n=f.platform();if(n){f.platforms.push(n);var i=f.version();if(i){var r=i.toString();r.indexOf(".")>0?r=r.replace(".","_"):r+="_0",f.platforms.push(n+r.split("_")[0]),f.platforms.push(n+r),f.isAndroid()&&4.4>i?t=4>i?"c":"b":f.isWindowsPhone()&&(t="b")}}f.setGrade(t)},isWebView:function(){return!(!e.cordova&&!e.PhoneGap&&!e.phonegap&&"object"!==e.forge)},isIPad:function(){return/iPad/i.test(f.navigator.platform)?!0:/iPad/i.test(f.ua)},isIOS:function(){return f.is(l)},isAndroid:function(){return f.is(c)},isWindowsPhone:function(){return f.is(d)},isEdge:function(){return f.is(u)},isCrosswalk:function(){return f.is(p)},platform:function(){return null===m&&f.setPlatform(f.device().platform),m},setPlatform:function(e){m="undefined"!=typeof e&&null!==e&&e.length?e.toLowerCase():i("ionicplatform")?i("ionicplatform"):f.ua.indexOf("Edge")>-1?u:f.ua.indexOf("Windows Phone")>-1?d:f.ua.indexOf("Android")>0?c:/iPhone|iPad|iPod/.test(f.ua)?l:f.navigator.platform&&navigator.platform.toLowerCase().split(" ")[0]||""},version:function(){return null===g&&f.setVersion(f.device().version),g},setVersion:function(e){if("undefined"!=typeof e&&null!==e&&(e=e.split("."),e=parseFloat(e[0]+"."+(e.length>1?e[1]:0)),!isNaN(e)))return void(g=e);g=0;var t=f.platform(),n={android:/Android (\d+).(\d+)?/,ios:/OS (\d+)_(\d+)?/,windowsphone:/Windows Phone (\d+).(\d+)?/};n[t]&&(e=f.ua.match(n[t]),e&&e.length>2&&(g=parseFloat(e[1]+"."+e[2])))},is:function(e){if(e=e.toLowerCase(),f.platforms)for(var t=0;t<f.platforms.length;t++)if(f.platforms[t]===e)return!0;var n=f.platform();return n?n===e.toLowerCase():f.ua.toLowerCase().indexOf(e)>=0},exitApp:function(){f.ready(function(){navigator.app&&navigator.app.exitApp&&navigator.app.exitApp()})},showStatusBar:function(n){f._showStatusBar=n,f.ready(function(){h(function(){f._showStatusBar?(e.StatusBar&&e.StatusBar.show(),t.body.classList.remove("status-bar-hide")):(e.StatusBar&&e.StatusBar.hide(),t.body.classList.add("status-bar-hide"))})})},fullScreen:function(e,i){f.isFullScreen=e!==!1,n.DomUtil.ready(function(){h(function(){f.isFullScreen?t.body.classList.add("fullscreen"):t.body.classList.remove("fullscreen")}),f.showStatusBar(i===!0)})}},m=null,g=null,v=[],_=2e3;r(),"complete"===t.readyState?a():(s=!0,e.addEventListener("load",a,!1))}(window,document,ionic),function(e,t){"use strict";t.CSS={},t.CSS.TRANSITION=[],t.CSS.TRANSFORM=[],t.EVENTS={},function(){var n,i=["webkitTransform","transform","-webkit-transform","webkit-transform","-moz-transform","moz-transform","MozTransform","mozTransform","msTransform"];for(n=0;n<i.length;n++)if(void 0!==e.documentElement.style[i[n]]){t.CSS.TRANSFORM=i[n];break}for(i=["webkitTransition","mozTransition","msTransition","transition"],n=0;n<i.length;n++)if(void 0!==e.documentElement.style[i[n]]){t.CSS.TRANSITION=i[n];break}t.CSS.TRANSITION=t.CSS.TRANSITION||"transition";var r=t.CSS.TRANSITION.indexOf("webkit")>-1;t.CSS.TRANSITION_DURATION=(r?"-webkit-":"")+"transition-duration",t.CSS.TRANSITIONEND=(r?"webkitTransitionEnd ":"")+"transitionend"}(),function(){var e="touchstart",n="touchmove",i="touchend",r="touchcancel";window.navigator.pointerEnabled?(e="pointerdown",
n="pointermove",i="pointerup",r="pointercancel"):window.navigator.msPointerEnabled&&(e="MSPointerDown",n="MSPointerMove",i="MSPointerUp",r="MSPointerCancel"),t.EVENTS.touchstart=e,t.EVENTS.touchmove=n,t.EVENTS.touchend=i,t.EVENTS.touchcancel=r}(),"classList"in e.documentElement||!Object.defineProperty||"undefined"==typeof HTMLElement||Object.defineProperty(HTMLElement.prototype,"classList",{get:function(){function e(e){return function(){var n,i=t.className.split(/\s+/);for(n=0;n<arguments.length;n++)e(i,i.indexOf(arguments[n]),arguments[n]);t.className=i.join(" ")}}var t=this;return{add:e(function(e,t,n){~t||e.push(n)}),remove:e(function(e,t){~t&&e.splice(t,1)}),toggle:e(function(e,t,n){~t?e.splice(t,1):e.push(n)}),contains:function(e){return!!~t.className.split(/\s+/).indexOf(e)},item:function(e){return t.className.split(/\s+/)[e]||null}}}})}(document,ionic);var X,F,B,W,$,q,U,K,j="touchmove",Z=12,Q=50,J={click:i,mousedown:r,mouseup:a,mousemove:o,touchstart:s,touchend:l,touchcancel:d,touchmove:c,pointerdown:s,pointerup:l,pointercancel:d,pointermove:c,MSPointerDown:s,MSPointerUp:l,MSPointerCancel:d,MSPointerMove:c,focusin:m,focusout:g};ionic.tap={register:function(t){return X=t,e("click",!0,!0),e("mouseup"),e("mousedown"),window.navigator.pointerEnabled?(e("pointerdown"),e("pointerup"),e("pointercancel"),j="pointermove"):window.navigator.msPointerEnabled?(e("MSPointerDown"),e("MSPointerUp"),e("MSPointerCancel"),j="MSPointerMove"):(e("touchstart"),e("touchend"),e("touchcancel")),e("focusin"),e("focusout"),function(){for(var t in J)e(t,!1);X=null,F=null,B=!1,$=!1,q=null}},ignoreScrollStart:function(e){return e.defaultPrevented||/^(file|range)$/i.test(e.target.type)||"true"==(e.target.dataset?e.target.dataset.preventScroll:e.target.getAttribute("data-prevent-scroll"))||!!/^(object|embed)$/i.test(e.target.tagName)||ionic.tap.isElementTapDisabled(e.target)},isTextInput:function(e){return!!e&&("TEXTAREA"==e.tagName||"true"===e.contentEditable||"INPUT"==e.tagName&&!/^(radio|checkbox|range|file|submit|reset|color|image|button)$/i.test(e.type))},isDateInput:function(e){return!!e&&"INPUT"==e.tagName&&/^(date|time|datetime-local|month|week)$/i.test(e.type)},isVideo:function(e){return!!e&&"VIDEO"==e.tagName},isKeyboardElement:function(e){return!ionic.Platform.isIOS()||ionic.Platform.isIPad()?ionic.tap.isTextInput(e)&&!ionic.tap.isDateInput(e):ionic.tap.isTextInput(e)||!!e&&"SELECT"==e.tagName},isLabelWithTextInput:function(e){var t=w(e,!1);return!!t&&ionic.tap.isTextInput(T(t))},containsOrIsTextInput:function(e){return ionic.tap.isTextInput(e)||ionic.tap.isLabelWithTextInput(e)},cloneFocusedInput:function(e){ionic.tap.hasCheckedClone||(ionic.tap.hasCheckedClone=!0,ionic.requestAnimationFrame(function(){var t=e.querySelector(":focus");if(ionic.tap.isTextInput(t)&&!ionic.tap.isDateInput(t)){var n=t.cloneNode(!0);n.value=t.value,n.classList.add("cloned-text-input"),n.readOnly=!0,t.isContentEditable&&(n.contentEditable=t.contentEditable,n.innerHTML=t.innerHTML),t.parentElement.insertBefore(n,t),t.classList.add("previous-input-focus"),n.scrollTop=t.scrollTop}}))},hasCheckedClone:!1,removeClonedInputs:function(e){ionic.tap.hasCheckedClone=!1,ionic.requestAnimationFrame(function(){var t,n=e.querySelectorAll(".cloned-text-input"),i=e.querySelectorAll(".previous-input-focus");for(t=0;t<n.length;t++)n[t].parentElement.removeChild(n[t]);for(t=0;t<i.length;t++)i[t].classList.remove("previous-input-focus"),i[t].style.top="",ionic.keyboard.isOpen&&!ionic.keyboard.isClosing&&i[t].focus()})},requiresNativeClick:function(e){return ionic.Platform.isWindowsPhone()&&("A"==e.tagName||"BUTTON"==e.tagName||e.hasAttribute("ng-click")||"INPUT"==e.tagName&&("button"==e.type||"submit"==e.type))?!0:!e||e.disabled||/^(file|range)$/i.test(e.type)||/^(object|video)$/i.test(e.tagName)||ionic.tap.isLabelContainingFileInput(e)?!0:ionic.tap.isElementTapDisabled(e)},isLabelContainingFileInput:function(e){var t=w(e);if("LABEL"!==t.tagName)return!1;var n=t.querySelector("input[type=file]");return n&&n.disabled===!1?!0:!1},isElementTapDisabled:function(e){if(e&&1===e.nodeType)for(var t=e;t;){if(t.getAttribute&&"true"==t.getAttribute("data-tap-disabled"))return!0;t=t.parentElement}return!1},setTolerance:function(e,t){Z=e,Q=t},cancelClick:function(){$=!0},pointerCoord:function(e){var t={x:0,y:0};if(e){var n=e.touches&&e.touches.length?e.touches:[e],i=e.changedTouches&&e.changedTouches[0]||n[0];i&&(t.x=i.clientX||i.pageX||0,t.y=i.clientY||i.pageY||0)}return t}},ionic.DomUtil.ready(function(){var e="undefined"!=typeof angular?angular:null;(!e||e&&!e.scenario)&&ionic.tap.register(document)}),function(e,t){"use strict";function n(){a={},t.requestAnimationFrame(r)}function i(){for(var e in a)a[e]&&(a[e].classList.add(l),o[e]=a[e]);a={}}function r(){if(t.transition&&t.transition.isActive)return void setTimeout(r,400);for(var e in o)o[e]&&(o[e].classList.remove(l),delete o[e])}var a={},o={},s=0,l="activated";t.activator={start:function(e){var n=t.tap.pointerCoord(e).x;n>0&&30>n||t.requestAnimationFrame(function(){if(!(t.scroll&&t.scroll.isScrolling||t.tap.requiresNativeClick(e.target))){for(var n,r=e.target,o=0;6>o&&(r&&1===r.nodeType);o++){if(n&&r.classList&&r.classList.contains("item")){n=r;break}if("A"==r.tagName||"BUTTON"==r.tagName||r.hasAttribute("ng-click")){n=r;break}if(r.classList&&r.classList.contains("button")){n=r;break}if("ION-CONTENT"==r.tagName||r.classList&&r.classList.contains("pane")||"BODY"==r.tagName)break;r=r.parentElement}n&&(a[s]=n,t.requestAnimationFrame(i),s=s>29?0:s+1)}})},end:function(){setTimeout(n,200)}}}(document,ionic),function(e){var t=0;e.Utils={arrayMove:function(e,t,n){if(n>=e.length)for(var i=n-e.length;i--+1;)e.push(void 0);return e.splice(n,0,e.splice(t,1)[0]),e},proxy:function(e,t){var n=Array.prototype.slice.call(arguments,2);return function(){return e.apply(t,n.concat(Array.prototype.slice.call(arguments)))}},debounce:function(e,t,n){var i,r,a,o,s;return function(){a=this,r=arguments,o=new Date;var l=function(){var c=new Date-o;t>c?i=setTimeout(l,t-c):(i=null,n||(s=e.apply(a,r)))},c=n&&!i;return i||(i=setTimeout(l,t)),c&&(s=e.apply(a,r)),s}},throttle:function(e,t,n){var i,r,a,o=null,s=0;n||(n={});var l=function(){s=n.leading===!1?0:Date.now(),o=null,a=e.apply(i,r)};return function(){var c=Date.now();s||n.leading!==!1||(s=c);var d=t-(c-s);return i=this,r=arguments,0>=d?(clearTimeout(o),o=null,s=c,a=e.apply(i,r)):o||n.trailing===!1||(o=setTimeout(l,d)),a}},inherit:function(t,n){var i,r=this;i=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return r.apply(this,arguments)},e.extend(i,r,n);var a=function(){this.constructor=i};return a.prototype=r.prototype,i.prototype=new a,t&&e.extend(i.prototype,t),i.__super__=r.prototype,i},extend:function(e){for(var t=Array.prototype.slice.call(arguments,1),n=0;n<t.length;n++){var i=t[n];if(i)for(var r in i)e[r]=i[r]}return e},nextUid:function(){return"ion"+t++},disconnectScope:function(e){if(e&&e.$root!==e){var t=e.$parent;e.$$disconnected=!0,e.$broadcast("$ionic.disconnectScope",e),t.$$childHead===e&&(t.$$childHead=e.$$nextSibling),t.$$childTail===e&&(t.$$childTail=e.$$prevSibling),e.$$prevSibling&&(e.$$prevSibling.$$nextSibling=e.$$nextSibling),e.$$nextSibling&&(e.$$nextSibling.$$prevSibling=e.$$prevSibling),e.$$nextSibling=e.$$prevSibling=null}},reconnectScope:function(e){if(e&&e.$root!==e&&e.$$disconnected){var t=e.$parent;e.$$disconnected=!1,e.$broadcast("$ionic.reconnectScope",e),e.$$prevSibling=t.$$childTail,t.$$childHead?(t.$$childTail.$$nextSibling=e,t.$$childTail=e):t.$$childHead=t.$$childTail=e}},isScopeDisconnected:function(e){for(var t=e;t;){if(t.$$disconnected)return!0;t=t.$parent}return!1}},e.inherit=e.Utils.inherit,e.extend=e.Utils.extend,e.throttle=e.Utils.throttle,e.proxy=e.Utils.proxy,e.debounce=e.Utils.debounce}(window.ionic);var ee,te,ne,ie,re,ae=0,oe=0,se=0,le=!1,ce="keyboard-open",de="scroll-content",ue=ionic.debounce(E,200,!0),pe=ionic.debounce(y,100,!0);ionic.keyboard={isOpen:!1,isClosing:!1,isOpening:!1,height:0,isLandscape:!1,isInitialized:!1,hide:function(){V()&&cordova.plugins.Keyboard.close(),ee&&ee.blur()},show:function(){V()&&cordova.plugins.Keyboard.show()},disable:function(){V()?(window.removeEventListener("native.keyboardshow",pe),window.removeEventListener("native.keyboardhide",x)):document.body.removeEventListener("focusout",x),document.body.removeEventListener("ionic.focusin",ue),document.body.removeEventListener("focusin",ue),window.removeEventListener("orientationchange",D),window.navigator.msPointerEnabled?document.removeEventListener("MSPointerDown",S):document.removeEventListener("touchstart",S),ionic.keyboard.isInitialized=!1},enable:function(){S()}},ae=G(),ionic.Platform.ready(function(){A(),window.addEventListener("orientationchange",D),setTimeout(A,999),window.navigator.msPointerEnabled?document.addEventListener("MSPointerDown",S,!1):document.addEventListener("touchstart",S,!1)});var he,fe={};ionic.viewport={orientation:function(){return window.innerWidth>window.innerHeight?90:0}},ionic.Platform.ready(function(){R(),window.addEventListener("orientationchange",function(){setTimeout(H,1e3)},!1)}),function(e){"use strict";e.views.View=function(){this.initialize.apply(this,arguments)},e.views.View.inherit=e.inherit,e.extend(e.views.View.prototype,{initialize:function(){}})}(window.ionic);var me={effect:{}};!function(e){var t=Date.now||function(){return+new Date},n=60,i=1e3,r={},a=1;me.effect.Animate={requestAnimationFrame:function(){var t=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame,n=!!t;if(t&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(t.toString())&&(n=!1),n)return function(e,n){t(e,n)};var i=60,r={},a=0,o=1,s=null,l=+new Date;return function(e){var t=o++;return r[t]=e,a++,null===s&&(s=setInterval(function(){var e=+new Date,t=r;r={},a=0;for(var n in t)t.hasOwnProperty(n)&&(t[n](e),l=e);e-l>2500&&(clearInterval(s),s=null)},1e3/i)),t}}(),stop:function(e){var t=null!=r[e];return t&&(r[e]=null),t},isRunning:function(e){return null!=r[e]},start:function(e,o,s,l,c,d){var u=t(),p=u,h=0,f=0,m=a++;if(d||(d=document.body),m%20===0){var g={};for(var v in r)g[v]=!0;r=g}var _=function(a){var g=a!==!0,v=t();if(!r[m]||o&&!o(m))return r[m]=null,void(s&&s(n-f/((v-u)/i),m,!1));if(g)for(var w=Math.round((v-p)/(i/n))-1,T=0;T<Math.min(w,4);T++)_(!0),f++;l&&(h=(v-u)/l,h>1&&(h=1));var b=c?c(h):h;e(b,v,g)!==!1&&1!==h||!g?g&&(p=v,me.effect.Animate.requestAnimationFrame(_,d)):(r[m]=null,s&&s(n-f/((v-u)/i),m,1===h||null==l))};return r[m]=!0,me.effect.Animate.requestAnimationFrame(_,d),m}}}(window),function(e){var t=function(){},n=function(e){return Math.pow(e-1,3)+1},i=function(e){return(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2)};e.views.Scroll=e.views.View.inherit({initialize:function(n){var i=this;i.__container=n.el,i.__content=n.el.firstElementChild,setTimeout(function(){i.__container&&i.__content&&(i.__container.scrollTop=0,i.__content.scrollTop=0)}),i.options={scrollingX:!1,scrollbarX:!0,scrollingY:!0,scrollbarY:!0,startX:0,startY:0,wheelDampen:6,minScrollbarSizeX:5,minScrollbarSizeY:5,scrollbarsFade:!0,scrollbarFadeDelay:300,scrollbarResizeFadeDelay:1e3,animating:!0,animationDuration:250,decelVelocityThreshold:4,decelVelocityThresholdPaging:4,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,deceleration:.97,preventDefault:!1,scrollingComplete:t,penetrationDeceleration:.03,penetrationAcceleration:.08,scrollEventInterval:10,freeze:!1,getContentWidth:function(){return Math.max(i.__content.scrollWidth,i.__content.offsetWidth)},getContentHeight:function(){return Math.max(i.__content.scrollHeight,i.__content.offsetHeight+2*i.__content.offsetTop)}};for(var r in n)i.options[r]=n[r];i.hintResize=e.debounce(function(){i.resize()},1e3,!0),i.onScroll=function(){e.scroll.isScrolling?(clearTimeout(i.scrollTimer),i.scrollTimer=setTimeout(i.setScrollStop,80)):setTimeout(i.setScrollStart,50)},i.freeze=function(e){return arguments.length&&(i.options.freeze=e),i.options.freeze},i.freezeShut=i.freeze,i.setScrollStart=function(){e.scroll.isScrolling=Math.abs(e.scroll.lastTop-i.__scrollTop)>1,clearTimeout(i.scrollTimer),i.scrollTimer=setTimeout(i.setScrollStop,80)},i.setScrollStop=function(){e.scroll.isScrolling=!1,e.scroll.lastTop=i.__scrollTop},i.triggerScrollEvent=e.throttle(function(){i.onScroll(),e.trigger("scroll",{scrollTop:i.__scrollTop,scrollLeft:i.__scrollLeft,target:i.__container})},i.options.scrollEventInterval),i.triggerScrollEndEvent=function(){e.trigger("scrollend",{scrollTop:i.__scrollTop,scrollLeft:i.__scrollLeft,target:i.__container})},i.__scrollLeft=i.options.startX,i.__scrollTop=i.options.startY,i.__callback=i.getRenderFn(),i.__initEventHandlers(),i.__createScrollbars()},run:function(){this.resize(),this.__fadeScrollbars("out",this.options.scrollbarResizeFadeDelay)},__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshDeactivate:null,__refreshStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,__transformProperty:null,__perspectiveProperty:null,__indicatorX:null,__indicatorY:null,__scrollbarFadeTimeout:null,__didWaitForSize:null,__sizerTimeout:null,__initEventHandlers:function(){function t(e){return e.touches&&e.touches.length?e.touches:[{pageX:e.pageX,pageY:e.pageY}]}var n,i=this,r=i.__container;if(i.scrollChildIntoView=function(t){var a=r.getBoundingClientRect().bottom;n=r.offsetHeight;var o=i.isShrunkForKeyboard,s=r.parentNode.classList.contains("modal"),l=s&&window.innerWidth>=680;if(!o){if(e.Platform.isIOS()||e.Platform.isFullScreen||l){var c=t.detail.viewportHeight-a,d=Math.max(0,t.detail.keyboardHeight-c);e.requestAnimationFrame(function(){n-=d,r.style.height=n+"px",r.style.overflow="visible",i.resize()})}i.isShrunkForKeyboard=!0}t.detail.isElementUnderKeyboard&&e.requestAnimationFrame(function(){r.scrollTop=0,i.isShrunkForKeyboard&&!o&&(a=r.getBoundingClientRect().bottom);var s=.5*n,l=(t.detail.elementBottom+t.detail.elementTop)/2,c=l-a,d=c+s;d>0&&(e.Platform.isIOS()&&e.tap.cloneFocusedInput(r,i),i.scrollBy(0,d,!0),i.onScroll())}),t.stopPropagation()},i.resetScrollView=function(){i.isShrunkForKeyboard&&(i.isShrunkForKeyboard=!1,r.style.height="",r.style.overflow=""),i.resize()},r.addEventListener("scrollChildIntoView",i.scrollChildIntoView),document.addEventListener("resetScrollView",i.resetScrollView),i.touchStart=function(n){if(i.startCoordinates=e.tap.pointerCoord(n),!e.tap.ignoreScrollStart(n)){if(i.__isDown=!0,e.tap.containsOrIsTextInput(n.target)||"SELECT"===n.target.tagName)return void(i.__hasStarted=!1);i.__isSelectable=!0,i.__enableScrollY=!0,i.__hasStarted=!0,i.doTouchStart(t(n),n.timeStamp),n.preventDefault()}},i.touchMove=function(n){if(!(i.options.freeze||!i.__isDown||!i.__isDown&&n.defaultPrevented||"TEXTAREA"===n.target.tagName&&n.target.parentElement.querySelector(":focus"))){if(!i.__hasStarted&&(e.tap.containsOrIsTextInput(n.target)||"SELECT"===n.target.tagName))return i.__hasStarted=!0,i.doTouchStart(t(n),n.timeStamp),void n.preventDefault();if(i.startCoordinates){var a=e.tap.pointerCoord(n);i.__isSelectable&&e.tap.isTextInput(n.target)&&Math.abs(i.startCoordinates.x-a.x)>20&&(i.__enableScrollY=!1,i.__isSelectable=!0),i.__enableScrollY&&Math.abs(i.startCoordinates.y-a.y)>10&&(i.__isSelectable=!1,e.tap.cloneFocusedInput(r,i))}i.doTouchMove(t(n),n.timeStamp,n.scale),i.__isDown=!0}},i.touchMoveBubble=function(e){i.__isDown&&i.options.preventDefault&&e.preventDefault()},i.touchEnd=function(t){i.__isDown&&(i.doTouchEnd(t,t.timeStamp),i.__isDown=!1,i.__hasStarted=!1,i.__isSelectable=!0,i.__enableScrollY=!0,i.__isDragging||i.__isDecelerating||i.__isAnimating||e.tap.removeClonedInputs(r,i))},i.mouseWheel=e.animationFrameThrottle(function(t){var n=e.DomUtil.getParentOrSelfWithClass(t.target,"ionic-scroll");i.options.freeze||n!==i.__container||(i.hintResize(),i.scrollBy((t.wheelDeltaX||t.deltaX||0)/i.options.wheelDampen,(-t.wheelDeltaY||t.deltaY||0)/i.options.wheelDampen),i.__fadeScrollbars("in"),clearTimeout(i.__wheelHideBarTimeout),i.__wheelHideBarTimeout=setTimeout(function(){i.__fadeScrollbars("out")},100))}),"ontouchstart"in window)r.addEventListener("touchstart",i.touchStart,!1),i.options.preventDefault&&r.addEventListener("touchmove",i.touchMoveBubble,!1),document.addEventListener("touchmove",i.touchMove,!1),document.addEventListener("touchend",i.touchEnd,!1),document.addEventListener("touchcancel",i.touchEnd,!1),document.addEventListener("wheel",i.mouseWheel,!1);else if(window.navigator.pointerEnabled)r.addEventListener("pointerdown",i.touchStart,!1),i.options.preventDefault&&r.addEventListener("pointermove",i.touchMoveBubble,!1),document.addEventListener("pointermove",i.touchMove,!1),document.addEventListener("pointerup",i.touchEnd,!1),document.addEventListener("pointercancel",i.touchEnd,!1),document.addEventListener("wheel",i.mouseWheel,!1);else if(window.navigator.msPointerEnabled)r.addEventListener("MSPointerDown",i.touchStart,!1),i.options.preventDefault&&r.addEventListener("MSPointerMove",i.touchMoveBubble,!1),document.addEventListener("MSPointerMove",i.touchMove,!1),document.addEventListener("MSPointerUp",i.touchEnd,!1),document.addEventListener("MSPointerCancel",i.touchEnd,!1),document.addEventListener("wheel",i.mouseWheel,!1);else{var a=!1;i.mouseDown=function(n){e.tap.ignoreScrollStart(n)||"SELECT"===n.target.tagName||(i.doTouchStart(t(n),n.timeStamp),e.tap.isTextInput(n.target)||n.preventDefault(),a=!0)},i.mouseMove=function(e){i.options.freeze||!a||!a&&e.defaultPrevented||(i.doTouchMove(t(e),e.timeStamp),a=!0)},i.mouseMoveBubble=function(e){a&&i.options.preventDefault&&e.preventDefault()},i.mouseUp=function(e){a&&(i.doTouchEnd(e,e.timeStamp),a=!1)},r.addEventListener("mousedown",i.mouseDown,!1),i.options.preventDefault&&r.addEventListener("mousemove",i.mouseMoveBubble,!1),document.addEventListener("mousemove",i.mouseMove,!1),document.addEventListener("mouseup",i.mouseUp,!1),document.addEventListener("mousewheel",i.mouseWheel,!1),document.addEventListener("wheel",i.mouseWheel,!1)}},__cleanup:function(){var n=this,i=n.__container;i.removeEventListener("touchstart",n.touchStart),i.removeEventListener("touchmove",n.touchMoveBubble),document.removeEventListener("touchmove",n.touchMove),document.removeEventListener("touchend",n.touchEnd),document.removeEventListener("touchcancel",n.touchEnd),i.removeEventListener("pointerdown",n.touchStart),i.removeEventListener("pointermove",n.touchMoveBubble),document.removeEventListener("pointermove",n.touchMove),document.removeEventListener("pointerup",n.touchEnd),document.removeEventListener("pointercancel",n.touchEnd),i.removeEventListener("MSPointerDown",n.touchStart),i.removeEventListener("MSPointerMove",n.touchMoveBubble),document.removeEventListener("MSPointerMove",n.touchMove),document.removeEventListener("MSPointerUp",n.touchEnd),document.removeEventListener("MSPointerCancel",n.touchEnd),i.removeEventListener("mousedown",n.mouseDown),i.removeEventListener("mousemove",n.mouseMoveBubble),document.removeEventListener("mousemove",n.mouseMove),document.removeEventListener("mouseup",n.mouseUp),document.removeEventListener("mousewheel",n.mouseWheel),document.removeEventListener("wheel",n.mouseWheel),i.removeEventListener("scrollChildIntoView",n.scrollChildIntoView),document.removeEventListener("resetScrollView",n.resetScrollView),e.tap.removeClonedInputs(i,n),delete n.__container,delete n.__content,delete n.__indicatorX,delete n.__indicatorY,delete n.options.el,n.__callback=n.scrollChildIntoView=n.resetScrollView=t,n.mouseMove=n.mouseDown=n.mouseUp=n.mouseWheel=n.touchStart=n.touchMove=n.touchEnd=n.touchCancel=t,n.resize=n.scrollTo=n.zoomTo=n.__scrollingComplete=t,i=null},__createScrollbar:function(e){var t=document.createElement("div"),n=document.createElement("div");return n.className="scroll-bar-indicator scroll-bar-fade-out","h"==e?t.className="scroll-bar scroll-bar-h":t.className="scroll-bar scroll-bar-v",t.appendChild(n),t},__createScrollbars:function(){var e,t,n=this;n.options.scrollingX&&(e={el:n.__createScrollbar("h"),sizeRatio:1},e.indicator=e.el.children[0],n.options.scrollbarX&&n.__container.appendChild(e.el),n.__indicatorX=e),n.options.scrollingY&&(t={el:n.__createScrollbar("v"),sizeRatio:1},t.indicator=t.el.children[0],n.options.scrollbarY&&n.__container.appendChild(t.el),n.__indicatorY=t)},__resizeScrollbars:function(){var t=this;if(t.__indicatorX){var n=Math.max(Math.round(t.__clientWidth*t.__clientWidth/t.__contentWidth),20);n>t.__contentWidth&&(n=0),n!==t.__indicatorX.size&&e.requestAnimationFrame(function(){t.__indicatorX.indicator.style.width=n+"px"}),t.__indicatorX.size=n,t.__indicatorX.minScale=t.options.minScrollbarSizeX/n,t.__indicatorX.maxPos=t.__clientWidth-n,t.__indicatorX.sizeRatio=t.__maxScrollLeft?t.__indicatorX.maxPos/t.__maxScrollLeft:1}if(t.__indicatorY){var i=Math.max(Math.round(t.__clientHeight*t.__clientHeight/t.__contentHeight),20);i>t.__contentHeight&&(i=0),i!==t.__indicatorY.size&&e.requestAnimationFrame(function(){t.__indicatorY&&(t.__indicatorY.indicator.style.height=i+"px")}),t.__indicatorY.size=i,t.__indicatorY.minScale=t.options.minScrollbarSizeY/i,t.__indicatorY.maxPos=t.__clientHeight-i,t.__indicatorY.sizeRatio=t.__maxScrollTop?t.__indicatorY.maxPos/t.__maxScrollTop:1}},__repositionScrollbars:function(){var e,t,n,i,r,a,o=this,s=0,l=0;if(o.__indicatorX){o.__indicatorY&&(s=10),r=Math.round(o.__indicatorX.sizeRatio*o.__scrollLeft)||0,n=o.__scrollLeft-(o.__maxScrollLeft-s),o.__scrollLeft<0?(t=Math.max(o.__indicatorX.minScale,(o.__indicatorX.size-Math.abs(o.__scrollLeft))/o.__indicatorX.size),r=0,o.__indicatorX.indicator.style[o.__transformOriginProperty]="left center"):n>0?(t=Math.max(o.__indicatorX.minScale,(o.__indicatorX.size-n)/o.__indicatorX.size),r=o.__indicatorX.maxPos-s,o.__indicatorX.indicator.style[o.__transformOriginProperty]="right center"):(r=Math.min(o.__maxScrollLeft,Math.max(0,r)),t=1);var c="translate3d("+r+"px, 0, 0) scaleX("+t+")";o.__indicatorX.transformProp!==c&&(o.__indicatorX.indicator.style[o.__transformProperty]=c,o.__indicatorX.transformProp=c)}if(o.__indicatorY){a=Math.round(o.__indicatorY.sizeRatio*o.__scrollTop)||0,o.__indicatorX&&(l=10),i=o.__scrollTop-(o.__maxScrollTop-l),o.__scrollTop<0?(e=Math.max(o.__indicatorY.minScale,(o.__indicatorY.size-Math.abs(o.__scrollTop))/o.__indicatorY.size),a=0,"center top"!==o.__indicatorY.originProp&&(o.__indicatorY.indicator.style[o.__transformOriginProperty]="center top",o.__indicatorY.originProp="center top")):i>0?(e=Math.max(o.__indicatorY.minScale,(o.__indicatorY.size-i)/o.__indicatorY.size),a=o.__indicatorY.maxPos-l,"center bottom"!==o.__indicatorY.originProp&&(o.__indicatorY.indicator.style[o.__transformOriginProperty]="center bottom",o.__indicatorY.originProp="center bottom")):(a=Math.min(o.__maxScrollTop,Math.max(0,a)),e=1);var d="translate3d(0,"+a+"px, 0) scaleY("+e+")";o.__indicatorY.transformProp!==d&&(o.__indicatorY.indicator.style[o.__transformProperty]=d,o.__indicatorY.transformProp=d)}},__fadeScrollbars:function(e,t){var n=this;if(n.options.scrollbarsFade){var i="scroll-bar-fade-out";n.options.scrollbarsFade===!0&&(clearTimeout(n.__scrollbarFadeTimeout),"in"==e?(n.__indicatorX&&n.__indicatorX.indicator.classList.remove(i),n.__indicatorY&&n.__indicatorY.indicator.classList.remove(i)):n.__scrollbarFadeTimeout=setTimeout(function(){n.__indicatorX&&n.__indicatorX.indicator.classList.add(i),n.__indicatorY&&n.__indicatorY.indicator.classList.add(i)},t||n.options.scrollbarFadeDelay))}},__scrollingComplete:function(){this.options.scrollingComplete(),e.tap.removeClonedInputs(this.__container,this),this.__fadeScrollbars("out")},resize:function(e){var t=this;t.__container&&t.options&&t.setDimensions(t.__container.clientWidth,t.__container.clientHeight,t.options.getContentWidth(),t.options.getContentHeight(),e)},getRenderFn:function(){var e,t=this,n=t.__content,i=document.documentElement.style;"MozAppearance"in i?e="gecko":"WebkitAppearance"in i?e="webkit":"string"==typeof navigator.cpuClass&&(e="trident");var r,a={trident:"ms",gecko:"Moz",webkit:"Webkit",presto:"O"}[e],o=document.createElement("div"),s=a+"Perspective",l=a+"Transform",c=a+"TransformOrigin";return t.__perspectiveProperty=l,t.__transformProperty=l,t.__transformOriginProperty=c,o.style[s]!==r?function(e,i,r,a){var o="translate3d("+-e+"px,"+-i+"px,0) scale("+r+")";o!==t.contentTransform&&(n.style[l]=o,t.contentTransform=o),t.__repositionScrollbars(),a||t.triggerScrollEvent()}:o.style[l]!==r?function(e,i,r,a){n.style[l]="translate("+-e+"px,"+-i+"px) scale("+r+")",t.__repositionScrollbars(),a||t.triggerScrollEvent()}:function(e,i,r,a){n.style.marginLeft=e?-e/r+"px":"",n.style.marginTop=i?-i/r+"px":"",n.style.zoom=r||"",t.__repositionScrollbars(),a||t.triggerScrollEvent()}},setDimensions:function(e,t,n,i,r){var a=this;(e||t||n||i)&&(e===+e&&(a.__clientWidth=e),t===+t&&(a.__clientHeight=t),n===+n&&(a.__contentWidth=n),i===+i&&(a.__contentHeight=i),a.__computeScrollMax(),a.__resizeScrollbars(),r||a.scrollTo(a.__scrollLeft,a.__scrollTop,!0,null,!0))},setPosition:function(e,t){this.__clientLeft=e||0,this.__clientTop=t||0},setSnapSize:function(e,t){this.__snapWidth=e,this.__snapHeight=t},activatePullToRefresh:function(t,n){var i=this;i.__refreshHeight=t,i.__refreshActivate=function(){e.requestAnimationFrame(n.activate)},i.__refreshDeactivate=function(){e.requestAnimationFrame(n.deactivate)},i.__refreshStart=function(){e.requestAnimationFrame(n.start)},i.__refreshShow=function(){e.requestAnimationFrame(n.show)},i.__refreshHide=function(){e.requestAnimationFrame(n.hide)},i.__refreshTail=function(){e.requestAnimationFrame(n.tail)},i.__refreshTailTime=100,i.__minSpinTime=600},triggerPullToRefresh:function(){this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0);var e=new Date;this.refreshStartTime=e.getTime(),this.__refreshStart&&this.__refreshStart()},finishPullToRefresh:function(){var e=this,t=new Date,n=0;e.refreshStartTime+e.__minSpinTime>t.getTime()&&(n=e.refreshStartTime+e.__minSpinTime-t.getTime()),setTimeout(function(){e.__refreshTail&&e.__refreshTail(),setTimeout(function(){e.__refreshActive=!1,e.__refreshDeactivate&&e.__refreshDeactivate(),e.__refreshHide&&e.__refreshHide(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)},e.__refreshTailTime)},n)},getValues:function(){return{left:this.__scrollLeft,top:this.__scrollTop,zoom:this.__zoomLevel}},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},zoomTo:function(e,t,n,i){var r=this;if(!r.options.zooming)throw new Error("Zooming is not enabled!");r.__isDecelerating&&(me.effect.Animate.stop(r.__isDecelerating),r.__isDecelerating=!1);var a=r.__zoomLevel;null==n&&(n=r.__clientWidth/2),null==i&&(i=r.__clientHeight/2),e=Math.max(Math.min(e,r.options.maxZoom),r.options.minZoom),r.__computeScrollMax(e);var o=(n+r.__scrollLeft)*e/a-n,s=(i+r.__scrollTop)*e/a-i;o>r.__maxScrollLeft?o=r.__maxScrollLeft:0>o&&(o=0),s>r.__maxScrollTop?s=r.__maxScrollTop:0>s&&(s=0),r.__publish(o,s,e,t)},zoomBy:function(e,t,n,i){this.zoomTo(this.__zoomLevel*e,t,n,i)},scrollTo:function(e,t,n,i,r){var a=this;if(a.__isDecelerating&&(me.effect.Animate.stop(a.__isDecelerating),a.__isDecelerating=!1),null!=i&&i!==a.__zoomLevel){if(!a.options.zooming)throw new Error("Zooming is not enabled!");e*=i,t*=i,a.__computeScrollMax(i)}else i=a.__zoomLevel;a.options.scrollingX?a.options.paging?e=Math.round(e/a.__clientWidth)*a.__clientWidth:a.options.snapping&&(e=Math.round(e/a.__snapWidth)*a.__snapWidth):e=a.__scrollLeft,a.options.scrollingY?a.options.paging?t=Math.round(t/a.__clientHeight)*a.__clientHeight:a.options.snapping&&(t=Math.round(t/a.__snapHeight)*a.__snapHeight):t=a.__scrollTop,e=Math.max(Math.min(a.__maxScrollLeft,e),0),t=Math.max(Math.min(a.__maxScrollTop,t),0),e===a.__scrollLeft&&t===a.__scrollTop&&(n=!1),a.__publish(e,t,i,n,r)},scrollBy:function(e,t,n){var i=this,r=i.__isAnimating?i.__scheduledLeft:i.__scrollLeft,a=i.__isAnimating?i.__scheduledTop:i.__scrollTop;i.scrollTo(r+(e||0),a+(t||0),n)},doMouseZoom:function(e,t,n,i){var r=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*r,!1,n-this.__clientLeft,i-this.__clientTop)},doTouchStart:function(e,t){var n=this;n.__decStopped=!(!n.__isDecelerating&&!n.__isAnimating),n.hintResize(),t instanceof Date&&(t=t.valueOf()),"number"!=typeof t&&(t=Date.now()),n.__interruptedAnimation=!0,n.__isDecelerating&&(me.effect.Animate.stop(n.__isDecelerating),n.__isDecelerating=!1,n.__interruptedAnimation=!0),n.__isAnimating&&(me.effect.Animate.stop(n.__isAnimating),n.__isAnimating=!1,n.__interruptedAnimation=!0);var i,r,a=1===e.length;a?(i=e[0].pageX,r=e[0].pageY):(i=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2),n.__initialTouchLeft=i,n.__initialTouchTop=r,n.__initialTouches=e,n.__zoomLevelStart=n.__zoomLevel,n.__lastTouchLeft=i,n.__lastTouchTop=r,n.__lastTouchMove=t,n.__lastScale=1,n.__enableScrollX=!a&&n.options.scrollingX,n.__enableScrollY=!a&&n.options.scrollingY,n.__isTracking=!0,n.__didDecelerationComplete=!1,n.__isDragging=!a,n.__isSingleTouch=a,n.__positions=[]},doTouchMove:function(e,t,n){t instanceof Date&&(t=t.valueOf()),"number"!=typeof t&&(t=Date.now());var i=this;if(i.__isTracking){var r,a;2===e.length?(r=Math.abs(e[0].pageX+e[1].pageX)/2,a=Math.abs(e[0].pageY+e[1].pageY)/2,!n&&i.options.zooming&&(n=i.__getScale(i.__initialTouches,e))):(r=e[0].pageX,a=e[0].pageY);var o=i.__positions;if(i.__isDragging){i.__decStopped=!1;var s=r-i.__lastTouchLeft,l=a-i.__lastTouchTop,c=i.__scrollLeft,d=i.__scrollTop,u=i.__zoomLevel;if(null!=n&&i.options.zooming){var p=u;if(u=u/i.__lastScale*n,u=Math.max(Math.min(u,i.options.maxZoom),i.options.minZoom),p!==u){var h=r-i.__clientLeft,f=a-i.__clientTop;c=(h+c)*u/p-h,d=(f+d)*u/p-f,i.__computeScrollMax(u)}}if(i.__enableScrollX){c-=s*i.options.speedMultiplier;var m=i.__maxScrollLeft;(c>m||0>c)&&(i.options.bouncing?c+=s/2*i.options.speedMultiplier:c=c>m?m:0)}if(i.__enableScrollY){d-=l*i.options.speedMultiplier;var g=i.__maxScrollTop;d>g||0>d?i.options.bouncing||i.__refreshHeight&&0>d?(d+=l/2*i.options.speedMultiplier,i.__enableScrollX||null==i.__refreshHeight||(0>d?(i.__refreshHidden=!1,i.__refreshShow()):(i.__refreshHide(),i.__refreshHidden=!0),!i.__refreshActive&&d<=-i.__refreshHeight?(i.__refreshActive=!0,i.__refreshActivate&&i.__refreshActivate()):i.__refreshActive&&d>-i.__refreshHeight&&(i.__refreshActive=!1,i.__refreshDeactivate&&i.__refreshDeactivate()))):d=d>g?g:0:i.__refreshHeight&&!i.__refreshHidden&&(i.__refreshHide(),i.__refreshHidden=!0)}o.length>60&&o.splice(0,30),o.push(c,d,t),i.__publish(c,d,u)}else{var v=i.options.locking?3:0,_=5,w=Math.abs(r-i.__initialTouchLeft),T=Math.abs(a-i.__initialTouchTop);i.__enableScrollX=i.options.scrollingX&&w>=v,i.__enableScrollY=i.options.scrollingY&&T>=v,o.push(i.__scrollLeft,i.__scrollTop,t),i.__isDragging=(i.__enableScrollX||i.__enableScrollY)&&(w>=_||T>=_),i.__isDragging&&(i.__interruptedAnimation=!1,i.__fadeScrollbars("in"))}i.__lastTouchLeft=r,i.__lastTouchTop=a,i.__lastTouchMove=t,i.__lastScale=n}},doTouchEnd:function(t,n){n instanceof Date&&(n=n.valueOf()),"number"!=typeof n&&(n=Date.now());var i=this;if(i.__isTracking){if(i.__isTracking=!1,i.__isDragging)if(i.__isDragging=!1,i.__isSingleTouch&&i.options.animating&&n-i.__lastTouchMove<=100){for(var r=i.__positions,a=r.length-1,o=a,s=a;s>0&&r[s]>i.__lastTouchMove-100;s-=3)o=s;if(o!==a){
var l=r[a]-r[o],c=i.__scrollLeft-r[o-2],d=i.__scrollTop-r[o-1];i.__decelerationVelocityX=c/l*(1e3/60),i.__decelerationVelocityY=d/l*(1e3/60);var u=i.options.paging||i.options.snapping?i.options.decelVelocityThresholdPaging:i.options.decelVelocityThreshold;(Math.abs(i.__decelerationVelocityX)>u||Math.abs(i.__decelerationVelocityY)>u)&&(i.__refreshActive||i.__startDeceleration(n))}else i.__scrollingComplete()}else n-i.__lastTouchMove>100&&i.__scrollingComplete();else i.__decStopped&&(t.isTapHandled=!0,i.__decStopped=!1);if(!i.__isDecelerating)if(i.__refreshActive&&i.__refreshStart){i.__publish(i.__scrollLeft,-i.__refreshHeight,i.__zoomLevel,!0);var p=new Date;i.refreshStartTime=p.getTime(),i.__refreshStart&&i.__refreshStart(),e.Platform.isAndroid()||i.__startDeceleration()}else(i.__interruptedAnimation||i.__isDragging)&&i.__scrollingComplete(),i.scrollTo(i.__scrollLeft,i.__scrollTop,!0,i.__zoomLevel),i.__refreshActive&&(i.__refreshActive=!1,i.__refreshDeactivate&&i.__refreshDeactivate());i.__positions.length=0}},__publish:function(e,t,r,a,o){var s=this,l=s.__isAnimating;if(l&&(me.effect.Animate.stop(l),s.__isAnimating=!1),a&&s.options.animating){s.__scheduledLeft=e,s.__scheduledTop=t,s.__scheduledZoom=r;var c=s.__scrollLeft,d=s.__scrollTop,u=s.__zoomLevel,p=e-c,h=t-d,f=r-u,m=function(e,t,n){n&&(s.__scrollLeft=c+p*e,s.__scrollTop=d+h*e,s.__zoomLevel=u+f*e,s.__callback&&s.__callback(s.__scrollLeft,s.__scrollTop,s.__zoomLevel,o))},g=function(e){return s.__isAnimating===e},v=function(e,t,n){t===s.__isAnimating&&(s.__isAnimating=!1),(s.__didDecelerationComplete||n)&&s.__scrollingComplete(),s.options.zooming&&s.__computeScrollMax()};s.__isAnimating=me.effect.Animate.start(m,g,v,s.options.animationDuration,l?n:i)}else s.__scheduledLeft=s.__scrollLeft=e,s.__scheduledTop=s.__scrollTop=t,s.__scheduledZoom=s.__zoomLevel=r,s.__callback&&s.__callback(e,t,r,o),s.options.zooming&&s.__computeScrollMax()},__computeScrollMax:function(e){var t=this;null==e&&(e=t.__zoomLevel),t.__maxScrollLeft=Math.max(t.__contentWidth*e-t.__clientWidth,0),t.__maxScrollTop=Math.max(t.__contentHeight*e-t.__clientHeight,0),t.__didWaitForSize||t.__maxScrollLeft||t.__maxScrollTop||(t.__didWaitForSize=!0,t.__waitForSize())},__waitForSize:function(){var e=this;clearTimeout(e.__sizerTimeout);var t=function(){e.resize(!0)};t(),e.__sizerTimeout=setTimeout(t,500)},__startDeceleration:function(){var e=this;if(e.options.paging){var t=Math.max(Math.min(e.__scrollLeft,e.__maxScrollLeft),0),n=Math.max(Math.min(e.__scrollTop,e.__maxScrollTop),0),i=e.__clientWidth,r=e.__clientHeight;e.__minDecelerationScrollLeft=Math.floor(t/i)*i,e.__minDecelerationScrollTop=Math.floor(n/r)*r,e.__maxDecelerationScrollLeft=Math.ceil(t/i)*i,e.__maxDecelerationScrollTop=Math.ceil(n/r)*r}else e.__minDecelerationScrollLeft=0,e.__minDecelerationScrollTop=0,e.__maxDecelerationScrollLeft=e.__maxScrollLeft,e.__maxDecelerationScrollTop=e.__maxScrollTop,e.__refreshActive&&(e.__minDecelerationScrollTop=-1*e.__refreshHeight);var a=function(t,n,i){e.__stepThroughDeceleration(i)};e.__minVelocityToKeepDecelerating=e.options.snapping?4:.1;var o=function(){var t=Math.abs(e.__decelerationVelocityX)>=e.__minVelocityToKeepDecelerating||Math.abs(e.__decelerationVelocityY)>=e.__minVelocityToKeepDecelerating;return t||(e.__didDecelerationComplete=!0,e.options.bouncing&&!e.__refreshActive&&e.scrollTo(Math.min(Math.max(e.__scrollLeft,0),e.__maxScrollLeft),Math.min(Math.max(e.__scrollTop,0),e.__maxScrollTop),e.__refreshActive)),t},s=function(){e.__isDecelerating=!1,e.__didDecelerationComplete&&e.__scrollingComplete(),e.options.paging&&e.scrollTo(e.__scrollLeft,e.__scrollTop,e.options.snapping)};e.__isDecelerating=me.effect.Animate.start(a,o,s)},__stepThroughDeceleration:function(e){var t=this,n=t.__scrollLeft+t.__decelerationVelocityX,i=t.__scrollTop+t.__decelerationVelocityY;if(!t.options.bouncing){var r=Math.max(Math.min(t.__maxDecelerationScrollLeft,n),t.__minDecelerationScrollLeft);r!==n&&(n=r,t.__decelerationVelocityX=0);var a=Math.max(Math.min(t.__maxDecelerationScrollTop,i),t.__minDecelerationScrollTop);a!==i&&(i=a,t.__decelerationVelocityY=0)}if(e?t.__publish(n,i,t.__zoomLevel):(t.__scrollLeft=n,t.__scrollTop=i),!t.options.paging){var o=t.options.deceleration;t.__decelerationVelocityX*=o,t.__decelerationVelocityY*=o}if(t.options.bouncing){var s=0,l=0,c=t.options.penetrationDeceleration,d=t.options.penetrationAcceleration;if(n<t.__minDecelerationScrollLeft?s=t.__minDecelerationScrollLeft-n:n>t.__maxDecelerationScrollLeft&&(s=t.__maxDecelerationScrollLeft-n),i<t.__minDecelerationScrollTop?l=t.__minDecelerationScrollTop-i:i>t.__maxDecelerationScrollTop&&(l=t.__maxDecelerationScrollTop-i),0!==s){var u=s*t.__decelerationVelocityX<=t.__minDecelerationScrollLeft;u&&(t.__decelerationVelocityX+=s*c);var p=Math.abs(t.__decelerationVelocityX)<=t.__minVelocityToKeepDecelerating;(!u||p)&&(t.__decelerationVelocityX=s*d)}if(0!==l){var h=l*t.__decelerationVelocityY<=t.__minDecelerationScrollTop;h&&(t.__decelerationVelocityY+=l*c);var f=Math.abs(t.__decelerationVelocityY)<=t.__minVelocityToKeepDecelerating;(!h||f)&&(t.__decelerationVelocityY=l*d)}}},__getDistance:function(e,t){var n=t.pageX-e.pageX,i=t.pageY-e.pageY;return Math.sqrt(n*n+i*i)},__getScale:function(e,t){return e.length>=2&&t.length>=2?this.__getDistance(t[0],t[1])/this.__getDistance(e[0],e[1]):1}}),e.scroll={isScrolling:!1,lastTop:0}}(ionic),function(e){var t=function(){},n=function(e){};e.views.ScrollNative=e.views.View.inherit({initialize:function(t){var n=this;n.__container=n.el=t.el,n.__content=t.el.firstElementChild,n.__frozen=!1,n.isNative=!0,n.__scrollTop=n.el.scrollTop,n.__scrollLeft=n.el.scrollLeft,n.__clientHeight=n.__content.clientHeight,n.__clientWidth=n.__content.clientWidth,n.__maxScrollTop=Math.max(n.__contentHeight-n.__clientHeight,0),n.__maxScrollLeft=Math.max(n.__contentWidth-n.__clientWidth,0),(t.startY>=0||t.startX>=0)&&e.requestAnimationFrame(function(){n.el.scrollTop=t.startY||0,n.el.scrollLeft=t.startX||0,n.__scrollTop=n.el.scrollTop,n.__scrollLeft=n.el.scrollLeft}),n.options={freeze:!1,getContentWidth:function(){return Math.max(n.__content.scrollWidth,n.__content.offsetWidth)},getContentHeight:function(){return Math.max(n.__content.scrollHeight,n.__content.offsetHeight+2*n.__content.offsetTop)}};for(var i in t)n.options[i]=t[i];n.onScroll=function(){e.scroll.isScrolling||(e.scroll.isScrolling=!0),clearTimeout(n.scrollTimer),n.scrollTimer=setTimeout(function(){e.scroll.isScrolling=!1},80)},n.freeze=function(e){n.__frozen=e},n.freezeShut=function(e){n.__frozenShut=e},n.__initEventHandlers()},__callback:function(){n("__callback")},zoomTo:function(){n("zoomTo")},zoomBy:function(){n("zoomBy")},activatePullToRefresh:function(){n("activatePullToRefresh")},resize:function(e){var t=this;t.__container&&t.options&&t.setDimensions(t.__container.clientWidth,t.__container.clientHeight,t.options.getContentWidth(),t.options.getContentHeight(),e)},run:function(){this.resize()},getValues:function(){var e=this;return e.update(),{left:e.__scrollLeft,top:e.__scrollTop,zoom:1}},update:function(){var e=this;e.__scrollLeft=e.el.scrollLeft,e.__scrollTop=e.el.scrollTop},setDimensions:function(e,t,n,i){var r=this;(e||t||n||i)&&(e===+e&&(r.__clientWidth=e),t===+t&&(r.__clientHeight=t),n===+n&&(r.__contentWidth=n),i===+i&&(r.__contentHeight=i),r.__computeScrollMax())},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},scrollBy:function(e,t,n){var i=this;i.update();var r=i.__isAnimating?i.__scheduledLeft:i.__scrollLeft,a=i.__isAnimating?i.__scheduledTop:i.__scrollTop;i.scrollTo(r+(e||0),a+(t||0),n)},scrollTo:function(t,n,i){function r(t,n){function i(e){return--e*e*e+1}function r(){var p=Date.now(),h=Math.min(1,(p-l)/c),f=i(h);d!=t&&(a.el.scrollTop=parseInt(f*(t-d)+d,10)),u!=n&&(a.el.scrollLeft=parseInt(f*(n-u)+u,10)),1>h?e.requestAnimationFrame(r):(e.tap.removeClonedInputs(a.__container,a),a.el.style.overflowX=o,a.el.style.overflowY=s,a.resize())}var l=Date.now(),c=250,d=a.el.scrollTop,u=a.el.scrollLeft;return d===t&&u===n?(a.el.style.overflowX=o,a.el.style.overflowY=s,void a.resize()):void e.requestAnimationFrame(r)}var a=this;if(!i)return a.el.scrollTop=n,a.el.scrollLeft=t,void a.resize();var o=a.el.style.overflowX,s=a.el.style.overflowY;clearTimeout(a.__scrollToCleanupTimeout),a.__scrollToCleanupTimeout=setTimeout(function(){a.el.style.overflowX=o,a.el.style.overflowY=s},500),a.el.style.overflowY="hidden",a.el.style.overflowX="hidden",r(n,t)},__waitForSize:function(){var e=this;clearTimeout(e.__sizerTimeout);var t=function(){e.resize(!0)};t(),e.__sizerTimeout=setTimeout(t,500)},__computeScrollMax:function(){var e=this;e.__maxScrollLeft=Math.max(e.__contentWidth-e.__clientWidth,0),e.__maxScrollTop=Math.max(e.__contentHeight-e.__clientHeight,0),e.__didWaitForSize||e.__maxScrollLeft||e.__maxScrollTop||(e.__didWaitForSize=!0,e.__waitForSize())},__initEventHandlers:function(){var t,n,i=this,r=i.__container;i.scrollChildIntoView=function(a){var o=r.getBoundingClientRect();i.__originalContainerHeight||(i.__originalContainerHeight=o.height),t=i.__originalContainerHeight;var s=i.isShrunkForKeyboard,l=r.parentNode.classList.contains("modal"),c=r.parentNode.classList.contains("popover"),d=l&&window.innerWidth>=680,u=n&&n!==a.detail.keyboardHeight;(!s||u)&&(!c&&(e.Platform.isIOS()||e.Platform.isFullScreen||d)&&e.requestAnimationFrame(function(){t=Math.max(0,Math.min(i.__originalContainerHeight,i.__originalContainerHeight-(a.detail.keyboardHeight-43))),r.style.height=t+"px",r.classList.add("keyboard-up"),i.resize()}),i.isShrunkForKeyboard=!0),n=a.detail.keyboardHeight,a.detail.isElementUnderKeyboard&&e.requestAnimationFrame(function(){var t=e.DomUtil.getOffsetTop(a.detail.target);setTimeout(function(){e.Platform.isIOS()&&e.tap.cloneFocusedInput(r,i),i.scrollTo(0,t-(o.top+100),!0),i.onScroll()},32)}),a.stopPropagation()},i.resetScrollView=function(){i.isShrunkForKeyboard&&(i.isShrunkForKeyboard=!1,r.style.height="",i.__originalContainerHeight=r.getBoundingClientRect().height,e.Platform.isIOS()&&e.requestAnimationFrame(function(){r.classList.remove("keyboard-up")})),i.resize()},i.handleTouchMove=function(e){return i.__frozenShut?(e.preventDefault(),e.stopPropagation(),!1):i.__frozen?(e.preventDefault(),!1):!0},r.addEventListener("scroll",i.onScroll),r.addEventListener("scrollChildIntoView",i.scrollChildIntoView),r.addEventListener(e.EVENTS.touchstart,i.handleTouchMove),r.addEventListener(e.EVENTS.touchmove,i.handleTouchMove),document.addEventListener("resetScrollView",i.resetScrollView)},__cleanup:function(){var n=this,i=n.__container;i.removeEventListener("resetScrollView",n.resetScrollView),i.removeEventListener("scroll",n.onScroll),i.removeEventListener("scrollChildIntoView",n.scrollChildIntoView),i.removeEventListener("resetScrollView",n.resetScrollView),i.removeEventListener(e.EVENTS.touchstart,n.handleTouchMove),i.removeEventListener(e.EVENTS.touchmove,n.handleTouchMove),e.tap.removeClonedInputs(i,n),delete n.__container,delete n.__content,delete n.__indicatorX,delete n.__indicatorY,delete n.options.el,n.resize=n.scrollTo=n.onScroll=n.resetScrollView=t,n.scrollChildIntoView=t,i=null}})}(ionic),function(e){"use strict";var t="item",n="item-content",i="item-sliding",r="item-options",a="item-placeholder",o="item-reordering",s="item-reorder",l=function(){};l.prototype={start:function(){},drag:function(){},end:function(){},isSameItem:function(){return!1}};var c=function(e){this.dragThresholdX=e.dragThresholdX||10,this.el=e.el,this.item=e.item,this.canSwipe=e.canSwipe};c.prototype=new l,c.prototype.start=function(a){var o,s,l,c;this.canSwipe()&&(o=a.target.classList.contains(n)?a.target:a.target.classList.contains(t)?a.target.querySelector("."+n):e.DomUtil.getParentWithClass(a.target,n),o&&(o.classList.remove(i),l=parseFloat(o.style[e.CSS.TRANSFORM].replace("translate3d(","").split(",")[0])||0,s=o.parentNode.querySelector("."+r),s&&(s.classList.remove("invisible"),c=s.offsetWidth,this._currentDrag={buttons:s,buttonsWidth:c,content:o,startOffsetX:l})))},c.prototype.isSameItem=function(e){return e._lastDrag&&this._currentDrag?this._currentDrag.content==e._lastDrag.content:!1},c.prototype.clean=function(t){function n(){i.buttons&&i.buttons.classList.add("invisible")}var i=this._lastDrag;i&&i.content&&(i.content.style[e.CSS.TRANSITION]="",i.content.style[e.CSS.TRANSFORM]="",t?(i.content.style[e.CSS.TRANSITION]="none",n(),e.requestAnimationFrame(function(){i.content.style[e.CSS.TRANSITION]=""})):e.requestAnimationFrame(function(){setTimeout(n,250)}))},c.prototype.drag=e.animationFrameThrottle(function(t){var n;if(this._currentDrag&&(!this._isDragging&&(Math.abs(t.gesture.deltaX)>this.dragThresholdX||Math.abs(this._currentDrag.startOffsetX)>0)&&(this._isDragging=!0),this._isDragging)){n=this._currentDrag.buttonsWidth;var i=Math.min(0,this._currentDrag.startOffsetX+t.gesture.deltaX);-n>i&&(i=Math.min(-n,-n+.4*(t.gesture.deltaX+n))),this._currentDrag.content.$$ionicOptionsOpen=0!==i,this._currentDrag.content.style[e.CSS.TRANSFORM]="translate3d("+i+"px, 0, 0)",this._currentDrag.content.style[e.CSS.TRANSITION]="none"}}),c.prototype.end=function(t,n){var i=this;if(!i._currentDrag)return void(n&&n());var r=-i._currentDrag.buttonsWidth;t.gesture.deltaX>-(i._currentDrag.buttonsWidth/2)&&("left"==t.gesture.direction&&Math.abs(t.gesture.velocityX)<.3?r=0:"right"==t.gesture.direction&&(r=0)),e.requestAnimationFrame(function(){if(0===r){i._currentDrag.content.style[e.CSS.TRANSFORM]="";var t=i._currentDrag.buttons;setTimeout(function(){t&&t.classList.add("invisible")},250)}else i._currentDrag.content.style[e.CSS.TRANSFORM]="translate3d("+r+"px,0,0)";i._currentDrag.content.style[e.CSS.TRANSITION]="",i._lastDrag||(i._lastDrag={}),e.extend(i._lastDrag,i._currentDrag),i._currentDrag&&(i._currentDrag.buttons=null,i._currentDrag.content=null),i._currentDrag=null,n&&n()})};var d=function(e){var t=this;if(t.dragThresholdY=e.dragThresholdY||0,t.onReorder=e.onReorder,t.listEl=e.listEl,t.el=t.item=e.el,t.scrollEl=e.scrollEl,t.scrollView=e.scrollView,t.listElTrueTop=0,t.listEl.offsetParent){var n=t.listEl;do t.listElTrueTop+=n.offsetTop,n=n.offsetParent;while(n)}};d.prototype=new l,d.prototype._moveElement=function(t){var n=t.gesture.center.pageY+this.scrollView.getValues().top-this._currentDrag.elementHeight/2-this.listElTrueTop;this.el.style[e.CSS.TRANSFORM]="translate3d(0, "+n+"px, 0)"},d.prototype.deregister=function(){this.listEl=this.el=this.scrollEl=this.scrollView=null},d.prototype.start=function(t){var n=e.DomUtil.getChildIndex(this.el,this.el.nodeName.toLowerCase()),i=this.el.scrollHeight,r=this.el.cloneNode(!0);r.classList.add(a),this.el.parentNode.insertBefore(r,this.el),this.el.classList.add(o),this._currentDrag={elementHeight:i,startIndex:n,placeholder:r,scrollHeight:scroll,list:r.parentNode},this._moveElement(t)},d.prototype.drag=e.animationFrameThrottle(function(t){var n=this;if(this._currentDrag){var i=0,r=t.gesture.center.pageY,a=this.listElTrueTop;if(this.scrollView){var o=this.scrollView.__container;i=this.scrollView.getValues().top;var s=o.offsetTop,l=s-r+this._currentDrag.elementHeight/2,c=r+this._currentDrag.elementHeight/2-s-o.offsetHeight;t.gesture.deltaY<0&&l>0&&i>0&&(this.scrollView.scrollBy(null,-l),e.requestAnimationFrame(function(){n.drag(t)})),t.gesture.deltaY>0&&c>0&&i<this.scrollView.getScrollMax().top&&(this.scrollView.scrollBy(null,c),e.requestAnimationFrame(function(){n.drag(t)}))}!this._isDragging&&Math.abs(t.gesture.deltaY)>this.dragThresholdY&&(this._isDragging=!0),this._isDragging&&(this._moveElement(t),this._currentDrag.currentY=i+r-a)}}),d.prototype._getReorderIndex=function(){for(var e,t=this,n=Array.prototype.slice.call(t._currentDrag.placeholder.parentNode.children).filter(function(e){return e.nodeName===t.el.nodeName&&e!==t.el}),i=t._currentDrag.currentY,r=0,a=n.length;a>r;r++)if(e=n[r],r===a-1){if(i>e.offsetTop)return r}else if(0===r){if(i<e.offsetTop+e.offsetHeight)return r}else if(i>e.offsetTop-e.offsetHeight/2&&i<e.offsetTop+e.offsetHeight)return r;return t._currentDrag.startIndex},d.prototype.end=function(t,n){if(!this._currentDrag)return void(n&&n());var i=this._currentDrag.placeholder,r=this._getReorderIndex();this.el.classList.remove(o),this.el.style[e.CSS.TRANSFORM]="",i.parentNode.insertBefore(this.el,i),i.parentNode.removeChild(i),this.onReorder&&this.onReorder(this.el,this._currentDrag.startIndex,r),this._currentDrag={placeholder:null,content:null},this._currentDrag=null,n&&n()},e.views.ListView=e.views.View.inherit({initialize:function(t){var n=this;t=e.extend({onReorder:function(){},virtualRemoveThreshold:-200,virtualAddThreshold:200,canSwipe:function(){return!0}},t),e.extend(n,t),!n.itemHeight&&n.listEl&&(n.itemHeight=n.listEl.children[0]&&parseInt(n.listEl.children[0].style.height,10)),n.onRefresh=t.onRefresh||function(){},n.onRefreshOpening=t.onRefreshOpening||function(){},n.onRefreshHolding=t.onRefreshHolding||function(){};var i={};e.DomUtil.getParentOrSelfWithClass(n.el,"overflow-scroll")&&(i.prevent_default_directions=["left","right"]),window.ionic.onGesture("release",function(e){n._handleEndDrag(e)},n.el,i),window.ionic.onGesture("drag",function(e){n._handleDrag(e)},n.el,i),n._initDrag()},deregister:function(){this.el=this.listEl=this.scrollEl=this.scrollView=null,this.isScrollFreeze&&self.scrollView.freeze(!1)},stopRefreshing:function(){var e=this.el.querySelector(".list-refresher");e.style.height="0"},didScroll:function(e){var t=this;if(t.isVirtual){var n=t.itemHeight,i=e.target.scrollHeight,r=t.el.parentNode.offsetHeight,a=Math.max(0,e.scrollTop+t.virtualRemoveThreshold),o=Math.min(i,Math.abs(e.scrollTop)+r+t.virtualAddThreshold),s=parseInt(Math.abs(a/n),10),l=parseInt(Math.abs(o/n),10);t._virtualItemsToRemove=Array.prototype.slice.call(t.listEl.children,0,s),t.renderViewport&&t.renderViewport(a,o,s,l)}},didStopScrolling:function(){if(this.isVirtual)for(var e=0;e<this._virtualItemsToRemove.length;e++)this.didHideItem&&this.didHideItem(e)},clearDragEffects:function(e){this._lastDragOp&&(this._lastDragOp.clean&&this._lastDragOp.clean(e),this._lastDragOp.deregister&&this._lastDragOp.deregister(),this._lastDragOp=null)},_initDrag:function(){this._lastDragOp&&this._lastDragOp.deregister&&this._lastDragOp.deregister(),this._lastDragOp=this._dragOp,this._dragOp=null},_getItem:function(e){for(;e;){if(e.classList&&e.classList.contains(t))return e;e=e.parentNode}return null},_startDrag:function(t){var n=this;n._isDragging=!1;var i,r=n._lastDragOp;n._didDragUpOrDown&&r instanceof c&&r.clean&&r.clean(),!e.DomUtil.getParentOrSelfWithClass(t.target,s)||"up"!=t.gesture.direction&&"down"!=t.gesture.direction?!n._didDragUpOrDown&&("left"==t.gesture.direction||"right"==t.gesture.direction)&&Math.abs(t.gesture.deltaX)>5&&(i=n._getItem(t.target),i&&i.querySelector(".item-options")&&(n._dragOp=new c({el:n.el,item:i,canSwipe:n.canSwipe}),n._dragOp.start(t),t.preventDefault(),n.isScrollFreeze=n.scrollView.freeze(!0))):(i=n._getItem(t.target),i&&(n._dragOp=new d({listEl:n.el,el:i,scrollEl:n.scrollEl,scrollView:n.scrollView,onReorder:function(e,t,i){n.onReorder&&n.onReorder(e,t,i)}}),n._dragOp.start(t),t.preventDefault())),r&&n._dragOp&&!n._dragOp.isSameItem(r)&&t.defaultPrevented&&r.clean&&r.clean()},_handleEndDrag:function(e){var t=this;t.scrollView&&(t.isScrollFreeze=t.scrollView.freeze(!1)),t._didDragUpOrDown=!1,t._dragOp&&t._dragOp.end(e,function(){t._initDrag()})},_handleDrag:function(e){var t=this;Math.abs(e.gesture.deltaY)>5&&(t._didDragUpOrDown=!0),t.isDragging||t._dragOp||t._startDrag(e),t._dragOp&&(e.gesture.srcEvent.preventDefault(),t._dragOp.drag(e))}})}(ionic),function(e){"use strict";e.views.Modal=e.views.View.inherit({initialize:function(t){t=e.extend({focusFirstInput:!1,unfocusOnHide:!0,focusFirstDelay:600,backdropClickToClose:!0,hardwareBackButtonClose:!0},t),e.extend(this,t),this.el=t.el},show:function(){var e=this;e.focusFirstInput&&window.setTimeout(function(){var t=e.el.querySelector("input, textarea");t&&t.focus&&t.focus()},e.focusFirstDelay)},hide:function(){if(this.unfocusOnHide){var e=this.el.querySelectorAll("input, textarea");window.setTimeout(function(){for(var t=0;t<e.length;t++)e[t].blur&&e[t].blur()})}}})}(ionic),function(e){"use strict";e.views.SideMenu=e.views.View.inherit({initialize:function(e){this.el=e.el,this.isEnabled="undefined"==typeof e.isEnabled?!0:e.isEnabled,this.setWidth(e.width)},getFullWidth:function(){return this.width},setWidth:function(e){this.width=e,this.el.style.width=e+"px"},setIsEnabled:function(e){this.isEnabled=e},bringUp:function(){"0"!==this.el.style.zIndex&&(this.el.style.zIndex="0")},pushDown:function(){"-1"!==this.el.style.zIndex&&(this.el.style.zIndex="-1")}}),e.views.SideMenuContent=e.views.View.inherit({initialize:function(t){e.extend(this,{animationClass:"menu-animated",onDrag:function(){},onEndDrag:function(){}},t),e.onGesture("drag",e.proxy(this._onDrag,this),this.el),e.onGesture("release",e.proxy(this._onEndDrag,this),this.el)},_onDrag:function(e){this.onDrag&&this.onDrag(e)},_onEndDrag:function(e){this.onEndDrag&&this.onEndDrag(e)},disableAnimation:function(){this.el.classList.remove(this.animationClass)},enableAnimation:function(){this.el.classList.add(this.animationClass)},getTranslateX:function(){return parseFloat(this.el.style[e.CSS.TRANSFORM].replace("translate3d(","").split(",")[0])},setTranslateX:e.animationFrameThrottle(function(t){this.el.style[e.CSS.TRANSFORM]="translate3d("+t+"px, 0, 0)"})})}(ionic),function(e){"use strict";e.views.Slider=e.views.View.inherit({initialize:function(e){function t(){if(b.offsetWidth){S=D.children,x=S.length,S.length<2&&(e.continuous=!1),T.transitions&&e.continuous&&S.length<3&&(D.appendChild(S[0].cloneNode(!0)),D.appendChild(D.children[1].cloneNode(!0)),S=D.children),y=new Array(S.length),E=b.offsetWidth||b.getBoundingClientRect().width,D.style.width=S.length*E+"px";for(var t=S.length;t--;){var n=S[t];n.style.width=E+"px",n.setAttribute("data-index",t),T.transitions&&(n.style.left=t*-E+"px",o(t,M>t?-E:t>M?E:0,0))}e.continuous&&T.transitions&&(o(r(M-1),-E,0),o(r(M+1),E,0)),T.transitions||(D.style.left=M*-E+"px"),b.style.visibility="visible",e.slidesChanged&&e.slidesChanged()}}function n(t){e.continuous?a(M-1,t):M&&a(M-1,t)}function i(t){e.continuous?a(M+1,t):M<S.length-1&&a(M+1,t)}function r(e){return(S.length+e%S.length)%S.length}function a(t,n){if(M!=t){if(!S)return void(M=t);if(T.transitions){var i=Math.abs(M-t)/(M-t);if(e.continuous){var a=i;i=-y[r(t)]/E,i!==a&&(t=-i*S.length+t)}for(var s=Math.abs(M-t)-1;s--;)o(r((t>M?t:M)-s-1),E*i,0);t=r(t),o(M,E*i,n||L),o(t,0,n||L),e.continuous&&o(r(t-i),-(E*i),0)}else t=r(t),l(M*-E,t*-E,n||L);M=t,w(e.callback&&e.callback(M,S[M]))}}function o(e,t,n){s(e,t,n),y[e]=t}function s(e,t,n){var i=S[e],r=i&&i.style;r&&(r.webkitTransitionDuration=r.MozTransitionDuration=r.msTransitionDuration=r.OTransitionDuration=r.transitionDuration=n+"ms",r.webkitTransform="translate("+t+"px,0)translateZ(0)",r.msTransform=r.MozTransform=r.OTransform="translateX("+t+"px)")}function l(t,n,i){if(!i)return void(D.style.left=n+"px");var r=+new Date,a=setInterval(function(){var o=+new Date-r;return o>i?(D.style.left=n+"px",I&&c(),e.transitionEnd&&e.transitionEnd.call(event,M,S[M]),void clearInterval(a)):void(D.style.left=(n-t)*(Math.floor(o/i*100)/100)+t+"px")},4)}function c(){C=setTimeout(i,I)}function d(){I=e.auto||0,clearTimeout(C)}var u,p,h,f=this;window.navigator.pointerEnabled?(u="pointerdown",p="pointermove",h="pointerup"):window.navigator.msPointerEnabled?(u="MSPointerDown",p="MSPointerMove",h="MSPointerUp"):(u="touchstart",p="touchmove",h="touchend");var m="mousedown",g="mousemove",v="mouseup",_=function(){},w=function(e){setTimeout(e||_,0)},T={addEventListener:!!window.addEventListener,transitions:function(e){var t=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var n in t)if(void 0!==e.style[t[n]])return!0;return!1}(document.createElement("swipe"))},b=e.el;if(b){var S,y,E,x,D=b.children[0];e=e||{};var M=parseInt(e.startSlide,10)||0,L=e.speed||300;e.continuous=void 0!==e.continuous?e.continuous:!0;var C,P,I=e.auto||0,k={},N={},z={handleEvent:function(n){switch(!n.touches&&n.pageX&&n.pageY&&(n.touches=[{pageX:n.pageX,pageY:n.pageY}]),n.type){case u:this.start(n);break;case m:this.start(n);break;case p:this.touchmove(n);break;case g:this.touchmove(n);break;case h:w(this.end(n));break;case v:w(this.end(n));break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":w(this.transitionEnd(n));break;case"resize":w(t)}e.stopPropagation&&n.stopPropagation()},start:function(e){if(e.touches){var t=e.touches[0];k={x:t.pageX,y:t.pageY,time:+new Date},P=void 0,N={},D.addEventListener(p,this,!1),D.addEventListener(g,this,!1),D.addEventListener(h,this,!1),D.addEventListener(v,this,!1),document.addEventListener(h,this,!1),document.addEventListener(v,this,!1)}},touchmove:function(t){if(!(!t.touches||t.touches.length>1||t.scale&&1!==t.scale||f.slideIsDisabled)){e.disableScroll&&t.preventDefault();var n=t.touches[0];N={x:n.pageX-k.x,y:n.pageY-k.y},"undefined"==typeof P&&(P=!!(P||Math.abs(N.x)<Math.abs(N.y))),P||(t.preventDefault(),d(),e.continuous?(s(r(M-1),N.x+y[r(M-1)],0),s(M,N.x+y[M],0),s(r(M+1),N.x+y[r(M+1)],0)):(e.bouncing?N.x=N.x/(!M&&N.x>0||M==S.length-1&&N.x<0?Math.abs(N.x)/E+1:1):(E*M-N.x<0&&(N.x=Math.min(N.x,E*M)),Math.abs(N.x)>E*(S.length-M-1)&&(N.x=Math.max(-E*(S.length-M-1),N.x))),s(M-1,N.x+y[M-1],0),s(M,N.x+y[M],0),s(M+1,N.x+y[M+1],0)),e.onDrag&&e.onDrag())}},end:function(){var t=+new Date-k.time,n=Number(t)<250&&Math.abs(N.x)>20||Math.abs(N.x)>E/2,i=!M&&N.x>0||M==S.length-1&&N.x<0;e.continuous&&(i=!1);var a=N.x<0;P||(n&&!i?(a?(e.continuous?(o(r(M-1),-E,0),o(r(M+2),E,0)):o(M-1,-E,0),o(M,y[M]-E,L),o(r(M+1),y[r(M+1)]-E,L),M=r(M+1)):(e.continuous?(o(r(M+1),E,0),o(r(M-2),-E,0)):o(M+1,E,0),o(M,y[M]+E,L),o(r(M-1),y[r(M-1)]+E,L),M=r(M-1)),e.callback&&e.callback(M,S[M])):e.continuous?(o(r(M-1),-E,L),o(M,0,L),o(r(M+1),E,L)):(o(M-1,-E,L),o(M,0,L),o(M+1,E,L))),D.removeEventListener(p,z,!1),D.removeEventListener(g,z,!1),D.removeEventListener(h,z,!1),D.removeEventListener(v,z,!1),document.removeEventListener(h,z,!1),document.removeEventListener(v,z,!1),e.onDragEnd&&e.onDragEnd()},transitionEnd:function(t){parseInt(t.target.getAttribute("data-index"),10)==M&&(I&&c(),e.transitionEnd&&e.transitionEnd.call(t,M,S[M]))}};this.update=function(){setTimeout(t)},this.setup=function(){t()},this.loop=function(t){return arguments.length&&(e.continuous=!!t),e.continuous},this.enableSlide=function(e){return arguments.length&&(this.slideIsDisabled=!e),!this.slideIsDisabled},this.slide=this.select=function(e,t){d(),a(e,t)},this.prev=this.previous=function(){d(),n()},this.next=function(){d(),i()},this.stop=function(){d()},this.start=function(){c()},this.autoPlay=function(e){!I||0>I?d():(I=e,c())},this.currentIndex=this.selected=function(){return M},this.slidesCount=this.count=function(){return x},this.kill=function(){d(),D.style.width="",D.style.left="",S&&(S=[]),T.addEventListener?(D.removeEventListener(u,z,!1),D.removeEventListener(m,z,!1),D.removeEventListener("webkitTransitionEnd",z,!1),D.removeEventListener("msTransitionEnd",z,!1),D.removeEventListener("oTransitionEnd",z,!1),D.removeEventListener("otransitionend",z,!1),D.removeEventListener("transitionend",z,!1),window.removeEventListener("resize",z,!1)):window.onresize=null},this.load=function(){t(),I&&c(),T.addEventListener?(D.addEventListener(u,z,!1),D.addEventListener(m,z,!1),T.transitions&&(D.addEventListener("webkitTransitionEnd",z,!1),D.addEventListener("msTransitionEnd",z,!1),D.addEventListener("oTransitionEnd",z,!1),D.addEventListener("otransitionend",z,!1),D.addEventListener("transitionend",z,!1)),window.addEventListener("resize",z,!1)):window.onresize=function(){t()}}}}})}(ionic),function(){"use strict";function e(e){e.fn.swiper=function(t){var i;return e(this).each(function(){var e=new n(this,t);i||(i=e)}),i}}var t,n=function(e,r,a,o){function s(){return"horizontal"===y.params.direction}function l(e){return Math.floor(e)}function c(){y.autoplayTimeoutId=setTimeout(function(){y.params.loop?(y.fixLoop(),y._slideNext()):y.isEnd?r.autoplayStopOnLast?y.stopAutoplay():y._slideTo(0):y._slideNext()},y.params.autoplay)}function d(e,n){var i=t(e.target);if(!i.is(n))if("string"==typeof n)i=i.parents(n);else if(n.nodeType){var r;return i.parents().each(function(e,t){t===n&&(r=n)}),r?n:void 0}return 0===i.length?void 0:i[0]}function u(e,t){t=t||{};var n=window.MutationObserver||window.WebkitMutationObserver,i=new n(function(e){e.forEach(function(e){y.onResize(!0),y.emit("onObserverUpdate",y,e)})});i.observe(e,{attributes:"undefined"==typeof t.attributes?!0:t.attributes,childList:"undefined"==typeof t.childList?!0:t.childList,characterData:"undefined"==typeof t.characterData?!0:t.characterData}),y.observers.push(i)}function p(e){e.originalEvent&&(e=e.originalEvent);var t=e.keyCode||e.charCode;if(!y.params.allowSwipeToNext&&(s()&&39===t||!s()&&40===t))return!1;if(!y.params.allowSwipeToPrev&&(s()&&37===t||!s()&&38===t))return!1;if(!(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||document.activeElement&&document.activeElement.nodeName&&("input"===document.activeElement.nodeName.toLowerCase()||"textarea"===document.activeElement.nodeName.toLowerCase()))){if(37===t||39===t||38===t||40===t){var n=!1;if(y.container.parents(".swiper-slide").length>0&&0===y.container.parents(".swiper-slide-active").length)return;var i={left:window.pageXOffset,top:window.pageYOffset},r=window.innerWidth,a=window.innerHeight,o=y.container.offset();y.rtl&&(o.left=o.left-y.container[0].scrollLeft);for(var l=[[o.left,o.top],[o.left+y.width,o.top],[o.left,o.top+y.height],[o.left+y.width,o.top+y.height]],c=0;c<l.length;c++){var d=l[c];d[0]>=i.left&&d[0]<=i.left+r&&d[1]>=i.top&&d[1]<=i.top+a&&(n=!0)}if(!n)return}s()?((37===t||39===t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1),(39===t&&!y.rtl||37===t&&y.rtl)&&y.slideNext(),(37===t&&!y.rtl||39===t&&y.rtl)&&y.slidePrev()):((38===t||40===t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1),40===t&&y.slideNext(),38===t&&y.slidePrev())}}function h(e){e.originalEvent&&(e=e.originalEvent);var t=y.mousewheel.event,n=0,i=y.rtl?-1:1;if(e.detail)n=-e.detail;else if("mousewheel"===t)if(y.params.mousewheelForceToAxis)if(s()){if(!(Math.abs(e.wheelDeltaX)>Math.abs(e.wheelDeltaY)))return;n=e.wheelDeltaX*i}else{if(!(Math.abs(e.wheelDeltaY)>Math.abs(e.wheelDeltaX)))return;n=e.wheelDeltaY}else n=Math.abs(e.wheelDeltaX)>Math.abs(e.wheelDeltaY)?-e.wheelDeltaX*i:-e.wheelDeltaY;else if("DOMMouseScroll"===t)n=-e.detail;else if("wheel"===t)if(y.params.mousewheelForceToAxis)if(s()){if(!(Math.abs(e.deltaX)>Math.abs(e.deltaY)))return;n=-e.deltaX*i}else{if(!(Math.abs(e.deltaY)>Math.abs(e.deltaX)))return;n=-e.deltaY}else n=Math.abs(e.deltaX)>Math.abs(e.deltaY)?-e.deltaX*i:-e.deltaY;if(0!==n){if(y.params.mousewheelInvert&&(n=-n),y.params.freeMode){var r=y.getWrapperTranslate()+n*y.params.mousewheelSensitivity,a=y.isBeginning,o=y.isEnd;if(r>=y.minTranslate()&&(r=y.minTranslate()),r<=y.maxTranslate()&&(r=y.maxTranslate()),y.setWrapperTransition(0),y.setWrapperTranslate(r),y.updateProgress(),y.updateActiveIndex(),(!a&&y.isBeginning||!o&&y.isEnd)&&y.updateClasses(),y.params.freeModeSticky&&(clearTimeout(y.mousewheel.timeout),y.mousewheel.timeout=setTimeout(function(){y.slideReset()},300)),0===r||r===y.maxTranslate())return}else{if((new window.Date).getTime()-y.mousewheel.lastScrollTime>60)if(0>n)if(y.isEnd&&!y.params.loop||y.animating){if(y.params.mousewheelReleaseOnEdges)return!0}else y.slideNext();else if(y.isBeginning&&!y.params.loop||y.animating){if(y.params.mousewheelReleaseOnEdges)return!0}else y.slidePrev();y.mousewheel.lastScrollTime=(new window.Date).getTime()}return y.params.autoplay&&y.stopAutoplay(),e.preventDefault?e.preventDefault():e.returnValue=!1,!1}}function f(e,n){e=t(e);var i,r,a,o=y.rtl?-1:1;i=e.attr("data-swiper-parallax")||"0",r=e.attr("data-swiper-parallax-x"),
a=e.attr("data-swiper-parallax-y"),r||a?(r=r||"0",a=a||"0"):s()?(r=i,a="0"):(a=i,r="0"),r=r.indexOf("%")>=0?parseInt(r,10)*n*o+"%":r*n*o+"px",a=a.indexOf("%")>=0?parseInt(a,10)*n+"%":a*n+"px",e.transform("translate3d("+r+", "+a+",0px)")}function m(e){return 0!==e.indexOf("on")&&(e=e[0]!==e[0].toUpperCase()?"on"+e[0].toUpperCase()+e.substring(1):"on"+e),e}if(!(this instanceof n))return new n(e,r);var g={direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,autoplay:!1,autoplayDisableOnInteraction:!0,iOSEdgeSwipeDetection:!1,iOSEdgeSwipeThreshold:20,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,freeModeSticky:!1,freeModeMinimumVelocity:.02,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",coverflow:{rotate:50,stretch:0,depth:100,modifier:1,slideShadows:!0},cube:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94},fade:{crossFade:!1},parallax:!1,scrollbar:null,scrollbarHide:!0,scrollbarDraggable:!1,scrollbarSnapOnRelease:!1,keyboardControl:!1,mousewheelControl:!1,mousewheelReleaseOnEdges:!1,mousewheelInvert:!1,mousewheelForceToAxis:!1,mousewheelSensitivity:1,hashnav:!1,breakpoints:void 0,spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,centeredSlides:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,onlyExternal:!1,threshold:0,touchMoveStopPropagation:!0,pagination:null,paginationElement:"span",paginationClickable:!1,paginationHide:!1,paginationBulletRender:null,resistance:!0,resistanceRatio:.85,nextButton:null,prevButton:null,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,lazyLoading:!1,lazyLoadingInPrevNext:!1,lazyLoadingOnTransitionStart:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,control:void 0,controlInverse:!1,controlBy:"slide",allowSwipeToPrev:!0,allowSwipeToNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",slideClass:"swiper-slide",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",bulletClass:"swiper-pagination-bullet",bulletActiveClass:"swiper-pagination-bullet-active",buttonDisabledClass:"swiper-button-disabled",paginationHiddenClass:"swiper-pagination-hidden",observer:!1,observeParents:!1,a11y:!1,prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}",runCallbacksOnInit:!0},v=r&&r.virtualTranslate;r=r||{};var _={};for(var w in r)if("object"!=typeof r[w]||(r[w].nodeType||r[w]===window||r[w]===document||"undefined"!=typeof i&&r[w]instanceof i||"undefined"!=typeof jQuery&&r[w]instanceof jQuery))_[w]=r[w];else{_[w]={};for(var T in r[w])_[w][T]=r[w][T]}for(var b in g)if("undefined"==typeof r[b])r[b]=g[b];else if("object"==typeof r[b])for(var S in g[b])"undefined"==typeof r[b][S]&&(r[b][S]=g[b][S]);var y=this;if(y.params=r,y.originalParams=_,y.classNames=[],"undefined"!=typeof t&&"undefined"!=typeof i&&(t=i),("undefined"!=typeof t||(t="undefined"==typeof i?window.Dom7||window.Zepto||window.jQuery:i))&&(y.$=t,y.currentBreakpoint=void 0,y.getActiveBreakpoint=function(){if(!y.params.breakpoints)return!1;var e,t=!1,n=[];for(e in y.params.breakpoints)y.params.breakpoints.hasOwnProperty(e)&&n.push(e);n.sort(function(e,t){return parseInt(e,10)>parseInt(t,10)});for(var i=0;i<n.length;i++)e=n[i],e>=window.innerWidth&&!t&&(t=e);return t||"max"},y.setBreakpoint=function(){var e=y.getActiveBreakpoint();if(e&&y.currentBreakpoint!==e){var t=e in y.params.breakpoints?y.params.breakpoints[e]:y.originalParams;for(var n in t)y.params[n]=t[n];y.currentBreakpoint=e}},y.params.breakpoints&&y.setBreakpoint(),y.container=t(e),0!==y.container.length)){if(y.container.length>1)return void y.container.each(function(){new n(this,r)});y.container[0].swiper=y,y.container.data("swiper",y),y.classNames.push("swiper-container-"+y.params.direction),y.params.freeMode&&y.classNames.push("swiper-container-free-mode"),y.support.flexbox||(y.classNames.push("swiper-container-no-flexbox"),y.params.slidesPerColumn=1),y.params.autoHeight&&y.classNames.push("swiper-container-autoheight"),(y.params.parallax||y.params.watchSlidesVisibility)&&(y.params.watchSlidesProgress=!0),["cube","coverflow"].indexOf(y.params.effect)>=0&&(y.support.transforms3d?(y.params.watchSlidesProgress=!0,y.classNames.push("swiper-container-3d")):y.params.effect="slide"),"slide"!==y.params.effect&&y.classNames.push("swiper-container-"+y.params.effect),"cube"===y.params.effect&&(y.params.resistanceRatio=0,y.params.slidesPerView=1,y.params.slidesPerColumn=1,y.params.slidesPerGroup=1,y.params.centeredSlides=!1,y.params.spaceBetween=0,y.params.virtualTranslate=!0,y.params.setWrapperSize=!1),"fade"===y.params.effect&&(y.params.slidesPerView=1,y.params.slidesPerColumn=1,y.params.slidesPerGroup=1,y.params.watchSlidesProgress=!0,y.params.spaceBetween=0,"undefined"==typeof v&&(y.params.virtualTranslate=!0)),y.params.grabCursor&&y.support.touch&&(y.params.grabCursor=!1),y.wrapper=y.container.children("."+y.params.wrapperClass),y.params.pagination&&(y.paginationContainer=t(y.params.pagination),y.params.paginationClickable&&y.paginationContainer.addClass("swiper-pagination-clickable")),y.rtl=s()&&("rtl"===y.container[0].dir.toLowerCase()||"rtl"===y.container.css("direction")),y.rtl&&y.classNames.push("swiper-container-rtl"),y.rtl&&(y.wrongRTL="-webkit-box"===y.wrapper.css("display")),y.params.slidesPerColumn>1&&y.classNames.push("swiper-container-multirow"),y.device.android&&y.classNames.push("swiper-container-android"),y.container.addClass(y.classNames.join(" ")),y.translate=0,y.progress=0,y.velocity=0,y.lockSwipeToNext=function(){y.params.allowSwipeToNext=!1},y.lockSwipeToPrev=function(){y.params.allowSwipeToPrev=!1},y.lockSwipes=function(){y.params.allowSwipeToNext=y.params.allowSwipeToPrev=!1},y.unlockSwipeToNext=function(){y.params.allowSwipeToNext=!0},y.unlockSwipeToPrev=function(){y.params.allowSwipeToPrev=!0},y.unlockSwipes=function(){y.params.allowSwipeToNext=y.params.allowSwipeToPrev=!0},y.params.grabCursor&&(y.container[0].style.cursor="move",y.container[0].style.cursor="-webkit-grab",y.container[0].style.cursor="-moz-grab",y.container[0].style.cursor="grab"),y.imagesToLoad=[],y.imagesLoaded=0,y.loadImage=function(e,t,n,i,r){function a(){r&&r()}var o;e.complete&&i?a():t?(o=new window.Image,o.onload=a,o.onerror=a,n&&(o.srcset=n),t&&(o.src=t)):a()},y.preloadImages=function(){function e(){"undefined"!=typeof y&&null!==y&&(void 0!==y.imagesLoaded&&y.imagesLoaded++,y.imagesLoaded===y.imagesToLoad.length&&(y.params.updateOnImagesReady&&y.update(),y.emit("onImagesReady",y)))}y.imagesToLoad=y.container.find("img");for(var t=0;t<y.imagesToLoad.length;t++)y.loadImage(y.imagesToLoad[t],y.imagesToLoad[t].currentSrc||y.imagesToLoad[t].getAttribute("src"),y.imagesToLoad[t].srcset||y.imagesToLoad[t].getAttribute("srcset"),!0,e)},y.autoplayTimeoutId=void 0,y.autoplaying=!1,y.autoplayPaused=!1,y.startAutoplay=function(){return"undefined"!=typeof y.autoplayTimeoutId?!1:y.params.autoplay?y.autoplaying?!1:(y.autoplaying=!0,y.emit("onAutoplayStart",y),void c()):!1},y.stopAutoplay=function(e){y.autoplayTimeoutId&&(y.autoplayTimeoutId&&clearTimeout(y.autoplayTimeoutId),y.autoplaying=!1,y.autoplayTimeoutId=void 0,y.emit("onAutoplayStop",y))},y.pauseAutoplay=function(e){y.autoplayPaused||(y.autoplayTimeoutId&&clearTimeout(y.autoplayTimeoutId),y.autoplayPaused=!0,0===e?(y.autoplayPaused=!1,c()):y.wrapper.transitionEnd(function(){y&&(y.autoplayPaused=!1,y.autoplaying?c():y.stopAutoplay())}))},y.minTranslate=function(){return-y.snapGrid[0]},y.maxTranslate=function(){return-y.snapGrid[y.snapGrid.length-1]},y.updateAutoHeight=function(){var e=y.slides.eq(y.activeIndex)[0].offsetHeight;e&&y.wrapper.css("height",y.slides.eq(y.activeIndex)[0].offsetHeight+"px")},y.updateContainerSize=function(){var e,t;e="undefined"!=typeof y.params.width?y.params.width:y.container[0].clientWidth,t="undefined"!=typeof y.params.height?y.params.height:y.container[0].clientHeight,0===e&&s()||0===t&&!s()||(e=e-parseInt(y.container.css("padding-left"),10)-parseInt(y.container.css("padding-right"),10),t=t-parseInt(y.container.css("padding-top"),10)-parseInt(y.container.css("padding-bottom"),10),y.width=e,y.height=t,y.size=s()?y.width:y.height)},y.updateSlidesSize=function(){y.slides=y.wrapper.children("."+y.params.slideClass),y.snapGrid=[],y.slidesGrid=[],y.slidesSizesGrid=[];var e,t=y.params.spaceBetween,n=-y.params.slidesOffsetBefore,i=0,r=0;"string"==typeof t&&t.indexOf("%")>=0&&(t=parseFloat(t.replace("%",""))/100*y.size),y.virtualSize=-t,y.rtl?y.slides.css({marginLeft:"",marginTop:""}):y.slides.css({marginRight:"",marginBottom:""});var a;y.params.slidesPerColumn>1&&(a=Math.floor(y.slides.length/y.params.slidesPerColumn)===y.slides.length/y.params.slidesPerColumn?y.slides.length:Math.ceil(y.slides.length/y.params.slidesPerColumn)*y.params.slidesPerColumn,"auto"!==y.params.slidesPerView&&"row"===y.params.slidesPerColumnFill&&(a=Math.max(a,y.params.slidesPerView*y.params.slidesPerColumn)));var o,c=y.params.slidesPerColumn,d=a/c,u=d-(y.params.slidesPerColumn*d-y.slides.length);for(e=0;e<y.slides.length;e++){o=0;var p=y.slides.eq(e);if(y.params.slidesPerColumn>1){var h,f,m;"column"===y.params.slidesPerColumnFill?(f=Math.floor(e/c),m=e-f*c,(f>u||f===u&&m===c-1)&&++m>=c&&(m=0,f++),h=f+m*a/c,p.css({"-webkit-box-ordinal-group":h,"-moz-box-ordinal-group":h,"-ms-flex-order":h,"-webkit-order":h,order:h})):(m=Math.floor(e/d),f=e-m*d),p.css({"margin-top":0!==m&&y.params.spaceBetween&&y.params.spaceBetween+"px"}).attr("data-swiper-column",f).attr("data-swiper-row",m)}"none"!==p.css("display")&&("auto"===y.params.slidesPerView?(o=s()?p.outerWidth(!0):p.outerHeight(!0),y.params.roundLengths&&(o=l(o))):(o=(y.size-(y.params.slidesPerView-1)*t)/y.params.slidesPerView,y.params.roundLengths&&(o=l(o)),s()?y.slides[e].style.width=o+"px":y.slides[e].style.height=o+"px"),y.slides[e].swiperSlideSize=o,y.slidesSizesGrid.push(o),y.params.centeredSlides?(n=n+o/2+i/2+t,0===e&&(n=n-y.size/2-t),Math.abs(n)<.001&&(n=0),r%y.params.slidesPerGroup===0&&y.snapGrid.push(n),y.slidesGrid.push(n)):(r%y.params.slidesPerGroup===0&&y.snapGrid.push(n),y.slidesGrid.push(n),n=n+o+t),y.virtualSize+=o+t,i=o,r++)}y.virtualSize=Math.max(y.virtualSize,y.size)+y.params.slidesOffsetAfter;var g;if(y.rtl&&y.wrongRTL&&("slide"===y.params.effect||"coverflow"===y.params.effect)&&y.wrapper.css({width:y.virtualSize+y.params.spaceBetween+"px"}),(!y.support.flexbox||y.params.setWrapperSize)&&(s()?y.wrapper.css({width:y.virtualSize+y.params.spaceBetween+"px"}):y.wrapper.css({height:y.virtualSize+y.params.spaceBetween+"px"})),y.params.slidesPerColumn>1&&(y.virtualSize=(o+y.params.spaceBetween)*a,y.virtualSize=Math.ceil(y.virtualSize/y.params.slidesPerColumn)-y.params.spaceBetween,y.wrapper.css({width:y.virtualSize+y.params.spaceBetween+"px"}),y.params.centeredSlides)){for(g=[],e=0;e<y.snapGrid.length;e++)y.snapGrid[e]<y.virtualSize+y.snapGrid[0]&&g.push(y.snapGrid[e]);y.snapGrid=g}if(!y.params.centeredSlides){for(g=[],e=0;e<y.snapGrid.length;e++)y.snapGrid[e]<=y.virtualSize-y.size&&g.push(y.snapGrid[e]);y.snapGrid=g,Math.floor(y.virtualSize-y.size)>Math.floor(y.snapGrid[y.snapGrid.length-1])&&y.snapGrid.push(y.virtualSize-y.size)}0===y.snapGrid.length&&(y.snapGrid=[0]),0!==y.params.spaceBetween&&(s()?y.rtl?y.slides.css({marginLeft:t+"px"}):y.slides.css({marginRight:t+"px"}):y.slides.css({marginBottom:t+"px"})),y.params.watchSlidesProgress&&y.updateSlidesOffset()},y.updateSlidesOffset=function(){for(var e=0;e<y.slides.length;e++)y.slides[e].swiperSlideOffset=s()?y.slides[e].offsetLeft:y.slides[e].offsetTop},y.updateSlidesProgress=function(e){if("undefined"==typeof e&&(e=y.translate||0),0!==y.slides.length){"undefined"==typeof y.slides[0].swiperSlideOffset&&y.updateSlidesOffset();var t=-e;y.rtl&&(t=e),y.slides.removeClass(y.params.slideVisibleClass);for(var n=0;n<y.slides.length;n++){var i=y.slides[n],r=(t-i.swiperSlideOffset)/(i.swiperSlideSize+y.params.spaceBetween);if(y.params.watchSlidesVisibility){var a=-(t-i.swiperSlideOffset),o=a+y.slidesSizesGrid[n],s=a>=0&&a<y.size||o>0&&o<=y.size||0>=a&&o>=y.size;s&&y.slides.eq(n).addClass(y.params.slideVisibleClass)}i.progress=y.rtl?-r:r}}},y.updateProgress=function(e){"undefined"==typeof e&&(e=y.translate||0);var t=y.maxTranslate()-y.minTranslate(),n=y.isBeginning,i=y.isEnd;0===t?(y.progress=0,y.isBeginning=y.isEnd=!0):(y.progress=(e-y.minTranslate())/t,y.isBeginning=y.progress<=0,y.isEnd=y.progress>=1),y.isBeginning&&!n&&y.emit("onReachBeginning",y),y.isEnd&&!i&&y.emit("onReachEnd",y),y.params.watchSlidesProgress&&y.updateSlidesProgress(e),y.emit("onProgress",y,y.progress)},y.updateActiveIndex=function(){var e,t,n,i=y.rtl?y.translate:-y.translate;for(t=0;t<y.slidesGrid.length;t++)"undefined"!=typeof y.slidesGrid[t+1]?i>=y.slidesGrid[t]&&i<y.slidesGrid[t+1]-(y.slidesGrid[t+1]-y.slidesGrid[t])/2?e=t:i>=y.slidesGrid[t]&&i<y.slidesGrid[t+1]&&(e=t+1):i>=y.slidesGrid[t]&&(e=t);(0>e||"undefined"==typeof e)&&(e=0),n=Math.floor(e/y.params.slidesPerGroup),n>=y.snapGrid.length&&(n=y.snapGrid.length-1),e!==y.activeIndex&&(y.snapIndex=n,y.previousIndex=y.activeIndex,y.activeIndex=e,y.updateClasses())},y.updateClasses=function(){y.slides.removeClass(y.params.slideActiveClass+" "+y.params.slideNextClass+" "+y.params.slidePrevClass);var e=y.slides.eq(y.activeIndex);if(e.addClass(y.params.slideActiveClass),e.next("."+y.params.slideClass).addClass(y.params.slideNextClass),e.prev("."+y.params.slideClass).addClass(y.params.slidePrevClass),y.bullets&&y.bullets.length>0){y.bullets.removeClass(y.params.bulletActiveClass);var n;y.params.loop?(n=Math.ceil(y.activeIndex-y.loopedSlides)/y.params.slidesPerGroup,n>y.slides.length-1-2*y.loopedSlides&&(n-=y.slides.length-2*y.loopedSlides),n>y.bullets.length-1&&(n-=y.bullets.length)):n="undefined"!=typeof y.snapIndex?y.snapIndex:y.activeIndex||0,y.paginationContainer.length>1?y.bullets.each(function(){t(this).index()===n&&t(this).addClass(y.params.bulletActiveClass)}):y.bullets.eq(n).addClass(y.params.bulletActiveClass)}y.params.loop||(y.params.prevButton&&(y.isBeginning?(t(y.params.prevButton).addClass(y.params.buttonDisabledClass),y.params.a11y&&y.a11y&&y.a11y.disable(t(y.params.prevButton))):(t(y.params.prevButton).removeClass(y.params.buttonDisabledClass),y.params.a11y&&y.a11y&&y.a11y.enable(t(y.params.prevButton)))),y.params.nextButton&&(y.isEnd?(t(y.params.nextButton).addClass(y.params.buttonDisabledClass),y.params.a11y&&y.a11y&&y.a11y.disable(t(y.params.nextButton))):(t(y.params.nextButton).removeClass(y.params.buttonDisabledClass),y.params.a11y&&y.a11y&&y.a11y.enable(t(y.params.nextButton)))))},y.updatePagination=function(){if(y.params.pagination&&y.paginationContainer&&y.paginationContainer.length>0){for(var e="",t=y.params.loop?Math.ceil((y.slides.length-2*y.loopedSlides)/y.params.slidesPerGroup):y.snapGrid.length,n=0;t>n;n++)e+=y.params.paginationBulletRender?y.params.paginationBulletRender(n,y.params.bulletClass):"<"+y.params.paginationElement+' class="'+y.params.bulletClass+'"></'+y.params.paginationElement+">";y.paginationContainer.html(e),y.bullets=y.paginationContainer.find("."+y.params.bulletClass),y.params.paginationClickable&&y.params.a11y&&y.a11y&&y.a11y.initPagination()}},y.update=function(e){function t(){i=Math.min(Math.max(y.translate,y.maxTranslate()),y.minTranslate()),y.setWrapperTranslate(i),y.updateActiveIndex(),y.updateClasses()}if(y.updateContainerSize(),y.updateSlidesSize(),y.updateProgress(),y.updatePagination(),y.updateClasses(),y.params.scrollbar&&y.scrollbar&&y.scrollbar.set(),e){var n,i;y.controller&&y.controller.spline&&(y.controller.spline=void 0),y.params.freeMode?(t(),y.params.autoHeight&&y.updateAutoHeight()):(n=("auto"===y.params.slidesPerView||y.params.slidesPerView>1)&&y.isEnd&&!y.params.centeredSlides?y.slideTo(y.slides.length-1,0,!1,!0):y.slideTo(y.activeIndex,0,!1,!0),n||t())}else y.params.autoHeight&&y.updateAutoHeight()},y.onResize=function(e){y.params.breakpoints&&y.setBreakpoint();var t=y.params.allowSwipeToPrev,n=y.params.allowSwipeToNext;if(y.params.allowSwipeToPrev=y.params.allowSwipeToNext=!0,y.updateContainerSize(),y.updateSlidesSize(),("auto"===y.params.slidesPerView||y.params.freeMode||e)&&y.updatePagination(),y.params.scrollbar&&y.scrollbar&&y.scrollbar.set(),y.controller&&y.controller.spline&&(y.controller.spline=void 0),y.params.freeMode){var i=Math.min(Math.max(y.translate,y.maxTranslate()),y.minTranslate());y.setWrapperTranslate(i),y.updateActiveIndex(),y.updateClasses(),y.params.autoHeight&&y.updateAutoHeight()}else y.updateClasses(),("auto"===y.params.slidesPerView||y.params.slidesPerView>1)&&y.isEnd&&!y.params.centeredSlides?y.slideTo(y.slides.length-1,0,!1,!0):y.slideTo(y.activeIndex,0,!1,!0);y.params.allowSwipeToPrev=t,y.params.allowSwipeToNext=n};var E=["mousedown","mousemove","mouseup"];window.navigator.pointerEnabled?E=["pointerdown","pointermove","pointerup"]:window.navigator.msPointerEnabled&&(E=["MSPointerDown","MSPointerMove","MSPointerUp"]),y.touchEvents={start:y.support.touch||!y.params.simulateTouch?"touchstart":E[0],move:y.support.touch||!y.params.simulateTouch?"touchmove":E[1],end:y.support.touch||!y.params.simulateTouch?"touchend":E[2]},(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&("container"===y.params.touchEventsTarget?y.container:y.wrapper).addClass("swiper-wp8-"+y.params.direction),y.initEvents=function(e){var n=e?"off":"on",i=e?"removeEventListener":"addEventListener",a="container"===y.params.touchEventsTarget?y.container[0]:y.wrapper[0],o=y.support.touch?a:document,s=y.params.nested?!0:!1;y.browser.ie?(a[i](y.touchEvents.start,y.onTouchStart,!1),o[i](y.touchEvents.move,y.onTouchMove,s),o[i](y.touchEvents.end,y.onTouchEnd,!1)):(y.support.touch&&(a[i](y.touchEvents.start,y.onTouchStart,!1),a[i](y.touchEvents.move,y.onTouchMove,s),a[i](y.touchEvents.end,y.onTouchEnd,!1)),!r.simulateTouch||y.device.ios||y.device.android||(a[i]("mousedown",y.onTouchStart,!1),document[i]("mousemove",y.onTouchMove,s),document[i]("mouseup",y.onTouchEnd,!1))),window[i]("resize",y.onResize),y.params.nextButton&&(t(y.params.nextButton)[n]("click",y.onClickNext),y.params.a11y&&y.a11y&&t(y.params.nextButton)[n]("keydown",y.a11y.onEnterKey)),y.params.prevButton&&(t(y.params.prevButton)[n]("click",y.onClickPrev),y.params.a11y&&y.a11y&&t(y.params.prevButton)[n]("keydown",y.a11y.onEnterKey)),y.params.pagination&&y.params.paginationClickable&&(t(y.paginationContainer)[n]("click","."+y.params.bulletClass,y.onClickIndex),y.params.a11y&&y.a11y&&t(y.paginationContainer)[n]("keydown","."+y.params.bulletClass,y.a11y.onEnterKey)),(y.params.preventClicks||y.params.preventClicksPropagation)&&a[i]("click",y.preventClicks,!0)},y.attachEvents=function(e){y.initEvents()},y.detachEvents=function(){y.initEvents(!0)},y.allowClick=!0,y.preventClicks=function(e){y.allowClick||(y.params.preventClicks&&e.preventDefault(),y.params.preventClicksPropagation&&y.animating&&(e.stopPropagation(),e.stopImmediatePropagation()))},y.onClickNext=function(e){e.preventDefault(),(!y.isEnd||y.params.loop)&&y.slideNext()},y.onClickPrev=function(e){e.preventDefault(),(!y.isBeginning||y.params.loop)&&y.slidePrev()},y.onClickIndex=function(e){e.preventDefault();var n=t(this).index()*y.params.slidesPerGroup;y.params.loop&&(n+=y.loopedSlides),y.slideTo(n)},y.updateClickedSlide=function(e){var n=d(e,"."+y.params.slideClass),i=!1;if(n)for(var r=0;r<y.slides.length;r++)y.slides[r]===n&&(i=!0);if(!n||!i)return y.clickedSlide=void 0,void(y.clickedIndex=void 0);if(y.clickedSlide=n,y.clickedIndex=t(n).index(),y.params.slideToClickedSlide&&void 0!==y.clickedIndex&&y.clickedIndex!==y.activeIndex){var a,o=y.clickedIndex;if(y.params.loop){if(y.animating)return;a=t(y.clickedSlide).attr("data-swiper-slide-index"),y.params.centeredSlides?o<y.loopedSlides-y.params.slidesPerView/2||o>y.slides.length-y.loopedSlides+y.params.slidesPerView/2?(y.fixLoop(),o=y.wrapper.children("."+y.params.slideClass+'[data-swiper-slide-index="'+a+'"]:not(.swiper-slide-duplicate)').eq(0).index(),setTimeout(function(){y.slideTo(o)},0)):y.slideTo(o):o>y.slides.length-y.params.slidesPerView?(y.fixLoop(),o=y.wrapper.children("."+y.params.slideClass+'[data-swiper-slide-index="'+a+'"]:not(.swiper-slide-duplicate)').eq(0).index(),setTimeout(function(){y.slideTo(o)},0)):y.slideTo(o)}else y.slideTo(o)}};var x,D,M,L,C,P,I,k,N,z,O="input, select, textarea, button",A=Date.now(),G=[];y.animating=!1,y.touches={startX:0,startY:0,currentX:0,currentY:0,diff:0};var V,R;if(y.onTouchStart=function(e){if(e.originalEvent&&(e=e.originalEvent),V="touchstart"===e.type,V||!("which"in e)||3!==e.which){if(y.params.noSwiping&&d(e,"."+y.params.noSwipingClass))return void(y.allowClick=!0);if(!y.params.swipeHandler||d(e,y.params.swipeHandler)){var n=y.touches.currentX="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,i=y.touches.currentY="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY;if(!(y.device.ios&&y.params.iOSEdgeSwipeDetection&&n<=y.params.iOSEdgeSwipeThreshold)){if(x=!0,D=!1,M=!0,C=void 0,R=void 0,y.touches.startX=n,y.touches.startY=i,L=Date.now(),y.allowClick=!0,y.updateContainerSize(),y.swipeDirection=void 0,y.params.threshold>0&&(k=!1),"touchstart"!==e.type){var r=!0;t(e.target).is(O)&&(r=!1),document.activeElement&&t(document.activeElement).is(O)&&document.activeElement.blur(),r&&e.preventDefault()}y.emit("onTouchStart",y,e)}}}},y.onTouchMove=function(e){if(e.originalEvent&&(e=e.originalEvent),!(V&&"mousemove"===e.type||e.preventedByNestedSwiper)){if(y.params.onlyExternal)return y.allowClick=!1,void(x&&(y.touches.startX=y.touches.currentX="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,y.touches.startY=y.touches.currentY="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,L=Date.now()));if(V&&document.activeElement&&e.target===document.activeElement&&t(e.target).is(O))return D=!0,void(y.allowClick=!1);if(M&&y.emit("onTouchMove",y,e),!(e.targetTouches&&e.targetTouches.length>1)){if(y.touches.currentX="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,y.touches.currentY="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,"undefined"==typeof C){var n=180*Math.atan2(Math.abs(y.touches.currentY-y.touches.startY),Math.abs(y.touches.currentX-y.touches.startX))/Math.PI;C=s()?n>y.params.touchAngle:90-n>y.params.touchAngle}if(C&&y.emit("onTouchMoveOpposite",y,e),"undefined"==typeof R&&y.browser.ieTouch&&(y.touches.currentX!==y.touches.startX||y.touches.currentY!==y.touches.startY)&&(R=!0),x){if(C)return void(x=!1);if(R||!y.browser.ieTouch){y.allowClick=!1,y.emit("onSliderMove",y,e),e.preventDefault(),y.params.touchMoveStopPropagation&&!y.params.nested&&e.stopPropagation(),D||(r.loop&&y.fixLoop(),I=y.getWrapperTranslate(),y.setWrapperTransition(0),y.animating&&y.wrapper.trigger("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd"),y.params.autoplay&&y.autoplaying&&(y.params.autoplayDisableOnInteraction?y.stopAutoplay():y.pauseAutoplay()),z=!1,y.params.grabCursor&&(y.container[0].style.cursor="move",y.container[0].style.cursor="-webkit-grabbing",y.container[0].style.cursor="-moz-grabbin",y.container[0].style.cursor="grabbing")),D=!0;var i=y.touches.diff=s()?y.touches.currentX-y.touches.startX:y.touches.currentY-y.touches.startY;i*=y.params.touchRatio,y.rtl&&(i=-i),y.swipeDirection=i>0?"prev":"next",P=i+I;var a=!0;if(i>0&&P>y.minTranslate()?(a=!1,y.params.resistance&&(P=y.minTranslate()-1+Math.pow(-y.minTranslate()+I+i,y.params.resistanceRatio))):0>i&&P<y.maxTranslate()&&(a=!1,y.params.resistance&&(P=y.maxTranslate()+1-Math.pow(y.maxTranslate()-I-i,y.params.resistanceRatio))),a&&(e.preventedByNestedSwiper=!0),!y.params.allowSwipeToNext&&"next"===y.swipeDirection&&I>P&&(P=I),!y.params.allowSwipeToPrev&&"prev"===y.swipeDirection&&P>I&&(P=I),y.params.followFinger){if(y.params.threshold>0){if(!(Math.abs(i)>y.params.threshold||k))return void(P=I);if(!k)return k=!0,y.touches.startX=y.touches.currentX,y.touches.startY=y.touches.currentY,P=I,void(y.touches.diff=s()?y.touches.currentX-y.touches.startX:y.touches.currentY-y.touches.startY)}(y.params.freeMode||y.params.watchSlidesProgress)&&y.updateActiveIndex(),y.params.freeMode&&(0===G.length&&G.push({position:y.touches[s()?"startX":"startY"],time:L}),G.push({position:y.touches[s()?"currentX":"currentY"],time:(new window.Date).getTime()})),y.updateProgress(P),y.setWrapperTranslate(P)}}}}}},y.onTouchEnd=function(e){if(e.originalEvent&&(e=e.originalEvent),M&&y.emit("onTouchEnd",y,e),M=!1,x){y.params.grabCursor&&D&&x&&(y.container[0].style.cursor="move",y.container[0].style.cursor="-webkit-grab",y.container[0].style.cursor="-moz-grab",y.container[0].style.cursor="grab");var n=Date.now(),i=n-L;if(y.allowClick&&(y.updateClickedSlide(e),y.emit("onTap",y,e),300>i&&n-A>300&&(N&&clearTimeout(N),N=setTimeout(function(){y&&(y.params.paginationHide&&y.paginationContainer.length>0&&!t(e.target).hasClass(y.params.bulletClass)&&y.paginationContainer.toggleClass(y.params.paginationHiddenClass),y.emit("onClick",y,e))},300)),300>i&&300>n-A&&(N&&clearTimeout(N),y.emit("onDoubleTap",y,e))),A=Date.now(),setTimeout(function(){y&&(y.allowClick=!0)},0),!x||!D||!y.swipeDirection||0===y.touches.diff||P===I)return void(x=D=!1);x=D=!1;var r;if(r=y.params.followFinger?y.rtl?y.translate:-y.translate:-P,y.params.freeMode){if(r<-y.minTranslate())return void y.slideTo(y.activeIndex);if(r>-y.maxTranslate())return void(y.slides.length<y.snapGrid.length?y.slideTo(y.snapGrid.length-1):y.slideTo(y.slides.length-1));if(y.params.freeModeMomentum){if(G.length>1){var a=G.pop(),o=G.pop(),s=a.position-o.position,l=a.time-o.time;y.velocity=s/l,y.velocity=y.velocity/2,Math.abs(y.velocity)<y.params.freeModeMinimumVelocity&&(y.velocity=0),(l>150||(new window.Date).getTime()-a.time>300)&&(y.velocity=0)}else y.velocity=0;G.length=0;var c=1e3*y.params.freeModeMomentumRatio,d=y.velocity*c,u=y.translate+d;y.rtl&&(u=-u);var p,h=!1,f=20*Math.abs(y.velocity)*y.params.freeModeMomentumBounceRatio;if(u<y.maxTranslate())y.params.freeModeMomentumBounce?(u+y.maxTranslate()<-f&&(u=y.maxTranslate()-f),p=y.maxTranslate(),h=!0,z=!0):u=y.maxTranslate();else if(u>y.minTranslate())y.params.freeModeMomentumBounce?(u-y.minTranslate()>f&&(u=y.minTranslate()+f),p=y.minTranslate(),h=!0,z=!0):u=y.minTranslate();else if(y.params.freeModeSticky){var m,g=0;for(g=0;g<y.snapGrid.length;g+=1)if(y.snapGrid[g]>-u){m=g;break}u=Math.abs(y.snapGrid[m]-u)<Math.abs(y.snapGrid[m-1]-u)||"next"===y.swipeDirection?y.snapGrid[m]:y.snapGrid[m-1],y.rtl||(u=-u)}if(0!==y.velocity)c=y.rtl?Math.abs((-u-y.translate)/y.velocity):Math.abs((u-y.translate)/y.velocity);else if(y.params.freeModeSticky)return void y.slideReset();y.params.freeModeMomentumBounce&&h?(y.updateProgress(p),y.setWrapperTransition(c),y.setWrapperTranslate(u),y.onTransitionStart(),y.animating=!0,y.wrapper.transitionEnd(function(){y&&z&&(y.emit("onMomentumBounce",y),y.setWrapperTransition(y.params.speed),y.setWrapperTranslate(p),y.wrapper.transitionEnd(function(){y&&y.onTransitionEnd()}))})):y.velocity?(y.updateProgress(u),y.setWrapperTransition(c),y.setWrapperTranslate(u),y.onTransitionStart(),y.animating||(y.animating=!0,y.wrapper.transitionEnd(function(){y&&y.onTransitionEnd()}))):y.updateProgress(u),y.updateActiveIndex()}return void((!y.params.freeModeMomentum||i>=y.params.longSwipesMs)&&(y.updateProgress(),y.updateActiveIndex()))}var v,_=0,w=y.slidesSizesGrid[0];for(v=0;v<y.slidesGrid.length;v+=y.params.slidesPerGroup)"undefined"!=typeof y.slidesGrid[v+y.params.slidesPerGroup]?r>=y.slidesGrid[v]&&r<y.slidesGrid[v+y.params.slidesPerGroup]&&(_=v,w=y.slidesGrid[v+y.params.slidesPerGroup]-y.slidesGrid[v]):r>=y.slidesGrid[v]&&(_=v,w=y.slidesGrid[y.slidesGrid.length-1]-y.slidesGrid[y.slidesGrid.length-2]);var T=(r-y.slidesGrid[_])/w;if(i>y.params.longSwipesMs){if(!y.params.longSwipes)return void y.slideTo(y.activeIndex);"next"===y.swipeDirection&&(T>=y.params.longSwipesRatio?y.slideTo(_+y.params.slidesPerGroup):y.slideTo(_)),"prev"===y.swipeDirection&&(T>1-y.params.longSwipesRatio?y.slideTo(_+y.params.slidesPerGroup):y.slideTo(_))}else{if(!y.params.shortSwipes)return void y.slideTo(y.activeIndex);"next"===y.swipeDirection&&y.slideTo(_+y.params.slidesPerGroup),"prev"===y.swipeDirection&&y.slideTo(_)}}},y._slideTo=function(e,t){return y.slideTo(e,t,!0,!0)},y.slideTo=function(e,t,n,i){"undefined"==typeof n&&(n=!0),"undefined"==typeof e&&(e=0),0>e&&(e=0),y.snapIndex=Math.floor(e/y.params.slidesPerGroup),y.snapIndex>=y.snapGrid.length&&(y.snapIndex=y.snapGrid.length-1);var r=-y.snapGrid[y.snapIndex];y.params.autoplay&&y.autoplaying&&(i||!y.params.autoplayDisableOnInteraction?y.pauseAutoplay(t):y.stopAutoplay()),y.updateProgress(r);for(var a=0;a<y.slidesGrid.length;a++)-Math.floor(100*r)>=Math.floor(100*y.slidesGrid[a])&&(e=a);return!y.params.allowSwipeToNext&&r<y.translate&&r<y.minTranslate()?!1:!y.params.allowSwipeToPrev&&r>y.translate&&r>y.maxTranslate()&&(y.activeIndex||0)!==e?!1:("undefined"==typeof t&&(t=y.params.speed),y.previousIndex=y.activeIndex||0,y.activeIndex=e,y.rtl&&-r===y.translate||!y.rtl&&r===y.translate?(y.params.autoHeight&&y.updateAutoHeight(),y.updateClasses(),"slide"!==y.params.effect&&y.setWrapperTranslate(r),!1):(y.updateClasses(),y.onTransitionStart(n),0===t?(y.setWrapperTranslate(r),y.setWrapperTransition(0),y.onTransitionEnd(n)):(y.setWrapperTranslate(r),y.setWrapperTransition(t),y.animating||(y.animating=!0,y.wrapper.transitionEnd(function(){y&&y.onTransitionEnd(n)}))),!0))},y.onTransitionStart=function(e){"undefined"==typeof e&&(e=!0),y.params.autoHeight&&y.updateAutoHeight(),y.lazy&&y.lazy.onTransitionStart(),e&&(y.emit("onTransitionStart",y),y.activeIndex!==y.previousIndex&&(y.emit("onSlideChangeStart",y),a.$emit("$ionicSlides.slideChangeStart",{slider:y,activeIndex:y.getSlideDataIndex(y.activeIndex),previousIndex:y.getSlideDataIndex(y.previousIndex)}),y.activeIndex>y.previousIndex?y.emit("onSlideNextStart",y):y.emit("onSlidePrevStart",y)))},y.onTransitionEnd=function(e){y.animating=!1,y.setWrapperTransition(0),"undefined"==typeof e&&(e=!0),y.lazy&&y.lazy.onTransitionEnd(),e&&(y.emit("onTransitionEnd",y),y.activeIndex!==y.previousIndex&&(y.emit("onSlideChangeEnd",y),a.$emit("$ionicSlides.slideChangeEnd",{slider:y,activeIndex:y.getSlideDataIndex(y.activeIndex),previousIndex:y.getSlideDataIndex(y.previousIndex)}),y.activeIndex>y.previousIndex?y.emit("onSlideNextEnd",y):y.emit("onSlidePrevEnd",y))),y.params.hashnav&&y.hashnav&&y.hashnav.setHash()},y.slideNext=function(e,t,n){if(y.params.loop){if(y.animating)return!1;y.fixLoop();y.container[0].clientLeft;return y.slideTo(y.activeIndex+y.params.slidesPerGroup,t,e,n)}return y.slideTo(y.activeIndex+y.params.slidesPerGroup,t,e,n)},y._slideNext=function(e){return y.slideNext(!0,e,!0)},y.slidePrev=function(e,t,n){if(y.params.loop){if(y.animating)return!1;y.fixLoop();y.container[0].clientLeft;return y.slideTo(y.activeIndex-1,t,e,n)}return y.slideTo(y.activeIndex-1,t,e,n)},y._slidePrev=function(e){return y.slidePrev(!0,e,!0)},y.slideReset=function(e,t,n){return y.slideTo(y.activeIndex,t,e)},y.setWrapperTransition=function(e,t){y.wrapper.transition(e),"slide"!==y.params.effect&&y.effects[y.params.effect]&&y.effects[y.params.effect].setTransition(e),y.params.parallax&&y.parallax&&y.parallax.setTransition(e),y.params.scrollbar&&y.scrollbar&&y.scrollbar.setTransition(e),y.params.control&&y.controller&&y.controller.setTransition(e,t),y.emit("onSetTransition",y,e)},y.setWrapperTranslate=function(e,t,n){var i=0,r=0,a=0;s()?i=y.rtl?-e:e:r=e,y.params.roundLengths&&(i=l(i),
r=l(r)),y.params.virtualTranslate||(y.support.transforms3d?y.wrapper.transform("translate3d("+i+"px, "+r+"px, "+a+"px)"):y.wrapper.transform("translate("+i+"px, "+r+"px)")),y.translate=s()?i:r;var o,c=y.maxTranslate()-y.minTranslate();o=0===c?0:(e-y.minTranslate())/c,o!==y.progress&&y.updateProgress(e),t&&y.updateActiveIndex(),"slide"!==y.params.effect&&y.effects[y.params.effect]&&y.effects[y.params.effect].setTranslate(y.translate),y.params.parallax&&y.parallax&&y.parallax.setTranslate(y.translate),y.params.scrollbar&&y.scrollbar&&y.scrollbar.setTranslate(y.translate),y.params.control&&y.controller&&y.controller.setTranslate(y.translate,n),y.emit("onSetTranslate",y,y.translate)},y.getTranslate=function(e,t){var n,i,r,a;return"undefined"==typeof t&&(t="x"),y.params.virtualTranslate?y.rtl?-y.translate:y.translate:(r=window.getComputedStyle(e,null),window.WebKitCSSMatrix?(i=r.transform||r.webkitTransform,i.split(",").length>6&&(i=i.split(", ").map(function(e){return e.replace(",",".")}).join(", ")),a=new window.WebKitCSSMatrix("none"===i?"":i)):(a=r.MozTransform||r.OTransform||r.MsTransform||r.msTransform||r.transform||r.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),n=a.toString().split(",")),"x"===t&&(i=window.WebKitCSSMatrix?a.m41:16===n.length?parseFloat(n[12]):parseFloat(n[4])),"y"===t&&(i=window.WebKitCSSMatrix?a.m42:16===n.length?parseFloat(n[13]):parseFloat(n[5])),y.rtl&&i&&(i=-i),i||0)},y.getWrapperTranslate=function(e){return"undefined"==typeof e&&(e=s()?"x":"y"),y.getTranslate(y.wrapper[0],e)},y.observers=[],y.initObservers=function(){if(y.params.observeParents)for(var e=y.container.parents(),t=0;t<e.length;t++)u(e[t]);u(y.container[0],{childList:!1}),u(y.wrapper[0],{attributes:!1})},y.disconnectObservers=function(){for(var e=0;e<y.observers.length;e++)y.observers[e].disconnect();y.observers=[]},y.updateLoop=function(){var e=y.slides.eq(y.activeIndex);if(angular.element(e).hasClass(y.params.slideDuplicateClass)){for(var t=angular.element(e).attr("data-swiper-slide-index"),n=y.wrapper.children("."+y.params.slideClass),i=0;i<n.length;i++)if(!angular.element(n[i]).hasClass(y.params.slideDuplicateClass)&&angular.element(n[i]).attr("data-swiper-slide-index")===t){y.slideTo(i,0,!1,!0);break}setTimeout(function(){y.createLoop()},50)}},y.getSlideDataIndex=function(e){var t=y.slides.eq(e),n=angular.element(t).attr("data-swiper-slide-index");return parseInt(n)},y.createLoop=function(){y.wrapper.children("."+y.params.slideClass+"."+y.params.slideDuplicateClass).remove();var e=y.wrapper.children("."+y.params.slideClass);"auto"!==y.params.slidesPerView||y.params.loopedSlides||(y.params.loopedSlides=e.length),y.loopedSlides=parseInt(y.params.loopedSlides||y.params.slidesPerView,10),y.loopedSlides=y.loopedSlides+y.params.loopAdditionalSlides,y.loopedSlides>e.length&&(y.loopedSlides=e.length);var n,i,r,a=[],s=[];for(e.each(function(n,i){var r=t(this);n<y.loopedSlides&&s.push(i),n<e.length&&n>=e.length-y.loopedSlides&&a.push(i),r.attr("data-swiper-slide-index",n)}),n=0;n<s.length;n++)r=angular.element(s[n]).clone().addClass(y.params.slideDuplicateClass),r.removeAttr("ng-transclude"),r.removeAttr("ng-repeat"),i=angular.element(s[n]).scope(),r=o(r)(i),angular.element(y.wrapper).append(r);for(n=a.length-1;n>=0;n--)r=angular.element(a[n]).clone().addClass(y.params.slideDuplicateClass),r.removeAttr("ng-transclude"),r.removeAttr("ng-repeat"),i=angular.element(a[n]).scope(),r=o(r)(i),angular.element(y.wrapper).prepend(r)},y.destroyLoop=function(){y.wrapper.children("."+y.params.slideClass+"."+y.params.slideDuplicateClass).remove(),y.slides.removeAttr("data-swiper-slide-index")},y.fixLoop=function(){var e;y.activeIndex<y.loopedSlides?(e=y.slides.length-3*y.loopedSlides+y.activeIndex,e+=y.loopedSlides,y.slideTo(e,0,!1,!0)):("auto"===y.params.slidesPerView&&y.activeIndex>=2*y.loopedSlides||y.activeIndex>y.slides.length-2*y.params.slidesPerView)&&(e=-y.slides.length+y.activeIndex+y.loopedSlides,e+=y.loopedSlides,y.slideTo(e,0,!1,!0))},y.appendSlide=function(e){if(y.params.loop&&y.destroyLoop(),"object"==typeof e&&e.length)for(var t=0;t<e.length;t++)e[t]&&y.wrapper.append(e[t]);else y.wrapper.append(e);y.params.loop&&y.createLoop(),y.params.observer&&y.support.observer||y.update(!0)},y.prependSlide=function(e){y.params.loop&&y.destroyLoop();var t=y.activeIndex+1;if("object"==typeof e&&e.length){for(var n=0;n<e.length;n++)e[n]&&y.wrapper.prepend(e[n]);t=y.activeIndex+e.length}else y.wrapper.prepend(e);y.params.loop&&y.createLoop(),y.params.observer&&y.support.observer||y.update(!0),y.slideTo(t,0,!1)},y.removeSlide=function(e){y.params.loop&&(y.destroyLoop(),y.slides=y.wrapper.children("."+y.params.slideClass));var t,n=y.activeIndex;if("object"==typeof e&&e.length){for(var i=0;i<e.length;i++)t=e[i],y.slides[t]&&y.slides.eq(t).remove(),n>t&&n--;n=Math.max(n,0)}else t=e,y.slides[t]&&y.slides.eq(t).remove(),n>t&&n--,n=Math.max(n,0);y.params.loop&&y.createLoop(),y.params.observer&&y.support.observer||y.update(!0),y.params.loop?y.slideTo(n+y.loopedSlides,0,!1):y.slideTo(n,0,!1)},y.removeAllSlides=function(){for(var e=[],t=0;t<y.slides.length;t++)e.push(t);y.removeSlide(e)},y.effects={fade:{setTranslate:function(){for(var e=0;e<y.slides.length;e++){var t=y.slides.eq(e),n=t[0].swiperSlideOffset,i=-n;y.params.virtualTranslate||(i-=y.translate);var r=0;s()||(r=i,i=0);var a=y.params.fade.crossFade?Math.max(1-Math.abs(t[0].progress),0):1+Math.min(Math.max(t[0].progress,-1),0);t.css({opacity:a}).transform("translate3d("+i+"px, "+r+"px, 0px)")}},setTransition:function(e){if(y.slides.transition(e),y.params.virtualTranslate&&0!==e){var t=!1;y.slides.transitionEnd(function(){if(!t&&y){t=!0,y.animating=!1;for(var e=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],n=0;n<e.length;n++)y.wrapper.trigger(e[n])}})}}},cube:{setTranslate:function(){var e,n=0;y.params.cube.shadow&&(s()?(e=y.wrapper.find(".swiper-cube-shadow"),0===e.length&&(e=t('<div class="swiper-cube-shadow"></div>'),y.wrapper.append(e)),e.css({height:y.width+"px"})):(e=y.container.find(".swiper-cube-shadow"),0===e.length&&(e=t('<div class="swiper-cube-shadow"></div>'),y.container.append(e))));for(var i=0;i<y.slides.length;i++){var r=y.slides.eq(i),a=90*i,o=Math.floor(a/360);y.rtl&&(a=-a,o=Math.floor(-a/360));var l=Math.max(Math.min(r[0].progress,1),-1),c=0,d=0,u=0;i%4===0?(c=4*-o*y.size,u=0):(i-1)%4===0?(c=0,u=4*-o*y.size):(i-2)%4===0?(c=y.size+4*o*y.size,u=y.size):(i-3)%4===0&&(c=-y.size,u=3*y.size+4*y.size*o),y.rtl&&(c=-c),s()||(d=c,c=0);var p="rotateX("+(s()?0:-a)+"deg) rotateY("+(s()?a:0)+"deg) translate3d("+c+"px, "+d+"px, "+u+"px)";if(1>=l&&l>-1&&(n=90*i+90*l,y.rtl&&(n=90*-i-90*l)),r.transform(p),y.params.cube.slideShadows){var h=s()?r.find(".swiper-slide-shadow-left"):r.find(".swiper-slide-shadow-top"),f=s()?r.find(".swiper-slide-shadow-right"):r.find(".swiper-slide-shadow-bottom");0===h.length&&(h=t('<div class="swiper-slide-shadow-'+(s()?"left":"top")+'"></div>'),r.append(h)),0===f.length&&(f=t('<div class="swiper-slide-shadow-'+(s()?"right":"bottom")+'"></div>'),r.append(f));r[0].progress;h.length&&(h[0].style.opacity=-r[0].progress),f.length&&(f[0].style.opacity=r[0].progress)}}if(y.wrapper.css({"-webkit-transform-origin":"50% 50% -"+y.size/2+"px","-moz-transform-origin":"50% 50% -"+y.size/2+"px","-ms-transform-origin":"50% 50% -"+y.size/2+"px","transform-origin":"50% 50% -"+y.size/2+"px"}),y.params.cube.shadow)if(s())e.transform("translate3d(0px, "+(y.width/2+y.params.cube.shadowOffset)+"px, "+-y.width/2+"px) rotateX(90deg) rotateZ(0deg) scale("+y.params.cube.shadowScale+")");else{var m=Math.abs(n)-90*Math.floor(Math.abs(n)/90),g=1.5-(Math.sin(2*m*Math.PI/360)/2+Math.cos(2*m*Math.PI/360)/2),v=y.params.cube.shadowScale,_=y.params.cube.shadowScale/g,w=y.params.cube.shadowOffset;e.transform("scale3d("+v+", 1, "+_+") translate3d(0px, "+(y.height/2+w)+"px, "+-y.height/2/_+"px) rotateX(-90deg)")}var T=y.isSafari||y.isUiWebView?-y.size/2:0;y.wrapper.transform("translate3d(0px,0,"+T+"px) rotateX("+(s()?0:n)+"deg) rotateY("+(s()?-n:0)+"deg)")},setTransition:function(e){y.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),y.params.cube.shadow&&!s()&&y.container.find(".swiper-cube-shadow").transition(e)}},coverflow:{setTranslate:function(){for(var e=y.translate,n=s()?-e+y.width/2:-e+y.height/2,i=s()?y.params.coverflow.rotate:-y.params.coverflow.rotate,r=y.params.coverflow.depth,a=0,o=y.slides.length;o>a;a++){var l=y.slides.eq(a),c=y.slidesSizesGrid[a],d=l[0].swiperSlideOffset,u=(n-d-c/2)/c*y.params.coverflow.modifier,p=s()?i*u:0,h=s()?0:i*u,f=-r*Math.abs(u),m=s()?0:y.params.coverflow.stretch*u,g=s()?y.params.coverflow.stretch*u:0;Math.abs(g)<.001&&(g=0),Math.abs(m)<.001&&(m=0),Math.abs(f)<.001&&(f=0),Math.abs(p)<.001&&(p=0),Math.abs(h)<.001&&(h=0);var v="translate3d("+g+"px,"+m+"px,"+f+"px)  rotateX("+h+"deg) rotateY("+p+"deg)";if(l.transform(v),l[0].style.zIndex=-Math.abs(Math.round(u))+1,y.params.coverflow.slideShadows){var _=s()?l.find(".swiper-slide-shadow-left"):l.find(".swiper-slide-shadow-top"),w=s()?l.find(".swiper-slide-shadow-right"):l.find(".swiper-slide-shadow-bottom");0===_.length&&(_=t('<div class="swiper-slide-shadow-'+(s()?"left":"top")+'"></div>'),l.append(_)),0===w.length&&(w=t('<div class="swiper-slide-shadow-'+(s()?"right":"bottom")+'"></div>'),l.append(w)),_.length&&(_[0].style.opacity=u>0?u:0),w.length&&(w[0].style.opacity=-u>0?-u:0)}}if(y.browser.ie){var T=y.wrapper[0].style;T.perspectiveOrigin=n+"px 50%"}},setTransition:function(e){y.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}}},y.lazy={initialImageLoaded:!1,loadImageInSlide:function(e,n){if("undefined"!=typeof e&&("undefined"==typeof n&&(n=!0),0!==y.slides.length)){var i=y.slides.eq(e),r=i.find(".swiper-lazy:not(.swiper-lazy-loaded):not(.swiper-lazy-loading)");!i.hasClass("swiper-lazy")||i.hasClass("swiper-lazy-loaded")||i.hasClass("swiper-lazy-loading")||(r=r.add(i[0])),0!==r.length&&r.each(function(){var e=t(this);e.addClass("swiper-lazy-loading");var r=e.attr("data-background"),a=e.attr("data-src"),o=e.attr("data-srcset");y.loadImage(e[0],a||r,o,!1,function(){if(r?(e.css("background-image","url("+r+")"),e.removeAttr("data-background")):(o&&(e.attr("srcset",o),e.removeAttr("data-srcset")),a&&(e.attr("src",a),e.removeAttr("data-src"))),e.addClass("swiper-lazy-loaded").removeClass("swiper-lazy-loading"),i.find(".swiper-lazy-preloader, .preloader").remove(),y.params.loop&&n){var t=i.attr("data-swiper-slide-index");if(i.hasClass(y.params.slideDuplicateClass)){var s=y.wrapper.children('[data-swiper-slide-index="'+t+'"]:not(.'+y.params.slideDuplicateClass+")");y.lazy.loadImageInSlide(s.index(),!1)}else{var l=y.wrapper.children("."+y.params.slideDuplicateClass+'[data-swiper-slide-index="'+t+'"]');y.lazy.loadImageInSlide(l.index(),!1)}}y.emit("onLazyImageReady",y,i[0],e[0])}),y.emit("onLazyImageLoad",y,i[0],e[0])})}},load:function(){var e;if(y.params.watchSlidesVisibility)y.wrapper.children("."+y.params.slideVisibleClass).each(function(){y.lazy.loadImageInSlide(t(this).index())});else if(y.params.slidesPerView>1)for(e=y.activeIndex;e<y.activeIndex+y.params.slidesPerView;e++)y.slides[e]&&y.lazy.loadImageInSlide(e);else y.lazy.loadImageInSlide(y.activeIndex);if(y.params.lazyLoadingInPrevNext)if(y.params.slidesPerView>1){for(e=y.activeIndex+y.params.slidesPerView;e<y.activeIndex+y.params.slidesPerView+y.params.slidesPerView;e++)y.slides[e]&&y.lazy.loadImageInSlide(e);for(e=y.activeIndex-y.params.slidesPerView;e<y.activeIndex;e++)y.slides[e]&&y.lazy.loadImageInSlide(e)}else{var n=y.wrapper.children("."+y.params.slideNextClass);n.length>0&&y.lazy.loadImageInSlide(n.index());var i=y.wrapper.children("."+y.params.slidePrevClass);i.length>0&&y.lazy.loadImageInSlide(i.index())}},onTransitionStart:function(){y.params.lazyLoading&&(y.params.lazyLoadingOnTransitionStart||!y.params.lazyLoadingOnTransitionStart&&!y.lazy.initialImageLoaded)&&y.lazy.load()},onTransitionEnd:function(){y.params.lazyLoading&&!y.params.lazyLoadingOnTransitionStart&&y.lazy.load()}},y.scrollbar={isTouched:!1,setDragPosition:function(e){var t=y.scrollbar,n=s()?"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageX:e.pageX||e.clientX:"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageY:e.pageY||e.clientY,i=n-t.track.offset()[s()?"left":"top"]-t.dragSize/2,r=-y.minTranslate()*t.moveDivider,a=-y.maxTranslate()*t.moveDivider;r>i?i=r:i>a&&(i=a),i=-i/t.moveDivider,y.updateProgress(i),y.setWrapperTranslate(i,!0)},dragStart:function(e){var t=y.scrollbar;t.isTouched=!0,e.preventDefault(),e.stopPropagation(),t.setDragPosition(e),clearTimeout(t.dragTimeout),t.track.transition(0),y.params.scrollbarHide&&t.track.css("opacity",1),y.wrapper.transition(100),t.drag.transition(100),y.emit("onScrollbarDragStart",y)},dragMove:function(e){var t=y.scrollbar;t.isTouched&&(e.preventDefault?e.preventDefault():e.returnValue=!1,t.setDragPosition(e),y.wrapper.transition(0),t.track.transition(0),t.drag.transition(0),y.emit("onScrollbarDragMove",y))},dragEnd:function(e){var t=y.scrollbar;t.isTouched&&(t.isTouched=!1,y.params.scrollbarHide&&(clearTimeout(t.dragTimeout),t.dragTimeout=setTimeout(function(){t.track.css("opacity",0),t.track.transition(400)},1e3)),y.emit("onScrollbarDragEnd",y),y.params.scrollbarSnapOnRelease&&y.slideReset())},enableDraggable:function(){var e=y.scrollbar,n=y.support.touch?e.track:document;t(e.track).on(y.touchEvents.start,e.dragStart),t(n).on(y.touchEvents.move,e.dragMove),t(n).on(y.touchEvents.end,e.dragEnd)},disableDraggable:function(){var e=y.scrollbar,n=y.support.touch?e.track:document;t(e.track).off(y.touchEvents.start,e.dragStart),t(n).off(y.touchEvents.move,e.dragMove),t(n).off(y.touchEvents.end,e.dragEnd)},set:function(){if(y.params.scrollbar){var e=y.scrollbar;e.track=t(y.params.scrollbar),e.drag=e.track.find(".swiper-scrollbar-drag"),0===e.drag.length&&(e.drag=t('<div class="swiper-scrollbar-drag"></div>'),e.track.append(e.drag)),e.drag[0].style.width="",e.drag[0].style.height="",e.trackSize=s()?e.track[0].offsetWidth:e.track[0].offsetHeight,e.divider=y.size/y.virtualSize,e.moveDivider=e.divider*(e.trackSize/y.size),e.dragSize=e.trackSize*e.divider,s()?e.drag[0].style.width=e.dragSize+"px":e.drag[0].style.height=e.dragSize+"px",e.divider>=1?e.track[0].style.display="none":e.track[0].style.display="",y.params.scrollbarHide&&(e.track[0].style.opacity=0)}},setTranslate:function(){if(y.params.scrollbar){var e,t=y.scrollbar,n=(y.translate||0,t.dragSize);e=(t.trackSize-t.dragSize)*y.progress,y.rtl&&s()?(e=-e,e>0?(n=t.dragSize-e,e=0):-e+t.dragSize>t.trackSize&&(n=t.trackSize+e)):0>e?(n=t.dragSize+e,e=0):e+t.dragSize>t.trackSize&&(n=t.trackSize-e),s()?(y.support.transforms3d?t.drag.transform("translate3d("+e+"px, 0, 0)"):t.drag.transform("translateX("+e+"px)"),t.drag[0].style.width=n+"px"):(y.support.transforms3d?t.drag.transform("translate3d(0px, "+e+"px, 0)"):t.drag.transform("translateY("+e+"px)"),t.drag[0].style.height=n+"px"),y.params.scrollbarHide&&(clearTimeout(t.timeout),t.track[0].style.opacity=1,t.timeout=setTimeout(function(){t.track[0].style.opacity=0,t.track.transition(400)},1e3))}},setTransition:function(e){y.params.scrollbar&&y.scrollbar.drag.transition(e)}},y.controller={LinearSpline:function(e,t){this.x=e,this.y=t,this.lastIndex=e.length-1;var n,i;this.x.length;this.interpolate=function(e){return e?(i=r(this.x,e),n=i-1,(e-this.x[n])*(this.y[i]-this.y[n])/(this.x[i]-this.x[n])+this.y[n]):0};var r=function(){var e,t,n;return function(i,r){for(t=-1,e=i.length;e-t>1;)i[n=e+t>>1]<=r?t=n:e=n;return e}}()},getInterpolateFunction:function(e){y.controller.spline||(y.controller.spline=y.params.loop?new y.controller.LinearSpline(y.slidesGrid,e.slidesGrid):new y.controller.LinearSpline(y.snapGrid,e.snapGrid))},setTranslate:function(e,t){function i(t){e=t.rtl&&"horizontal"===t.params.direction?-y.translate:y.translate,"slide"===y.params.controlBy&&(y.controller.getInterpolateFunction(t),a=-y.controller.spline.interpolate(-e)),a&&"container"!==y.params.controlBy||(r=(t.maxTranslate()-t.minTranslate())/(y.maxTranslate()-y.minTranslate()),a=(e-y.minTranslate())*r+t.minTranslate()),y.params.controlInverse&&(a=t.maxTranslate()-a),t.updateProgress(a),t.setWrapperTranslate(a,!1,y),t.updateActiveIndex()}var r,a,o=y.params.control;if(y.isArray(o))for(var s=0;s<o.length;s++)o[s]!==t&&o[s]instanceof n&&i(o[s]);else o instanceof n&&t!==o&&i(o)},setTransition:function(e,t){function i(t){t.setWrapperTransition(e,y),0!==e&&(t.onTransitionStart(),t.wrapper.transitionEnd(function(){a&&(t.params.loop&&"slide"===y.params.controlBy&&t.fixLoop(),t.onTransitionEnd())}))}var r,a=y.params.control;if(y.isArray(a))for(r=0;r<a.length;r++)a[r]!==t&&a[r]instanceof n&&i(a[r]);else a instanceof n&&t!==a&&i(a)}},y.hashnav={init:function(){if(y.params.hashnav){y.hashnav.initialized=!0;var e=document.location.hash.replace("#","");if(e)for(var t=0,n=0,i=y.slides.length;i>n;n++){var r=y.slides.eq(n),a=r.attr("data-hash");if(a===e&&!r.hasClass(y.params.slideDuplicateClass)){var o=r.index();y.slideTo(o,t,y.params.runCallbacksOnInit,!0)}}}},setHash:function(){y.hashnav.initialized&&y.params.hashnav&&(document.location.hash=y.slides.eq(y.activeIndex).attr("data-hash")||"")}},y.disableKeyboardControl=function(){y.params.keyboardControl=!1,t(document).off("keydown",p)},y.enableKeyboardControl=function(){y.params.keyboardControl=!0,t(document).on("keydown",p)},y.mousewheel={event:!1,lastScrollTime:(new window.Date).getTime()},y.params.mousewheelControl){try{new window.WheelEvent("wheel"),y.mousewheel.event="wheel"}catch(H){}y.mousewheel.event||void 0===document.onmousewheel||(y.mousewheel.event="mousewheel"),y.mousewheel.event||(y.mousewheel.event="DOMMouseScroll")}y.disableMousewheelControl=function(){return y.mousewheel.event?(y.container.off(y.mousewheel.event,h),!0):!1},y.enableMousewheelControl=function(){return y.mousewheel.event?(y.container.on(y.mousewheel.event,h),!0):!1},y.parallax={setTranslate:function(){y.container.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){f(this,y.progress)}),y.slides.each(function(){var e=t(this);e.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){var t=Math.min(Math.max(e[0].progress,-1),1);f(this,t)})})},setTransition:function(e){"undefined"==typeof e&&(e=y.params.speed),y.container.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){var n=t(this),i=parseInt(n.attr("data-swiper-parallax-duration"),10)||e;0===e&&(i=0),n.transition(i)})}},y._plugins=[];for(var Y in y.plugins){var X=y.plugins[Y](y,y.params[Y]);X&&y._plugins.push(X)}return y.callPlugins=function(e){for(var t=0;t<y._plugins.length;t++)e in y._plugins[t]&&y._plugins[t][e](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},y.emitterEventListeners={},y.emit=function(e){y.params[e]&&y.params[e](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);var t;if(y.emitterEventListeners[e])for(t=0;t<y.emitterEventListeners[e].length;t++)y.emitterEventListeners[e][t](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);y.callPlugins&&y.callPlugins(e,arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},y.on=function(e,t){return e=m(e),y.emitterEventListeners[e]||(y.emitterEventListeners[e]=[]),y.emitterEventListeners[e].push(t),y},y.off=function(e,t){var n;if(e=m(e),"undefined"==typeof t)return y.emitterEventListeners[e]=[],y;if(y.emitterEventListeners[e]&&0!==y.emitterEventListeners[e].length){for(n=0;n<y.emitterEventListeners[e].length;n++)y.emitterEventListeners[e][n]===t&&y.emitterEventListeners[e].splice(n,1);return y}},y.once=function(e,t){e=m(e);var n=function(){t(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]),y.off(e,n)};return y.on(e,n),y},y.a11y={makeFocusable:function(e){return e.attr("tabIndex","0"),e},addRole:function(e,t){return e.attr("role",t),e},addLabel:function(e,t){return e.attr("aria-label",t),e},disable:function(e){return e.attr("aria-disabled",!0),e},enable:function(e){return e.attr("aria-disabled",!1),e},onEnterKey:function(e){13===e.keyCode&&(t(e.target).is(y.params.nextButton)?(y.onClickNext(e),y.isEnd?y.a11y.notify(y.params.lastSlideMessage):y.a11y.notify(y.params.nextSlideMessage)):t(e.target).is(y.params.prevButton)&&(y.onClickPrev(e),y.isBeginning?y.a11y.notify(y.params.firstSlideMessage):y.a11y.notify(y.params.prevSlideMessage)),t(e.target).is("."+y.params.bulletClass)&&t(e.target)[0].click())},liveRegion:t('<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span>'),notify:function(e){var t=y.a11y.liveRegion;0!==t.length&&(t.html(""),t.html(e))},init:function(){if(y.params.nextButton){var e=t(y.params.nextButton);y.a11y.makeFocusable(e),y.a11y.addRole(e,"button"),y.a11y.addLabel(e,y.params.nextSlideMessage)}if(y.params.prevButton){var n=t(y.params.prevButton);y.a11y.makeFocusable(n),y.a11y.addRole(n,"button"),y.a11y.addLabel(n,y.params.prevSlideMessage)}t(y.container).append(y.a11y.liveRegion)},initPagination:function(){y.params.pagination&&y.params.paginationClickable&&y.bullets&&y.bullets.length&&y.bullets.each(function(){var e=t(this);y.a11y.makeFocusable(e),y.a11y.addRole(e,"button"),y.a11y.addLabel(e,y.params.paginationBulletMessage.replace(/{{index}}/,e.index()+1))})},destroy:function(){y.a11y.liveRegion&&y.a11y.liveRegion.length>0&&y.a11y.liveRegion.remove()}},y.init=function(){y.params.loop&&y.createLoop(),y.updateContainerSize(),y.updateSlidesSize(),y.updatePagination(),y.params.scrollbar&&y.scrollbar&&(y.scrollbar.set(),y.params.scrollbarDraggable&&y.scrollbar.enableDraggable()),"slide"!==y.params.effect&&y.effects[y.params.effect]&&(y.params.loop||y.updateProgress(),y.effects[y.params.effect].setTranslate()),y.params.loop?y.slideTo(y.params.initialSlide+y.loopedSlides,0,y.params.runCallbacksOnInit):(y.slideTo(y.params.initialSlide,0,y.params.runCallbacksOnInit),0===y.params.initialSlide&&(y.parallax&&y.params.parallax&&y.parallax.setTranslate(),y.lazy&&y.params.lazyLoading&&(y.lazy.load(),y.lazy.initialImageLoaded=!0))),y.attachEvents(),y.params.observer&&y.support.observer&&y.initObservers(),y.params.preloadImages&&!y.params.lazyLoading&&y.preloadImages(),y.params.autoplay&&y.startAutoplay(),y.params.keyboardControl&&y.enableKeyboardControl&&y.enableKeyboardControl(),y.params.mousewheelControl&&y.enableMousewheelControl&&y.enableMousewheelControl(),y.params.hashnav&&y.hashnav&&y.hashnav.init(),y.params.a11y&&y.a11y&&y.a11y.init(),y.emit("onInit",y)},y.cleanupStyles=function(){y.container.removeClass(y.classNames.join(" ")).removeAttr("style"),y.wrapper.removeAttr("style"),y.slides&&y.slides.length&&y.slides.removeClass([y.params.slideVisibleClass,y.params.slideActiveClass,y.params.slideNextClass,y.params.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-column").removeAttr("data-swiper-row"),y.paginationContainer&&y.paginationContainer.length&&y.paginationContainer.removeClass(y.params.paginationHiddenClass),y.bullets&&y.bullets.length&&y.bullets.removeClass(y.params.bulletActiveClass),y.params.prevButton&&t(y.params.prevButton).removeClass(y.params.buttonDisabledClass),y.params.nextButton&&t(y.params.nextButton).removeClass(y.params.buttonDisabledClass),y.params.scrollbar&&y.scrollbar&&(y.scrollbar.track&&y.scrollbar.track.length&&y.scrollbar.track.removeAttr("style"),y.scrollbar.drag&&y.scrollbar.drag.length&&y.scrollbar.drag.removeAttr("style"))},y.destroy=function(e,t){y.detachEvents(),y.stopAutoplay(),y.params.scrollbar&&y.scrollbar&&y.params.scrollbarDraggable&&y.scrollbar.disableDraggable(),y.params.loop&&y.destroyLoop(),t&&y.cleanupStyles(),y.disconnectObservers(),y.params.keyboardControl&&y.disableKeyboardControl&&y.disableKeyboardControl(),y.params.mousewheelControl&&y.disableMousewheelControl&&y.disableMousewheelControl(),y.params.a11y&&y.a11y&&y.a11y.destroy(),y.emit("onDestroy"),e!==!1&&(y=null)},y.init(),y}};n.prototype={isSafari:function(){var e=navigator.userAgent.toLowerCase();return e.indexOf("safari")>=0&&e.indexOf("chrome")<0&&e.indexOf("android")<0}(),isUiWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},browser:{ie:window.navigator.pointerEnabled||window.navigator.msPointerEnabled,ieTouch:window.navigator.msPointerEnabled&&window.navigator.msMaxTouchPoints>1||window.navigator.pointerEnabled&&window.navigator.maxTouchPoints>1},device:function(){var e=navigator.userAgent,t=e.match(/(Android);?[\s\/]+([\d.]+)?/),n=e.match(/(iPad).*OS\s([\d_]+)/),i=e.match(/(iPod)(.*OS\s([\d_]+))?/),r=!n&&e.match(/(iPhone\sOS)\s([\d_]+)/);return{ios:n||r||i,android:t}}(),support:{touch:window.Modernizr&&Modernizr.touch===!0||function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}(),transforms3d:window.Modernizr&&Modernizr.csstransforms3d===!0||function(){var e=document.createElement("div").style;return"webkitPerspective"in e||"MozPerspective"in e||"OPerspective"in e||"MsPerspective"in e||"perspective"in e}(),flexbox:function(){for(var e=document.createElement("div").style,t="alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient".split(" "),n=0;n<t.length;n++)if(t[n]in e)return!0}(),observer:function(){return"MutationObserver"in window||"WebkitMutationObserver"in window}()},plugins:{}};for(var i=(function(){var e=function(e){var t=this,n=0;for(n=0;n<e.length;n++)t[n]=e[n];return t.length=e.length,this},t=function(t,n){var i=[],r=0;if(t&&!n&&t instanceof e)return t;if(t)if("string"==typeof t){var a,o,s=t.trim();if(s.indexOf("<")>=0&&s.indexOf(">")>=0){var l="div";for(0===s.indexOf("<li")&&(l="ul"),0===s.indexOf("<tr")&&(l="tbody"),(0===s.indexOf("<td")||0===s.indexOf("<th"))&&(l="tr"),0===s.indexOf("<tbody")&&(l="table"),0===s.indexOf("<option")&&(l="select"),o=document.createElement(l),o.innerHTML=t,r=0;r<o.childNodes.length;r++)i.push(o.childNodes[r])}else for(a=n||"#"!==t[0]||t.match(/[ .<>:~]/)?(n||document).querySelectorAll(t):[document.getElementById(t.split("#")[1])],r=0;r<a.length;r++)a[r]&&i.push(a[r])}else if(t.nodeType||t===window||t===document)i.push(t);else if(t.length>0&&t[0].nodeType)for(r=0;r<t.length;r++)i.push(t[r]);return new e(i)};return e.prototype={addClass:function(e){if("undefined"==typeof e)return this;for(var t=e.split(" "),n=0;n<t.length;n++)for(var i=0;i<this.length;i++)this[i].classList.add(t[n]);return this},removeClass:function(e){for(var t=e.split(" "),n=0;n<t.length;n++)for(var i=0;i<this.length;i++)this[i].classList.remove(t[n]);return this},hasClass:function(e){return this[0]?this[0].classList.contains(e):!1},toggleClass:function(e){for(var t=e.split(" "),n=0;n<t.length;n++)for(var i=0;i<this.length;i++)this[i].classList.toggle(t[n]);return this},attr:function(e,t){if(1===arguments.length&&"string"==typeof e)return this[0]?this[0].getAttribute(e):void 0;for(var n=0;n<this.length;n++)if(2===arguments.length)this[n].setAttribute(e,t);else for(var i in e)this[n][i]=e[i],this[n].setAttribute(i,e[i]);return this},removeAttr:function(e){for(var t=0;t<this.length;t++)this[t].removeAttribute(e);return this},data:function(e,t){if("undefined"==typeof t){if(this[0]){var n=this[0].getAttribute("data-"+e);return n?n:this[0].dom7ElementDataStorage&&e in this[0].dom7ElementDataStorage?this[0].dom7ElementDataStorage[e]:void 0}return void 0}for(var i=0;i<this.length;i++){var r=this[i];r.dom7ElementDataStorage||(r.dom7ElementDataStorage={}),r.dom7ElementDataStorage[e]=t}return this},transform:function(e){for(var t=0;t<this.length;t++){var n=this[t].style;n.webkitTransform=n.MsTransform=n.msTransform=n.MozTransform=n.OTransform=n.transform=e}return this},transition:function(e){"string"!=typeof e&&(e+="ms");for(var t=0;t<this.length;t++){var n=this[t].style;n.webkitTransitionDuration=n.MsTransitionDuration=n.msTransitionDuration=n.MozTransitionDuration=n.OTransitionDuration=n.transitionDuration=e}return this},on:function(e,n,i,r){function a(e){var r=e.target;if(t(r).is(n))i.call(r,e);else for(var a=t(r).parents(),o=0;o<a.length;o++)t(a[o]).is(n)&&i.call(a[o],e)}var o,s,l=e.split(" ");for(o=0;o<this.length;o++)if("function"==typeof n||n===!1)for("function"==typeof n&&(i=arguments[1],r=arguments[2]||!1),s=0;s<l.length;s++)this[o].addEventListener(l[s],i,r);else for(s=0;s<l.length;s++)this[o].dom7LiveListeners||(this[o].dom7LiveListeners=[]),this[o].dom7LiveListeners.push({listener:i,liveListener:a}),this[o].addEventListener(l[s],a,r);return this},off:function(e,t,n,i){for(var r=e.split(" "),a=0;a<r.length;a++)for(var o=0;o<this.length;o++)if("function"==typeof t||t===!1)"function"==typeof t&&(n=arguments[1],i=arguments[2]||!1),this[o].removeEventListener(r[a],n,i);else if(this[o].dom7LiveListeners)for(var s=0;s<this[o].dom7LiveListeners.length;s++)this[o].dom7LiveListeners[s].listener===n&&this[o].removeEventListener(r[a],this[o].dom7LiveListeners[s].liveListener,i);return this},once:function(e,t,n,i){function r(o){n(o),a.off(e,t,r,i)}var a=this;"function"==typeof t&&(t=!1,n=arguments[1],i=arguments[2]),a.on(e,t,r,i)},trigger:function(e,t){for(var n=0;n<this.length;n++){var i;try{i=new window.CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0})}catch(r){i=document.createEvent("Event"),i.initEvent(e,!0,!0),i.detail=t}this[n].dispatchEvent(i)}return this},transitionEnd:function(e){function t(a){if(a.target===this)for(e.call(this,a),n=0;n<i.length;n++)r.off(i[n],t)}var n,i=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],r=this;if(e)for(n=0;n<i.length;n++)r.on(i[n],t);return this},width:function(){return this[0]===window?window.innerWidth:this.length>0?parseFloat(this.css("width")):null},outerWidth:function(e){return this.length>0?e?this[0].offsetWidth+parseFloat(this.css("margin-right"))+parseFloat(this.css("margin-left")):this[0].offsetWidth:null},height:function(){return this[0]===window?window.innerHeight:this.length>0?parseFloat(this.css("height")):null},outerHeight:function(e){return this.length>0?e?this[0].offsetHeight+parseFloat(this.css("margin-top"))+parseFloat(this.css("margin-bottom")):this[0].offsetHeight:null},offset:function(){if(this.length>0){var e=this[0],t=e.getBoundingClientRect(),n=document.body,i=e.clientTop||n.clientTop||0,r=e.clientLeft||n.clientLeft||0,a=window.pageYOffset||e.scrollTop,o=window.pageXOffset||e.scrollLeft;return{top:t.top+a-i,left:t.left+o-r}}return null},css:function(e,t){var n;if(1===arguments.length){if("string"!=typeof e){for(n=0;n<this.length;n++)for(var i in e)this[n].style[i]=e[i];return this}if(this[0])return window.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(n=0;n<this.length;n++)this[n].style[e]=t;return this}return this},each:function(e){for(var t=0;t<this.length;t++)e.call(this[t],t,this[t]);return this},html:function(e){if("undefined"==typeof e)return this[0]?this[0].innerHTML:void 0;for(var t=0;t<this.length;t++)this[t].innerHTML=e;return this},is:function(n){if(!this[0])return!1;var i,r;if("string"==typeof n){var a=this[0];if(a===document)return n===document;if(a===window)return n===window;if(a.matches)return a.matches(n);if(a.webkitMatchesSelector)return a.webkitMatchesSelector(n);if(a.mozMatchesSelector)return a.mozMatchesSelector(n);if(a.msMatchesSelector)return a.msMatchesSelector(n);for(i=t(n),r=0;r<i.length;r++)if(i[r]===this[0])return!0;return!1}if(n===document)return this[0]===document;if(n===window)return this[0]===window;if(n.nodeType||n instanceof e){for(i=n.nodeType?[n]:n,r=0;r<i.length;r++)if(i[r]===this[0])return!0;return!1;
}return!1},index:function(){if(this[0]){for(var e=this[0],t=0;null!==(e=e.previousSibling);)1===e.nodeType&&t++;return t}return void 0},eq:function(t){if("undefined"==typeof t)return this;var n,i=this.length;return t>i-1?new e([]):0>t?(n=i+t,new e(0>n?[]:[this[n]])):new e([this[t]])},append:function(t){var n,i;for(n=0;n<this.length;n++)if("string"==typeof t){var r=document.createElement("div");for(r.innerHTML=t;r.firstChild;)this[n].appendChild(r.firstChild)}else if(t instanceof e)for(i=0;i<t.length;i++)this[n].appendChild(t[i]);else this[n].appendChild(t);return this},prepend:function(t){var n,i;for(n=0;n<this.length;n++)if("string"==typeof t){var r=document.createElement("div");for(r.innerHTML=t,i=r.childNodes.length-1;i>=0;i--)this[n].insertBefore(r.childNodes[i],this[n].childNodes[0])}else if(t instanceof e)for(i=0;i<t.length;i++)this[n].insertBefore(t[i],this[n].childNodes[0]);else this[n].insertBefore(t,this[n].childNodes[0]);return this},insertBefore:function(e){for(var n=t(e),i=0;i<this.length;i++)if(1===n.length)n[0].parentNode.insertBefore(this[i],n[0]);else if(n.length>1)for(var r=0;r<n.length;r++)n[r].parentNode.insertBefore(this[i].cloneNode(!0),n[r])},insertAfter:function(e){for(var n=t(e),i=0;i<this.length;i++)if(1===n.length)n[0].parentNode.insertBefore(this[i],n[0].nextSibling);else if(n.length>1)for(var r=0;r<n.length;r++)n[r].parentNode.insertBefore(this[i].cloneNode(!0),n[r].nextSibling)},next:function(n){return new e(this.length>0?n?this[0].nextElementSibling&&t(this[0].nextElementSibling).is(n)?[this[0].nextElementSibling]:[]:this[0].nextElementSibling?[this[0].nextElementSibling]:[]:[])},nextAll:function(n){var i=[],r=this[0];if(!r)return new e([]);for(;r.nextElementSibling;){var a=r.nextElementSibling;n?t(a).is(n)&&i.push(a):i.push(a),r=a}return new e(i)},prev:function(n){return new e(this.length>0?n?this[0].previousElementSibling&&t(this[0].previousElementSibling).is(n)?[this[0].previousElementSibling]:[]:this[0].previousElementSibling?[this[0].previousElementSibling]:[]:[])},prevAll:function(n){var i=[],r=this[0];if(!r)return new e([]);for(;r.previousElementSibling;){var a=r.previousElementSibling;n?t(a).is(n)&&i.push(a):i.push(a),r=a}return new e(i)},parent:function(e){for(var n=[],i=0;i<this.length;i++)e?t(this[i].parentNode).is(e)&&n.push(this[i].parentNode):n.push(this[i].parentNode);return t(t.unique(n))},parents:function(e){for(var n=[],i=0;i<this.length;i++)for(var r=this[i].parentNode;r;)e?t(r).is(e)&&n.push(r):n.push(r),r=r.parentNode;return t(t.unique(n))},find:function(t){for(var n=[],i=0;i<this.length;i++)for(var r=this[i].querySelectorAll(t),a=0;a<r.length;a++)n.push(r[a]);return new e(n)},children:function(n){for(var i=[],r=0;r<this.length;r++)for(var a=this[r].childNodes,o=0;o<a.length;o++)n?1===a[o].nodeType&&t(a[o]).is(n)&&i.push(a[o]):1===a[o].nodeType&&i.push(a[o]);return new e(t.unique(i))},remove:function(){for(var e=0;e<this.length;e++)this[e].parentNode&&this[e].parentNode.removeChild(this[e]);return this},add:function(){var e,n,i=this;for(e=0;e<arguments.length;e++){var r=t(arguments[e]);for(n=0;n<r.length;n++)i[i.length]=r[n],i.length++}return i}},t.fn=e.prototype,t.unique=function(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t},t}()),r=["jQuery","Zepto","Dom7"],a=0;a<r.length;a++)window[r[a]]&&e(window[r[a]]);var o;o="undefined"==typeof i?window.Dom7||window.Zepto||window.jQuery:i,o&&("transitionEnd"in o.fn||(o.fn.transitionEnd=function(e){function t(a){if(a.target===this)for(e.call(this,a),n=0;n<i.length;n++)r.off(i[n],t)}var n,i=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],r=this;if(e)for(n=0;n<i.length;n++)r.on(i[n],t);return this}),"transform"in o.fn||(o.fn.transform=function(e){for(var t=0;t<this.length;t++){var n=this[t].style;n.webkitTransform=n.MsTransform=n.msTransform=n.MozTransform=n.OTransform=n.transform=e}return this}),"transition"in o.fn||(o.fn.transition=function(e){"string"!=typeof e&&(e+="ms");for(var t=0;t<this.length;t++){var n=this[t].style;n.webkitTransitionDuration=n.MsTransitionDuration=n.msTransitionDuration=n.MozTransitionDuration=n.OTransitionDuration=n.transitionDuration=e}return this})),ionic.views.Swiper=n}(),function(e){"use strict";e.views.Toggle=e.views.View.inherit({initialize:function(t){var n=this;this.el=t.el,this.checkbox=t.checkbox,this.track=t.track,this.handle=t.handle,this.openPercent=-1,this.onChange=t.onChange||function(){},this.triggerThreshold=t.triggerThreshold||20,this.dragStartHandler=function(e){n.dragStart(e)},this.dragHandler=function(e){n.drag(e)},this.holdHandler=function(e){n.hold(e)},this.releaseHandler=function(e){n.release(e)},this.dragStartGesture=e.onGesture("dragstart",this.dragStartHandler,this.el),this.dragGesture=e.onGesture("drag",this.dragHandler,this.el),this.dragHoldGesture=e.onGesture("hold",this.holdHandler,this.el),this.dragReleaseGesture=e.onGesture("release",this.releaseHandler,this.el)},destroy:function(){e.offGesture(this.dragStartGesture,"dragstart",this.dragStartGesture),e.offGesture(this.dragGesture,"drag",this.dragGesture),e.offGesture(this.dragHoldGesture,"hold",this.holdHandler),e.offGesture(this.dragReleaseGesture,"release",this.releaseHandler)},tap:function(){"disabled"!==this.el.getAttribute("disabled")&&this.val(!this.checkbox.checked)},dragStart:function(e){this.checkbox.disabled||(this._dragInfo={width:this.el.offsetWidth,left:this.el.offsetLeft,right:this.el.offsetLeft+this.el.offsetWidth,triggerX:this.el.offsetWidth/2,initialState:this.checkbox.checked},e.gesture.srcEvent.preventDefault(),this.hold(e))},drag:function(t){var n=this;this._dragInfo&&(t.gesture.srcEvent.preventDefault(),e.requestAnimationFrame(function(){if(n._dragInfo){var e=t.gesture.touches[0].pageX-n._dragInfo.left,i=n._dragInfo.width-n.triggerThreshold;n._dragInfo.initialState?e<n.triggerThreshold?n.setOpenPercent(0):e>n._dragInfo.triggerX&&n.setOpenPercent(100):e<n._dragInfo.triggerX?n.setOpenPercent(0):e>i&&n.setOpenPercent(100)}}))},endDrag:function(){this._dragInfo=null},hold:function(){this.el.classList.add("dragging")},release:function(e){this.el.classList.remove("dragging"),this.endDrag(e)},setOpenPercent:function(t){if(this.openPercent<0||t<this.openPercent-3||t>this.openPercent+3)if(this.openPercent=t,0===t)this.val(!1);else if(100===t)this.val(!0);else{var n=Math.round(t/100*this.track.offsetWidth-this.handle.offsetWidth);n=1>n?0:n,this.handle.style[e.CSS.TRANSFORM]="translate3d("+n+"px,0,0)"}},val:function(t){return(t===!0||t===!1)&&(""!==this.handle.style[e.CSS.TRANSFORM]&&(this.handle.style[e.CSS.TRANSFORM]=""),this.checkbox.checked=t,this.openPercent=t?100:0,this.onChange&&this.onChange()),this.checkbox.checked}})}(ionic)}();
/*!
 * ionic.bundle.js is a concatenation of:
 * ionic.js, angular.js, angular-animate.js,
 * angular-sanitize.js, angular-ui-router.js,
 * and ionic-angular.js
 */

/*
 AngularJS v1.5.3
 (c) 2010-2016 Google, Inc. http://angularjs.org
 License: MIT
*/
(function(T,P,u){'use strict';function O(a){return function(){var b=arguments[0],d;d="["+(a?a+":":"")+b+"] http://errors.angularjs.org/1.5.3/"+(a?a+"/":"")+b;for(b=1;b<arguments.length;b++){d=d+(1==b?"?":"&")+"p"+(b-1)+"=";var c=encodeURIComponent,e;e=arguments[b];e="function"==typeof e?e.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof e?"undefined":"string"!=typeof e?JSON.stringify(e):e;d+=c(e)}return Error(d)}}function za(a){if(null==a||Ya(a))return!1;if(M(a)||y(a)||H&&a instanceof H)return!0;
var b="length"in Object(a)&&a.length;return R(b)&&(0<=b&&(b-1 in a||a instanceof Array)||"function"==typeof a.item)}function q(a,b,d){var c,e;if(a)if(D(a))for(c in a)"prototype"==c||"length"==c||"name"==c||a.hasOwnProperty&&!a.hasOwnProperty(c)||b.call(d,a[c],c,a);else if(M(a)||za(a)){var f="object"!==typeof a;c=0;for(e=a.length;c<e;c++)(f||c in a)&&b.call(d,a[c],c,a)}else if(a.forEach&&a.forEach!==q)a.forEach(b,d,a);else if(oc(a))for(c in a)b.call(d,a[c],c,a);else if("function"===typeof a.hasOwnProperty)for(c in a)a.hasOwnProperty(c)&&
b.call(d,a[c],c,a);else for(c in a)va.call(a,c)&&b.call(d,a[c],c,a);return a}function pc(a,b,d){for(var c=Object.keys(a).sort(),e=0;e<c.length;e++)b.call(d,a[c[e]],c[e]);return c}function qc(a){return function(b,d){a(d,b)}}function Wd(){return++qb}function Ob(a,b,d){for(var c=a.$$hashKey,e=0,f=b.length;e<f;++e){var g=b[e];if(J(g)||D(g))for(var h=Object.keys(g),k=0,l=h.length;k<l;k++){var m=h[k],n=g[m];d&&J(n)?fa(n)?a[m]=new Date(n.valueOf()):Za(n)?a[m]=new RegExp(n):n.nodeName?a[m]=n.cloneNode(!0):
Pb(n)?a[m]=n.clone():(J(a[m])||(a[m]=M(n)?[]:{}),Ob(a[m],[n],!0)):a[m]=n}}c?a.$$hashKey=c:delete a.$$hashKey;return a}function S(a){return Ob(a,Aa.call(arguments,1),!1)}function Xd(a){return Ob(a,Aa.call(arguments,1),!0)}function Y(a){return parseInt(a,10)}function Qb(a,b){return S(Object.create(a),b)}function E(){}function $a(a){return a}function da(a){return function(){return a}}function rc(a){return D(a.toString)&&a.toString!==ka}function z(a){return"undefined"===typeof a}function A(a){return"undefined"!==
typeof a}function J(a){return null!==a&&"object"===typeof a}function oc(a){return null!==a&&"object"===typeof a&&!sc(a)}function y(a){return"string"===typeof a}function R(a){return"number"===typeof a}function fa(a){return"[object Date]"===ka.call(a)}function D(a){return"function"===typeof a}function Za(a){return"[object RegExp]"===ka.call(a)}function Ya(a){return a&&a.window===a}function ab(a){return a&&a.$evalAsync&&a.$watch}function Oa(a){return"boolean"===typeof a}function Yd(a){return a&&R(a.length)&&
Zd.test(ka.call(a))}function Pb(a){return!(!a||!(a.nodeName||a.prop&&a.attr&&a.find))}function $d(a){var b={};a=a.split(",");var d;for(d=0;d<a.length;d++)b[a[d]]=!0;return b}function oa(a){return N(a.nodeName||a[0]&&a[0].nodeName)}function bb(a,b){var d=a.indexOf(b);0<=d&&a.splice(d,1);return d}function pa(a,b){function d(a,b){var d=b.$$hashKey,e;if(M(a)){e=0;for(var f=a.length;e<f;e++)b.push(c(a[e]))}else if(oc(a))for(e in a)b[e]=c(a[e]);else if(a&&"function"===typeof a.hasOwnProperty)for(e in a)a.hasOwnProperty(e)&&
(b[e]=c(a[e]));else for(e in a)va.call(a,e)&&(b[e]=c(a[e]));d?b.$$hashKey=d:delete b.$$hashKey;return b}function c(a){if(!J(a))return a;var b=f.indexOf(a);if(-1!==b)return g[b];if(Ya(a)||ab(a))throw Ba("cpws");var b=!1,c=e(a);c===u&&(c=M(a)?[]:Object.create(sc(a)),b=!0);f.push(a);g.push(c);return b?d(a,c):c}function e(a){switch(ka.call(a)){case "[object Int8Array]":case "[object Int16Array]":case "[object Int32Array]":case "[object Float32Array]":case "[object Float64Array]":case "[object Uint8Array]":case "[object Uint8ClampedArray]":case "[object Uint16Array]":case "[object Uint32Array]":return new a.constructor(c(a.buffer));
case "[object ArrayBuffer]":if(!a.slice){var b=new ArrayBuffer(a.byteLength);(new Uint8Array(b)).set(new Uint8Array(a));return b}return a.slice(0);case "[object Boolean]":case "[object Number]":case "[object String]":case "[object Date]":return new a.constructor(a.valueOf());case "[object RegExp]":return b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex,b;case "[object Blob]":return new a.constructor([a],{type:a.type})}if(D(a.cloneNode))return a.cloneNode(!0)}var f=[],
g=[];if(b){if(Yd(b)||"[object ArrayBuffer]"===ka.call(b))throw Ba("cpta");if(a===b)throw Ba("cpi");M(b)?b.length=0:q(b,function(a,c){"$$hashKey"!==c&&delete b[c]});f.push(a);g.push(b);return d(a,b)}return c(a)}function ia(a,b){if(M(a)){b=b||[];for(var d=0,c=a.length;d<c;d++)b[d]=a[d]}else if(J(a))for(d in b=b||{},a)if("$"!==d.charAt(0)||"$"!==d.charAt(1))b[d]=a[d];return b||a}function na(a,b){if(a===b)return!0;if(null===a||null===b)return!1;if(a!==a&&b!==b)return!0;var d=typeof a,c;if(d==typeof b&&
"object"==d)if(M(a)){if(!M(b))return!1;if((d=a.length)==b.length){for(c=0;c<d;c++)if(!na(a[c],b[c]))return!1;return!0}}else{if(fa(a))return fa(b)?na(a.getTime(),b.getTime()):!1;if(Za(a))return Za(b)?a.toString()==b.toString():!1;if(ab(a)||ab(b)||Ya(a)||Ya(b)||M(b)||fa(b)||Za(b))return!1;d=V();for(c in a)if("$"!==c.charAt(0)&&!D(a[c])){if(!na(a[c],b[c]))return!1;d[c]=!0}for(c in b)if(!(c in d)&&"$"!==c.charAt(0)&&A(b[c])&&!D(b[c]))return!1;return!0}return!1}function cb(a,b,d){return a.concat(Aa.call(b,
d))}function tc(a,b){var d=2<arguments.length?Aa.call(arguments,2):[];return!D(b)||b instanceof RegExp?b:d.length?function(){return arguments.length?b.apply(a,cb(d,arguments,0)):b.apply(a,d)}:function(){return arguments.length?b.apply(a,arguments):b.call(a)}}function ae(a,b){var d=b;"string"===typeof a&&"$"===a.charAt(0)&&"$"===a.charAt(1)?d=u:Ya(b)?d="$WINDOW":b&&P===b?d="$DOCUMENT":ab(b)&&(d="$SCOPE");return d}function db(a,b){if(z(a))return u;R(b)||(b=b?2:null);return JSON.stringify(a,ae,b)}function uc(a){return y(a)?
JSON.parse(a):a}function vc(a,b){a=a.replace(be,"");var d=Date.parse("Jan 01, 1970 00:00:00 "+a)/6E4;return isNaN(d)?b:d}function Rb(a,b,d){d=d?-1:1;var c=a.getTimezoneOffset();b=vc(b,c);d*=b-c;a=new Date(a.getTime());a.setMinutes(a.getMinutes()+d);return a}function wa(a){a=H(a).clone();try{a.empty()}catch(b){}var d=H("<div>").append(a).html();try{return a[0].nodeType===Pa?N(d):d.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+N(b)})}catch(c){return N(d)}}function wc(a){try{return decodeURIComponent(a)}catch(b){}}
function xc(a){var b={};q((a||"").split("&"),function(a){var c,e,f;a&&(e=a=a.replace(/\+/g,"%20"),c=a.indexOf("="),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=wc(e),A(e)&&(f=A(f)?wc(f):!0,va.call(b,e)?M(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function Sb(a){var b=[];q(a,function(a,c){M(a)?q(a,function(a){b.push(ja(c,!0)+(!0===a?"":"="+ja(a,!0)))}):b.push(ja(c,!0)+(!0===a?"":"="+ja(a,!0)))});return b.length?b.join("&"):""}function rb(a){return ja(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,
"=").replace(/%2B/gi,"+")}function ja(a,b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,b?"%20":"+")}function ce(a,b){var d,c,e=Qa.length;for(c=0;c<e;++c)if(d=Qa[c]+b,y(d=a.getAttribute(d)))return d;return null}function de(a,b){var d,c,e={};q(Qa,function(b){b+="app";!d&&a.hasAttribute&&a.hasAttribute(b)&&(d=a,c=a.getAttribute(b))});q(Qa,function(b){b+="app";var e;!d&&(e=a.querySelector("["+b.replace(":",
"\\:")+"]"))&&(d=e,c=e.getAttribute(b))});d&&(e.strictDi=null!==ce(d,"strict-di"),b(d,c?[c]:[],e))}function yc(a,b,d){J(d)||(d={});d=S({strictDi:!1},d);var c=function(){a=H(a);if(a.injector()){var c=a[0]===P?"document":wa(a);throw Ba("btstrpd",c.replace(/</,"&lt;").replace(/>/,"&gt;"));}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);d.debugInfoEnabled&&b.push(["$compileProvider",function(a){a.debugInfoEnabled(!0)}]);b.unshift("ng");c=eb(b,d.strictDi);c.invoke(["$rootScope",
"$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;T&&e.test(T.name)&&(d.debugInfoEnabled=!0,T.name=T.name.replace(e,""));if(T&&!f.test(T.name))return c();T.name=T.name.replace(f,"");ea.resumeBootstrap=function(a){q(a,function(a){b.push(a)});return c()};D(ea.resumeDeferredBootstrap)&&ea.resumeDeferredBootstrap()}function ee(){T.name="NG_ENABLE_DEBUG_INFO!"+T.name;T.location.reload()}
function fe(a){a=ea.element(a).injector();if(!a)throw Ba("test");return a.get("$$testability")}function zc(a,b){b=b||"_";return a.replace(ge,function(a,c){return(c?b:"")+a.toLowerCase()})}function he(){var a;if(!Ac){var b=sb();($=z(b)?T.jQuery:b?T[b]:u)&&$.fn.on?(H=$,S($.fn,{scope:Ra.scope,isolateScope:Ra.isolateScope,controller:Ra.controller,injector:Ra.injector,inheritedData:Ra.inheritedData}),a=$.cleanData,$.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=$._data(f,"events"))&&c.$destroy&&
$(f).triggerHandler("$destroy");a(b)}):H=U;ea.element=H;Ac=!0}}function tb(a,b,d){if(!a)throw Ba("areq",b||"?",d||"required");return a}function Sa(a,b,d){d&&M(a)&&(a=a[a.length-1]);tb(D(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Ta(a,b){if("hasOwnProperty"===a)throw Ba("badname",b);}function Bc(a,b,d){if(!b)return a;b=b.split(".");for(var c,e=a,f=b.length,g=0;g<f;g++)c=b[g],a&&(a=(e=a)[c]);return!d&&D(a)?tc(e,a):a}function ub(a){for(var b=
a[0],d=a[a.length-1],c,e=1;b!==d&&(b=b.nextSibling);e++)if(c||a[e]!==b)c||(c=H(Aa.call(a,0,e))),c.push(b);return c||a}function V(){return Object.create(null)}function ie(a){function b(a,b,c){return a[b]||(a[b]=c())}var d=O("$injector"),c=O("ng");a=b(a,"angular",Object);a.$$minErr=a.$$minErr||O;return b(a,"module",function(){var a={};return function(f,g,h){if("hasOwnProperty"===f)throw c("badname","module");g&&a.hasOwnProperty(f)&&(a[f]=null);return b(a,f,function(){function a(b,d,e,f){f||(f=c);return function(){f[e||
"push"]([b,d,arguments]);return L}}function b(a,d){return function(b,e){e&&D(e)&&(e.$$moduleName=f);c.push([a,d,arguments]);return L}}if(!g)throw d("nomod",f);var c=[],e=[],p=[],F=a("$injector","invoke","push",e),L={_invokeQueue:c,_configBlocks:e,_runBlocks:p,requires:g,name:f,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),decorator:b("$provide","decorator"),animation:b("$animateProvider",
"register"),filter:b("$filterProvider","register"),controller:b("$controllerProvider","register"),directive:b("$compileProvider","directive"),component:b("$compileProvider","component"),config:F,run:function(a){p.push(a);return this}};h&&F(h);return L})}})}function je(a){S(a,{bootstrap:yc,copy:pa,extend:S,merge:Xd,equals:na,element:H,forEach:q,injector:eb,noop:E,bind:tc,toJson:db,fromJson:uc,identity:$a,isUndefined:z,isDefined:A,isString:y,isFunction:D,isObject:J,isNumber:R,isElement:Pb,isArray:M,
version:ke,isDate:fa,lowercase:N,uppercase:vb,callbacks:{counter:0},getTestability:fe,$$minErr:O,$$csp:Ga,reloadWithDebugInfo:ee});Tb=ie(T);Tb("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:le});a.provider("$compile",Cc).directive({a:me,input:Dc,textarea:Dc,form:ne,script:oe,select:pe,style:qe,option:re,ngBind:se,ngBindHtml:te,ngBindTemplate:ue,ngClass:ve,ngClassEven:we,ngClassOdd:xe,ngCloak:ye,ngController:ze,ngForm:Ae,ngHide:Be,ngIf:Ce,ngInclude:De,ngInit:Ee,ngNonBindable:Fe,
ngPluralize:Ge,ngRepeat:He,ngShow:Ie,ngStyle:Je,ngSwitch:Ke,ngSwitchWhen:Le,ngSwitchDefault:Me,ngOptions:Ne,ngTransclude:Oe,ngModel:Pe,ngList:Qe,ngChange:Re,pattern:Ec,ngPattern:Ec,required:Fc,ngRequired:Fc,minlength:Gc,ngMinlength:Gc,maxlength:Hc,ngMaxlength:Hc,ngValue:Se,ngModelOptions:Te}).directive({ngInclude:Ue}).directive(wb).directive(Ic);a.provider({$anchorScroll:Ve,$animate:We,$animateCss:Xe,$$animateJs:Ye,$$animateQueue:Ze,$$AnimateRunner:$e,$$animateAsyncRun:af,$browser:bf,$cacheFactory:cf,
$controller:df,$document:ef,$exceptionHandler:ff,$filter:Jc,$$forceReflow:gf,$interpolate:hf,$interval:jf,$http:kf,$httpParamSerializer:lf,$httpParamSerializerJQLike:mf,$httpBackend:nf,$xhrFactory:of,$location:pf,$log:qf,$parse:rf,$rootScope:sf,$q:tf,$$q:uf,$sce:vf,$sceDelegate:wf,$sniffer:xf,$templateCache:yf,$templateRequest:zf,$$testability:Af,$timeout:Bf,$window:Cf,$$rAF:Df,$$jqLite:Ef,$$HashMap:Ff,$$cookieReader:Gf})}])}function fb(a){return a.replace(Hf,function(a,d,c,e){return e?c.toUpperCase():
c}).replace(If,"Moz$1")}function Kc(a){a=a.nodeType;return 1===a||!a||9===a}function Lc(a,b){var d,c,e=b.createDocumentFragment(),f=[];if(Ub.test(a)){d=d||e.appendChild(b.createElement("div"));c=(Jf.exec(a)||["",""])[1].toLowerCase();c=ha[c]||ha._default;d.innerHTML=c[1]+a.replace(Kf,"<$1></$2>")+c[2];for(c=c[0];c--;)d=d.lastChild;f=cb(f,d.childNodes);d=e.firstChild;d.textContent=""}else f.push(b.createTextNode(a));e.textContent="";e.innerHTML="";q(f,function(a){e.appendChild(a)});return e}function Mc(a,
b){var d=a.parentNode;d&&d.replaceChild(b,a);b.appendChild(a)}function U(a){if(a instanceof U)return a;var b;y(a)&&(a=W(a),b=!0);if(!(this instanceof U)){if(b&&"<"!=a.charAt(0))throw Vb("nosel");return new U(a)}if(b){b=P;var d;a=(d=Lf.exec(a))?[b.createElement(d[1])]:(d=Lc(a,b))?d.childNodes:[]}Nc(this,a)}function Wb(a){return a.cloneNode(!0)}function xb(a,b){b||gb(a);if(a.querySelectorAll)for(var d=a.querySelectorAll("*"),c=0,e=d.length;c<e;c++)gb(d[c])}function Oc(a,b,d,c){if(A(c))throw Vb("offargs");
var e=(c=yb(a))&&c.events,f=c&&c.handle;if(f)if(b){var g=function(b){var c=e[b];A(d)&&bb(c||[],d);A(d)&&c&&0<c.length||(a.removeEventListener(b,f,!1),delete e[b])};q(b.split(" "),function(a){g(a);zb[a]&&g(zb[a])})}else for(b in e)"$destroy"!==b&&a.removeEventListener(b,f,!1),delete e[b]}function gb(a,b){var d=a.ng339,c=d&&hb[d];c&&(b?delete c.data[b]:(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),Oc(a)),delete hb[d],a.ng339=u))}function yb(a,b){var d=a.ng339,d=d&&hb[d];b&&!d&&(a.ng339=d=++Mf,
d=hb[d]={events:{},data:{},handle:u});return d}function Xb(a,b,d){if(Kc(a)){var c=A(d),e=!c&&b&&!J(b),f=!b;a=(a=yb(a,!e))&&a.data;if(c)a[b]=d;else{if(f)return a;if(e)return a&&a[b];S(a,b)}}}function Ab(a,b){return a.getAttribute?-1<(" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+b+" "):!1}function Bb(a,b){b&&a.setAttribute&&q(b.split(" "),function(b){a.setAttribute("class",W((" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+W(b)+" "," ")))})}function Cb(a,
b){if(b&&a.setAttribute){var d=(" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");q(b.split(" "),function(a){a=W(a);-1===d.indexOf(" "+a+" ")&&(d+=a+" ")});a.setAttribute("class",W(d))}}function Nc(a,b){if(b)if(b.nodeType)a[a.length++]=b;else{var d=b.length;if("number"===typeof d&&b.window!==b){if(d)for(var c=0;c<d;c++)a[a.length++]=b[c]}else a[a.length++]=b}}function Pc(a,b){return Db(a,"$"+(b||"ngController")+"Controller")}function Db(a,b,d){9==a.nodeType&&(a=a.documentElement);for(b=
M(b)?b:[b];a;){for(var c=0,e=b.length;c<e;c++)if(A(d=H.data(a,b[c])))return d;a=a.parentNode||11===a.nodeType&&a.host}}function Qc(a){for(xb(a,!0);a.firstChild;)a.removeChild(a.firstChild)}function Yb(a,b){b||xb(a);var d=a.parentNode;d&&d.removeChild(a)}function Nf(a,b){b=b||T;if("complete"===b.document.readyState)b.setTimeout(a);else H(b).on("load",a)}function Rc(a,b){var d=Eb[b.toLowerCase()];return d&&Sc[oa(a)]&&d}function Of(a,b){var d=function(c,d){c.isDefaultPrevented=function(){return c.defaultPrevented};
var f=b[d||c.type],g=f?f.length:0;if(g){if(z(c.immediatePropagationStopped)){var h=c.stopImmediatePropagation;c.stopImmediatePropagation=function(){c.immediatePropagationStopped=!0;c.stopPropagation&&c.stopPropagation();h&&h.call(c)}}c.isImmediatePropagationStopped=function(){return!0===c.immediatePropagationStopped};var k=f.specialHandlerWrapper||Pf;1<g&&(f=ia(f));for(var l=0;l<g;l++)c.isImmediatePropagationStopped()||k(a,c,f[l])}};d.elem=a;return d}function Pf(a,b,d){d.call(a,b)}function Qf(a,b,
d){var c=b.relatedTarget;c&&(c===a||Rf.call(a,c))||d.call(a,b)}function Ef(){this.$get=function(){return S(U,{hasClass:function(a,b){a.attr&&(a=a[0]);return Ab(a,b)},addClass:function(a,b){a.attr&&(a=a[0]);return Cb(a,b)},removeClass:function(a,b){a.attr&&(a=a[0]);return Bb(a,b)}})}}function Ha(a,b){var d=a&&a.$$hashKey;if(d)return"function"===typeof d&&(d=a.$$hashKey()),d;d=typeof a;return d="function"==d||"object"==d&&null!==a?a.$$hashKey=d+":"+(b||Wd)():d+":"+a}function Ua(a,b){if(b){var d=0;this.nextUid=
function(){return++d}}q(a,this.put,this)}function Tc(a){a=a.toString().replace(Sf,"");return a.match(Tf)||a.match(Uf)}function Vf(a){return(a=Tc(a))?"function("+(a[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function eb(a,b){function d(a){return function(b,c){if(J(b))q(b,qc(a));else return a(b,c)}}function c(a,b){Ta(a,"service");if(D(b)||M(b))b=p.instantiate(b);if(!b.$get)throw Ia("pget",a);return n[a+"Provider"]=b}function e(a,b){return function(){var c=x.invoke(b,this);if(z(c))throw Ia("undef",a);
return c}}function f(a,b,d){return c(a,{$get:!1!==d?e(a,b):b})}function g(a){tb(z(a)||M(a),"modulesToLoad","not an array");var b=[],c;q(a,function(a){function d(a){var b,c;b=0;for(c=a.length;b<c;b++){var e=a[b],f=p.get(e[0]);f[e[1]].apply(f,e[2])}}if(!m.get(a)){m.put(a,!0);try{y(a)?(c=Tb(a),b=b.concat(g(c.requires)).concat(c._runBlocks),d(c._invokeQueue),d(c._configBlocks)):D(a)?b.push(p.invoke(a)):M(a)?b.push(p.invoke(a)):Sa(a,"module")}catch(e){throw M(a)&&(a=a[a.length-1]),e.message&&e.stack&&
-1==e.stack.indexOf(e.message)&&(e=e.message+"\n"+e.stack),Ia("modulerr",a,e.stack||e.message||e);}}});return b}function h(a,c){function d(b,e){if(a.hasOwnProperty(b)){if(a[b]===k)throw Ia("cdep",b+" <- "+l.join(" <- "));return a[b]}try{return l.unshift(b),a[b]=k,a[b]=c(b,e)}catch(f){throw a[b]===k&&delete a[b],f;}finally{l.shift()}}function e(a,c,f){var g=[];a=eb.$$annotate(a,b,f);for(var h=0,k=a.length;h<k;h++){var l=a[h];if("string"!==typeof l)throw Ia("itkn",l);g.push(c&&c.hasOwnProperty(l)?c[l]:
d(l,f))}return g}return{invoke:function(a,b,c,d){"string"===typeof c&&(d=c,c=null);c=e(a,c,d);M(a)&&(a=a[a.length-1]);d=11>=Da?!1:"function"===typeof a&&/^(?:class\s|constructor\()/.test(Function.prototype.toString.call(a));return d?(c.unshift(null),new (Function.prototype.bind.apply(a,c))):a.apply(b,c)},instantiate:function(a,b,c){var d=M(a)?a[a.length-1]:a;a=e(a,b,c);a.unshift(null);return new (Function.prototype.bind.apply(d,a))},get:d,annotate:eb.$$annotate,has:function(b){return n.hasOwnProperty(b+
"Provider")||a.hasOwnProperty(b)}}}b=!0===b;var k={},l=[],m=new Ua([],!0),n={$provide:{provider:d(c),factory:d(f),service:d(function(a,b){return f(a,["$injector",function(a){return a.instantiate(b)}])}),value:d(function(a,b){return f(a,da(b),!1)}),constant:d(function(a,b){Ta(a,"constant");n[a]=b;F[a]=b}),decorator:function(a,b){var c=p.get(a+"Provider"),d=c.$get;c.$get=function(){var a=x.invoke(d,c);return x.invoke(b,null,{$delegate:a})}}}},p=n.$injector=h(n,function(a,b){ea.isString(b)&&l.push(b);
throw Ia("unpr",l.join(" <- "));}),F={},L=h(F,function(a,b){var c=p.get(a+"Provider",b);return x.invoke(c.$get,c,u,a)}),x=L;n.$injectorProvider={$get:da(L)};var r=g(a),x=L.get("$injector");x.strictDi=b;q(r,function(a){a&&x.invoke(a)});return x}function Ve(){var a=!0;this.disableAutoScrolling=function(){a=!1};this.$get=["$window","$location","$rootScope",function(b,d,c){function e(a){var b=null;Array.prototype.some.call(a,function(a){if("a"===oa(a))return b=a,!0});return b}function f(a){if(a){a.scrollIntoView();
var c;c=g.yOffset;D(c)?c=c():Pb(c)?(c=c[0],c="fixed"!==b.getComputedStyle(c).position?0:c.getBoundingClientRect().bottom):R(c)||(c=0);c&&(a=a.getBoundingClientRect().top,b.scrollBy(0,a-c))}else b.scrollTo(0,0)}function g(a){a=y(a)?a:d.hash();var b;a?(b=h.getElementById(a))?f(b):(b=e(h.getElementsByName(a)))?f(b):"top"===a&&f(null):f(null)}var h=b.document;a&&c.$watch(function(){return d.hash()},function(a,b){a===b&&""===a||Nf(function(){c.$evalAsync(g)})});return g}]}function ib(a,b){if(!a&&!b)return"";
if(!a)return b;if(!b)return a;M(a)&&(a=a.join(" "));M(b)&&(b=b.join(" "));return a+" "+b}function Wf(a){y(a)&&(a=a.split(" "));var b=V();q(a,function(a){a.length&&(b[a]=!0)});return b}function Ja(a){return J(a)?a:{}}function Xf(a,b,d,c){function e(a){try{a.apply(null,Aa.call(arguments,1))}finally{if(L--,0===L)for(;x.length;)try{x.pop()()}catch(b){d.error(b)}}}function f(){t=null;g();h()}function g(){r=G();r=z(r)?null:r;na(r,I)&&(r=I);I=r}function h(){if(v!==k.url()||w!==r)v=k.url(),w=r,q(C,function(a){a(k.url(),
r)})}var k=this,l=a.location,m=a.history,n=a.setTimeout,p=a.clearTimeout,F={};k.isMock=!1;var L=0,x=[];k.$$completeOutstandingRequest=e;k.$$incOutstandingRequestCount=function(){L++};k.notifyWhenNoOutstandingRequests=function(a){0===L?a():x.push(a)};var r,w,v=l.href,Q=b.find("base"),t=null,G=c.history?function(){try{return m.state}catch(a){}}:E;g();w=r;k.url=function(b,d,e){z(e)&&(e=null);l!==a.location&&(l=a.location);m!==a.history&&(m=a.history);if(b){var f=w===e;if(v===b&&(!c.history||f))return k;
var h=v&&Ka(v)===Ka(b);v=b;w=e;if(!c.history||h&&f){if(!h||t)t=b;d?l.replace(b):h?(d=l,e=b.indexOf("#"),e=-1===e?"":b.substr(e),d.hash=e):l.href=b;l.href!==b&&(t=b)}else m[d?"replaceState":"pushState"](e,"",b),g(),w=r;return k}return t||l.href.replace(/%27/g,"'")};k.state=function(){return r};var C=[],K=!1,I=null;k.onUrlChange=function(b){if(!K){if(c.history)H(a).on("popstate",f);H(a).on("hashchange",f);K=!0}C.push(b);return b};k.$$applicationDestroyed=function(){H(a).off("hashchange popstate",f)};
k.$$checkUrlChange=h;k.baseHref=function(){var a=Q.attr("href");return a?a.replace(/^(https?\:)?\/\/[^\/]*/,""):""};k.defer=function(a,b){var c;L++;c=n(function(){delete F[c];e(a)},b||0);F[c]=!0;return c};k.defer.cancel=function(a){return F[a]?(delete F[a],p(a),e(E),!0):!1}}function bf(){this.$get=["$window","$log","$sniffer","$document",function(a,b,d,c){return new Xf(a,c,b,d)}]}function cf(){this.$get=function(){function a(a,c){function e(a){a!=n&&(p?p==a&&(p=a.n):p=a,f(a.n,a.p),f(a,n),n=a,n.n=
null)}function f(a,b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(a in b)throw O("$cacheFactory")("iid",a);var g=0,h=S({},c,{id:a}),k=V(),l=c&&c.capacity||Number.MAX_VALUE,m=V(),n=null,p=null;return b[a]={put:function(a,b){if(!z(b)){if(l<Number.MAX_VALUE){var c=m[a]||(m[a]={key:a});e(c)}a in k||g++;k[a]=b;g>l&&this.remove(p.key);return b}},get:function(a){if(l<Number.MAX_VALUE){var b=m[a];if(!b)return;e(b)}return k[a]},remove:function(a){if(l<Number.MAX_VALUE){var b=m[a];if(!b)return;b==n&&(n=b.p);b==p&&(p=
b.n);f(b.n,b.p);delete m[a]}a in k&&(delete k[a],g--)},removeAll:function(){k=V();g=0;m=V();n=p=null},destroy:function(){m=h=k=null;delete b[a]},info:function(){return S({},h,{size:g})}}}var b={};a.info=function(){var a={};q(b,function(b,e){a[e]=b.info()});return a};a.get=function(a){return b[a]};return a}}function yf(){this.$get=["$cacheFactory",function(a){return a("templates")}]}function Cc(a,b){function d(a,b,c){var d=/^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/,e={};q(a,function(a,f){if(a in m)e[f]=
m[a];else{var g=a.match(d);if(!g)throw ga("iscp",b,f,a,c?"controller bindings definition":"isolate scope definition");e[f]={mode:g[1][0],collection:"*"===g[2],optional:"?"===g[3],attrName:g[4]||f};g[4]&&(m[a]=e[f])}});return e}function c(a){var b=a.charAt(0);if(!b||b!==N(b))throw ga("baddir",a);if(a!==a.trim())throw ga("baddir",a);}var e={},f=/^\s*directive\:\s*([\w\-]+)\s+(.*)$/,g=/(([\w\-]+)(?:\:([^;]+))?;?)/,h=$d("ngSrc,ngSrcset,src,srcset"),k=/^(?:(\^\^?)?(\?)?(\^\^?)?)?/,l=/^(on[a-z]+|formaction)$/,
m=V();this.directive=function L(b,d){Ta(b,"directive");y(b)?(c(b),tb(d,"directiveFactory"),e.hasOwnProperty(b)||(e[b]=[],a.factory(b+"Directive",["$injector","$exceptionHandler",function(a,c){var d=[];q(e[b],function(e,f){try{var g=a.invoke(e);D(g)?g={compile:da(g)}:!g.compile&&g.link&&(g.compile=da(g.link));g.priority=g.priority||0;g.index=f;g.name=g.name||b;g.require=g.require||g.controller&&g.name;g.restrict=g.restrict||"EA";g.$$moduleName=e.$$moduleName;d.push(g)}catch(h){c(h)}});return d}])),
e[b].push(d)):q(b,qc(L));return this};this.component=function(a,b){function c(a){function e(b){return D(b)||M(b)?function(c,d){return a.invoke(b,this,{$element:c,$attrs:d})}:b}var f=b.template||b.templateUrl?b.template:"";return{controller:d,controllerAs:Uc(b.controller)||b.controllerAs||"$ctrl",template:e(f),templateUrl:e(b.templateUrl),transclude:b.transclude,scope:{},bindToController:b.bindings||{},restrict:"E",require:b.require}}var d=b.controller||E;q(b,function(a,b){"$"===b.charAt(0)&&(c[b]=
a,d[b]=a)});c.$inject=["$injector"];return this.directive(a,c)};this.aHrefSanitizationWhitelist=function(a){return A(a)?(b.aHrefSanitizationWhitelist(a),this):b.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(a){return A(a)?(b.imgSrcSanitizationWhitelist(a),this):b.imgSrcSanitizationWhitelist()};var n=!0;this.debugInfoEnabled=function(a){return A(a)?(n=a,this):n};var p=10;this.onChangesTtl=function(a){return arguments.length?(p=a,this):p};this.$get=["$injector","$interpolate",
"$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$sce","$animate","$$sanitizeUri",function(a,b,c,m,v,Q,t,G,C,K){function I(){try{if(!--pa)throw $=u,ga("infchng",p);t.$apply(function(){for(var a=0,b=$.length;a<b;++a)$[a]();$=u})}finally{pa++}}function qa(a,b){if(b){var c=Object.keys(b),d,e,f;d=0;for(e=c.length;d<e;d++)f=c[d],this[f]=b[f]}else this.$attr={};this.$$element=a}function Ca(a,b,c){la.innerHTML="<span "+b+">";b=la.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);
d.value=c;a.attributes.setNamedItem(d)}function B(a,b){try{a.addClass(b)}catch(c){}}function ba(a,b,c,d,e){a instanceof H||(a=H(a));for(var f=/\S+/,g=0,h=a.length;g<h;g++){var k=a[g];k.nodeType===Pa&&k.nodeValue.match(f)&&Mc(k,a[g]=P.createElement("span"))}var l=xa(a,b,a,c,d,e);ba.$$addScopeClass(a);var m=null;return function(b,c,d){tb(b,"scope");e&&e.needsNewScope&&(b=b.$parent.$new());d=d||{};var f=d.parentBoundTranscludeFn,g=d.transcludeControllers;d=d.futureParentElement;f&&f.$$boundTransclude&&
(f=f.$$boundTransclude);m||(m=(d=d&&d[0])?"foreignobject"!==oa(d)&&ka.call(d).match(/SVG/)?"svg":"html":"html");d="html"!==m?H(ca(m,H("<div>").append(a).html())):c?Ra.clone.call(a):a;if(g)for(var h in g)d.data("$"+h+"Controller",g[h].instance);ba.$$addScopeInfo(d,b);c&&c(d,b);l&&l(b,d,d,f);return d}}function xa(a,b,c,d,e,f){function g(a,c,d,e){var f,k,l,m,n,p,G;if(r)for(G=Array(c.length),m=0;m<h.length;m+=3)f=h[m],G[f]=c[f];else G=c;m=0;for(n=h.length;m<n;)k=G[h[m++]],c=h[m++],f=h[m++],c?(c.scope?
(l=a.$new(),ba.$$addScopeInfo(H(k),l)):l=a,p=c.transcludeOnThisElement?s(a,c.transclude,e):!c.templateOnThisElement&&e?e:!e&&b?s(a,b):null,c(f,l,k,d,p)):f&&f(a,k.childNodes,u,e)}for(var h=[],k,l,m,n,r,p=0;p<a.length;p++){k=new qa;l=A(a[p],[],k,0===p?d:u,e);(f=l.length?ra(l,a[p],k,b,c,null,[],[],f):null)&&f.scope&&ba.$$addScopeClass(k.$$element);k=f&&f.terminal||!(m=a[p].childNodes)||!m.length?null:xa(m,f?(f.transcludeOnThisElement||!f.templateOnThisElement)&&f.transclude:b);if(f||k)h.push(p,f,k),
n=!0,r=r||f;f=null}return n?g:null}function s(a,b,c){function d(e,f,g,h,k){e||(e=a.$new(!1,k),e.$$transcluded=!0);return b(e,f,{parentBoundTranscludeFn:c,transcludeControllers:g,futureParentElement:h})}var e=d.$$slots=V(),f;for(f in b.$$slots)e[f]=b.$$slots[f]?s(a,b.$$slots[f],c):null;return d}function A(a,b,c,d,e){var h=c.$attr,k;switch(a.nodeType){case 1:Fa(b,ya(oa(a)),"E",d,e);for(var l,m,n,r=a.attributes,p=0,G=r&&r.length;p<G;p++){var v=!1,C=!1;l=r[p];k=l.name;m=W(l.value);l=ya(k);if(n=za.test(l))k=
k.replace(Vc,"").substr(8).replace(/_(.)/g,function(a,b){return b.toUpperCase()});(l=l.match(Ba))&&R(l[1])&&(v=k,C=k.substr(0,k.length-5)+"end",k=k.substr(0,k.length-6));l=ya(k.toLowerCase());h[l]=k;if(n||!c.hasOwnProperty(l))c[l]=m,Rc(a,l)&&(c[l]=!0);fa(a,b,m,l,n);Fa(b,l,"A",d,e,v,C)}a=a.className;J(a)&&(a=a.animVal);if(y(a)&&""!==a)for(;k=g.exec(a);)l=ya(k[2]),Fa(b,l,"C",d,e)&&(c[l]=W(k[3])),a=a.substr(k.index+k[0].length);break;case Pa:if(11===Da)for(;a.parentNode&&a.nextSibling&&a.nextSibling.nodeType===
Pa;)a.nodeValue+=a.nextSibling.nodeValue,a.parentNode.removeChild(a.nextSibling);Y(b,a.nodeValue);break;case 8:try{if(k=f.exec(a.nodeValue))l=ya(k[1]),Fa(b,l,"M",d,e)&&(c[l]=W(k[2]))}catch(w){}}b.sort(Z);return b}function Wc(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ga("uterdir",b,c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return H(d)}function O(a,b,c){return function(d,e,f,g,h){e=Wc(e[0],
b,c);return a(d,e,f,g,h)}}function Zb(a,b,c,d,e,f){var g;return a?ba(b,c,d,e,f):function(){g||(g=ba(b,c,d,e,f),b=c=f=null);return g.apply(this,arguments)}}function ra(a,b,d,e,f,g,h,k,l){function m(a,b,c,d){if(a){c&&(a=O(a,c,d));a.require=B.require;a.directiveName=L;if(C===B||B.$$isolateScope)a=ia(a,{isolateScope:!0});h.push(a)}if(b){c&&(b=O(b,c,d));b.require=B.require;b.directiveName=L;if(C===B||B.$$isolateScope)b=ia(b,{isolateScope:!0});k.push(b)}}function n(a,c,e,f,g){function l(a,b,c,d){var e;
ab(a)||(d=c,c=b,b=a,a=u);Ca&&(e=K);c||(c=Ca?t.parent():t);if(d){var f=g.$$slots[d];if(f)return f(a,b,e,c,s);if(z(f))throw ga("noslot",d,wa(t));}else return g(a,b,e,c,s)}var m,r,p,B,I,K,x,t;b===e?(f=d,t=d.$$element):(t=H(e),f=new qa(t,d));I=c;C?B=c.$new(!0):G&&(I=c.$parent);g&&(x=l,x.$$boundTransclude=g,x.isSlotFilled=function(a){return!!g.$$slots[a]});v&&(K=T(t,f,x,v,B,c,C));C&&(ba.$$addScopeInfo(t,B,!0,!(w&&(w===C||w===C.$$originalDirective))),ba.$$addScopeClass(t,!0),B.$$isolateBindings=C.$$isolateBindings,
(p=ha(c,f,B,B.$$isolateBindings,C))&&B.$on("$destroy",p));for(r in K){p=v[r];var Va=K[r],Q=p.$$bindings.bindToController;Va.identifier&&Q&&(m=ha(I,f,Va.instance,Q,p));var L=Va();L!==Va.instance&&(Va.instance=L,t.data("$"+p.name+"Controller",L),m&&m(),m=ha(I,f,Va.instance,Q,p))}q(v,function(a,b){var c=a.require;a.bindToController&&!M(c)&&J(c)&&S(K[b].instance,jb(b,c,t,K))});q(K,function(a){var b=a.instance;D(b.$onInit)&&b.$onInit();D(b.$onDestroy)&&I.$on("$destroy",function(){b.$onDestroy()})});m=
0;for(r=h.length;m<r;m++)p=h[m],ja(p,p.isolateScope?B:c,t,f,p.require&&jb(p.directiveName,p.require,t,K),x);var s=c;C&&(C.template||null===C.templateUrl)&&(s=B);a&&a(s,e.childNodes,u,g);for(m=k.length-1;0<=m;m--)p=k[m],ja(p,p.isolateScope?B:c,t,f,p.require&&jb(p.directiveName,p.require,t,K),x);q(K,function(a){a=a.instance;D(a.$postLink)&&a.$postLink()})}l=l||{};for(var p=-Number.MAX_VALUE,G=l.newScopeDirective,v=l.controllerDirectives,C=l.newIsolateScopeDirective,w=l.templateDirective,I=l.nonTlbTranscludeDirective,
K=!1,x=!1,Ca=l.hasElementTranscludeDirective,t=d.$$element=H(b),B,L,Q,s=e,xa,Ea=!1,E=!1,y,ra=0,N=a.length;ra<N;ra++){B=a[ra];var R=B.$$start,Fa=B.$$end;R&&(t=Wc(b,R,Fa));Q=u;if(p>B.priority)break;if(y=B.scope)B.templateUrl||(J(y)?(X("new/isolated scope",C||G,B,t),C=B):X("new/isolated scope",C,B,t)),G=G||B;L=B.name;if(!Ea&&(B.replace&&(B.templateUrl||B.template)||B.transclude&&!B.$$tlb)){for(y=ra+1;Ea=a[y++];)if(Ea.transclude&&!Ea.$$tlb||Ea.replace&&(Ea.templateUrl||Ea.template)){E=!0;break}Ea=!0}!B.templateUrl&&
B.controller&&(y=B.controller,v=v||V(),X("'"+L+"' controller",v[L],B,t),v[L]=B);if(y=B.transclude)if(K=!0,B.$$tlb||(X("transclusion",I,B,t),I=B),"element"==y)Ca=!0,p=B.priority,Q=t,t=d.$$element=H(ba.$$createComment(L,d[L])),b=t[0],da(f,Aa.call(Q,0),b),Q[0].$$parentNode=Q[0].parentNode,s=Zb(E,Q,e,p,g&&g.name,{nonTlbTranscludeDirective:I});else{var P=V();Q=H(Wb(b)).contents();if(J(y)){Q=[];var Z=V(),Y=V();q(y,function(a,b){var c="?"===a.charAt(0);a=c?a.substring(1):a;Z[a]=b;P[b]=null;Y[b]=c});q(t.contents(),
function(a){var b=Z[ya(oa(a))];b?(Y[b]=!0,P[b]=P[b]||[],P[b].push(a)):Q.push(a)});q(Y,function(a,b){if(!a)throw ga("reqslot",b);});for(var $ in P)P[$]&&(P[$]=Zb(E,P[$],e))}t.empty();s=Zb(E,Q,e,u,u,{needsNewScope:B.$$isolateScope||B.$$newScope});s.$$slots=P}if(B.template)if(x=!0,X("template",w,B,t),w=B,y=D(B.template)?B.template(t,d):B.template,y=ua(y),B.replace){g=B;Q=Ub.test(y)?Xc(ca(B.templateNamespace,W(y))):[];b=Q[0];if(1!=Q.length||1!==b.nodeType)throw ga("tplrt",L,"");da(f,t,b);N={$attr:{}};
y=A(b,[],N);var ea=a.splice(ra+1,a.length-(ra+1));(C||G)&&Yc(y,C,G);a=a.concat(y).concat(ea);U(d,N);N=a.length}else t.html(y);if(B.templateUrl)x=!0,X("template",w,B,t),w=B,B.replace&&(g=B),n=aa(a.splice(ra,a.length-ra),t,d,f,K&&s,h,k,{controllerDirectives:v,newScopeDirective:G!==B&&G,newIsolateScopeDirective:C,templateDirective:w,nonTlbTranscludeDirective:I}),N=a.length;else if(B.compile)try{xa=B.compile(t,d,s),D(xa)?m(null,xa,R,Fa):xa&&m(xa.pre,xa.post,R,Fa)}catch(fa){c(fa,wa(t))}B.terminal&&(n.terminal=
!0,p=Math.max(p,B.priority))}n.scope=G&&!0===G.scope;n.transcludeOnThisElement=K;n.templateOnThisElement=x;n.transclude=s;l.hasElementTranscludeDirective=Ca;return n}function jb(a,b,c,d){var e;if(y(b)){var f=b.match(k);b=b.substring(f[0].length);var g=f[1]||f[3],f="?"===f[2];"^^"===g?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e=g?c.inheritedData(h):c.data(h)}if(!e&&!f)throw ga("ctreq",b,a);}else if(M(b))for(e=[],g=0,f=b.length;g<f;g++)e[g]=jb(a,b[g],c,d);else J(b)&&(e=
{},q(b,function(b,f){e[f]=jb(a,b,c,d)}));return e||null}function T(a,b,c,d,e,f,g){var h=V(),k;for(k in d){var l=d[k],m={$scope:l===g||l.$$isolateScope?e:f,$element:a,$attrs:b,$transclude:c},n=l.controller;"@"==n&&(n=b[l.name]);m=Q(n,m,!0,l.controllerAs);h[l.name]=m;a.data("$"+l.name+"Controller",m.instance)}return h}function Yc(a,b,c){for(var d=0,e=a.length;d<e;d++)a[d]=Qb(a[d],{$$isolateScope:b,$$newScope:c})}function Fa(b,f,g,h,k,l,m){if(f===k)return null;k=null;if(e.hasOwnProperty(f)){var n;f=
a.get(f+"Directive");for(var p=0,G=f.length;p<G;p++)try{if(n=f[p],(z(h)||h>n.priority)&&-1!=n.restrict.indexOf(g)){l&&(n=Qb(n,{$$start:l,$$end:m}));if(!n.$$bindings){var v=n,C=n,w=n.name,B={isolateScope:null,bindToController:null};J(C.scope)&&(!0===C.bindToController?(B.bindToController=d(C.scope,w,!0),B.isolateScope={}):B.isolateScope=d(C.scope,w,!1));J(C.bindToController)&&(B.bindToController=d(C.bindToController,w,!0));if(J(B.bindToController)){var I=C.controller,K=C.controllerAs;if(!I)throw ga("noctrl",
w);if(!Uc(I,K))throw ga("noident",w);}var x=v.$$bindings=B;J(x.isolateScope)&&(n.$$isolateBindings=x.isolateScope)}b.push(n);k=n}}catch(t){c(t)}}return k}function R(b){if(e.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,f=c.length;d<f;d++)if(b=c[d],b.multiElement)return!0;return!1}function U(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;q(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&b[e]!==d&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});q(b,function(b,f){"class"==f?(B(e,b),a["class"]=(a["class"]?
a["class"]+" ":"")+b):"style"==f?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==f.charAt(0)||a.hasOwnProperty(f)||(a[f]=b,d[f]=c[f])})}function aa(a,b,c,d,e,f,g,h){var k=[],l,n,p=b[0],r=a.shift(),G=Qb(r,{templateUrl:null,transclude:null,replace:null,$$originalDirective:r}),v=D(r.templateUrl)?r.templateUrl(b,c):r.templateUrl,C=r.templateNamespace;b.empty();m(v).then(function(m){var w,I;m=ua(m);if(r.replace){m=Ub.test(m)?Xc(ca(C,W(m))):[];w=m[0];if(1!=m.length||1!==
w.nodeType)throw ga("tplrt",r.name,v);m={$attr:{}};da(d,b,w);var K=A(w,[],m);J(r.scope)&&Yc(K,!0);a=K.concat(a);U(c,m)}else w=p,b.html(m);a.unshift(G);l=ra(a,w,c,e,b,r,f,g,h);q(d,function(a,c){a==w&&(d[c]=b[0])});for(n=xa(b[0].childNodes,e);k.length;){m=k.shift();I=k.shift();var x=k.shift(),t=k.shift(),K=b[0];if(!m.$$destroyed){if(I!==p){var qa=I.className;h.hasElementTranscludeDirective&&r.replace||(K=Wb(w));da(x,H(I),K);B(H(K),qa)}I=l.transcludeOnThisElement?s(m,l.transclude,t):t;l(n,m,K,d,I)}}k=
null});return function(a,b,c,d,e){a=e;b.$$destroyed||(k?k.push(b,c,d,a):(l.transcludeOnThisElement&&(a=s(b,l.transclude,e)),l(n,b,c,d,a)))}}function Z(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function X(a,b,c,d){function e(a){return a?" (module: "+a+")":""}if(b)throw ga("multidir",b.name,e(b.$$moduleName),c.name,e(c.$$moduleName),a,wa(d));}function Y(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){a=a.parent();var b=!!a.length;
b&&ba.$$addBindingClass(a);return function(a,c){var e=c.parent();b||ba.$$addBindingClass(e);ba.$$addBindingInfo(e,d.expressions);a.$watch(d,function(a){c[0].nodeValue=a})}}})}function ca(a,b){a=N(a||"html");switch(a){case "svg":case "math":var c=P.createElement("div");c.innerHTML="<"+a+">"+b+"</"+a+">";return c.childNodes[0].childNodes;default:return b}}function ea(a,b){if("srcdoc"==b)return G.HTML;var c=oa(a);if("xlinkHref"==b||"form"==c&&"action"==b||"img"!=c&&("src"==b||"ngSrc"==b))return G.RESOURCE_URL}
function fa(a,c,d,e,f){var g=ea(a,e);f=h[e]||f;var k=b(d,!0,g,f);if(k){if("multiple"===e&&"select"===oa(a))throw ga("selmulti",wa(a));c.push({priority:100,compile:function(){return{pre:function(a,c,h){c=h.$$observers||(h.$$observers=V());if(l.test(e))throw ga("nodomevents");var m=h[e];m!==d&&(k=m&&b(m,!0,g,f),d=m);k&&(h[e]=k(a),(c[e]||(c[e]=[])).$$inter=!0,(h.$$observers&&h.$$observers[e].$$scope||a).$watch(k,function(a,b){"class"===e&&a!=b?h.$updateClass(a,b):h.$set(e,a)}))}}}})}}function da(a,b,
c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g<h;g++)if(a[g]==d){a[g++]=c;h=g+e-1;for(var k=a.length;g<k;g++,h++)h<k?a[g]=a[h]:delete a[g];a.length-=e-1;a.context===d&&(a.context=c);break}f&&f.replaceChild(c,d);a=P.createDocumentFragment();for(g=0;g<e;g++)a.appendChild(b[g]);H.hasData(d)&&(H.data(c,H.data(d)),H(d).off("$destroy"));H.cleanData(a.querySelectorAll("*"));for(g=1;g<e;g++)delete b[g];b[0]=c;b.length=1}function ia(a,b){return S(function(){return a.apply(null,arguments)},
a,b)}function ja(a,b,d,e,f,g){try{a(b,d,e,f,g)}catch(h){c(h,wa(d))}}function ha(a,c,d,e,f){function g(b,c,e){D(d.$onChanges)&&c!==e&&($||(a.$$postDigest(I),$=[]),l||(l={},$.push(h)),l[b]&&(e=l[b].previousValue),l[b]={previousValue:e,currentValue:c})}function h(){d.$onChanges(l);l=u}var k=[],l;q(e,function(e,h){var l=e.attrName,m=e.optional,n,r,p,G;switch(e.mode){case "@":m||va.call(c,l)||(d[h]=c[l]=void 0);c.$observe(l,function(a){y(a)&&(g(h,a,d[h]),d[h]=a)});c.$$observers[l].$$scope=a;n=c[l];y(n)?
d[h]=b(n)(a):Oa(n)&&(d[h]=n);break;case "=":if(!va.call(c,l)){if(m)break;c[l]=void 0}if(m&&!c[l])break;r=v(c[l]);G=r.literal?na:function(a,b){return a===b||a!==a&&b!==b};p=r.assign||function(){n=d[h]=r(a);throw ga("nonassign",c[l],l,f.name);};n=d[h]=r(a);m=function(b){G(b,d[h])||(G(b,n)?p(a,b=d[h]):d[h]=b);return n=b};m.$stateful=!0;m=e.collection?a.$watchCollection(c[l],m):a.$watch(v(c[l],m),null,r.literal);k.push(m);break;case "<":if(!va.call(c,l)){if(m)break;c[l]=void 0}if(m&&!c[l])break;r=v(c[l]);
d[h]=r(a);m=a.$watch(r,function(a){g(h,a,d[h]);d[h]=a},r.literal);k.push(m);break;case "&":r=c.hasOwnProperty(l)?v(c[l]):E;if(r===E&&m)break;d[h]=function(b){return r(a,b)}}});return k.length&&function(){for(var a=0,b=k.length;a<b;++a)k[a]()}}var ma=/^\w/,la=P.createElement("div"),pa=p,$;qa.prototype={$normalize:ya,$addClass:function(a){a&&0<a.length&&C.addClass(this.$$element,a)},$removeClass:function(a){a&&0<a.length&&C.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=Zc(a,b);c&&
c.length&&C.addClass(this.$$element,c);(c=Zc(b,a))&&c.length&&C.removeClass(this.$$element,c)},$set:function(a,b,d,e){var f=Rc(this.$$element[0],a),g=$c[a],h=a;f?(this.$$element.prop(a,b),e=f):g&&(this[g]=b,h=g);this[a]=b;e?this.$attr[a]=e:(e=this.$attr[a])||(this.$attr[a]=e=zc(a,"-"));f=oa(this.$$element);if("a"===f&&("href"===a||"xlinkHref"===a)||"img"===f&&"src"===a)this[a]=b=K(b,"src"===a);else if("img"===f&&"srcset"===a){for(var f="",g=W(b),k=/(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/,k=/\s/.test(g)?
k:/(,)/,g=g.split(k),k=Math.floor(g.length/2),l=0;l<k;l++)var m=2*l,f=f+K(W(g[m]),!0),f=f+(" "+W(g[m+1]));g=W(g[2*l]).split(/\s/);f+=K(W(g[0]),!0);2===g.length&&(f+=" "+W(g[1]));this[a]=b=f}!1!==d&&(null===b||z(b)?this.$$element.removeAttr(e):ma.test(e)?this.$$element.attr(e,b):Ca(this.$$element[0],e,b));(a=this.$$observers)&&q(a[h],function(a){try{a(b)}catch(d){c(d)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers=V()),e=d[a]||(d[a]=[]);e.push(b);t.$evalAsync(function(){e.$$inter||
!c.hasOwnProperty(a)||z(c[a])||b(c[a])});return function(){bb(e,b)}}};var sa=b.startSymbol(),ta=b.endSymbol(),ua="{{"==sa&&"}}"==ta?$a:function(a){return a.replace(/\{\{/g,sa).replace(/}}/g,ta)},za=/^ngAttr[A-Z]/,Ba=/^(.+)Start$/;ba.$$addBindingInfo=n?function(a,b){var c=a.data("$binding")||[];M(b)?c=c.concat(b):c.push(b);a.data("$binding",c)}:E;ba.$$addBindingClass=n?function(a){B(a,"ng-binding")}:E;ba.$$addScopeInfo=n?function(a,b,c,d){a.data(c?d?"$isolateScopeNoTemplate":"$isolateScope":"$scope",
b)}:E;ba.$$addScopeClass=n?function(a,b){B(a,b?"ng-isolate-scope":"ng-scope")}:E;ba.$$createComment=function(a,b){var c="";n&&(c=" "+(a||"")+": "+(b||"")+" ");return P.createComment(c)};return ba}]}function ya(a){return fb(a.replace(Vc,""))}function Zc(a,b){var d="",c=a.split(/\s+/),e=b.split(/\s+/),f=0;a:for(;f<c.length;f++){for(var g=c[f],h=0;h<e.length;h++)if(g==e[h])continue a;d+=(0<d.length?" ":"")+g}return d}function Xc(a){a=H(a);var b=a.length;if(1>=b)return a;for(;b--;)8===a[b].nodeType&&
Yf.call(a,b,1);return a}function Uc(a,b){if(b&&y(b))return b;if(y(a)){var d=ad.exec(a);if(d)return d[3]}}function df(){var a={},b=!1;this.has=function(b){return a.hasOwnProperty(b)};this.register=function(b,c){Ta(b,"controller");J(b)?S(a,b):a[b]=c};this.allowGlobals=function(){b=!0};this.$get=["$injector","$window",function(d,c){function e(a,b,c,d){if(!a||!J(a.$scope))throw O("$controller")("noscp",d,b);a.$scope[b]=c}return function(f,g,h,k){var l,m,n;h=!0===h;k&&y(k)&&(n=k);if(y(f)){k=f.match(ad);
if(!k)throw Zf("ctrlfmt",f);m=k[1];n=n||k[3];f=a.hasOwnProperty(m)?a[m]:Bc(g.$scope,m,!0)||(b?Bc(c,m,!0):u);Sa(f,m,!0)}if(h)return h=(M(f)?f[f.length-1]:f).prototype,l=Object.create(h||null),n&&e(g,n,l,m||f.name),S(function(){var a=d.invoke(f,l,g,m);a!==l&&(J(a)||D(a))&&(l=a,n&&e(g,n,l,m||f.name));return l},{instance:l,identifier:n});l=d.instantiate(f,g,m);n&&e(g,n,l,m||f.name);return l}}]}function ef(){this.$get=["$window",function(a){return H(a.document)}]}function ff(){this.$get=["$log",function(a){return function(b,
d){a.error.apply(a,arguments)}}]}function $b(a){return J(a)?fa(a)?a.toISOString():db(a):a}function lf(){this.$get=function(){return function(a){if(!a)return"";var b=[];pc(a,function(a,c){null===a||z(a)||(M(a)?q(a,function(a){b.push(ja(c)+"="+ja($b(a)))}):b.push(ja(c)+"="+ja($b(a))))});return b.join("&")}}}function mf(){this.$get=function(){return function(a){function b(a,e,f){null===a||z(a)||(M(a)?q(a,function(a,c){b(a,e+"["+(J(a)?c:"")+"]")}):J(a)&&!fa(a)?pc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?
"":"]"))}):d.push(ja(e)+"="+ja($b(a))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function ac(a,b){if(y(a)){var d=a.replace($f,"").trim();if(d){var c=b("Content-Type");(c=c&&0===c.indexOf(bd))||(c=(c=d.match(ag))&&bg[c[0]].test(d));c&&(a=uc(d))}}return a}function cd(a){var b=V(),d;y(a)?q(a.split("\n"),function(a){d=a.indexOf(":");var e=N(W(a.substr(0,d)));a=W(a.substr(d+1));e&&(b[e]=b[e]?b[e]+", "+a:a)}):J(a)&&q(a,function(a,d){var f=N(d),g=W(a);f&&(b[f]=b[f]?b[f]+", "+g:g)});return b}
function dd(a){var b;return function(d){b||(b=cd(a));return d?(d=b[N(d)],void 0===d&&(d=null),d):b}}function ed(a,b,d,c){if(D(c))return c(a,b,d);q(c,function(c){a=c(a,b,d)});return a}function kf(){var a=this.defaults={transformResponse:[ac],transformRequest:[function(a){return J(a)&&"[object File]"!==ka.call(a)&&"[object Blob]"!==ka.call(a)&&"[object FormData]"!==ka.call(a)?db(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ia(bc),put:ia(bc),patch:ia(bc)},xsrfCookieName:"XSRF-TOKEN",
xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer"},b=!1;this.useApplyAsync=function(a){return A(a)?(b=!!a,this):b};var d=!0;this.useLegacyPromiseExtensions=function(a){return A(a)?(d=!!a,this):d};var c=this.interceptors=[];this.$get=["$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector",function(e,f,g,h,k,l){function m(b){function c(a){var b=S({},a);b.data=ed(a.data,a.headers,a.status,f.transformResponse);a=a.status;return 200<=a&&300>a?b:k.reject(b)}function e(a,
b){var c,d={};q(a,function(a,e){D(a)?(c=a(b),null!=c&&(d[e]=c)):d[e]=a});return d}if(!J(b))throw O("$http")("badreq",b);if(!y(b.url))throw O("$http")("badreq",b.url);var f=S({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer},b);f.headers=function(b){var c=a.headers,d=S({},b.headers),f,g,h,c=S({},c.common,c[N(b.method)]);a:for(f in c){g=N(f);for(h in d)if(N(h)===g)continue a;d[f]=c[f]}return e(d,ia(b))}(b);f.method=vb(f.method);
f.paramSerializer=y(f.paramSerializer)?l.get(f.paramSerializer):f.paramSerializer;var g=[function(b){var d=b.headers,e=ed(b.data,dd(d),u,b.transformRequest);z(e)&&q(d,function(a,b){"content-type"===N(b)&&delete d[b]});z(b.withCredentials)&&!z(a.withCredentials)&&(b.withCredentials=a.withCredentials);return n(b,e).then(c,c)},u],h=k.when(f);for(q(L,function(a){(a.request||a.requestError)&&g.unshift(a.request,a.requestError);(a.response||a.responseError)&&g.push(a.response,a.responseError)});g.length;){b=
g.shift();var m=g.shift(),h=h.then(b,m)}d?(h.success=function(a){Sa(a,"fn");h.then(function(b){a(b.data,b.status,b.headers,f)});return h},h.error=function(a){Sa(a,"fn");h.then(null,function(b){a(b.data,b.status,b.headers,f)});return h}):(h.success=fd("success"),h.error=fd("error"));return h}function n(c,d){function g(a,c,d,e){function f(){l(c,a,d,e)}K&&(200<=a&&300>a?K.put(L,[a,c,cd(d),e]):K.remove(L));b?h.$applyAsync(f):(f(),h.$$phase||h.$apply())}function l(a,b,d,e){b=-1<=b?b:0;(200<=b&&300>b?G.resolve:
G.reject)({data:a,status:b,headers:dd(d),config:c,statusText:e})}function n(a){l(a.data,a.status,ia(a.headers()),a.statusText)}function t(){var a=m.pendingRequests.indexOf(c);-1!==a&&m.pendingRequests.splice(a,1)}var G=k.defer(),C=G.promise,K,I,qa=c.headers,L=p(c.url,c.paramSerializer(c.params));m.pendingRequests.push(c);C.then(t,t);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(K=J(c.cache)?c.cache:J(a.cache)?a.cache:F);K&&(I=K.get(L),A(I)?I&&D(I.then)?I.then(n,n):M(I)?
l(I[1],I[0],ia(I[2]),I[3]):l(I,200,{},"OK"):K.put(L,C));z(I)&&((I=gd(c.url)?f()[c.xsrfCookieName||a.xsrfCookieName]:u)&&(qa[c.xsrfHeaderName||a.xsrfHeaderName]=I),e(c.method,L,d,g,qa,c.timeout,c.withCredentials,c.responseType));return C}function p(a,b){0<b.length&&(a+=(-1==a.indexOf("?")?"?":"&")+b);return a}var F=g("$http");a.paramSerializer=y(a.paramSerializer)?l.get(a.paramSerializer):a.paramSerializer;var L=[];q(c,function(a){L.unshift(y(a)?l.get(a):l.invoke(a))});m.pendingRequests=[];(function(a){q(arguments,
function(a){m[a]=function(b,c){return m(S({},c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){q(arguments,function(a){m[a]=function(b,c,d){return m(S({},d||{},{method:a,url:b,data:c}))}})})("post","put","patch");m.defaults=a;return m}]}function of(){this.$get=function(){return function(){return new T.XMLHttpRequest}}}function nf(){this.$get=["$browser","$window","$document","$xhrFactory",function(a,b,d,c){return cg(a,c,a.defer,b.angular.callbacks,d[0])}]}function cg(a,b,d,
c,e){function f(a,b,d){var f=e.createElement("script"),m=null;f.type="text/javascript";f.src=a;f.async=!0;m=function(a){f.removeEventListener("load",m,!1);f.removeEventListener("error",m,!1);e.body.removeChild(f);f=null;var g=-1,F="unknown";a&&("load"!==a.type||c[b].called||(a={type:"error"}),F=a.type,g="error"===a.type?404:200);d&&d(g,F)};f.addEventListener("load",m,!1);f.addEventListener("error",m,!1);e.body.appendChild(f);return m}return function(e,h,k,l,m,n,p,F){function L(){w&&w();v&&v.abort()}
function x(b,c,e,f,g){A(t)&&d.cancel(t);w=v=null;b(c,e,f,g);a.$$completeOutstandingRequest(E)}a.$$incOutstandingRequestCount();h=h||a.url();if("jsonp"==N(e)){var r="_"+(c.counter++).toString(36);c[r]=function(a){c[r].data=a;c[r].called=!0};var w=f(h.replace("JSON_CALLBACK","angular.callbacks."+r),r,function(a,b){x(l,a,c[r].data,"",b);c[r]=E})}else{var v=b(e,h);v.open(e,h,!0);q(m,function(a,b){A(a)&&v.setRequestHeader(b,a)});v.onload=function(){var a=v.statusText||"",b="response"in v?v.response:v.responseText,
c=1223===v.status?204:v.status;0===c&&(c=b?200:"file"==sa(h).protocol?404:0);x(l,c,b,v.getAllResponseHeaders(),a)};e=function(){x(l,-1,null,null,"")};v.onerror=e;v.onabort=e;p&&(v.withCredentials=!0);if(F)try{v.responseType=F}catch(Q){if("json"!==F)throw Q;}v.send(z(k)?null:k)}if(0<n)var t=d(L,n);else n&&D(n.then)&&n.then(L)}}function hf(){var a="{{",b="}}";this.startSymbol=function(b){return b?(a=b,this):a};this.endSymbol=function(a){return a?(b=a,this):b};this.$get=["$parse","$exceptionHandler",
"$sce",function(d,c,e){function f(a){return"\\\\\\"+a}function g(c){return c.replace(n,a).replace(p,b)}function h(a,b,c,d){var e;return e=a.$watch(function(a){e();return d(a)},b,c)}function k(f,k,n,r){function p(a){try{var b=a;a=n?e.getTrusted(n,b):e.valueOf(b);var d;if(r&&!A(a))d=a;else if(null==a)d="";else{switch(typeof a){case "string":break;case "number":a=""+a;break;default:a=db(a)}d=a}return d}catch(g){c(La.interr(f,g))}}if(!f.length||-1===f.indexOf(a)){var v;k||(k=g(f),v=da(k),v.exp=f,v.expressions=
[],v.$$watchDelegate=h);return v}r=!!r;var q,t,G=0,C=[],K=[];v=f.length;for(var I=[],qa=[];G<v;)if(-1!=(q=f.indexOf(a,G))&&-1!=(t=f.indexOf(b,q+l)))G!==q&&I.push(g(f.substring(G,q))),G=f.substring(q+l,t),C.push(G),K.push(d(G,p)),G=t+m,qa.push(I.length),I.push("");else{G!==v&&I.push(g(f.substring(G)));break}n&&1<I.length&&La.throwNoconcat(f);if(!k||C.length){var Ca=function(a){for(var b=0,c=C.length;b<c;b++){if(r&&z(a[b]))return;I[qa[b]]=a[b]}return I.join("")};return S(function(a){var b=0,d=C.length,
e=Array(d);try{for(;b<d;b++)e[b]=K[b](a);return Ca(e)}catch(g){c(La.interr(f,g))}},{exp:f,expressions:C,$$watchDelegate:function(a,b){var c;return a.$watchGroup(K,function(d,e){var f=Ca(d);D(b)&&b.call(this,f,d!==e?c:f,a);c=f})}})}}var l=a.length,m=b.length,n=new RegExp(a.replace(/./g,f),"g"),p=new RegExp(b.replace(/./g,f),"g");k.startSymbol=function(){return a};k.endSymbol=function(){return b};return k}]}function jf(){this.$get=["$rootScope","$window","$q","$$q","$browser",function(a,b,d,c,e){function f(f,
k,l,m){function n(){p?f.apply(null,F):f(r)}var p=4<arguments.length,F=p?Aa.call(arguments,4):[],q=b.setInterval,x=b.clearInterval,r=0,w=A(m)&&!m,v=(w?c:d).defer(),Q=v.promise;l=A(l)?l:0;Q.$$intervalId=q(function(){w?e.defer(n):a.$evalAsync(n);v.notify(r++);0<l&&r>=l&&(v.resolve(r),x(Q.$$intervalId),delete g[Q.$$intervalId]);w||a.$apply()},k);g[Q.$$intervalId]=v;return Q}var g={};f.cancel=function(a){return a&&a.$$intervalId in g?(g[a.$$intervalId].reject("canceled"),b.clearInterval(a.$$intervalId),
delete g[a.$$intervalId],!0):!1};return f}]}function cc(a){a=a.split("/");for(var b=a.length;b--;)a[b]=rb(a[b]);return a.join("/")}function hd(a,b){var d=sa(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=Y(d.port)||dg[d.protocol]||null}function id(a,b){var d="/"!==a.charAt(0);d&&(a="/"+a);var c=sa(a);b.$$path=decodeURIComponent(d&&"/"===c.pathname.charAt(0)?c.pathname.substring(1):c.pathname);b.$$search=xc(c.search);b.$$hash=decodeURIComponent(c.hash);b.$$path&&"/"!=b.$$path.charAt(0)&&(b.$$path=
"/"+b.$$path)}function la(a,b){if(0===b.indexOf(a))return b.substr(a.length)}function Ka(a){var b=a.indexOf("#");return-1==b?a:a.substr(0,b)}function kb(a){return a.replace(/(#.+)|#$/,"$1")}function dc(a,b,d){this.$$html5=!0;d=d||"";hd(a,this);this.$$parse=function(a){var d=la(b,a);if(!y(d))throw Fb("ipthprfx",a,b);id(d,this);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Sb(this.$$search),d=this.$$hash?"#"+rb(this.$$hash):"";this.$$url=cc(this.$$path)+(a?"?"+a:"")+
d;this.$$absUrl=b+this.$$url.substr(1)};this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;A(f=la(a,c))?(g=f,g=A(f=la(d,f))?b+(la("/",f)||f):a+g):A(f=la(b,c))?g=b+f:b==c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function ec(a,b,d){hd(a,this);this.$$parse=function(c){var e=la(a,c)||la(b,c),f;z(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",z(e)&&(a=c,this.replace())):(f=la(d,e),z(f)&&(f=e));id(f,this);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;0===f.indexOf(e)&&
(f=f.replace(e,""));g.exec(f)||(c=(f=g.exec(c))?f[1]:c);this.$$path=c;this.$$compose()};this.$$compose=function(){var b=Sb(this.$$search),e=this.$$hash?"#"+rb(this.$$hash):"";this.$$url=cc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+(this.$$url?d+this.$$url:"")};this.$$parseLinkUrl=function(b,d){return Ka(a)==Ka(b)?(this.$$parse(b),!0):!1}}function jd(a,b,d){this.$$html5=!0;ec.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a==Ka(c)?
f=c:(g=la(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$compose=function(){var b=Sb(this.$$search),e=this.$$hash?"#"+rb(this.$$hash):"";this.$$url=cc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+d+this.$$url}}function Gb(a){return function(){return this[a]}}function kd(a,b){return function(d){if(z(d))return this[a];this[a]=b(d);this.$$compose();return this}}function pf(){var a="",b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return A(b)?(a=b,this):
a};this.html5Mode=function(a){return Oa(a)?(b.enabled=a,this):J(a)?(Oa(a.enabled)&&(b.enabled=a.enabled),Oa(a.requireBase)&&(b.requireBase=a.requireBase),Oa(a.rewriteLinks)&&(b.rewriteLinks=a.rewriteLinks),this):b};this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(d,c,e,f,g){function h(a,b,d){var e=l.url(),f=l.$$state;try{c.url(a,b,d),l.$$state=c.state()}catch(g){throw l.url(e),l.$$state=f,g;}}function k(a,b){d.$broadcast("$locationChangeSuccess",l.absUrl(),a,l.$$state,
b)}var l,m;m=c.baseHref();var n=c.url(),p;if(b.enabled){if(!m&&b.requireBase)throw Fb("nobase");p=n.substring(0,n.indexOf("/",n.indexOf("//")+2))+(m||"/");m=e.history?dc:jd}else p=Ka(n),m=ec;var F=p.substr(0,Ka(p).lastIndexOf("/")+1);l=new m(p,F,"#"+a);l.$$parseLinkUrl(n,n);l.$$state=c.state();var q=/^\s*(javascript|mailto):/i;f.on("click",function(a){if(b.rewriteLinks&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&&2!=a.which&&2!=a.button){for(var e=H(a.target);"a"!==oa(e[0]);)if(e[0]===f[0]||!(e=e.parent())[0])return;
var h=e.prop("href"),k=e.attr("href")||e.attr("xlink:href");J(h)&&"[object SVGAnimatedString]"===h.toString()&&(h=sa(h.animVal).href);q.test(h)||!h||e.attr("target")||a.isDefaultPrevented()||!l.$$parseLinkUrl(h,k)||(a.preventDefault(),l.absUrl()!=c.url()&&(d.$apply(),g.angular["ff-684208-preventDefault"]=!0))}});kb(l.absUrl())!=kb(n)&&c.url(l.absUrl(),!0);var x=!0;c.onUrlChange(function(a,b){z(la(F,a))?g.location.href=a:(d.$evalAsync(function(){var c=l.absUrl(),e=l.$$state,f;a=kb(a);l.$$parse(a);
l.$$state=b;f=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;l.absUrl()===a&&(f?(l.$$parse(c),l.$$state=e,h(c,!1,e)):(x=!1,k(c,e)))}),d.$$phase||d.$digest())});d.$watch(function(){var a=kb(c.url()),b=kb(l.absUrl()),f=c.state(),g=l.$$replace,m=a!==b||l.$$html5&&e.history&&f!==l.$$state;if(x||m)x=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,l.$$state,f).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=f):(m&&h(b,g,f===l.$$state?null:
l.$$state),k(a,f)))});l.$$replace=!1});return l}]}function qf(){var a=!0,b=this;this.debugEnabled=function(b){return A(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=d.console||{},e=b[a]||b.log||E;a=!1;try{a=!!e.apply}catch(k){}return a?function(){var a=[];q(arguments,function(b){a.push(c(b))});
return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){a&&c.apply(b,arguments)}}()}}]}function Wa(a,b){if("__defineGetter__"===a||"__defineSetter__"===a||"__lookupGetter__"===a||"__lookupSetter__"===a||"__proto__"===a)throw ca("isecfld",b);return a}function eg(a){return a+""}function ta(a,b){if(a){if(a.constructor===a)throw ca("isecfn",b);if(a.window===a)throw ca("isecwindow",b);if(a.children&&
(a.nodeName||a.prop&&a.attr&&a.find))throw ca("isecdom",b);if(a===Object)throw ca("isecobj",b);}return a}function ld(a,b){if(a){if(a.constructor===a)throw ca("isecfn",b);if(a===fg||a===gg||a===hg)throw ca("isecff",b);}}function Hb(a,b){if(a&&(a===(0).constructor||a===(!1).constructor||a==="".constructor||a==={}.constructor||a===[].constructor||a===Function.constructor))throw ca("isecaf",b);}function ig(a,b){return"undefined"!==typeof a?a:b}function md(a,b){return"undefined"===typeof a?b:"undefined"===
typeof b?a:a+b}function aa(a,b){var d,c;switch(a.type){case s.Program:d=!0;q(a.body,function(a){aa(a.expression,b);d=d&&a.expression.constant});a.constant=d;break;case s.Literal:a.constant=!0;a.toWatch=[];break;case s.UnaryExpression:aa(a.argument,b);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;break;case s.BinaryExpression:aa(a.left,b);aa(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.left.toWatch.concat(a.right.toWatch);break;case s.LogicalExpression:aa(a.left,
b);aa(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case s.ConditionalExpression:aa(a.test,b);aa(a.alternate,b);aa(a.consequent,b);a.constant=a.test.constant&&a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case s.Identifier:a.constant=!1;a.toWatch=[a];break;case s.MemberExpression:aa(a.object,b);a.computed&&aa(a.property,b);a.constant=a.object.constant&&(!a.computed||a.property.constant);a.toWatch=[a];break;case s.CallExpression:d=
a.filter?!b(a.callee.name).$stateful:!1;c=[];q(a.arguments,function(a){aa(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=a.filter&&!b(a.callee.name).$stateful?c:[a];break;case s.AssignmentExpression:aa(a.left,b);aa(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=[a];break;case s.ArrayExpression:d=!0;c=[];q(a.elements,function(a){aa(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=c;break;case s.ObjectExpression:d=
!0;c=[];q(a.properties,function(a){aa(a.value,b);d=d&&a.value.constant;a.value.constant||c.push.apply(c,a.value.toWatch)});a.constant=d;a.toWatch=c;break;case s.ThisExpression:a.constant=!1;a.toWatch=[];break;case s.LocalsExpression:a.constant=!1,a.toWatch=[]}}function nd(a){if(1==a.length){a=a[0].expression;var b=a.toWatch;return 1!==b.length?b:b[0]!==a?b:u}}function od(a){return a.type===s.Identifier||a.type===s.MemberExpression}function pd(a){if(1===a.body.length&&od(a.body[0].expression))return{type:s.AssignmentExpression,
left:a.body[0].expression,right:{type:s.NGValueParameter},operator:"="}}function qd(a){return 0===a.body.length||1===a.body.length&&(a.body[0].expression.type===s.Literal||a.body[0].expression.type===s.ArrayExpression||a.body[0].expression.type===s.ObjectExpression)}function rd(a,b){this.astBuilder=a;this.$filter=b}function sd(a,b){this.astBuilder=a;this.$filter=b}function Ib(a){return"constructor"==a}function fc(a){return D(a.valueOf)?a.valueOf():jg.call(a)}function rf(){var a=V(),b=V(),d={"true":!0,
"false":!1,"null":null,undefined:u};this.addLiteral=function(a,b){d[a]=b};this.$get=["$filter",function(c){function e(d,e,g){var p,t,G;g=g||x;switch(typeof d){case "string":G=d=d.trim();var C=g?b:a;p=C[G];if(!p){":"===d.charAt(0)&&":"===d.charAt(1)&&(t=!0,d=d.substring(2));p=g?L:F;var K=new gc(p);p=(new hc(K,c,p)).parse(d);p.constant?p.$$watchDelegate=m:t?p.$$watchDelegate=p.literal?l:k:p.inputs&&(p.$$watchDelegate=h);g&&(p=f(p));C[G]=p}return n(p,e);case "function":return n(d,e);default:return n(E,
e)}}function f(a){function b(c,d,e,f){var g=x;x=!0;try{return a(c,d,e,f)}finally{x=g}}if(!a)return a;b.$$watchDelegate=a.$$watchDelegate;b.assign=f(a.assign);b.constant=a.constant;b.literal=a.literal;for(var c=0;a.inputs&&c<a.inputs.length;++c)a.inputs[c]=f(a.inputs[c]);b.inputs=a.inputs;return b}function g(a,b){return null==a||null==b?a===b:"object"===typeof a&&(a=fc(a),"object"===typeof a)?!1:a===b||a!==a&&b!==b}function h(a,b,c,d,e){var f=d.inputs,h;if(1===f.length){var k=g,f=f[0];return a.$watch(function(a){var b=
f(a);g(b,k)||(h=d(a,u,u,[b]),k=b&&fc(b));return h},b,c,e)}for(var l=[],m=[],n=0,p=f.length;n<p;n++)l[n]=g,m[n]=null;return a.$watch(function(a){for(var b=!1,c=0,e=f.length;c<e;c++){var k=f[c](a);if(b||(b=!g(k,l[c])))m[c]=k,l[c]=k&&fc(k)}b&&(h=d(a,u,u,m));return h},b,c,e)}function k(a,b,c,d){var e,f;return e=a.$watch(function(a){return d(a)},function(a,c,d){f=a;D(b)&&b.apply(this,arguments);A(a)&&d.$$postDigest(function(){A(f)&&e()})},c)}function l(a,b,c,d){function e(a){var b=!0;q(a,function(a){A(a)||
(b=!1)});return b}var f,g;return f=a.$watch(function(a){return d(a)},function(a,c,d){g=a;D(b)&&b.call(this,a,c,d);e(a)&&d.$$postDigest(function(){e(g)&&f()})},c)}function m(a,b,c,d){var e;return e=a.$watch(function(a){e();return d(a)},b,c)}function n(a,b){if(!b)return a;var c=a.$$watchDelegate,d=!1,c=c!==l&&c!==k?function(c,e,f,g){f=d&&g?g[0]:a(c,e,f,g);return b(f,c,e)}:function(c,d,e,f){e=a(c,d,e,f);c=b(e,c,d);return A(e)?c:e};a.$$watchDelegate&&a.$$watchDelegate!==h?c.$$watchDelegate=a.$$watchDelegate:
b.$stateful||(c.$$watchDelegate=h,d=!a.inputs,c.inputs=a.inputs?a.inputs:[a]);return c}var p=Ga().noUnsafeEval,F={csp:p,expensiveChecks:!1,literals:pa(d)},L={csp:p,expensiveChecks:!0,literals:pa(d)},x=!1;e.$$runningExpensiveChecks=function(){return x};return e}]}function tf(){this.$get=["$rootScope","$exceptionHandler",function(a,b){return td(function(b){a.$evalAsync(b)},b)}]}function uf(){this.$get=["$browser","$exceptionHandler",function(a,b){return td(function(b){a.defer(b)},b)}]}function td(a,
b){function d(){this.$$state={status:0}}function c(a,b){return function(c){b.call(a,c)}}function e(c){!c.processScheduled&&c.pending&&(c.processScheduled=!0,a(function(){var a,d,e;e=c.pending;c.processScheduled=!1;c.pending=u;for(var f=0,g=e.length;f<g;++f){d=e[f][0];a=e[f][c.status];try{D(a)?d.resolve(a(c.value)):1===c.status?d.resolve(c.value):d.reject(c.value)}catch(h){d.reject(h),b(h)}}}))}function f(){this.promise=new d}var g=O("$q",TypeError);S(d.prototype,{then:function(a,b,c){if(z(a)&&z(b)&&
z(c))return this;var d=new f;this.$$state.pending=this.$$state.pending||[];this.$$state.pending.push([d,a,b,c]);0<this.$$state.status&&e(this.$$state);return d.promise},"catch":function(a){return this.then(null,a)},"finally":function(a,b){return this.then(function(b){return k(b,!0,a)},function(b){return k(b,!1,a)},b)}});S(f.prototype,{resolve:function(a){this.promise.$$state.status||(a===this.promise?this.$$reject(g("qcycle",a)):this.$$resolve(a))},$$resolve:function(a){function d(a){k||(k=!0,h.$$resolve(a))}
function f(a){k||(k=!0,h.$$reject(a))}var g,h=this,k=!1;try{if(J(a)||D(a))g=a&&a.then;D(g)?(this.promise.$$state.status=-1,g.call(a,d,f,c(this,this.notify))):(this.promise.$$state.value=a,this.promise.$$state.status=1,e(this.promise.$$state))}catch(l){f(l),b(l)}},reject:function(a){this.promise.$$state.status||this.$$reject(a)},$$reject:function(a){this.promise.$$state.value=a;this.promise.$$state.status=2;e(this.promise.$$state)},notify:function(c){var d=this.promise.$$state.pending;0>=this.promise.$$state.status&&
d&&d.length&&a(function(){for(var a,e,f=0,g=d.length;f<g;f++){e=d[f][0];a=d[f][3];try{e.notify(D(a)?a(c):c)}catch(h){b(h)}}})}});var h=function(a,b){var c=new f;b?c.resolve(a):c.reject(a);return c.promise},k=function(a,b,c){var d=null;try{D(c)&&(d=c())}catch(e){return h(e,!1)}return d&&D(d.then)?d.then(function(){return h(a,b)},function(a){return h(a,!1)}):h(a,b)},l=function(a,b,c,d){var e=new f;e.resolve(a);return e.promise.then(b,c,d)},m=function(a){if(!D(a))throw g("norslvr",a);var b=new f;a(function(a){b.resolve(a)},
function(a){b.reject(a)});return b.promise};m.prototype=d.prototype;m.defer=function(){var a=new f;a.resolve=c(a,a.resolve);a.reject=c(a,a.reject);a.notify=c(a,a.notify);return a};m.reject=function(a){var b=new f;b.reject(a);return b.promise};m.when=l;m.resolve=l;m.all=function(a){var b=new f,c=0,d=M(a)?[]:{};q(a,function(a,e){c++;l(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||b.reject(a)})});0===c&&b.resolve(d);return b.promise};return m}function Df(){this.$get=
["$window","$timeout",function(a,b){var d=a.requestAnimationFrame||a.webkitRequestAnimationFrame,c=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.webkitCancelRequestAnimationFrame,e=!!d,f=e?function(a){var b=d(a);return function(){c(b)}}:function(a){var c=b(a,16.66,!1);return function(){b.cancel(c)}};f.supported=e;return f}]}function sf(){function a(a){function b(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=
0;this.$id=++qb;this.$$ChildScope=null}b.prototype=a;return b}var b=10,d=O("$rootScope"),c=null,e=null;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$exceptionHandler","$parse","$browser",function(f,g,h){function k(a){a.currentScope.$$destroyed=!0}function l(a){9===Da&&(a.$$childHead&&l(a.$$childHead),a.$$nextSibling&&l(a.$$nextSibling));a.$parent=a.$$nextSibling=a.$$prevSibling=a.$$childHead=a.$$childTail=a.$root=a.$$watchers=null}function m(){this.$id=++qb;this.$$phase=
this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this.$root=this;this.$$destroyed=!1;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=0;this.$$isolateBindings=null}function n(a){if(w.$$phase)throw d("inprog",w.$$phase);w.$$phase=a}function p(a,b){do a.$$watchersCount+=b;while(a=a.$parent)}function F(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&delete a.$$listenerCount[c];while(a=a.$parent)}function s(){}function x(){for(;t.length;)try{t.shift()()}catch(a){f(a)}e=
null}function r(){null===e&&(e=h.defer(function(){w.$apply(x)}))}m.prototype={constructor:m,$new:function(b,c){var d;c=c||this;b?(d=new m,d.$root=this.$root):(this.$$ChildScope||(this.$$ChildScope=a(this)),d=new this.$$ChildScope);d.$parent=c;d.$$prevSibling=c.$$childTail;c.$$childHead?(c.$$childTail.$$nextSibling=d,c.$$childTail=d):c.$$childHead=c.$$childTail=d;(b||c!=this)&&d.$on("$destroy",k);return d},$watch:function(a,b,d,e){var f=g(a);if(f.$$watchDelegate)return f.$$watchDelegate(this,b,d,f,
a);var h=this,k=h.$$watchers,l={fn:b,last:s,get:f,exp:e||a,eq:!!d};c=null;D(b)||(l.fn=E);k||(k=h.$$watchers=[]);k.unshift(l);p(this,1);return function(){0<=bb(k,l)&&p(h,-1);c=null}},$watchGroup:function(a,b){function c(){h=!1;k?(k=!1,b(e,e,g)):b(e,d,g)}var d=Array(a.length),e=Array(a.length),f=[],g=this,h=!1,k=!0;if(!a.length){var l=!0;g.$evalAsync(function(){l&&b(e,e,g)});return function(){l=!1}}if(1===a.length)return this.$watch(a[0],function(a,c,f){e[0]=a;d[0]=c;b(e,a===c?e:d,f)});q(a,function(a,
b){var k=g.$watch(a,function(a,f){e[b]=a;d[b]=f;h||(h=!0,g.$evalAsync(c))});f.push(k)});return function(){for(;f.length;)f.shift()()}},$watchCollection:function(a,b){function c(a){e=a;var b,d,g,h;if(!z(e)){if(J(e))if(za(e))for(f!==n&&(f=n,v=f.length=0,l++),a=e.length,v!==a&&(l++,f.length=v=a),b=0;b<a;b++)h=f[b],g=e[b],d=h!==h&&g!==g,d||h===g||(l++,f[b]=g);else{f!==p&&(f=p={},v=0,l++);a=0;for(b in e)va.call(e,b)&&(a++,g=e[b],h=f[b],b in f?(d=h!==h&&g!==g,d||h===g||(l++,f[b]=g)):(v++,f[b]=g,l++));if(v>
a)for(b in l++,f)va.call(e,b)||(v--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$stateful=!0;var d=this,e,f,h,k=1<b.length,l=0,m=g(a,c),n=[],p={},r=!0,v=0;return this.$watch(m,function(){r?(r=!1,b(e,e,d)):b(e,h,d);if(k)if(J(e))if(za(e)){h=Array(e.length);for(var a=0;a<e.length;a++)h[a]=e[a]}else for(a in h={},e)va.call(e,a)&&(h[a]=e[a]);else h=e})},$digest:function(){var a,g,k,l,m,p,r,q,t=b,F,A=[],z,y;n("$digest");h.$$checkUrlChange();this===w&&null!==e&&(h.defer.cancel(e),x());c=null;do{q=!1;
for(F=this;v.length;){try{y=v.shift(),y.scope.$eval(y.expression,y.locals)}catch(E){f(E)}c=null}a:do{if(p=F.$$watchers)for(r=p.length;r--;)try{if(a=p[r])if(m=a.get,(g=m(F))!==(k=a.last)&&!(a.eq?na(g,k):"number"===typeof g&&"number"===typeof k&&isNaN(g)&&isNaN(k)))q=!0,c=a,a.last=a.eq?pa(g,null):g,l=a.fn,l(g,k===s?g:k,F),5>t&&(z=4-t,A[z]||(A[z]=[]),A[z].push({msg:D(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:g,oldVal:k}));else if(a===c){q=!1;break a}}catch(H){f(H)}if(!(p=F.$$watchersCount&&
F.$$childHead||F!==this&&F.$$nextSibling))for(;F!==this&&!(p=F.$$nextSibling);)F=F.$parent}while(F=p);if((q||v.length)&&!t--)throw w.$$phase=null,d("infdig",b,A);}while(q||v.length);for(w.$$phase=null;u.length;)try{u.shift()()}catch(J){f(J)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this===w&&h.$$applicationDestroyed();p(this,-this.$$watchersCount);for(var b in this.$$listenerCount)F(this,this.$$listenerCount[b],b);a&&a.$$childHead==
this&&(a.$$childHead=this.$$nextSibling);a&&a.$$childTail==this&&(a.$$childTail=this.$$prevSibling);this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=E;this.$on=this.$watch=this.$watchGroup=function(){return E};this.$$listeners={};this.$$nextSibling=null;l(this)}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a,b){w.$$phase||
v.length||h.defer(function(){v.length&&w.$digest()});v.push({scope:this,expression:g(a),locals:b})},$$postDigest:function(a){u.push(a)},$apply:function(a){try{n("$apply");try{return this.$eval(a)}finally{w.$$phase=null}}catch(b){f(b)}finally{try{w.$digest()}catch(c){throw f(c),c;}}},$applyAsync:function(a){function b(){c.$eval(a)}var c=this;a&&t.push(b);a=g(a);r()},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=
0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){var d=c.indexOf(b);-1!==d&&(c[d]=null,F(e,1,a))}},$emit:function(a,b){var c=[],d,e=this,g=!1,h={name:a,targetScope:e,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=cb([h],arguments,1),l,m;do{d=e.$$listeners[a]||c;h.currentScope=e;l=0;for(m=d.length;l<m;l++)if(d[l])try{d[l].apply(null,k)}catch(n){f(n)}else d.splice(l,1),l--,m--;if(g)return h.currentScope=null,h;e=e.$parent}while(e);
h.currentScope=null;return h},$broadcast:function(a,b){var c=this,d=this,e={name:a,targetScope:this,preventDefault:function(){e.defaultPrevented=!0},defaultPrevented:!1};if(!this.$$listenerCount[a])return e;for(var g=cb([e],arguments,1),h,k;c=d;){e.currentScope=c;d=c.$$listeners[a]||[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,g)}catch(l){f(l)}else d.splice(h,1),h--,k--;if(!(d=c.$$listenerCount[a]&&c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}e.currentScope=
null;return e}};var w=new m,v=w.$$asyncQueue=[],u=w.$$postDigestQueue=[],t=w.$$applyAsyncQueue=[];return w}]}function le(){var a=/^\s*(https?|ftp|mailto|tel|file):/,b=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationWhitelist=function(b){return A(b)?(a=b,this):a};this.imgSrcSanitizationWhitelist=function(a){return A(a)?(b=a,this):b};this.$get=function(){return function(d,c){var e=c?b:a,f;f=sa(d).href;return""===f||f.match(e)?d:"unsafe:"+f}}}function kg(a){if("self"===a)return a;
if(y(a)){if(-1<a.indexOf("***"))throw ua("iwcard",a);a=ud(a).replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return new RegExp("^"+a+"$")}if(Za(a))return new RegExp("^"+a.source+"$");throw ua("imatcher");}function vd(a){var b=[];A(a)&&q(a,function(a){b.push(kg(a))});return b}function wf(){this.SCE_CONTEXTS=ma;var a=["self"],b=[];this.resourceUrlWhitelist=function(b){arguments.length&&(a=vd(b));return a};this.resourceUrlBlacklist=function(a){arguments.length&&(b=vd(a));return b};this.$get=["$injector",
function(d){function c(a,b){return"self"===a?gd(b):!!a.exec(b.href)}function e(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var f=function(a){throw ua("unsafe");};d.has("$sanitize")&&(f=d.get("$sanitize"));var g=e(),h={};h[ma.HTML]=e(g);h[ma.CSS]=e(g);h[ma.URL]=e(g);h[ma.JS]=e(g);h[ma.RESOURCE_URL]=
e(h[ma.URL]);return{trustAs:function(a,b){var c=h.hasOwnProperty(a)?h[a]:null;if(!c)throw ua("icontext",a,b);if(null===b||z(b)||""===b)return b;if("string"!==typeof b)throw ua("itype",a);return new c(b)},getTrusted:function(d,e){if(null===e||z(e)||""===e)return e;var g=h.hasOwnProperty(d)?h[d]:null;if(g&&e instanceof g)return e.$$unwrapTrustedValue();if(d===ma.RESOURCE_URL){var g=sa(e.toString()),n,p,q=!1;n=0;for(p=a.length;n<p;n++)if(c(a[n],g)){q=!0;break}if(q)for(n=0,p=b.length;n<p;n++)if(c(b[n],
g)){q=!1;break}if(q)return e;throw ua("insecurl",e.toString());}if(d===ma.HTML)return f(e);throw ua("unsafe");},valueOf:function(a){return a instanceof g?a.$$unwrapTrustedValue():a}}}]}function vf(){var a=!0;this.enabled=function(b){arguments.length&&(a=!!b);return a};this.$get=["$parse","$sceDelegate",function(b,d){if(a&&8>Da)throw ua("iequirks");var c=ia(ma);c.isEnabled=function(){return a};c.trustAs=d.trustAs;c.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b},
c.valueOf=$a);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs,f=c.getTrusted,g=c.trustAs;q(ma,function(a,b){var d=N(b);c[fb("parse_as_"+d)]=function(b){return e(a,b)};c[fb("get_trusted_"+d)]=function(b){return f(a,b)};c[fb("trust_as_"+d)]=function(b){return g(a,b)}});return c}]}function xf(){this.$get=["$window","$document",function(a,b){var d={},c=!(a.chrome&&a.chrome.app&&a.chrome.app.runtime)&&a.history&&a.history.pushState,
e=Y((/android (\d+)/.exec(N((a.navigator||{}).userAgent))||[])[1]),f=/Boxee/i.test((a.navigator||{}).userAgent),g=b[0]||{},h,k=/^(Moz|webkit|ms)(?=[A-Z])/,l=g.body&&g.body.style,m=!1,n=!1;if(l){for(var p in l)if(m=k.exec(p)){h=m[0];h=h.substr(0,1).toUpperCase()+h.substr(1);break}h||(h="WebkitOpacity"in l&&"webkit");m=!!("transition"in l||h+"Transition"in l);n=!!("animation"in l||h+"Animation"in l);!e||m&&n||(m=y(l.webkitTransition),n=y(l.webkitAnimation))}return{history:!(!c||4>e||f),hasEvent:function(a){if("input"===
a&&11>=Da)return!1;if(z(d[a])){var b=g.createElement("div");d[a]="on"+a in b}return d[a]},csp:Ga(),vendorPrefix:h,transitions:m,animations:n,android:e}}]}function zf(){var a;this.httpOptions=function(b){return b?(a=b,this):a};this.$get=["$templateCache","$http","$q","$sce",function(b,d,c,e){function f(g,h){f.totalPendingRequests++;y(g)&&b.get(g)||(g=e.getTrustedResourceUrl(g));var k=d.defaults&&d.defaults.transformResponse;M(k)?k=k.filter(function(a){return a!==ac}):k===ac&&(k=null);return d.get(g,
S({cache:b,transformResponse:k},a))["finally"](function(){f.totalPendingRequests--}).then(function(a){b.put(g,a.data);return a.data},function(a){if(!h)throw lg("tpload",g,a.status,a.statusText);return c.reject(a)})}f.totalPendingRequests=0;return f}]}function Af(){this.$get=["$rootScope","$browser","$location",function(a,b,d){return{findBindings:function(a,b,d){a=a.getElementsByClassName("ng-binding");var g=[];q(a,function(a){var c=ea.element(a).data("$binding");c&&q(c,function(c){d?(new RegExp("(^|\\s)"+
ud(b)+"(\\s|\\||$)")).test(c)&&g.push(a):-1!=c.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,d){for(var g=["ng-","data-ng-","ng\\:"],h=0;h<g.length;++h){var k=a.querySelectorAll("["+g[h]+"model"+(d?"=":"*=")+'"'+b+'"]');if(k.length)return k}},getLocation:function(){return d.url()},setLocation:function(b){b!==d.url()&&(d.url(b),a.$digest())},whenStable:function(a){b.notifyWhenNoOutstandingRequests(a)}}}]}function Bf(){this.$get=["$rootScope","$browser","$q","$$q","$exceptionHandler",
function(a,b,d,c,e){function f(f,k,l){D(f)||(l=k,k=f,f=E);var m=Aa.call(arguments,3),n=A(l)&&!l,p=(n?c:d).defer(),q=p.promise,s;s=b.defer(function(){try{p.resolve(f.apply(null,m))}catch(b){p.reject(b),e(b)}finally{delete g[q.$$timeoutId]}n||a.$apply()},k);q.$$timeoutId=s;g[s]=p;return q}var g={};f.cancel=function(a){return a&&a.$$timeoutId in g?(g[a.$$timeoutId].reject("canceled"),delete g[a.$$timeoutId],b.defer.cancel(a.$$timeoutId)):!1};return f}]}function sa(a){Da&&(Z.setAttribute("href",a),a=
Z.href);Z.setAttribute("href",a);return{href:Z.href,protocol:Z.protocol?Z.protocol.replace(/:$/,""):"",host:Z.host,search:Z.search?Z.search.replace(/^\?/,""):"",hash:Z.hash?Z.hash.replace(/^#/,""):"",hostname:Z.hostname,port:Z.port,pathname:"/"===Z.pathname.charAt(0)?Z.pathname:"/"+Z.pathname}}function gd(a){a=y(a)?sa(a):a;return a.protocol===wd.protocol&&a.host===wd.host}function Cf(){this.$get=da(T)}function xd(a){function b(a){try{return decodeURIComponent(a)}catch(b){return a}}var d=a[0]||{},
c={},e="";return function(){var a,g,h,k,l;a=d.cookie||"";if(a!==e)for(e=a,a=e.split("; "),c={},h=0;h<a.length;h++)g=a[h],k=g.indexOf("="),0<k&&(l=b(g.substring(0,k)),z(c[l])&&(c[l]=b(g.substring(k+1))));return c}}function Gf(){this.$get=xd}function Jc(a){function b(d,c){if(J(d)){var e={};q(d,function(a,c){e[c]=b(c,a)});return e}return a.factory(d+"Filter",c)}this.register=b;this.$get=["$injector",function(a){return function(b){return a.get(b+"Filter")}}];b("currency",yd);b("date",zd);b("filter",mg);
b("json",ng);b("limitTo",og);b("lowercase",pg);b("number",Ad);b("orderBy",Bd);b("uppercase",qg)}function mg(){return function(a,b,d){if(!za(a)){if(null==a)return a;throw O("filter")("notarray",a);}var c;switch(ic(b)){case "function":break;case "boolean":case "null":case "number":case "string":c=!0;case "object":b=rg(b,d,c);break;default:return a}return Array.prototype.filter.call(a,b)}}function rg(a,b,d){var c=J(a)&&"$"in a;!0===b?b=na:D(b)||(b=function(a,b){if(z(a))return!1;if(null===a||null===b)return a===
b;if(J(b)||J(a)&&!rc(a))return!1;a=N(""+a);b=N(""+b);return-1!==a.indexOf(b)});return function(e){return c&&!J(e)?Ma(e,a.$,b,!1):Ma(e,a,b,d)}}function Ma(a,b,d,c,e){var f=ic(a),g=ic(b);if("string"===g&&"!"===b.charAt(0))return!Ma(a,b.substring(1),d,c);if(M(a))return a.some(function(a){return Ma(a,b,d,c)});switch(f){case "object":var h;if(c){for(h in a)if("$"!==h.charAt(0)&&Ma(a[h],b,d,!0))return!0;return e?!1:Ma(a,b,d,!1)}if("object"===g){for(h in b)if(e=b[h],!D(e)&&!z(e)&&(f="$"===h,!Ma(f?a:a[h],
e,d,f,f)))return!1;return!0}return d(a,b);case "function":return!1;default:return d(a,b)}}function ic(a){return null===a?"null":typeof a}function yd(a){var b=a.NUMBER_FORMATS;return function(a,c,e){z(c)&&(c=b.CURRENCY_SYM);z(e)&&(e=b.PATTERNS[1].maxFrac);return null==a?a:Cd(a,b.PATTERNS[1],b.GROUP_SEP,b.DECIMAL_SEP,e).replace(/\u00A4/g,c)}}function Ad(a){var b=a.NUMBER_FORMATS;return function(a,c){return null==a?a:Cd(a,b.PATTERNS[0],b.GROUP_SEP,b.DECIMAL_SEP,c)}}function sg(a){var b=0,d,c,e,f,g;-1<
(c=a.indexOf(Dd))&&(a=a.replace(Dd,""));0<(e=a.search(/e/i))?(0>c&&(c=e),c+=+a.slice(e+1),a=a.substring(0,e)):0>c&&(c=a.length);for(e=0;a.charAt(e)==jc;e++);if(e==(g=a.length))d=[0],c=1;else{for(g--;a.charAt(g)==jc;)g--;c-=e;d=[];for(f=0;e<=g;e++,f++)d[f]=+a.charAt(e)}c>Ed&&(d=d.splice(0,Ed-1),b=c-1,c=1);return{d:d,e:b,i:c}}function tg(a,b,d,c){var e=a.d,f=e.length-a.i;b=z(b)?Math.min(Math.max(d,f),c):+b;d=b+a.i;c=e[d];if(0<d){e.splice(Math.max(a.i,d));for(var g=d;g<e.length;g++)e[g]=0}else for(f=
Math.max(0,f),a.i=1,e.length=Math.max(1,d=b+1),e[0]=0,g=1;g<d;g++)e[g]=0;if(5<=c)if(0>d-1){for(c=0;c>d;c--)e.unshift(0),a.i++;e.unshift(1);a.i++}else e[d-1]++;for(;f<Math.max(0,b);f++)e.push(0);if(b=e.reduceRight(function(a,b,c,d){b+=a;d[c]=b%10;return Math.floor(b/10)},0))e.unshift(b),a.i++}function Cd(a,b,d,c,e){if(!y(a)&&!R(a)||isNaN(a))return"";var f=!isFinite(a),g=!1,h=Math.abs(a)+"",k="";if(f)k="\u221e";else{g=sg(h);tg(g,e,b.minFrac,b.maxFrac);k=g.d;h=g.i;e=g.e;f=[];for(g=k.reduce(function(a,
b){return a&&!b},!0);0>h;)k.unshift(0),h++;0<h?f=k.splice(h):(f=k,k=[0]);h=[];for(k.length>=b.lgSize&&h.unshift(k.splice(-b.lgSize).join(""));k.length>b.gSize;)h.unshift(k.splice(-b.gSize).join(""));k.length&&h.unshift(k.join(""));k=h.join(d);f.length&&(k+=c+f.join(""));e&&(k+="e+"+e)}return 0>a&&!g?b.negPre+k+b.negSuf:b.posPre+k+b.posSuf}function Jb(a,b,d,c){var e="";if(0>a||c&&0>=a)c?a=-a+1:(a=-a,e="-");for(a=""+a;a.length<b;)a=jc+a;d&&(a=a.substr(a.length-b));return e+a}function X(a,b,d,c,e){d=
d||0;return function(f){f=f["get"+a]();if(0<d||f>-d)f+=d;0===f&&-12==d&&(f=12);return Jb(f,b,c,e)}}function lb(a,b,d){return function(c,e){var f=c["get"+a](),g=vb((d?"STANDALONE":"")+(b?"SHORT":"")+a);return e[g][f]}}function Fd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function Gd(a){return function(b){var d=Fd(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Jb(b,a)}}function kc(a,b){return 0>=a.getFullYear()?
b.ERAS[0]:b.ERAS[1]}function zd(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0,h=b[8]?a.setUTCFullYear:a.setFullYear,k=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=Y(b[9]+b[10]),g=Y(b[9]+b[11]));h.call(a,Y(b[1]),Y(b[2])-1,Y(b[3]));f=Y(b[4]||0)-f;g=Y(b[5]||0)-g;h=Y(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));k.call(a,f,g,h,b)}return a}var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,d,f){var g="",h=
[],k,l;d=d||"mediumDate";d=a.DATETIME_FORMATS[d]||d;y(c)&&(c=ug.test(c)?Y(c):b(c));R(c)&&(c=new Date(c));if(!fa(c)||!isFinite(c.getTime()))return c;for(;d;)(l=vg.exec(d))?(h=cb(h,l,1),d=h.pop()):(h.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=vc(f,m),c=Rb(c,f,!0));q(h,function(b){k=wg[b];g+=k?k(c,a.DATETIME_FORMATS,m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function ng(){return function(a,b){z(b)&&(b=2);return db(a,b)}}function og(){return function(a,b,d){b=Infinity===
Math.abs(Number(b))?Number(b):Y(b);if(isNaN(b))return a;R(a)&&(a=a.toString());if(!M(a)&&!y(a))return a;d=!d||isNaN(d)?0:Y(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?a.slice(d,d+b):0===d?a.slice(b,a.length):a.slice(Math.max(0,d+b),d)}}function Bd(a){function b(b,d){d=d?-1:1;return b.map(function(b){var c=1,h=$a;if(D(b))h=b;else if(y(b)){if("+"==b.charAt(0)||"-"==b.charAt(0))c="-"==b.charAt(0)?-1:1,b=b.substring(1);if(""!==b&&(h=a(b),h.constant))var k=h(),h=function(a){return a[k]}}return{get:h,
descending:c*d}})}function d(a){switch(typeof a){case "number":case "boolean":case "string":return!0;default:return!1}}return function(a,e,f){if(null==a)return a;if(!za(a))throw O("orderBy")("notarray",a);M(e)||(e=[e]);0===e.length&&(e=["+"]);var g=b(e,f);g.push({get:function(){return{}},descending:f?-1:1});a=Array.prototype.map.call(a,function(a,b){return{value:a,predicateValues:g.map(function(c){var e=c.get(a);c=typeof e;if(null===e)c="string",e="null";else if("string"===c)e=e.toLowerCase();else if("object"===
c)a:{if("function"===typeof e.valueOf&&(e=e.valueOf(),d(e)))break a;if(rc(e)&&(e=e.toString(),d(e)))break a;e=b}return{value:e,type:c}})}});a.sort(function(a,b){for(var c=0,d=0,e=g.length;d<e;++d){var c=a.predicateValues[d],f=b.predicateValues[d],q=0;c.type===f.type?c.value!==f.value&&(q=c.value<f.value?-1:1):q=c.type<f.type?-1:1;if(c=q*g[d].descending)break}return c});return a=a.map(function(a){return a.value})}}function Na(a){D(a)&&(a={link:a});a.restrict=a.restrict||"AC";return da(a)}function Hd(a,
b,d,c,e){var f=this,g=[];f.$error={};f.$$success={};f.$pending=u;f.$name=e(b.name||b.ngForm||"")(d);f.$dirty=!1;f.$pristine=!0;f.$valid=!0;f.$invalid=!1;f.$submitted=!1;f.$$parentForm=Kb;f.$rollbackViewValue=function(){q(g,function(a){a.$rollbackViewValue()})};f.$commitViewValue=function(){q(g,function(a){a.$commitViewValue()})};f.$addControl=function(a){Ta(a.$name,"input");g.push(a);a.$name&&(f[a.$name]=a);a.$$parentForm=f};f.$$renameControl=function(a,b){var c=a.$name;f[c]===a&&delete f[c];f[b]=
a;a.$name=b};f.$removeControl=function(a){a.$name&&f[a.$name]===a&&delete f[a.$name];q(f.$pending,function(b,c){f.$setValidity(c,null,a)});q(f.$error,function(b,c){f.$setValidity(c,null,a)});q(f.$$success,function(b,c){f.$setValidity(c,null,a)});bb(g,a);a.$$parentForm=Kb};Id({ctrl:this,$element:a,set:function(a,b,c){var d=a[b];d?-1===d.indexOf(c)&&d.push(c):a[b]=[c]},unset:function(a,b,c){var d=a[b];d&&(bb(d,c),0===d.length&&delete a[b])},$animate:c});f.$setDirty=function(){c.removeClass(a,Xa);c.addClass(a,
Lb);f.$dirty=!0;f.$pristine=!1;f.$$parentForm.$setDirty()};f.$setPristine=function(){c.setClass(a,Xa,Lb+" ng-submitted");f.$dirty=!1;f.$pristine=!0;f.$submitted=!1;q(g,function(a){a.$setPristine()})};f.$setUntouched=function(){q(g,function(a){a.$setUntouched()})};f.$setSubmitted=function(){c.addClass(a,"ng-submitted");f.$submitted=!0;f.$$parentForm.$setSubmitted()}}function lc(a){a.$formatters.push(function(b){return a.$isEmpty(b)?b:b.toString()})}function mb(a,b,d,c,e,f){var g=N(b[0].type);if(!e.android){var h=
!1;b.on("compositionstart",function(){h=!0});b.on("compositionend",function(){h=!1;l()})}var k,l=function(a){k&&(f.defer.cancel(k),k=null);if(!h){var e=b.val();a=a&&a.type;"password"===g||d.ngTrim&&"false"===d.ngTrim||(e=W(e));(c.$viewValue!==e||""===e&&c.$$hasNativeValidators)&&c.$setViewValue(e,a)}};if(e.hasEvent("input"))b.on("input",l);else{var m=function(a,b,c){k||(k=f.defer(function(){k=null;b&&b.value===c||l(a)}))};b.on("keydown",function(a){var b=a.keyCode;91===b||15<b&&19>b||37<=b&&40>=b||
m(a,this,this.value)});if(e.hasEvent("paste"))b.on("paste cut",m)}b.on("change",l);if(Jd[g]&&c.$$hasNativeValidators&&g===d.type)b.on("keydown wheel mousedown",function(a){if(!k){var b=this.validity,c=b.badInput,d=b.typeMismatch;k=f.defer(function(){k=null;b.badInput===c&&b.typeMismatch===d||l(a)})}});c.$render=function(){var a=c.$isEmpty(c.$viewValue)?"":c.$viewValue;b.val()!==a&&b.val(a)}}function Mb(a,b){return function(d,c){var e,f;if(fa(d))return d;if(y(d)){'"'==d.charAt(0)&&'"'==d.charAt(d.length-
1)&&(d=d.substring(1,d.length-1));if(xg.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(),ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},q(e,function(a,c){c<b.length&&(f[b[c]]=+a)}),new Date(f.yyyy,f.MM-1,f.dd,f.HH,f.mm,f.ss||0,1E3*f.sss||0)}return NaN}}function nb(a,b,d,c){return function(e,f,g,h,k,l,m){function n(a){return a&&!(a.getTime&&
a.getTime()!==a.getTime())}function p(a){return A(a)&&!fa(a)?d(a)||u:a}Kd(e,f,g,h);mb(e,f,g,h,k,l);var q=h&&h.$options&&h.$options.timezone,s;h.$$parserName=a;h.$parsers.push(function(a){return h.$isEmpty(a)?null:b.test(a)?(a=d(a,s),q&&(a=Rb(a,q)),a):u});h.$formatters.push(function(a){if(a&&!fa(a))throw ob("datefmt",a);if(n(a))return(s=a)&&q&&(s=Rb(s,q,!0)),m("date")(a,c,q);s=null;return""});if(A(g.min)||g.ngMin){var x;h.$validators.min=function(a){return!n(a)||z(x)||d(a)>=x};g.$observe("min",function(a){x=
p(a);h.$validate()})}if(A(g.max)||g.ngMax){var r;h.$validators.max=function(a){return!n(a)||z(r)||d(a)<=r};g.$observe("max",function(a){r=p(a);h.$validate()})}}}function Kd(a,b,d,c){(c.$$hasNativeValidators=J(b[0].validity))&&c.$parsers.push(function(a){var c=b.prop("validity")||{};return c.badInput||c.typeMismatch?u:a})}function Ld(a,b,d,c,e){if(A(c)){a=a(c);if(!a.constant)throw ob("constexpr",d,c);return a(b)}return e}function mc(a,b){a="ngClass"+a;return["$animate",function(d){function c(a,b){var c=
[],d=0;a:for(;d<a.length;d++){for(var e=a[d],m=0;m<b.length;m++)if(e==b[m])continue a;c.push(e)}return c}function e(a){var b=[];return M(a)?(q(a,function(a){b=b.concat(e(a))}),b):y(a)?a.split(" "):J(a)?(q(a,function(a,c){a&&(b=b.concat(c.split(" ")))}),b):a}return{restrict:"AC",link:function(f,g,h){function k(a,b){var c=g.data("$classCounts")||V(),d=[];q(a,function(a){if(0<b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<b)&&d.push(a)});g.data("$classCounts",c);return d.join(" ")}function l(a){if(!0===b||f.$index%
2===b){var l=e(a||[]);if(!m){var q=k(l,1);h.$addClass(q)}else if(!na(a,m)){var s=e(m),q=c(l,s),l=c(s,l),q=k(q,1),l=k(l,-1);q&&q.length&&d.addClass(g,q);l&&l.length&&d.removeClass(g,l)}}m=ia(a)}var m;f.$watch(h[a],l,!0);h.$observe("class",function(b){l(f.$eval(h[a]))});"ngClass"!==a&&f.$watch("$index",function(c,d){var g=c&1;if(g!==(d&1)){var l=e(f.$eval(h[a]));g===b?(g=k(l,1),h.$addClass(g)):(g=k(l,-1),h.$removeClass(g))}})}}}]}function Id(a){function b(a,b){b&&!f[a]?(k.addClass(e,a),f[a]=!0):!b&&
f[a]&&(k.removeClass(e,a),f[a]=!1)}function d(a,c){a=a?"-"+zc(a,"-"):"";b(pb+a,!0===c);b(Md+a,!1===c)}var c=a.ctrl,e=a.$element,f={},g=a.set,h=a.unset,k=a.$animate;f[Md]=!(f[pb]=e.hasClass(pb));c.$setValidity=function(a,e,f){z(e)?(c.$pending||(c.$pending={}),g(c.$pending,a,f)):(c.$pending&&h(c.$pending,a,f),Nd(c.$pending)&&(c.$pending=u));Oa(e)?e?(h(c.$error,a,f),g(c.$$success,a,f)):(g(c.$error,a,f),h(c.$$success,a,f)):(h(c.$error,a,f),h(c.$$success,a,f));c.$pending?(b(Od,!0),c.$valid=c.$invalid=
u,d("",null)):(b(Od,!1),c.$valid=Nd(c.$error),c.$invalid=!c.$valid,d("",c.$valid));e=c.$pending&&c.$pending[a]?u:c.$error[a]?!1:c.$$success[a]?!0:null;d(a,e);c.$$parentForm.$setValidity(a,e,c)}}function Nd(a){if(a)for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var yg=/^\/(.+)\/([a-z]*)$/,va=Object.prototype.hasOwnProperty,N=function(a){return y(a)?a.toLowerCase():a},vb=function(a){return y(a)?a.toUpperCase():a},Da,H,$,Aa=[].slice,Yf=[].splice,zg=[].push,ka=Object.prototype.toString,sc=Object.getPrototypeOf,
Ba=O("ng"),ea=T.angular||(T.angular={}),Tb,qb=0;Da=P.documentMode;E.$inject=[];$a.$inject=[];var M=Array.isArray,Zd=/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/,W=function(a){return y(a)?a.trim():a},ud=function(a){return a.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},Ga=function(){if(!A(Ga.rules)){var a=P.querySelector("[ng-csp]")||P.querySelector("[data-ng-csp]");if(a){var b=a.getAttribute("ng-csp")||a.getAttribute("data-ng-csp");
Ga.rules={noUnsafeEval:!b||-1!==b.indexOf("no-unsafe-eval"),noInlineStyle:!b||-1!==b.indexOf("no-inline-style")}}else{a=Ga;try{new Function(""),b=!1}catch(d){b=!0}a.rules={noUnsafeEval:b,noInlineStyle:!1}}}return Ga.rules},sb=function(){if(A(sb.name_))return sb.name_;var a,b,d=Qa.length,c,e;for(b=0;b<d;++b)if(c=Qa[b],a=P.querySelector("["+c.replace(":","\\:")+"jq]")){e=a.getAttribute(c+"jq");break}return sb.name_=e},be=/:/g,Qa=["ng-","data-ng-","ng:","x-ng-"],ge=/[A-Z]/g,Ac=!1,Pa=3,ke={full:"1.5.3",
major:1,minor:5,dot:3,codeName:"diplohaplontic-meiosis"};U.expando="ng339";var hb=U.cache={},Mf=1;U._data=function(a){return this.cache[a[this.expando]]||{}};var Hf=/([\:\-\_]+(.))/g,If=/^moz([A-Z])/,zb={mouseleave:"mouseout",mouseenter:"mouseover"},Vb=O("jqLite"),Lf=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Ub=/<|&#?\w+;/,Jf=/<([\w:-]+)/,Kf=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,ha={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,
"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ha.optgroup=ha.option;ha.tbody=ha.tfoot=ha.colgroup=ha.caption=ha.thead;ha.th=ha.td;var Rf=Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)},Ra=U.prototype={ready:function(a){function b(){d||(d=!0,a())}var d=!1;"complete"===P.readyState?setTimeout(b):(this.on("DOMContentLoaded",b),U(T).on("load",b))},toString:function(){var a=
[];q(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?H(this[a]):H(this[this.length+a])},length:0,push:zg,sort:[].sort,splice:[].splice},Eb={};q("multiple selected checked disabled readOnly required open".split(" "),function(a){Eb[N(a)]=a});var Sc={};q("input select option textarea button form details".split(" "),function(a){Sc[a]=!0});var $c={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern"};q({data:Xb,removeData:gb,
hasData:function(a){for(var b in hb[a.ng339])return!0;return!1},cleanData:function(a){for(var b=0,d=a.length;b<d;b++)gb(a[b])}},function(a,b){U[b]=a});q({data:Xb,inheritedData:Db,scope:function(a){return H.data(a,"$scope")||Db(a.parentNode||a,["$isolateScope","$scope"])},isolateScope:function(a){return H.data(a,"$isolateScope")||H.data(a,"$isolateScopeNoTemplate")},controller:Pc,injector:function(a){return Db(a,"$injector")},removeAttr:function(a,b){a.removeAttribute(b)},hasClass:Ab,css:function(a,
b,d){b=fb(b);if(A(d))a.style[b]=d;else return a.style[b]},attr:function(a,b,d){var c=a.nodeType;if(c!==Pa&&2!==c&&8!==c)if(c=N(b),Eb[c])if(A(d))d?(a[b]=!0,a.setAttribute(b,c)):(a[b]=!1,a.removeAttribute(c));else return a[b]||(a.attributes.getNamedItem(b)||E).specified?c:u;else if(A(d))a.setAttribute(b,d);else if(a.getAttribute)return a=a.getAttribute(b,2),null===a?u:a},prop:function(a,b,d){if(A(d))a[b]=d;else return a[b]},text:function(){function a(a,d){if(z(d)){var c=a.nodeType;return 1===c||c===
Pa?a.textContent:""}a.textContent=d}a.$dv="";return a}(),val:function(a,b){if(z(b)){if(a.multiple&&"select"===oa(a)){var d=[];q(a.options,function(a){a.selected&&d.push(a.value||a.text)});return 0===d.length?null:d}return a.value}a.value=b},html:function(a,b){if(z(b))return a.innerHTML;xb(a,!0);a.innerHTML=b},empty:Qc},function(a,b){U.prototype[b]=function(b,c){var e,f,g=this.length;if(a!==Qc&&z(2==a.length&&a!==Ab&&a!==Pc?b:c)){if(J(b)){for(e=0;e<g;e++)if(a===Xb)a(this[e],b);else for(f in b)a(this[e],
f,b[f]);return this}e=a.$dv;g=z(e)?Math.min(g,1):g;for(f=0;f<g;f++){var h=a(this[f],b,c);e=e?e+h:h}return e}for(e=0;e<g;e++)a(this[e],b,c);return this}});q({removeData:gb,on:function(a,b,d,c){if(A(c))throw Vb("onargs");if(Kc(a)){c=yb(a,!0);var e=c.events,f=c.handle;f||(f=c.handle=Of(a,e));c=0<=b.indexOf(" ")?b.split(" "):[b];for(var g=c.length,h=function(b,c,g){var h=e[b];h||(h=e[b]=[],h.specialHandlerWrapper=c,"$destroy"===b||g||a.addEventListener(b,f,!1));h.push(d)};g--;)b=c[g],zb[b]?(h(zb[b],Qf),
h(b,u,!0)):h(b)}},off:Oc,one:function(a,b,d){a=H(a);a.on(b,function e(){a.off(b,d);a.off(b,e)});a.on(b,d)},replaceWith:function(a,b){var d,c=a.parentNode;xb(a);q(new U(b),function(b){d?c.insertBefore(b,d.nextSibling):c.replaceChild(b,a);d=b})},children:function(a){var b=[];q(a.childNodes,function(a){1===a.nodeType&&b.push(a)});return b},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,b){var d=a.nodeType;if(1===d||11===d){b=new U(b);for(var d=0,c=b.length;d<c;d++)a.appendChild(b[d])}},
prepend:function(a,b){if(1===a.nodeType){var d=a.firstChild;q(new U(b),function(b){a.insertBefore(b,d)})}},wrap:function(a,b){Mc(a,H(b).eq(0).clone()[0])},remove:Yb,detach:function(a){Yb(a,!0)},after:function(a,b){var d=a,c=a.parentNode;b=new U(b);for(var e=0,f=b.length;e<f;e++){var g=b[e];c.insertBefore(g,d.nextSibling);d=g}},addClass:Cb,removeClass:Bb,toggleClass:function(a,b,d){b&&q(b.split(" "),function(b){var e=d;z(e)&&(e=!Ab(a,b));(e?Cb:Bb)(a,b)})},parent:function(a){return(a=a.parentNode)&&
11!==a.nodeType?a:null},next:function(a){return a.nextElementSibling},find:function(a,b){return a.getElementsByTagName?a.getElementsByTagName(b):[]},clone:Wb,triggerHandler:function(a,b,d){var c,e,f=b.type||b,g=yb(a);if(g=(g=g&&g.events)&&g[f])c={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return!0===this.immediatePropagationStopped},
stopPropagation:E,type:f,target:a},b.type&&(c=S(c,b)),b=ia(g),e=d?[c].concat(d):[c],q(b,function(b){c.isImmediatePropagationStopped()||b.apply(a,e)})}},function(a,b){U.prototype[b]=function(b,c,e){for(var f,g=0,h=this.length;g<h;g++)z(f)?(f=a(this[g],b,c,e),A(f)&&(f=H(f))):Nc(f,a(this[g],b,c,e));return A(f)?f:this};U.prototype.bind=U.prototype.on;U.prototype.unbind=U.prototype.off});Ua.prototype={put:function(a,b){this[Ha(a,this.nextUid)]=b},get:function(a){return this[Ha(a,this.nextUid)]},remove:function(a){var b=
this[a=Ha(a,this.nextUid)];delete this[a];return b}};var Ff=[function(){this.$get=[function(){return Ua}]}],Tf=/^([^\(]+?)=>/,Uf=/^[^\(]*\(\s*([^\)]*)\)/m,Ag=/,/,Bg=/^\s*(_?)(\S+?)\1\s*$/,Sf=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ia=O("$injector");eb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw y(d)&&d||(d=a.name||Vf(a)),Ia("strictdi",d);b=Tc(a);q(b[1].split(Ag),function(a){a.replace(Bg,function(a,b,d){c.push(d)})})}a.$inject=c}}else M(a)?
(b=a.length-1,Sa(a[b],"fn"),c=a.slice(0,b)):Sa(a,"fn",!0);return c};var Pd=O("$animate"),Ye=function(){this.$get=E},Ze=function(){var a=new Ua,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=y(b)?b.split(" "):M(b)?b:[],q(b,function(b){b&&(d=!0,a[b]=c)}));return d}function f(){q(b,function(b){var c=a.get(b);if(c){var d=Wf(b.attr("class")),e="",f="";q(c,function(a,b){a!==!!d[b]&&(a?e+=(e.length?" ":"")+b:f+=(f.length?" ":"")+b)});q(b,function(a){e&&Cb(a,
e);f&&Bb(a,f)});a.remove(b)}});b.length=0}return{enabled:E,on:E,off:E,pin:E,push:function(g,h,k,l){l&&l();k=k||{};k.from&&g.css(k.from);k.to&&g.css(k.to);if(k.addClass||k.removeClass)if(h=k.addClass,l=k.removeClass,k=a.get(g)||{},h=e(k,h,!0),l=e(k,l,!1),h||l)a.put(g,k),b.push(g),1===b.length&&c.$$postDigest(f);g=new d;g.complete();return g}}}]},We=["$provide",function(a){var b=this;this.$$registeredAnimations=Object.create(null);this.register=function(d,c){if(d&&"."!==d.charAt(0))throw Pd("notcsel",
d);var e=d+"-animation";b.$$registeredAnimations[d.substr(1)]=e;a.factory(e,c)};this.classNameFilter=function(a){if(1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?a:null)&&/(\s+|\/)ng-animate(\s+|\/)/.test(this.$$classNameFilter.toString()))throw Pd("nongcls","ng-animate");return this.$$classNameFilter};this.$get=["$$animateQueue",function(a){function b(a,c,d){if(d){var h;a:{for(h=0;h<d.length;h++){var k=d[h];if(1===k.nodeType){h=k;break a}}h=void 0}!h||h.parentNode||h.previousElementSibling||
(d=null)}d?d.after(a):c.prepend(a)}return{on:a.on,off:a.off,pin:a.pin,enabled:a.enabled,cancel:function(a){a.end&&a.end()},enter:function(e,f,g,h){f=f&&H(f);g=g&&H(g);f=f||g.parent();b(e,f,g);return a.push(e,"enter",Ja(h))},move:function(e,f,g,h){f=f&&H(f);g=g&&H(g);f=f||g.parent();b(e,f,g);return a.push(e,"move",Ja(h))},leave:function(b,c){return a.push(b,"leave",Ja(c),function(){b.remove()})},addClass:function(b,c,g){g=Ja(g);g.addClass=ib(g.addclass,c);return a.push(b,"addClass",g)},removeClass:function(b,
c,g){g=Ja(g);g.removeClass=ib(g.removeClass,c);return a.push(b,"removeClass",g)},setClass:function(b,c,g,h){h=Ja(h);h.addClass=ib(h.addClass,c);h.removeClass=ib(h.removeClass,g);return a.push(b,"setClass",h)},animate:function(b,c,g,h,k){k=Ja(k);k.from=k.from?S(k.from,c):c;k.to=k.to?S(k.to,g):g;k.tempClasses=ib(k.tempClasses,h||"ng-inline-animate");return a.push(b,"animate",k)}}}]}],af=function(){this.$get=["$$rAF",function(a){function b(b){d.push(b);1<d.length||a(function(){for(var a=0;a<d.length;a++)d[a]();
d=[]})}var d=[];return function(){var a=!1;b(function(){a=!0});return function(d){a?d():b(d)}}}]},$e=function(){this.$get=["$q","$sniffer","$$animateAsyncRun","$document","$timeout",function(a,b,d,c,e){function f(a){this.setHost(a);var b=d();this._doneCallbacks=[];this._tick=function(a){var d=c[0];d&&d.hidden?e(a,0,!1):b(a)};this._state=0}f.chain=function(a,b){function c(){if(d===a.length)b(!0);else a[d](function(a){!1===a?b(!1):(d++,c())})}var d=0;c()};f.all=function(a,b){function c(f){e=e&&f;++d===
a.length&&b(e)}var d=0,e=!0;q(a,function(a){a.done(c)})};f.prototype={setHost:function(a){this.host=a||{}},done:function(a){2===this._state?a():this._doneCallbacks.push(a)},progress:E,getPromise:function(){if(!this.promise){var b=this;this.promise=a(function(a,c){b.done(function(b){!1===b?c():a()})})}return this.promise},then:function(a,b){return this.getPromise().then(a,b)},"catch":function(a){return this.getPromise()["catch"](a)},"finally":function(a){return this.getPromise()["finally"](a)},pause:function(){this.host.pause&&
this.host.pause()},resume:function(){this.host.resume&&this.host.resume()},end:function(){this.host.end&&this.host.end();this._resolve(!0)},cancel:function(){this.host.cancel&&this.host.cancel();this._resolve(!1)},complete:function(a){var b=this;0===b._state&&(b._state=1,b._tick(function(){b._resolve(a)}))},_resolve:function(a){2!==this._state&&(q(this._doneCallbacks,function(b){b(a)}),this._doneCallbacks.length=0,this._state=2)}};return f}]},Xe=function(){this.$get=["$$rAF","$q","$$AnimateRunner",
function(a,b,d){return function(b,e){function f(){a(function(){g.addClass&&(b.addClass(g.addClass),g.addClass=null);g.removeClass&&(b.removeClass(g.removeClass),g.removeClass=null);g.to&&(b.css(g.to),g.to=null);h||k.complete();h=!0});return k}var g=e||{};g.$$prepared||(g=pa(g));g.cleanupStyles&&(g.from=g.to=null);g.from&&(b.css(g.from),g.from=null);var h,k=new d;return{start:f,end:f}}}]},ga=O("$compile");Cc.$inject=["$provide","$$sanitizeUriProvider"];var Vc=/^((?:x|data)[\:\-_])/i,Zf=O("$controller"),
ad=/^(\S+)(\s+as\s+([\w$]+))?$/,gf=function(){this.$get=["$document",function(a){return function(b){b?!b.nodeType&&b instanceof H&&(b=b[0]):b=a[0].body;return b.offsetWidth+1}}]},bd="application/json",bc={"Content-Type":bd+";charset=utf-8"},ag=/^\[|^\{(?!\{)/,bg={"[":/]$/,"{":/}$/},$f=/^\)\]\}',?\n/,Cg=O("$http"),fd=function(a){return function(){throw Cg("legacy",a);}},La=ea.$interpolateMinErr=O("$interpolate");La.throwNoconcat=function(a){throw La("noconcat",a);};La.interr=function(a,b){return La("interr",
a,b.toString())};var Dg=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,dg={http:80,https:443,ftp:21},Fb=O("$location"),Eg={$$html5:!1,$$replace:!1,absUrl:Gb("$$absUrl"),url:function(a){if(z(a))return this.$$url;var b=Dg.exec(a);(b[1]||""===a)&&this.path(decodeURIComponent(b[1]));(b[2]||b[1]||""===a)&&this.search(b[3]||"");this.hash(b[5]||"");return this},protocol:Gb("$$protocol"),host:Gb("$$host"),port:Gb("$$port"),path:kd("$$path",function(a){a=null!==a?a.toString():"";return"/"==a.charAt(0)?a:"/"+a}),search:function(a,
b){switch(arguments.length){case 0:return this.$$search;case 1:if(y(a)||R(a))a=a.toString(),this.$$search=xc(a);else if(J(a))a=pa(a,{}),q(a,function(b,c){null==b&&delete a[c]}),this.$$search=a;else throw Fb("isrcharg");break;default:z(b)||null===b?delete this.$$search[a]:this.$$search[a]=b}this.$$compose();return this},hash:kd("$$hash",function(a){return null!==a?a.toString():""}),replace:function(){this.$$replace=!0;return this}};q([jd,ec,dc],function(a){a.prototype=Object.create(Eg);a.prototype.state=
function(b){if(!arguments.length)return this.$$state;if(a!==dc||!this.$$html5)throw Fb("nostate");this.$$state=z(b)?null:b;return this}});var ca=O("$parse"),fg=Function.prototype.call,gg=Function.prototype.apply,hg=Function.prototype.bind,Nb=V();q("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),function(a){Nb[a]=!0});var Fg={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},gc=function(a){this.options=a};gc.prototype={constructor:gc,lex:function(a){this.text=a;this.index=0;for(this.tokens=
[];this.index<this.text.length;)if(a=this.text.charAt(this.index),'"'===a||"'"===a)this.readString(a);else if(this.isNumber(a)||"."===a&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(a))this.readIdent();else if(this.is(a,"(){}[].,;:?"))this.tokens.push({index:this.index,text:a}),this.index++;else if(this.isWhitespace(a))this.index++;else{var b=a+this.peek(),d=b+this.peek(2),c=Nb[b],e=Nb[d];Nb[a]||c||e?(a=e?d:c?b:a,this.tokens.push({index:this.index,text:a,operator:!0}),this.index+=
a.length):this.throwError("Unexpected next character ",this.index,this.index+1)}return this.tokens},is:function(a,b){return-1!==b.indexOf(a)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a&&"string"===typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===
a||"+"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b=A(b)?"s "+b+"-"+this.index+" ["+this.text.substring(b,d)+"]":" "+d;throw ca("lexerr",a,b,this.text);},readNumber:function(){for(var a="",b=this.index;this.index<this.text.length;){var d=N(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var c=this.peek();if("e"==d&&this.isExpOperator(c))a+=d;else if(this.isExpOperator(d)&&c&&this.isNumber(c)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||
c&&this.isNumber(c)||"e"!=a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}this.tokens.push({index:b,text:a,constant:!0,value:Number(a)})},readIdent:function(){for(var a=this.index;this.index<this.text.length;){var b=this.text.charAt(this.index);if(!this.isIdent(b)&&!this.isNumber(b))break;this.index++}this.tokens.push({index:a,text:this.text.slice(a,this.index),identifier:!0})},readString:function(a){var b=this.index;this.index++;for(var d="",c=a,e=!1;this.index<this.text.length;){var f=
this.text.charAt(this.index),c=c+f;if(e)"u"===f?(e=this.text.substring(this.index+1,this.index+5),e.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+e+"]"),this.index+=4,d+=String.fromCharCode(parseInt(e,16))):d+=Fg[f]||f,e=!1;else if("\\"===f)e=!0;else{if(f===a){this.index++;this.tokens.push({index:b,text:c,constant:!0,value:d});return}d+=f}this.index++}this.throwError("Unterminated quote",b)}};var s=function(a,b){this.lexer=a;this.options=b};s.Program="Program";s.ExpressionStatement=
"ExpressionStatement";s.AssignmentExpression="AssignmentExpression";s.ConditionalExpression="ConditionalExpression";s.LogicalExpression="LogicalExpression";s.BinaryExpression="BinaryExpression";s.UnaryExpression="UnaryExpression";s.CallExpression="CallExpression";s.MemberExpression="MemberExpression";s.Identifier="Identifier";s.Literal="Literal";s.ArrayExpression="ArrayExpression";s.Property="Property";s.ObjectExpression="ObjectExpression";s.ThisExpression="ThisExpression";s.LocalsExpression="LocalsExpression";
s.NGValueParameter="NGValueParameter";s.prototype={ast:function(a){this.text=a;this.tokens=this.lexer.lex(a);a=this.program();0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]);return a},program:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.expressionStatement()),!this.expect(";"))return{type:s.Program,body:a}},expressionStatement:function(){return{type:s.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var a=
this.expression();this.expect("|");)a=this.filter(a);return a},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary();this.expect("=")&&(a={type:s.AssignmentExpression,left:a,right:this.assignment(),operator:"="});return a},ternary:function(){var a=this.logicalOR(),b,d;return this.expect("?")&&(b=this.expression(),this.consume(":"))?(d=this.expression(),{type:s.ConditionalExpression,test:a,alternate:b,consequent:d}):a},logicalOR:function(){for(var a=this.logicalAND();this.expect("||");)a=
{type:s.LogicalExpression,operator:"||",left:a,right:this.logicalAND()};return a},logicalAND:function(){for(var a=this.equality();this.expect("&&");)a={type:s.LogicalExpression,operator:"&&",left:a,right:this.equality()};return a},equality:function(){for(var a=this.relational(),b;b=this.expect("==","!=","===","!==");)a={type:s.BinaryExpression,operator:b.text,left:a,right:this.relational()};return a},relational:function(){for(var a=this.additive(),b;b=this.expect("<",">","<=",">=");)a={type:s.BinaryExpression,
operator:b.text,left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),b;b=this.expect("+","-");)a={type:s.BinaryExpression,operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),b;b=this.expect("*","/","%");)a={type:s.BinaryExpression,operator:b.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:s.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:
this.primary()},primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")):this.expect("[")?a=this.arrayDeclaration():this.expect("{")?a=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?a=pa(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?a={type:s.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError("not a primary expression",
this.peek());for(var b;b=this.expect("(","[",".");)"("===b.text?(a={type:s.CallExpression,callee:a,arguments:this.parseArguments()},this.consume(")")):"["===b.text?(a={type:s.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")):"."===b.text?a={type:s.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var b={type:s.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(":");)a.push(this.expression());
return b},parseArguments:function(){var a=[];if(")"!==this.peekToken().text){do a.push(this.expression());while(this.expect(","))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier",a);return{type:s.Identifier,name:a.text}},constant:function(){return{type:s.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]");
return{type:s.ArrayExpression,elements:a}},object:function(){var a=[],b;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;b={type:s.Property,kind:"init"};this.peek().constant?b.key=this.constant():this.peek().identifier?b.key=this.identifier():this.throwError("invalid key",this.peek());this.consume(":");b.value=this.expression();a.push(b)}while(this.expect(","))}this.consume("}");return{type:s.ObjectExpression,properties:a}},throwError:function(a,b){throw ca("syntax",b.text,a,b.index+1,this.text,
this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw ca("ueoe",this.text);var b=this.expect(a);b||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw ca("ueoe",this.text);return this.tokens[0]},peek:function(a,b,d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c,e){if(this.tokens.length>a){a=this.tokens[a];var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1},
expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},selfReferential:{"this":{type:s.ThisExpression},$locals:{type:s.LocalsExpression}}};rd.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.state={nextId:0,filters:{},expensiveChecks:b,fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]};aa(c,d.$filter);var e="",f;this.stage="assign";if(f=pd(c))this.state.computing="assign",e=this.nextId(),this.recurse(f,e),this.return_(e),e="fn.assign="+
this.generateFunction("assign","s,v,l");f=nd(c.body);d.stage="inputs";q(f,function(a,b){var c="fn"+b;d.state[c]={vars:[],body:[],own:{}};d.state.computing=c;var e=d.nextId();d.recurse(a,e);d.return_(e);d.state.inputs.push(c);a.watchId=b});this.state.computing="fn";this.stage="main";this.recurse(c);e='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+e+this.watchFns()+"return fn;";e=(new Function("$filter","ensureSafeMemberName","ensureSafeObject",
"ensureSafeFunction","getStringValue","ensureSafeAssignContext","ifDefined","plus","text",e))(this.$filter,Wa,ta,ld,eg,Hb,ig,md,a);this.state=this.stage=u;e.literal=qd(c);e.constant=c.constant;return e},USE:"use",STRICT:"strict",watchFns:function(){var a=[],b=this.state.inputs,d=this;q(b,function(b){a.push("var "+b+"="+d.generateFunction(b,"s"))});b.length&&a.push("fn.inputs=["+b.join(",")+"];");return a.join("")},generateFunction:function(a,b){return"function("+b+"){"+this.varsPrefix(a)+this.body(a)+
"};"},filterPrefix:function(){var a=[],b=this;q(this.state.filters,function(d,c){a.push(d+"=$filter("+b.escape(c)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length?"var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")},recurse:function(a,b,d,c,e,f){var g,h,k=this,l,m;c=c||E;if(!f&&A(a.watchId))b=b||this.nextId(),this.if_("i",this.lazyAssign(b,this.computedMember("i",a.watchId)),this.lazyRecurse(a,b,d,
c,e,!0));else switch(a.type){case s.Program:q(a.body,function(b,c){k.recurse(b.expression,u,u,function(a){h=a});c!==a.body.length-1?k.current().body.push(h,";"):k.return_(h)});break;case s.Literal:m=this.escape(a.value);this.assign(b,m);c(m);break;case s.UnaryExpression:this.recurse(a.argument,u,u,function(a){h=a});m=a.operator+"("+this.ifDefined(h,0)+")";this.assign(b,m);c(m);break;case s.BinaryExpression:this.recurse(a.left,u,u,function(a){g=a});this.recurse(a.right,u,u,function(a){h=a});m="+"===
a.operator?this.plus(g,h):"-"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(h,0):"("+g+")"+a.operator+"("+h+")";this.assign(b,m);c(m);break;case s.LogicalExpression:b=b||this.nextId();k.recurse(a.left,b);k.if_("&&"===a.operator?b:k.not(b),k.lazyRecurse(a.right,b));c(b);break;case s.ConditionalExpression:b=b||this.nextId();k.recurse(a.test,b);k.if_(b,k.lazyRecurse(a.alternate,b),k.lazyRecurse(a.consequent,b));c(b);break;case s.Identifier:b=b||this.nextId();d&&(d.context="inputs"===k.stage?
"s":this.assign(this.nextId(),this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);Wa(a.name);k.if_("inputs"===k.stage||k.not(k.getHasOwnProperty("l",a.name)),function(){k.if_("inputs"===k.stage||"s",function(){e&&1!==e&&k.if_(k.not(k.nonComputedMember("s",a.name)),k.lazyAssign(k.nonComputedMember("s",a.name),"{}"));k.assign(b,k.nonComputedMember("s",a.name))})},b&&k.lazyAssign(b,k.nonComputedMember("l",a.name)));(k.state.expensiveChecks||Ib(a.name))&&k.addEnsureSafeObject(b);c(b);
break;case s.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();k.recurse(a.object,g,u,function(){k.if_(k.notNull(g),function(){e&&1!==e&&k.addEnsureSafeAssignContext(g);if(a.computed)h=k.nextId(),k.recurse(a.property,h),k.getStringValue(h),k.addEnsureSafeMemberName(h),e&&1!==e&&k.if_(k.not(k.computedMember(g,h)),k.lazyAssign(k.computedMember(g,h),"{}")),m=k.ensureSafeObject(k.computedMember(g,h)),k.assign(b,m),d&&(d.computed=!0,d.name=h);else{Wa(a.property.name);e&&
1!==e&&k.if_(k.not(k.nonComputedMember(g,a.property.name)),k.lazyAssign(k.nonComputedMember(g,a.property.name),"{}"));m=k.nonComputedMember(g,a.property.name);if(k.state.expensiveChecks||Ib(a.property.name))m=k.ensureSafeObject(m);k.assign(b,m);d&&(d.computed=!1,d.name=a.property.name)}},function(){k.assign(b,"undefined")});c(b)},!!e);break;case s.CallExpression:b=b||this.nextId();a.filter?(h=k.filter(a.callee.name),l=[],q(a.arguments,function(a){var b=k.nextId();k.recurse(a,b);l.push(b)}),m=h+"("+
l.join(",")+")",k.assign(b,m),c(b)):(h=k.nextId(),g={},l=[],k.recurse(a.callee,h,g,function(){k.if_(k.notNull(h),function(){k.addEnsureSafeFunction(h);q(a.arguments,function(a){k.recurse(a,k.nextId(),u,function(a){l.push(k.ensureSafeObject(a))})});g.name?(k.state.expensiveChecks||k.addEnsureSafeObject(g.context),m=k.member(g.context,g.name,g.computed)+"("+l.join(",")+")"):m=h+"("+l.join(",")+")";m=k.ensureSafeObject(m);k.assign(b,m)},function(){k.assign(b,"undefined")});c(b)}));break;case s.AssignmentExpression:h=
this.nextId();g={};if(!od(a.left))throw ca("lval");this.recurse(a.left,u,g,function(){k.if_(k.notNull(g.context),function(){k.recurse(a.right,h);k.addEnsureSafeObject(k.member(g.context,g.name,g.computed));k.addEnsureSafeAssignContext(g.context);m=k.member(g.context,g.name,g.computed)+a.operator+h;k.assign(b,m);c(b||m)})},1);break;case s.ArrayExpression:l=[];q(a.elements,function(a){k.recurse(a,k.nextId(),u,function(a){l.push(a)})});m="["+l.join(",")+"]";this.assign(b,m);c(m);break;case s.ObjectExpression:l=
[];q(a.properties,function(a){k.recurse(a.value,k.nextId(),u,function(b){l.push(k.escape(a.key.type===s.Identifier?a.key.name:""+a.key.value)+":"+b)})});m="{"+l.join(",")+"}";this.assign(b,m);c(m);break;case s.ThisExpression:this.assign(b,"s");c("s");break;case s.LocalsExpression:this.assign(b,"l");c("l");break;case s.NGValueParameter:this.assign(b,"v"),c("v")}},getHasOwnProperty:function(a,b){var d=a+"."+b,c=this.current().own;c.hasOwnProperty(d)||(c[d]=this.nextId(!1,a+"&&("+this.escape(b)+" in "+
a+")"));return c[d]},assign:function(a,b){if(a)return this.current().body.push(a,"=",b,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return"ifDefined("+a+","+this.escape(b)+")"},plus:function(a,b){return"plus("+a+","+b+")"},return_:function(a){this.current().body.push("return ",a,";")},if_:function(a,b,d){if(!0===a)b();else{var c=this.current().body;c.push("if(",a,"){");b();c.push("}");
d&&(c.push("else{"),d(),c.push("}"))}},not:function(a){return"!("+a+")"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a,b){return a+"."+b},computedMember:function(a,b){return a+"["+b+"]"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a,b)},addEnsureSafeObject:function(a){this.current().body.push(this.ensureSafeObject(a),";")},addEnsureSafeMemberName:function(a){this.current().body.push(this.ensureSafeMemberName(a),";")},addEnsureSafeFunction:function(a){this.current().body.push(this.ensureSafeFunction(a),
";")},addEnsureSafeAssignContext:function(a){this.current().body.push(this.ensureSafeAssignContext(a),";")},ensureSafeObject:function(a){return"ensureSafeObject("+a+",text)"},ensureSafeMemberName:function(a){return"ensureSafeMemberName("+a+",text)"},ensureSafeFunction:function(a){return"ensureSafeFunction("+a+",text)"},getStringValue:function(a){this.assign(a,"getStringValue("+a+")")},ensureSafeAssignContext:function(a){return"ensureSafeAssignContext("+a+",text)"},lazyRecurse:function(a,b,d,c,e,f){var g=
this;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(y(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(R(a))return a.toString();if(!0===a)return"true";if(!1===a)return"false";if(null===a)return"null";if("undefined"===typeof a)return"undefined";throw ca("esc");},nextId:function(a,
b){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(b?"="+b:""));return d},current:function(){return this.state[this.state.computing]}};sd.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.expression=a;this.expensiveChecks=b;aa(c,d.$filter);var e,f;if(e=pd(c))f=this.recurse(e);e=nd(c.body);var g;e&&(g=[],q(e,function(a,b){var c=d.recurse(a);a.input=c;g.push(c);a.watchId=b}));var h=[];q(c.body,function(a){h.push(d.recurse(a.expression))});e=0===c.body.length?E:1===
c.body.length?h[0]:function(a,b){var c;q(h,function(d){c=d(a,b)});return c};f&&(e.assign=function(a,b,c){return f(a,c,b)});g&&(e.inputs=g);e.literal=qd(c);e.constant=c.constant;return e},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case s.Literal:return this.value(a.value,b);case s.UnaryExpression:return e=this.recurse(a.argument),this["unary"+a.operator](e,b);case s.BinaryExpression:return c=this.recurse(a.left),e=this.recurse(a.right),
this["binary"+a.operator](c,e,b);case s.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case s.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),b);case s.Identifier:return Wa(a.name,f.expression),f.identifier(a.name,f.expensiveChecks||Ib(a.name),b,d,f.expression);case s.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(Wa(a.property.name,f.expression),
e=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c,e,b,d,f.expression):this.nonComputedMember(c,e,f.expensiveChecks,b,d,f.expression);case s.CallExpression:return g=[],q(a.arguments,function(a){g.push(f.recurse(a))}),a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter?function(a,c,d,f){for(var n=[],p=0;p<g.length;++p)n.push(g[p](a,c,d,f));a=e.apply(u,n,f);return b?{context:u,name:u,value:a}:a}:function(a,c,d,m){var n=
e(a,c,d,m),p;if(null!=n.value){ta(n.context,f.expression);ld(n.value,f.expression);p=[];for(var q=0;q<g.length;++q)p.push(ta(g[q](a,c,d,m),f.expression));p=ta(n.value.apply(n.context,p),f.expression)}return b?{value:p}:p};case s.AssignmentExpression:return c=this.recurse(a.left,!0,1),e=this.recurse(a.right),function(a,d,g,m){var n=c(a,d,g,m);a=e(a,d,g,m);ta(n.value,f.expression);Hb(n.context);n.context[n.name]=a;return b?{value:a}:a};case s.ArrayExpression:return g=[],q(a.elements,function(a){g.push(f.recurse(a))}),
function(a,c,d,e){for(var f=[],p=0;p<g.length;++p)f.push(g[p](a,c,d,e));return b?{value:f}:f};case s.ObjectExpression:return g=[],q(a.properties,function(a){g.push({key:a.key.type===s.Identifier?a.key.name:""+a.key.value,value:f.recurse(a.value)})}),function(a,c,d,e){for(var f={},p=0;p<g.length;++p)f[g[p].key]=g[p].value(a,c,d,e);return b?{value:f}:f};case s.ThisExpression:return function(a){return b?{value:a}:a};case s.LocalsExpression:return function(a,c){return b?{value:c}:c};case s.NGValueParameter:return function(a,
c,d){return b?{value:d}:d}}},"unary+":function(a,b){return function(d,c,e,f){d=a(d,c,e,f);d=A(d)?+d:0;return b?{value:d}:d}},"unary-":function(a,b){return function(d,c,e,f){d=a(d,c,e,f);d=A(d)?-d:0;return b?{value:d}:d}},"unary!":function(a,b){return function(d,c,e,f){d=!a(d,c,e,f);return b?{value:d}:d}},"binary+":function(a,b,d){return function(c,e,f,g){var h=a(c,e,f,g);c=b(c,e,f,g);h=md(h,c);return d?{value:h}:h}},"binary-":function(a,b,d){return function(c,e,f,g){var h=a(c,e,f,g);c=b(c,e,f,g);
h=(A(h)?h:0)-(A(c)?c:0);return d?{value:h}:h}},"binary*":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)*b(c,e,f,g);return d?{value:c}:c}},"binary/":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)/b(c,e,f,g);return d?{value:c}:c}},"binary%":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)%b(c,e,f,g);return d?{value:c}:c}},"binary===":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)===b(c,e,f,g);return d?{value:c}:c}},"binary!==":function(a,b,d){return function(c,e,f,g){c=a(c,
e,f,g)!==b(c,e,f,g);return d?{value:c}:c}},"binary==":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)==b(c,e,f,g);return d?{value:c}:c}},"binary!=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)!=b(c,e,f,g);return d?{value:c}:c}},"binary<":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<b(c,e,f,g);return d?{value:c}:c}},"binary>":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},"binary<=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,
g)<=b(c,e,f,g);return d?{value:c}:c}},"binary>=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},"binary&&":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},"binary||":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},"ternary?:":function(a,b,d,c){return function(e,f,g,h){e=a(e,f,g,h)?b(e,f,g,h):d(e,f,g,h);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:u,
name:u,value:a}:a}},identifier:function(a,b,d,c,e){return function(f,g,h,k){f=g&&a in g?g:f;c&&1!==c&&f&&!f[a]&&(f[a]={});g=f?f[a]:u;b&&ta(g,e);return d?{context:f,name:a,value:g}:g}},computedMember:function(a,b,d,c,e){return function(f,g,h,k){var l=a(f,g,h,k),m,n;null!=l&&(m=b(f,g,h,k),m+="",Wa(m,e),c&&1!==c&&(Hb(l),l&&!l[m]&&(l[m]={})),n=l[m],ta(n,e));return d?{context:l,name:m,value:n}:n}},nonComputedMember:function(a,b,d,c,e,f){return function(g,h,k,l){g=a(g,h,k,l);e&&1!==e&&(Hb(g),g&&!g[b]&&
(g[b]={}));h=null!=g?g[b]:u;(d||Ib(b))&&ta(h,f);return c?{context:g,name:b,value:h}:h}},inputs:function(a,b){return function(d,c,e,f){return f?f[b]:a(d,c,e)}}};var hc=function(a,b,d){this.lexer=a;this.$filter=b;this.options=d;this.ast=new s(a,d);this.astCompiler=d.csp?new sd(this.ast,b):new rd(this.ast,b)};hc.prototype={constructor:hc,parse:function(a){return this.astCompiler.compile(a,this.options.expensiveChecks)}};var jg=Object.prototype.valueOf,ua=O("$sce"),ma={HTML:"html",CSS:"css",URL:"url",
RESOURCE_URL:"resourceUrl",JS:"js"},lg=O("$compile"),Z=P.createElement("a"),wd=sa(T.location.href);xd.$inject=["$document"];Jc.$inject=["$provide"];var Ed=22,Dd=".",jc="0";yd.$inject=["$locale"];Ad.$inject=["$locale"];var wg={yyyy:X("FullYear",4,0,!1,!0),yy:X("FullYear",2,0,!0,!0),y:X("FullYear",1,0,!1,!0),MMMM:lb("Month"),MMM:lb("Month",!0),MM:X("Month",2,1),M:X("Month",1,1),LLLL:lb("Month",!1,!0),dd:X("Date",2),d:X("Date",1),HH:X("Hours",2),H:X("Hours",1),hh:X("Hours",2,-12),h:X("Hours",1,-12),
mm:X("Minutes",2),m:X("Minutes",1),ss:X("Seconds",2),s:X("Seconds",1),sss:X("Milliseconds",3),EEEE:lb("Day"),EEE:lb("Day",!0),a:function(a,b){return 12>a.getHours()?b.AMPMS[0]:b.AMPMS[1]},Z:function(a,b,d){a=-1*d;return a=(0<=a?"+":"")+(Jb(Math[0<a?"floor":"ceil"](a/60),2)+Jb(Math.abs(a%60),2))},ww:Gd(2),w:Gd(1),G:kc,GG:kc,GGG:kc,GGGG:function(a,b){return 0>=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},vg=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
ug=/^\-?\d+$/;zd.$inject=["$locale"];var pg=da(N),qg=da(vb);Bd.$inject=["$parse"];var me=da({restrict:"E",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a,b){if("a"===b[0].nodeName.toLowerCase()){var e="[object SVGAnimatedString]"===ka.call(b.prop("href"))?"xlink:href":"href";b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),wb={};q(Eb,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!=a){var c=ya("ng-"+b),e=d;"checked"===a&&(e=function(a,
b,e){e.ngModel!==e[c]&&d(a,b,e)});wb[c]=function(){return{restrict:"A",priority:100,link:e}}}});q($c,function(a,b){wb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"==e.ngPattern.charAt(0)&&(c=e.ngPattern.match(yg))){e.$set("ngPattern",new RegExp(c[1],c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});q(["src","srcset","href"],function(a){var b=ya("ng-"+a);wb[b]=function(){return{priority:99,link:function(d,c,e){var f=a,g=a;"href"===a&&"[object SVGAnimatedString]"===
ka.call(c.prop("href"))&&(g="xlinkHref",e.$attr[g]="xlink:href",f=null);e.$observe(b,function(b){b?(e.$set(g,b),Da&&f&&c.prop(f,e[g])):"href"===a&&e.$set(g,null)})}}}});var Kb={$addControl:E,$$renameControl:function(a,b){a.$name=b},$removeControl:E,$setValidity:E,$setDirty:E,$setPristine:E,$setSubmitted:E};Hd.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var Qd=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||E}return{name:"form",
restrict:a?"EAC":"E",require:["form","^^?form"],controller:Hd,compile:function(d,f){d.addClass(Xa).addClass(pb);var g=f.name?"name":a&&f.ngForm?"ngForm":!1;return{pre:function(a,d,e,f){var n=f[0];if(!("action"in e)){var p=function(b){a.$apply(function(){n.$commitViewValue();n.$setSubmitted()});b.preventDefault()};d[0].addEventListener("submit",p,!1);d.on("$destroy",function(){b(function(){d[0].removeEventListener("submit",p,!1)},0,!1)})}(f[1]||n.$$parentForm).$addControl(n);var q=g?c(n.$name):E;g&&
(q(a,n),e.$observe(g,function(b){n.$name!==b&&(q(a,u),n.$$parentForm.$$renameControl(n,b),q=c(n.$name),q(a,n))}));d.on("$destroy",function(){n.$$parentForm.$removeControl(n);q(a,u);S(n,Kb)})}}}}}]},ne=Qd(),Ae=Qd(!0),xg=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,Gg=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,Hg=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
Ig=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,Rd=/^(\d{4,})-(\d{2})-(\d{2})$/,Sd=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,nc=/^(\d{4,})-W(\d\d)$/,Td=/^(\d{4,})-(\d\d)$/,Ud=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Jd=V();q(["date","datetime-local","month","time","week"],function(a){Jd[a]=!0});var Vd={text:function(a,b,d,c,e,f){mb(a,b,d,c,e,f);lc(c)},date:nb("date",Rd,Mb(Rd,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":nb("datetimelocal",Sd,Mb(Sd,"yyyy MM dd HH mm ss sss".split(" ")),
"yyyy-MM-ddTHH:mm:ss.sss"),time:nb("time",Ud,Mb(Ud,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:nb("week",nc,function(a,b){if(fa(a))return a;if(y(a)){nc.lastIndex=0;var d=nc.exec(a);if(d){var c=+d[1],e=+d[2],f=d=0,g=0,h=0,k=Fd(c),e=7*(e-1);b&&(d=b.getHours(),f=b.getMinutes(),g=b.getSeconds(),h=b.getMilliseconds());return new Date(c,0,k.getDate()+e,d,f,g,h)}}return NaN},"yyyy-Www"),month:nb("month",Td,Mb(Td,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f){Kd(a,b,d,c);mb(a,b,d,c,e,f);c.$$parserName=
"number";c.$parsers.push(function(a){return c.$isEmpty(a)?null:Ig.test(a)?parseFloat(a):u});c.$formatters.push(function(a){if(!c.$isEmpty(a)){if(!R(a))throw ob("numfmt",a);a=a.toString()}return a});if(A(d.min)||d.ngMin){var g;c.$validators.min=function(a){return c.$isEmpty(a)||z(g)||a>=g};d.$observe("min",function(a){A(a)&&!R(a)&&(a=parseFloat(a,10));g=R(a)&&!isNaN(a)?a:u;c.$validate()})}if(A(d.max)||d.ngMax){var h;c.$validators.max=function(a){return c.$isEmpty(a)||z(h)||a<=h};d.$observe("max",function(a){A(a)&&
!R(a)&&(a=parseFloat(a,10));h=R(a)&&!isNaN(a)?a:u;c.$validate()})}},url:function(a,b,d,c,e,f){mb(a,b,d,c,e,f);lc(c);c.$$parserName="url";c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||Gg.test(d)}},email:function(a,b,d,c,e,f){mb(a,b,d,c,e,f);lc(c);c.$$parserName="email";c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||Hg.test(d)}},radio:function(a,b,d,c){z(d.name)&&b.attr("name",++qb);b.on("click",function(a){b[0].checked&&c.$setViewValue(d.value,a&&a.type)});c.$render=
function(){b[0].checked=d.value==c.$viewValue};d.$observe("value",c.$render)},checkbox:function(a,b,d,c,e,f,g,h){var k=Ld(h,a,"ngTrueValue",d.ngTrueValue,!0),l=Ld(h,a,"ngFalseValue",d.ngFalseValue,!1);b.on("click",function(a){c.$setViewValue(b[0].checked,a&&a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty=function(a){return!1===a};c.$formatters.push(function(a){return na(a,k)});c.$parsers.push(function(a){return a?k:l})},hidden:E,button:E,submit:E,reset:E,file:E},Dc=["$browser",
"$sniffer","$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e,f,g,h){h[0]&&(Vd[N(g.type)]||Vd.text)(e,f,g,h[0],b,a,d,c)}}}}],Jg=/^(true|false|\d+)$/,Se=function(){return{restrict:"A",priority:100,compile:function(a,b){return Jg.test(b.ngValue)?function(a,b,e){e.$set("value",a.$eval(e.ngValue))}:function(a,b,e){a.$watch(e.ngValue,function(a){e.$set("value",a)})}}}},se=["$compile",function(a){return{restrict:"AC",compile:function(b){a.$$addBindingClass(b);
return function(b,c,e){a.$$addBindingInfo(c,e.ngBind);c=c[0];b.$watch(e.ngBind,function(a){c.textContent=z(a)?"":a})}}}}],ue=["$interpolate","$compile",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate));b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe("ngBindTemplate",function(a){d.textContent=z(a)?"":a})}}}}],te=["$sce","$parse","$compile",function(a,b,d){return{restrict:"A",compile:function(c,e){var f=b(e.ngBindHtml),g=
b(e.ngBindHtml,function(a){return(a||"").toString()});d.$$addBindingClass(c);return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml);b.$watch(g,function(){c.html(a.getTrustedHtml(f(b))||"")})}}}}],Re=da({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),ve=mc("",!0),xe=mc("Odd",0),we=mc("Even",1),ye=Na({compile:function(a,b){b.$set("ngCloak",u);a.removeClass("ng-cloak")}}),ze=[function(){return{restrict:"A",scope:!0,controller:"@",
priority:500}}],Ic={},Kg={blur:!0,focus:!0};q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var b=ya("ng-"+a);Ic[b]=["$parse","$rootScope",function(d,c){return{restrict:"A",compile:function(e,f){var g=d(f[b],null,!0);return function(b,d){d.on(a,function(d){var e=function(){g(b,{$event:d})};Kg[a]&&c.$$phase?b.$evalAsync(e):b.$apply(e)})}}}}]});var Ce=["$animate","$compile",function(a,
b){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(d,c,e,f,g){var h,k,l;d.$watch(e.ngIf,function(d){d?k||g(function(d,f){k=f;d[d.length++]=b.$$createComment("end ngIf",e.ngIf);h={clone:d};a.enter(d,c.parent(),c)}):(l&&(l.remove(),l=null),k&&(k.$destroy(),k=null),h&&(l=ub(h.clone),a.leave(l).then(function(){l=null}),h=null))})}}}],De=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,
transclude:"element",controller:ea.noop,compile:function(c,e){var f=e.ngInclude||e.src,g=e.onload||"",h=e.autoscroll;return function(c,e,m,n,p){var q=0,s,x,r,w=function(){x&&(x.remove(),x=null);s&&(s.$destroy(),s=null);r&&(d.leave(r).then(function(){x=null}),x=r,r=null)};c.$watch(f,function(f){var m=function(){!A(h)||h&&!c.$eval(h)||b()},t=++q;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&t===q){var b=c.$new();n.template=a;a=p(b,function(a){w();d.enter(a,null,e).then(m)});s=b;r=a;s.$emit("$includeContentLoaded",
f);c.$eval(g)}},function(){c.$$destroyed||t!==q||(w(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(w(),n.template=null)})}}}}],Ue=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(b,d,c,e){ka.call(d[0]).match(/SVG/)?(d.empty(),a(Lc(e.template,P).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],Ee=Na({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),
Qe=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,b,d,c){var e=b.attr(d.$attr.ngList)||", ",f="false"!==d.ngTrim,g=f?W(e):e;c.$parsers.push(function(a){if(!z(a)){var b=[];a&&q(a.split(g),function(a){a&&b.push(f?W(a):a)});return b}});c.$formatters.push(function(a){return M(a)?a.join(e):u});c.$isEmpty=function(a){return!a||!a.length}}}},pb="ng-valid",Md="ng-invalid",Xa="ng-pristine",Lb="ng-dirty",Od="ng-pending",ob=O("ngModel"),Lg=["$scope","$exceptionHandler","$attrs",
"$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(a,b,d,c,e,f,g,h,k,l){this.$modelValue=this.$viewValue=Number.NaN;this.$$rawModelValue=u;this.$validators={};this.$asyncValidators={};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$untouched=!0;this.$touched=!1;this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending=u;this.$name=l(d.name||"",!1)(a);this.$$parentForm=Kb;var m=e(d.ngModel),
n=m.assign,p=m,s=n,y=null,x,r=this;this.$$setOptions=function(a){if((r.$options=a)&&a.getterSetter){var b=e(d.ngModel+"()"),f=e(d.ngModel+"($$$p)");p=function(a){var c=m(a);D(c)&&(c=b(a));return c};s=function(a,b){D(m(a))?f(a,{$$$p:b}):n(a,b)}}else if(!m.assign)throw ob("nonassign",d.ngModel,wa(c));};this.$render=E;this.$isEmpty=function(a){return z(a)||""===a||null===a||a!==a};this.$$updateEmptyClasses=function(a){r.$isEmpty(a)?(f.removeClass(c,"ng-not-empty"),f.addClass(c,"ng-empty")):(f.removeClass(c,
"ng-empty"),f.addClass(c,"ng-not-empty"))};var w=0;Id({ctrl:this,$element:c,set:function(a,b){a[b]=!0},unset:function(a,b){delete a[b]},$animate:f});this.$setPristine=function(){r.$dirty=!1;r.$pristine=!0;f.removeClass(c,Lb);f.addClass(c,Xa)};this.$setDirty=function(){r.$dirty=!0;r.$pristine=!1;f.removeClass(c,Xa);f.addClass(c,Lb);r.$$parentForm.$setDirty()};this.$setUntouched=function(){r.$touched=!1;r.$untouched=!0;f.setClass(c,"ng-untouched","ng-touched")};this.$setTouched=function(){r.$touched=
!0;r.$untouched=!1;f.setClass(c,"ng-touched","ng-untouched")};this.$rollbackViewValue=function(){g.cancel(y);r.$viewValue=r.$$lastCommittedViewValue;r.$render()};this.$validate=function(){if(!R(r.$modelValue)||!isNaN(r.$modelValue)){var a=r.$$rawModelValue,b=r.$valid,c=r.$modelValue,d=r.$options&&r.$options.allowInvalid;r.$$runValidators(a,r.$$lastCommittedViewValue,function(e){d||b===e||(r.$modelValue=e?a:u,r.$modelValue!==c&&r.$$writeModelToScope())})}};this.$$runValidators=function(a,b,c){function d(){var c=
!0;q(r.$validators,function(d,e){var g=d(a,b);c=c&&g;f(e,g)});return c?!0:(q(r.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;q(r.$asyncValidators,function(e,g){var h=e(a,b);if(!h||!D(h.then))throw ob("nopromise",h);f(g,u);c.push(h.then(function(){f(g,!0)},function(){d=!1;f(g,!1)}))});c.length?k.all(c).then(function(){g(d)},E):g(!0)}function f(a,b){h===w&&r.$setValidity(a,b)}function g(a){h===w&&c(a)}w++;var h=w;(function(){var a=r.$$parserName||"parse";if(z(x))f(a,null);
else return x||(q(r.$validators,function(a,b){f(b,null)}),q(r.$asyncValidators,function(a,b){f(b,null)})),f(a,x),x;return!0})()?d()?e():g(!1):g(!1)};this.$commitViewValue=function(){var a=r.$viewValue;g.cancel(y);if(r.$$lastCommittedViewValue!==a||""===a&&r.$$hasNativeValidators)r.$$updateEmptyClasses(a),r.$$lastCommittedViewValue=a,r.$pristine&&this.$setDirty(),this.$$parseAndValidate()};this.$$parseAndValidate=function(){var b=r.$$lastCommittedViewValue;if(x=z(b)?u:!0)for(var c=0;c<r.$parsers.length;c++)if(b=
r.$parsers[c](b),z(b)){x=!1;break}R(r.$modelValue)&&isNaN(r.$modelValue)&&(r.$modelValue=p(a));var d=r.$modelValue,e=r.$options&&r.$options.allowInvalid;r.$$rawModelValue=b;e&&(r.$modelValue=b,r.$modelValue!==d&&r.$$writeModelToScope());r.$$runValidators(b,r.$$lastCommittedViewValue,function(a){e||(r.$modelValue=a?b:u,r.$modelValue!==d&&r.$$writeModelToScope())})};this.$$writeModelToScope=function(){s(a,r.$modelValue);q(r.$viewChangeListeners,function(a){try{a()}catch(c){b(c)}})};this.$setViewValue=
function(a,b){r.$viewValue=a;r.$options&&!r.$options.updateOnDefault||r.$$debounceViewValueCommit(b)};this.$$debounceViewValueCommit=function(b){var c=0,d=r.$options;d&&A(d.debounce)&&(d=d.debounce,R(d)?c=d:R(d[b])?c=d[b]:R(d["default"])&&(c=d["default"]));g.cancel(y);c?y=g(function(){r.$commitViewValue()},c):h.$$phase?r.$commitViewValue():a.$apply(function(){r.$commitViewValue()})};a.$watch(function(){var b=p(a);if(b!==r.$modelValue&&(r.$modelValue===r.$modelValue||b===b)){r.$modelValue=r.$$rawModelValue=
b;x=u;for(var c=r.$formatters,d=c.length,e=b;d--;)e=c[d](e);r.$viewValue!==e&&(r.$$updateEmptyClasses(e),r.$viewValue=r.$$lastCommittedViewValue=e,r.$render(),r.$$runValidators(b,e,E))}return b})}],Pe=["$rootScope",function(a){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:Lg,priority:1,compile:function(b){b.addClass(Xa).addClass("ng-untouched").addClass(pb);return{pre:function(a,b,e,f){var g=f[0];b=f[1]||g.$$parentForm;g.$$setOptions(f[2]&&f[2].$options);b.$addControl(g);
e.$observe("name",function(a){g.$name!==a&&g.$$parentForm.$$renameControl(g,a)});a.$on("$destroy",function(){g.$$parentForm.$removeControl(g)})},post:function(b,c,e,f){var g=f[0];if(g.$options&&g.$options.updateOn)c.on(g.$options.updateOn,function(a){g.$$debounceViewValueCommit(a&&a.type)});c.on("blur",function(){g.$touched||(a.$$phase?b.$evalAsync(g.$setTouched):b.$apply(g.$setTouched))})}}}}}],Mg=/(\s+|^)default(\s+|$)/,Te=function(){return{restrict:"A",controller:["$scope","$attrs",function(a,
b){var d=this;this.$options=pa(a.$eval(b.ngModelOptions));A(this.$options.updateOn)?(this.$options.updateOnDefault=!1,this.$options.updateOn=W(this.$options.updateOn.replace(Mg,function(){d.$options.updateOnDefault=!0;return" "}))):this.$options.updateOnDefault=!0}]}},Fe=Na({terminal:!0,priority:1E3}),Ng=O("ngOptions"),Og=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
Ne=["$compile","$parse",function(a,b){function d(a,c,d){function e(a,b,c,d,f){this.selectValue=a;this.viewValue=b;this.label=c;this.group=d;this.disabled=f}function l(a){var b;if(!p&&za(a))b=a;else{b=[];for(var c in a)a.hasOwnProperty(c)&&"$"!==c.charAt(0)&&b.push(c)}return b}var m=a.match(Og);if(!m)throw Ng("iexp",a,wa(c));var n=m[5]||m[7],p=m[6];a=/ as /.test(m[0])&&m[1];var q=m[9];c=b(m[2]?m[1]:n);var s=a&&b(a)||c,x=q&&b(q),r=q?function(a,b){return x(d,b)}:function(a){return Ha(a)},w=function(a,
b){return r(a,y(a,b))},v=b(m[2]||m[1]),u=b(m[3]||""),t=b(m[4]||""),G=b(m[8]),C={},y=p?function(a,b){C[p]=b;C[n]=a;return C}:function(a){C[n]=a;return C};return{trackBy:q,getTrackByValue:w,getWatchables:b(G,function(a){var b=[];a=a||[];for(var c=l(a),e=c.length,f=0;f<e;f++){var g=a===c?f:c[f],k=a[g],g=y(k,g),k=r(k,g);b.push(k);if(m[2]||m[1])k=v(d,g),b.push(k);m[4]&&(g=t(d,g),b.push(g))}return b}),getOptions:function(){for(var a=[],b={},c=G(d)||[],f=l(c),g=f.length,m=0;m<g;m++){var n=c===f?m:f[m],p=
y(c[n],n),x=s(d,p),n=r(x,p),C=v(d,p),A=u(d,p),p=t(d,p),x=new e(n,x,C,A,p);a.push(x);b[n]=x}return{items:a,selectValueMap:b,getOptionFromViewValue:function(a){return b[w(a)]},getViewValueFromOption:function(a){return q?ea.copy(a.viewValue):a.viewValue}}}}}var c=P.createElement("option"),e=P.createElement("optgroup");return{restrict:"A",terminal:!0,require:["select","ngModel"],link:{pre:function(a,b,c,d){d[0].registerOption=E},post:function(b,g,h,k){function l(a,b){a.element=b;b.disabled=a.disabled;
a.label!==b.label&&(b.label=a.label,b.textContent=a.label);a.value!==b.value&&(b.value=a.selectValue)}function m(a,b,c,d){b&&N(b.nodeName)===c?c=b:(c=d.cloneNode(!1),b?a.insertBefore(c,b):a.appendChild(c));return c}function n(a){for(var b;a;)b=a.nextSibling,Yb(a),a=b}function p(a){var b=w&&w[0],c=G&&G[0];if(b||c)for(;a&&(a===b||a===c||8===a.nodeType||"option"===oa(a)&&""===a.value);)a=a.nextSibling;return a}function s(){var a=C&&u.readValue();C=z.getOptions();var b={},d=g[0].firstChild;t&&g.prepend(w);
d=p(d);C.items.forEach(function(a){var f,h;A(a.group)?(f=b[a.group],f||(f=m(g[0],d,"optgroup",e),d=f.nextSibling,f.label=a.group,f=b[a.group]={groupElement:f,currentOptionElement:f.firstChild}),h=m(f.groupElement,f.currentOptionElement,"option",c),l(a,h),f.currentOptionElement=h.nextSibling):(h=m(g[0],d,"option",c),l(a,h),d=h.nextSibling)});Object.keys(b).forEach(function(a){n(b[a].currentOptionElement)});n(d);x.$render();if(!x.$isEmpty(a)){var f=u.readValue();(z.trackBy||r?na(a,f):a===f)||(x.$setViewValue(f),
x.$render())}}var u=k[0],x=k[1],r=h.multiple,w;k=0;for(var v=g.children(),y=v.length;k<y;k++)if(""===v[k].value){w=v.eq(k);break}var t=!!w,G=H(c.cloneNode(!1));G.val("?");var C,z=d(h.ngOptions,g,b);r?(x.$isEmpty=function(a){return!a||0===a.length},u.writeValue=function(a){C.items.forEach(function(a){a.element.selected=!1});a&&a.forEach(function(a){(a=C.getOptionFromViewValue(a))&&!a.disabled&&(a.element.selected=!0)})},u.readValue=function(){var a=g.val()||[],b=[];q(a,function(a){(a=C.selectValueMap[a])&&
!a.disabled&&b.push(C.getViewValueFromOption(a))});return b},z.trackBy&&b.$watchCollection(function(){if(M(x.$viewValue))return x.$viewValue.map(function(a){return z.getTrackByValue(a)})},function(){x.$render()})):(u.writeValue=function(a){var b=C.getOptionFromViewValue(a);b&&!b.disabled?(g[0].value!==b.selectValue&&(G.remove(),t||w.remove(),g[0].value=b.selectValue,b.element.selected=!0),b.element.setAttribute("selected","selected")):null===a||t?(G.remove(),t||g.prepend(w),g.val(""),w.prop("selected",
!0),w.attr("selected",!0)):(t||w.remove(),g.prepend(G),g.val("?"),G.prop("selected",!0),G.attr("selected",!0))},u.readValue=function(){var a=C.selectValueMap[g.val()];return a&&!a.disabled?(t||w.remove(),G.remove(),C.getViewValueFromOption(a)):null},z.trackBy&&b.$watch(function(){return z.getTrackByValue(x.$viewValue)},function(){x.$render()}));t?(w.remove(),a(w)(b),w.removeClass("ng-scope")):w=H(c.cloneNode(!1));s();b.$watchCollection(z.getWatchables,s)}}}}],Ge=["$locale","$interpolate","$log",function(a,
b,d){var c=/{}/g,e=/^when(Minus)?(.+)$/;return{link:function(f,g,h){function k(a){g.text(a||"")}var l=h.count,m=h.$attr.when&&g.attr(h.$attr.when),n=h.offset||0,p=f.$eval(m)||{},s={},u=b.startSymbol(),x=b.endSymbol(),r=u+l+"-"+n+x,w=ea.noop,v;q(h,function(a,b){var c=e.exec(b);c&&(c=(c[1]?"-":"")+N(c[2]),p[c]=g.attr(h.$attr[b]))});q(p,function(a,d){s[d]=b(a.replace(c,r))});f.$watch(l,function(b){var c=parseFloat(b),e=isNaN(c);e||c in p||(c=a.pluralCat(c-n));c===v||e&&R(v)&&isNaN(v)||(w(),e=s[c],z(e)?
(null!=b&&d.debug("ngPluralize: no rule defined for '"+c+"' in "+m),w=E,k()):w=f.$watch(e,k),v=c)})}}}],He=["$parse","$animate","$compile",function(a,b,d){var c=O("ngRepeat"),e=function(a,b,c,d,e,m,n){a[c]=d;e&&(a[e]=m);a.$index=b;a.$first=0===b;a.$last=b===n-1;a.$middle=!(a.$first||a.$last);a.$odd=!(a.$even=0===(b&1))};return{restrict:"A",multiElement:!0,transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,compile:function(f,g){var h=g.ngRepeat,k=d.$$createComment("end ngRepeat",h),l=h.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
if(!l)throw c("iexp",h);var m=l[1],n=l[2],p=l[3],s=l[4],l=m.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);if(!l)throw c("iidexp",m);var y=l[3]||l[1],x=l[2];if(p&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(p)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(p)))throw c("badident",p);var r,w,v,z,t={$id:Ha};s?r=a(s):(v=function(a,b){return Ha(b)},z=function(a){return a});return function(a,d,f,g,l){r&&(w=function(b,c,d){x&&(t[x]=b);t[y]=c;t.$index=
d;return r(a,t)});var m=V();a.$watchCollection(n,function(f){var g,n,r=d[0],s,t=V(),A,E,H,D,I,F,J;p&&(a[p]=f);if(za(f))I=f,n=w||v;else for(J in n=w||z,I=[],f)va.call(f,J)&&"$"!==J.charAt(0)&&I.push(J);A=I.length;J=Array(A);for(g=0;g<A;g++)if(E=f===I?g:I[g],H=f[E],D=n(E,H,g),m[D])F=m[D],delete m[D],t[D]=F,J[g]=F;else{if(t[D])throw q(J,function(a){a&&a.scope&&(m[a.id]=a)}),c("dupes",h,D,H);J[g]={id:D,scope:u,clone:u};t[D]=!0}for(s in m){F=m[s];D=ub(F.clone);b.leave(D);if(D[0].parentNode)for(g=0,n=D.length;g<
n;g++)D[g].$$NG_REMOVED=!0;F.scope.$destroy()}for(g=0;g<A;g++)if(E=f===I?g:I[g],H=f[E],F=J[g],F.scope){s=r;do s=s.nextSibling;while(s&&s.$$NG_REMOVED);F.clone[0]!=s&&b.move(ub(F.clone),null,r);r=F.clone[F.clone.length-1];e(F.scope,g,y,H,x,E,A)}else l(function(a,c){F.scope=c;var d=k.cloneNode(!1);a[a.length++]=d;b.enter(a,null,r);r=d;F.clone=a;t[F.id]=F;e(F.scope,g,y,H,x,E,A)});m=t})}}}}],Ie=["$animate",function(a){return{restrict:"A",multiElement:!0,link:function(b,d,c){b.$watch(c.ngShow,function(b){a[b?
"removeClass":"addClass"](d,"ng-hide",{tempClasses:"ng-hide-animate"})})}}}],Be=["$animate",function(a){return{restrict:"A",multiElement:!0,link:function(b,d,c){b.$watch(c.ngHide,function(b){a[b?"addClass":"removeClass"](d,"ng-hide",{tempClasses:"ng-hide-animate"})})}}}],Je=Na(function(a,b,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&q(d,function(a,c){b.css(c,"")});a&&b.css(a)},!0)}),Ke=["$animate","$compile",function(a,b){return{require:"ngSwitch",controller:["$scope",function(){this.cases={}}],
link:function(d,c,e,f){var g=[],h=[],k=[],l=[],m=function(a,b){return function(){a.splice(b,1)}};d.$watch(e.ngSwitch||e.on,function(c){var d,e;d=0;for(e=k.length;d<e;++d)a.cancel(k[d]);d=k.length=0;for(e=l.length;d<e;++d){var s=ub(h[d].clone);l[d].$destroy();(k[d]=a.leave(s)).then(m(k,d))}h.length=0;l.length=0;(g=f.cases["!"+c]||f.cases["?"])&&q(g,function(c){c.transclude(function(d,e){l.push(e);var f=c.element;d[d.length++]=b.$$createComment("end ngSwitchWhen");h.push({clone:d});a.enter(d,f.parent(),
f)})})})}}}],Le=Na({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,b,d,c,e){c.cases["!"+d.ngSwitchWhen]=c.cases["!"+d.ngSwitchWhen]||[];c.cases["!"+d.ngSwitchWhen].push({transclude:e,element:b})}}),Me=Na({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,b,d,c,e){c.cases["?"]=c.cases["?"]||[];c.cases["?"].push({transclude:e,element:b})}}),Pg=O("ngTransclude"),Oe=Na({restrict:"EAC",link:function(a,b,d,c,e){d.ngTransclude===
d.$attr.ngTransclude&&(d.ngTransclude="");if(!e)throw Pg("orphan",wa(b));e(function(a){a.length&&(b.empty(),b.append(a))},null,d.ngTransclude||d.ngTranscludeSlot)}}),oe=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(b,d){"text/ng-template"==d.type&&a.put(d.id,b[0].text)}}}],Qg={$setViewValue:E,$render:E},Rg=["$element","$scope",function(a,b){var d=this,c=new Ua;d.ngModelCtrl=Qg;d.unknownOption=H(P.createElement("option"));d.renderUnknownOption=function(b){b="? "+Ha(b)+
" ?";d.unknownOption.val(b);a.prepend(d.unknownOption);a.val(b)};b.$on("$destroy",function(){d.renderUnknownOption=E});d.removeUnknownOption=function(){d.unknownOption.parent()&&d.unknownOption.remove()};d.readValue=function(){d.removeUnknownOption();return a.val()};d.writeValue=function(b){d.hasOption(b)?(d.removeUnknownOption(),a.val(b),""===b&&d.emptyOption.prop("selected",!0)):null==b&&d.emptyOption?(d.removeUnknownOption(),a.val("")):d.renderUnknownOption(b)};d.addOption=function(a,b){if(8!==
b[0].nodeType){Ta(a,'"option value"');""===a&&(d.emptyOption=b);var g=c.get(a)||0;c.put(a,g+1);d.ngModelCtrl.$render();b[0].hasAttribute("selected")&&(b[0].selected=!0)}};d.removeOption=function(a){var b=c.get(a);b&&(1===b?(c.remove(a),""===a&&(d.emptyOption=u)):c.put(a,b-1))};d.hasOption=function(a){return!!c.get(a)};d.registerOption=function(a,b,c,h,k){if(h){var l;c.$observe("value",function(a){A(l)&&d.removeOption(l);l=a;d.addOption(a,b)})}else k?a.$watch(k,function(a,e){c.$set("value",a);e!==
a&&d.removeOption(e);d.addOption(a,b)}):d.addOption(c.value,b);b.on("$destroy",function(){d.removeOption(c.value);d.ngModelCtrl.$render()})}}],pe=function(){return{restrict:"E",require:["select","?ngModel"],controller:Rg,priority:1,link:{pre:function(a,b,d,c){var e=c[1];if(e){var f=c[0];f.ngModelCtrl=e;b.on("change",function(){a.$apply(function(){e.$setViewValue(f.readValue())})});if(d.multiple){f.readValue=function(){var a=[];q(b.find("option"),function(b){b.selected&&a.push(b.value)});return a};
f.writeValue=function(a){var c=new Ua(a);q(b.find("option"),function(a){a.selected=A(c.get(a.value))})};var g,h=NaN;a.$watch(function(){h!==e.$viewValue||na(g,e.$viewValue)||(g=ia(e.$viewValue),e.$render());h=e.$viewValue});e.$isEmpty=function(a){return!a||0===a.length}}}},post:function(a,b,d,c){var e=c[1];if(e){var f=c[0];e.$render=function(){f.writeValue(e.$viewValue)}}}}}},re=["$interpolate",function(a){return{restrict:"E",priority:100,compile:function(b,d){if(A(d.value))var c=a(d.value,!0);else{var e=
a(b.text(),!0);e||d.$set("value",b.text())}return function(a,b,d){var k=b.parent();(k=k.data("$selectController")||k.parent().data("$selectController"))&&k.registerOption(a,b,d,c,e)}}}}],qe=da({restrict:"E",terminal:!1}),Fc=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){c&&(d.required=!0,c.$validators.required=function(a,b){return!d.required||!c.$isEmpty(b)},d.$observe("required",function(){c.$validate()}))}}},Ec=function(){return{restrict:"A",require:"?ngModel",link:function(a,
b,d,c){if(c){var e,f=d.ngPattern||d.pattern;d.$observe("pattern",function(a){y(a)&&0<a.length&&(a=new RegExp("^"+a+"$"));if(a&&!a.test)throw O("ngPattern")("noregexp",f,a,wa(b));e=a||u;c.$validate()});c.$validators.pattern=function(a,b){return c.$isEmpty(b)||z(e)||e.test(b)}}}}},Hc=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=-1;d.$observe("maxlength",function(a){a=Y(a);e=isNaN(a)?-1:a;c.$validate()});c.$validators.maxlength=function(a,b){return 0>e||c.$isEmpty(b)||
b.length<=e}}}}},Gc=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=0;d.$observe("minlength",function(a){e=Y(a)||0;c.$validate()});c.$validators.minlength=function(a,b){return c.$isEmpty(b)||b.length>=e}}}}};T.angular.bootstrap?T.console&&console.log("WARNING: Tried to load angular more than once."):(he(),je(ea),ea.module("ngLocale",[],["$provide",function(a){function b(a){a+="";var b=a.indexOf(".");return-1==b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM",
"PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),WEEKENDRANGE:[5,
6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a,
c){var e=a|0,f=c;u===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),H(P).ready(function(){de(P,yc)}))})(window,document);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');
//# sourceMappingURL=angular.min.js.map

/*!
 * ionic.bundle.js is a concatenation of:
 * ionic.js, angular.js, angular-animate.js,
 * angular-sanitize.js, angular-ui-router.js,
 * and ionic-angular.js
 */

/*
 AngularJS v1.5.3
 (c) 2010-2016 Google, Inc. http://angularjs.org
 License: MIT
*/
(function(E,w,Va){'use strict';function ya(a,b,c){if(!a)throw Ka("areq",b||"?",c||"required");return a}function za(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;ba(a)&&(a=a.join(" "));ba(b)&&(b=b.join(" "));return a+" "+b}function La(a){var b={};a&&(a.to||a.from)&&(b.to=a.to,b.from=a.from);return b}function V(a,b,c){var d="";a=ba(a)?a:a&&I(a)&&a.length?a.split(/\s+/):[];q(a,function(a,f){a&&0<a.length&&(d+=0<f?" ":"",d+=c?b+a:a+b)});return d}function Ma(a){if(a instanceof H)switch(a.length){case 0:return[];
case 1:if(1===a[0].nodeType)return a;break;default:return H(ga(a))}if(1===a.nodeType)return H(a)}function ga(a){if(!a[0])return a;for(var b=0;b<a.length;b++){var c=a[b];if(1==c.nodeType)return c}}function Na(a,b,c){q(b,function(b){a.addClass(b,c)})}function Oa(a,b,c){q(b,function(b){a.removeClass(b,c)})}function Q(a){return function(b,c){c.addClass&&(Na(a,b,c.addClass),c.addClass=null);c.removeClass&&(Oa(a,b,c.removeClass),c.removeClass=null)}}function oa(a){a=a||{};if(!a.$$prepared){var b=a.domOperation||
O;a.domOperation=function(){a.$$domOperationFired=!0;b();b=O};a.$$prepared=!0}return a}function ha(a,b){Aa(a,b);Ba(a,b)}function Aa(a,b){b.from&&(a.css(b.from),b.from=null)}function Ba(a,b){b.to&&(a.css(b.to),b.to=null)}function T(a,b,c){var d=b.options||{};c=c.options||{};var e=(d.addClass||"")+" "+(c.addClass||""),f=(d.removeClass||"")+" "+(c.removeClass||"");a=Pa(a.attr("class"),e,f);c.preparationClasses&&(d.preparationClasses=W(c.preparationClasses,d.preparationClasses),delete c.preparationClasses);
e=d.domOperation!==O?d.domOperation:null;Ca(d,c);e&&(d.domOperation=e);d.addClass=a.addClass?a.addClass:null;d.removeClass=a.removeClass?a.removeClass:null;b.addClass=d.addClass;b.removeClass=d.removeClass;return d}function Pa(a,b,c){function d(a){I(a)&&(a=a.split(" "));var b={};q(a,function(a){a.length&&(b[a]=!0)});return b}var e={};a=d(a);b=d(b);q(b,function(a,b){e[b]=1});c=d(c);q(c,function(a,b){e[b]=1===e[b]?null:-1});var f={addClass:"",removeClass:""};q(e,function(b,c){var d,e;1===b?(d="addClass",
e=!a[c]):-1===b&&(d="removeClass",e=a[c]);e&&(f[d].length&&(f[d]+=" "),f[d]+=c)});return f}function A(a){return a instanceof w.element?a[0]:a}function Qa(a,b,c){var d="";b&&(d=V(b,"ng-",!0));c.addClass&&(d=W(d,V(c.addClass,"-add")));c.removeClass&&(d=W(d,V(c.removeClass,"-remove")));d.length&&(c.preparationClasses=d,a.addClass(d))}function pa(a,b){var c=b?"-"+b+"s":"";la(a,[ma,c]);return[ma,c]}function ra(a,b){var c=b?"paused":"",d=X+"PlayState";la(a,[d,c]);return[d,c]}function la(a,b){a.style[b[0]]=
b[1]}function W(a,b){return a?b?a+" "+b:a:b}function Da(a,b,c){var d=Object.create(null),e=a.getComputedStyle(b)||{};q(c,function(a,b){var c=e[a];if(c){var F=c.charAt(0);if("-"===F||"+"===F||0<=F)c=Ra(c);0===c&&(c=null);d[b]=c}});return d}function Ra(a){var b=0;a=a.split(/\s*,\s*/);q(a,function(a){"s"==a.charAt(a.length-1)&&(a=a.substring(0,a.length-1));a=parseFloat(a)||0;b=b?Math.max(a,b):a});return b}function sa(a){return 0===a||null!=a}function Ea(a,b){var c=R,d=a+"s";b?c+="Duration":d+=" linear all";
return[c,d]}function Fa(){var a=Object.create(null);return{flush:function(){a=Object.create(null)},count:function(b){return(b=a[b])?b.total:0},get:function(b){return(b=a[b])&&b.value},put:function(b,c){a[b]?a[b].total++:a[b]={total:1,value:c}}}}function Ga(a,b,c){q(c,function(c){a[c]=Y(a[c])?a[c]:b.style.getPropertyValue(c)})}var O=w.noop,Ha=w.copy,Ca=w.extend,H=w.element,q=w.forEach,ba=w.isArray,I=w.isString,ca=w.isObject,N=w.isUndefined,Y=w.isDefined,Ia=w.isFunction,ta=w.isElement,R,ua,X,va;N(E.ontransitionend)&&
Y(E.onwebkittransitionend)?(R="WebkitTransition",ua="webkitTransitionEnd transitionend"):(R="transition",ua="transitionend");N(E.onanimationend)&&Y(E.onwebkitanimationend)?(X="WebkitAnimation",va="webkitAnimationEnd animationend"):(X="animation",va="animationend");var qa=X+"Delay",wa=X+"Duration",ma=R+"Delay";E=R+"Duration";var Ka=w.$$minErr("ng"),Sa={transitionDuration:E,transitionDelay:ma,transitionProperty:R+"Property",animationDuration:wa,animationDelay:qa,animationIterationCount:X+"IterationCount"},
Ta={transitionDuration:E,transitionDelay:ma,animationDuration:wa,animationDelay:qa};w.module("ngAnimate",[]).directive("ngAnimateSwap",["$animate","$rootScope",function(a,b){return{restrict:"A",transclude:"element",terminal:!0,priority:600,link:function(b,d,e,f,r){var x,F;b.$watchCollection(e.ngAnimateSwap||e["for"],function(e){x&&a.leave(x);F&&(F.$destroy(),F=null);if(e||0===e)F=b.$new(),r(F,function(b){x=b;a.enter(b,null,d)})})}}}]).directive("ngAnimateChildren",["$interpolate",function(a){return{link:function(b,
c,d){function e(a){c.data("$$ngAnimateChildren","on"===a||"true"===a)}var f=d.ngAnimateChildren;w.isString(f)&&0===f.length?c.data("$$ngAnimateChildren",!0):(e(a(f)(b)),d.$observe("ngAnimateChildren",e))}}}]).factory("$$rAFScheduler",["$$rAF",function(a){function b(a){d=d.concat(a);c()}function c(){if(d.length){for(var b=d.shift(),r=0;r<b.length;r++)b[r]();e||a(function(){e||c()})}}var d,e;d=b.queue=[];b.waitUntilQuiet=function(b){e&&e();e=a(function(){e=null;b();c()})};return b}]).provider("$$animateQueue",
["$animateProvider",function(a){function b(a){if(!a)return null;a=a.split(" ");var b=Object.create(null);q(a,function(a){b[a]=!0});return b}function c(a,c){if(a&&c){var d=b(c);return a.split(" ").some(function(a){return d[a]})}}function d(a,b,c,d){return f[a].some(function(a){return a(b,c,d)})}function e(a,b){var c=0<(a.addClass||"").length,d=0<(a.removeClass||"").length;return b?c&&d:c||d}var f=this.rules={skip:[],cancel:[],join:[]};f.join.push(function(a,b,c){return!b.structural&&e(b)});f.skip.push(function(a,
b,c){return!b.structural&&!e(b)});f.skip.push(function(a,b,c){return"leave"==c.event&&b.structural});f.skip.push(function(a,b,c){return c.structural&&2===c.state&&!b.structural});f.cancel.push(function(a,b,c){return c.structural&&b.structural});f.cancel.push(function(a,b,c){return 2===c.state&&b.structural});f.cancel.push(function(a,b,d){if(d.structural)return!1;a=b.addClass;b=b.removeClass;var e=d.addClass;d=d.removeClass;return N(a)&&N(b)||N(e)&&N(d)?!1:c(a,d)||c(b,e)});this.$get=["$$rAF","$rootScope",
"$rootElement","$document","$$HashMap","$$animation","$$AnimateRunner","$templateRequest","$$jqLite","$$forceReflow",function(b,c,f,u,l,w,s,M,v,h){function P(){var a=!1;return function(b){a?b():c.$$postDigest(function(){a=!0;b()})}}function y(a,b,c){var g=A(b),d=A(a),k=[];(a=G[c])&&q(a,function(a){t.call(a.node,g)?k.push(a.callback):"leave"===c&&t.call(a.node,d)&&k.push(a.callback)});return k}function k(a,g,k){function m(c,g,d,k){F(function(){var c=y(J,a,g);c.length&&b(function(){q(c,function(b){b(a,
d,k)})})});c.progress(g,d,k)}function G(b){var c=a,g=h;g.preparationClasses&&(c.removeClass(g.preparationClasses),g.preparationClasses=null);g.activeClasses&&(c.removeClass(g.activeClasses),g.activeClasses=null);Ja(a,h);ha(a,h);h.domOperation();f.complete(!b)}var h=Ha(k),t,J;if(a=Ma(a))t=A(a),J=a.parent();var h=oa(h),f=new s,F=P();ba(h.addClass)&&(h.addClass=h.addClass.join(" "));h.addClass&&!I(h.addClass)&&(h.addClass=null);ba(h.removeClass)&&(h.removeClass=h.removeClass.join(" "));h.removeClass&&
!I(h.removeClass)&&(h.removeClass=null);h.from&&!ca(h.from)&&(h.from=null);h.to&&!ca(h.to)&&(h.to=null);if(!t)return G(),f;k=[t.className,h.addClass,h.removeClass].join(" ");if(!Ua(k))return G(),f;var v=0<=["enter","move","leave"].indexOf(g),l=!K||u[0].hidden||C.get(t);k=!l&&z.get(t)||{};var Z=!!k.state;l||Z&&1==k.state||(l=!n(a,J,g));if(l)return G(),f;v&&xa(a);l={structural:v,element:a,event:g,addClass:h.addClass,removeClass:h.removeClass,close:G,options:h,runner:f};if(Z){if(d("skip",a,l,k)){if(2===
k.state)return G(),f;T(a,k,l);return k.runner}if(d("cancel",a,l,k))if(2===k.state)k.runner.end();else if(k.structural)k.close();else return T(a,k,l),k.runner;else if(d("join",a,l,k))if(2===k.state)T(a,l,{});else return Qa(a,v?g:null,h),g=l.event=k.event,h=T(a,k,l),k.runner}else T(a,l,{});(Z=l.structural)||(Z="animate"===l.event&&0<Object.keys(l.options.to||{}).length||e(l));if(!Z)return G(),ka(a),f;var M=(k.counter||0)+1;l.counter=M;D(a,1,l);c.$$postDigest(function(){var b=z.get(t),c=!b,b=b||{},d=
0<(a.parent()||[]).length&&("animate"===b.event||b.structural||e(b));if(c||b.counter!==M||!d){c&&(Ja(a,h),ha(a,h));if(c||v&&b.event!==g)h.domOperation(),f.end();d||ka(a)}else g=!b.structural&&e(b,!0)?"setClass":b.event,D(a,2),b=w(a,g,b.options),b.done(function(b){G(!b);(b=z.get(t))&&b.counter===M&&ka(A(a));m(f,g,"close",{})}),f.setHost(b),m(f,g,"start",{})});return f}function xa(a){a=A(a).querySelectorAll("[data-ng-animate]");q(a,function(a){var b=parseInt(a.getAttribute("data-ng-animate")),c=z.get(a);
if(c)switch(b){case 2:c.runner.end();case 1:z.remove(a)}})}function ka(a){a=A(a);a.removeAttribute("data-ng-animate");z.remove(a)}function J(a,b){return A(a)===A(b)}function n(a,b,c){c=H(u[0].body);var g=J(a,c)||"HTML"===a[0].nodeName,d=J(a,f),k=!1,h,m=C.get(A(a));(a=H.data(a[0],"$ngAnimatePin"))&&(b=a);for(b=A(b);b;){d||(d=J(b,f));if(1!==b.nodeType)break;a=z.get(b)||{};if(!k){var e=C.get(b);if(!0===e&&!1!==m){m=!0;break}else!1===e&&(m=!1);k=a.structural}if(N(h)||!0===h)a=H.data(b,"$$ngAnimateChildren"),
Y(a)&&(h=a);if(k&&!1===h)break;g||(g=J(b,c));if(g&&d)break;if(!d&&(a=H.data(b,"$ngAnimatePin"))){b=A(a);continue}b=b.parentNode}return(!k||h)&&!0!==m&&d&&g}function D(a,b,c){c=c||{};c.state=b;a=A(a);a.setAttribute("data-ng-animate",b);c=(b=z.get(a))?Ca(b,c):c;z.put(a,c)}var z=new l,C=new l,K=null,g=c.$watch(function(){return 0===M.totalPendingRequests},function(a){a&&(g(),c.$$postDigest(function(){c.$$postDigest(function(){null===K&&(K=!0)})}))}),G={},m=a.classNameFilter(),Ua=m?function(a){return m.test(a)}:
function(){return!0},Ja=Q(v),t=Node.prototype.contains||function(a){return this===a||!!(this.compareDocumentPosition(a)&16)},Z={on:function(a,b,c){var g=ga(b);G[a]=G[a]||[];G[a].push({node:g,callback:c});H(b).on("$destroy",function(){Z.off(a,b,c)})},off:function(a,b,c){function g(a,b,c){var d=ga(b);return a.filter(function(a){return!(a.node===d&&(!c||a.callback===c))})}var d=G[a];d&&(G[a]=1===arguments.length?null:g(d,b,c))},pin:function(a,b){ya(ta(a),"element","not an element");ya(ta(b),"parentElement",
"not an element");a.data("$ngAnimatePin",b)},push:function(a,b,c,g){c=c||{};c.domOperation=g;return k(a,b,c)},enabled:function(a,b){var c=arguments.length;if(0===c)b=!!K;else if(ta(a)){var g=A(a),d=C.get(g);1===c?b=!d:C.put(g,!b)}else b=K=!!a;return b}};return Z}]}]).provider("$$animation",["$animateProvider",function(a){function b(a){return a.data("$$animationRunner")}var c=this.drivers=[];this.$get=["$$jqLite","$rootScope","$injector","$$AnimateRunner","$$HashMap","$$rAFScheduler",function(a,e,
f,r,x,F){function u(a){function b(a){if(a.processed)return a;a.processed=!0;var d=a.domNode,h=d.parentNode;e.put(d,a);for(var f;h;){if(f=e.get(h)){f.processed||(f=b(f));break}h=h.parentNode}(f||c).children.push(a);return a}var c={children:[]},d,e=new x;for(d=0;d<a.length;d++){var f=a[d];e.put(f.domNode,a[d]={domNode:f.domNode,fn:f.fn,children:[]})}for(d=0;d<a.length;d++)b(a[d]);return function(a){var b=[],c=[],d;for(d=0;d<a.children.length;d++)c.push(a.children[d]);a=c.length;var h=0,e=[];for(d=0;d<
c.length;d++){var f=c[d];0>=a&&(a=h,h=0,b.push(e),e=[]);e.push(f.fn);f.children.forEach(function(a){h++;c.push(a)});a--}e.length&&b.push(e);return b}(c)}var l=[],w=Q(a);return function(s,x,v){function h(a){a=a.hasAttribute("ng-animate-ref")?[a]:a.querySelectorAll("[ng-animate-ref]");var b=[];q(a,function(a){var c=a.getAttribute("ng-animate-ref");c&&c.length&&b.push(a)});return b}function P(a){var b=[],c={};q(a,function(a,g){var d=A(a.element),k=0<=["enter","move"].indexOf(a.event),d=a.structural?
h(d):[];if(d.length){var e=k?"to":"from";q(d,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]||{};c[b][e]={animationID:g,element:H(a)}})}else b.push(a)});var d={},k={};q(c,function(c,h){var e=c.from,f=c.to;if(e&&f){var m=a[e.animationID],C=a[f.animationID],n=e.animationID.toString();if(!k[n]){var D=k[n]={structural:!0,beforeStart:function(){m.beforeStart();C.beforeStart()},close:function(){m.close();C.close()},classes:y(m.classes,C.classes),from:m,to:C,anchors:[]};D.classes.length?b.push(D):
(b.push(m),b.push(C))}k[n].anchors.push({out:e.element,"in":f.element})}else e=e?e.animationID:f.animationID,f=e.toString(),d[f]||(d[f]=!0,b.push(a[e]))});return b}function y(a,b){a=a.split(" ");b=b.split(" ");for(var c=[],d=0;d<a.length;d++){var k=a[d];if("ng-"!==k.substring(0,3))for(var e=0;e<b.length;e++)if(k===b[e]){c.push(k);break}}return c.join(" ")}function k(a){for(var b=c.length-1;0<=b;b--){var d=c[b];if(f.has(d)&&(d=f.get(d)(a)))return d}}function xa(a,c){a.from&&a.to?(b(a.from.element).setHost(c),
b(a.to.element).setHost(c)):b(a.element).setHost(c)}function ka(){var a=b(s);!a||"leave"===x&&v.$$domOperationFired||a.end()}function J(b){s.off("$destroy",ka);s.removeData("$$animationRunner");w(s,v);ha(s,v);v.domOperation();C&&a.removeClass(s,C);s.removeClass("ng-animate");D.complete(!b)}v=oa(v);var n=0<=["enter","move","leave"].indexOf(x),D=new r({end:function(){J()},cancel:function(){J(!0)}});if(!c.length)return J(),D;s.data("$$animationRunner",D);var z=za(s.attr("class"),za(v.addClass,v.removeClass)),
C=v.tempClasses;C&&(z+=" "+C,v.tempClasses=null);var K;n&&(K="ng-"+x+"-prepare",a.addClass(s,K));l.push({element:s,classes:z,event:x,structural:n,options:v,beforeStart:function(){s.addClass("ng-animate");C&&a.addClass(s,C);K&&(a.removeClass(s,K),K=null)},close:J});s.on("$destroy",ka);if(1<l.length)return D;e.$$postDigest(function(){var a=[];q(l,function(c){b(c.element)?a.push(c):c.close()});l.length=0;var c=P(a),d=[];q(c,function(a){d.push({domNode:A(a.from?a.from.element:a.element),fn:function(){a.beforeStart();
var c,d=a.close;if(b(a.anchors?a.from.element||a.to.element:a.element)){var g=k(a);g&&(c=g.start)}c?(c=c(),c.done(function(a){d(!a)}),xa(a,c)):d()}})});F(u(d))});return D}}]}]).provider("$animateCss",["$animateProvider",function(a){var b=Fa(),c=Fa();this.$get=["$window","$$jqLite","$$AnimateRunner","$timeout","$$forceReflow","$sniffer","$$rAFScheduler","$$animateQueue",function(a,e,f,r,x,F,u,l){function w(a,b){var c=a.parentNode;return(c.$$ngAnimateParentKey||(c.$$ngAnimateParentKey=++P))+"-"+a.getAttribute("class")+
"-"+b}function s(k,h,f,l){var n;0<b.count(f)&&(n=c.get(f),n||(h=V(h,"-stagger"),e.addClass(k,h),n=Da(a,k,l),n.animationDuration=Math.max(n.animationDuration,0),n.transitionDuration=Math.max(n.transitionDuration,0),e.removeClass(k,h),c.put(f,n)));return n||{}}function M(a){y.push(a);u.waitUntilQuiet(function(){b.flush();c.flush();for(var a=x(),d=0;d<y.length;d++)y[d](a);y.length=0})}function v(c,h,e){h=b.get(e);h||(h=Da(a,c,Sa),"infinite"===h.animationIterationCount&&(h.animationIterationCount=1));
b.put(e,h);c=h;e=c.animationDelay;h=c.transitionDelay;c.maxDelay=e&&h?Math.max(e,h):e||h;c.maxDuration=Math.max(c.animationDuration*c.animationIterationCount,c.transitionDuration);return c}var h=Q(e),P=0,y=[];return function(a,c){function d(){n()}function u(){n(!0)}function n(b){if(!(P||H&&da)){P=!0;da=!1;g.$$skipPreparationClasses||e.removeClass(a,fa);e.removeClass(a,ga);ra(m,!1);pa(m,!1);q(y,function(a){m.style[a[0]]=""});h(a,g);ha(a,g);Object.keys(G).length&&q(G,function(a,b){a?m.style.setProperty(b,
a):m.style.removeProperty(b)});if(g.onDone)g.onDone();ea&&ea.length&&a.off(ea.join(" "),C);var c=a.data("$$animateCss");c&&(r.cancel(c[0].timer),a.removeData("$$animateCss"));E&&E.complete(!b)}}function D(a){p.blockTransition&&pa(m,a);p.blockKeyframeAnimation&&ra(m,!!a)}function z(){E=new f({end:d,cancel:u});M(O);n();return{$$willAnimate:!1,start:function(){return E},end:d}}function C(a){a.stopPropagation();var b=a.originalEvent||a;a=b.$manualTimeStamp||Date.now();b=parseFloat(b.elapsedTime.toFixed(3));
Math.max(a-W,0)>=Q&&b>=L&&(H=!0,n())}function K(){function b(){if(!P){D(!1);q(y,function(a){m.style[a[0]]=a[1]});h(a,g);e.addClass(a,ga);if(p.recalculateTimingStyles){na=m.className+" "+fa;ia=w(m,na);B=v(m,na,ia);$=B.maxDelay;I=Math.max($,0);L=B.maxDuration;if(0===L){n();return}p.hasTransitions=0<B.transitionDuration;p.hasAnimations=0<B.animationDuration}p.applyAnimationDelay&&($="boolean"!==typeof g.delay&&sa(g.delay)?parseFloat(g.delay):$,I=Math.max($,0),B.animationDelay=$,aa=[qa,$+"s"],y.push(aa),
m.style[aa[0]]=aa[1]);Q=1E3*I;T=1E3*L;if(g.easing){var d,f=g.easing;p.hasTransitions&&(d=R+"TimingFunction",y.push([d,f]),m.style[d]=f);p.hasAnimations&&(d=X+"TimingFunction",y.push([d,f]),m.style[d]=f)}B.transitionDuration&&ea.push(ua);B.animationDuration&&ea.push(va);W=Date.now();var l=Q+1.5*T;d=W+l;var f=a.data("$$animateCss")||[],K=!0;if(f.length){var z=f[0];(K=d>z.expectedEndTime)?r.cancel(z.timer):f.push(n)}K&&(l=r(c,l,!1),f[0]={timer:l,expectedEndTime:d},f.push(n),a.data("$$animateCss",f));
if(ea.length)a.on(ea.join(" "),C);g.to&&(g.cleanupStyles&&Ga(G,m,Object.keys(g.to)),Ba(a,g))}}function c(){var b=a.data("$$animateCss");if(b){for(var d=1;d<b.length;d++)b[d]();a.removeData("$$animateCss")}}if(!P)if(m.parentNode){var d=function(a){if(H)da&&a&&(da=!1,n());else if(da=!a,B.animationDuration)if(a=ra(m,da),da)y.push(a);else{var b=y,c=b.indexOf(a);0<=a&&b.splice(c,1)}},f=0<ca&&(B.transitionDuration&&0===U.transitionDuration||B.animationDuration&&0===U.animationDuration)&&Math.max(U.animationDelay,
U.transitionDelay);f?r(b,Math.floor(f*ca*1E3),!1):b();N.resume=function(){d(!0)};N.pause=function(){d(!1)}}else n()}var g=c||{};g.$$prepared||(g=oa(Ha(g)));var G={},m=A(a);if(!m||!m.parentNode||!l.enabled())return z();var y=[],x=a.attr("class"),t=La(g),P,da,H,E,N,I,Q,L,T,W,ea=[];if(0===g.duration||!F.animations&&!F.transitions)return z();var ja=g.event&&ba(g.event)?g.event.join(" "):g.event,Y="",S="";ja&&g.structural?Y=V(ja,"ng-",!0):ja&&(Y=ja);g.addClass&&(S+=V(g.addClass,"-add"));g.removeClass&&
(S.length&&(S+=" "),S+=V(g.removeClass,"-remove"));g.applyClassesEarly&&S.length&&h(a,g);var fa=[Y,S].join(" ").trim(),na=x+" "+fa,ga=V(fa,"-active"),x=t.to&&0<Object.keys(t.to).length;if(!(0<(g.keyframeStyle||"").length||x||fa))return z();var ia,U;0<g.stagger?(t=parseFloat(g.stagger),U={transitionDelay:t,animationDelay:t,transitionDuration:0,animationDuration:0}):(ia=w(m,na),U=s(m,fa,ia,Ta));g.$$skipPreparationClasses||e.addClass(a,fa);g.transitionStyle&&(t=[R,g.transitionStyle],la(m,t),y.push(t));
0<=g.duration&&(t=0<m.style[R].length,t=Ea(g.duration,t),la(m,t),y.push(t));g.keyframeStyle&&(t=[X,g.keyframeStyle],la(m,t),y.push(t));var ca=U?0<=g.staggerIndex?g.staggerIndex:b.count(ia):0;(ja=0===ca)&&!g.skipBlocking&&pa(m,9999);var B=v(m,na,ia),$=B.maxDelay;I=Math.max($,0);L=B.maxDuration;var p={};p.hasTransitions=0<B.transitionDuration;p.hasAnimations=0<B.animationDuration;p.hasTransitionAll=p.hasTransitions&&"all"==B.transitionProperty;p.applyTransitionDuration=x&&(p.hasTransitions&&!p.hasTransitionAll||
p.hasAnimations&&!p.hasTransitions);p.applyAnimationDuration=g.duration&&p.hasAnimations;p.applyTransitionDelay=sa(g.delay)&&(p.applyTransitionDuration||p.hasTransitions);p.applyAnimationDelay=sa(g.delay)&&p.hasAnimations;p.recalculateTimingStyles=0<S.length;if(p.applyTransitionDuration||p.applyAnimationDuration)L=g.duration?parseFloat(g.duration):L,p.applyTransitionDuration&&(p.hasTransitions=!0,B.transitionDuration=L,t=0<m.style[R+"Property"].length,y.push(Ea(L,t))),p.applyAnimationDuration&&(p.hasAnimations=
!0,B.animationDuration=L,y.push([wa,L+"s"]));if(0===L&&!p.recalculateTimingStyles)return z();if(null!=g.delay){var aa;"boolean"!==typeof g.delay&&(aa=parseFloat(g.delay),I=Math.max(aa,0));p.applyTransitionDelay&&y.push([ma,aa+"s"]);p.applyAnimationDelay&&y.push([qa,aa+"s"])}null==g.duration&&0<B.transitionDuration&&(p.recalculateTimingStyles=p.recalculateTimingStyles||ja);Q=1E3*I;T=1E3*L;g.skipBlocking||(p.blockTransition=0<B.transitionDuration,p.blockKeyframeAnimation=0<B.animationDuration&&0<U.animationDelay&&
0===U.animationDuration);g.from&&(g.cleanupStyles&&Ga(G,m,Object.keys(g.from)),Aa(a,g));p.blockTransition||p.blockKeyframeAnimation?D(L):g.skipBlocking||pa(m,!1);return{$$willAnimate:!0,end:d,start:function(){if(!P)return N={end:d,cancel:u,resume:null,pause:null},E=new f(N),M(K),E}}}}]}]).provider("$$animateCssDriver",["$$animationProvider",function(a){a.drivers.push("$$animateCssDriver");this.$get=["$animateCss","$rootScope","$$AnimateRunner","$rootElement","$sniffer","$$jqLite","$document",function(a,
c,d,e,f,r,x){function F(a){return a.replace(/\bng-\S+\b/g,"")}function u(a,b){I(a)&&(a=a.split(" "));I(b)&&(b=b.split(" "));return a.filter(function(a){return-1===b.indexOf(a)}).join(" ")}function l(c,e,f){function k(a){var b={},c=A(a).getBoundingClientRect();q(["width","height","top","left"],function(a){var d=c[a];switch(a){case "top":d+=M.scrollTop;break;case "left":d+=M.scrollLeft}b[a]=Math.floor(d)+"px"});return b}function l(){var c=F(f.attr("class")||""),d=u(c,n),c=u(n,c),d=a(r,{to:k(f),addClass:"ng-anchor-in "+
d,removeClass:"ng-anchor-out "+c,delay:!0});return d.$$willAnimate?d:null}function x(){r.remove();e.removeClass("ng-animate-shim");f.removeClass("ng-animate-shim")}var r=H(A(e).cloneNode(!0)),n=F(r.attr("class")||"");e.addClass("ng-animate-shim");f.addClass("ng-animate-shim");r.addClass("ng-anchor");v.append(r);var D;c=function(){var c=a(r,{addClass:"ng-anchor-out",delay:!0,from:k(e)});return c.$$willAnimate?c:null}();if(!c&&(D=l(),!D))return x();var z=c||D;return{start:function(){function a(){c&&
c.end()}var b,c=z.start();c.done(function(){c=null;if(!D&&(D=l()))return c=D.start(),c.done(function(){c=null;x();b.complete()}),c;x();b.complete()});return b=new d({end:a,cancel:a})}}}function w(a,b,c,e){var f=s(a,O),r=s(b,O),x=[];q(e,function(a){(a=l(c,a.out,a["in"]))&&x.push(a)});if(f||r||0!==x.length)return{start:function(){function a(){q(b,function(a){a.end()})}var b=[];f&&b.push(f.start());r&&b.push(r.start());q(x,function(a){b.push(a.start())});var c=new d({end:a,cancel:a});d.all(b,function(a){c.complete(a)});
return c}}}function s(c){var d=c.element,e=c.options||{};c.structural&&(e.event=c.event,e.structural=!0,e.applyClassesEarly=!0,"leave"===c.event&&(e.onDone=e.domOperation));e.preparationClasses&&(e.event=W(e.event,e.preparationClasses));c=a(d,e);return c.$$willAnimate?c:null}if(!f.animations&&!f.transitions)return O;var M=x[0].body;c=A(e);var v=H(c.parentNode&&11===c.parentNode.nodeType||M.contains(c)?c:M);Q(r);return function(a){return a.from&&a.to?w(a.from,a.to,a.classes,a.anchors):s(a)}}]}]).provider("$$animateJs",
["$animateProvider",function(a){this.$get=["$injector","$$AnimateRunner","$$jqLite",function(b,c,d){function e(c){c=ba(c)?c:c.split(" ");for(var d=[],e={},f=0;f<c.length;f++){var l=c[f],q=a.$$registeredAnimations[l];q&&!e[l]&&(d.push(b.get(q)),e[l]=!0)}return d}var f=Q(d);return function(a,b,d,u){function l(){u.domOperation();f(a,u)}function w(a,b,d,e,g){switch(d){case "animate":b=[b,e.from,e.to,g];break;case "setClass":b=[b,h,H,g];break;case "addClass":b=[b,h,g];break;case "removeClass":b=[b,H,g];
break;default:b=[b,g]}b.push(e);if(a=a.apply(a,b))if(Ia(a.start)&&(a=a.start()),a instanceof c)a.done(g);else if(Ia(a))return a;return O}function s(a,b,d,e,g){var f=[];q(e,function(e){var h=e[g];h&&f.push(function(){var e,g,f=!1,k=function(a){f||(f=!0,(g||O)(a),e.complete(!a))};e=new c({end:function(){k()},cancel:function(){k(!0)}});g=w(h,a,b,d,function(a){k(!1===a)});return e})});return f}function A(a,b,d,e,g){var f=s(a,b,d,e,g);if(0===f.length){var h,k;"beforeSetClass"===g?(h=s(a,"removeClass",
d,e,"beforeRemoveClass"),k=s(a,"addClass",d,e,"beforeAddClass")):"setClass"===g&&(h=s(a,"removeClass",d,e,"removeClass"),k=s(a,"addClass",d,e,"addClass"));h&&(f=f.concat(h));k&&(f=f.concat(k))}if(0!==f.length)return function(a){var b=[];f.length&&q(f,function(a){b.push(a())});b.length?c.all(b,a):a();return function(a){q(b,function(b){a?b.cancel():b.end()})}}}var v=!1;3===arguments.length&&ca(d)&&(u=d,d=null);u=oa(u);d||(d=a.attr("class")||"",u.addClass&&(d+=" "+u.addClass),u.removeClass&&(d+=" "+
u.removeClass));var h=u.addClass,H=u.removeClass,y=e(d),k,E;if(y.length){var I,J;"leave"==b?(J="leave",I="afterLeave"):(J="before"+b.charAt(0).toUpperCase()+b.substr(1),I=b);"enter"!==b&&"move"!==b&&(k=A(a,b,u,y,J));E=A(a,b,u,y,I)}if(k||E){var n;return{$$willAnimate:!0,end:function(){n?n.end():(v=!0,l(),ha(a,u),n=new c,n.complete(!0));return n},start:function(){function b(c){v=!0;l();ha(a,u);n.complete(c)}if(n)return n;n=new c;var d,e=[];k&&e.push(function(a){d=k(a)});e.length?e.push(function(a){l();
a(!0)}):l();E&&e.push(function(a){d=E(a)});n.setHost({end:function(){v||((d||O)(void 0),b(void 0))},cancel:function(){v||((d||O)(!0),b(!0))}});c.chain(e,b);return n}}}}}]}]).provider("$$animateJsDriver",["$$animationProvider",function(a){a.drivers.push("$$animateJsDriver");this.$get=["$$animateJs","$$AnimateRunner",function(a,c){function d(c){return a(c.element,c.event,c.classes,c.options)}return function(a){if(a.from&&a.to){var b=d(a.from),r=d(a.to);if(b||r)return{start:function(){function a(){return function(){q(d,
function(a){a.end()})}}var d=[];b&&d.push(b.start());r&&d.push(r.start());c.all(d,function(a){e.complete(a)});var e=new c({end:a(),cancel:a()});return e}}}else return d(a)}}]}])})(window,window.angular);
//# sourceMappingURL=angular-animate.min.js.map

/*!
 * ionic.bundle.js is a concatenation of:
 * ionic.js, angular.js, angular-animate.js,
 * angular-sanitize.js, angular-ui-router.js,
 * and ionic-angular.js
 */

/*
 AngularJS v1.5.3
 (c) 2010-2016 Google, Inc. http://angularjs.org
 License: MIT
*/
(function(A,e,B){'use strict';function C(a){var c=[];v(c,e.noop).chars(a);return c.join("")}function h(a,c){var b={},d=a.split(","),l;for(l=0;l<d.length;l++)b[c?e.lowercase(d[l]):d[l]]=!0;return b}function D(a,c){null===a||a===B?a="":"string"!==typeof a&&(a=""+a);g.innerHTML=a;var b=5;do{if(0===b)throw w("uinput");b--;11>=document.documentMode&&n(g);a=g.innerHTML;g.innerHTML=a}while(a!==g.innerHTML);for(b=g.firstChild;b;){switch(b.nodeType){case 1:c.start(b.nodeName.toLowerCase(),E(b.attributes));
break;case 3:c.chars(b.textContent)}var d;if(!(d=b.firstChild)&&(1==b.nodeType&&c.end(b.nodeName.toLowerCase()),d=b.nextSibling,!d))for(;null==d;){b=b.parentNode;if(b===g)break;d=b.nextSibling;1==b.nodeType&&c.end(b.nodeName.toLowerCase())}b=d}for(;b=g.firstChild;)g.removeChild(b)}function E(a){for(var c={},b=0,d=a.length;b<d;b++){var l=a[b];c[l.name]=l.value}return c}function x(a){return a.replace(/&/g,"&amp;").replace(F,function(a){var b=a.charCodeAt(0);a=a.charCodeAt(1);return"&#"+(1024*(b-55296)+
(a-56320)+65536)+";"}).replace(G,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function v(a,c){var b=!1,d=e.bind(a,a.push);return{start:function(a,f){a=e.lowercase(a);!b&&H[a]&&(b=a);b||!0!==t[a]||(d("<"),d(a),e.forEach(f,function(b,f){var g=e.lowercase(f),h="img"===a&&"src"===g||"background"===g;!0!==I[g]||!0===y[g]&&!c(b,h)||(d(" "),d(f),d('="'),d(x(b)),d('"'))}),d(">"))},end:function(a){a=e.lowercase(a);b||!0!==t[a]||!0===z[a]||(d("</"),d(a),d(">"));a==
b&&(b=!1)},chars:function(a){b||d(x(a))}}}function n(a){if(a.nodeType===Node.ELEMENT_NODE)for(var c=a.attributes,b=0,d=c.length;b<d;b++){var e=c[b],f=e.name.toLowerCase();if("xmlns:ns1"===f||0===f.indexOf("ns1:"))a.removeAttributeNode(e),b--,d--}(c=a.firstChild)&&n(c);(c=a.nextSibling)&&n(c)}var w=e.$$minErr("$sanitize"),F=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,G=/([^\#-~ |!])/g,z=h("area,br,col,hr,img,wbr"),q=h("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),k=h("rp,rt"),u=e.extend({},k,q),q=e.extend({},
q,h("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),k=e.extend({},k,h("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),J=h("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),
H=h("script,style"),t=e.extend({},z,q,k,u),y=h("background,cite,href,longdesc,src,xlink:href"),u=h("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"),k=h("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",
!0),I=e.extend({},y,k,u),g;(function(a){if(a.document&&a.document.implementation)a=a.document.implementation.createHTMLDocument("inert");else throw w("noinert");var c=(a.documentElement||a.getDocumentElement()).getElementsByTagName("body");1===c.length?g=c[0]:(c=a.createElement("html"),g=a.createElement("body"),c.appendChild(g),a.appendChild(c))})(A);e.module("ngSanitize",[]).provider("$sanitize",function(){var a=!1;this.$get=["$$sanitizeUri",function(c){a&&e.extend(t,J);return function(a){var d=
[];D(a,v(d,function(a,b){return!/^unsafe:/.test(c(a,b))}));return d.join("")}}];this.enableSvg=function(c){return e.isDefined(c)?(a=c,this):a}});e.module("ngSanitize").filter("linky",["$sanitize",function(a){var c=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,b=/^mailto:/i,d=e.$$minErr("linky"),g=e.isString;return function(f,h,m){function k(a){a&&p.push(C(a))}function q(a,b){var c;p.push("<a ");e.isFunction(m)&&(m=m(a));if(e.isObject(m))for(c in m)p.push(c+
'="'+m[c]+'" ');else m={};!e.isDefined(h)||"target"in m||p.push('target="',h,'" ');p.push('href="',a.replace(/"/g,"&quot;"),'">');k(b);p.push("</a>")}if(null==f||""===f)return f;if(!g(f))throw d("notstring",f);for(var r=f,p=[],s,n;f=r.match(c);)s=f[0],f[2]||f[4]||(s=(f[3]?"http://":"mailto:")+s),n=f.index,k(r.substr(0,n)),q(s,f[0].replace(b,"")),r=r.substring(n+f[0].length);k(r);return a(p.join(""))}}])})(window,window.angular);
//# sourceMappingURL=angular-sanitize.min.js.map

/*!
 * ionic.bundle.js is a concatenation of:
 * ionic.js, angular.js, angular-animate.js,
 * angular-sanitize.js, angular-ui-router.js,
 * and ionic-angular.js
 */

/**
 * State-based routing for AngularJS
 * @version v0.2.13
 * @link http://angular-ui.github.com/
 * @license MIT License, http://www.opensource.org/licenses/MIT
 */
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return M(new(M(function(){},{prototype:a})),b)}function e(a){return L(arguments,function(b){b!==a&&L(b,function(b,c){a.hasOwnProperty(c)||(a[c]=b)})}),a}function f(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function g(a){if(Object.keys)return Object.keys(a);var c=[];return b.forEach(a,function(a,b){c.push(b)}),c}function h(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if(d in a&&a[d]===b)return d;return-1}function i(a,b,c,d){var e,i=f(c,d),j={},k=[];for(var l in i)if(i[l].params&&(e=g(i[l].params),e.length))for(var m in e)h(k,e[m])>=0||(k.push(e[m]),j[e[m]]=a[e[m]]);return M({},j,b)}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e<c.length;e++){var f=c[e];if(a[f]!=b[f])return!1}return!0}function k(a,b){var c={};return L(a,function(a){c[a]=b[a]}),c}function l(a){var b={},c=Array.prototype.concat.apply(Array.prototype,Array.prototype.slice.call(arguments,1));for(var d in a)-1==h(c,d)&&(b[d]=a[d]);return b}function m(a,b){var c=K(a),d=c?[]:{};return L(a,function(a,e){b(a,e)&&(d[c?d.length:e]=a)}),d}function n(a,b){var c=K(a)?[]:{};return L(a,function(a,d){c[d]=b(a,d)}),c}function o(a,b){var d=1,f=2,i={},j=[],k=i,m=M(a.when(i),{$$promises:i,$$values:i});this.study=function(i){function n(a,c){if(s[c]!==f){if(r.push(c),s[c]===d)throw r.splice(0,h(r,c)),new Error("Cyclic dependency: "+r.join(" -> "));if(s[c]=d,I(a))q.push(c,[function(){return b.get(a)}],j);else{var e=b.annotate(a);L(e,function(a){a!==c&&i.hasOwnProperty(a)&&n(i[a],a)}),q.push(c,a,e)}r.pop(),s[c]=f}}function o(a){return J(a)&&a.then&&a.$$promises}if(!J(i))throw new Error("'invocables' must be an object");var p=g(i||{}),q=[],r=[],s={};return L(i,n),i=r=s=null,function(d,f,g){function h(){--u||(v||e(t,f.$$values),r.$$values=t,r.$$promises=r.$$promises||!0,delete r.$$inheritedValues,n.resolve(t))}function i(a){r.$$failure=a,n.reject(a)}function j(c,e,f){function j(a){l.reject(a),i(a)}function k(){if(!G(r.$$failure))try{l.resolve(b.invoke(e,g,t)),l.promise.then(function(a){t[c]=a,h()},j)}catch(a){j(a)}}var l=a.defer(),m=0;L(f,function(a){s.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,s[a].then(function(b){t[a]=b,--m||k()},j))}),m||k(),s[c]=l.promise}if(o(d)&&g===c&&(g=f,f=d,d=null),d){if(!J(d))throw new Error("'locals' must be an object")}else d=k;if(f){if(!o(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=m;var n=a.defer(),r=n.promise,s=r.$$promises={},t=M({},d),u=1+q.length/3,v=!1;if(G(f.$$failure))return i(f.$$failure),r;f.$$inheritedValues&&e(t,l(f.$$inheritedValues,p)),M(s,f.$$promises),f.$$values?(v=e(t,l(f.$$values,p)),r.$$inheritedValues=l(f.$$values,p),h()):(f.$$inheritedValues&&(r.$$inheritedValues=l(f.$$inheritedValues,p)),f.then(h,i));for(var w=0,x=q.length;x>w;w+=3)d.hasOwnProperty(q[w])?h():j(q[w],q[w+1],q[w+2]);return r}},this.resolve=function(a,b,c,d){return this.study(a)(b,c,d)}}function p(a,b,c){this.fromConfig=function(a,b,c){return G(a.template)?this.fromString(a.template,b):G(a.templateUrl)?this.fromUrl(a.templateUrl,b):G(a.templateProvider)?this.fromProvider(a.templateProvider,b,c):null},this.fromString=function(a,b){return H(a)?a(b):a},this.fromUrl=function(c,d){return H(c)&&(c=c(d)),null==c?null:a.get(c,{cache:b,headers:{Accept:"text/html"}}).then(function(a){return a.data})},this.fromProvider=function(a,b,d){return c.invoke(a,null,d||{params:b})}}function q(a,b,e){function f(b,c,d,e){if(q.push(b),o[b])return o[b];if(!/^\w+(-+\w+)*(?:\[\])?$/.test(b))throw new Error("Invalid parameter name '"+b+"' in pattern '"+a+"'");if(p[b])throw new Error("Duplicate parameter name '"+b+"' in pattern '"+a+"'");return p[b]=new O.Param(b,c,d,e),p[b]}function g(a,b,c){var d=["",""],e=a.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!b)return e;switch(c){case!1:d=["(",")"];break;case!0:d=["?(",")?"];break;default:d=["("+c+"|",")?"]}return e+d[0]+b+d[1]}function h(c,e){var f,g,h,i,j;return f=c[2]||c[3],j=b.params[f],h=a.substring(m,c.index),g=e?c[4]:c[4]||("*"==c[1]?".*":null),i=O.type(g||"string")||d(O.type("string"),{pattern:new RegExp(g)}),{id:f,regexp:g,segment:h,type:i,cfg:j}}b=M({params:{}},J(b)?b:{});var i,j=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,k=/([:]?)([\w\[\]-]+)|\{([\w\[\]-]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l="^",m=0,n=this.segments=[],o=e?e.params:{},p=this.params=e?e.params.$$new():new O.ParamSet,q=[];this.source=a;for(var r,s,t;(i=j.exec(a))&&(r=h(i,!1),!(r.segment.indexOf("?")>=0));)s=f(r.id,r.type,r.cfg,"path"),l+=g(r.segment,s.type.pattern.source,s.squash),n.push(r.segment),m=j.lastIndex;t=a.substring(m);var u=t.indexOf("?");if(u>=0){var v=this.sourceSearch=t.substring(u);if(t=t.substring(0,u),this.sourcePath=a.substring(0,m+u),v.length>0)for(m=0;i=k.exec(v);)r=h(i,!0),s=f(r.id,r.type,r.cfg,"search"),m=j.lastIndex}else this.sourcePath=a,this.sourceSearch="";l+=g(t)+(b.strict===!1?"/?":"")+"$",n.push(t),this.regexp=new RegExp(l,b.caseInsensitive?"i":c),this.prefix=n[0],this.$$paramNames=q}function r(a){M(this,a)}function s(){function a(a){return null!=a?a.toString().replace(/\//g,"%2F"):a}function e(a){return null!=a?a.toString().replace(/%2F/g,"/"):a}function f(a){return this.pattern.test(a)}function i(){return{strict:t,caseInsensitive:p}}function j(a){return H(a)||K(a)&&H(a[a.length-1])}function k(){for(;x.length;){var a=x.shift();if(a.pattern)throw new Error("You cannot override a type's .pattern at runtime.");b.extend(v[a.name],o.invoke(a.def))}}function l(a){M(this,a||{})}O=this;var o,p=!1,t=!0,u=!1,v={},w=!0,x=[],y={string:{encode:a,decode:e,is:f,pattern:/[^/]*/},"int":{encode:a,decode:function(a){return parseInt(a,10)},is:function(a){return G(a)&&this.decode(a.toString())===a},pattern:/\d+/},bool:{encode:function(a){return a?1:0},decode:function(a){return 0!==parseInt(a,10)},is:function(a){return a===!0||a===!1},pattern:/0|1/},date:{encode:function(a){return this.is(a)?[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2)].join("-"):c},decode:function(a){if(this.is(a))return a;var b=this.capture.exec(a);return b?new Date(b[1],b[2]-1,b[3]):c},is:function(a){return a instanceof Date&&!isNaN(a.valueOf())},equals:function(a,b){return this.is(a)&&this.is(b)&&a.toISOString()===b.toISOString()},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/},json:{encode:b.toJson,decode:b.fromJson,is:b.isObject,equals:b.equals,pattern:/[^/]*/},any:{encode:b.identity,decode:b.identity,is:b.identity,equals:b.equals,pattern:/.*/}};s.$$getDefaultValue=function(a){if(!j(a.value))return a.value;if(!o)throw new Error("Injectable functions cannot be called at configuration time");return o.invoke(a.value)},this.caseInsensitive=function(a){return G(a)&&(p=a),p},this.strictMode=function(a){return G(a)&&(t=a),t},this.defaultSquashPolicy=function(a){if(!G(a))return u;if(a!==!0&&a!==!1&&!I(a))throw new Error("Invalid squash policy: "+a+". Valid policies: false, true, arbitrary-string");return u=a,a},this.compile=function(a,b){return new q(a,M(i(),b))},this.isMatcher=function(a){if(!J(a))return!1;var b=!0;return L(q.prototype,function(c,d){H(c)&&(b=b&&G(a[d])&&H(a[d]))}),b},this.type=function(a,b,c){if(!G(b))return v[a];if(v.hasOwnProperty(a))throw new Error("A type named '"+a+"' has already been defined.");return v[a]=new r(M({name:a},b)),c&&(x.push({name:a,def:c}),w||k()),this},L(y,function(a,b){v[b]=new r(M({name:b},a))}),v=d(v,{}),this.$get=["$injector",function(a){return o=a,w=!1,k(),L(y,function(a,b){v[b]||(v[b]=new r(a))}),this}],this.Param=function(a,b,d,e){function f(a){var b=J(a)?g(a):[],c=-1===h(b,"value")&&-1===h(b,"type")&&-1===h(b,"squash")&&-1===h(b,"array");return c&&(a={value:a}),a.$$fn=j(a.value)?a.value:function(){return a.value},a}function i(b,c,d){if(b.type&&c)throw new Error("Param '"+a+"' has two type configurations.");return c?c:b.type?b.type instanceof r?b.type:new r(b.type):"config"===d?v.any:v.string}function k(){var b={array:"search"===e?"auto":!1},c=a.match(/\[\]$/)?{array:!0}:{};return M(b,c,d).array}function l(a,b){var c=a.squash;if(!b||c===!1)return!1;if(!G(c)||null==c)return u;if(c===!0||I(c))return c;throw new Error("Invalid squash policy: '"+c+"'. Valid policies: false, true, or arbitrary string")}function p(a,b,d,e){var f,g,i=[{from:"",to:d||b?c:""},{from:null,to:d||b?c:""}];return f=K(a.replace)?a.replace:[],I(e)&&f.push({from:e,to:c}),g=n(f,function(a){return a.from}),m(i,function(a){return-1===h(g,a.from)}).concat(f)}function q(){if(!o)throw new Error("Injectable functions cannot be called at configuration time");return o.invoke(d.$$fn)}function s(a){function b(a){return function(b){return b.from===a}}function c(a){var c=n(m(w.replace,b(a)),function(a){return a.to});return c.length?c[0]:a}return a=c(a),G(a)?w.type.decode(a):q()}function t(){return"{Param:"+a+" "+b+" squash: '"+z+"' optional: "+y+"}"}var w=this;d=f(d),b=i(d,b,e);var x=k();b=x?b.$asArray(x,"search"===e):b,"string"!==b.name||x||"path"!==e||d.value!==c||(d.value="");var y=d.value!==c,z=l(d,y),A=p(d,x,y,z);M(this,{id:a,type:b,location:e,array:x,squash:z,replace:A,isOptional:y,value:s,dynamic:c,config:d,toString:t})},l.prototype={$$new:function(){return d(this,M(new l,{$$parent:this}))},$$keys:function(){for(var a=[],b=[],c=this,d=g(l.prototype);c;)b.push(c),c=c.$$parent;return b.reverse(),L(b,function(b){L(g(b),function(b){-1===h(a,b)&&-1===h(d,b)&&a.push(b)})}),a},$$values:function(a){var b={},c=this;return L(c.$$keys(),function(d){b[d]=c[d].value(a&&a[d])}),b},$$equals:function(a,b){var c=!0,d=this;return L(d.$$keys(),function(e){var f=a&&a[e],g=b&&b[e];d[e].type.equals(f,g)||(c=!1)}),c},$$validates:function(a){var b,c,d,e=!0,f=this;return L(this.$$keys(),function(g){d=f[g],c=a[g],b=!c&&d.isOptional,e=e&&(b||!!d.type.is(c))}),e},$$parent:c},this.ParamSet=l}function t(a,d){function e(a){var b=/^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(a.source);return null!=b?b[1].replace(/\\(.)/g,"$1"):""}function f(a,b){return a.replace(/\$(\$|\d{1,2})/,function(a,c){return b["$"===c?0:Number(c)]})}function g(a,b,c){if(!c)return!1;var d=a.invoke(b,b,{$match:c});return G(d)?d:!0}function h(d,e,f,g){function h(a,b,c){return"/"===p?a:b?p.slice(0,-1)+a:c?p.slice(1)+a:a}function m(a){function b(a){var b=a(f,d);return b?(I(b)&&d.replace().url(b),!0):!1}if(!a||!a.defaultPrevented){var e=o&&d.url()===o;if(o=c,e)return!0;var g,h=j.length;for(g=0;h>g;g++)if(b(j[g]))return;k&&b(k)}}function n(){return i=i||e.$on("$locationChangeSuccess",m)}var o,p=g.baseHref(),q=d.url();return l||n(),{sync:function(){m()},listen:function(){return n()},update:function(a){return a?void(q=d.url()):void(d.url()!==q&&(d.url(q),d.replace()))},push:function(a,b,e){d.url(a.format(b||{})),o=e&&e.$$avoidResync?d.url():c,e&&e.replace&&d.replace()},href:function(c,e,f){if(!c.validates(e))return null;var g=a.html5Mode();b.isObject(g)&&(g=g.enabled);var i=c.format(e);if(f=f||{},g||null===i||(i="#"+a.hashPrefix()+i),i=h(i,g,f.absolute),!f.absolute||!i)return i;var j=!g&&i?"/":"",k=d.port();return k=80===k||443===k?"":":"+k,[d.protocol(),"://",d.host(),k,j,i].join("")}}}var i,j=[],k=null,l=!1;this.rule=function(a){if(!H(a))throw new Error("'rule' must be a function");return j.push(a),this},this.otherwise=function(a){if(I(a)){var b=a;a=function(){return b}}else if(!H(a))throw new Error("'rule' must be a function");return k=a,this},this.when=function(a,b){var c,h=I(b);if(I(a)&&(a=d.compile(a)),!h&&!H(b)&&!K(b))throw new Error("invalid 'handler' in when()");var i={matcher:function(a,b){return h&&(c=d.compile(b),b=["$match",function(a){return c.format(a)}]),M(function(c,d){return g(c,b,a.exec(d.path(),d.search()))},{prefix:I(a.prefix)?a.prefix:""})},regex:function(a,b){if(a.global||a.sticky)throw new Error("when() RegExp must not be global or sticky");return h&&(c=b,b=["$match",function(a){return f(c,a)}]),M(function(c,d){return g(c,b,a.exec(d.path()))},{prefix:e(a)})}},j={matcher:d.isMatcher(a),regex:a instanceof RegExp};for(var k in j)if(j[k])return this.rule(i[k](a,b));throw new Error("invalid 'what' in when()")},this.deferIntercept=function(a){a===c&&(a=!0),l=a},this.$get=h,h.$inject=["$location","$rootScope","$injector","$browser"]}function u(a,e){function f(a){return 0===a.indexOf(".")||0===a.indexOf("^")}function l(a,b){if(!a)return c;var d=I(a),e=d?a:a.name,g=f(e);if(g){if(!b)throw new Error("No reference point given for path '"+e+"'");b=l(b);for(var h=e.split("."),i=0,j=h.length,k=b;j>i;i++)if(""!==h[i]||0!==i){if("^"!==h[i])break;if(!k.parent)throw new Error("Path '"+e+"' not valid for state '"+b.name+"'");k=k.parent}else k=b;h=h.slice(i).join("."),e=k.name+(k.name&&h?".":"")+h}var m=y[e];return!m||!d&&(d||m!==a&&m.self!==a)?c:m}function m(a,b){z[a]||(z[a]=[]),z[a].push(b)}function o(a){for(var b=z[a]||[];b.length;)p(b.shift())}function p(b){b=d(b,{self:b,resolve:b.resolve||{},toString:function(){return this.name}});var c=b.name;if(!I(c)||c.indexOf("@")>=0)throw new Error("State must have a valid name");if(y.hasOwnProperty(c))throw new Error("State '"+c+"'' is already defined");var e=-1!==c.indexOf(".")?c.substring(0,c.lastIndexOf(".")):I(b.parent)?b.parent:J(b.parent)&&I(b.parent.name)?b.parent.name:"";if(e&&!y[e])return m(e,b.self);for(var f in B)H(B[f])&&(b[f]=B[f](b,B.$delegates[f]));return y[c]=b,!b[A]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){x.$current.navigable==b&&j(a,c)||x.transitionTo(b,a,{inherit:!0,location:!1})}]),o(c),b}function q(a){return a.indexOf("*")>-1}function r(a){var b=a.split("."),c=x.$current.name.split(".");if("**"===b[0]&&(c=c.slice(h(c,b[1])),c.unshift("**")),"**"===b[b.length-1]&&(c.splice(h(c,b[b.length-2])+1,Number.MAX_VALUE),c.push("**")),b.length!=c.length)return!1;for(var d=0,e=b.length;e>d;d++)"*"===b[d]&&(c[d]="*");return c.join("")===b.join("")}function s(a,b){return I(a)&&!G(b)?B[a]:H(b)&&I(a)?(B[a]&&!B.$delegates[a]&&(B.$delegates[a]=B[a]),B[a]=b,this):this}function t(a,b){return J(a)?b=a:b.name=a,p(b),this}function u(a,e,f,h,m,o,p){function s(b,c,d,f){var g=a.$broadcast("$stateNotFound",b,c,d);if(g.defaultPrevented)return p.update(),B;if(!g.retry)return null;if(f.$retry)return p.update(),C;var h=x.transition=e.when(g.retry);return h.then(function(){return h!==x.transition?u:(b.options.$retry=!0,x.transitionTo(b.to,b.toParams,b.options))},function(){return B}),p.update(),h}function t(a,c,d,g,i,j){var l=d?c:k(a.params.$$keys(),c),n={$stateParams:l};i.resolve=m.resolve(a.resolve,n,i.resolve,a);var o=[i.resolve.then(function(a){i.globals=a})];return g&&o.push(g),L(a.views,function(c,d){var e=c.resolve&&c.resolve!==a.resolve?c.resolve:{};e.$template=[function(){return f.load(d,{view:c,locals:n,params:l,notify:j.notify})||""}],o.push(m.resolve(e,n,i.resolve,a).then(function(f){if(H(c.controllerProvider)||K(c.controllerProvider)){var g=b.extend({},e,n);f.$$controller=h.invoke(c.controllerProvider,null,g)}else f.$$controller=c.controller;f.$$state=a,f.$$controllerAs=c.controllerAs,i[d]=f}))}),e.all(o).then(function(){return i})}var u=e.reject(new Error("transition superseded")),z=e.reject(new Error("transition prevented")),B=e.reject(new Error("transition aborted")),C=e.reject(new Error("transition failed"));return w.locals={resolve:null,globals:{$stateParams:{}}},x={params:{},current:w.self,$current:w,transition:null},x.reload=function(){return x.transitionTo(x.current,o,{reload:!0,inherit:!1,notify:!0})},x.go=function(a,b,c){return x.transitionTo(a,b,M({inherit:!0,relative:x.$current},c))},x.transitionTo=function(b,c,f){c=c||{},f=M({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},f||{});var g,j=x.$current,m=x.params,n=j.path,q=l(b,f.relative);if(!G(q)){var r={to:b,toParams:c,options:f},y=s(r,j.self,m,f);if(y)return y;if(b=r.to,c=r.toParams,f=r.options,q=l(b,f.relative),!G(q)){if(!f.relative)throw new Error("No such state '"+b+"'");throw new Error("Could not resolve '"+b+"' from state '"+f.relative+"'")}}if(q[A])throw new Error("Cannot transition to abstract state '"+b+"'");if(f.inherit&&(c=i(o,c||{},x.$current,q)),!q.params.$$validates(c))return C;c=q.params.$$values(c),b=q;var B=b.path,D=0,E=B[D],F=w.locals,H=[];if(!f.reload)for(;E&&E===n[D]&&E.ownParams.$$equals(c,m);)F=H[D]=E.locals,D++,E=B[D];if(v(b,j,F,f))return b.self.reloadOnSearch!==!1&&p.update(),x.transition=null,e.when(x.current);if(c=k(b.params.$$keys(),c||{}),f.notify&&a.$broadcast("$stateChangeStart",b.self,c,j.self,m).defaultPrevented)return p.update(),z;for(var I=e.when(F),J=D;J<B.length;J++,E=B[J])F=H[J]=d(F),I=t(E,c,E===b,I,F,f);var K=x.transition=I.then(function(){var d,e,g;if(x.transition!==K)return u;for(d=n.length-1;d>=D;d--)g=n[d],g.self.onExit&&h.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=D;d<B.length;d++)e=B[d],e.locals=H[d],e.self.onEnter&&h.invoke(e.self.onEnter,e.self,e.locals.globals);return x.transition!==K?u:(x.$current=b,x.current=b.self,x.params=c,N(x.params,o),x.transition=null,f.location&&b.navigable&&p.push(b.navigable.url,b.navigable.locals.globals.$stateParams,{$$avoidResync:!0,replace:"replace"===f.location}),f.notify&&a.$broadcast("$stateChangeSuccess",b.self,c,j.self,m),p.update(!0),x.current)},function(d){return x.transition!==K?u:(x.transition=null,g=a.$broadcast("$stateChangeError",b.self,c,j.self,m,d),g.defaultPrevented||p.update(),e.reject(d))});return K},x.is=function(a,b,d){d=M({relative:x.$current},d||{});var e=l(a,d.relative);return G(e)?x.$current!==e?!1:b?j(e.params.$$values(b),o):!0:c},x.includes=function(a,b,d){if(d=M({relative:x.$current},d||{}),I(a)&&q(a)){if(!r(a))return!1;a=x.$current.name}var e=l(a,d.relative);return G(e)?G(x.$current.includes[e.name])?b?j(e.params.$$values(b),o,g(b)):!0:!1:c},x.href=function(a,b,d){d=M({lossy:!0,inherit:!0,absolute:!1,relative:x.$current},d||{});var e=l(a,d.relative);if(!G(e))return null;d.inherit&&(b=i(o,b||{},x.$current,e));var f=e&&d.lossy?e.navigable:e;return f&&f.url!==c&&null!==f.url?p.href(f.url,k(e.params.$$keys(),b||{}),{absolute:d.absolute}):null},x.get=function(a,b){if(0===arguments.length)return n(g(y),function(a){return y[a].self});var c=l(a,b||x.$current);return c&&c.self?c.self:null},x}function v(a,b,c,d){return a!==b||(c!==b.locals||d.reload)&&a.self.reloadOnSearch!==!1?void 0:!0}var w,x,y={},z={},A="abstract",B={parent:function(a){if(G(a.parent)&&a.parent)return l(a.parent);var b=/^(.+)\.[^.]+$/.exec(a.name);return b?l(b[1]):w},data:function(a){return a.parent&&a.parent.data&&(a.data=a.self.data=M({},a.parent.data,a.data)),a.data},url:function(a){var b=a.url,c={params:a.params||{}};if(I(b))return"^"==b.charAt(0)?e.compile(b.substring(1),c):(a.parent.navigable||w).url.concat(b,c);if(!b||e.isMatcher(b))return b;throw new Error("Invalid url '"+b+"' in state '"+a+"'")},navigable:function(a){return a.url?a:a.parent?a.parent.navigable:null},ownParams:function(a){var b=a.url&&a.url.params||new O.ParamSet;return L(a.params||{},function(a,c){b[c]||(b[c]=new O.Param(c,null,a,"config"))}),b},params:function(a){return a.parent&&a.parent.params?M(a.parent.params.$$new(),a.ownParams):new O.ParamSet},views:function(a){var b={};return L(G(a.views)?a.views:{"":a},function(c,d){d.indexOf("@")<0&&(d+="@"+a.parent.name),b[d]=c}),b},path:function(a){return a.parent?a.parent.path.concat(a):[]},includes:function(a){var b=a.parent?M({},a.parent.includes):{};return b[a.name]=!0,b},$delegates:{}};w=p({name:"",url:"^",views:null,"abstract":!0}),w.navigable=null,this.decorator=s,this.state=t,this.$get=u,u.$inject=["$rootScope","$q","$view","$injector","$resolve","$stateParams","$urlRouter","$location","$urlMatcherFactory"]}function v(){function a(a,b){return{load:function(c,d){var e,f={template:null,controller:null,view:null,locals:null,notify:!0,async:!0,params:{}};return d=M(f,d),d.view&&(e=b.fromConfig(d.view,d.params,d.locals)),e&&d.notify&&a.$broadcast("$viewContentLoading",d),e}}}this.$get=a,a.$inject=["$rootScope","$templateFactory"]}function w(){var a=!1;this.useAnchorScroll=function(){a=!0},this.$get=["$anchorScroll","$timeout",function(b,c){return a?b:function(a){c(function(){a[0].scrollIntoView()},0,!1)}}]}function x(a,c,d,e){function f(){return c.has?function(a){return c.has(a)?c.get(a):null}:function(a){try{return c.get(a)}catch(b){return null}}}function g(a,b){var c=function(){return{enter:function(a,b,c){b.after(a),c()},leave:function(a,b){a.remove(),b()}}};if(j)return{enter:function(a,b,c){var d=j.enter(a,null,b,c);d&&d.then&&d.then(c)},leave:function(a,b){var c=j.leave(a,b);c&&c.then&&c.then(b)}};if(i){var d=i&&i(b,a);return{enter:function(a,b,c){d.enter(a,null,b),c()},leave:function(a,b){d.leave(a),b()}}}return c()}var h=f(),i=h("$animator"),j=h("$animate"),k={restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(c,f,h){return function(c,f,i){function j(){l&&(l.remove(),l=null),n&&(n.$destroy(),n=null),m&&(r.leave(m,function(){l=null}),l=m,m=null)}function k(g){var k,l=z(c,i,f,e),s=l&&a.$current&&a.$current.locals[l];if(g||s!==o){k=c.$new(),o=a.$current.locals[l];var t=h(k,function(a){r.enter(a,f,function(){n&&n.$emit("$viewContentAnimationEnded"),(b.isDefined(q)&&!q||c.$eval(q))&&d(a)}),j()});m=t,n=k,n.$emit("$viewContentLoaded"),n.$eval(p)}}var l,m,n,o,p=i.onload||"",q=i.autoscroll,r=g(i,c);c.$on("$stateChangeSuccess",function(){k(!1)}),c.$on("$viewContentLoading",function(){k(!1)}),k(!0)}}};return k}function y(a,b,c,d){return{restrict:"ECA",priority:-400,compile:function(e){var f=e.html();return function(e,g,h){var i=c.$current,j=z(e,h,g,d),k=i&&i.locals[j];if(k){g.data("$uiView",{name:j,state:k.$$state}),g.html(k.$template?k.$template:f);var l=a(g.contents());if(k.$$controller){k.$scope=e;var m=b(k.$$controller,k);k.$$controllerAs&&(e[k.$$controllerAs]=m),g.data("$ngControllerController",m),g.children().data("$ngControllerController",m)}l(e)}}}}}function z(a,b,c,d){var e=d(b.uiView||b.name||"")(a),f=c.inheritedData("$uiView");return e.indexOf("@")>=0?e:e+"@"+(f?f.state.name:"")}function A(a,b){var c,d=a.match(/^\s*({[^}]*})\s*$/);if(d&&(a=b+"("+d[1]+")"),c=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!c||4!==c.length)throw new Error("Invalid state ref '"+a+"'");return{state:c[1],paramExpr:c[3]||null}}function B(a){var b=a.parent().inheritedData("$uiView");return b&&b.state&&b.state.name?b.state:void 0}function C(a,c){var d=["location","inherit","reload"];return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(e,f,g,h){var i=A(g.uiSref,a.current.name),j=null,k=B(f)||a.$current,l=null,m="A"===f.prop("tagName"),n="FORM"===f[0].nodeName,o=n?"action":"href",p=!0,q={relative:k,inherit:!0},r=e.$eval(g.uiSrefOpts)||{};b.forEach(d,function(a){a in r&&(q[a]=r[a])});var s=function(c){if(c&&(j=b.copy(c)),p){l=a.href(i.state,j,q);var d=h[1]||h[0];return d&&d.$$setStateInfo(i.state,j),null===l?(p=!1,!1):void g.$set(o,l)}};i.paramExpr&&(e.$watch(i.paramExpr,function(a){a!==j&&s(a)},!0),j=b.copy(e.$eval(i.paramExpr))),s(),n||f.bind("click",function(b){var d=b.which||b.button;if(!(d>1||b.ctrlKey||b.metaKey||b.shiftKey||f.attr("target"))){var e=c(function(){a.go(i.state,j,q)});b.preventDefault();var g=m&&!l?1:0;b.preventDefault=function(){g--<=0&&c.cancel(e)}}})}}}function D(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs",function(b,d,e){function f(){g()?d.addClass(j):d.removeClass(j)}function g(){return"undefined"!=typeof e.uiSrefActiveEq?h&&a.is(h.name,i):h&&a.includes(h.name,i)}var h,i,j;j=c(e.uiSrefActiveEq||e.uiSrefActive||"",!1)(b),this.$$setStateInfo=function(b,c){h=a.get(b,B(d)),i=c,f()},b.$on("$stateChangeSuccess",f)}]}}function E(a){var b=function(b){return a.is(b)};return b.$stateful=!0,b}function F(a){var b=function(b){return a.includes(b)};return b.$stateful=!0,b}var G=b.isDefined,H=b.isFunction,I=b.isString,J=b.isObject,K=b.isArray,L=b.forEach,M=b.extend,N=b.copy;b.module("ui.router.util",["ng"]),b.module("ui.router.router",["ui.router.util"]),b.module("ui.router.state",["ui.router.router","ui.router.util"]),b.module("ui.router",["ui.router.state"]),b.module("ui.router.compat",["ui.router"]),o.$inject=["$q","$injector"],b.module("ui.router.util").service("$resolve",o),p.$inject=["$http","$templateCache","$injector"],b.module("ui.router.util").service("$templateFactory",p);var O;q.prototype.concat=function(a,b){var c={caseInsensitive:O.caseInsensitive(),strict:O.strictMode(),squash:O.defaultSquashPolicy()};return new q(this.sourcePath+a+this.sourceSearch,M(c,b),this)},q.prototype.toString=function(){return this.source},q.prototype.exec=function(a,b){function c(a){function b(a){return a.split("").reverse().join("")}function c(a){return a.replace(/\\-/,"-")}var d=b(a).split(/-(?!\\)/),e=n(d,b);return n(e,c).reverse()}var d=this.regexp.exec(a);if(!d)return null;b=b||{};var e,f,g,h=this.parameters(),i=h.length,j=this.segments.length-1,k={};if(j!==d.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");for(e=0;j>e;e++){g=h[e];var l=this.params[g],m=d[e+1];for(f=0;f<l.replace;f++)l.replace[f].from===m&&(m=l.replace[f].to);m&&l.array===!0&&(m=c(m)),k[g]=l.value(m)}for(;i>e;e++)g=h[e],k[g]=this.params[g].value(b[g]);return k},q.prototype.parameters=function(a){return G(a)?this.params[a]||null:this.$$paramNames},q.prototype.validates=function(a){return this.params.$$validates(a)},q.prototype.format=function(a){function b(a){return encodeURIComponent(a).replace(/-/g,function(a){return"%5C%"+a.charCodeAt(0).toString(16).toUpperCase()})}a=a||{};var c=this.segments,d=this.parameters(),e=this.params;if(!this.validates(a))return null;var f,g=!1,h=c.length-1,i=d.length,j=c[0];for(f=0;i>f;f++){var k=h>f,l=d[f],m=e[l],o=m.value(a[l]),p=m.isOptional&&m.type.equals(m.value(),o),q=p?m.squash:!1,r=m.type.encode(o);if(k){var s=c[f+1];if(q===!1)null!=r&&(j+=K(r)?n(r,b).join("-"):encodeURIComponent(r)),j+=s;else if(q===!0){var t=j.match(/\/$/)?/\/?(.*)/:/(.*)/;j+=s.match(t)[1]}else I(q)&&(j+=q+s)}else{if(null==r||p&&q!==!1)continue;K(r)||(r=[r]),r=n(r,encodeURIComponent).join("&"+l+"="),j+=(g?"&":"?")+(l+"="+r),g=!0}}return j},r.prototype.is=function(){return!0},r.prototype.encode=function(a){return a},r.prototype.decode=function(a){return a},r.prototype.equals=function(a,b){return a==b},r.prototype.$subPattern=function(){var a=this.pattern.toString();return a.substr(1,a.length-2)},r.prototype.pattern=/.*/,r.prototype.toString=function(){return"{Type:"+this.name+"}"},r.prototype.$asArray=function(a,b){function d(a,b){function d(a,b){return function(){return a[b].apply(a,arguments)}}function e(a){return K(a)?a:G(a)?[a]:[]}function f(a){switch(a.length){case 0:return c;case 1:return"auto"===b?a[0]:a;default:return a}}function g(a){return!a}function h(a,b){return function(c){c=e(c);var d=n(c,a);return b===!0?0===m(d,g).length:f(d)}}function i(a){return function(b,c){var d=e(b),f=e(c);if(d.length!==f.length)return!1;for(var g=0;g<d.length;g++)if(!a(d[g],f[g]))return!1;return!0}}this.encode=h(d(a,"encode")),this.decode=h(d(a,"decode")),this.is=h(d(a,"is"),!0),this.equals=i(d(a,"equals")),this.pattern=a.pattern,this.$arrayMode=b}if(!a)return this;if("auto"===a&&!b)throw new Error("'auto' array mode is for query parameters only");return new d(this,a)},b.module("ui.router.util").provider("$urlMatcherFactory",s),b.module("ui.router.util").run(["$urlMatcherFactory",function(){}]),t.$inject=["$locationProvider","$urlMatcherFactoryProvider"],b.module("ui.router.router").provider("$urlRouter",t),u.$inject=["$urlRouterProvider","$urlMatcherFactoryProvider"],b.module("ui.router.state").value("$stateParams",{}).provider("$state",u),v.$inject=[],b.module("ui.router.state").provider("$view",v),b.module("ui.router.state").provider("$uiViewScroll",w),x.$inject=["$state","$injector","$uiViewScroll","$interpolate"],y.$inject=["$compile","$controller","$state","$interpolate"],b.module("ui.router.state").directive("uiView",x),b.module("ui.router.state").directive("uiView",y),C.$inject=["$state","$timeout"],D.$inject=["$state","$stateParams","$interpolate"],b.module("ui.router.state").directive("uiSref",C).directive("uiSrefActive",D).directive("uiSrefActiveEq",D),E.$inject=["$state"],F.$inject=["$state"],b.module("ui.router.state").filter("isState",E).filter("includedByState",F)}(window,window.angular);
/*!
 * ionic.bundle.js is a concatenation of:
 * ionic.js, angular.js, angular-animate.js,
 * angular-sanitize.js, angular-ui-router.js,
 * and ionic-angular.js
 */

/*!
 * Copyright 2015 Drifty Co.
 * http://drifty.com/
 *
 * Ionic, v1.3.1
 * A powerful HTML5 mobile app framework.
 * http://ionicframework.com/
 *
 * By @maxlynch, @benjsperry, @adamdbradley <3
 *
 * Licensed under the MIT license. Please see LICENSE for more information.
 *
 */

!function(){function e(e,t,n,i,o,r){function a(i,a,c,s,u){function d(){N.resizeRequiresRefresh(b.__clientWidth,b.__clientHeight)&&g()}function f(){var e;return e={dataLength:0,width:0,height:0,resizeRequiresRefresh:function(t,n){var i=e.dataLength&&t&&n&&(t!==e.width||n!==e.height);return e.width=t,e.height=n,!!i},dataChangeRequiresRefresh:function(t){var n=t.length>0||t.length<e.dataLength;return e.dataLength=t.length,!!n}}}function h(){return T||(T=new e({afterItemsNode:M[0],containerNode:S,heightData:A,widthData:V,forceRefreshImages:!(!l(c.forceRefreshImages)||"false"===c.forceRefreshImages),keyExpression:I,renderBuffer:D,scope:i,scrollView:s.scrollView,transclude:u}))}function p(){var e=angular.element(b.__content.querySelector(".collection-repeat-after-container"));if(!e.length){var t=!1,n=[].filter.call(b.__content.childNodes,function(e){return ionic.DomUtil.contains(e,S)?(t=!0,!1):t});e=angular.element('<span class="collection-repeat-after-container">'),b.options.scrollingX&&e.addClass("horizontal"),e.append(n),b.__content.appendChild(e[0])}return e}function v(){L?m(L,A):A.computed=!0,R?m(R,V):V.computed=!0}function g(){var e=P.length>0;if(e&&(A.computed||V.computed)&&w(),e&&A.computed){if(A.value=E.height,!A.value)throw new Error('collection-repeat tried to compute the height of repeated elements "'+k+'", but was unable to. Please provide the "item-height" attribute. http://ionicframework.com/docs/api/directive/collectionRepeat/')}else!A.dynamic&&A.getValue&&(A.value=A.getValue());if(e&&V.computed){if(V.value=E.width,!V.value)throw new Error('collection-repeat tried to compute the width of repeated elements "'+k+'", but was unable to. Please provide the "item-width" attribute. http://ionicframework.com/docs/api/directive/collectionRepeat/')}else!V.dynamic&&V.getValue&&(V.value=V.getValue());h().refreshLayout()}function m(e,n){if(e){var i;try{i=t(e)}catch(o){e.trim().match(/\d+(px|%)$/)&&(e='"'+e+'"'),i=t(e)}var r=e.replace(/(\'|\"|px|%)/g,"").trim(),a=r.length&&!/([a-zA-Z]|\$|:|\?)/.test(r);if(n.attrValue=e,a)if(e.indexOf("%")>-1){var c=parseFloat(i())/100;n.getValue=n===A?function(){return Math.floor(c*b.__clientHeight)}:function(){return Math.floor(c*b.__clientWidth)}}else n.value=parseInt(i());else n.dynamic=!0,n.getValue=n===A?function(e,t){var n=i(e,t);return n.charAt&&"%"===n.charAt(n.length-1)?Math.floor(parseFloat(n)/100*b.__clientHeight):parseInt(n)}:function(e,t){var n=i(e,t);return n.charAt&&"%"===n.charAt(n.length-1)?Math.floor(parseFloat(n)/100*b.__clientWidth):parseInt(n)}}}function w(){O||u(H=i.$new(),function(e){e[0].removeAttribute("collection-repeat"),O=e[0]}),H[I]=(x(i)||[])[0],o.$$phase||H.$digest(),S.appendChild(O);var e=n.getComputedStyle(O);E.width=parseInt(e.width),E.height=parseInt(e.height),S.removeChild(O)}var b=s.scrollView,y=a[0],S=angular.element('<div class="collection-repeat-container">')[0];if(y.parentNode.replaceChild(S,y),b.options.scrollingX&&b.options.scrollingY)throw new Error("collection-repeat expected a parent x or y scrollView, not an xy scrollView.");var k=c.collectionRepeat,C=k.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!C)throw new Error("collection-repeat expected expression in form of '_item_ in _collection_[ track by _id_]' but got '"+c.collectionRepeat+"'.");var T,I=C[1],B=C[2],x=t(B),A={},V={},E={},P=[],_=c.itemRenderBuffer||c.collectionBufferSize,D=angular.isDefined(_)?parseInt(_):$,L=c.itemHeight||c.collectionItemHeight,R=c.itemWidth||c.collectionItemWidth,M=p(),N=f();v(),s.$element.on("scroll-resize",g),angular.element(n).on("resize",d);var z=o.$on("$ionicExposeAside",ionic.animationFrameThrottle(function(){s.scrollView.resize(),d()}));r(g,0,!1),i.$watchCollection(x,function(e){if(P=e||(e=[]),!angular.isArray(e))throw new Error("collection-repeat expected an array for '"+B+"', but got a "+typeof value);i.$$postDigest(function(){h().setData(P),N.dataChangeRequiresRefresh(P)&&g()})}),i.$on("$destroy",function(){angular.element(n).off("resize",d),z(),s.$element&&s.$element.off("scroll-resize",g),O&&O.parentNode&&O.parentNode.removeChild(O),H&&H.$destroy(),H=O=null,T&&T.destroy(),T=null});var O,H}return{restrict:"A",priority:1e3,transclude:"element",$$tlb:!0,require:"^^$ionicScroll",link:a}}function t(e,t,n){var i={primaryPos:0,secondaryPos:0,primarySize:0,secondarySize:0,rowPrimarySize:0};return function(o){function r(){return a(!0)}function a(t){if(!a.destroyed){var n,o,r,l,u,d=ee.getScrollValue(),f=d+ee.scrollPrimarySize;ee.updateRenderRange(d,f),F=Math.max(0,F-T),W=Math.min(A.length-1,W+T);for(n in Z)(F>n||n>W)&&(r=Z[n],delete Z[n],G.push(r),r.isShown=!1);for(n=F;W>=n;n++)n>=A.length||Z[n]&&!t||(r=Z[n]||(Z[n]=G.length?G.pop():j.length?j.shift():new s),K.push(r),r.isShown=!0,u=r.scope,u.$index=n,u[C]=A[n],u.$first=0===n,u.$last=n===A.length-1,u.$middle=!(u.$first||u.$last),u.$odd=!(u.$even=0===(1&n)),u.$$disconnected&&ionic.Utils.reconnectScope(r.scope),l=ee.getDimensions(n),(r.secondaryPos!==l.secondaryPos||r.primaryPos!==l.primaryPos)&&(r.node.style[ionic.CSS.TRANSFORM]=O.replace(N,r.primaryPos=l.primaryPos).replace(z,r.secondaryPos=l.secondaryPos)),(r.secondarySize!==l.secondarySize||r.primarySize!==l.primarySize)&&(r.node.style.cssText=r.node.style.cssText.replace(m,H.replace(N,(r.primarySize=l.primarySize)+1).replace(z,r.secondarySize=l.secondarySize))));for(W===A.length-1&&(l=ee.getDimensions(A.length-1)||i,w.style[ionic.CSS.TRANSFORM]=O.replace(N,l.primaryPos+l.primarySize).replace(z,0));G.length;)r=G.pop(),r.scope.$broadcast("$collectionRepeatLeave"),ionic.Utils.disconnectScope(r.scope),j.push(r),r.node.style[ionic.CSS.TRANSFORM]="translate3d(-9999px,-9999px,0)",r.primaryPos=r.secondaryPos=null;if(y)for(n=0,o=K.length;o>n&&(r=K[n]);n++)if(r.images)for(var h,p=0,v=r.images.length;v>p&&(h=r.images[p]);p++){var $=h.src;h.src=g,h.src=$}if(t)for(var b=e.$$phase;K.length;)r=K.pop(),b||r.scope.$digest();else c()}}function c(){var t;c.running||(c.running=!0,n(function(){for(var n=e.$$phase;K.length;)t=K.pop(),t.isShown&&(n||t.scope.$digest());c.running=!1}))}function s(){var e=this;this.scope=I.$new(),this.id="item"+J++,x(this.scope,function(t){e.element=t,e.element.data("$$collectionRepeatItem",e),e.node=t[0],e.node.style[ionic.CSS.TRANSFORM]="translate3d(-9999px,-9999px,0)",e.node.style.cssText+=" height: 0px; width: 0px;",ionic.Utils.disconnectScope(e.scope),b.appendChild(e.node),e.images=t[0].getElementsByTagName("img")})}function l(){this.getItemPrimarySize=P,this.getItemSecondarySize=D,this.getScrollValue=function(){return Math.max(0,Math.min(B.__scrollTop-q,B.__maxScrollTop-q-U))},this.refreshDirection=function(){this.scrollPrimarySize=B.__clientHeight,this.scrollSecondarySize=B.__clientWidth,this.estimatedPrimarySize=v,this.estimatedSecondarySize=$,this.estimatedItemsAcross=R&&Math.floor(B.__clientWidth/$)||1}}function u(){this.getItemPrimarySize=D,this.getItemSecondarySize=P,this.getScrollValue=function(){return Math.max(0,Math.min(B.__scrollLeft-q,B.__maxScrollLeft-q-U))},this.refreshDirection=function(){this.scrollPrimarySize=B.__clientWidth,this.scrollSecondarySize=B.__clientHeight,this.estimatedPrimarySize=$,this.estimatedSecondarySize=v,this.estimatedItemsAcross=R&&Math.floor(B.__clientHeight/v)||1}}function d(){this.getEstimatedSecondaryPos=function(e){return e%this.estimatedItemsAcross*this.estimatedSecondarySize},this.getEstimatedPrimaryPos=function(e){return Math.floor(e/this.estimatedItemsAcross)*this.estimatedPrimarySize},this.getEstimatedIndex=function(e){return Math.floor(e/this.estimatedPrimarySize)*this.estimatedItemsAcross}}function f(){this.getEstimatedSecondaryPos=function(){return 0},this.getEstimatedPrimaryPos=function(e){return e*this.estimatedPrimarySize},this.getEstimatedIndex=function(e){return Math.floor(e/this.estimatedPrimarySize)}}function h(){this.getContentSize=function(){return this.getEstimatedPrimaryPos(A.length-1)+this.estimatedPrimarySize+q+U};var e={};this.getDimensions=function(t){return e.primaryPos=this.getEstimatedPrimaryPos(t),e.secondaryPos=this.getEstimatedSecondaryPos(t),e.primarySize=this.estimatedPrimarySize,e.secondarySize=this.estimatedSecondarySize,e},this.updateRenderRange=function(e,t){F=Math.max(0,this.getEstimatedIndex(e)),W=Math.min(A.length-1,this.getEstimatedIndex(t)+this.estimatedItemsAcross-1),Y=Math.max(0,this.getEstimatedPrimaryPos(F)),X=this.getEstimatedPrimaryPos(W)+this.estimatedPrimarySize}}function p(){function e(e){var t,r,a;for(t=Math.max(0,n);e>=t&&(a=c[t]);t++)r=c[t-1]||i,a.primarySize=o.getItemPrimarySize(t,A[t]),a.secondarySize=o.scrollSecondarySize,a.primaryPos=r.primaryPos+r.primarySize,a.secondaryPos=0}function t(e){var t,r,a;for(t=Math.max(n,0);e>=t&&(a=c[t]);t++)r=c[t-1]||i,a.secondarySize=Math.min(o.getItemSecondarySize(t,A[t]),o.scrollSecondarySize),a.secondaryPos=r.secondaryPos+r.secondarySize,0===t||a.secondaryPos+a.secondarySize>o.scrollSecondarySize?(a.secondaryPos=0,a.primarySize=o.getItemPrimarySize(t,A[t]),a.primaryPos=r.primaryPos+r.rowPrimarySize,a.rowStartIndex=t,a.rowPrimarySize=a.primarySize):(a.primarySize=o.getItemPrimarySize(t,A[t]),a.primaryPos=r.primaryPos,a.rowStartIndex=r.rowStartIndex,c[a.rowStartIndex].rowPrimarySize=a.rowPrimarySize=Math.max(c[a.rowStartIndex].rowPrimarySize,a.primarySize),a.rowPrimarySize=Math.max(a.primarySize,a.rowPrimarySize))}var n,o=this,r=ionic.debounce(Q,25,!0),a=R?t:e,c=[];this.getContentSize=function(){var e=c[n]||i;return(e.primaryPos+e.primarySize||0)+this.getEstimatedPrimaryPos(A.length-n-1)+q+U},this.onDestroy=function(){c.length=0},this.onRefreshData=function(){var e,t;for(e=c.length,t=A.length;t>e;e++)c.push({});n=-1},this.onRefreshLayout=function(){n=-1},this.getDimensions=function(e){return e=Math.min(e,A.length-1),e>n&&(e>.9*A.length?(a(A.length-1),n=A.length-1,Q()):(a(e),n=e,r())),c[e]};var s=-1,l=-1;this.updateRenderRange=function(e,t){var n,i,o;if(this.getDimensions(2*this.getEstimatedIndex(t)),-1===s||0===e)n=0;else if(e>=l)for(n=s,i=A.length;i>n&&!((o=this.getDimensions(n))&&o.primaryPos+o.rowPrimarySize>=e);n++);else for(n=s;n>=0;n--)if((o=this.getDimensions(n))&&o.primaryPos<=e){n=R?o.rowStartIndex:n;break}F=Math.min(Math.max(0,n),A.length-1),Y=-1!==F?this.getDimensions(F).primaryPos:-1;var r;for(n=F+1,i=A.length;i>n;n++)if((o=this.getDimensions(n))&&o.primaryPos+o.rowPrimarySize>t){if(R)for(r=o;i-1>n&&(o=this.getDimensions(n+1)).primaryPos===r.primaryPos;)n++;break}W=Math.min(n,A.length-1),X=-1!==W?(o=this.getDimensions(W)).primaryPos+(o.rowPrimarySize||o.primarySize):-1,l=e,s=F}}var v,$,w=o.afterItemsNode,b=o.containerNode,y=o.forceRefreshImages,S=o.heightData,k=o.widthData,C=o.keyExpression,T=o.renderBuffer,I=o.scope,B=o.scrollView,x=o.transclude,A=[],V={},E=S.getValue||function(){return S.value},P=function(e,t){return V[C]=t,V.$index=e,E(I,V)},_=k.getValue||function(){return k.value},D=function(e,t){return V[C]=t,V.$index=e,_(I,V)},L=!!B.options.scrollingY,R=L?k.dynamic||k.value!==B.__clientWidth:S.dynamic||S.value!==B.__clientHeight,M=!S.dynamic&&!k.dynamic,N="PRIMARY",z="SECONDARY",O=L?"translate3d(SECONDARYpx,PRIMARYpx,0)":"translate3d(PRIMARYpx,SECONDARYpx,0)",H=L?"height: PRIMARYpx; width: SECONDARYpx;":"height: SECONDARYpx; width: PRIMARYpx;",q=0,U=0,F=-1,W=-1,X=-1,Y=-1,j=[],G=[],K=[],Z={},J=0,Q=L?function(){B.setDimensions(null,null,null,ee.getContentSize(),!0)}:function(){B.setDimensions(null,null,ee.getContentSize(),null,!0)},ee=L?new l:new u;(R?d:f).call(ee),(M?h:p).call(ee);var te=L?"getContentHeight":"getContentWidth",ne=B.options[te];B.options[te]=angular.bind(ee,ee.getContentSize),B.__$callback=B.__callback,B.__callback=function(e,t,n,i){var o=ee.getScrollValue();(-1===F||o+ee.scrollPrimarySize>X||Y>o)&&a(),B.__$callback(e,t,n,i)};var ie=!1,oe=!1;this.refreshLayout=function(){A.length?(v=P(0,A[0]),$=D(0,A[0])):(v=100,$=100);var e=getComputedStyle(w)||{},n=w.firstElementChild&&getComputedStyle(w.firstElementChild)||{},i=w.lastElementChild&&getComputedStyle(w.lastElementChild)||{};U=(parseInt(e[L?"height":"width"])||0)+(n&&parseInt(n[L?"marginTop":"marginLeft"])||0)+(i&&parseInt(i[L?"marginBottom":"marginRight"])||0),q=0;var o=b;do q+=o[L?"offsetTop":"offsetLeft"];while(ionic.DomUtil.contains(B.__content,o=o.offsetParent));var a=b.previousElementSibling,c=a?t.getComputedStyle(a):{},l=parseInt(c[L?"marginBottom":"marginRight"]||0);if(b.style[ionic.CSS.TRANSFORM]=O.replace(N,-l).replace(z,0),q-=l,B.__clientHeight&&B.__clientWidth||(B.__clientWidth=B.__container.clientWidth,B.__clientHeight=B.__container.clientHeight),(ee.onRefreshLayout||angular.noop)(),ee.refreshDirection(),Q(),!ie)for(var u=Math.max(20,3*T),d=0;u>d;d++)j.push(new s);ie=!0,ie&&oe&&((B.__scrollLeft>B.__maxScrollLeft||B.__scrollTop>B.__maxScrollTop)&&B.resize(),r(!0))},this.setData=function(e){A=e,(ee.onRefreshData||angular.noop)(),oe=!0},this.destroy=function(){a.destroyed=!0,j.forEach(function(e){e.scope.$destroy(),e.scope=e.element=e.node=e.images=null}),j.length=K.length=G.length=0,Z={},B.options[te]=ne,B.__callback=B.__$callback,B.resize(),(ee.onDestroy||angular.noop)()}}}function n(e){return["$ionicGesture","$parse",function(t,n){var i=e.substr(2).toLowerCase();return function(o,r,a){var c=n(a[e]),s=function(e){o.$apply(function(){c(o,{$event:e})})},l=t.on(i,s,r);o.$on("$destroy",function(){t.off(l,i,s)})}}]}function i(e){return["$document","$timeout",function(t,n){return{restrict:"E",controller:"$ionicHeaderBar",compile:function(i){function o(t,n,i,o){e?(t.$watch(function(){return n[0].className},function(e){var n=-1===e.indexOf("ng-hide"),i=-1!==e.indexOf("bar-subheader");t.$hasHeader=n&&!i,t.$hasSubheader=n&&i,t.$emit("$ionicSubheader",t.$hasSubheader)}),t.$on("$destroy",function(){delete t.$hasHeader,delete t.$hasSubheader}),o.align(),t.$on("$ionicHeader.align",function(){ionic.requestAnimationFrame(function(){o.align()})})):(t.$watch(function(){return n[0].className},function(e){var n=-1===e.indexOf("ng-hide"),i=-1!==e.indexOf("bar-subfooter");t.$hasFooter=n&&!i,t.$hasSubfooter=n&&i}),t.$on("$destroy",function(){delete t.$hasFooter,delete t.$hasSubfooter}),t.$watch("$hasTabs",function(e){n.toggleClass("has-tabs",!!e)}),o.align(),t.$on("$ionicFooter.align",function(){ionic.requestAnimationFrame(function(){o.align()})}))}return i.addClass(e?"bar bar-header":"bar bar-footer"),n(function(){e&&t[0].getElementsByClassName("tabs-top").length&&i.addClass("has-tabs-top")}),{pre:o}}}}]}function o(e){return e.clientHeight}function r(e){e.stopPropagation()}var a=angular.module("ionic",["ngAnimate","ngSanitize","ui.router","ngIOS9UIWebViewPatch"]),c=angular.extend,s=angular.forEach,l=angular.isDefined,u=angular.isNumber,d=angular.isString,f=angular.element,h=angular.noop;a.factory("$ionicActionSheet",["$rootScope","$compile","$animate","$timeout","$ionicTemplateLoader","$ionicPlatform","$ionicBody","IONIC_BACK_PRIORITY",function(e,t,n,i,o,r,a,s){function l(o){function l(e){e&&/icon/.test(e)&&(u.$actionSheetHasIcon=!0)}var u=e.$new(!0);c(u,{cancel:h,destructiveButtonClicked:h,buttonClicked:h,$deregisterBackButton:h,buttons:[],cancelOnStateChange:!0},o||{});for(var d=0;d<u.buttons.length;d++)l(u.buttons[d].text);l(u.cancelText),l(u.destructiveText);var p=u.element=t('<ion-action-sheet ng-class="cssClass" buttons="buttons"></ion-action-sheet>')(u),v=f(p[0].querySelector(".action-sheet-wrapper")),g=u.cancelOnStateChange?e.$on("$stateChangeSuccess",function(){u.cancel()}):h;return u.removeSheet=function(e){u.removed||(u.removed=!0,v.removeClass("action-sheet-up"),i(function(){a.removeClass("action-sheet-open")},400),u.$deregisterBackButton(),g(),n.removeClass(p,"active").then(function(){u.$destroy(),p.remove(),u.cancel.$scope=v=null,(e||h)(o.buttons)}))},u.showSheet=function(e){u.removed||(a.append(p).addClass("action-sheet-open"),n.addClass(p,"active").then(function(){u.removed||(e||h)()}),i(function(){u.removed||v.addClass("action-sheet-up")},20,!1))},u.$deregisterBackButton=r.registerBackButtonAction(function(){i(u.cancel)},s.actionSheet),u.cancel=function(){u.removeSheet(o.cancel)},u.buttonClicked=function(e){o.buttonClicked(e,o.buttons[e])===!0&&u.removeSheet()},u.destructiveButtonClicked=function(){o.destructiveButtonClicked()===!0&&u.removeSheet()},u.showSheet(),u.cancel.$scope=u,u.cancel}return{show:l}}]),f.prototype.addClass=function(e){var t,n,i,o,r,a;if(e&&"ng-scope"!=e&&"ng-isolate-scope"!=e)for(t=0;t<this.length;t++)if(o=this[t],o.setAttribute)if(e.indexOf(" ")<0&&o.classList.add)o.classList.add(e);else{for(a=(" "+(o.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),r=e.split(" "),n=0;n<r.length;n++)i=r[n].trim(),-1===a.indexOf(" "+i+" ")&&(a+=i+" ");o.setAttribute("class",a.trim())}return this},f.prototype.removeClass=function(e){var t,n,i,o,r;if(e)for(t=0;t<this.length;t++)if(r=this[t],r.getAttribute)if(e.indexOf(" ")<0&&r.classList.remove)r.classList.remove(e);else for(i=e.split(" "),n=0;n<i.length;n++)o=i[n],r.setAttribute("class",(" "+(r.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+o.trim()+" "," ").trim());return this},a.factory("$ionicBackdrop",["$document","$timeout","$$rAF","$rootScope",function(e,t,n,i){function o(){s++,1===s&&(c.addClass("visible"),i.$broadcast("backdrop.shown"),n(function(){s>=1&&c.addClass("active")}))}function r(){1===s&&(c.removeClass("active"),i.$broadcast("backdrop.hidden"),t(function(){0===s&&c.removeClass("visible")},400,!1)),s=Math.max(0,s-1)}function a(){return c}var c=f('<div class="backdrop">'),s=0;return e[0].body.appendChild(c[0]),{retain:o,release:r,getElement:a,_element:c}}]),a.factory("$ionicBind",["$parse","$interpolate",function(e,t){var n=/^\s*([@=&])(\??)\s*(\w*)\s*$/;return function(i,o,r){s(r||{},function(r,a){var c,s,l=r.match(n)||[],u=l[3]||a,d=l[1];switch(d){case"@":if(!o[u])return;o.$observe(u,function(e){i[a]=e}),o[u]&&(i[a]=t(o[u])(i));break;case"=":if(!o[u])return;s=i.$watch(o[u],function(e){i[a]=e}),i.$on("$destroy",s);break;case"&":if(o[u]&&o[u].match(RegExp(a+"(.*?)")))throw new Error('& expression binding "'+a+'" looks like it will recursively call "'+o[u]+'" and cause a stack overflow! Please choose a different scopeName.');c=e(o[u]),i[a]=function(e){return c(i,e)}}})}}]),a.factory("$ionicBody",["$document",function(e){return{addClass:function(){for(var t=0;t<arguments.length;t++)e[0].body.classList.add(arguments[t]);return this},removeClass:function(){for(var t=0;t<arguments.length;t++)e[0].body.classList.remove(arguments[t]);return this},enableClass:function(e){var t=Array.prototype.slice.call(arguments).slice(1);return e?this.addClass.apply(this,t):this.removeClass.apply(this,t),this},append:function(t){return e[0].body.appendChild(t.length?t[0]:t),this},get:function(){return e[0].body}}}]),a.factory("$ionicClickBlock",["$document","$ionicBody","$timeout",function(e,t,n){function i(e){e.preventDefault(),e.stopPropagation()}function o(){s&&(a?a.classList.remove(l):(a=e[0].createElement("div"),a.className="click-block",t.append(a),a.addEventListener("touchstart",i),a.addEventListener("mousedown",i)),s=!1)}function r(){a&&a.classList.add(l)}var a,c,s,l="click-block-hide";return{show:function(e){s=!0,n.cancel(c),c=n(this.hide,e||310,!1),o()},hide:function(){s=!1,n.cancel(c),r()}}}]),a.factory("$ionicGesture",[function(){return{on:function(e,t,n,i){return window.ionic.onGesture(e,t,n[0],i)},off:function(e,t,n){return window.ionic.offGesture(e,t,n)}}}]),a.factory("$ionicHistory",["$rootScope","$state","$location","$window","$timeout","$ionicViewSwitcher","$ionicNavViewDelegate",function(e,t,n,i,o,r,a){function s(e){return e?R.views[e]:null}function u(e){return e?s(e.backViewId):null}function d(e){return e?s(e.forwardViewId):null}function f(e){return e?R.histories[e]:null}function h(e){var t=p(e);return R.histories[t.historyId]||(R.histories[t.historyId]={historyId:t.historyId,parentHistoryId:p(t.scope.$parent).historyId,stack:[],cursor:-1}),f(t.historyId)}function p(t){for(var n=t;n;){if(n.hasOwnProperty("$historyId"))return{historyId:n.$historyId,scope:n};n=n.$parent}return{historyId:"root",scope:e}}function v(e){R.currentView=s(e),R.backView=u(R.currentView),R.forwardView=d(R.currentView)}function g(){var e;if(t&&t.current&&t.current.name){if(e=t.current.name,t.params)for(var n in t.params)t.params.hasOwnProperty(n)&&t.params[n]&&(e+="_"+n+"="+t.params[n]);return e}return ionic.Utils.nextUid()}function m(){var e;if(t&&t.params)for(var n in t.params)t.params.hasOwnProperty(n)&&(e=e||{},e[n]=t.params[n]);return e}function $(e){return e&&e.length&&/ion-side-menus|ion-tabs/i.test(e[0].tagName)}function w(e,t){if(t&&t.$$state&&t.$$state.self.canSwipeBack===!1)return!1;if(e&&"false"===e.attr("can-swipe-back"))return!1;var n=e.find("ion-view");return n&&"false"===n.attr("can-swipe-back")?!1:!0}var b,y,S,k,C,T="initialView",I="newView",B="moveBack",x="moveForward",A="back",V="forward",E="enter",P="exit",_="swap",D="none",L=0,R={histories:{root:{historyId:"root",parentHistoryId:null,stack:[],cursor:-1}},views:{},backView:null,forwardView:null,currentView:null},M=function(){};return M.prototype.initialize=function(e){if(e){for(var t in e)this[t]=e[t];return this}return null},M.prototype.go=function(){if(this.stateName)return t.go(this.stateName,this.stateParams);if(this.url&&this.url!==n.url()){if(R.backView===this)return i.history.go(-1);if(R.forwardView===this)return i.history.go(1);n.url(this.url)}return null},M.prototype.destroy=function(){this.scope&&(this.scope.$destroy&&this.scope.$destroy(),this.scope=null)},{register:function(e,t){var i,a,c,l=g(),d=h(e),$=R.currentView,M=R.backView,N=R.forwardView,z=null,O=null,H=D,q=d.historyId,U=n.url();if(b!==l&&(b=l,L++),C)z=C.viewId,O=C.action,H=C.direction,C=null;else if(M&&M.stateId===l)z=M.viewId,q=M.historyId,O=B,M.historyId===$.historyId?H=A:$&&(H=P,i=f(M.historyId),i&&i.parentHistoryId===$.historyId?H=E:(i=f($.historyId),i&&i.parentHistoryId===d.parentHistoryId&&(H=_)));else if(N&&N.stateId===l)z=N.viewId,q=N.historyId,O=x,N.historyId===$.historyId?H=V:$&&(H=P,$.historyId===d.parentHistoryId?H=E:(i=f($.historyId),i&&i.parentHistoryId===d.parentHistoryId&&(H=_))),i=p(e),N.historyId&&i.scope&&(i.scope.$historyId=N.historyId,q=N.historyId);else if($&&$.historyId!==q&&d.cursor>-1&&d.stack.length>0&&d.cursor<d.stack.length&&d.stack[d.cursor].stateId===l){var F=d.stack[d.cursor];if(z=F.viewId,q=F.historyId,O=B,H=_,i=f($.historyId),i&&i.parentHistoryId===q?H=P:(i=f(q),i&&i.parentHistoryId===$.historyId&&(H=E)),i=s(F.backViewId),i&&F.historyId!==i.historyId){var W=Object.keys(R.views);W.forEach(function(e){var t=R.views[e];t.backViewId===F.viewId&&(t.backViewId=null)}),d.stack[d.cursor].backViewId=$.viewId}}else{if(c=r.createViewEle(t),this.isAbstractEle(c,t))return{action:"abstractView",direction:D,ele:c};if(z=ionic.Utils.nextUid(),$){if($.forwardViewId=z,O=I,N&&$.stateId!==N.stateId&&$.historyId===N.historyId&&(i=f(N.historyId))){for(a=i.stack.length-1;a>=N.index;a--){var X=i.stack[a];X&&X.destroy&&X.destroy(),i.stack.splice(a)}q=N.historyId}d.historyId===$.historyId?H=V:$.historyId!==d.historyId&&(H=E,i=f($.historyId),i&&i.parentHistoryId===d.parentHistoryId?H=_:(i=f(i.parentHistoryId),i&&i.historyId===d.historyId&&(H=P)))}else O=T;2>L&&(H=D),R.views[z]=this.createView({viewId:z,index:d.stack.length,historyId:d.historyId,backViewId:$&&$.viewId?$.viewId:null,forwardViewId:null,stateId:l,stateName:this.currentStateName(),stateParams:m(),url:U,canSwipeBack:w(c,t)}),d.stack.push(R.views[z])}if(S&&S(),o.cancel(k),y){if(y.disableAnimate&&(H=D),y.disableBack&&(R.views[z].backViewId=null),y.historyRoot){for(a=0;a<d.stack.length;a++)d.stack[a].viewId===z?(d.stack[a].index=0,d.stack[a].backViewId=d.stack[a].forwardViewId=null):delete R.views[d.stack[a].viewId];d.stack=[R.views[z]]}y=null}if(v(z),R.backView&&q==R.backView.historyId&&l==R.backView.stateId&&U==R.backView.url)for(a=0;a<d.stack.length;a++)if(d.stack[a].viewId==z){O="dupNav",H=D,a>0&&(d.stack[a-1].forwardViewId=null),R.forwardView=null,R.currentView.index=R.backView.index,R.currentView.backViewId=R.backView.backViewId,R.backView=u(R.backView),d.stack.splice(a,1);break}return d.cursor=R.currentView.index,{viewId:z,action:O,direction:H,historyId:q,enableBack:this.enabledBack(R.currentView),isHistoryRoot:0===R.currentView.index,ele:c}},registerHistory:function(e){e.$historyId=ionic.Utils.nextUid()},createView:function(e){var t=new M;return t.initialize(e)},getViewById:s,viewHistory:function(){return R},currentView:function(e){return arguments.length&&(R.currentView=e),R.currentView},currentHistoryId:function(){return R.currentView?R.currentView.historyId:null},currentTitle:function(e){return R.currentView?(arguments.length&&(R.currentView.title=e),R.currentView.title):void 0},backView:function(e){return arguments.length&&(R.backView=e),R.backView},backTitle:function(e){var t=e&&s(e.backViewId)||R.backView;return t&&t.title},forwardView:function(e){return arguments.length&&(R.forwardView=e),R.forwardView},currentStateName:function(){return t&&t.current?t.current.name:null},isCurrentStateNavView:function(e){return!!(t&&t.current&&t.current.views&&t.current.views[e])},goToHistoryRoot:function(e){if(e){var t=f(e);if(t&&t.stack.length){if(R.currentView&&R.currentView.viewId===t.stack[0].viewId)return;C={viewId:t.stack[0].viewId,action:B,direction:A},t.stack[0].go()}}},goBack:function(e){if(l(e)&&-1!==e){if(e>-1)return;var t=R.histories[this.currentHistoryId()],n=t.cursor+e+1;1>n&&(n=1),t.cursor=n,v(t.stack[n].viewId);for(var i=n-1,r=[],a=s(t.stack[i].forwardViewId);a&&(r.push(a.stateId||a.viewId),i++,!(i>=t.stack.length));)a=s(t.stack[i].forwardViewId);var c=this;r.length&&o(function(){c.clearCache(r)},300)}R.backView&&R.backView.go()},removeBackView:function(){var e=this,t=R.histories[this.currentHistoryId()],n=t.cursor,i=t.stack[n],o=t.stack[n-1],r=t.stack[n-2];o&&r&&(t.stack.splice(n-1,1),e.clearCache([o.viewId]),i.backViewId=r.viewId,i.index=i.index-1,r.forwardViewId=i.viewId,R.backView=r,t.currentCursor+=-1)},enabledBack:function(e){var t=u(e);return!(!t||t.historyId!==e.historyId)},clearHistory:function(){var e=R.histories,t=R.currentView;if(e)for(var n in e)e[n].stack&&(e[n].stack=[],e[n].cursor=-1),t&&t.historyId===n?(t.backViewId=t.forwardViewId=null,e[n].stack.push(t)):e[n].destroy&&e[n].destroy();for(var i in R.views)i!==t.viewId&&delete R.views[i];t&&v(t.viewId)},clearCache:function(e){return o(function(){a._instances.forEach(function(t){t.clearCache(e)})})},nextViewOptions:function(t){return S&&S(),arguments.length&&(o.cancel(k),null===t?y=t:(y=y||{},c(y,t),y.expire&&(S=e.$on("$stateChangeSuccess",function(){k=o(function(){y=null},y.expire)})))),y},isAbstractEle:function(e,t){return t&&t.$$state&&t.$$state.self["abstract"]?!0:!(!e||!$(e)&&!$(e.children()))},isActiveScope:function(e){if(!e)return!1;for(var t,n=e,i=this.currentHistoryId();n;){if(n.$$disconnected)return!1;if(!t&&n.hasOwnProperty("$historyId")&&(t=!0),i){if(n.hasOwnProperty("$historyId")&&i==n.$historyId)return!0;if(n.hasOwnProperty("$activeHistoryId")&&i==n.$activeHistoryId){if(n.hasOwnProperty("$historyId"))return!0;if(!t)return!0}}t&&n.hasOwnProperty("$activeHistoryId")&&(t=!1),n=n.$parent}return i?"root"==i:!0}}}]).run(["$rootScope","$state","$location","$document","$ionicPlatform","$ionicHistory","IONIC_BACK_PRIORITY",function(e,t,n,i,o,r,a){function c(e){var t=r.backView();return t?t.go():ionic.Platform.exitApp(),e.preventDefault(),!1}e.$on("$ionicView.beforeEnter",function(){ionic.keyboard&&ionic.keyboard.hide&&ionic.keyboard.hide()}),e.$on("$ionicHistory.change",function(e,i){if(!i)return null;var o=r.viewHistory(),a=i.historyId?o.histories[i.historyId]:null;if(a&&a.cursor>-1&&a.cursor<a.stack.length){var c=a.stack[a.cursor];return c.go(i)}!i.url&&i.uiSref&&(i.url=t.href(i.uiSref)),i.url&&(0===i.url.indexOf("#")&&(i.url=i.url.replace("#","")),i.url!==n.url()&&n.url(i.url))}),e.$ionicGoBack=function(e){r.goBack(e)},e.$on("$ionicView.afterEnter",function(e,t){t&&t.title&&(i[0].title=t.title)}),o.registerBackButtonAction(c,a.view)}]),a.provider("$ionicConfig",function(){function e(e,i){a.platform[e]=i,o.platform[e]={},t(a,a.platform[e]),n(a.platform[e],o.platform[e],"")}function t(e,n){for(var i in e)i!=r&&e.hasOwnProperty(i)&&(angular.isObject(e[i])?(l(n[i])||(n[i]={}),t(e[i],n[i])):l(n[i])||(n[i]=null))}function n(e,t,o){s(e,function(c,s){angular.isObject(e[s])?(t[s]={},n(e[s],t[s],o+"."+s)):t[s]=function(n){if(arguments.length)return e[s]=n,t;if(e[s]==r){var c=i(a.platform,ionic.Platform.platform()+o+"."+s);return c||c===!1?c:i(a.platform,"default"+o+"."+s)}return e[s]}})}function i(e,t){t=t.split(".");for(var n=0;n<t.length;n++){if(!e||!l(e[t[n]]))return null;e=e[t[n]]}return e}var o=this;o.platform={};var r="platform",a={views:{maxCache:r,forwardCache:r,transition:r,swipeBackEnabled:r,swipeBackHitWidth:r},navBar:{alignTitle:r,positionPrimaryButtons:r,positionSecondaryButtons:r,transition:r},backButton:{icon:r,text:r,previousTitleText:r},form:{checkbox:r,toggle:r},scrolling:{jsScrolling:r},spinner:{icon:r},tabs:{style:r,position:r},templates:{maxPrefetch:r},platform:{}};n(a,o,""),e("default",{views:{maxCache:10,forwardCache:!1,transition:"ios",swipeBackEnabled:!0,swipeBackHitWidth:45},navBar:{alignTitle:"center",positionPrimaryButtons:"left",positionSecondaryButtons:"right",transition:"view"},backButton:{icon:"ion-ios-arrow-back",text:"Back",previousTitleText:!0},form:{checkbox:"circle",toggle:"large"},scrolling:{jsScrolling:!0},spinner:{icon:"ios"},tabs:{style:"standard",position:"bottom"},templates:{maxPrefetch:30}}),e("ios",{}),e("android",{views:{transition:"android",swipeBackEnabled:!1},navBar:{alignTitle:"left",positionPrimaryButtons:"right",positionSecondaryButtons:"right"},backButton:{icon:"ion-android-arrow-back",text:!1,previousTitleText:!1},form:{checkbox:"square",toggle:"small"},spinner:{icon:"android"},tabs:{style:"striped",position:"top"},scrolling:{jsScrolling:!1}}),e("windowsphone",{spinner:{icon:"android"}}),o.transitions={views:{},navBar:{}},o.transitions.views.ios=function(e,t,n,i){function o(e,t,n,i){var o={};o[ionic.CSS.TRANSITION_DURATION]=r.shouldAnimate?"":0,o.opacity=t,i>-1&&(o.boxShadow="0 0 10px rgba(0,0,0,"+(r.shouldAnimate?.45*i:.3)+")"),o[ionic.CSS.TRANSFORM]="translate3d("+n+"%,0,0)",ionic.DomUtil.cachedStyles(e,o)}var r={run:function(i){"forward"==n?(o(e,1,99*(1-i),1-i),o(t,1-.1*i,-33*i,-1)):"back"==n?(o(e,1-.1*(1-i),-33*(1-i),-1),o(t,1,100*i,1-i)):(o(e,1,0,-1),o(t,0,0,-1))},shouldAnimate:i&&("forward"==n||"back"==n)};return r},o.transitions.navBar.ios=function(e,t,n,i){function o(e,t,n,i){var o={};o[ionic.CSS.TRANSITION_DURATION]=c.shouldAnimate?"":"0ms",o.opacity=1===t?"":t,e.setCss("buttons-left",o),e.setCss("buttons-right",o),e.setCss("back-button",o),o[ionic.CSS.TRANSFORM]="translate3d("+i+"px,0,0)",e.setCss("back-text",o),o[ionic.CSS.TRANSFORM]="translate3d("+n+"px,0,0)",e.setCss("title",o)}function r(e,t,n){if(e&&t){var i=(e.titleTextX()+e.titleWidth())*(1-n),r=t&&(t.titleTextX()-e.backButtonTextLeft())*(1-n)||0;o(e,n,i,r)}}function a(e,t,n){if(e&&t){var i=(-(e.titleTextX()-t.backButtonTextLeft())-e.titleLeftRight())*n;o(e,1-n,i,0)}}var c={run:function(n){var i=e.controller(),o=t&&t.controller();"back"==c.direction?(a(i,o,1-n),r(o,i,1-n)):(r(i,o,n),a(o,i,n))},direction:n,shouldAnimate:i&&("forward"==n||"back"==n)};return c},o.transitions.views.android=function(e,t,n,i){function o(e,t,n){var i={};i[ionic.CSS.TRANSITION_DURATION]=r.shouldAnimate?"":0,i[ionic.CSS.TRANSFORM]="translate3d("+t+"%,0,0)",i.opacity=n,ionic.DomUtil.cachedStyles(e,i)}i=i&&("forward"==n||"back"==n);var r={run:function(i){"forward"==n?(o(e,99*(1-i),1),o(t,-100*i,1)):"back"==n?(o(e,-100*(1-i),1),o(t,100*i,1)):(o(e,0,1),o(t,0,0))},shouldAnimate:i};return r},o.transitions.navBar.android=function(e,t,n,i){function o(e,t){if(e){var n={};n.opacity=1===t?"":t,e.setCss("buttons-left",n),e.setCss("buttons-right",n),e.setCss("back-button",n),e.setCss("back-text",n),e.setCss("title",n)}}return{run:function(n){o(e.controller(),n),o(t&&t.controller(),1-n)},shouldAnimate:i&&("forward"==n||"back"==n)}},
o.transitions.views.none=function(e,t){return{run:function(n){o.transitions.views.android(e,t,!1,!1).run(n)},shouldAnimate:!1}},o.transitions.navBar.none=function(e,t){return{run:function(n){o.transitions.navBar.ios(e,t,!1,!1).run(n),o.transitions.navBar.android(e,t,!1,!1).run(n)},shouldAnimate:!1}},o.setPlatformConfig=e,o.$get=function(){return o}}).config(["$compileProvider",function(e){e.aHrefSanitizationWhitelist(/^\s*(https?|sms|tel|geo|ftp|mailto|file|ghttps?|ms-appx-web|ms-appx|x-wmapp0):/),e.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|content|blob|ms-appx|ms-appx-web|x-wmapp0):|data:image\//)}]);var p='<div class="loading-container"><div class="loading"></div></div>';a.constant("$ionicLoadingConfig",{template:"<ion-spinner></ion-spinner>"}).factory("$ionicLoading",["$ionicLoadingConfig","$ionicBody","$ionicTemplateLoader","$ionicBackdrop","$timeout","$q","$log","$compile","$ionicPlatform","$rootScope","IONIC_BACK_PRIORITY",function(e,t,n,i,o,r,a,s,l,u,d){function f(){return m||(m=n.compile({template:p,appendTo:t.get()}).then(function(e){return e.show=function(a){var c=a.templateUrl?n.load(a.templateUrl):r.when(a.template||a.content||"");e.scope=a.scope||e.scope,e.isShown||(e.hasBackdrop=!a.noBackdrop&&a.showBackdrop!==!1,e.hasBackdrop&&(i.retain(),i.getElement().addClass("backdrop-loading"))),a.duration&&(o.cancel(e.durationTimeout),e.durationTimeout=o(angular.bind(e,e.hide),+a.duration)),$(),$=l.registerBackButtonAction(h,d.loading),c.then(function(n){if(n){var i=e.element.children();i.html(n),s(i.contents())(e.scope)}e.isShown&&(e.element.addClass("visible"),ionic.requestAnimationFrame(function(){e.isShown&&(e.element.addClass("active"),t.addClass("loading-active"))}))}),e.isShown=!0},e.hide=function(){$(),e.isShown&&(e.hasBackdrop&&(i.release(),i.getElement().removeClass("backdrop-loading")),e.element.removeClass("active"),t.removeClass("loading-active"),e.element.removeClass("visible"),ionic.requestAnimationFrame(function(){!e.isShown&&e.element.removeClass("visible")})),o.cancel(e.durationTimeout),e.isShown=!1;var n=e.element.children();n.html("")},e})),m}function v(t){t=c({},e||{},t||{});var n=t.delay||t.showDelay||0;return w(),b(),t.hideOnStateChange&&(w=u.$on("$stateChangeSuccess",g),b=u.$on("$stateChangeError",g)),o.cancel(y),y=o(h,n),y.then(f).then(function(e){return e.show(t)})}function g(){return w(),b(),o.cancel(y),f().then(function(e){return e.hide()})}var m,$=h,w=h,b=h,y=r.when();return{show:v,hide:g,_getLoader:f}}]),a.factory("$ionicModal",["$rootScope","$ionicBody","$compile","$timeout","$ionicPlatform","$ionicTemplateLoader","$$q","$log","$ionicClickBlock","$window","IONIC_BACK_PRIORITY",function(e,t,n,i,o,r,a,s,l,u,d){var p=ionic.views.Modal.inherit({initialize:function(e){ionic.views.Modal.prototype.initialize.call(this,e),this.animation=e.animation||"slide-in-up"},show:function(e){var n=this;if(n.scope.$$destroyed)return s.error("Cannot call "+n.viewType+".show() after remove(). Please create a new "+n.viewType+" instance."),a.when();l.show(600),m.add(n);var r=f(n.modalEl);n.el.classList.remove("hide"),i(function(){n._isShown&&t.addClass(n.viewType+"-open")},400,!1),n.el.parentElement||(r.addClass(n.animation),t.append(n.el));var c=r.data("$$ionicScrollController");return c&&c.resize(),e&&n.positionView&&(n.positionView(e,r),n._onWindowResize=function(){n._isShown&&n.positionView(e,r)},ionic.on("resize",n._onWindowResize,window)),r.addClass("ng-enter active").removeClass("ng-leave ng-leave-active"),n._isShown=!0,n._deregisterBackButton=o.registerBackButtonAction(n.hardwareBackButtonClose?angular.bind(n,n.hide):h,d.modal),ionic.views.Modal.prototype.show.call(n),i(function(){n._isShown&&(r.addClass("ng-enter-active"),ionic.trigger("resize"),n.scope.$parent&&n.scope.$parent.$broadcast(n.viewType+".shown",n),n.el.classList.add("active"),n.scope.$broadcast("$ionicHeader.align"),n.scope.$broadcast("$ionicFooter.align"),n.scope.$broadcast("$ionic.modalPresented"))},20),i(function(){n._isShown&&(n.$el.on("touchmove",function(e){var t=ionic.DomUtil.getParentOrSelfWithClass(e.target,"scroll");t||e.preventDefault()}),n.$el.on("click",function(e){n.backdropClickToClose&&e.target===n.el&&m.isHighest(n)&&n.hide()}))},400)},hide:function(){var e=this,n=f(e.modalEl);return l.show(600),m.remove(e),e.el.classList.remove("active"),n.addClass("ng-leave"),i(function(){e._isShown||(n.addClass("ng-leave-active").removeClass("ng-enter ng-enter-active active"),e.scope.$broadcast("$ionic.modalRemoved"))},20,!1),e.$el.off("click"),e._isShown=!1,e.scope.$parent&&e.scope.$parent.$broadcast(e.viewType+".hidden",e),e._deregisterBackButton&&e._deregisterBackButton(),ionic.views.Modal.prototype.hide.call(e),e.positionView&&ionic.off("resize",e._onWindowResize,window),i(function(){t.removeClass(e.viewType+"-open"),e.el.classList.add("hide")},e.hideDelay||320)},remove:function(){var e,t,n=this;return n.scope.$parent&&n.scope.$parent.$broadcast(n.viewType+".removed",n),n._isShown?t=n.hide():(e=a.defer(),e.resolve(),t=e.promise),t.then(function(){n.scope.$destroy(),n.$el.remove()})},isShown:function(){return!!this._isShown}}),v=function(t,i){var o=i.scope&&i.scope.$new()||e.$new(!0);i.viewType=i.viewType||"modal",c(o,{$hasHeader:!1,$hasSubheader:!1,$hasFooter:!1,$hasSubfooter:!1,$hasTabs:!1,$hasTabsTop:!1});var r=n("<ion-"+i.viewType+">"+t+"</ion-"+i.viewType+">")(o);i.$el=r,i.el=r[0],i.modalEl=i.el.querySelector("."+i.viewType);var a=new p(i);return a.scope=o,i.scope||(o[i.viewType]=a),a},g=[],m={add:function(e){g.push(e)},remove:function(e){var t=g.indexOf(e);t>-1&&t<g.length&&g.splice(t,1)},isHighest:function(e){var t=g.indexOf(e);return t>-1&&t===g.length-1}};return{fromTemplate:function(e,t){var n=v(e,t||{});return n},fromTemplateUrl:function(e,t,n){var i;return angular.isFunction(t)&&(i=t,t=n),r.load(e).then(function(e){var n=v(e,t||{});return i&&i(n),n})},stack:m}}]),a.service("$ionicNavBarDelegate",ionic.DelegateService(["align","showBackButton","showBar","title","changeTitle","setTitle","getTitle","back","getPreviousTitle"])),a.service("$ionicNavViewDelegate",ionic.DelegateService(["clearCache"])),a.constant("IONIC_BACK_PRIORITY",{view:100,sideMenu:150,modal:200,actionSheet:300,popup:400,loading:500}).provider("$ionicPlatform",function(){return{$get:["$q","$ionicScrollDelegate",function(e,t){var n={onHardwareBackButton:function(e){ionic.Platform.ready(function(){document.addEventListener("backbutton",e,!1)})},offHardwareBackButton:function(e){ionic.Platform.ready(function(){document.removeEventListener("backbutton",e)})},$backButtonActions:{},registerBackButtonAction:function(e,t,i){n._hasBackButtonHandler||(n.$backButtonActions={},n.onHardwareBackButton(n.hardwareBackButtonClick),n._hasBackButtonHandler=!0);var o={id:i?i:ionic.Utils.nextUid(),priority:t?t:0,fn:e};return n.$backButtonActions[o.id]=o,function(){delete n.$backButtonActions[o.id]}},hardwareBackButtonClick:function(e){var t,i;for(i in n.$backButtonActions)(!t||n.$backButtonActions[i].priority>=t.priority)&&(t=n.$backButtonActions[i]);return t?(t.fn(e),t):void 0},is:function(e){return ionic.Platform.is(e)},on:function(e,t){return ionic.Platform.ready(function(){document.addEventListener(e,t,!1)}),function(){ionic.Platform.ready(function(){document.removeEventListener(e,t)})}},ready:function(n){var i=e.defer();return ionic.Platform.ready(function(){window.addEventListener("statusTap",function(){t.scrollTop(!0)}),i.resolve(),n&&n()}),i.promise}};return n}]}}),a.factory("$ionicPopover",["$ionicModal","$ionicPosition","$document","$window",function(e,t,n,i){function o(e,n){var o=f(e.target||e),a=t.offset(o),c=n.prop("offsetWidth"),s=n.prop("offsetHeight"),l=i.innerWidth,u=i.innerHeight,d={left:a.left+a.width/2-c/2},h=f(n[0].querySelector(".popover-arrow"));d.left<r?d.left=r:d.left+c+r>l&&(d.left=l-c-r),a.top+a.height+s>u&&a.top-s>0?(d.top=a.top-s,n.addClass("popover-bottom")):(d.top=a.top+a.height,n.removeClass("popover-bottom")),h.css({left:a.left+a.width/2-h.prop("offsetWidth")/2-d.left+"px"}),n.css({top:d.top+"px",left:d.left+"px",marginLeft:"0",opacity:"1"})}var r=6,a={viewType:"popover",hideDelay:1,animation:"none",positionView:o};return{fromTemplate:function(t,n){return e.fromTemplate(t,ionic.Utils.extend({},a,n))},fromTemplateUrl:function(t,n){return e.fromTemplateUrl(t,ionic.Utils.extend({},a,n))}}}]);var v='<div class="popup-container" ng-class="cssClass"><div class="popup"><div class="popup-head"><h3 class="popup-title" ng-bind-html="title"></h3><h5 class="popup-sub-title" ng-bind-html="subTitle" ng-if="subTitle"></h5></div><div class="popup-body"></div><div class="popup-buttons" ng-show="buttons.length"><button ng-repeat="button in buttons" ng-click="$buttonTapped(button, $event)" class="button" ng-class="button.type || \'button-default\'" ng-bind-html="button.text"></button></div></div></div>';a.factory("$ionicPopup",["$ionicTemplateLoader","$ionicBackdrop","$q","$timeout","$rootScope","$ionicBody","$compile","$ionicPlatform","$ionicModal","IONIC_BACK_PRIORITY",function(e,t,n,i,o,r,a,s,l,u){function d(t){t=c({scope:null,title:"",buttons:[]},t||{});var s={};return s.scope=(t.scope||o).$new(),s.element=f(v),s.responseDeferred=n.defer(),r.get().appendChild(s.element[0]),a(s.element)(s.scope),c(s.scope,{title:t.title,buttons:t.buttons,subTitle:t.subTitle,cssClass:t.cssClass,$buttonTapped:function(e,t){var n=(e.onTap||h).apply(s,[t]);t=t.originalEvent||t,t.defaultPrevented||s.responseDeferred.resolve(n)}}),n.when(t.templateUrl?e.load(t.templateUrl):t.template||t.content||"").then(function(e){var t=f(s.element[0].querySelector(".popup-body"));e?(t.html(e),a(t.contents())(s.scope)):t.remove()}),s.show=function(){s.isShown||s.removed||(l.stack.add(s),s.isShown=!0,ionic.requestAnimationFrame(function(){s.isShown&&(s.element.removeClass("popup-hidden"),s.element.addClass("popup-showing active"),m(s.element))}))},s.hide=function(e){return e=e||h,s.isShown?(l.stack.remove(s),s.isShown=!1,s.element.removeClass("active"),s.element.addClass("popup-hidden"),void i(e,250,!1)):e()},s.remove=function(){s.removed||(s.hide(function(){s.element.remove(),s.scope.$destroy()}),s.removed=!0)},s}function p(){var e=S[S.length-1];e&&e.responseDeferred.resolve()}function g(e){function n(){S.push(o),i(o.show,a,!1),o.responseDeferred.promise.then(function(e){var n=S.indexOf(o);return-1!==n&&S.splice(n,1),o.remove(),S.length>0?S[S.length-1].show():(t.release(),i(function(){S.length||r.removeClass("popup-open")},400,!1),(k._backButtonActionDone||h)()),e})}var o=k._createPopup(e),a=0;return S.length>0?(a=y.stackPushDelay,i(S[S.length-1].hide,a,!1)):(r.addClass("popup-open"),t.retain(),k._backButtonActionDone=s.registerBackButtonAction(p,u.popup)),o.responseDeferred.promise.close=function(e){o.removed||o.responseDeferred.resolve(e)},o.responseDeferred.notify({close:o.responseDeferred.close}),n(),o.responseDeferred.promise}function m(e){var t=e[0].querySelector("[autofocus]");t&&t.focus()}function $(e){return g(c({buttons:[{text:e.okText||"OK",type:e.okType||"button-positive",onTap:function(){return!0}}]},e||{}))}function w(e){return g(c({buttons:[{text:e.cancelText||"Cancel",type:e.cancelType||"button-default",onTap:function(){return!1}},{text:e.okText||"OK",type:e.okType||"button-positive",onTap:function(){return!0}}]},e||{}))}function b(e){var t=o.$new(!0);t.data={},t.data.fieldtype=e.inputType?e.inputType:"text",t.data.response=e.defaultText?e.defaultText:"",t.data.placeholder=e.inputPlaceholder?e.inputPlaceholder:"",t.data.maxlength=e.maxLength?parseInt(e.maxLength):"";var n="";return e.template&&/<[a-z][\s\S]*>/i.test(e.template)===!1&&(n="<span>"+e.template+"</span>",delete e.template),g(c({template:n+'<input ng-model="data.response" type="{{ data.fieldtype }}"maxlength="{{ data.maxlength }}"placeholder="{{ data.placeholder }}">',scope:t,buttons:[{text:e.cancelText||"Cancel",type:e.cancelType||"button-default",onTap:function(){}},{text:e.okText||"OK",type:e.okType||"button-positive",onTap:function(){return t.data.response||""}}]},e||{}))}var y={stackPushDelay:75},S=[],k={show:g,alert:$,confirm:w,prompt:b,_createPopup:d,_popupStack:S};return k}]),a.factory("$ionicPosition",["$document","$window",function(e,t){function n(e,n){return e.currentStyle?e.currentStyle[n]:t.getComputedStyle?t.getComputedStyle(e)[n]:e.style[n]}function i(e){return"static"===(n(e,"position")||"static")}var o=function(t){for(var n=e[0],o=t.offsetParent||n;o&&o!==n&&i(o);)o=o.offsetParent;return o||n};return{position:function(t){var n=this.offset(t),i={top:0,left:0},r=o(t[0]);r!=e[0]&&(i=this.offset(f(r)),i.top+=r.clientTop-r.scrollTop,i.left+=r.clientLeft-r.scrollLeft);var a=t[0].getBoundingClientRect();return{width:a.width||t.prop("offsetWidth"),height:a.height||t.prop("offsetHeight"),top:n.top-i.top,left:n.left-i.left}},offset:function(n){var i=n[0].getBoundingClientRect();return{width:i.width||n.prop("offsetWidth"),height:i.height||n.prop("offsetHeight"),top:i.top+(t.pageYOffset||e[0].documentElement.scrollTop),left:i.left+(t.pageXOffset||e[0].documentElement.scrollLeft)}}}}]),a.service("$ionicScrollDelegate",ionic.DelegateService(["resize","scrollTop","scrollBottom","scrollTo","scrollBy","zoomTo","zoomBy","getScrollPosition","anchorScroll","freezeScroll","freezeAllScrolls","getScrollView"])),a.service("$ionicSideMenuDelegate",ionic.DelegateService(["toggleLeft","toggleRight","getOpenRatio","isOpen","isOpenLeft","isOpenRight","canDragContent","edgeDragThreshold"])),a.service("$ionicSlideBoxDelegate",ionic.DelegateService(["update","slide","select","enableSlide","previous","next","stop","autoPlay","start","currentIndex","selected","slidesCount","count","loop"])),a.service("$ionicTabsDelegate",ionic.DelegateService(["select","selectedIndex","showBar"])),function(){var e=[];a.factory("$ionicTemplateCache",["$http","$templateCache","$timeout",function(t,n,i){function o(e){return"undefined"==typeof e?r():(d(e)&&(e=[e]),s(e,function(e){c.push(e)}),void(a&&r()))}function r(){var e;if(o._runCount++,a=!0,0!==c.length){for(var s=0;4>s&&(e=c.pop());)d(e)&&t.get(e,{cache:n}),s++;c.length&&i(r,1e3)}}var a,c=e;return o._runCount=0,o}]).config(["$stateProvider","$ionicConfigProvider",function(t,n){var i=t.state;t.state=function(o,r){if("object"==typeof r){var a=r.prefetchTemplate!==!1&&e.length<n.templates.maxPrefetch();if(a&&d(r.templateUrl)&&e.push(r.templateUrl),angular.isObject(r.views))for(var c in r.views)a=r.views[c].prefetchTemplate!==!1&&e.length<n.templates.maxPrefetch(),a&&d(r.views[c].templateUrl)&&e.push(r.views[c].templateUrl)}return i.call(t,o,r)}}]).run(["$ionicTemplateCache",function(e){e()}])}(),a.factory("$ionicTemplateLoader",["$compile","$controller","$http","$q","$rootScope","$templateCache",function(e,t,n,i,o,r){function a(e){return n.get(e,{cache:r}).then(function(e){return e.data&&e.data.trim()})}function s(n){n=c({template:"",templateUrl:"",scope:null,controller:null,locals:{},appendTo:null},n||{});var r=n.templateUrl?this.load(n.templateUrl):i.when(n.template);return r.then(function(i){var r,a=n.scope||o.$new(),s=f("<div>").html(i).contents();return n.controller&&(r=t(n.controller,c(n.locals,{$scope:a})),s.children().data("$ngControllerController",r)),n.appendTo&&f(n.appendTo).append(s),e(s)(a),{element:s,scope:a}})}return{load:a,compile:s}}]),a.factory("$ionicViewService",["$ionicHistory","$log",function(e,t){function n(e,n){t.warn("$ionicViewService"+e+" is deprecated, please use $ionicHistory"+n+" instead: http://ionicframework.com/docs/nightly/api/service/$ionicHistory/")}n("","");var i={getCurrentView:"currentView",getBackView:"backView",getForwardView:"forwardView",getCurrentStateName:"currentStateName",nextViewOptions:"nextViewOptions",clearHistory:"clearHistory"};return s(i,function(t,o){i[o]=function(){return n("."+o,"."+t),e[t].apply(this,arguments)}}),i}]),a.factory("$ionicViewSwitcher",["$timeout","$document","$q","$ionicClickBlock","$ionicConfig","$ionicNavBarDelegate",function(e,t,n,i,o,r){function a(e,t){return u(e)["abstract"]?u(e).name:t?t.stateId||t.viewId:ionic.Utils.nextUid()}function u(e){return e&&e.$$state&&e.$$state.self||{}}function d(e,t,n,i){var r=u(e),a=w||D(t,"view-transition")||r.viewTransition||o.views.transition()||"ios",s=o.navBar.transition();return n=b||D(t,"view-direction")||r.viewDirection||n||"none",c(h(i),{transition:a,navBarTransition:"view"===s?a:s,direction:n,shouldAnimate:"none"!==a&&"none"!==n})}function h(e){return e=e||{},{viewId:e.viewId,historyId:e.historyId,stateId:e.stateId,stateName:e.stateName,stateParams:e.stateParams}}function p(e,t){return arguments.length>1?void D(e,x,t):D(e,x)}function v(e){if(e&&e.length){var t=e.scope();t&&(t.$emit("$ionicView.unloaded",e.data(B)),t.$destroy()),e.remove()}}function g(e,t){var n=e.lastIndexOf("."),i=t.lastIndexOf(".");if(0>n||0>i)return!1;var o=e.substring(0,n),r=t.substring(0,i);return o===r}function m(e,t){if(!e)return null;var n=angular.element(e).attr("abstract"),i=angular.element(e).attr("state");if("true"!==n)return i===t.stateName?angular.element(e).scope():null;for(var o=$(e),r=0;r<o.length;r++){var a=angular.element(o[r]).attr("state");if(a===t.stateName)return t.abstractView=!0,angular.element(o[r]).scope()}return null}function $(e){for(var t=[],n=angular.element(e).find("ion-nav-view"),i=0;i<n.length;i++){for(var o=angular.element(n[i]).children(),r=[],a=0;a<o.length;a++)r=r.concat(o[a]);t=t.concat(r)}return t}var w,b,y="webkitTransitionEnd transitionend",S="$noCache",k="$destroyEle",C="$eleId",T="$accessed",I="$fallbackTimer",B="$viewData",x="nav-view",A="active",V="cached",E="stage",P=0;ionic.transition=ionic.transition||{},ionic.transition.isActive=!1;var _,D=ionic.DomUtil.cachedAttr,L=[],R=1100,M={create:function(t,s,f,$,x,_){var N,z,O,H=++P,q={init:function(e,t){M.isTransitioning(!0),q.loadViewElements(e),q.render(e,function(){t&&t()})},loadViewElements:function(e){var n,i,o,r=t.getViewElements(),c=a(s,f),u=t.activeEleId();for(n=0,i=r.length;i>n&&(o=r.eq(n),o.data(C)===c?o.data(S)?(o.data(C,c+ionic.Utils.nextUid()),o.data(k,!0)):N=o:l(u)&&o.data(C)===u&&(z=o),!N||!z);n++);O=!!N,O||(N=e.ele||M.createViewEle(s),N.data(C,c)),_&&t.activeEleId(c),e.ele=null},render:function(e,n){if(O)ionic.Utils.reconnectScope(N.scope());else{p(N,E);var i=d(s,N,e.direction,f),r=o.transitions.views[i.transition]||o.transitions.views.none;r(N,null,i.direction,!0).run(0),N.data(B,{viewId:i.viewId,historyId:i.historyId,stateName:i.stateName,stateParams:i.stateParams}),(u(s).cache===!1||"false"===u(s).cache||"false"==N.attr("cache-view")||0===o.views.maxCache())&&N.data(S,!0);var a=t.appendViewElement(N,s);delete i.direction,delete i.transition,a.$emit("$ionicView.loaded",i)}N.data(T,Date.now()),n&&n()},transition:function(a,l,u){function v(){p(N,F.shouldAnimate?"entering":A),p(z,F.shouldAnimate?"leaving":V),F.run(1),r._instances.forEach(function(e){e.triggerTransitionStart(H)}),F.shouldAnimate||m()}function g(e){e.target===this&&m()}function m(){m.x||(m.x=!0,N.off(y,g),e.cancel(N.data(I)),z&&e.cancel(z.data(I)),C&&C.resolve(t),H===P&&(n.all(L).then(M.transitionEnd),q.emit("after",T,B),q.cleanup(T)),r._instances.forEach(function(e){e.triggerTransitionEnd()}),w=b=f=$=N=z=null)}function S(e){e.target===this&&k()}function k(){p(N,V),p(z,A),N.off(y,S),e.cancel(N.data(I)),M.transitionEnd([t])}var C,T=d(s,N,a,f),B=c(c({},T),h($));T.transitionId=B.transitionId=H,T.fromCache=!!O,T.enableBack=!!l,T.renderStart=x,T.renderEnd=_,D(N.parent(),"nav-view-transition",T.transition),D(N.parent(),"nav-view-direction",T.direction),e.cancel(N.data(I));var U=o.transitions.views[T.transition]||o.transitions.views.none,F=U(N,z,T.direction,T.shouldAnimate&&u&&_);if(F.shouldAnimate&&(N.on(y,g),N.data(I,e(m,R)),i.show(R)),x&&(q.emit("before",T,B),p(N,E),F.run(0)),_&&(C=n.defer(),L.push(C.promise)),x&&_)e(function(){ionic.requestAnimationFrame(v)});else{if(!_)return p(N,"entering"),p(z,"leaving"),{run:F.run,cancel:function(t){t?(N.on(y,S),N.data(I,e(k,R)),i.show(R)):k(),F.shouldAnimate=t,F.run(0),F=null}};_&&v()}},emit:function(e,t,n){var i,o=m(N,t),r=m(z,n);!t.viewId||t.abstractView?r&&(r.$emit("$ionicView.beforeLeave",n),r.$emit("$ionicView.leave",n),r.$emit("$ionicView.afterLeave",n),r.$broadcast("$ionicParentView.beforeLeave",n),r.$broadcast("$ionicParentView.leave",n),r.$broadcast("$ionicParentView.afterLeave",n)):("after"==e&&(o&&(o.$emit("$ionicView.enter",t),o.$broadcast("$ionicParentView.enter",t)),r?(r.$emit("$ionicView.leave",n),r.$broadcast("$ionicParentView.leave",n)):o&&n&&n.viewId&&t.stateName!==n.stateName&&(i=g(t.stateName,n.stateName),i&&o.$emit("$ionicNavView.leave",n))),o&&(o.$emit("$ionicView."+e+"Enter",t),o.$broadcast("$ionicParentView."+e+"Enter",t)),r?(r.$emit("$ionicView."+e+"Leave",n),r.$broadcast("$ionicParentView."+e+"Leave",n)):o&&n&&n.viewId&&t.stateName!==n.stateName&&(i=g(t.stateName,n.stateName),i&&o.$emit("$ionicNavView."+e+"Leave",n)))},cleanup:function(e){z&&"back"==e.direction&&!o.views.forwardCache()&&v(z);var n,i,r,a=t.getViewElements(),c=a.length,s=c-1>o.views.maxCache(),l=Date.now();for(n=0;c>n;n++)i=a.eq(n),s&&i.data(T)<l?(l=i.data(T),r=a.eq(n)):i.data(k)&&p(i)!=A&&v(i);v(r),N.data(S)&&N.data(k,!0)},enteringEle:function(){return N},leavingEle:function(){return z}};return q},transitionEnd:function(e){s(e,function(e){e.transitionEnd()}),M.isTransitioning(!1),i.hide(),L=[]},nextTransition:function(e){w=e},nextDirection:function(e){b=e},isTransitioning:function(t){return arguments.length&&(ionic.transition.isActive=!!t,e.cancel(_),t&&(_=e(function(){M.isTransitioning(!1)},999))),ionic.transition.isActive},createViewEle:function(e){var n=t[0].createElement("div");return e&&e.$template&&(n.innerHTML=e.$template,1===n.children.length)?(n.children[0].classList.add("pane"),e.$$state&&e.$$state.self&&e.$$state.self["abstract"]?angular.element(n.children[0]).attr("abstract","true"):e.$$state&&e.$$state.self&&angular.element(n.children[0]).attr("state",e.$$state.self.name),f(n.children[0])):(n.className="pane",f(n))},viewEleIsActive:function(e,t){p(e,t?A:V)},getTransitionData:d,navViewAttr:p,destroyViewEle:v};return M}]),angular.module("ngIOS9UIWebViewPatch",["ng"]).config(["$provide",function(e){"use strict";e.decorator("$browser",["$delegate","$window",function(e,t){function n(e){return/(iPhone|iPad|iPod).* OS 9_\d/.test(e)&&!/Version\/9\./.test(e)}function i(e){function t(){n=null}var n=null,i=e.url;return e.url=function(){return arguments.length?(n=arguments[0],i.apply(e,arguments)):n||i.apply(e,arguments)},window.addEventListener("popstate",t,!1),window.addEventListener("hashchange",t,!1),e}return n(t.navigator.userAgent)?i(e):e}])}]),a.config(["$provide",function(e){e.decorator("$compile",["$delegate",function(e){return e.$$addScopeInfo=function(e,t,n,i){var o=n?i?"$isolateScopeNoTemplate":"$isolateScope":"$scope";e.data(o,t)},e}])}]),a.config(["$provide",function(e){function t(e,t){return e.__hash=e.hash,e.hash=function(n){return l(n)&&n.length>0&&t(function(){var e=document.querySelector(".scroll-content");e&&(e.scrollTop=0)},0,!1),e.__hash(n)},e}e.decorator("$location",["$delegate","$timeout",t])}]),a.controller("$ionicHeaderBar",["$scope","$element","$attrs","$q","$ionicConfig","$ionicHistory",function(e,t,n,i,o,r){function a(e){return C[e]||(C[e]=t[0].querySelector("."+e)),C[e]}var c="title",s="back-text",l="back-button",u="default-title",d="previous-title",f="hide",h=this,p="",v="",g=0,m=0,$="",w=!1,b=!0,y=!0,S=!1,k=0;h.beforeEnter=function(t){e.$broadcast("$ionicView.beforeEnter",t)},h.title=function(e){return arguments.length&&e!==p&&(a(c).innerHTML=e,p=e,k=0),p},h.enableBack=function(e,t){return arguments.length&&(w=e,t||h.updateBackButton()),w},h.showBack=function(e,t){return arguments.length&&(b=e,t||h.updateBackButton()),b},h.showNavBack=function(e){y=e,h.updateBackButton()},h.updateBackButton=function(){var e;(b&&y&&w)!==S&&(S=b&&y&&w,e=a(l),e&&e.classList[S?"remove":"add"](f)),w&&(e=e||a(l),e&&(h.backButtonIcon!==o.backButton.icon()&&(e=a(l+" .icon"),e&&(h.backButtonIcon=o.backButton.icon(),e.className="icon "+h.backButtonIcon)),h.backButtonText!==o.backButton.text()&&(e=a(l+" .back-text"),e&&(e.textContent=h.backButtonText=o.backButton.text()))))},h.titleTextWidth=function(){var e=a(c);if(e)for(var t=angular.element(e).children(),n=0;n<t.length;n++)if(angular.element(t[n]).hasClass("nav-bar-title")){e=t[n];break}var i=ionic.DomUtil.getTextBounds(e);return k=Math.min(i&&i.width||30)},h.titleWidth=function(){var e=h.titleTextWidth(),t=a(c).offsetWidth;return e>t&&(e=t+(g-m-5)),e},h.titleTextX=function(){return t[0].offsetWidth/2-h.titleWidth()/2},h.titleLeftRight=function(){return g-m},h.backButtonTextLeft=function(){for(var e=0,t=a(s);t;)e+=t.offsetLeft,t=t.parentElement;return e},h.resetBackButton=function(e){if(o.backButton.previousTitleText()){var t=a(d);if(t){t.classList.remove(f);var n=e&&r.getViewById(e.viewId),i=r.backTitle(n);i!==v&&(v=t.innerHTML=i)}var c=a(u);c&&c.classList.remove(f)}},h.align=function(e){var i=a(c);e=e||n.alignTitle||o.navBar.alignTitle();var r=h.calcWidths(e,!1);if(b&&v&&o.backButton.previousTitleText()){var s=h.calcWidths(e,!0),l=t[0].offsetWidth-s.titleLeft-s.titleRight;h.titleTextWidth()<=l&&(r=s)}return h.updatePositions(i,r.titleLeft,r.titleRight,r.buttonsLeft,r.buttonsRight,r.css,r.showPrevTitle)},h.calcWidths=function(e,n){var i,o,r,h,p,v,g,m,$,w=a(c),y=a(l),S=t[0].childNodes,k=0,C=0,T=0,I=0,B="",x=0;for(i=0;i<S.length;i++){if(p=S[i],g=0,1==p.nodeType){if(p===w){$=!0;continue}if(p.classList.contains(f))continue;if(b&&p===y){for(o=0;o<p.childNodes.length;o++)if(h=p.childNodes[o],1==h.nodeType)if(h.classList.contains(s))for(r=0;r<h.children.length;r++)if(v=h.children[r],n){if(v.classList.contains(u))continue;x+=v.offsetWidth}else{if(v.classList.contains(d))continue;x+=v.offsetWidth}else x+=h.offsetWidth;else 3==h.nodeType&&h.nodeValue.trim()&&(m=ionic.DomUtil.getTextBounds(h),x+=m&&m.width||0);g=x||p.offsetWidth}else g=p.offsetWidth}else 3==p.nodeType&&p.nodeValue.trim()&&(m=ionic.DomUtil.getTextBounds(p),g=m&&m.width||0);$?C+=g:k+=g}if("left"==e)B="title-left",k&&(T=k+15),C&&(I=C+15);else if("right"==e)B="title-right",k&&(T=k+15),C&&(I=C+15);else{var A=Math.max(k,C)+10;A>10&&(T=I=A)}return{backButtonWidth:x,buttonsLeft:k,buttonsRight:C,titleLeft:T,titleRight:I,showPrevTitle:n,css:B}},h.updatePositions=function(e,n,r,c,s,l,p){var v=i.defer();if(e&&(n!==g&&(e.style.left=n?n+"px":"",g=n),r!==m&&(e.style.right=r?r+"px":"",m=r),l!==$&&(l&&e.classList.add(l),$&&e.classList.remove($),$=l)),o.backButton.previousTitleText()){var w=a(d),b=a(u);w&&w.classList[p?"remove":"add"](f),b&&b.classList[p?"add":"remove"](f)}return ionic.requestAnimationFrame(function(){if(e&&e.offsetWidth+10<e.scrollWidth){var n=s+5,i=t[0].offsetWidth-g-h.titleTextWidth()-20;r=n>i?n:i,r!==m&&(e.style.right=r+"px",m=r)}v.resolve()}),v.promise},h.setCss=function(e,t){ionic.DomUtil.cachedStyles(a(e),t)};var C={};e.$on("$destroy",function(){for(var e in C)C[e]=null})}]),a.controller("$ionInfiniteScroll",["$scope","$attrs","$element","$timeout",function(e,t,n,i){function o(){ionic.requestAnimationFrame(function(){n[0].classList.add("active")}),s.isLoading=!0,e.$parent&&e.$parent.$apply(t.onInfinite||"")}function r(){ionic.requestAnimationFrame(function(){n[0].classList.remove("active")}),i(function(){s.jsScrolling&&s.scrollView.resize(),(s.jsScrolling&&s.scrollView.__container&&s.scrollView.__container.offsetHeight>0||!s.jsScrolling)&&s.checkBounds()},30,!1),s.isLoading=!1}function a(){if(!s.isLoading){var e={};if(s.jsScrolling){e=s.getJSMaxScroll();var t=s.scrollView.getValues();(-1!==e.left&&t.left>=e.left||-1!==e.top&&t.top>=e.top)&&o()}else e=s.getNativeMaxScroll(),(-1!==e.left&&s.scrollEl.scrollLeft>=e.left-s.scrollEl.clientWidth||-1!==e.top&&s.scrollEl.scrollTop>=e.top-s.scrollEl.clientHeight)&&o()}}function c(e){var n=(t.distance||"2.5%").trim(),i=-1!==n.indexOf("%");return i?e*(1-parseFloat(n)/100):e-parseFloat(n)}var s=this;s.isLoading=!1,e.icon=function(){return l(t.icon)?t.icon:"ion-load-d"},e.spinner=function(){return l(t.spinner)?t.spinner:""},e.$on("scroll.infiniteScrollComplete",function(){r()}),e.$on("$destroy",function(){s.scrollCtrl&&s.scrollCtrl.$element&&s.scrollCtrl.$element.off("scroll",s.checkBounds),s.scrollEl&&s.scrollEl.removeEventListener&&s.scrollEl.removeEventListener("scroll",s.checkBounds)}),s.checkBounds=ionic.Utils.throttle(a,300),s.getJSMaxScroll=function(){var e=s.scrollView.getScrollMax();return{left:s.scrollView.options.scrollingX?c(e.left):-1,top:s.scrollView.options.scrollingY?c(e.top):-1}},s.getNativeMaxScroll=function(){var e={left:s.scrollEl.scrollWidth,top:s.scrollEl.scrollHeight},t=window.getComputedStyle(s.scrollEl)||{};return{left:!e.left||"scroll"!==t.overflowX&&"auto"!==t.overflowX&&"scroll"!==s.scrollEl.style["overflow-x"]?-1:c(e.left),top:!e.top||"scroll"!==t.overflowY&&"auto"!==t.overflowY&&"scroll"!==s.scrollEl.style["overflow-y"]?-1:c(e.top)}},s.__finishInfiniteScroll=r}]),a.service("$ionicListDelegate",ionic.DelegateService(["showReorder","showDelete","canSwipeItems","closeOptionButtons"])).controller("$ionicList",["$scope","$attrs","$ionicListDelegate","$ionicHistory",function(e,t,n,i){var o=this,r=!0,a=!1,c=!1,s=n._registerInstance(o,t.delegateHandle,function(){return i.isActiveScope(e)});e.$on("$destroy",s),o.showReorder=function(e){return arguments.length&&(a=!!e),a},o.showDelete=function(e){return arguments.length&&(c=!!e),c},o.canSwipeItems=function(e){return arguments.length&&(r=!!e),r},o.closeOptionButtons=function(){o.listView&&o.listView.clearDragEffects()}}]),a.controller("$ionicNavBar",["$scope","$element","$attrs","$compile","$timeout","$ionicNavBarDelegate","$ionicConfig","$ionicHistory",function(e,t,n,i,o,r,a,c){function u(e,t){var n=console.warn||console.log;n&&n.call(console,"navBarController."+e+" is deprecated, please use "+t+" instead")}function d(e){return x[e]?f(x[e]):void 0}function h(){for(var e=0;e<B.length;e++)if(B[e].isActive)return B[e]}function p(){for(var e=0;e<B.length;e++)if(!B[e].isActive)return B[e]}function v(e,t){e&&ionic.DomUtil.cachedAttr(e.containerEle(),"nav-bar",t)}function g(e){ionic.DomUtil.cachedAttr(t,"nav-swipe",e)}var m,$,w,b="hide",y="$ionNavBarController",S="primaryButtons",k="secondaryButtons",C="backButton",T="primaryButtons secondaryButtons leftButtons rightButtons title".split(" "),I=this,B=[],x={},A=!0;t.parent().data(y,I);var V=n.delegateHandle||"navBar"+ionic.Utils.nextUid(),E=r._registerInstance(I,V);I.init=function(){t.addClass("nav-bar-container"),ionic.DomUtil.cachedAttr(t,"nav-bar-transition",a.views.transition()),I.createHeaderBar(!1),I.createHeaderBar(!0),e.$emit("ionNavBar.init",V)},I.createHeaderBar=function(o){function r(e,t){e&&("title"===t?g.append(e):"rightButtons"==t||t==k&&"left"!=a.navBar.positionSecondaryButtons()||t==S&&"right"==a.navBar.positionPrimaryButtons()?(v||(v=f('<div class="buttons buttons-right">'),h.append(v)),t==k?v.append(e):v.prepend(e)):(p||(p=f('<div class="buttons buttons-left">'),m[C]?m[C].after(p):h.prepend(p)),t==k?p.append(e):p.prepend(e)))}var c=f('<div class="nav-bar-block">');ionic.DomUtil.cachedAttr(c,"nav-bar",o?"active":"cached");var u=n.alignTitle||a.navBar.alignTitle(),h=f("<ion-header-bar>").addClass(n["class"]).attr("align-title",u);l(n.noTapScroll)&&h.attr("no-tap-scroll",n.noTapScroll);var p,v,g=f('<div class="title title-'+u+'">'),m={},$={};m[C]=d(C),m[C]&&h.append(m[C]),h.append(g),s(T,function(e){m[e]=d(e),r(m[e],e)});for(var w=0;w<h[0].children.length;w++)h[0].children[w].classList.add("header-item");c.append(h),t.append(i(c)(e.$new()));var y=h.data("$ionHeaderBarController");y.backButtonIcon=a.backButton.icon(),y.backButtonText=a.backButton.text();var I={isActive:o,title:function(e){y.title(e)},setItem:function(e,t){I.removeItem(t),e?("title"===t&&I.title(""),r(e,t),m[t]&&m[t].addClass(b),$[t]=e):m[t]&&m[t].removeClass(b)},removeItem:function(e){$[e]&&($[e].scope().$destroy(),$[e].remove(),$[e]=null)},containerEle:function(){return c},headerBarEle:function(){return h},afterLeave:function(){
s(T,function(e){I.removeItem(e)}),y.resetBackButton()},controller:function(){return y},destroy:function(){s(T,function(e){I.removeItem(e)}),c.scope().$destroy();for(var e in m)m[e]&&(m[e].removeData(),m[e]=null);p&&p.removeData(),v&&v.removeData(),g.removeData(),h.removeData(),c.remove(),c=h=g=p=v=null}};return B.push(I),I},I.navElement=function(e,t){return l(t)&&(x[e]=t),x[e]},I.update=function(e){var t=!e.hasHeaderBar&&e.showNavBar;e.transition=a.views.transition(),t||(e.direction="none"),I.enable(t);var n=I.isInitialized?p():h(),i=I.isInitialized?h():null,o=n.controller();o.enableBack(e.enableBack,!0),o.showBack(e.showBack,!0),o.updateBackButton(),I.title(e.title,n),I.showBar(t),e.navBarItems&&s(T,function(t){n.setItem(e.navBarItems[t],t)}),I.transition(n,i,e),I.isInitialized=!0,g("")},I.transition=function(n,i,r){function c(){for(var e=0;e<B.length;e++)B[e].isActive=!1;n.isActive=!0,v(n,"active"),v(i,"cached"),I.activeTransition=d=$=null}var s=n.controller(),l=a.transitions.navBar[r.navBarTransition]||a.transitions.navBar.none,u=r.transitionId;s.beforeEnter(r);var d=l(n,i,r.direction,r.shouldAnimate&&I.isInitialized);ionic.DomUtil.cachedAttr(t,"nav-bar-transition",r.navBarTransition),ionic.DomUtil.cachedAttr(t,"nav-bar-direction",r.direction),d.shouldAnimate&&r.renderEnd?v(n,"stage"):(v(n,"entering"),v(i,"leaving")),s.resetBackButton(r),d.run(0),I.activeTransition={run:function(e){d.shouldAnimate=!1,d.direction="back",d.run(e)},cancel:function(t,o,r){g(o),v(i,"active"),v(n,"cached"),d.shouldAnimate=t,d.run(0),I.activeTransition=d=null;var a;r.showBar!==I.showBar()&&I.showBar(r.showBar),r.showBackButton!==I.showBackButton()&&I.showBackButton(r.showBackButton),a&&e.$apply()},complete:function(e,t){g(t),d.shouldAnimate=e,d.run(1),$=c}},o(s.align,16),(m=function(){w===u&&(v(n,"entering"),v(i,"leaving"),d.run(1),$=function(){w!=u&&d.shouldAnimate||c()},m=null)})()},I.triggerTransitionStart=function(e){w=e,m&&m()},I.triggerTransitionEnd=function(){$&&$()},I.showBar=function(t){return arguments.length&&(I.visibleBar(t),e.$parent.$hasHeader=!!t),!!e.$parent.$hasHeader},I.visibleBar=function(e){e&&!A?(t.removeClass(b),I.align()):!e&&A&&t.addClass(b),A=e},I.enable=function(e){I.visibleBar(e);for(var t=0;t<r._instances.length;t++)r._instances[t]!==I&&r._instances[t].visibleBar(!1)},I.showBackButton=function(t){if(arguments.length){for(var n=0;n<B.length;n++)B[n].controller().showNavBack(!!t);e.$isBackButtonShown=!!t}return e.$isBackButtonShown},I.showActiveBackButton=function(e){var t=h();return t?arguments.length?t.controller().showBack(e):t.controller().showBack():void 0},I.title=function(t,n){return l(t)&&(t=t||"",n=n||h(),n&&n.title(t),e.$title=t,c.currentTitle(t)),e.$title},I.align=function(e,t){t=t||h(),t&&t.controller().align(e)},I.hasTabsTop=function(e){t[e?"addClass":"removeClass"]("nav-bar-tabs-top")},I.hasBarSubheader=function(e){t[e?"addClass":"removeClass"]("nav-bar-has-subheader")},I.changeTitle=function(e){u("changeTitle(val)","title(val)"),I.title(e)},I.setTitle=function(e){u("setTitle(val)","title(val)"),I.title(e)},I.getTitle=function(){return u("getTitle()","title()"),I.title()},I.back=function(){u("back()","$ionicHistory.goBack()"),c.goBack()},I.getPreviousTitle=function(){u("getPreviousTitle()","$ionicHistory.backTitle()"),c.goBack()},e.$on("$destroy",function(){e.$parent.$hasHeader=!1,t.parent().removeData(y);for(var n=0;n<B.length;n++)B[n].destroy();t.remove(),t=B=null,E()})}]),a.controller("$ionicNavView",["$scope","$element","$attrs","$compile","$controller","$ionicNavBarDelegate","$ionicNavViewDelegate","$ionicHistory","$ionicViewSwitcher","$ionicConfig","$ionicScrollDelegate","$ionicSideMenuDelegate",function(e,t,n,i,o,r,a,s,l,u,d,f){function h(e,n){for(var i,o,r=t.children(),a=0,c=r.length;c>a;a++)if(i=r.eq(a),V(i)==I){o=i.scope(),o&&o.$emit(e.name.replace("Tabs","View"),n),o&&o.$broadcast(e.name.replace("Tabs","ParentView"),n);break}}function p(e){ionic.DomUtil.cachedAttr(t,"nav-swipe",e)}function v(e,t){var n=m();n&&n.hasTabsTop(t)}function g(e,t){var n=m();n&&n.hasBarSubheader(t)}function m(){if(w)for(var e=0;e<r._instances.length;e++)if(r._instances[e].$$delegateHandle==w)return r._instances[e];return t.inheritedData("$ionNavBarController")}var $,w,b,y,S,k="$eleId",C="$destroyEle",T="$noCache",I="active",B="cached",x=this,A=!1,V=l.navViewAttr;x.scope=e,x.element=t,x.init=function(){var i=n.name||"",o=t.parent().inheritedData("$uiView"),r=o&&o.state?o.state.name:"";i.indexOf("@")<0&&(i=i+"@"+r);var c={name:i,state:null};t.data("$uiView",c);var s=a._registerInstance(x,n.delegateHandle);return e.$on("$destroy",function(){s(),x.isSwipeFreeze&&d.freezeAllScrolls(!1)}),e.$on("$ionicHistory.deselect",x.cacheCleanup),e.$on("$ionicTabs.top",v),e.$on("$ionicSubheader",g),e.$on("$ionicTabs.beforeLeave",h),e.$on("$ionicTabs.afterLeave",h),e.$on("$ionicTabs.leave",h),ionic.Platform.ready(function(){ionic.Platform.isWebView()&&ionic.Platform.isIOS()&&x.initSwipeBack()}),c},x.register=function(t){var n=c({},s.currentView()),i=s.register(e,t);x.update(i);var o=s.getViewById(i.viewId)||{},r=y!==i.viewId;x.render(i,t,o,n,r,!0)},x.update=function(e){A=!0,$=e.direction;var n=t.parent().inheritedData("$ionNavViewController");n&&(n.isPrimary(!1),("enter"===$||"exit"===$)&&(n.direction($),"enter"===$&&($="none")))},x.render=function(e,t,n,i,o,r){var a=l.create(x,t,n,i,o,r);a.init(e,function(){a.transition(x.direction(),e.enableBack,!S),y=S=null})},x.beforeEnter=function(e){if(A){w=e.navBarDelegate;var t=m();t&&t.update(e),p("")}},x.activeEleId=function(e){return arguments.length&&(b=e),b},x.transitionEnd=function(){var e,n,i,o=t.children();for(e=0,n=o.length;n>e;e++)i=o.eq(e),i.data(k)===b?V(i,I):("leaving"===V(i)||V(i)===I||V(i)===B)&&(i.data(C)||i.data(T)?l.destroyViewEle(i):(V(i,B),ionic.Utils.disconnectScope(i.scope())));p(""),x.isSwipeFreeze&&d.freezeAllScrolls(!1)},x.cacheCleanup=function(){for(var e=t.children(),n=0,i=e.length;i>n;n++)e.eq(n).data(C)&&l.destroyViewEle(e.eq(n))},x.clearCache=function(e){var n,i,o,r,a,c,s=t.children();for(o=0,r=s.length;r>o;o++)if(n=s.eq(o),e)for(c=n.data(k),a=0;a<e.length;a++)c===e[a]&&l.destroyViewEle(n);else V(n)==B?l.destroyViewEle(n):V(n)==I&&(i=n.scope(),i&&i.$broadcast("$ionicView.clearCache"))},x.getViewElements=function(){return t.children()},x.appendViewElement=function(n,r){var a=i(n);t.append(n);var c=e.$new();if(r&&r.$$controller){r.$scope=c;var s=o(r.$$controller,r);r.$$controllerAs&&(c[r.$$controllerAs]=s),t.children().data("$ngControllerController",s)}return a(c),c},x.title=function(e){var t=m();t&&t.title(e)},x.enableBackButton=function(e){var t=m();t&&t.enableBackButton(e)},x.showBackButton=function(e){var t=m();return t?arguments.length?t.showActiveBackButton(e):t.showActiveBackButton():!0},x.showBar=function(e){var t=m();return t?arguments.length?t.showBar(e):t.showBar():!0},x.isPrimary=function(e){return arguments.length&&(A=e),A},x.direction=function(e){return arguments.length&&($=e),$},x.initSwipeBack=function(){function n(e){if(A&&u.views.swipeBackEnabled()&&!f.isOpenRight()&&(k=r(e),!(k>T))){v=s.backView();var n=s.currentView();if(v&&v.historyId===n.historyId&&n.canSwipeBack!==!1){b||(b=window.innerWidth),x.isSwipeFreeze=d.freezeAllScrolls(!0);var a={direction:"back"};C=[],I={showBar:x.showBar(),showBackButton:x.showBackButton()};var p=l.create(x,a,v,n,!0,!1);p.loadViewElements(a),p.render(a),c=p.transition("back",s.enabledBack(v),!0),h=m(),$=ionic.onGesture("drag",i,t[0]),w=ionic.onGesture("release",o,t[0])}}}function i(e){if(A&&c){var t=r(e);if(C.push({t:Date.now(),x:t}),t>=b-15)o(e);else{var n=Math.min(Math.max(a(t),0),1);c.run(n),h&&h.activeTransition&&h.activeTransition.run(n)}}}function o(e){if(A&&c&&C&&C.length>1){for(var t=Date.now(),n=r(e),s=C[C.length-1],l=C.length-2;l>=0&&!(t-s.t>200);l--)s=C[l];var u=n>=C[C.length-2].x,f=a(n),g=Math.abs(s.x-n)/(t-s.t);if(y=v.viewId,S=.03>f||f>.97,u&&(f>.5||g>.1)){var m=g>.5||.05>g||n>b-45?"fast":"slow";p(S?"":m),v.go(),h&&h.activeTransition&&h.activeTransition.complete(!S,m)}else p(S?"":"fast"),y=null,c.cancel(!S),h&&h.activeTransition&&h.activeTransition.cancel(!S,"fast",I),S=null}ionic.offGesture($,"drag",i),ionic.offGesture(w,"release",o),b=c=C=null,x.isSwipeFreeze=d.freezeAllScrolls(!1)}function r(e){return ionic.tap.pointerCoord(e.gesture.srcEvent).x}function a(e){return(e-k)/b}var c,h,v,g,$,w,b,k,C,T=u.views.swipeBackHitWidth(),I={};g=ionic.onGesture("dragstart",n,t[0]),e.$on("$destroy",function(){ionic.offGesture(g,"dragstart",n),ionic.offGesture($,"drag",i),ionic.offGesture(w,"release",o),x.element=c=h=null})}}]),a.controller("$ionicRefresher",["$scope","$attrs","$element","$ionicBind","$timeout",function(e,t,n,i,o){function r(e){e.touches=e.touches||[{screenX:e.screenX,screenY:e.screenY}],P=Math.floor(e.touches[0].screenY)}function a(e){e.touches=e.touches||[{screenX:e.screenX,screenY:e.screenY}],P=e.touches[0].screenY}function c(){P=null,(D||T)&&(T?(T=!1,B=0,x>A?($(),p(A,E)):(p(0,E,m),I=!1)):(B=0,I=!1,h(!1)))}function s(e){if(e.touches=e.touches||[{screenX:e.screenX,screenY:e.screenY}],(P||"mousemove"!=e.type)&&D&&!(e.touches.length>1)){if(null===P&&(P=e.touches[0].screenY),_=e.touches[0].screenY-P,ionic.Platform.isAndroid()&&4.4===ionic.Platform.version()&&!ionic.Platform.isCrosswalk()&&0===S.scrollTop&&_>0&&(T=!0,e.preventDefault()),0>=_-B||0!==S.scrollTop)return I&&(I=!1,h(!1)),T&&f(S,_- -1*B),void(0!==x&&d(0));_>0&&0===S.scrollTop&&!I&&(B=_),e.preventDefault(),I||(I=!0,h(!0)),T=!0,d((_-B)/3),!V&&x>A?(V=!0,ionic.requestAnimationFrame(g)):V&&A>x&&(V=!1,ionic.requestAnimationFrame(m))}}function u(e){D=0===e.target.scrollTop||T}function d(e){k.style[ionic.CSS.TRANSFORM]="translate3d(0px, "+e+"px, 0px)",x=e}function f(e,t){e.scrollTop=t;var n=document.createEvent("UIEvents");n.initUIEvent("scroll",!0,!0,window,1),e.dispatchEvent(n)}function h(e){e?ionic.requestAnimationFrame(function(){k.classList.add("overscroll"),w()}):ionic.requestAnimationFrame(function(){k.classList.remove("overscroll"),b(),m()})}function p(e,t,n){function i(e){return--e*e*e+1}function o(){var c=Date.now(),s=Math.min(1,(c-r)/t),l=i(s);d(Math.floor(l*(e-a)+a)),1>s?ionic.requestAnimationFrame(o):(5>e&&e>-5&&(I=!1,h(!1)),n&&n())}var r=Date.now(),a=x;return a===e?void n():void ionic.requestAnimationFrame(o)}function v(){k&&(ionic.off(L,a,k),ionic.off(R,s,k),ionic.off(M,c,k),ionic.off("mousedown",r,k),ionic.off("mousemove",s,k),ionic.off("mouseup",c,k)),S&&ionic.off("scroll",u,S),S=null,k=null}function g(){n[0].classList.add("active"),e.$onPulling()}function m(){o(function(){n.removeClass("active refreshing refreshing-tail"),V&&(V=!1)},150)}function $(){n[0].classList.add("refreshing");var t=e.$onRefresh();t&&t.then&&t["finally"](function(){e.$broadcast("scroll.refreshComplete")})}function w(){n[0].classList.remove("invisible")}function b(){n[0].classList.add("invisible")}function y(){n[0].classList.add("refreshing-tail")}var S,k,C=this,T=!1,I=!1,B=0,x=0,A=60,V=!1,E=500,P=null,_=null,D=!0;l(t.pullingIcon)||t.$set("pullingIcon","ion-android-arrow-down"),e.showSpinner=!l(t.refreshingIcon)&&"none"!=t.spinner,e.showIcon=l(t.refreshingIcon),i(e,t,{pullingIcon:"@",pullingText:"@",refreshingIcon:"@",refreshingText:"@",spinner:"@",disablePullingRotation:"@",$onRefresh:"&onRefresh",$onPulling:"&onPulling"}),e.$on("scroll.refreshComplete",function(){o(function(){ionic.requestAnimationFrame(y),p(0,E,m),o(function(){I&&(I=!1,h(!1))},E)},E)});var L,R,M;window.navigator.pointerEnabled?(L="pointerdown",R="pointermove",M="pointerup"):window.navigator.msPointerEnabled?(L="MSPointerDown",R="MSPointerMove",M="MSPointerUp"):(L="touchstart",R="touchmove",M="touchend"),C.init=function(){if(S=n.parent().parent()[0],k=n.parent()[0],!(S&&S.classList.contains("ionic-scroll")&&k&&k.classList.contains("scroll")))throw new Error("Refresher must be immediate child of ion-content or ion-scroll");ionic.on(L,a,k),ionic.on(R,s,k),ionic.on(M,c,k),ionic.on("mousedown",r,k),ionic.on("mousemove",s,k),ionic.on("mouseup",c,k),ionic.on("scroll",u,S),e.$on("$destroy",v)},C.getRefresherDomMethods=function(){return{activate:g,deactivate:m,start:$,show:w,hide:b,tail:y}},C.__handleTouchmove=s,C.__getScrollChild=function(){return k},C.__getScrollParent=function(){return S}}]),a.controller("$ionicScroll",["$scope","scrollViewOptions","$timeout","$window","$location","$document","$ionicScrollDelegate","$ionicHistory",function(e,t,n,i,o,r,a,c){var s=this;s.__timeout=n,s._scrollViewOptions=t,s.isNative=function(){return!!t.nativeScrolling};var u,d=s.element=t.el,h=s.$element=f(d);u=s.isNative()?s.scrollView=new ionic.views.ScrollNative(t):s.scrollView=new ionic.views.Scroll(t),(h.parent().length?h.parent():h).data("$$ionicScrollController",s);var p=a._registerInstance(s,t.delegateHandle,function(){return c.isActiveScope(e)});l(t.bouncing)||ionic.Platform.ready(function(){u&&u.options&&(u.options.bouncing=!0,ionic.Platform.isAndroid()&&(u.options.bouncing=!1,u.options.deceleration=.95))});var v=angular.bind(u,u.resize);angular.element(i).on("resize",v);var g=function(t){var n=(t.originalEvent||t).detail||{};e.$onScroll&&e.$onScroll({event:t,scrollTop:n.scrollTop||0,scrollLeft:n.scrollLeft||0})};h.on("scroll",g),e.$on("$destroy",function(){p(),u&&u.__cleanup&&u.__cleanup(),angular.element(i).off("resize",v),h&&h.off("scroll",g),s._scrollViewOptions&&(s._scrollViewOptions.el=null),t&&(t.el=null),u=s.scrollView=t=s._scrollViewOptions=d=s.$element=h=null}),n(function(){u&&u.run&&u.run()}),s.getScrollView=function(){return u},s.getScrollPosition=function(){return u.getValues()},s.resize=function(){return n(v,0,!1).then(function(){h&&h.triggerHandler("scroll-resize")})},s.scrollTop=function(e){s.resize().then(function(){u&&u.scrollTo(0,0,!!e)})},s.scrollBottom=function(e){s.resize().then(function(){if(u){var t=u.getScrollMax();u.scrollTo(t.left,t.top,!!e)}})},s.scrollTo=function(e,t,n){s.resize().then(function(){u&&u.scrollTo(e,t,!!n)})},s.zoomTo=function(e,t,n,i){s.resize().then(function(){u&&u.zoomTo(e,!!t,n,i)})},s.zoomBy=function(e,t,n,i){s.resize().then(function(){u&&u.zoomBy(e,!!t,n,i)})},s.scrollBy=function(e,t,n){s.resize().then(function(){u&&u.scrollBy(e,t,!!n)})},s.anchorScroll=function(e){s.resize().then(function(){if(u){var t=o.hash(),n=t&&r[0].getElementById(t);if(!t||!n)return void u.scrollTo(0,0,!!e);var i=n,a=0,c=0;do null!==i&&(a+=i.offsetLeft),null!==i&&(c+=i.offsetTop),i=i.offsetParent;while(i.attributes!=s.element.attributes&&i.offsetParent);u.scrollTo(a,c,!!e)}})},s.freezeScroll=u.freeze,s.freezeScrollShut=u.freezeShut,s.freezeAllScrolls=function(e){for(var t=0;t<a._instances.length;t++)a._instances[t].freezeScroll(e)},s._setRefresher=function(e,t,n){s.refresher=t;var i=s.refresher.clientHeight||60;u.activatePullToRefresh(i,n)}}]),a.controller("$ionicSideMenus",["$scope","$attrs","$ionicSideMenuDelegate","$ionicPlatform","$ionicBody","$ionicHistory","$ionicScrollDelegate","IONIC_BACK_PRIORITY","$rootScope",function(e,t,n,i,o,r,a,c,s){var l,d,f,p,v,g,m,$=this,w=!0;$.$scope=e,$.initialize=function(e){$.left=e.left,$.right=e.right,$.setContent(e.content),$.dragThresholdX=e.dragThresholdX||10,r.registerHistory($.$scope)},$.setContent=function(e){e&&($.content=e,$.content.onDrag=function(e){$._handleDrag(e)},$.content.endDrag=function(e){$._endDrag(e)})},$.isOpenLeft=function(){return $.getOpenAmount()>0},$.isOpenRight=function(){return $.getOpenAmount()<0},$.toggleLeft=function(e){if(!m&&$.left.isEnabled){var t=$.getOpenAmount();0===arguments.length&&(e=0>=t),$.content.enableAnimation(),e?($.openPercentage(100),s.$emit("$ionicSideMenuOpen","left")):($.openPercentage(0),s.$emit("$ionicSideMenuClose","left"))}},$.toggleRight=function(e){if(!m&&$.right.isEnabled){var t=$.getOpenAmount();0===arguments.length&&(e=t>=0),$.content.enableAnimation(),e?($.openPercentage(-100),s.$emit("$ionicSideMenuOpen","right")):($.openPercentage(0),s.$emit("$ionicSideMenuClose","right"))}},$.toggle=function(e){"right"==e?$.toggleRight():$.toggleLeft()},$.close=function(){$.openPercentage(0),s.$emit("$ionicSideMenuClose","left"),s.$emit("$ionicSideMenuClose","right")},$.getOpenAmount=function(){return $.content&&$.content.getTranslateX()||0},$.getOpenRatio=function(){var e=$.getOpenAmount();return e>=0?e/$.left.width:e/$.right.width},$.isOpen=function(){return 0!==$.getOpenAmount()},$.getOpenPercentage=function(){return 100*$.getOpenRatio()},$.openPercentage=function(e){var t=e/100;$.left&&e>=0?$.openAmount($.left.width*t):$.right&&0>e&&$.openAmount($.right.width*t),o.enableClass(0!==e,"menu-open"),$.content.setCanScroll(0==e)},$.openAmount=function(e){var t=$.left&&$.left.width||0,n=$.right&&$.right.width||0;return($.left&&$.left.isEnabled||!(e>0))&&($.right&&$.right.isEnabled||!(0>e))?d&&e>t?void $.content.setTranslateX(t):l&&-n>e?void $.content.setTranslateX(-n):($.content.setTranslateX(e),void(e>=0?(d=!0,l=!1,e>0&&($.right&&$.right.pushDown&&$.right.pushDown(),$.left&&$.left.bringUp&&$.left.bringUp())):(l=!0,d=!1,$.right&&$.right.bringUp&&$.right.bringUp(),$.left&&$.left.pushDown&&$.left.pushDown()))):void $.content.setTranslateX(0)},$.snapToRest=function(e){$.content.enableAnimation(),f=!1;var t=$.getOpenRatio();if(0===t)return void $.openPercentage(0);var n=.3,i=e.gesture.velocityX,o=e.gesture.direction;t>0&&.5>t&&"right"==o&&n>i?$.openPercentage(0):t>.5&&"left"==o&&n>i?$.openPercentage(100):0>t&&t>-.5&&"left"==o&&n>i?$.openPercentage(0):.5>t&&"right"==o&&n>i?$.openPercentage(-100):"right"==o&&t>=0&&(t>=.5||i>n)?$.openPercentage(100):"left"==o&&0>=t&&(-.5>=t||i>n)?$.openPercentage(-100):$.openPercentage(0)},$.enableMenuWithBackViews=function(e){return arguments.length&&(w=!!e),w},$.isAsideExposed=function(){return!!m},$.exposeAside=function(e){($.left&&$.left.isEnabled||$.right&&$.right.isEnabled)&&($.close(),m=e,$.left&&$.left.isEnabled&&$.right&&$.right.isEnabled?$.content.setMarginLeftAndRight(m?$.left.width:0,m?$.right.width:0):$.left&&$.left.isEnabled?$.content.setMarginLeft(m?$.left.width:0):$.right&&$.right.isEnabled&&$.content.setMarginRight(m?$.right.width:0),$.$scope.$emit("$ionicExposeAside",m))},$.activeAsideResizing=function(e){o.enableClass(e,"aside-resizing")},$._endDrag=function(e){m||(f&&$.snapToRest(e),p=null,v=null,g=null)},$._handleDrag=function(t){!m&&e.dragContent&&(p?v=t.gesture.touches[0].pageX:(p=t.gesture.touches[0].pageX,v=p),!f&&Math.abs(v-p)>$.dragThresholdX&&(p=v,f=!0,$.content.disableAnimation(),g=$.getOpenAmount()),f&&$.openAmount(g+(v-p)))},$.canDragContent=function(t){return arguments.length&&(e.dragContent=!!t),e.dragContent},$.edgeThreshold=25,$.edgeThresholdEnabled=!1,$.edgeDragThreshold=function(e){return arguments.length&&(u(e)&&e>0?($.edgeThreshold=e,$.edgeThresholdEnabled=!0):$.edgeThresholdEnabled=!!e),$.edgeThresholdEnabled},$.isDraggableTarget=function(t){var n=$.edgeThresholdEnabled&&!$.isOpen(),i=t.gesture.startEvent&&t.gesture.startEvent.center&&t.gesture.startEvent.center.pageX,o=!n||i<=$.edgeThreshold||i>=$.content.element.offsetWidth-$.edgeThreshold,a=r.backView(),c=w?!0:!a;if(!c){var s=r.currentView()||{};return o&&a.historyId!==s.historyId}return(e.dragContent||$.isOpen())&&o&&!t.gesture.srcEvent.defaultPrevented&&c&&!t.target.tagName.match(/input|textarea|select|object|embed/i)&&!t.target.isContentEditable&&!(t.target.dataset?t.target.dataset.preventScroll:"true"==t.target.getAttribute("data-prevent-scroll"))},e.sideMenuContentTranslateX=0;var b=h,y=angular.bind($,$.close);e.$watch(function(){return 0!==$.getOpenAmount()},function(e){b(),e&&(b=i.registerBackButtonAction(y,c.sideMenu))});var S=n._registerInstance($,t.delegateHandle,function(){return r.isActiveScope(e)});e.$on("$destroy",function(){S(),b(),$.$scope=null,$.content&&($.content.setCanScroll(!0),$.content.element=null,$.content=null)}),$.initialize({left:{width:275},right:{width:275}})}]),function(e){function t(e,i,o,r){var a,c,s,l=document.createElement(f[e]||e);for(a in i)if(angular.isArray(i[a]))for(c=0;c<i[a].length;c++)if(i[a][c].fn)for(s=0;s<i[a][c].t;s++)t(a,i[a][c].fn(s,r),l,r);else t(a,i[a][c],l,r);else n(l,a,i[a]);o.appendChild(l)}function n(e,t,n){e.setAttribute(f[t]||t,n)}function i(e,t){var n=e.split(";"),i=n.slice(t),o=n.slice(0,n.length-i.length);return n=i.concat(o).reverse(),n.join(";")+";"+n[0]}function o(e,t){return e/=t/2,1>e?.5*e*e*e:(e-=2,.5*(e*e*e+2))}var r="translate(32,32)",c="stroke-opacity",s="round",l="indefinite",u="750ms",d="none",f={a:"animate",an:"attributeName",at:"animateTransform",c:"circle",da:"stroke-dasharray",os:"stroke-dashoffset",f:"fill",lc:"stroke-linecap",rc:"repeatCount",sw:"stroke-width",t:"transform",v:"values"},h={v:"0,32,32;360,32,32",an:"transform",type:"rotate",rc:l,dur:u},p={sw:4,lc:s,line:[{fn:function(e,t){return{y1:"ios"==t?17:12,y2:"ios"==t?29:20,t:r+" rotate("+(30*e+(6>e?180:-180))+")",a:[{fn:function(){return{an:c,dur:u,v:i("0;.1;.15;.25;.35;.45;.55;.65;.7;.85;1",e),rc:l}},t:1}]}},t:12}]},v={android:{c:[{sw:6,da:128,os:82,r:26,cx:32,cy:32,f:d}]},ios:p,"ios-small":p,bubbles:{sw:0,c:[{fn:function(e){return{cx:24*Math.cos(2*Math.PI*e/8),cy:24*Math.sin(2*Math.PI*e/8),t:r,a:[{fn:function(){return{an:"r",dur:u,v:i("1;2;3;4;5;6;7;8",e),rc:l}},t:1}]}},t:8}]},circles:{c:[{fn:function(e){return{r:5,cx:24*Math.cos(2*Math.PI*e/8),cy:24*Math.sin(2*Math.PI*e/8),t:r,sw:0,a:[{fn:function(){return{an:"fill-opacity",dur:u,v:i(".3;.3;.3;.4;.7;.85;.9;1",e),rc:l}},t:1}]}},t:8}]},crescent:{c:[{sw:4,da:128,os:82,r:26,cx:32,cy:32,f:d,at:[h]}]},dots:{c:[{fn:function(e){return{cx:16+16*e,cy:32,sw:0,a:[{fn:function(){return{an:"fill-opacity",dur:u,v:i(".5;.6;.8;1;.8;.6;.5",e),rc:l}},t:1},{fn:function(){return{an:"r",dur:u,v:i("4;5;6;5;4;3;3",e),rc:l}},t:1}]}},t:3}]},lines:{sw:7,lc:s,line:[{fn:function(e){return{x1:10+14*e,x2:10+14*e,a:[{fn:function(){return{an:"y1",dur:u,v:i("16;18;28;18;16",e),rc:l}},t:1},{fn:function(){return{an:"y2",dur:u,v:i("48;44;36;46;48",e),rc:l}},t:1},{fn:function(){return{an:c,dur:u,v:i("1;.8;.5;.4;1",e),rc:l}},t:1}]}},t:4}]},ripple:{f:d,"fill-rule":"evenodd",sw:3,circle:[{fn:function(e){return{cx:32,cy:32,a:[{fn:function(){return{an:"r",begin:-1*e+"s",dur:"2s",v:"0;24",keyTimes:"0;1",keySplines:"0.1,0.2,0.3,1",calcMode:"spline",rc:l}},t:1},{fn:function(){return{an:c,begin:-1*e+"s",dur:"2s",v:".2;1;.2;0",rc:l}},t:1}]}},t:2}]},spiral:{defs:[{linearGradient:[{id:"sGD",gradientUnits:"userSpaceOnUse",x1:55,y1:46,x2:2,y2:46,stop:[{offset:.1,"class":"stop1"},{offset:1,"class":"stop2"}]}]}],g:[{sw:4,lc:s,f:d,path:[{stroke:"url(#sGD)",d:"M4,32 c0,15,12,28,28,28c8,0,16-4,21-9"},{d:"M60,32 C60,16,47.464,4,32,4S4,16,4,32"}],at:[h]}]}},g={android:function(t){function i(){if(!r.stop){var t=o(Date.now()-a,650),d=1,f=0,h=188-58*t,p=182-182*t;c%2&&(d=-1,f=-64,h=128- -58*t,p=182*t);var v=[0,-101,-90,-11,-180,79,-270,-191][c];n(u,"da",Math.max(Math.min(h,188),128)),n(u,"os",Math.max(Math.min(p,182),0)),n(u,"t","scale("+d+",1) translate("+f+",0) rotate("+v+",32,32)"),s+=4.1,s>359&&(s=0),n(l,"t","rotate("+s+",32,32)"),t>=1&&(c++,c>7&&(c=0),a=Date.now()),e.requestAnimationFrame(i)}}var r={};this.stop=!1;var a,c=0,s=0,l=t.querySelector("g"),u=t.querySelector("circle");return function(){return a=Date.now(),i(),r}}};a.controller("$ionicSpinner",["$element","$attrs","$ionicConfig",function(e,n,i){var o,r;this.init=function(){o=n.icon||i.spinner.icon();var r=document.createElement("div");return t("svg",{viewBox:"0 0 64 64",g:[v[o]]},r,o),e.html(r.innerHTML),this.start(),o},this.start=function(){g[o]&&(r=g[o](e[0])())},this.stop=function(){g[o]&&(r.stop=!0)}}])}(ionic),a.controller("$ionicTab",["$scope","$ionicHistory","$attrs","$location","$state",function(e,t,n,i,o){this.$scope=e,this.hrefMatchesState=function(){return n.href&&0===i.path().indexOf(n.href.replace(/^#/,"").replace(/\/$/,""))},this.srefMatchesState=function(){return n.uiSref&&o.includes(n.uiSref.split("(")[0])},this.navNameMatchesState=function(){return this.navViewName&&t.isCurrentStateNavView(this.navViewName)},this.tabMatchesState=function(){return this.hrefMatchesState()||this.srefMatchesState()||this.navNameMatchesState()}}]),a.controller("$ionicTabs",["$scope","$element","$ionicHistory",function(e,t,n){var i,o=this,r=null,a=null,c=!0;o.tabs=[],o.selectedIndex=function(){return o.tabs.indexOf(r)},o.selectedTab=function(){return r},o.previousSelectedTab=function(){return a},o.add=function(e){n.registerHistory(e),o.tabs.push(e)},o.remove=function(e){var t=o.tabs.indexOf(e);if(-1!==t){if(e.$tabSelected)if(o.deselect(e),1===o.tabs.length);else{var n=t===o.tabs.length-1?t-1:t+1;o.select(o.tabs[n])}o.tabs.splice(t,1)}},o.deselect=function(e){e.$tabSelected&&(a=r,r=i=null,e.$tabSelected=!1,(e.onDeselect||h)(),e.$broadcast&&e.$broadcast("$ionicHistory.deselect"))},o.select=function(t,a){var c;if(u(t)){if(c=t,c>=o.tabs.length)return;t=o.tabs[c]}else c=o.tabs.indexOf(t);1===arguments.length&&(a=!(!t.navViewName&&!t.uiSref)),r&&r.$historyId==t.$historyId?a&&n.goToHistoryRoot(t.$historyId):i!==c&&(s(o.tabs,function(e){o.deselect(e)}),r=t,i=c,o.$scope&&o.$scope.$parent&&(o.$scope.$parent.$activeHistoryId=t.$historyId),t.$tabSelected=!0,(t.onSelect||h)(),a&&e.$emit("$ionicHistory.change",{type:"tab",tabIndex:c,historyId:t.$historyId,navViewName:t.navViewName,hasNavView:!!t.navViewName,title:t.title,url:t.href,uiSref:t.uiSref}),e.$broadcast("tabSelected",{selectedTab:t,selectedTabIndex:c}))},o.hasActiveScope=function(){for(var e=0;e<o.tabs.length;e++)if(n.isActiveScope(o.tabs[e]))return!0;return!1},o.showBar=function(e){return arguments.length&&(e?t.removeClass("tabs-item-hide"):t.addClass("tabs-item-hide"),c=!!e),c}}]),a.controller("$ionicView",["$scope","$element","$attrs","$compile","$rootScope",function(e,t,n,i,o){function r(){var t=l(n.viewTitle)&&"viewTitle"||l(n.title)&&"title";t&&(a(n[t]),$.push(n.$observe(t,a))),l(n.hideBackButton)&&$.push(e.$watch(n.hideBackButton,function(e){f.showBackButton(!e)})),l(n.hideNavBar)&&$.push(e.$watch(n.hideNavBar,function(e){f.showBar(!e)}))}function a(e){l(e)&&e!==v&&(v=e,f.title(v))}function s(){for(var e=0;e<$.length;e++)$[e]();$=[]}function u(t){return t?i(t)(e.$new()):void 0}function d(t){return!!e.$eval(n[t])}var f,h,p,v,g=this,m={},$=[],w=e.$on("ionNavBar.init",function(e,t){e.stopPropagation(),h=t});g.init=function(){w();var n=t.inheritedData("$ionModalController");f=t.inheritedData("$ionNavViewController"),f&&!n&&(e.$on("$ionicView.beforeEnter",g.beforeEnter),e.$on("$ionicView.afterEnter",r),e.$on("$ionicView.beforeLeave",s))},g.beforeEnter=function(t,i){if(i&&!i.viewNotified){i.viewNotified=!0,o.$$phase||e.$digest(),v=l(n.viewTitle)?n.viewTitle:n.title;var r={};for(var a in m)r[a]=u(m[a]);f.beforeEnter(c(i,{title:v,showBack:!d("hideBackButton"),navBarItems:r,navBarDelegate:h||null,showNavBar:!d("hideNavBar"),hasHeaderBar:!!p})),s()}},g.navElement=function(e,t){m[e]=t}}]),a.directive("ionActionSheet",["$document",function(e){return{restrict:"E",scope:!0,replace:!0,link:function(t,n){var i=function(e){27==e.which&&(t.cancel(),t.$apply())},o=function(e){e.target==n[0]&&(t.cancel(),t.$apply())};t.$on("$destroy",function(){n.remove(),e.unbind("keyup",i)}),e.bind("keyup",i),n.bind("click",o)},template:'<div class="action-sheet-backdrop"><div class="action-sheet-wrapper"><div class="action-sheet" ng-class="{\'action-sheet-has-icons\': $actionSheetHasIcon}"><div class="action-sheet-group action-sheet-options"><div class="action-sheet-title" ng-if="titleText" ng-bind-html="titleText"></div><button class="button action-sheet-option" ng-click="buttonClicked($index)" ng-class="b.className" ng-repeat="b in buttons" ng-bind-html="b.text"></button><button class="button destructive action-sheet-destructive" ng-if="destructiveText" ng-click="destructiveButtonClicked()" ng-bind-html="destructiveText"></button></div><div class="action-sheet-group action-sheet-cancel" ng-if="cancelText"><button class="button" ng-click="cancel()" ng-bind-html="cancelText"></button></div></div></div></div>'}}]),a.directive("ionCheckbox",["$ionicConfig",function(e){return{restrict:"E",replace:!0,require:"?ngModel",transclude:!0,template:'<label class="item item-checkbox"><div class="checkbox checkbox-input-hidden disable-pointer-events"><input type="checkbox"><i class="checkbox-icon"></i></div><div class="item-content disable-pointer-events" ng-transclude></div></label>',compile:function(t,n){var i=t.find("input");s({name:n.name,"ng-value":n.ngValue,"ng-model":n.ngModel,"ng-checked":n.ngChecked,"ng-disabled":n.ngDisabled,"ng-true-value":n.ngTrueValue,"ng-false-value":n.ngFalseValue,"ng-change":n.ngChange,"ng-required":n.ngRequired,required:n.required},function(e,t){l(e)&&i.attr(t,e)});var o=t[0].querySelector(".checkbox");o.classList.add("checkbox-"+e.form.checkbox())}}}]),a.directive("collectionRepeat",e).factory("$ionicCollectionManager",t);var g="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",m=/height:.*?px;\s*width:.*?px/,$=3;e.$inject=["$ionicCollectionManager","$parse","$window","$$rAF","$rootScope","$timeout"],t.$inject=["$rootScope","$window","$$rAF"],a.directive("ionContent",["$timeout","$controller","$ionicBind","$ionicConfig",function(e,t,n,i){return{restrict:"E",require:"^?ionNavView",scope:!0,priority:800,compile:function(e,o){function r(e,i,r){function u(){e.$onScrollComplete({scrollTop:c.scrollView.__scrollTop,scrollLeft:c.scrollView.__scrollLeft})}var d=e.$parent;if(e.$watch(function(){return(d.$hasHeader?" has-header":"")+(d.$hasSubheader?" has-subheader":"")+(d.$hasFooter?" has-footer":"")+(d.$hasSubfooter?" has-subfooter":"")+(d.$hasTabs?" has-tabs":"")+(d.$hasTabsTop?" has-tabs-top":"")},function(e,t){i.removeClass(t),i.addClass(e)}),e.$hasHeader=e.$hasSubheader=e.$hasFooter=e.$hasSubfooter=e.$hasTabs=e.$hasTabsTop=!1,n(e,r,{$onScroll:"&onScroll",$onScrollComplete:"&onScrollComplete",hasBouncing:"@",padding:"@",direction:"@",scrollbarX:"@",scrollbarY:"@",startX:"@",startY:"@",scrollEventInterval:"@"}),e.direction=e.direction||"y",l(r.padding)&&e.$watch(r.padding,function(e){(a||i).toggleClass("padding",!!e)}),"false"===r.scroll);else{var f={};s?(i.addClass("overflow-scroll"),f={el:i[0],delegateHandle:o.delegateHandle,startX:e.$eval(e.startX)||0,startY:e.$eval(e.startY)||0,nativeScrolling:!0}):f={el:i[0],delegateHandle:o.delegateHandle,locking:"true"===(o.locking||"true"),bouncing:e.$eval(e.hasBouncing),startX:e.$eval(e.startX)||0,startY:e.$eval(e.startY)||0,scrollbarX:e.$eval(e.scrollbarX)!==!1,scrollbarY:e.$eval(e.scrollbarY)!==!1,scrollingX:e.direction.indexOf("x")>=0,scrollingY:e.direction.indexOf("y")>=0,scrollEventInterval:parseInt(e.scrollEventInterval,10)||10,scrollingComplete:u},c=t("$ionicScroll",{$scope:e,scrollViewOptions:f}),e.scrollCtrl=c,e.$on("$destroy",function(){f&&(f.scrollingComplete=h,delete f.el),a=null,i=null,o.$$element=null})}}var a,c;e.addClass("scroll-content ionic-scroll"),"false"!=o.scroll?(a=f('<div class="scroll"></div>'),a.append(e.contents()),e.append(a)):e.addClass("scroll-content-false");var s="false"!==o.overflowScroll&&("true"===o.overflowScroll||!i.scrolling.jsScrolling());return s&&(s=!e[0].querySelector("[collection-repeat]")),{pre:r}}}}]),a.directive("exposeAsideWhen",["$window",function(e){return{restrict:"A",require:"^ionSideMenus",link:function(t,n,i,o){function r(){var t="large"==i.exposeAsideWhen?"(min-width:768px)":i.exposeAsideWhen;o.exposeAside(e.matchMedia(t).matches),o.activeAsideResizing(!1)}function a(){o.activeAsideResizing(!0),l()}var c=e.innerWidth,s=e.innerHeight;ionic.on("resize",function(){(c!==e.innerWidth||s!==e.innerHeight)&&(c=e.innerWidth,s=e.innerHeight,a())},e);var l=ionic.debounce(function(){t.$apply(r)},300,!1);t.$evalAsync(r)}}}]);var w="onHold onTap onDoubleTap onTouch onRelease onDragStart onDrag onDragEnd onDragUp onDragRight onDragDown onDragLeft onSwipe onSwipeUp onSwipeRight onSwipeDown onSwipeLeft".split(" ");w.forEach(function(e){a.directive(e,n(e))}),a.directive("ionHeaderBar",i(!0)).directive("ionFooterBar",i(!1)),a.directive("ionInfiniteScroll",["$timeout",function(e){return{restrict:"E",require:["?^$ionicScroll","ionInfiniteScroll"],
template:function(e,t){return t.icon?'<i class="icon {{icon()}} icon-refreshing {{scrollingType}}"></i>':'<ion-spinner icon="{{spinner()}}"></ion-spinner>'},scope:!0,controller:"$ionInfiniteScroll",link:function(t,n,i,o){var r=o[1],a=r.scrollCtrl=o[0],c=r.jsScrolling=!a.isNative();if(c)r.scrollView=a.scrollView,t.scrollingType="js-scrolling",a.$element.on("scroll",r.checkBounds);else{var s=ionic.DomUtil.getParentOrSelfWithClass(n[0].parentNode,"overflow-scroll");if(r.scrollEl=s,!s)throw"Infinite scroll must be used inside a scrollable div";r.scrollEl.addEventListener("scroll",r.checkBounds)}var u=l(i.immediateCheck)?t.$eval(i.immediateCheck):!0;u&&e(function(){r.checkBounds()})}}}]);var b=-1;a.directive("ionInput",[function(){return{restrict:"E",controller:["$scope","$element",function(e,t){this.$scope=e,this.$element=t,this.setInputAriaLabeledBy=function(e){var n=t[0].querySelectorAll("input,textarea");n.length&&n[0].setAttribute("aria-labelledby",e)},this.focus=function(){var e=t[0].querySelectorAll("input,textarea");e.length&&e[0].focus()}}]}}]),a.directive("ionLabel",[function(){return{restrict:"E",require:"?^ionInput",compile:function(){return function(e,t,n,i){var o=t[0];t.addClass("input-label"),t.attr("aria-label",t.text());var r=o.id||"_label-"+ ++b;o.id||t.attr("id",r),i&&(i.setInputAriaLabeledBy(r),t.on("click",function(){i.focus()}))}}}}]),a.directive("inputLabel",[function(){return{restrict:"C",require:"?^ionInput",compile:function(){return function(e,t,n,i){var o=t[0];t.attr("aria-label",t.text());var r=o.id||"_label-"+ ++b;o.id||t.attr("id",r),i&&i.setInputAriaLabeledBy(r)}}}}]),a.directive("ionItem",["$$rAF",function(e){return{restrict:"E",controller:["$scope","$element",function(e,t){this.$scope=e,this.$element=t}],scope:!0,compile:function(t,n){var i=l(n.href)||l(n.ngHref)||l(n.uiSref),o=i||/ion-(delete|option|reorder)-button/i.test(t.html());if(o){var r=f(i?"<a></a>":"<div></div>");r.addClass("item-content"),(l(n.href)||l(n.ngHref))&&(r.attr("ng-href","{{$href()}}"),l(n.target)&&r.attr("target","{{$target()}}")),r.append(t.contents()),t.addClass("item item-complex").append(r)}else t.addClass("item");return function(t,n,i){t.$href=function(){return i.href||i.ngHref},t.$target=function(){return i.target};var o=n[0].querySelector(".item-content");o&&t.$on("$collectionRepeatLeave",function(){o&&o.$$ionicOptionsOpen&&(o.style[ionic.CSS.TRANSFORM]="",o.style[ionic.CSS.TRANSITION]="none",e(function(){o.style[ionic.CSS.TRANSITION]=""}),o.$$ionicOptionsOpen=!1)})}}}}]);var y='<div class="item-left-edit item-delete enable-pointer-events"></div>';a.directive("ionDeleteButton",function(){function e(e){e.stopPropagation()}return{restrict:"E",require:["^^ionItem","^?ionList"],priority:Number.MAX_VALUE,compile:function(t,n){return n.$set("class",(n["class"]||"")+" button icon button-icon",!0),function(t,n,i,o){function r(){c=c||n.controller("ionList"),c&&c.showDelete()&&s.addClass("visible active")}var a=o[0],c=o[1],s=f(y);s.append(n),a.$element.append(s).addClass("item-left-editable"),n.on("click",e),r(),t.$on("$ionic.reconnectScope",r)}}}}),a.directive("itemFloatingLabel",function(){return{restrict:"C",link:function(e,t){var n=t[0],i=n.querySelector("input, textarea"),o=n.querySelector(".input-label");if(i&&o){var r=function(){i.value?o.classList.add("has-input"):o.classList.remove("has-input")};i.addEventListener("input",r);var a=f(i).controller("ngModel");a&&(a.$render=function(){i.value=a.$viewValue||"",r()}),e.$on("$destroy",function(){i.removeEventListener("input",r)})}}}});var S='<div class="item-options invisible"></div>';a.directive("ionOptionButton",[function(){function e(e){e.stopPropagation()}return{restrict:"E",require:"^ionItem",priority:Number.MAX_VALUE,compile:function(t,n){return n.$set("class",(n["class"]||"")+" button",!0),function(t,n,i,o){o.optionsContainer||(o.optionsContainer=f(S),o.$element.append(o.optionsContainer)),o.optionsContainer.append(n),o.$element.addClass("item-right-editable"),n.on("click",e)}}}}]);var k='<div data-prevent-scroll="true" class="item-right-edit item-reorder enable-pointer-events"></div>';a.directive("ionReorderButton",["$parse",function(e){return{restrict:"E",require:["^ionItem","^?ionList"],priority:Number.MAX_VALUE,compile:function(t,n){return n.$set("class",(n["class"]||"")+" button icon button-icon",!0),t[0].setAttribute("data-prevent-scroll",!0),function(t,n,i,o){var r=o[0],a=o[1],c=e(i.onReorder);t.$onReorder=function(e,n){c(t,{$fromIndex:e,$toIndex:n})},i.ngClick||i.onClick||i.onclick||(n[0].onclick=function(e){return e.stopPropagation(),!1});var s=f(k);s.append(n),r.$element.append(s).addClass("item-right-editable"),a&&a.showReorder()&&s.addClass("visible active")}}}}]),a.directive("keyboardAttach",function(){return function(e,t){function n(e){if(!ionic.Platform.isAndroid()||ionic.Platform.isFullScreen){var n=e.keyboardHeight||e.detail&&e.detail.keyboardHeight;t.css("bottom",n+"px"),r=t.controller("$ionicScroll"),r&&(r.scrollView.__container.style.bottom=n+o(t[0])+"px")}}function i(){(!ionic.Platform.isAndroid()||ionic.Platform.isFullScreen)&&(t.css("bottom",""),r&&(r.scrollView.__container.style.bottom=""))}ionic.on("native.keyboardshow",n,window),ionic.on("native.keyboardhide",i,window),ionic.on("native.showkeyboard",n,window),ionic.on("native.hidekeyboard",i,window);var r;e.$on("$destroy",function(){ionic.off("native.keyboardshow",n,window),ionic.off("native.keyboardhide",i,window),ionic.off("native.showkeyboard",n,window),ionic.off("native.hidekeyboard",i,window)})}}),a.directive("ionList",["$timeout",function(e){return{restrict:"E",require:["ionList","^?$ionicScroll"],controller:"$ionicList",compile:function(t,n){var i=f('<div class="list">').append(t.contents()).addClass(n.type);return t.append(i),function(t,i,o,r){function a(){function o(e,t){t()&&e.addClass("visible")||e.removeClass("active"),ionic.requestAnimationFrame(function(){t()&&e.addClass("active")||e.removeClass("visible")})}var r=c.listView=new ionic.views.ListView({el:i[0],listEl:i.children()[0],scrollEl:s&&s.element,scrollView:s&&s.scrollView,onReorder:function(t,n,i){var o=f(t).scope();o&&o.$onReorder&&e(function(){o.$onReorder(n,i)})},canSwipe:function(){return c.canSwipeItems()}});t.$on("$destroy",function(){r&&(r.deregister&&r.deregister(),r=null)}),l(n.canSwipe)&&t.$watch("!!("+n.canSwipe+")",function(e){c.canSwipeItems(e)}),l(n.showDelete)&&t.$watch("!!("+n.showDelete+")",function(e){c.showDelete(e)}),l(n.showReorder)&&t.$watch("!!("+n.showReorder+")",function(e){c.showReorder(e)}),t.$watch(function(){return c.showDelete()},function(e,t){if(e||t){e&&c.closeOptionButtons(),c.canSwipeItems(!e),i.children().toggleClass("list-left-editing",e),i.toggleClass("disable-pointer-events",e);var n=f(i[0].getElementsByClassName("item-delete"));o(n,c.showDelete)}}),t.$watch(function(){return c.showReorder()},function(e,t){if(e||t){e&&c.closeOptionButtons(),c.canSwipeItems(!e),i.children().toggleClass("list-right-editing",e),i.toggleClass("disable-pointer-events",e);var n=f(i[0].getElementsByClassName("item-reorder"));o(n,c.showReorder)}})}var c=r[0],s=r[1];e(a)}}}}]),a.directive("menuClose",["$ionicHistory","$timeout",function(e,t){return{restrict:"AC",link:function(n,i){i.bind("click",function(){var n=i.inheritedData("$ionSideMenusController");n&&(e.nextViewOptions({historyRoot:!0,disableAnimate:!0,expire:300}),t(function(){e.nextViewOptions({historyRoot:!1,disableAnimate:!1})},300),n.close())})}}}]),a.directive("menuToggle",function(){return{restrict:"AC",link:function(e,t,n){e.$on("$ionicView.beforeEnter",function(e,n){if(n.enableBack){var i=t.inheritedData("$ionSideMenusController");i.enableMenuWithBackViews()||t.addClass("hide")}else t.removeClass("hide")}),t.bind("click",function(){var e=t.inheritedData("$ionSideMenusController");e&&e.toggle(n.menuToggle)})}}}),a.directive("ionModal",[function(){return{restrict:"E",transclude:!0,replace:!0,controller:[function(){}],template:'<div class="modal-backdrop"><div class="modal-backdrop-bg"></div><div class="modal-wrapper" ng-transclude></div></div>'}}]),a.directive("ionModalView",function(){return{restrict:"E",compile:function(e){e.addClass("modal")}}}),a.directive("ionNavBackButton",["$ionicConfig","$document",function(e,t){return{restrict:"E",require:"^ionNavBar",compile:function(n,i){function o(e){return/ion-|icon/.test(e.className)}var r=t[0].createElement("button");for(var a in i.$attr)r.setAttribute(i.$attr[a],i[a]);i.ngClick||r.setAttribute("ng-click","$ionicGoBack()"),r.className="button back-button hide buttons "+(n.attr("class")||""),r.innerHTML=n.html()||"";for(var c,s,l,u,d=o(n[0]),f=0;f<n[0].childNodes.length;f++)c=n[0].childNodes[f],1===c.nodeType?o(c)?d=!0:c.classList.contains("default-title")?l=!0:c.classList.contains("previous-title")&&(u=!0):s||3!==c.nodeType||(s=!!c.nodeValue.trim());var h=e.backButton.icon();if(!d&&h&&"none"!==h&&(r.innerHTML='<i class="icon '+h+'"></i> '+r.innerHTML,r.className+=" button-clear"),!s){var p=t[0].createElement("span");p.className="back-text",!l&&e.backButton.text()&&(p.innerHTML+='<span class="default-title">'+e.backButton.text()+"</span>"),!u&&e.backButton.previousTitleText()&&(p.innerHTML+='<span class="previous-title"></span>'),r.appendChild(p)}return n.attr("class","hide"),n.empty(),{pre:function(e,t,n,i){i.navElement("backButton",r.outerHTML),r=null}}}}}]),a.directive("ionNavBar",function(){return{restrict:"E",controller:"$ionicNavBar",scope:!0,link:function(e,t,n,i){i.init()}}}),a.directive("ionNavButtons",["$document",function(e){return{require:"^ionNavBar",restrict:"E",compile:function(t,n){var i="left";/^primary|secondary|right$/i.test(n.side||"")&&(i=n.side.toLowerCase());var o=e[0].createElement("span");o.className=i+"-buttons",o.innerHTML=t.html();var r=i+"Buttons";return t.attr("class","hide"),t.empty(),{pre:function(e,t,n,i){var a=t.parent().data("$ionViewController");a?a.navElement(r,o.outerHTML):i.navElement(r,o.outerHTML),o=null}}}}}]),a.directive("navDirection",["$ionicViewSwitcher",function(e){return{restrict:"A",priority:1e3,link:function(t,n,i){n.bind("click",function(){e.nextDirection(i.navDirection)})}}}]),a.directive("ionNavTitle",["$document",function(e){return{require:"^ionNavBar",restrict:"E",compile:function(t,n){var i="title",o=e[0].createElement("span");for(var r in n.$attr)o.setAttribute(n.$attr[r],n[r]);return o.classList.add("nav-bar-title"),o.innerHTML=t.html(),t.attr("class","hide"),t.empty(),{pre:function(e,t,n,r){var a=t.parent().data("$ionViewController");a?a.navElement(i,o.outerHTML):r.navElement(i,o.outerHTML),o=null}}}}}]),a.directive("navTransition",["$ionicViewSwitcher",function(e){return{restrict:"A",priority:1e3,link:function(t,n,i){n.bind("click",function(){e.nextTransition(i.navTransition)})}}}]),a.directive("ionNavView",["$state","$ionicConfig",function(e,t){return{restrict:"E",terminal:!0,priority:2e3,transclude:!0,controller:"$ionicNavView",compile:function(n,i,o){return n.addClass("view-container"),ionic.DomUtil.cachedAttr(n,"nav-view-transition",t.views.transition()),function(t,n,i,r){function a(t){var n=e.$current&&e.$current.locals[s.name];n&&(t||n!==c)&&(c=n,s.state=n.$$state,r.register(n))}var c;o(t,function(e){n.append(e)});var s=r.init();t.$on("$stateChangeSuccess",function(){a(!1)}),t.$on("$viewContentLoading",function(){a(!1)}),a(!0)}}}}]),a.config(["$provide",function(e){e.decorator("ngClickDirective",["$delegate",function(e){return e.shift(),e}])}]).factory("$ionicNgClick",["$parse",function(e){return function(t,n,i){var o=angular.isFunction(i)?i:e(i);n.on("click",function(e){t.$apply(function(){o(t,{$event:e})})}),n.onclick=h}}]).directive("ngClick",["$ionicNgClick",function(e){return function(t,n,i){e(t,n,i.ngClick)}}]).directive("ionStopEvent",function(){return{restrict:"A",link:function(e,t,n){t.bind(n.ionStopEvent,r)}}}),a.directive("ionPane",function(){return{restrict:"E",link:function(e,t){t.addClass("pane")}}}),a.directive("ionPopover",[function(){return{restrict:"E",transclude:!0,replace:!0,controller:[function(){}],template:'<div class="popover-backdrop"><div class="popover-wrapper" ng-transclude></div></div>'}}]),a.directive("ionPopoverView",function(){return{restrict:"E",compile:function(e){e.append(f('<div class="popover-arrow">')),e.addClass("popover")}}}),a.directive("ionRadio",function(){return{restrict:"E",replace:!0,require:"?ngModel",transclude:!0,template:'<label class="item item-radio"><input type="radio" name="radio-group"><div class="radio-content"><div class="item-content disable-pointer-events" ng-transclude></div><i class="radio-icon disable-pointer-events icon ion-checkmark"></i></div></label>',compile:function(e,t){if(t.icon){var n=e.find("i");n.removeClass("ion-checkmark").addClass(t.icon)}var i=e.find("input");return s({name:t.name,value:t.value,disabled:t.disabled,"ng-value":t.ngValue,"ng-model":t.ngModel,"ng-disabled":t.ngDisabled,"ng-change":t.ngChange,"ng-required":t.ngRequired,required:t.required},function(e,t){l(e)&&i.attr(t,e)}),function(e,t,n){e.getValue=function(){return e.ngValue||n.value}}}}}),a.directive("ionRefresher",[function(){return{restrict:"E",replace:!0,require:["?^$ionicScroll","ionRefresher"],controller:"$ionicRefresher",template:'<div class="scroll-refresher invisible" collection-repeat-ignore><div class="ionic-refresher-content" ng-class="{\'ionic-refresher-with-text\': pullingText || refreshingText}"><div class="icon-pulling" ng-class="{\'pulling-rotation-disabled\':disablePullingRotation}"><i class="icon {{pullingIcon}}"></i></div><div class="text-pulling" ng-bind-html="pullingText"></div><div class="icon-refreshing"><ion-spinner ng-if="showSpinner" icon="{{spinner}}"></ion-spinner><i ng-if="showIcon" class="icon {{refreshingIcon}}"></i></div><div class="text-refreshing" ng-bind-html="refreshingText"></div></div></div>',link:function(e,t,n,i){var o=i[0],r=i[1];!o||o.isNative()?r.init():(t[0].classList.add("js-scrolling"),o._setRefresher(e,t[0],r.getRefresherDomMethods()),e.$on("scroll.refreshComplete",function(){e.$evalAsync(function(){o.scrollView.finishPullToRefresh()})}))}}}]),a.directive("ionScroll",["$timeout","$controller","$ionicBind","$ionicConfig",function(e,t,n,i){return{restrict:"E",scope:!0,controller:function(){},compile:function(e,o){function r(e,i,o){n(e,o,{direction:"@",paging:"@",$onScroll:"&onScroll",scroll:"@",scrollbarX:"@",scrollbarY:"@",zooming:"@",minZoom:"@",maxZoom:"@"}),e.direction=e.direction||"y",l(o.padding)&&e.$watch(o.padding,function(e){a.toggleClass("padding",!!e)}),e.$eval(e.paging)===!0&&a.addClass("scroll-paging"),e.direction||(e.direction="y");var r=e.$eval(e.paging)===!0;c&&i.addClass("overflow-scroll"),i.addClass("scroll-"+e.direction);var s={el:i[0],delegateHandle:o.delegateHandle,locking:"true"===(o.locking||"true"),bouncing:e.$eval(o.hasBouncing),paging:r,scrollbarX:e.$eval(e.scrollbarX)!==!1,scrollbarY:e.$eval(e.scrollbarY)!==!1,scrollingX:e.direction.indexOf("x")>=0,scrollingY:e.direction.indexOf("y")>=0,zooming:e.$eval(e.zooming)===!0,maxZoom:e.$eval(e.maxZoom)||3,minZoom:e.$eval(e.minZoom)||.5,preventDefault:!0,nativeScrolling:c};r&&(s.speedMultiplier=.8,s.bouncing=!1),t("$ionicScroll",{$scope:e,scrollViewOptions:s})}e.addClass("scroll-view ionic-scroll");var a=f('<div class="scroll"></div>');a.append(e.contents()),e.append(a);var c="false"!==o.overflowScroll&&("true"===o.overflowScroll||!i.scrolling.jsScrolling());return{pre:r}}}}]),a.directive("ionSideMenu",function(){return{restrict:"E",require:"^ionSideMenus",scope:!0,compile:function(e,t){return angular.isUndefined(t.isEnabled)&&t.$set("isEnabled","true"),angular.isUndefined(t.width)&&t.$set("width","275"),e.addClass("menu menu-"+t.side),function(e,n,i,o){e.side=i.side||"left";var r=o[e.side]=new ionic.views.SideMenu({width:t.width,el:n[0],isEnabled:!0});e.$watch(i.width,function(e){var t=+e;t&&t==e&&r.setWidth(+e)}),e.$watch(i.isEnabled,function(e){r.setIsEnabled(!!e)})}}}}),a.directive("ionSideMenuContent",["$timeout","$ionicGesture","$window",function(e,t,n){return{restrict:"EA",require:"^ionSideMenus",scope:!0,compile:function(i,o){function r(r,a,c,s){function u(e){0!==s.getOpenAmount()?(s.close(),e.gesture.srcEvent.preventDefault(),v=null,g=null):v||(v=ionic.tap.pointerCoord(e.gesture.srcEvent))}function d(e){s.isDraggableTarget(e)&&"x"==p(e)&&(s._handleDrag(e),e.gesture.srcEvent.preventDefault())}function f(e){"x"==p(e)&&e.gesture.srcEvent.preventDefault()}function h(e){s._endDrag(e),v=null,g=null}function p(e){if(g)return g;if(e&&e.gesture){if(v){var t=ionic.tap.pointerCoord(e.gesture.srcEvent),n=Math.abs(t.x-v.x),i=Math.abs(t.y-v.y),o=i>n?"y":"x";return Math.max(n,i)>30&&(g=o),o}v=ionic.tap.pointerCoord(e.gesture.srcEvent)}return"y"}var v=null,g=null;l(o.dragContent)?r.$watch(o.dragContent,function(e){s.canDragContent(e)}):s.canDragContent(!0),l(o.edgeDragThreshold)&&r.$watch(o.edgeDragThreshold,function(e){s.edgeDragThreshold(e)});var m={element:i[0],onDrag:function(){},endDrag:function(){},setCanScroll:function(e){var t=a[0].querySelector(".scroll");if(t){var n=angular.element(t.parentElement);if(n){var i=n.scope();i.scrollCtrl&&i.scrollCtrl.freezeScrollShut(!e)}}},getTranslateX:function(){return r.sideMenuContentTranslateX||0},setTranslateX:ionic.animationFrameThrottle(function(t){var n=m.offsetX+t;a[0].style[ionic.CSS.TRANSFORM]="translate3d("+n+"px,0,0)",e(function(){r.sideMenuContentTranslateX=t})}),setMarginLeft:ionic.animationFrameThrottle(function(e){e?(e=parseInt(e,10),a[0].style[ionic.CSS.TRANSFORM]="translate3d("+e+"px,0,0)",a[0].style.width=n.innerWidth-e+"px",m.offsetX=e):(a[0].style[ionic.CSS.TRANSFORM]="translate3d(0,0,0)",a[0].style.width="",m.offsetX=0)}),setMarginRight:ionic.animationFrameThrottle(function(e){e?(e=parseInt(e,10),a[0].style.width=n.innerWidth-e+"px",m.offsetX=e):(a[0].style.width="",m.offsetX=0),a[0].style[ionic.CSS.TRANSFORM]="translate3d(0,0,0)"}),setMarginLeftAndRight:ionic.animationFrameThrottle(function(e,t){e=e&&parseInt(e,10)||0,t=t&&parseInt(t,10)||0;var i=e+t;i>0?(a[0].style[ionic.CSS.TRANSFORM]="translate3d("+e+"px,0,0)",a[0].style.width=n.innerWidth-i+"px",m.offsetX=e):(a[0].style[ionic.CSS.TRANSFORM]="translate3d(0,0,0)",a[0].style.width="",m.offsetX=0)}),enableAnimation:function(){r.animationEnabled=!0,a[0].classList.add("menu-animated")},disableAnimation:function(){r.animationEnabled=!1,a[0].classList.remove("menu-animated")},offsetX:0};s.setContent(m);var $={stop_browser_behavior:!1};$.prevent_default_directions=["left","right"];var w=t.on("tap",u,a,$),b=t.on("dragright",d,a,$),y=t.on("dragleft",d,a,$),S=t.on("dragup",f,a,$),k=t.on("dragdown",f,a,$),C=t.on("release",h,a,$);r.$on("$destroy",function(){m&&(m.element=null,m=null),t.off(y,"dragleft",d),t.off(b,"dragright",d),t.off(S,"dragup",f),t.off(k,"dragdown",f),t.off(C,"release",h),t.off(w,"tap",u)})}return i.addClass("menu-content pane"),{pre:r}}}}]),a.directive("ionSideMenus",["$ionicBody",function(e){return{restrict:"ECA",controller:"$ionicSideMenus",compile:function(t,n){function i(t,n,i,o){o.enableMenuWithBackViews(t.$eval(i.enableMenuWithBackViews)),t.$on("$ionicExposeAside",function(n,i){t.$exposeAside||(t.$exposeAside={}),t.$exposeAside.active=i,e.enableClass(i,"aside-open")}),t.$on("$ionicView.beforeEnter",function(e,n){n.historyId&&(t.$activeHistoryId=n.historyId)}),t.$on("$destroy",function(){e.removeClass("menu-open","aside-open")})}return n.$set("class",(n["class"]||"")+" view"),{pre:i}}}}]),a.directive("ionSlideBox",["$animate","$timeout","$compile","$ionicSlideBoxDelegate","$ionicHistory","$ionicScrollDelegate",function(e,t,n,i,o,r){return{restrict:"E",replace:!0,transclude:!0,scope:{autoPlay:"=",doesContinue:"@",slideInterval:"@",showPager:"@",pagerClick:"&",disableScroll:"@",onSlideChanged:"&",activeSlide:"=?",bounce:"@"},controller:["$scope","$element","$attrs",function(e,n,a){function c(e){e&&!s.isScrollFreeze?r.freezeAllScrolls(e):!e&&s.isScrollFreeze&&r.freezeAllScrolls(!1),s.isScrollFreeze=e}var s=this,u=e.$eval(e.doesContinue)===!0,d=e.$eval(e.bounce)!==!1,f=l(a.autoPlay)?!!e.autoPlay:!1,h=f?e.$eval(e.slideInterval)||4e3:0,p=new ionic.views.Slider({el:n[0],auto:h,continuous:u,startSlide:e.activeSlide,bouncing:d,slidesChanged:function(){e.currentSlide=p.currentIndex(),t(function(){})},callback:function(n){e.currentSlide=n,e.onSlideChanged({index:e.currentSlide,$index:e.currentSlide}),e.$parent.$broadcast("slideBox.slideChanged",n),e.activeSlide=n,t(function(){})},onDrag:function(){c(!0)},onDragEnd:function(){c(!1)}});p.enableSlide(e.$eval(a.disableScroll)!==!0),e.$watch("activeSlide",function(e){l(e)&&p.slide(e)}),e.$on("slideBox.nextSlide",function(){p.next()}),e.$on("slideBox.prevSlide",function(){p.prev()}),e.$on("slideBox.setSlide",function(e,t){p.slide(t)}),this.__slider=p;var v=i._registerInstance(p,a.delegateHandle,function(){return o.isActiveScope(e)});e.$on("$destroy",function(){v(),p.kill()}),this.slidesCount=function(){return p.slidesCount()},this.onPagerClick=function(t){e.pagerClick({index:t})},t(function(){p.load()})}],template:'<div class="slider"><div class="slider-slides" ng-transclude></div></div>',link:function(t,i,o){function r(){if(!a){var e=t.$new();a=f("<ion-pager></ion-pager>"),i.append(a),a=n(a)(e)}return a}e.enabled(i,!1),l(o.showPager)||(t.showPager=!0,r().toggleClass("hide",!1)),o.$observe("showPager",function(e){void 0!==e&&(e=t.$eval(e),r().toggleClass("hide",!e))});var a}}}]).directive("ionSlide",function(){return{restrict:"E",require:"?^ionSlideBox",compile:function(e){e.addClass("slider-slide")}}}).directive("ionPager",function(){return{restrict:"E",replace:!0,require:"^ionSlideBox",template:'<div class="slider-pager"><span class="slider-pager-page" ng-repeat="slide in numSlides() track by $index" ng-class="{active: $index == currentSlide}" ng-click="pagerClick($index)"><i class="icon ion-record"></i></span></div>',link:function(e,t,n,i){var o=function(e){for(var n=t[0].children,i=n.length,o=0;i>o;o++)o==e?n[o].classList.add("active"):n[o].classList.remove("active")};e.pagerClick=function(e){i.onPagerClick(e)},e.numSlides=function(){return new Array(i.slidesCount())},e.$watch("currentSlide",function(e){o(e)})}}}),a.directive("ionSlides",["$animate","$timeout","$compile",function(e,t,n){return{restrict:"E",transclude:!0,scope:{options:"=",slider:"="},template:'<div class="swiper-container"><div class="swiper-wrapper" ng-transclude></div><div ng-hide="!showPager" class="swiper-pagination"></div></div>',controller:["$scope","$element",function(e,i){var o=this;this.update=function(){t(function(){if(o.__slider){o.__slider.update(),o._options.loop&&o.__slider.createLoop();var t=o.__slider.slides.length;t>10&&(e.showPager=!1),o.__slider.activeIndex>t-1&&o.__slider.slideTo(t-1)}})},this.rapidUpdate=ionic.debounce(function(){o.update()},50),this.getSlider=function(){return o.__slider};var r=e.options||{},a=angular.extend({pagination:i.children().children()[1],paginationClickable:!0,lazyLoading:!0,preloadImages:!1},r);this._options=a,t(function(){var t=new ionic.views.Swiper(i.children()[0],a,e,n);e.$emit("$ionicSlides.sliderInitialized",{slider:t}),o.__slider=t,e.slider=o.__slider,e.$on("$destroy",function(){t.destroy(),o.__slider=null})}),t(function(){o.rapidUpdate()},200)}],link:function(e){e.showPager=!0}}}]).directive("ionSlidePage",[function(){return{restrict:"E",require:"?^ionSlides",transclude:!0,replace:!0,template:'<div class="swiper-slide" ng-transclude></div>',link:function(e,t,n,i){i.rapidUpdate(),e.$on("$destroy",function(){i.rapidUpdate()})}}}]),a.directive("ionSpinner",function(){return{restrict:"E",controller:"$ionicSpinner",link:function(e,t,n,i){var o=i.init();t.addClass("spinner spinner-"+o),t.on("$destroy",function(){i.stop()})}}}),a.directive("ionTab",["$compile","$ionicConfig","$ionicBind","$ionicViewSwitcher",function(e,t,n,i){function o(e,t){return l(t)?" "+e+'="'+t+'"':""}return{restrict:"E",require:["^ionTabs","ionTab"],controller:"$ionicTab",scope:!0,compile:function(r,a){for(var c="<ion-tab-nav"+o("ng-click",a.ngClick)+o("title",a.title)+o("icon",a.icon)+o("icon-on",a.iconOn)+o("icon-off",a.iconOff)+o("badge",a.badge)+o("badge-style",a.badgeStyle)+o("hidden",a.hidden)+o("disabled",a.disabled)+o("class",a["class"])+"></ion-tab-nav>",s=document.createElement("div"),l=0;l<r[0].children.length;l++)s.appendChild(r[0].children[l].cloneNode(!0));var u=s.childElementCount;r.empty();var d,h;return u&&("ION-NAV-VIEW"===s.children[0].tagName&&(d=s.children[0].getAttribute("name"),s.children[0].classList.add("view-container"),h=!0),1===u&&(s=s.children[0]),h||s.classList.add("pane"),s.classList.add("tab-content")),function(o,r,a,l){function h(){w.tabMatchesState()&&$.select(o,!1)}function p(n){n&&u?(b||(g=o.$new(),m=f(s),i.viewEleIsActive(m,!0),$.$element.append(m),e(m)(g),b=!0),i.viewEleIsActive(m,!0)):b&&m&&(t.views.maxCache()>0?i.viewEleIsActive(m,!1):v())}function v(){g&&g.$destroy(),b&&m&&m.remove(),s.innerHTML="",b=g=m=null}var g,m,$=l[0],w=l[1],b=!1;o.$tabSelected=!1,n(o,a,{onSelect:"&",onDeselect:"&",title:"@",uiSref:"@",href:"@"}),$.add(o),o.$on("$destroy",function(){o.$tabsDestroy||$.remove(o),y.isolateScope().$destroy(),y.remove(),y=s=m=null}),r[0].removeAttribute("title"),d&&(w.navViewName=o.navViewName=d),o.$on("$stateChangeSuccess",h),h();var y=f(c);y.data("$ionTabsController",$),y.data("$ionTabController",w),$.$tabsElement.append(e(y)(o)),o.$watch("$tabSelected",p),o.$on("$ionicView.afterEnter",function(){i.viewEleIsActive(m,o.$tabSelected)}),o.$on("$ionicView.clearCache",function(){o.$tabSelected||v()})}}}}]),a.directive("ionTabNav",[function(){return{restrict:"E",replace:!0,require:["^ionTabs","^ionTab"],template:"<a ng-class=\"{'has-badge':badge, 'tab-hidden':isHidden(), 'tab-item-active': isTabActive()}\" "+' ng-disabled="disabled()" class="tab-item"><span class="badge {{badgeStyle}}" ng-if="badge">{{badge}}</span><i class="icon {{getIcon()}}" ng-if="getIcon()"></i><span class="tab-title" ng-bind-html="title"></span></a>',scope:{title:"@",icon:"@",iconOn:"@",iconOff:"@",badge:"=",hidden:"@",disabled:"&",badgeStyle:"@","class":"@"},link:function(e,t,n,i){var o=i[0],r=i[1];t[0].removeAttribute("title"),e.selectTab=function(e){e.preventDefault(),o.select(r.$scope,!0)},n.ngClick||t.on("click",function(t){e.$apply(function(){e.selectTab(t)})}),e.isHidden=function(){return"true"===n.hidden||n.hidden===!0?!0:!1},e.getIconOn=function(){return e.iconOn||e.icon},e.getIconOff=function(){return e.iconOff||e.icon},e.isTabActive=function(){return o.selectedTab()===r.$scope},e.getIcon=function(){return o.selectedTab()===r.$scope?e.iconOn||e.icon:e.iconOff||e.icon}}}}]),a.directive("ionTabs",["$ionicTabsDelegate","$ionicConfig",function(e,t){return{restrict:"E",scope:!0,controller:"$ionicTabs",compile:function(n){function i(t,n,i,o){function a(e,t){e.stopPropagation();var n=o.previousSelectedTab();n&&n.$broadcast(e.name.replace("NavView","Tabs"),t)}var c=e._registerInstance(o,i.delegateHandle,o.hasActiveScope);o.$scope=t,o.$element=n,o.$tabsElement=f(n[0].querySelector(".tabs")),t.$watch(function(){return n[0].className},function(e){var n=-1!==e.indexOf("tabs-top"),i=-1!==e.indexOf("tabs-item-hide");t.$hasTabs=!n&&!i,t.$hasTabsTop=n&&!i,t.$emit("$ionicTabs.top",t.$hasTabsTop)}),t.$on("$ionicNavView.beforeLeave",a),t.$on("$ionicNavView.afterLeave",a),t.$on("$ionicNavView.leave",a),t.$on("$destroy",function(){t.$tabsDestroy=!0,c(),o.$tabsElement=o.$element=o.$scope=r=null,delete t.$hasTabs,delete t.$hasTabsTop})}function o(e,t,n,i){i.selectedTab()||i.select(0)}var r=f('<div class="tab-nav tabs">');return r.append(n.contents()),n.append(r).addClass("tabs-"+t.tabs.position()+" tabs-"+t.tabs.style()),{pre:i,post:o}}}}]),a.directive("ionTitle",[function(){return{restrict:"E",compile:function(e){e.addClass("title")}}}]),a.directive("ionToggle",["$timeout","$ionicConfig",function(e,t){return{restrict:"E",replace:!0,require:"?ngModel",transclude:!0,template:'<div class="item item-toggle"><div ng-transclude></div><label class="toggle"><input type="checkbox"><div class="track"><div class="handle"></div></div></label></div>',compile:function(e,n){var i=e.find("input");return s({name:n.name,"ng-value":n.ngValue,"ng-model":n.ngModel,"ng-checked":n.ngChecked,"ng-disabled":n.ngDisabled,"ng-true-value":n.ngTrueValue,"ng-false-value":n.ngFalseValue,"ng-change":n.ngChange,"ng-required":n.ngRequired,required:n.required},function(e,t){l(e)&&i.attr(t,e)}),n.toggleClass&&e[0].getElementsByTagName("label")[0].classList.add(n.toggleClass),e.addClass("toggle-"+t.form.toggle()),function(e,t){var n=t[0].getElementsByTagName("label")[0],i=n.children[0],o=n.children[1],r=o.children[0],a=f(i).controller("ngModel");e.toggle=new ionic.views.Toggle({el:n,track:o,checkbox:i,handle:r,onChange:function(){a&&(a.$setViewValue(i.checked),e.$apply())}}),e.$on("$destroy",function(){e.toggle.destroy()})}}}}]),a.directive("ionView",function(){return{restrict:"EA",priority:1e3,controller:"$ionicView",compile:function(e){return e.addClass("pane"),e[0].removeAttribute("title"),function(e,t,n,i){i.init()}}}})}();
/**
 * State-based routing for AngularJS
 * @version v0.2.13
 * @link http://angular-ui.github.com/
 * @license MIT License, http://www.opensource.org/licenses/MIT
 */
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return M(new(M(function(){},{prototype:a})),b)}function e(a){return L(arguments,function(b){b!==a&&L(b,function(b,c){a.hasOwnProperty(c)||(a[c]=b)})}),a}function f(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function g(a){if(Object.keys)return Object.keys(a);var c=[];return b.forEach(a,function(a,b){c.push(b)}),c}function h(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if(d in a&&a[d]===b)return d;return-1}function i(a,b,c,d){var e,i=f(c,d),j={},k=[];for(var l in i)if(i[l].params&&(e=g(i[l].params),e.length))for(var m in e)h(k,e[m])>=0||(k.push(e[m]),j[e[m]]=a[e[m]]);return M({},j,b)}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e<c.length;e++){var f=c[e];if(a[f]!=b[f])return!1}return!0}function k(a,b){var c={};return L(a,function(a){c[a]=b[a]}),c}function l(a){var b={},c=Array.prototype.concat.apply(Array.prototype,Array.prototype.slice.call(arguments,1));for(var d in a)-1==h(c,d)&&(b[d]=a[d]);return b}function m(a,b){var c=K(a),d=c?[]:{};return L(a,function(a,e){b(a,e)&&(d[c?d.length:e]=a)}),d}function n(a,b){var c=K(a)?[]:{};return L(a,function(a,d){c[d]=b(a,d)}),c}function o(a,b){var d=1,f=2,i={},j=[],k=i,m=M(a.when(i),{$$promises:i,$$values:i});this.study=function(i){function n(a,c){if(s[c]!==f){if(r.push(c),s[c]===d)throw r.splice(0,h(r,c)),new Error("Cyclic dependency: "+r.join(" -> "));if(s[c]=d,I(a))q.push(c,[function(){return b.get(a)}],j);else{var e=b.annotate(a);L(e,function(a){a!==c&&i.hasOwnProperty(a)&&n(i[a],a)}),q.push(c,a,e)}r.pop(),s[c]=f}}function o(a){return J(a)&&a.then&&a.$$promises}if(!J(i))throw new Error("'invocables' must be an object");var p=g(i||{}),q=[],r=[],s={};return L(i,n),i=r=s=null,function(d,f,g){function h(){--u||(v||e(t,f.$$values),r.$$values=t,r.$$promises=r.$$promises||!0,delete r.$$inheritedValues,n.resolve(t))}function i(a){r.$$failure=a,n.reject(a)}function j(c,e,f){function j(a){l.reject(a),i(a)}function k(){if(!G(r.$$failure))try{l.resolve(b.invoke(e,g,t)),l.promise.then(function(a){t[c]=a,h()},j)}catch(a){j(a)}}var l=a.defer(),m=0;L(f,function(a){s.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,s[a].then(function(b){t[a]=b,--m||k()},j))}),m||k(),s[c]=l.promise}if(o(d)&&g===c&&(g=f,f=d,d=null),d){if(!J(d))throw new Error("'locals' must be an object")}else d=k;if(f){if(!o(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=m;var n=a.defer(),r=n.promise,s=r.$$promises={},t=M({},d),u=1+q.length/3,v=!1;if(G(f.$$failure))return i(f.$$failure),r;f.$$inheritedValues&&e(t,l(f.$$inheritedValues,p)),M(s,f.$$promises),f.$$values?(v=e(t,l(f.$$values,p)),r.$$inheritedValues=l(f.$$values,p),h()):(f.$$inheritedValues&&(r.$$inheritedValues=l(f.$$inheritedValues,p)),f.then(h,i));for(var w=0,x=q.length;x>w;w+=3)d.hasOwnProperty(q[w])?h():j(q[w],q[w+1],q[w+2]);return r}},this.resolve=function(a,b,c,d){return this.study(a)(b,c,d)}}function p(a,b,c){this.fromConfig=function(a,b,c){return G(a.template)?this.fromString(a.template,b):G(a.templateUrl)?this.fromUrl(a.templateUrl,b):G(a.templateProvider)?this.fromProvider(a.templateProvider,b,c):null},this.fromString=function(a,b){return H(a)?a(b):a},this.fromUrl=function(c,d){return H(c)&&(c=c(d)),null==c?null:a.get(c,{cache:b,headers:{Accept:"text/html"}}).then(function(a){return a.data})},this.fromProvider=function(a,b,d){return c.invoke(a,null,d||{params:b})}}function q(a,b,e){function f(b,c,d,e){if(q.push(b),o[b])return o[b];if(!/^\w+(-+\w+)*(?:\[\])?$/.test(b))throw new Error("Invalid parameter name '"+b+"' in pattern '"+a+"'");if(p[b])throw new Error("Duplicate parameter name '"+b+"' in pattern '"+a+"'");return p[b]=new O.Param(b,c,d,e),p[b]}function g(a,b,c){var d=["",""],e=a.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!b)return e;switch(c){case!1:d=["(",")"];break;case!0:d=["?(",")?"];break;default:d=["("+c+"|",")?"]}return e+d[0]+b+d[1]}function h(c,e){var f,g,h,i,j;return f=c[2]||c[3],j=b.params[f],h=a.substring(m,c.index),g=e?c[4]:c[4]||("*"==c[1]?".*":null),i=O.type(g||"string")||d(O.type("string"),{pattern:new RegExp(g)}),{id:f,regexp:g,segment:h,type:i,cfg:j}}b=M({params:{}},J(b)?b:{});var i,j=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,k=/([:]?)([\w\[\]-]+)|\{([\w\[\]-]+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,l="^",m=0,n=this.segments=[],o=e?e.params:{},p=this.params=e?e.params.$$new():new O.ParamSet,q=[];this.source=a;for(var r,s,t;(i=j.exec(a))&&(r=h(i,!1),!(r.segment.indexOf("?")>=0));)s=f(r.id,r.type,r.cfg,"path"),l+=g(r.segment,s.type.pattern.source,s.squash),n.push(r.segment),m=j.lastIndex;t=a.substring(m);var u=t.indexOf("?");if(u>=0){var v=this.sourceSearch=t.substring(u);if(t=t.substring(0,u),this.sourcePath=a.substring(0,m+u),v.length>0)for(m=0;i=k.exec(v);)r=h(i,!0),s=f(r.id,r.type,r.cfg,"search"),m=j.lastIndex}else this.sourcePath=a,this.sourceSearch="";l+=g(t)+(b.strict===!1?"/?":"")+"$",n.push(t),this.regexp=new RegExp(l,b.caseInsensitive?"i":c),this.prefix=n[0],this.$$paramNames=q}function r(a){M(this,a)}function s(){function a(a){return null!=a?a.toString().replace(/\//g,"%2F"):a}function e(a){return null!=a?a.toString().replace(/%2F/g,"/"):a}function f(a){return this.pattern.test(a)}function i(){return{strict:t,caseInsensitive:p}}function j(a){return H(a)||K(a)&&H(a[a.length-1])}function k(){for(;x.length;){var a=x.shift();if(a.pattern)throw new Error("You cannot override a type's .pattern at runtime.");b.extend(v[a.name],o.invoke(a.def))}}function l(a){M(this,a||{})}O=this;var o,p=!1,t=!0,u=!1,v={},w=!0,x=[],y={string:{encode:a,decode:e,is:f,pattern:/[^/]*/},"int":{encode:a,decode:function(a){return parseInt(a,10)},is:function(a){return G(a)&&this.decode(a.toString())===a},pattern:/\d+/},bool:{encode:function(a){return a?1:0},decode:function(a){return 0!==parseInt(a,10)},is:function(a){return a===!0||a===!1},pattern:/0|1/},date:{encode:function(a){return this.is(a)?[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2)].join("-"):c},decode:function(a){if(this.is(a))return a;var b=this.capture.exec(a);return b?new Date(b[1],b[2]-1,b[3]):c},is:function(a){return a instanceof Date&&!isNaN(a.valueOf())},equals:function(a,b){return this.is(a)&&this.is(b)&&a.toISOString()===b.toISOString()},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/},json:{encode:b.toJson,decode:b.fromJson,is:b.isObject,equals:b.equals,pattern:/[^/]*/},any:{encode:b.identity,decode:b.identity,is:b.identity,equals:b.equals,pattern:/.*/}};s.$$getDefaultValue=function(a){if(!j(a.value))return a.value;if(!o)throw new Error("Injectable functions cannot be called at configuration time");return o.invoke(a.value)},this.caseInsensitive=function(a){return G(a)&&(p=a),p},this.strictMode=function(a){return G(a)&&(t=a),t},this.defaultSquashPolicy=function(a){if(!G(a))return u;if(a!==!0&&a!==!1&&!I(a))throw new Error("Invalid squash policy: "+a+". Valid policies: false, true, arbitrary-string");return u=a,a},this.compile=function(a,b){return new q(a,M(i(),b))},this.isMatcher=function(a){if(!J(a))return!1;var b=!0;return L(q.prototype,function(c,d){H(c)&&(b=b&&G(a[d])&&H(a[d]))}),b},this.type=function(a,b,c){if(!G(b))return v[a];if(v.hasOwnProperty(a))throw new Error("A type named '"+a+"' has already been defined.");return v[a]=new r(M({name:a},b)),c&&(x.push({name:a,def:c}),w||k()),this},L(y,function(a,b){v[b]=new r(M({name:b},a))}),v=d(v,{}),this.$get=["$injector",function(a){return o=a,w=!1,k(),L(y,function(a,b){v[b]||(v[b]=new r(a))}),this}],this.Param=function(a,b,d,e){function f(a){var b=J(a)?g(a):[],c=-1===h(b,"value")&&-1===h(b,"type")&&-1===h(b,"squash")&&-1===h(b,"array");return c&&(a={value:a}),a.$$fn=j(a.value)?a.value:function(){return a.value},a}function i(b,c,d){if(b.type&&c)throw new Error("Param '"+a+"' has two type configurations.");return c?c:b.type?b.type instanceof r?b.type:new r(b.type):"config"===d?v.any:v.string}function k(){var b={array:"search"===e?"auto":!1},c=a.match(/\[\]$/)?{array:!0}:{};return M(b,c,d).array}function l(a,b){var c=a.squash;if(!b||c===!1)return!1;if(!G(c)||null==c)return u;if(c===!0||I(c))return c;throw new Error("Invalid squash policy: '"+c+"'. Valid policies: false, true, or arbitrary string")}function p(a,b,d,e){var f,g,i=[{from:"",to:d||b?c:""},{from:null,to:d||b?c:""}];return f=K(a.replace)?a.replace:[],I(e)&&f.push({from:e,to:c}),g=n(f,function(a){return a.from}),m(i,function(a){return-1===h(g,a.from)}).concat(f)}function q(){if(!o)throw new Error("Injectable functions cannot be called at configuration time");return o.invoke(d.$$fn)}function s(a){function b(a){return function(b){return b.from===a}}function c(a){var c=n(m(w.replace,b(a)),function(a){return a.to});return c.length?c[0]:a}return a=c(a),G(a)?w.type.decode(a):q()}function t(){return"{Param:"+a+" "+b+" squash: '"+z+"' optional: "+y+"}"}var w=this;d=f(d),b=i(d,b,e);var x=k();b=x?b.$asArray(x,"search"===e):b,"string"!==b.name||x||"path"!==e||d.value!==c||(d.value="");var y=d.value!==c,z=l(d,y),A=p(d,x,y,z);M(this,{id:a,type:b,location:e,array:x,squash:z,replace:A,isOptional:y,value:s,dynamic:c,config:d,toString:t})},l.prototype={$$new:function(){return d(this,M(new l,{$$parent:this}))},$$keys:function(){for(var a=[],b=[],c=this,d=g(l.prototype);c;)b.push(c),c=c.$$parent;return b.reverse(),L(b,function(b){L(g(b),function(b){-1===h(a,b)&&-1===h(d,b)&&a.push(b)})}),a},$$values:function(a){var b={},c=this;return L(c.$$keys(),function(d){b[d]=c[d].value(a&&a[d])}),b},$$equals:function(a,b){var c=!0,d=this;return L(d.$$keys(),function(e){var f=a&&a[e],g=b&&b[e];d[e].type.equals(f,g)||(c=!1)}),c},$$validates:function(a){var b,c,d,e=!0,f=this;return L(this.$$keys(),function(g){d=f[g],c=a[g],b=!c&&d.isOptional,e=e&&(b||!!d.type.is(c))}),e},$$parent:c},this.ParamSet=l}function t(a,d){function e(a){var b=/^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(a.source);return null!=b?b[1].replace(/\\(.)/g,"$1"):""}function f(a,b){return a.replace(/\$(\$|\d{1,2})/,function(a,c){return b["$"===c?0:Number(c)]})}function g(a,b,c){if(!c)return!1;var d=a.invoke(b,b,{$match:c});return G(d)?d:!0}function h(d,e,f,g){function h(a,b,c){return"/"===p?a:b?p.slice(0,-1)+a:c?p.slice(1)+a:a}function m(a){function b(a){var b=a(f,d);return b?(I(b)&&d.replace().url(b),!0):!1}if(!a||!a.defaultPrevented){var e=o&&d.url()===o;if(o=c,e)return!0;var g,h=j.length;for(g=0;h>g;g++)if(b(j[g]))return;k&&b(k)}}function n(){return i=i||e.$on("$locationChangeSuccess",m)}var o,p=g.baseHref(),q=d.url();return l||n(),{sync:function(){m()},listen:function(){return n()},update:function(a){return a?void(q=d.url()):void(d.url()!==q&&(d.url(q),d.replace()))},push:function(a,b,e){d.url(a.format(b||{})),o=e&&e.$$avoidResync?d.url():c,e&&e.replace&&d.replace()},href:function(c,e,f){if(!c.validates(e))return null;var g=a.html5Mode();b.isObject(g)&&(g=g.enabled);var i=c.format(e);if(f=f||{},g||null===i||(i="#"+a.hashPrefix()+i),i=h(i,g,f.absolute),!f.absolute||!i)return i;var j=!g&&i?"/":"",k=d.port();return k=80===k||443===k?"":":"+k,[d.protocol(),"://",d.host(),k,j,i].join("")}}}var i,j=[],k=null,l=!1;this.rule=function(a){if(!H(a))throw new Error("'rule' must be a function");return j.push(a),this},this.otherwise=function(a){if(I(a)){var b=a;a=function(){return b}}else if(!H(a))throw new Error("'rule' must be a function");return k=a,this},this.when=function(a,b){var c,h=I(b);if(I(a)&&(a=d.compile(a)),!h&&!H(b)&&!K(b))throw new Error("invalid 'handler' in when()");var i={matcher:function(a,b){return h&&(c=d.compile(b),b=["$match",function(a){return c.format(a)}]),M(function(c,d){return g(c,b,a.exec(d.path(),d.search()))},{prefix:I(a.prefix)?a.prefix:""})},regex:function(a,b){if(a.global||a.sticky)throw new Error("when() RegExp must not be global or sticky");return h&&(c=b,b=["$match",function(a){return f(c,a)}]),M(function(c,d){return g(c,b,a.exec(d.path()))},{prefix:e(a)})}},j={matcher:d.isMatcher(a),regex:a instanceof RegExp};for(var k in j)if(j[k])return this.rule(i[k](a,b));throw new Error("invalid 'what' in when()")},this.deferIntercept=function(a){a===c&&(a=!0),l=a},this.$get=h,h.$inject=["$location","$rootScope","$injector","$browser"]}function u(a,e){function f(a){return 0===a.indexOf(".")||0===a.indexOf("^")}function l(a,b){if(!a)return c;var d=I(a),e=d?a:a.name,g=f(e);if(g){if(!b)throw new Error("No reference point given for path '"+e+"'");b=l(b);for(var h=e.split("."),i=0,j=h.length,k=b;j>i;i++)if(""!==h[i]||0!==i){if("^"!==h[i])break;if(!k.parent)throw new Error("Path '"+e+"' not valid for state '"+b.name+"'");k=k.parent}else k=b;h=h.slice(i).join("."),e=k.name+(k.name&&h?".":"")+h}var m=y[e];return!m||!d&&(d||m!==a&&m.self!==a)?c:m}function m(a,b){z[a]||(z[a]=[]),z[a].push(b)}function o(a){for(var b=z[a]||[];b.length;)p(b.shift())}function p(b){b=d(b,{self:b,resolve:b.resolve||{},toString:function(){return this.name}});var c=b.name;if(!I(c)||c.indexOf("@")>=0)throw new Error("State must have a valid name");if(y.hasOwnProperty(c))throw new Error("State '"+c+"'' is already defined");var e=-1!==c.indexOf(".")?c.substring(0,c.lastIndexOf(".")):I(b.parent)?b.parent:J(b.parent)&&I(b.parent.name)?b.parent.name:"";if(e&&!y[e])return m(e,b.self);for(var f in B)H(B[f])&&(b[f]=B[f](b,B.$delegates[f]));return y[c]=b,!b[A]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){x.$current.navigable==b&&j(a,c)||x.transitionTo(b,a,{inherit:!0,location:!1})}]),o(c),b}function q(a){return a.indexOf("*")>-1}function r(a){var b=a.split("."),c=x.$current.name.split(".");if("**"===b[0]&&(c=c.slice(h(c,b[1])),c.unshift("**")),"**"===b[b.length-1]&&(c.splice(h(c,b[b.length-2])+1,Number.MAX_VALUE),c.push("**")),b.length!=c.length)return!1;for(var d=0,e=b.length;e>d;d++)"*"===b[d]&&(c[d]="*");return c.join("")===b.join("")}function s(a,b){return I(a)&&!G(b)?B[a]:H(b)&&I(a)?(B[a]&&!B.$delegates[a]&&(B.$delegates[a]=B[a]),B[a]=b,this):this}function t(a,b){return J(a)?b=a:b.name=a,p(b),this}function u(a,e,f,h,m,o,p){function s(b,c,d,f){var g=a.$broadcast("$stateNotFound",b,c,d);if(g.defaultPrevented)return p.update(),B;if(!g.retry)return null;if(f.$retry)return p.update(),C;var h=x.transition=e.when(g.retry);return h.then(function(){return h!==x.transition?u:(b.options.$retry=!0,x.transitionTo(b.to,b.toParams,b.options))},function(){return B}),p.update(),h}function t(a,c,d,g,i,j){var l=d?c:k(a.params.$$keys(),c),n={$stateParams:l};i.resolve=m.resolve(a.resolve,n,i.resolve,a);var o=[i.resolve.then(function(a){i.globals=a})];return g&&o.push(g),L(a.views,function(c,d){var e=c.resolve&&c.resolve!==a.resolve?c.resolve:{};e.$template=[function(){return f.load(d,{view:c,locals:n,params:l,notify:j.notify})||""}],o.push(m.resolve(e,n,i.resolve,a).then(function(f){if(H(c.controllerProvider)||K(c.controllerProvider)){var g=b.extend({},e,n);f.$$controller=h.invoke(c.controllerProvider,null,g)}else f.$$controller=c.controller;f.$$state=a,f.$$controllerAs=c.controllerAs,i[d]=f}))}),e.all(o).then(function(){return i})}var u=e.reject(new Error("transition superseded")),z=e.reject(new Error("transition prevented")),B=e.reject(new Error("transition aborted")),C=e.reject(new Error("transition failed"));return w.locals={resolve:null,globals:{$stateParams:{}}},x={params:{},current:w.self,$current:w,transition:null},x.reload=function(){return x.transitionTo(x.current,o,{reload:!0,inherit:!1,notify:!0})},x.go=function(a,b,c){return x.transitionTo(a,b,M({inherit:!0,relative:x.$current},c))},x.transitionTo=function(b,c,f){c=c||{},f=M({location:!0,inherit:!1,relative:null,notify:!0,reload:!1,$retry:!1},f||{});var g,j=x.$current,m=x.params,n=j.path,q=l(b,f.relative);if(!G(q)){var r={to:b,toParams:c,options:f},y=s(r,j.self,m,f);if(y)return y;if(b=r.to,c=r.toParams,f=r.options,q=l(b,f.relative),!G(q)){if(!f.relative)throw new Error("No such state '"+b+"'");throw new Error("Could not resolve '"+b+"' from state '"+f.relative+"'")}}if(q[A])throw new Error("Cannot transition to abstract state '"+b+"'");if(f.inherit&&(c=i(o,c||{},x.$current,q)),!q.params.$$validates(c))return C;c=q.params.$$values(c),b=q;var B=b.path,D=0,E=B[D],F=w.locals,H=[];if(!f.reload)for(;E&&E===n[D]&&E.ownParams.$$equals(c,m);)F=H[D]=E.locals,D++,E=B[D];if(v(b,j,F,f))return b.self.reloadOnSearch!==!1&&p.update(),x.transition=null,e.when(x.current);if(c=k(b.params.$$keys(),c||{}),f.notify&&a.$broadcast("$stateChangeStart",b.self,c,j.self,m).defaultPrevented)return p.update(),z;for(var I=e.when(F),J=D;J<B.length;J++,E=B[J])F=H[J]=d(F),I=t(E,c,E===b,I,F,f);var K=x.transition=I.then(function(){var d,e,g;if(x.transition!==K)return u;for(d=n.length-1;d>=D;d--)g=n[d],g.self.onExit&&h.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=D;d<B.length;d++)e=B[d],e.locals=H[d],e.self.onEnter&&h.invoke(e.self.onEnter,e.self,e.locals.globals);return x.transition!==K?u:(x.$current=b,x.current=b.self,x.params=c,N(x.params,o),x.transition=null,f.location&&b.navigable&&p.push(b.navigable.url,b.navigable.locals.globals.$stateParams,{$$avoidResync:!0,replace:"replace"===f.location}),f.notify&&a.$broadcast("$stateChangeSuccess",b.self,c,j.self,m),p.update(!0),x.current)},function(d){return x.transition!==K?u:(x.transition=null,g=a.$broadcast("$stateChangeError",b.self,c,j.self,m,d),g.defaultPrevented||p.update(),e.reject(d))});return K},x.is=function(a,b,d){d=M({relative:x.$current},d||{});var e=l(a,d.relative);return G(e)?x.$current!==e?!1:b?j(e.params.$$values(b),o):!0:c},x.includes=function(a,b,d){if(d=M({relative:x.$current},d||{}),I(a)&&q(a)){if(!r(a))return!1;a=x.$current.name}var e=l(a,d.relative);return G(e)?G(x.$current.includes[e.name])?b?j(e.params.$$values(b),o,g(b)):!0:!1:c},x.href=function(a,b,d){d=M({lossy:!0,inherit:!0,absolute:!1,relative:x.$current},d||{});var e=l(a,d.relative);if(!G(e))return null;d.inherit&&(b=i(o,b||{},x.$current,e));var f=e&&d.lossy?e.navigable:e;return f&&f.url!==c&&null!==f.url?p.href(f.url,k(e.params.$$keys(),b||{}),{absolute:d.absolute}):null},x.get=function(a,b){if(0===arguments.length)return n(g(y),function(a){return y[a].self});var c=l(a,b||x.$current);return c&&c.self?c.self:null},x}function v(a,b,c,d){return a!==b||(c!==b.locals||d.reload)&&a.self.reloadOnSearch!==!1?void 0:!0}var w,x,y={},z={},A="abstract",B={parent:function(a){if(G(a.parent)&&a.parent)return l(a.parent);var b=/^(.+)\.[^.]+$/.exec(a.name);return b?l(b[1]):w},data:function(a){return a.parent&&a.parent.data&&(a.data=a.self.data=M({},a.parent.data,a.data)),a.data},url:function(a){var b=a.url,c={params:a.params||{}};if(I(b))return"^"==b.charAt(0)?e.compile(b.substring(1),c):(a.parent.navigable||w).url.concat(b,c);if(!b||e.isMatcher(b))return b;throw new Error("Invalid url '"+b+"' in state '"+a+"'")},navigable:function(a){return a.url?a:a.parent?a.parent.navigable:null},ownParams:function(a){var b=a.url&&a.url.params||new O.ParamSet;return L(a.params||{},function(a,c){b[c]||(b[c]=new O.Param(c,null,a,"config"))}),b},params:function(a){return a.parent&&a.parent.params?M(a.parent.params.$$new(),a.ownParams):new O.ParamSet},views:function(a){var b={};return L(G(a.views)?a.views:{"":a},function(c,d){d.indexOf("@")<0&&(d+="@"+a.parent.name),b[d]=c}),b},path:function(a){return a.parent?a.parent.path.concat(a):[]},includes:function(a){var b=a.parent?M({},a.parent.includes):{};return b[a.name]=!0,b},$delegates:{}};w=p({name:"",url:"^",views:null,"abstract":!0}),w.navigable=null,this.decorator=s,this.state=t,this.$get=u,u.$inject=["$rootScope","$q","$view","$injector","$resolve","$stateParams","$urlRouter","$location","$urlMatcherFactory"]}function v(){function a(a,b){return{load:function(c,d){var e,f={template:null,controller:null,view:null,locals:null,notify:!0,async:!0,params:{}};return d=M(f,d),d.view&&(e=b.fromConfig(d.view,d.params,d.locals)),e&&d.notify&&a.$broadcast("$viewContentLoading",d),e}}}this.$get=a,a.$inject=["$rootScope","$templateFactory"]}function w(){var a=!1;this.useAnchorScroll=function(){a=!0},this.$get=["$anchorScroll","$timeout",function(b,c){return a?b:function(a){c(function(){a[0].scrollIntoView()},0,!1)}}]}function x(a,c,d,e){function f(){return c.has?function(a){return c.has(a)?c.get(a):null}:function(a){try{return c.get(a)}catch(b){return null}}}function g(a,b){var c=function(){return{enter:function(a,b,c){b.after(a),c()},leave:function(a,b){a.remove(),b()}}};if(j)return{enter:function(a,b,c){var d=j.enter(a,null,b,c);d&&d.then&&d.then(c)},leave:function(a,b){var c=j.leave(a,b);c&&c.then&&c.then(b)}};if(i){var d=i&&i(b,a);return{enter:function(a,b,c){d.enter(a,null,b),c()},leave:function(a,b){d.leave(a),b()}}}return c()}var h=f(),i=h("$animator"),j=h("$animate"),k={restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(c,f,h){return function(c,f,i){function j(){l&&(l.remove(),l=null),n&&(n.$destroy(),n=null),m&&(r.leave(m,function(){l=null}),l=m,m=null)}function k(g){var k,l=z(c,i,f,e),s=l&&a.$current&&a.$current.locals[l];if(g||s!==o){k=c.$new(),o=a.$current.locals[l];var t=h(k,function(a){r.enter(a,f,function(){n&&n.$emit("$viewContentAnimationEnded"),(b.isDefined(q)&&!q||c.$eval(q))&&d(a)}),j()});m=t,n=k,n.$emit("$viewContentLoaded"),n.$eval(p)}}var l,m,n,o,p=i.onload||"",q=i.autoscroll,r=g(i,c);c.$on("$stateChangeSuccess",function(){k(!1)}),c.$on("$viewContentLoading",function(){k(!1)}),k(!0)}}};return k}function y(a,b,c,d){return{restrict:"ECA",priority:-400,compile:function(e){var f=e.html();return function(e,g,h){var i=c.$current,j=z(e,h,g,d),k=i&&i.locals[j];if(k){g.data("$uiView",{name:j,state:k.$$state}),g.html(k.$template?k.$template:f);var l=a(g.contents());if(k.$$controller){k.$scope=e;var m=b(k.$$controller,k);k.$$controllerAs&&(e[k.$$controllerAs]=m),g.data("$ngControllerController",m),g.children().data("$ngControllerController",m)}l(e)}}}}}function z(a,b,c,d){var e=d(b.uiView||b.name||"")(a),f=c.inheritedData("$uiView");return e.indexOf("@")>=0?e:e+"@"+(f?f.state.name:"")}function A(a,b){var c,d=a.match(/^\s*({[^}]*})\s*$/);if(d&&(a=b+"("+d[1]+")"),c=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!c||4!==c.length)throw new Error("Invalid state ref '"+a+"'");return{state:c[1],paramExpr:c[3]||null}}function B(a){var b=a.parent().inheritedData("$uiView");return b&&b.state&&b.state.name?b.state:void 0}function C(a,c){var d=["location","inherit","reload"];return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(e,f,g,h){var i=A(g.uiSref,a.current.name),j=null,k=B(f)||a.$current,l=null,m="A"===f.prop("tagName"),n="FORM"===f[0].nodeName,o=n?"action":"href",p=!0,q={relative:k,inherit:!0},r=e.$eval(g.uiSrefOpts)||{};b.forEach(d,function(a){a in r&&(q[a]=r[a])});var s=function(c){if(c&&(j=b.copy(c)),p){l=a.href(i.state,j,q);var d=h[1]||h[0];return d&&d.$$setStateInfo(i.state,j),null===l?(p=!1,!1):void g.$set(o,l)}};i.paramExpr&&(e.$watch(i.paramExpr,function(a){a!==j&&s(a)},!0),j=b.copy(e.$eval(i.paramExpr))),s(),n||f.bind("click",function(b){var d=b.which||b.button;if(!(d>1||b.ctrlKey||b.metaKey||b.shiftKey||f.attr("target"))){var e=c(function(){a.go(i.state,j,q)});b.preventDefault();var g=m&&!l?1:0;b.preventDefault=function(){g--<=0&&c.cancel(e)}}})}}}function D(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs",function(b,d,e){function f(){g()?d.addClass(j):d.removeClass(j)}function g(){return"undefined"!=typeof e.uiSrefActiveEq?h&&a.is(h.name,i):h&&a.includes(h.name,i)}var h,i,j;j=c(e.uiSrefActiveEq||e.uiSrefActive||"",!1)(b),this.$$setStateInfo=function(b,c){h=a.get(b,B(d)),i=c,f()},b.$on("$stateChangeSuccess",f)}]}}function E(a){var b=function(b){return a.is(b)};return b.$stateful=!0,b}function F(a){var b=function(b){return a.includes(b)};return b.$stateful=!0,b}var G=b.isDefined,H=b.isFunction,I=b.isString,J=b.isObject,K=b.isArray,L=b.forEach,M=b.extend,N=b.copy;b.module("ui.router.util",["ng"]),b.module("ui.router.router",["ui.router.util"]),b.module("ui.router.state",["ui.router.router","ui.router.util"]),b.module("ui.router",["ui.router.state"]),b.module("ui.router.compat",["ui.router"]),o.$inject=["$q","$injector"],b.module("ui.router.util").service("$resolve",o),p.$inject=["$http","$templateCache","$injector"],b.module("ui.router.util").service("$templateFactory",p);var O;q.prototype.concat=function(a,b){var c={caseInsensitive:O.caseInsensitive(),strict:O.strictMode(),squash:O.defaultSquashPolicy()};return new q(this.sourcePath+a+this.sourceSearch,M(c,b),this)},q.prototype.toString=function(){return this.source},q.prototype.exec=function(a,b){function c(a){function b(a){return a.split("").reverse().join("")}function c(a){return a.replace(/\\-/,"-")}var d=b(a).split(/-(?!\\)/),e=n(d,b);return n(e,c).reverse()}var d=this.regexp.exec(a);if(!d)return null;b=b||{};var e,f,g,h=this.parameters(),i=h.length,j=this.segments.length-1,k={};if(j!==d.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");for(e=0;j>e;e++){g=h[e];var l=this.params[g],m=d[e+1];for(f=0;f<l.replace;f++)l.replace[f].from===m&&(m=l.replace[f].to);m&&l.array===!0&&(m=c(m)),k[g]=l.value(m)}for(;i>e;e++)g=h[e],k[g]=this.params[g].value(b[g]);return k},q.prototype.parameters=function(a){return G(a)?this.params[a]||null:this.$$paramNames},q.prototype.validates=function(a){return this.params.$$validates(a)},q.prototype.format=function(a){function b(a){return encodeURIComponent(a).replace(/-/g,function(a){return"%5C%"+a.charCodeAt(0).toString(16).toUpperCase()})}a=a||{};var c=this.segments,d=this.parameters(),e=this.params;if(!this.validates(a))return null;var f,g=!1,h=c.length-1,i=d.length,j=c[0];for(f=0;i>f;f++){var k=h>f,l=d[f],m=e[l],o=m.value(a[l]),p=m.isOptional&&m.type.equals(m.value(),o),q=p?m.squash:!1,r=m.type.encode(o);if(k){var s=c[f+1];if(q===!1)null!=r&&(j+=K(r)?n(r,b).join("-"):encodeURIComponent(r)),j+=s;else if(q===!0){var t=j.match(/\/$/)?/\/?(.*)/:/(.*)/;j+=s.match(t)[1]}else I(q)&&(j+=q+s)}else{if(null==r||p&&q!==!1)continue;K(r)||(r=[r]),r=n(r,encodeURIComponent).join("&"+l+"="),j+=(g?"&":"?")+(l+"="+r),g=!0}}return j},r.prototype.is=function(){return!0},r.prototype.encode=function(a){return a},r.prototype.decode=function(a){return a},r.prototype.equals=function(a,b){return a==b},r.prototype.$subPattern=function(){var a=this.pattern.toString();return a.substr(1,a.length-2)},r.prototype.pattern=/.*/,r.prototype.toString=function(){return"{Type:"+this.name+"}"},r.prototype.$asArray=function(a,b){function d(a,b){function d(a,b){return function(){return a[b].apply(a,arguments)}}function e(a){return K(a)?a:G(a)?[a]:[]}function f(a){switch(a.length){case 0:return c;case 1:return"auto"===b?a[0]:a;default:return a}}function g(a){return!a}function h(a,b){return function(c){c=e(c);var d=n(c,a);return b===!0?0===m(d,g).length:f(d)}}function i(a){return function(b,c){var d=e(b),f=e(c);if(d.length!==f.length)return!1;for(var g=0;g<d.length;g++)if(!a(d[g],f[g]))return!1;return!0}}this.encode=h(d(a,"encode")),this.decode=h(d(a,"decode")),this.is=h(d(a,"is"),!0),this.equals=i(d(a,"equals")),this.pattern=a.pattern,this.$arrayMode=b}if(!a)return this;if("auto"===a&&!b)throw new Error("'auto' array mode is for query parameters only");return new d(this,a)},b.module("ui.router.util").provider("$urlMatcherFactory",s),b.module("ui.router.util").run(["$urlMatcherFactory",function(){}]),t.$inject=["$locationProvider","$urlMatcherFactoryProvider"],b.module("ui.router.router").provider("$urlRouter",t),u.$inject=["$urlRouterProvider","$urlMatcherFactoryProvider"],b.module("ui.router.state").value("$stateParams",{}).provider("$state",u),v.$inject=[],b.module("ui.router.state").provider("$view",v),b.module("ui.router.state").provider("$uiViewScroll",w),x.$inject=["$state","$injector","$uiViewScroll","$interpolate"],y.$inject=["$compile","$controller","$state","$interpolate"],b.module("ui.router.state").directive("uiView",x),b.module("ui.router.state").directive("uiView",y),C.$inject=["$state","$timeout"],D.$inject=["$state","$stateParams","$interpolate"],b.module("ui.router.state").directive("uiSref",C).directive("uiSrefActive",D).directive("uiSrefActiveEq",D),E.$inject=["$state"],F.$inject=["$state"],b.module("ui.router.state").filter("isState",E).filter("includedByState",F)}(window,window.angular);
/*
* angular-css-injector v1.0.3
* Written by Gabriel Delépine
* Special thanks to (github users) : @kleiinnn
* License: MIT
* https://github.com/Yappli/angular-css-injector/
*/
angular.module('angular.css.injector', [])
.provider('cssInjector', function() {
	var singlePageMode = false;
	
	function CssInjector($compile, $rootScope){
        // Variables
        var singlePageMode = false,
            head = angular.element(document.getElementsByTagName('head')[0]),
            scope;  
        
        // Capture the event `locationChangeStart` when the url change. If singlePageMode===TRUE, call the function `removeAll`
        $rootScope.$on('$locationChangeStart', function()
        {
            if(singlePageMode === true)
                removeAll();
        });
        
        // Always called by the functions `addStylesheet` and `removeAll` to initialize the variable `scope`
        var _initScope = function()
        {
            if(scope === undefined)
            {
                if((scope = head.scope()) === undefined) // We initialise head's scope in a separated function because it is not defined at the time of the initialisation of the service.
                    throw("angular.css.injector error : Please initialize your app in the HTML tag and be sure your page has a HEAD tag.");
            }
        };
        
        // Used to add a CSS files in the head tag of the page
        var addStylesheet = function(href)
        {
            _initScope();
            
            if(scope.injectedStylesheets === undefined)
            {
                scope.injectedStylesheets = [];
                head.append($compile("<link data-ng-repeat='stylesheet in injectedStylesheets' data-ng-href='{{stylesheet.href}}' rel='stylesheet' />")(scope)); // Found here : http://stackoverflow.com/a/11913182/1662766
            }
            else
            {
                for(var i in scope.injectedStylesheets)
                {
                    if(scope.injectedStylesheets[i].href == href) // An url can't be added more than once. I use a loop FOR, not the function indexOf to make the code IE < 9 compatible
                        return;
                }
            }
            
            scope.injectedStylesheets.push({href: href});
        };
        
        // Used to remove all of the CSS files added with the function `addStylesheet`
        var removeAll = function()
        {
            _initScope();
            
            if(scope.injectedStylesheets !== undefined)
                scope.injectedStylesheets = []; // Make it empty
        };
		
        return {
            add: addStylesheet,
            removeAll: removeAll
        };
	}
	
	this.$get = function($compile, $rootScope){
		return new CssInjector($compile, $rootScope);
	};
	
	this.setSinglePageMode = function(mode){
		singlePageMode = mode;
		return this;
	}
});

/*! angularjs-scorm-wrapper 26-05-2016 */
var scormwrapper=angular.module("scormwrapper",[]);scormwrapper.service("scormWrapper",function(){"use strict";var a="Auto",b=!1,c=["Auto","1.2","2004"];this.setAPIVersion=function(b){b=b||"Auto";var d=c.indexOf(b.toString());return d>-1?a=c[d]:console.log("Not found, default to Auto"),a},this.getAPIVersion=function(){return a},this.isAvailable=function(){return!0},this.doLMSInitialize=function(){return this.cmiBooleanToJs(this.getAPICall("LMSInitialize","Initialize")(""))},this.doLMSFinish=function(){return this.cmiBooleanToJs(this.getAPICall("LMSFinish","Terminate")(""))},this.doLMSGetValue=function(a){return this.getAPICall("LMSGetValue","GetValue")(a)},this.doLMSSetValue=function(a,b){return this.cmiBooleanToJs(this.getAPICall("LMSSetValue","SetValue")(a,b))},this.doLMSCommit=function(){return this.cmiBooleanToJs(this.getAPICall("LMSCommit","Commit")(""))},this.doLMSGetLastError=function(){return this.getAPICall("LMSGetLastError","GetLastError")()},this.doLMSGetErrorString=function(a){return this.getAPICall("LMSGetErrorString","GetErrorString")(a.toString())},this.doLMSGetDiagnostic=function(a){return this.getAPICall("LMSGetDiagnostic","GetDiagnostic")(a.toString())},this.LMSIsInitialized=function(){return b},this.ErrorHandler=function(){return this.getAPICall("LMSGetLastError","GetLastError")()},this.cmiBooleanToJs=function(a){return"1"===a||1===a||"true"===a||a===!0},this.getAPIHandle=function(){var a=window;a.parent&&a.parent!=a&&this.findAPI(a.parent),!b&&a.top.opener?this.findAPI(a.top.opener):b||console.log("Unable to find API adapter")},this.findAPI=function(c){var d=0,e=500;for(d;e>d;d++){if(c.API&&("1.2"===a||"Auto"===a)){b=c.API,a="1.2";break}if(c.API_1484_11&&("2004"===a||"Auto"===a)){b=c.API_1484_11,a="2004";break}c.parent&&c.parent!=c&&(d++,c=c.parent)}},this.getAPICall=function(c,d){if(!b&&(this.getAPIHandle(),!b))return function(){console.log("No API found, can't execute: "+c+" or "+d)};switch(a){case"2004":return function(){return b[d].apply(b,arguments)};case"1.2":return function(){return b[c].apply(b,arguments)}}}});
!function(e){"use strict";if(e.URL=e.URL||e.webkitURL,e.Blob&&e.URL)try{return new Blob}catch(e){}var a=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||function(e){function s(e){return Object.prototype.toString.call(e).match(/^\[object\s(.*)\]$/)[1]}function t(){this.data=[]}function c(e,t,n){this.data=e,this.size=e.length,this.type=t,this.encoding=n}function l(e){this.code=this[this.name=e]}var n=t.prototype,o=c.prototype,d=e.FileReaderSync,r="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),i=r.length,a=e.URL||e.webkitURL||e,u=a.createObjectURL,p=a.revokeObjectURL,f=a,h=e.btoa,g=e.atob,m=e.ArrayBuffer,v=e.Uint8Array,b=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(c.fake=o.fake=!0;i--;)l.prototype[r[i]]=i+1;return a.createObjectURL||(f=e.URL=function(e){var t,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");return n.href=e,"origin"in n||("data:"===n.protocol.toLowerCase()?n.origin=null:(t=e.match(b),n.origin=t&&t[1])),n}),f.createObjectURL=function(e){var t,n=e.type;return null===n&&(n="application/octet-stream"),e instanceof c?(t="data:"+n,"base64"===e.encoding?t+";base64,"+e.data:"URI"===e.encoding?t+","+decodeURIComponent(e.data):h?t+";base64,"+h(e.data):t+","+encodeURIComponent(e.data)):u?u.call(a,e):void 0},f.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&p&&p.call(a,e)},n.append=function(e){var t=this.data;if(v&&(e instanceof m||e instanceof v)){for(var n="",o=new v(e),r=0,i=o.length;r<i;r++)n+=String.fromCharCode(o[r]);t.push(n)}else if("Blob"===s(e)||"File"===s(e)){if(!d)throw new l("NOT_READABLE_ERR");var a=new d;t.push(a.readAsBinaryString(e))}else e instanceof c?"base64"===e.encoding&&g?t.push(g(e.data)):"URI"===e.encoding?t.push(decodeURIComponent(e.data)):"raw"===e.encoding&&t.push(e.data):("string"!=typeof e&&(e+=""),t.push(unescape(encodeURIComponent(e))))},n.getBlob=function(e){return arguments.length||(e=null),new c(this.data.join(""),e,"raw")},n.toString=function(){return"[object BlobBuilder]"},o.slice=function(e,t,n){var o=arguments.length;return o<3&&(n=null),new c(this.data.slice(e,1<o?t:this.data.length),n,this.encoding)},o.toString=function(){return"[object Blob]"},o.close=function(){this.size=0,delete this.data},t}(e);e.Blob=function(e,t){var n=t&&t.type||"",o=new a;if(e)for(var r=0,i=e.length;r<i;r++)o.append(e[r]);return o.getBlob(n)}}(void 0!==self&&self||"undefined"!=typeof window&&window||this.content||this);var CryptoJS=CryptoJS||function(s){function n(){}var e={},t=e.lib={},o=t.Base={extend:function(e){n.prototype=this;var t=new n;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),(t.init.prototype=t).$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=t.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||i).stringify(this)},concat:function(e){var t=this.words,n=e.words,o=this.sigBytes;if(e=e.sigBytes,this.clamp(),o%4)for(var r=0;r<e;r++)t[o+r>>>2]|=(n[r>>>2]>>>24-r%4*8&255)<<24-(o+r)%4*8;else if(65535<n.length)for(r=0;r<e;r+=4)t[o+r>>>2]=n[r>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=s.ceil(t/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(4294967296*s.random()|0);return new c.init(t,e)}}),r=e.enc={},i=r.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],o=0;o<e;o++){var r=t[o>>>2]>>>24-o%4*8&255;n.push((r>>>4).toString(16)),n.push((15&r).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o+=2)n[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%8*4;return new c.init(n,t/2)}},a=r.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],o=0;o<e;o++)n.push(String.fromCharCode(t[o>>>2]>>>24-o%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>2]|=(255&e.charCodeAt(o))<<24-o%4*8;return new c.init(n,t)}},l=r.Utf8={stringify:function(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return a.parse(unescape(encodeURIComponent(e)))}},d=t.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,n=t.words,o=t.sigBytes,r=this.blockSize,i=o/(4*r);if(e=(i=e?s.ceil(i):s.max((0|i)-this._minBufferSize,0))*r,o=s.min(4*e,o),e){for(var a=0;a<e;a+=r)this._doProcessBlock(n,a);a=n.splice(0,e),t.sigBytes-=o}return new c.init(a,o)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});t.Hasher=d.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(n){return function(e,t){return new n.init(t).finalize(e)}},_createHmacHelper:function(n){return function(e,t){return new u.HMAC.init(n,t).finalize(e)}}});var u=e.algo={};return e}(Math);function UAParser(){this.ua="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:"",this.UNKNOWN="?",this.OBJ_TYPE="object",this.STR_TYPE="string",this.NAME="name",this.VERSION="version",this.BLACKBERRY="BlackBerry",this.BROWSER="Browser",this.CHROME="Chrome",this.FIREFOX="Firefox",this.OPERA="Opera",this.oldSafariMap={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},this.windowsVersionMap={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},this.regexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[this.NAME,this.VERSION],[/opios[\/ ]+([\w\.]+)/i],[this.VERSION,[this.NAME,this.OPERA+" Mini"]],[/\bopr\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.OPERA]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[this.NAME,this.VERSION],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[this.VERSION,[this.NAME,"UC"+this.BROWSER]],[/\bqbcore\/([\w\.]+)/i],[this.VERSION,[this.NAME,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[this.VERSION,[this.NAME,"WeChat"]],[/konqueror\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[this.VERSION,[this.NAME,"IE"]],[/yabrowser\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[this.NAME,/(.+)/,"$1 Secure "+this.BROWSER],this.VERSION],[/\bfocus\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.FIREFOX+" Focus"]],[/\bopt\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.OPERA+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Dolphin"]],[/coast\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.OPERA+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[this.VERSION,[this.NAME,"MIUI "+this.BROWSER]],[/fxios\/([-\w\.]+)/i],[this.VERSION,[this.NAME,this.FIREFOX]],[/\bqihu|(qi?ho?o?|360)browser/i],[[this.NAME,"360 "+this.BROWSER]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[this.NAME,/(.+)/,"$1 "+this.BROWSER],this.VERSION],[/(comodo_dragon)\/([\w\.]+)/i],[[this.NAME,/_/g," "],this.VERSION],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[this.NAME,this.VERSION],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[this.NAME],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[this.NAME,"Facebook"],this.VERSION],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[this.NAME,this.VERSION],[/\bgsa\/([\w\.]+) .*safari\//i],[this.VERSION,[this.NAME,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[this.VERSION,[this.NAME,this.CHROME+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[this.NAME,this.CHROME+" WebView"],this.VERSION],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[this.VERSION,[this.NAME,"Android "+this.BROWSER]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[this.NAME,this.VERSION],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[this.VERSION,[this.NAME,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[this.VERSION,this.NAME],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[this.NAME,[this.VERSION,this.strMapper,this.oldSafariMap]],[/(webkit|khtml)\/([\w\.]+)/i],[this.NAME,this.VERSION],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[this.NAME,"Netscape"],this.VERSION],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[this.VERSION,[this.NAME,this.FIREFOX+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[this.NAME,this.VERSION]],os:[[/microsoft (windows) (vista|xp)/i],[this.NAME,this.VERSION],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[this.NAME,[this.VERSION,this.strMapper,this.windowsVersionMap]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[this.NAME,"Windows"],[this.VERSION,this.strMapper,this.windowsVersionMap]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[this.VERSION,/_/g,"."],[this.NAME,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[this.NAME,"Mac OS"],[this.VERSION,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[this.VERSION,this.NAME],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[this.NAME,this.VERSION],[/\(bb(10);/i],[this.VERSION,[this.NAME,this.BLACKBERRY]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[this.VERSION,[this.NAME,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.FIREFOX+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[this.VERSION,[this.NAME,"webOS"]],[/crkey\/([\d\.]+)/i],[this.VERSION,[this.NAME,this.CHROME+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[this.NAME,"Chromium OS"],this.VERSION],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[this.NAME,this.VERSION],[/(sunos) ?([\w\.\d]*)/i],[[this.NAME,"Solaris"],this.VERSION],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[this.NAME,this.VERSION]]},this.has=function(e,t){return typeof e===this.STR_TYPE&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},this.strMapper=function(e,t){for(var n in t)if(typeof t[n]===this.OBJ_TYPE&&0<t[n].length){for(var o=0;o<t[n].length;o++)if(this.has(t[n][o],e))return n===this.UNKNOWN?void 0:n}else if(this.has(t[n],e))return n===this.UNKNOWN?void 0:n;return e},this.rgxMapper=function(e,t,n){for(var o,r,i,a,s,c,l=0;l<n.length&&!s;){var d=n[l],u=n[l+1];for(o=r=0;o<d.length&&!s;)if(s=d[o++].exec(t))for(i=0;i<u.length;i++)c=s[++r],typeof(a=u[i])===this.OBJ_TYPE&&0<a.length?2==a.length?"function"==typeof a[1]?e[a[0]]=a[1].call(e,c):e[a[0]]=a[1]:3==a.length?"function"!=typeof a[1]||a[1].exec&&a[1].test?e[a[0]]=c?c.replace(a[1],a[2]):void 0:e[a[0]]=c?a[1].call(e,c,a[2]):void 0:4==a.length&&(e[a[0]]=c?a[3].call(e,c.replace(a[1],a[2])):void 0):e[a]=c||void 0;l+=2}},this.getBrowserDetails=function(){var e={name:void 0,version:void 0};return this.rgxMapper(e,this.ua,this.regexes.browser),e},this.getOSDetails=function(){var e={name:void 0,version:void 0};return this.rgxMapper(e,this.ua,this.regexes.os),e}}!function(){var e=CryptoJS,c=e.lib.WordArray;e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,o=this._map;e.clamp(),e=[];for(var r=0;r<n;r+=3)for(var i=(t[r>>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,a=0;a<4&&r+.75*a<n;a++)e.push(o.charAt(i>>>6*(3-a)&63));if(t=o.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var t=e.length,n=this._map;!(o=n.charAt(64))||-1!=(o=e.indexOf(o))&&(t=o);for(var o=[],r=0,i=0;i<t;i++)if(i%4){var a=n.indexOf(e.charAt(i-1))<<i%4*2,s=n.indexOf(e.charAt(i))>>>6-i%4*2;o[r>>>2]|=(a|s)<<24-r%4*8,r++}return c.create(o,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(i){function C(e,t,n,o,r,i,a){return((e=e+(t&n|~t&o)+r+a)<<i|e>>>32-i)+t}function I(e,t,n,o,r,i,a){return((e=e+(t&o|n&~o)+r+a)<<i|e>>>32-i)+t}function E(e,t,n,o,r,i,a){return((e=e+(t^n^o)+r+a)<<i|e>>>32-i)+t}function S(e,t,n,o,r,i,a){return((e=e+(n^(t|~o))+r+a)<<i|e>>>32-i)+t}for(var e=CryptoJS,t=(o=e.lib).WordArray,n=o.Hasher,o=e.algo,T=[],r=0;r<64;r++)T[r]=4294967296*i.abs(i.sin(r+1))|0;o=o.MD5=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var o=e[a=t+n];e[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}n=this._hash.words;var r,i,a=e[t+0],s=(o=e[t+1],e[t+2]),c=e[t+3],l=e[t+4],d=e[t+5],u=e[t+6],p=e[t+7],f=e[t+8],h=e[t+9],g=e[t+10],m=e[t+11],v=e[t+12],b=e[t+13],y=e[t+14],k=e[t+15],w=n[0],x=S(x=S(x=S(x=S(x=E(x=E(x=E(x=E(x=I(x=I(x=I(x=I(x=C(x=C(x=C(x=C(x=n[1],i=C(i=n[2],r=C(r=n[3],w=C(w,x,i,r,a,7,T[0]),x,i,o,12,T[1]),w,x,s,17,T[2]),r,w,c,22,T[3]),i=C(i,r=C(r,w=C(w,x,i,r,l,7,T[4]),x,i,d,12,T[5]),w,x,u,17,T[6]),r,w,p,22,T[7]),i=C(i,r=C(r,w=C(w,x,i,r,f,7,T[8]),x,i,h,12,T[9]),w,x,g,17,T[10]),r,w,m,22,T[11]),i=C(i,r=C(r,w=C(w,x,i,r,v,7,T[12]),x,i,b,12,T[13]),w,x,y,17,T[14]),r,w,k,22,T[15]),i=I(i,r=I(r,w=I(w,x,i,r,o,5,T[16]),x,i,u,9,T[17]),w,x,m,14,T[18]),r,w,a,20,T[19]),i=I(i,r=I(r,w=I(w,x,i,r,d,5,T[20]),x,i,g,9,T[21]),w,x,k,14,T[22]),r,w,l,20,T[23]),i=I(i,r=I(r,w=I(w,x,i,r,h,5,T[24]),x,i,y,9,T[25]),w,x,c,14,T[26]),r,w,f,20,T[27]),i=I(i,r=I(r,w=I(w,x,i,r,b,5,T[28]),x,i,s,9,T[29]),w,x,p,14,T[30]),r,w,v,20,T[31]),i=E(i,r=E(r,w=E(w,x,i,r,d,4,T[32]),x,i,f,11,T[33]),w,x,m,16,T[34]),r,w,y,23,T[35]),i=E(i,r=E(r,w=E(w,x,i,r,o,4,T[36]),x,i,l,11,T[37]),w,x,p,16,T[38]),r,w,g,23,T[39]),i=E(i,r=E(r,w=E(w,x,i,r,b,4,T[40]),x,i,a,11,T[41]),w,x,c,16,T[42]),r,w,u,23,T[43]),i=E(i,r=E(r,w=E(w,x,i,r,h,4,T[44]),x,i,v,11,T[45]),w,x,k,16,T[46]),r,w,s,23,T[47]),i=S(i,r=S(r,w=S(w,x,i,r,a,6,T[48]),x,i,p,10,T[49]),w,x,y,15,T[50]),r,w,d,21,T[51]),i=S(i,r=S(r,w=S(w,x,i,r,v,6,T[52]),x,i,c,10,T[53]),w,x,g,15,T[54]),r,w,o,21,T[55]),i=S(i,r=S(r,w=S(w,x,i,r,f,6,T[56]),x,i,k,10,T[57]),w,x,u,15,T[58]),r,w,b,21,T[59]),i=S(i,r=S(r,w=S(w,x,i,r,l,6,T[60]),x,i,m,10,T[61]),w,x,s,15,T[62]),r,w,h,21,T[63]);n[0]=n[0]+w|0,n[1]=n[1]+x|0,n[2]=n[2]+i|0,n[3]=n[3]+r|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;t[o>>>5]|=128<<24-o%32;var r=i.floor(n/4294967296);for(t[15+(o+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t[14+(o+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),t=(e=this._hash).words,n=0;n<4;n++)o=t[n],t[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8);return e},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),e.MD5=n._createHelper(o),e.HmacMD5=n._createHmacHelper(o)}(Math),function(){var e,t=CryptoJS,n=(e=t.lib).Base,l=e.WordArray,o=(e=t.algo).EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:e.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=(a=this.cfg).hasher.create(),o=l.create(),r=o.words,i=a.keySize,a=a.iterations;r.length<i;){s&&n.update(s);var s=n.update(e).finalize(t);n.reset();for(var c=1;c<a;c++)s=n.finalize(s),n.reset();o.concat(s)}return o.sigBytes=4*i,o}});t.EvpKDF=function(e,t,n){return o.create(n).compute(e,t)}}(),CryptoJS.lib.Cipher||function(){var e=(p=CryptoJS).lib,t=e.Base,a=e.WordArray,n=e.BufferedBlockAlgorithm,o=p.enc.Base64,r=p.algo.EvpKDF,i=e.Cipher=n.extend({cfg:t.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){n.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(o){return{encrypt:function(e,t,n){return("string"==typeof t?f:u).encrypt(o,e,t,n)},decrypt:function(e,t,n){return("string"==typeof t?f:u).decrypt(o,e,t,n)}}}});e.StreamCipher=i.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});function s(e,t,n){var o=this._iv;o?this._iv=void 0:o=this._prevBlock;for(var r=0;r<n;r++)e[t+r]^=o[r]}var c=p.mode={},l=(e.BlockCipherMode=t.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();l.Encryptor=l.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;s.call(this,e,t,o),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),l.Decryptor=l.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,r=e.slice(t,t+o);n.decryptBlock(e,t),s.call(this,e,t,o),this._prevBlock=r}}),c=c.CBC=l,l=(p.pad={}).Pkcs7={pad:function(e,t){for(var n,o=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,r=[],i=0;i<n;i+=4)r.push(o);n=a.create(r,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},e.BlockCipher=i.extend({cfg:i.cfg.extend({mode:c,padding:l}),reset:function(){i.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var d=e.CipherParams=t.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),u=(c=(p.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?a.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=a.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return d.create({ciphertext:e,salt:n})}},e.SerializableCipher=t.extend({cfg:t.extend({format:c}),encrypt:function(e,t,n,o){o=this.cfg.extend(o);var r=e.createEncryptor(n,o);return t=r.finalize(t),r=r.cfg,d.create({ciphertext:t,key:n,iv:r.iv,algorithm:e,mode:r.mode,padding:r.padding,blockSize:e.blockSize,formatter:o.format})},decrypt:function(e,t,n,o){return o=this.cfg.extend(o),t=this._parse(t,o.format),e.createDecryptor(n,o).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),p=(p.kdf={}).OpenSSL={execute:function(e,t,n,o){return o=o||a.random(8),e=r.create({keySize:t+n}).compute(e,o),n=a.create(e.words.slice(t),4*n),e.sigBytes=4*t,d.create({key:e,iv:n,salt:o})}},f=e.PasswordBasedCipher=u.extend({cfg:u.cfg.extend({kdf:p}),encrypt:function(e,t,n,o){return n=(o=this.cfg.extend(o)).kdf.execute(n,e.keySize,e.ivSize),o.iv=n.iv,(e=u.encrypt.call(this,e,t,n.key,o)).mixIn(n),e},decrypt:function(e,t,n,o){return o=this.cfg.extend(o),t=this._parse(t,o.format),n=o.kdf.execute(n,e.keySize,e.ivSize,t.salt),o.iv=n.iv,u.decrypt.call(this,e,t,n.key,o)}})}(),function(){for(var e=CryptoJS,t=e.lib.BlockCipher,n=e.algo,a=[],o=[],r=[],i=[],s=[],c=[],l=[],d=[],u=[],p=[],f=[],h=0;h<256;h++)f[h]=h<128?h<<1:h<<1^283;var g=0,m=0;for(h=0;h<256;h++){var v=(v=m^m<<1^m<<2^m<<3^m<<4)>>>8^255&v^99;a[g]=v;var b=f[o[v]=g],y=f[b],k=f[y],w=257*f[v]^16843008*v;r[g]=w<<24|w>>>8,i[g]=w<<16|w>>>16,s[g]=w<<8|w>>>24,c[g]=w,w=16843009*k^65537*y^257*b^16843008*g,l[v]=w<<24|w>>>8,d[v]=w<<16|w>>>16,u[v]=w<<8|w>>>24,p[v]=w,g?(g=b^f[f[f[k^b]]],m^=f[f[m]]):g=m=1}var x=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),o=this._keySchedule=[],r=0;r<n;r++)if(r<t)o[r]=e[r];else{var i=o[r-1];r%t?6<t&&4==r%t&&(i=a[i>>>24]<<24|a[i>>>16&255]<<16|a[i>>>8&255]<<8|a[255&i]):(i=a[(i=i<<8|i>>>24)>>>24]<<24|a[i>>>16&255]<<16|a[i>>>8&255]<<8|a[255&i],i^=x[r/t|0]<<24),o[r]=o[r-t]^i}for(e=this._invKeySchedule=[],t=0;t<n;t++)r=n-t,i=t%4?o[r]:o[r-4],e[t]=t<4||r<=4?i:l[a[i>>>24]]^d[a[i>>>16&255]]^u[a[i>>>8&255]]^p[a[255&i]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,r,i,s,c,a)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,d,u,p,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,o,r,i,a,s){for(var c=this._nRounds,l=e[t]^n[0],d=e[t+1]^n[1],u=e[t+2]^n[2],p=e[t+3]^n[3],f=4,h=1;h<c;h++){var g=o[l>>>24]^r[d>>>16&255]^i[u>>>8&255]^a[255&p]^n[f++],m=o[d>>>24]^r[u>>>16&255]^i[p>>>8&255]^a[255&l]^n[f++],v=o[u>>>24]^r[p>>>16&255]^i[l>>>8&255]^a[255&d]^n[f++];p=o[p>>>24]^r[l>>>16&255]^i[d>>>8&255]^a[255&u]^n[f++],l=g,d=m,u=v}g=(s[l>>>24]<<24|s[d>>>16&255]<<16|s[u>>>8&255]<<8|s[255&p])^n[f++],m=(s[d>>>24]<<24|s[u>>>16&255]<<16|s[p>>>8&255]<<8|s[255&l])^n[f++],v=(s[u>>>24]<<24|s[p>>>16&255]<<16|s[l>>>8&255]<<8|s[255&d])^n[f++],p=(s[p>>>24]<<24|s[l>>>16&255]<<16|s[d>>>8&255]<<8|s[255&u])^n[f++],e[t]=g,e[t+1]=m,e[t+2]=v,e[t+3]=p},keySize:8});e.AES=t._createHelper(n)}(),function(e,t){"object"==typeof exports?module.exports=exports=t(require("./core")):"function"==typeof define&&define.amd?define(["./core"],t):t(e.CryptoJS)}(this,function(c){return function(r){var e=c,t=e.lib,n=t.WordArray,o=t.Hasher,i=e.algo,a=[],y=[];!function(){function e(e){for(var t=r.sqrt(e),n=2;n<=t;n++)if(!(e%n))return!1;return!0}function t(e){return 0|4294967296*(e-(0|e))}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(a[o]=t(r.pow(n,.5))),y[o]=t(r.pow(n,1/3)),o++),n++}();var k=[],s=i.SHA256=o.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,o=n[0],r=n[1],i=n[2],a=n[3],s=n[4],c=n[5],l=n[6],d=n[7],u=0;u<64;u++){if(u<16)k[u]=0|e[t+u];else{var p=k[u-15],f=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,h=k[u-2],g=(h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10;k[u]=f+k[u-7]+g+k[u-16]}var m=o&r^o&i^r&i,v=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22),b=d+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&l)+y[u]+k[u];d=l,l=c,c=s,s=0|a+b,a=i,i=r,r=o,o=0|b+(v+m)}n[0]=0|n[0]+o,n[1]=0|n[1]+r,n[2]=0|n[2]+i,n[3]=0|n[3]+a,n[4]=0|n[4]+s,n[5]=0|n[5]+c,n[6]=0|n[6]+l,n[7]=0|n[7]+d},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return t[o>>>5]|=128<<24-o%32,t[14+(64+o>>>9<<4)]=r.floor(n/4294967296),t[15+(64+o>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=o._createHelper(s),e.HmacSHA256=o._createHmacHelper(s)}(Math),c.SHA256}),function(e,t,n){"use strict";"undefined"!=typeof module&&module.exports?module.exports=n():"function"==typeof define&&define.amd?define(n):t.Fingerprint2=n()}(0,this,function(){"use strict";Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var n;if(null==this)throw new TypeError("'this' is null or undefined");var o=Object(this),r=o.length>>>0;if(0==r)return-1;var i=+t||0;if(Math.abs(i)===1/0&&(i=0),r<=i)return-1;for(n=Math.max(0<=i?i:r-Math.abs(i),0);n<r;){if(n in o&&o[n]===e)return n;n++}return-1});function e(e){this.options=this.extend(e,{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:!0,sortPluginsFor:[/palemoon/i]}),this.nativeForEach=Array.prototype.forEach,this.nativeMap=Array.prototype.map}return e.prototype={extend:function(e,t){if(null==e)return t;for(var n in e)null!=e[n]&&t[n]!==e[n]&&(t[n]=e[n]);return t},log:function(e){window.console},get:function(o){var e=[];e=this.userAgentKey(e),e=this.languageKey(e),e=this.colorDepthKey(e),e=this.screenResolutionKey(e),e=this.availableScreenResolutionKey(e),e=this.timezoneOffsetKey(e),e=this.sessionStorageKey(e),e=this.localStorageKey(e),e=this.indexedDbKey(e),e=this.addBehaviorKey(e),e=this.openDatabaseKey(e),e=this.cpuClassKey(e),e=this.platformKey(e),e=this.doNotTrackKey(e),e=this.pluginsKey(e),e=this.canvasKey(e),e=this.webglKey(e),e=this.adBlockKey(e),e=this.hasLiedLanguagesKey(e),e=this.hasLiedResolutionKey(e),e=this.hasLiedOsKey(e),e=this.hasLiedBrowserKey(e),e=this.touchSupportKey(e);var r=this;this.fontsKey(e,function(e){var n=[];r.each(e,function(e){var t=e.value;e.value&&(void 0!==e.value.join&&(t=e.value.join(";")),n.push(t))});var t=r.x64hash128(n.join("~~~"),31);return o(t,e)})},userAgentKey:function(e){return this.options.excludeUserAgent||e.push({key:"user_agent",value:this.getUserAgent()}),e},getUserAgent:function(){return navigator.userAgent},languageKey:function(e){return this.options.excludeLanguage||e.push({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage}),e},colorDepthKey:function(e){return this.options.excludeColorDepth||e.push({key:"color_depth",value:screen.colorDepth}),e},screenResolutionKey:function(e){return this.options.excludeScreenResolution?e:this.getScreenResolution(e)},getScreenResolution:function(e){var t;return void 0!==(t=this.options.detectScreenOrientation&&screen.height>screen.width?[screen.height,screen.width]:[screen.width,screen.height])&&e.push({key:"resolution",value:t}),e},availableScreenResolutionKey:function(e){return this.options.excludeAvailableScreenResolution?e:this.getAvailableScreenResolution(e)},getAvailableScreenResolution:function(e){var t;return screen.availWidth&&screen.availHeight&&(t=this.options.detectScreenOrientation?screen.availHeight>screen.availWidth?[screen.availHeight,screen.availWidth]:[screen.availWidth,screen.availHeight]:[screen.availHeight,screen.availWidth]),void 0!==t&&e.push({key:"available_resolution",value:t}),e},timezoneOffsetKey:function(e){return this.options.excludeTimezoneOffset||e.push({key:"timezone_offset",value:(new Date).getTimezoneOffset()}),e},sessionStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasSessionStorage()&&e.push({key:"session_storage",value:1}),e},localStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasLocalStorage()&&e.push({key:"local_storage",value:1}),e},indexedDbKey:function(e){return!this.options.excludeIndexedDB&&this.hasIndexedDB()&&e.push({key:"indexed_db",value:1}),e},addBehaviorKey:function(e){return document.body&&!this.options.excludeAddBehavior&&document.body.addBehavior&&e.push({key:"add_behavior",value:1}),e},openDatabaseKey:function(e){return!this.options.excludeOpenDatabase&&window.openDatabase&&e.push({key:"open_database",value:1}),e},cpuClassKey:function(e){return this.options.excludeCpuClass||e.push({key:"cpu_class",value:this.getNavigatorCpuClass()}),e},platformKey:function(e){return this.options.excludePlatform||e.push({key:"navigator_platform",value:this.getNavigatorPlatform()}),e},doNotTrackKey:function(e){return this.options.excludeDoNotTrack||e.push({key:"do_not_track",value:this.getDoNotTrack()}),e},canvasKey:function(e){return!this.options.excludeCanvas&&this.isCanvasSupported()&&e.push({key:"canvas",value:this.getCanvasFp()}),e},webglKey:function(e){return this.options.excludeWebGL?"undefined"==typeof NODEBUG&&this.log("Skipping WebGL fingerprinting per excludeWebGL configuration option"):this.isWebGlSupported()?e.push({key:"webgl",value:this.getWebglFp()}):"undefined"==typeof NODEBUG&&this.log("Skipping WebGL fingerprinting because it is not supported in this browser"),e},adBlockKey:function(e){return this.options.excludeAdBlock||e.push({key:"adblock",value:this.getAdBlock()}),e},hasLiedLanguagesKey:function(e){return this.options.excludeHasLiedLanguages||e.push({key:"has_lied_languages",value:this.getHasLiedLanguages()}),e},hasLiedResolutionKey:function(e){return this.options.excludeHasLiedResolution||e.push({key:"has_lied_resolution",value:this.getHasLiedResolution()}),e},hasLiedOsKey:function(e){return this.options.excludeHasLiedOs||e.push({key:"has_lied_os",value:this.getHasLiedOs()}),e},hasLiedBrowserKey:function(e){return this.options.excludeHasLiedBrowser||e.push({key:"has_lied_browser",value:this.getHasLiedBrowser()}),e},fontsKey:function(e,t){return this.options.excludeJsFonts?this.flashFontsKey(e,t):this.jsFontsKey(e,t)},flashFontsKey:function(t,n){return this.options.excludeFlashFonts?("undefined"==typeof NODEBUG&&this.log("Skipping flash fonts detection per excludeFlashFonts configuration option"),n(t)):this.hasSwfObjectLoaded()?this.hasMinFlashInstalled()?void 0===this.options.swfPath?("undefined"==typeof NODEBUG&&this.log("To use Flash fonts detection, you must pass a valid swfPath option, skipping Flash fonts enumeration"),n(t)):void this.loadSwfAndDetectFonts(function(e){t.push({key:"swf_fonts",value:e.join(";")}),n(t)}):("undefined"==typeof NODEBUG&&this.log("Flash is not installed, skipping Flash fonts enumeration"),n(t)):("undefined"==typeof NODEBUG&&this.log("Swfobject is not detected, Flash fonts enumeration is skipped"),n(t))},jsFontsKey:function(p,f){var h=this;return setTimeout(function(){var i=["monospace","sans-serif","serif"],a=document.getElementsByTagName("body")[0],s=document.createElement("span");s.style.fontSize="72px",s.innerHTML="mmmmmmmmmmlli";for(var c={},l={},e=0,t=i.length;e<t;e++)s.style.fontFamily=i[e],a.appendChild(s),c[i[e]]=s.offsetWidth,l[i[e]]=s.offsetHeight,a.removeChild(s);function n(e){for(var t=!1,n=0,o=i.length;n<o;n++){s.style.fontFamily=e+","+i[n],a.appendChild(s);var r=s.offsetWidth!==c[i[n]]||s.offsetHeight!==l[i[n]];a.removeChild(s),t=t||r}return t}var o=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Garamond","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"];h.options.extendedJsFonts&&(o=o.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"]));for(var r=[],d=0,u=o.length;d<u;d++)n(o[d])&&r.push(o[d]);p.push({key:"js_fonts",value:r}),f(p)},1)},pluginsKey:function(e){return this.options.excludePlugins||(this.isIE()?e.push({key:"ie_plugins",value:this.getIEPlugins()}):e.push({key:"regular_plugins",value:this.getRegularPlugins()})),e},getRegularPlugins:function(){for(var e=[],t=0,n=navigator.plugins.length;t<n;t++)e.push(navigator.plugins[t]);return this.pluginsShouldBeSorted()&&(e=e.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),this.map(e,function(e){var t=this.map(e,function(e){return[e.type,e.suffixes].join("~")}).join(",");return[e.name,e.description,t].join("::")},this)},getIEPlugins:function(){var e=[];if(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window){e=this.map(["AcroPDF.PDF","Adodb.Stream","AgControl.AgControl","DevalVRXCtrl.DevalVRXCtrl.1","MacromediaFlashPaper.MacromediaFlashPaper","Msxml2.DOMDocument","Msxml2.XMLHTTP","PDF.PdfCtrl","QuickTime.QuickTime","QuickTimeCheckObject.QuickTimeCheck.1","RealPlayer","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"],function(e){try{return new ActiveXObject(e),e}catch(e){return null}})}return navigator.plugins&&(e=e.concat(this.getRegularPlugins())),e},pluginsShouldBeSorted:function(){for(var e=!1,t=0,n=this.options.sortPluginsFor.length;t<n;t++){var o=this.options.sortPluginsFor[t];if(navigator.userAgent.match(o)){e=!0;break}}return e},touchSupportKey:function(e){return this.options.excludeTouchSupport||e.push({key:"touch_support",value:this.getTouchSupport()}),e},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},hasLocalStorage:function(){try{return!!window.localStorage}catch(e){return!0}},hasIndexedDB:function(){return!!window.indexedDB},getNavigatorCpuClass:function(){return navigator.cpuClass?navigator.cpuClass:"unknown"},getNavigatorPlatform:function(){return navigator.platform?navigator.platform:"unknown"},getDoNotTrack:function(){return navigator.doNotTrack?navigator.doNotTrack:"unknown"},getTouchSupport:function(){var e=0,t=!1;void 0!==navigator.maxTouchPoints?e=navigator.maxTouchPoints:void 0!==navigator.msMaxTouchPoints&&(e=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){}return[e,t,"ontouchstart"in window]},getCanvasFp:function(){var e=[],t=document.createElement("canvas");t.width=2e3,t.height=200,t.style.display="inline";var n=t.getContext("2d");return n.rect(0,0,10,10),n.rect(2,2,6,6),e.push("canvas winding:"+(!1===n.isPointInPath(5,5,"evenodd")?"yes":"no")),n.textBaseline="alphabetic",n.fillStyle="#f60",n.fillRect(125,1,62,20),n.fillStyle="#069",this.options.dontUseFakeFontInCanvas?n.font="11pt Arial":n.font="11pt no-real-font-123",n.fillText("Cwm fjordbank glyphs vext quiz, 😃",2,15),n.fillStyle="rgba(102, 204, 0, 0.7)",n.font="18pt Arial",n.fillText("Cwm fjordbank glyphs vext quiz, 😃",4,45),n.globalCompositeOperation="multiply",n.fillStyle="rgb(255,0,255)",n.beginPath(),n.arc(50,50,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(0,255,255)",n.beginPath(),n.arc(100,50,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(255,255,0)",n.beginPath(),n.arc(75,100,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(255,0,255)",n.arc(75,75,75,0,2*Math.PI,!0),n.arc(75,75,25,0,2*Math.PI,!0),n.fill("evenodd"),e.push("canvas fp:"+t.toDataURL()),e.join("~")},getWebglFp:function(){function e(e){return t.clearColor(0,0,0,1),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),"["+e[0]+", "+e[1]+"]"}var t;if(!(t=this.getWebglCanvas()))return null;var n=[],o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o);var r=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW),o.itemSize=3,o.numItems=3;var i=t.createProgram(),a=t.createShader(t.VERTEX_SHADER);t.shaderSource(a,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),t.compileShader(a);var s,c,l,d=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(d,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),t.compileShader(d),t.attachShader(i,a),t.attachShader(i,d),t.linkProgram(i),t.useProgram(i),i.vertexPosAttrib=t.getAttribLocation(i,"attrVertex"),i.offsetUniform=t.getUniformLocation(i,"uniformOffset"),t.enableVertexAttribArray(i.vertexPosArray),t.vertexAttribPointer(i.vertexPosAttrib,o.itemSize,t.FLOAT,!1,0,0),t.uniform2f(i.offsetUniform,1,1),t.drawArrays(t.TRIANGLE_STRIP,0,o.numItems),null!=t.canvas&&n.push(t.canvas.toDataURL()),n.push("extensions:"+t.getSupportedExtensions().join(";")),n.push("webgl aliased line width range:"+e(t.getParameter(t.ALIASED_LINE_WIDTH_RANGE))),n.push("webgl aliased point size range:"+e(t.getParameter(t.ALIASED_POINT_SIZE_RANGE))),n.push("webgl alpha bits:"+t.getParameter(t.ALPHA_BITS)),n.push("webgl antialiasing:"+(t.getContextAttributes().antialias?"yes":"no")),n.push("webgl blue bits:"+t.getParameter(t.BLUE_BITS)),n.push("webgl depth bits:"+t.getParameter(t.DEPTH_BITS)),n.push("webgl green bits:"+t.getParameter(t.GREEN_BITS)),n.push("webgl max anisotropy:"+((l=(s=t).getExtension("EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic"))?(0===(c=s.getParameter(l.MAX_TEXTURE_MAX_ANISOTROPY_EXT))&&(c=2),c):null)),n.push("webgl max combined texture image units:"+t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),n.push("webgl max cube map texture size:"+t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE)),n.push("webgl max fragment uniform vectors:"+t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS)),n.push("webgl max render buffer size:"+t.getParameter(t.MAX_RENDERBUFFER_SIZE)),n.push("webgl max texture image units:"+t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)),n.push("webgl max texture size:"+t.getParameter(t.MAX_TEXTURE_SIZE)),n.push("webgl max varying vectors:"+t.getParameter(t.MAX_VARYING_VECTORS)),n.push("webgl max vertex attribs:"+t.getParameter(t.MAX_VERTEX_ATTRIBS)),n.push("webgl max vertex texture image units:"+t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),n.push("webgl max vertex uniform vectors:"+t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS)),n.push("webgl max viewport dims:"+e(t.getParameter(t.MAX_VIEWPORT_DIMS))),n.push("webgl red bits:"+t.getParameter(t.RED_BITS)),n.push("webgl renderer:"+t.getParameter(t.RENDERER)),n.push("webgl shading language version:"+t.getParameter(t.SHADING_LANGUAGE_VERSION)),n.push("webgl stencil bits:"+t.getParameter(t.STENCIL_BITS)),n.push("webgl vendor:"+t.getParameter(t.VENDOR)),n.push("webgl version:"+t.getParameter(t.VERSION)),t.getShaderPrecisionFormat?(n.push("webgl vertex shader high float precision:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision),n.push("webgl vertex shader high float precision rangeMin:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).rangeMin),n.push("webgl vertex shader high float precision rangeMax:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).rangeMax),n.push("webgl vertex shader medium float precision:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision),n.push("webgl vertex shader medium float precision rangeMin:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).rangeMin),n.push("webgl vertex shader medium float precision rangeMax:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).rangeMax),n.push("webgl vertex shader low float precision:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.LOW_FLOAT).precision),n.push("webgl vertex shader low float precision rangeMin:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.LOW_FLOAT).rangeMin),n.push("webgl vertex shader low float precision rangeMax:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.LOW_FLOAT).rangeMax),n.push("webgl fragment shader high float precision:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision),n.push("webgl fragment shader high float precision rangeMin:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).rangeMin),n.push("webgl fragment shader high float precision rangeMax:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).rangeMax),n.push("webgl fragment shader medium float precision:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision),n.push("webgl fragment shader medium float precision rangeMin:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).rangeMin),n.push("webgl fragment shader medium float precision rangeMax:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).rangeMax),n.push("webgl fragment shader low float precision:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.LOW_FLOAT).precision),n.push("webgl fragment shader low float precision rangeMin:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.LOW_FLOAT).rangeMin),n.push("webgl fragment shader low float precision rangeMax:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.LOW_FLOAT).rangeMax),n.push("webgl vertex shader high int precision:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_INT).precision),n.push("webgl vertex shader high int precision rangeMin:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_INT).rangeMin),n.push("webgl vertex shader high int precision rangeMax:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_INT).rangeMax),n.push("webgl vertex shader medium int precision:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_INT).precision),n.push("webgl vertex shader medium int precision rangeMin:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_INT).rangeMin),n.push("webgl vertex shader medium int precision rangeMax:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_INT).rangeMax),n.push("webgl vertex shader low int precision:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.LOW_INT).precision),n.push("webgl vertex shader low int precision rangeMin:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.LOW_INT).rangeMin),n.push("webgl vertex shader low int precision rangeMax:"+t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.LOW_INT).rangeMax),n.push("webgl fragment shader high int precision:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_INT).precision),n.push("webgl fragment shader high int precision rangeMin:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_INT).rangeMin),n.push("webgl fragment shader high int precision rangeMax:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_INT).rangeMax),n.push("webgl fragment shader medium int precision:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_INT).precision),n.push("webgl fragment shader medium int precision rangeMin:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_INT).rangeMin),n.push("webgl fragment shader medium int precision rangeMax:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_INT).rangeMax),n.push("webgl fragment shader low int precision:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.LOW_INT).precision),n.push("webgl fragment shader low int precision rangeMin:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.LOW_INT).rangeMin),n.push("webgl fragment shader low int precision rangeMax:"+t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.LOW_INT).rangeMax)):"undefined"==typeof NODEBUG&&this.log("WebGL fingerprinting is incomplete, because your browser does not support getShaderPrecisionFormat"),n.join("~")},getAdBlock:function(){var e=document.createElement("div");e.setAttribute("id","ads");try{return document.body.appendChild(e),!document.getElementById("ads")}catch(e){return!1}},getHasLiedLanguages:function(){if(void 0!==navigator.languages)try{if(navigator.languages[0].substr(0,2)!==navigator.language.substr(0,2))return!0}catch(e){return!0}return!1},getHasLiedResolution:function(){return screen.width<screen.availWidth||screen.height<screen.availHeight},getHasLiedOs:function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.oscpu,o=navigator.platform.toLowerCase();if(e=0<=t.indexOf("windows phone")?"Windows Phone":0<=t.indexOf("win")?"Windows":0<=t.indexOf("android")?"Android":0<=t.indexOf("linux")?"Linux":0<=t.indexOf("iphone")||0<=t.indexOf("ipad")?"iOS":0<=t.indexOf("mac")?"Mac":"Other",("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints)&&"Windows Phone"!==e&&"Android"!==e&&"iOS"!==e&&"Other"!==e)return!0;if(void 0!==n){if(0<=(n=n.toLowerCase()).indexOf("win")&&"Windows"!==e&&"Windows Phone"!==e)return!0;if(0<=n.indexOf("linux")&&"Linux"!==e&&"Android"!==e)return!0;if(0<=n.indexOf("mac")&&"Mac"!==e&&"iOS"!==e)return!0;if(0===n.indexOf("win")&&0===n.indexOf("linux")&&0<=n.indexOf("mac")&&"other"!==e)return!0}return 0<=o.indexOf("win")&&"Windows"!==e&&"Windows Phone"!==e||((0<=o.indexOf("linux")||0<=o.indexOf("android")||0<=o.indexOf("pike"))&&"Linux"!==e&&"Android"!==e||((0<=o.indexOf("mac")||0<=o.indexOf("ipad")||0<=o.indexOf("ipod")||0<=o.indexOf("iphone"))&&"Mac"!==e&&"iOS"!==e||(0===o.indexOf("win")&&0===o.indexOf("linux")&&0<=o.indexOf("mac")&&"other"!==e||void 0===navigator.plugins&&"Windows"!==e&&"Windows Phone"!==e)))},getHasLiedBrowser:function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.productSub;if(("Chrome"===(e=0<=t.indexOf("firefox")?"Firefox":0<=t.indexOf("opera")||0<=t.indexOf("opr")?"Opera":0<=t.indexOf("chrome")?"Chrome":0<=t.indexOf("safari")?"Safari":0<=t.indexOf("trident")?"Internet Explorer":"Other")||"Safari"===e||"Opera"===e)&&"20030107"!==n)return!0;var o,r=eval.toString().length;if(37===r&&"Safari"!==e&&"Firefox"!==e&&"Other"!==e)return!0;if(39===r&&"Internet Explorer"!==e&&"Other"!==e)return!0;if(33===r&&"Chrome"!==e&&"Opera"!==e&&"Other"!==e)return!0;try{throw"a"}catch(e){try{e.toSource(),o=!0}catch(e){o=!1}}return!(!o||"Firefox"===e||"Other"===e)},isCanvasSupported:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},isWebGlSupported:function(){if(!this.isCanvasSupported())return!1;var t,e=document.createElement("canvas");try{t=e.getContext&&(e.getContext("webgl")||e.getContext("experimental-webgl"))}catch(e){t=!1}return!!window.WebGLRenderingContext&&!!t},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},hasSwfObjectLoaded:function(){return void 0!==window.swfobject},hasMinFlashInstalled:function(){return swfobject.hasFlashPlayerVersion("9.0.0")},addFlashDivNode:function(){var e=document.createElement("div");e.setAttribute("id",this.options.swfContainerId),document.body.appendChild(e)},loadSwfAndDetectFonts:function(t){var e="___fp_swf_loaded";window[e]=function(e){t(e)};var n=this.options.swfContainerId;this.addFlashDivNode();var o={onReady:e};swfobject.embedSWF(this.options.swfPath,n,"1","1","9.0.0",!1,o,{allowScriptAccess:"always",menu:"false"},{})},getWebglCanvas:function(){var e=document.createElement("canvas"),t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}return t=t||null},each:function(e,t,n){if(null!==e)if(this.nativeForEach&&e.forEach===this.nativeForEach)e.forEach(t,n);else if(e.length===+e.length){for(var o=0,r=e.length;o<r;o++)if(t.call(n,e[o],o,e)==={})return}else for(var i in e)if(e.hasOwnProperty(i)&&t.call(n,e[i],i,e)==={})return},map:function(e,o,r){var i=[];return null==e?i:this.nativeMap&&e.map===this.nativeMap?e.map(o,r):(this.each(e,function(e,t,n){i[i.length]=o.call(r,e,t,n)}),i)},x64Add:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},x64Multiply:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},x64Rotl:function(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])},x64LeftShift:function(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]},x64Xor:function(e,t){return[e[0]^t[0],e[1]^t[1]]},x64Fmix:function(e){return e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[4283543511,3981806797]),e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[3301882366,444984403]),e=this.x64Xor(e,[0,e[0]>>>1])},x64hash128:function(e,t){t=t||0;for(var n=(e=e||"").length%16,o=e.length-n,r=[0,t],i=[0,t],a=[0,0],s=[0,0],c=[2277735313,289559509],l=[1291169091,658871167],d=0;d<o;d+=16)a=[255&e.charCodeAt(d+4)|(255&e.charCodeAt(d+5))<<8|(255&e.charCodeAt(d+6))<<16|(255&e.charCodeAt(d+7))<<24,255&e.charCodeAt(d)|(255&e.charCodeAt(d+1))<<8|(255&e.charCodeAt(d+2))<<16|(255&e.charCodeAt(d+3))<<24],s=[255&e.charCodeAt(d+12)|(255&e.charCodeAt(d+13))<<8|(255&e.charCodeAt(d+14))<<16|(255&e.charCodeAt(d+15))<<24,255&e.charCodeAt(d+8)|(255&e.charCodeAt(d+9))<<8|(255&e.charCodeAt(d+10))<<16|(255&e.charCodeAt(d+11))<<24],a=this.x64Multiply(a,c),a=this.x64Rotl(a,31),a=this.x64Multiply(a,l),r=this.x64Xor(r,a),r=this.x64Rotl(r,27),r=this.x64Add(r,i),r=this.x64Add(this.x64Multiply(r,[0,5]),[0,1390208809]),s=this.x64Multiply(s,l),s=this.x64Rotl(s,33),s=this.x64Multiply(s,c),i=this.x64Xor(i,s),i=this.x64Rotl(i,31),i=this.x64Add(i,r),i=this.x64Add(this.x64Multiply(i,[0,5]),[0,944331445]);switch(a=[0,0],s=[0,0],n){case 15:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(d+14)],48));case 14:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(d+13)],40));case 13:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(d+12)],32));case 12:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(d+11)],24));case 11:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(d+10)],16));case 10:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(d+9)],8));case 9:s=this.x64Xor(s,[0,e.charCodeAt(d+8)]),s=this.x64Multiply(s,l),s=this.x64Rotl(s,33),s=this.x64Multiply(s,c),i=this.x64Xor(i,s);case 8:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(d+7)],56));case 7:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(d+6)],48));case 6:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(d+5)],40));case 5:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(d+4)],32));case 4:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(d+3)],24));case 3:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(d+2)],16));case 2:a=this.x64Xor(a,this.x64LeftShift([0,e.charCodeAt(d+1)],8));case 1:a=this.x64Xor(a,[0,e.charCodeAt(d)]),a=this.x64Multiply(a,c),a=this.x64Rotl(a,31),a=this.x64Multiply(a,l),r=this.x64Xor(r,a)}return r=this.x64Xor(r,[0,e.length]),i=this.x64Xor(i,[0,e.length]),r=this.x64Add(r,i),i=this.x64Add(i,r),r=this.x64Fmix(r),i=this.x64Fmix(i),r=this.x64Add(r,i),i=this.x64Add(i,r),("00000000"+(r[0]>>>0).toString(16)).slice(-8)+("00000000"+(r[1]>>>0).toString(16)).slice(-8)+("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)}},e.VERSION="1.1.1",e}),window.Modernizr=function(e,n,i){function o(e){h.cssText=e}function a(e,t){return typeof e===t}function r(e,t){return!!~(""+e).indexOf(t)}function s(e,t){for(var n in e){var o=e[n];if(!r(o,"-")&&h[o]!==i)return"pfx"!=t||o}return!1}function t(e,t,n){var o=e.charAt(0).toUpperCase()+e.slice(1),r=(e+" "+v.join(o+" ")+o).split(" ");return a(t,"string")||a(t,"undefined")?s(r,t):function(e,t,n){for(var o in e){var r=t[e[o]];if(r!==i)return!1===n?e[o]:a(r,"function")?r.bind(n||t):r}return!1}(r=(e+" "+b.join(o+" ")+o).split(" "),t,n)}var c,l,d={},u=n.documentElement,p="modernizr",f=n.createElement(p),h=f.style,g=" -webkit- -moz- -o- -ms- ".split(" "),m="Webkit Moz O ms",v=m.split(" "),b=m.toLowerCase().split(" "),y={},k=[],w=k.slice,x={}.hasOwnProperty;for(var C in l=a(x,"undefined")||a(x.call,"undefined")?function(e,t){return t in e&&a(e.constructor.prototype[t],"undefined")}:function(e,t){return x.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(o){var r=this;if("function"!=typeof r)throw new TypeError;var i=w.call(arguments,1),a=function(){if(this instanceof a){function e(){}e.prototype=r.prototype;var t=new e,n=r.apply(t,i.concat(w.call(arguments)));return Object(n)===n?n:t}return r.apply(o,i.concat(w.call(arguments)))};return a}),y.canvas=function(){var e=n.createElement("canvas");return!!e.getContext&&!!e.getContext("2d")},y.rgba=function(){return o("background-color:rgba(150,255,150,.5)"),r(h.backgroundColor,"rgba")},y.backgroundsize=function(){return t("backgroundSize")},y.borderradius=function(){return t("borderRadius")},y.opacity=function(){return function(e,t){o(g.join(e+";")+(t||""))}("opacity:.55"),/^0.55$/.test(h.opacity)},y.video=function(){var e=n.createElement("video"),t=!1;try{(t=!!e.canPlayType)&&((t=new Boolean(t)).ogg=e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),t.h264=e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),t.webm=e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""))}catch(e){}return t},y.audio=function(){var e=n.createElement("audio"),t=!1;try{(t=!!e.canPlayType)&&((t=new Boolean(t)).ogg=e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),t.mp3=e.canPlayType("audio/mpeg;").replace(/^no$/,""),t.wav=e.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),t.m4a=(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(e){}return t},y.localstorage=function(){try{return localStorage.setItem(p,p),localStorage.removeItem(p),!0}catch(e){return!1}},y)l(y,C)&&(c=C.toLowerCase(),d[c]=y[C](),k.push((d[c]?"":"no-")+c));return d.addTest=function(e,t){if("object"==typeof e)for(var n in e)l(e,n)&&d.addTest(n,e[n]);else{if(e=e.toLowerCase(),d[e]!==i)return d;t="function"==typeof t?t():t,u.className+=" "+(t?"":"no-")+e,d[e]=t}return d},o(""),f=null,function(e,a){function s(){var e=h.elements;return"string"==typeof e?e.split(" "):e}function c(e){var t=f[e[u]];return t||(t={},p++,e[u]=p,f[p]=t),t}function o(e,t,n){return t=t||a,l?t.createElement(e):!(o=(n=n||c(t)).cache[e]?n.cache[e].cloneNode():d.test(e)?(n.cache[e]=n.createElem(e)).cloneNode():n.createElem(e)).canHaveChildren||i.test(e)||o.tagUrn?o:n.frag.appendChild(o);var o}function t(e){var t=c(e=e||a);return!h.shivCSS||n||t.hasCSS||(t.hasCSS=!!function(e,t){var n=e.createElement("p"),o=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",o.insertBefore(n.lastChild,o.firstChild)}(e,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||function(t,n){n.cache||(n.cache={},n.createElem=t.createElement,n.createFrag=t.createDocumentFragment,n.frag=n.createFrag()),t.createElement=function(e){return h.shivMethods?o(e,t,n):n.createElem(e)},t.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+s().join().replace(/[\w\-]+/g,function(e){return n.createElem(e),n.frag.createElement(e),'c("'+e+'")'})+");return n}")(h,n.frag)}(e,t),e}var n,l,r=e.html5||{},i=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,d=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,u="_html5shiv",p=0,f={};!function(){try{var e=a.createElement("a");e.innerHTML="<xyz></xyz>",n="hidden"in e,l=1==e.childNodes.length||function(){a.createElement("a");var e=a.createDocumentFragment();return void 0===e.cloneNode||void 0===e.createDocumentFragment||void 0===e.createElement}()}catch(e){l=n=!0}}();var h={elements:r.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==r.shivCSS,supportsUnknownElements:l,shivMethods:!1!==r.shivMethods,type:"default",shivDocument:t,createElement:o,createDocumentFragment:function(e,t){if(e=e||a,l)return e.createDocumentFragment();for(var n=(t=t||c(e)).frag.cloneNode(),o=0,r=s(),i=r.length;o<i;o++)n.createElement(r[o]);return n}};e.html5=h,t(a)}(this,n),d._version="2.8.3",d._prefixes=g,d._domPrefixes=b,d._cssomPrefixes=v,d.testProp=function(e){return s([e])},d.testAllProps=t,u.className=u.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+" js "+k.join(" "),d}(0,this.document),function(e,p){function u(e){return"[object Function]"==r.call(e)}function f(e){return"string"==typeof e}function h(){}function g(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e}function m(){var e=k.shift();w=1,e?e.t?b(function(){("c"==e.t?v.injectCss:v.injectJs)(e.s,0,e.a,e.x,e.e,1)},0):(e(),m()):w=0}function t(e,t,n,o,r){return w=0,t=t||"j",f(e)?function(n,o,e,t,r,i,a){function s(e){if(!l&&g(c.readyState)&&(u.r=l=1,w||m(),c.onload=c.onreadystatechange=null,e))for(var t in"img"!=n&&b(function(){C.removeChild(c)},50),E[o])E[o].hasOwnProperty(t)&&E[o][t].onload()}a=a||v.errorTimeout;var c=p.createElement(n),l=0,d=0,u={t:e,s:o,e:r,a:i,x:a};1===E[o]&&(d=1,E[o]=[]),"object"==n?c.data=o:(c.src=o,c.type=n),c.width=c.height="0",c.onerror=c.onload=c.onreadystatechange=function(){s.call(this,d)},k.splice(t,0,u),"img"!=n&&(d||2===E[o]?(C.insertBefore(c,x?null:y),b(s,a)):E[o].push(c))}("c"==t?c:a,e,t,this.i++,n,o,r):(k.splice(this.i++,0,e),1==k.length&&m()),this}function s(){var e=v;return e.loader={load:t,i:0},e}var n,v,o=p.documentElement,b=e.setTimeout,y=p.getElementsByTagName("script")[0],r={}.toString,k=[],w=0,i="MozAppearance"in o.style,x=i&&!!p.createRange().compareNode,C=x?o:y.parentNode,a=(o=e.opera&&"[object Opera]"==r.call(e.opera),o=!!p.attachEvent&&!o,i?"object":o?"script":"img"),c=o?"script":a,l=Array.isArray||function(e){return"[object Array]"==r.call(e)},I=[],E={},S={timeout:function(e,t){return t.length&&(e.timeout=t[0]),e}};(v=function(e){function d(e,t,n,o,r){var i=function(e){e=e.split("!");var t,n,o,r=I.length,i=e.pop(),a=e.length;for(i={url:i,origUrl:i,prefixes:e},n=0;n<a;n++)o=e[n].split("="),(t=S[o.shift()])&&(i=t(i,o));for(n=0;n<r;n++)i=I[n](i);return i}(e),a=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(t=t&&(u(t)?t:t[e]||t[o]||t[e.split("/").pop().split("?")[0]]),i.instead?i.instead(e,t,n,o,r):(E[i.url]?i.noexec=!0:E[i.url]=1,n.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":void 0,i.noexec,i.attrs,i.timeout),(u(t)||u(a))&&n.load(function(){s(),t&&t(i.origUrl,r,o),a&&a(i.origUrl,r,o),E[i.url]=2})))}function t(e,t){function n(n,e){if(n){if(f(n))e||(s=function(){var e=[].slice.call(arguments);c.apply(this,e),l()}),d(n,s,t,0,i);else if(Object(n)===n)for(r in o=function(){var e,t=0;for(e in n)n.hasOwnProperty(e)&&t++;return t}(),n)n.hasOwnProperty(r)&&(e||--o||(u(s)?s=function(){var e=[].slice.call(arguments);c.apply(this,e),l()}:s[r]=function(t){return function(){var e=[].slice.call(arguments);t&&t.apply(this,e),l()}}(c[r])),d(n[r],s,t,r,i))}else e||l()}var o,r,i=!!e.test,a=e.load||e.both,s=e.callback||h,c=s,l=e.complete||h;n(i?e.yep:e.nope,!!a),a&&n(a)}var n,o,r=this.yepnope.loader;if(f(e))d(e,0,r,0);else if(l(e))for(n=0;n<e.length;n++)f(o=e[n])?d(o,0,r,0):l(o)?v(o):Object(o)===o&&t(o,r);else Object(e)===e&&t(e,r)}).addPrefix=function(e,t){S[e]=t},v.addFilter=function(e){I.push(e)},v.errorTimeout=1e4,null==p.readyState&&p.addEventListener&&(p.readyState="loading",p.addEventListener("DOMContentLoaded",n=function(){p.removeEventListener("DOMContentLoaded",n,0),p.readyState="complete"},0)),e.yepnope=s(),e.yepnope.executeStack=m,e.yepnope.injectJs=function(e,t,n,o,r,i){var a,s,c=p.createElement("script");o=o||v.errorTimeout;for(s in c.src=e,n)c.setAttribute(s,n[s]);t=i?m:t||h,c.onreadystatechange=c.onload=function(){!a&&g(c.readyState)&&(a=1,t(),c.onload=c.onreadystatechange=null)},b(function(){a||t(a=1)},o),r?c.onload():y.parentNode.insertBefore(c,y)},e.yepnope.injectCss=function(e,t,n,o,r,i){var a;o=p.createElement("link"),t=i?m:t||h;for(a in o.href=e,o.rel="stylesheet",o.type="text/css",n)o.setAttribute(a,n[a]);r||(y.parentNode.insertBefore(o,y),b(t,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};var self=this||{};try{!function(e){if("+"!==new e("q=%2B").get("q")||"+"!==new e({q:"+"}).get("q")||"+"!==new e([["q","+"]]).get("q")||"q=%0A"!==new e("q=\n").toString()||"q=+%26"!==new e({q:" &"}).toString()||"q=%25zx"!==new e({q:"%zx"}).toString())throw e;self.URLSearchParams=e}(URLSearchParams)}catch(e){!function(e,i,c){"use strict";var l=e.create,d=e.defineProperty,t=/[!'\(\)~]|%20|%00/g,n=/%(?![0-9a-fA-F]{2})/g,o=/\+/g,r={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"},a={append:function(e,t){f(this._ungap,e,t)},delete:function(e){delete this._ungap[e]},get:function(e){return this.has(e)?this._ungap[e][0]:null},getAll:function(e){return this.has(e)?this._ungap[e].slice(0):[]},has:function(e){return e in this._ungap},set:function(e,t){this._ungap[e]=[i(t)]},forEach:function(t,n){var o=this;for(var r in o._ungap)o._ungap[r].forEach(e,r);function e(e){t.call(n,e,i(r),o)}},toJSON:function(){return{}},toString:function(){var e=[];for(var t in this._ungap)for(var n=g(t),o=0,r=this._ungap[t];o<r.length;o++)e.push(n+"="+g(r[o]));return e.join("&")}};for(var s in a)d(u.prototype,s,{configurable:!0,writable:!0,value:a[s]});function u(e){var t=l(null);switch(d(this,"_ungap",{value:t}),!0){case!e:break;case"string"==typeof e:"?"===e.charAt(0)&&(e=e.slice(1));for(var n=e.split("&"),o=0,r=n.length;o<r;o++){var i=(a=n[o]).indexOf("=");-1<i?f(t,h(a.slice(0,i)),h(a.slice(i+1))):a.length&&f(t,h(a),"")}break;case c(e):for(o=0,r=e.length;o<r;o++){var a;f(t,(a=e[o])[0],a[1])}break;case"forEach"in e:e.forEach(p,t);break;default:for(var s in e)f(t,s,e[s])}}function p(e,t){f(this,t,e)}function f(e,t,n){var o=c(n)?n.join(","):n;t in e?e[t].push(o):e[t]=[o]}function h(e){return decodeURIComponent(e.replace(n,"%25").replace(o," "))}function g(e){return encodeURIComponent(e).replace(t,m)}function m(e){return r[e]}self.URLSearchParams=u}(Object,String,Array.isArray)}function getElementsByAttribute(e,t,n,o){for(var r,i,a="*"==t&&e.all?e.all:e.getElementsByTagName(t),s=new Array,c=void 0!==o?new RegExp("(^|\\s)"+o+"(\\s|$)","i"):null,l=0;l<a.length;l++)"string"==typeof(i=(r=a[l]).getAttribute&&r.getAttribute(n))&&0<i.length&&(void 0===o||c&&c.test(i))&&s.push(r);return s}function toggleClass(e,t){strHasClass(e.className,t)?removeClass(e,t):addClass(e,t)}function addRemoveClass(e,t,n){var o=e.className,r=!0;if(t)for(var i=0;i<t.length;i++)strHasClass(o,t[i])||(r=!1,o+=(""==o?"":" ")+t[i]);if(n)for(i=0;i<n.length;i++)strHasClass(o,n[i])&&(r=!1,o=strRemoveClass(o,n[i]));r||(e.className=o.trim())}function addClass(e,t){var n=e.className.trim();if(t instanceof Array){for(var o=!0,r=0;r<t.length;r++)strHasClass(n,t[r])||(o=!1,n+=(""==n?"":" ")+t[r]);if(o)return}else{if(strHasClass(n,t))return;n+=(""==n?"":" ")+t}e.className=n}function removeClass(e,t){var n=e.className;if(t instanceof Array){for(var o=!0,r=0;r<t.length;r++)strHasClass(n,t[r])&&(o=!1,n=strRemoveClass(n,t[r]));if(o)return}else{if(!strHasClass(n,t))return;n=strRemoveClass(n,t)}""==(n=n.trim())?e.removeAttribute("class"):e.className=n}function getClassThatStartsWith(e,t){for(var n=e.className.trim().split(" "),o=0;o<n.length;o++)if(-1<n[o].indexOf(t))return n[o]}function hasClass(e,t){var n=e.className;return e instanceof SVGElement&&(n=n.baseVal),strHasClass(n,t)}function strHasClass(e,t){for(var n=(e=e||"").trim().split(" "),o=0;o<n.length;o++)if(n[o]==t)return!0;return!1}function strRemoveClass(e,t){for(var n=(e=e||"").trim().split(" "),o=0;o<n.length;o++)n[o]==t&&(n[o]=null);return n.join(" ")}function shouldParse(e){if(!e.match(/^http[s]?:/g)&&0!=e.indexOf("/")&&0!=e.indexOf("#dontparse"))return!0}function removeElement(e){e&&e.parentNode&&e.parentNode.removeChild(e)}!function(m){var o=!1;try{o=!!Symbol.iterator}catch(e){}function e(e,t){var n=[];return e.forEach(t,n),o?n[Symbol.iterator]():{next:function(){var e=n.shift();return{done:void 0===e,value:e}}}}"forEach"in m||(m.forEach=function(n,o){var r=this,e=Object.create(null);this.toString().replace(/=[\s\S]*?(?:&|$)/g,"=").split("=").forEach(function(t){!t.length||t in e||(e[t]=r.getAll(t)).forEach(function(e){n.call(o,e,t,r)})})}),"keys"in m||(m.keys=function(){return e(this,function(e,t){this.push(t)})}),"values"in m||(m.values=function(){return e(this,function(e,t){this.push(e)})}),"entries"in m||(m.entries=function(){return e(this,function(e,t){this.push([t,e])})}),!o||Symbol.iterator in m||(m[Symbol.iterator]=m.entries),"sort"in m||(m.sort=function(){for(var e,t,n,o=this.entries(),r=o.next(),i=r.done,a=[],s=Object.create(null);!i;)t=(n=r.value)[0],a.push(t),t in s||(s[t]=[]),s[t].push(n[1]),i=(r=o.next()).done;for(a.sort(),e=0;e<a.length;e++)this.delete(a[e]);for(e=0;e<a.length;e++)t=a[e],this.append(t,s[t].shift())}),function(u){function p(e){var t=e.append;e.append=m.append,URLSearchParams.call(e,e._usp.search.slice(1)),e.append=t}function f(e,t){if(!(e instanceof t))throw new TypeError("'searchParams' accessed on an object that does not implement interface "+t.name)}function e(t){var n,o,r,e=t.prototype,i=g(e,"searchParams"),a=g(e,"href"),s=g(e,"search");function c(e,t){m.append.call(this,e,t),e=this.toString(),r.set.call(this._usp,e?"?"+e:"")}function l(e){m.delete.call(this,e),e=this.toString(),r.set.call(this._usp,e?"?"+e:"")}function d(e,t){m.set.call(this,e,t),e=this.toString(),r.set.call(this._usp,e?"?"+e:"")}!i&&s&&s.set&&(r=s,o=function(e,t){return e.append=c,e.delete=l,e.set=d,h(e,"_usp",{configurable:!0,writable:!0,value:t})},n=function(e,t){return h(e,"_searchParams",{configurable:!0,writable:!0,value:o(t,e)}),t},u.defineProperties(e,{href:{get:function(){return a.get.call(this)},set:function(e){var t=this._searchParams;a.set.call(this,e),t&&p(t)}},search:{get:function(){return s.get.call(this)},set:function(e){var t=this._searchParams;s.set.call(this,e),t&&p(t)}},searchParams:{get:function(){return f(this,t),this._searchParams||n(this,new URLSearchParams(this.search.slice(1)))},set:function(e){f(this,t),n(this,e)}}}))}var h=u.defineProperty,g=u.getOwnPropertyDescriptor;try{e(HTMLAnchorElement),/^function|object$/.test(typeof URL)&&URL.prototype&&e(URL)}catch(e){}}(Object)}(self.URLSearchParams.prototype,Object),function(e){"use strict";var t=e.prototype,i=t.parseFromString;try{if((new e).parseFromString("","text/html"))return}catch(e){}t.parseFromString=function(e,t){if(/^\s*text\/html\s*(?:;|$)/i.test(t)){var n,o=document.implementation.createHTMLDocument(""),r=o.documentElement;return r.innerHTML=e,n=r.firstElementChild,1===r.childElementCount&&"html"===n.localName.toLowerCase()&&o.replaceChild(n,r),o}return i.apply(this,arguments)}}(DOMParser),ph={removeHash:function(e){return-1==e.indexOf("#")?e:e.substring(0,e.lastIndexOf("#"))},getHash:function(e){if(0<=e.indexOf("#"))return e.substr(e.lastIndexOf("#")+1)},normalize:function(e){var t=ph.normalizedArray(e).join("/");return arguments.length&&"/"==e.substr(0,1)&&(t="file:///"+t),t},normalizedArray:function(e){for(var t=(e=e.replace(/\\/g,"/")).split("/"),n=t.length;n--;)t[n]?".."==t[n]&&0<n&&".."!=t[n-1]&&(t.splice(n,1),t.splice(n-1,1)):t.splice(n,1);return t[0].match(/http[s]?:$/g)&&(t[0]+="//"+t[1],t.splice(1,1)),t[0].match(/kotobee:$/g)&&(t[0]+="//"+t[1],t.splice(1,1)),"file:"==t[0]&&(t[0]+="///"+t[1],t.splice(1,1)),t},basename:function(e){if(-1==e.indexOf("/"))return e;var t=ph.normalizedArray(e);return t[t.length-1]},removeFilename:function(e){var t=ph.normalizedArray(e);return-1==t[t.length-1].indexOf(".")?e:(t.splice(t.length-1,1),t.join("/"))},removeExtension:function(e){if(-1==e.indexOf("."))return e;var t=e.split(".");return t.splice(t.length-1,1),t.join(".")},getExtension:function(e){if(-1==e.indexOf("."))return"";var t=e.split(".");return t[t.length-1]},dirname:function(e){if(-1==e.indexOf("/"))return e;var t=ph.normalizedArray(e);return 0<=t[t.length-1].indexOf(".")&&t.splice(t.length-1,1),1==t.length?t[0]:t[t.length-1]},relative:function(e,t){var n,o,r=ph.normalizedArray(e),i=ph.normalizedArray(t),a=new Array;for(0<=r[r.length-1].indexOf(".")&&r.splice(r.length-1,1),n=0;n<r.length&&r[n]==i[n];n++);for(o=n;o<r.length;o++)a.push("..");for(o=n;o<i.length;o++)a.push(i[o]);return a.join("/")},join:function(){for(var e=new Array,t=0;t<arguments.length;t++){var n=ph.normalizedArray(arguments[t]);t<arguments.length-1&&!isAbsoluteURLPath(n[n.length-1])&&0<=n[n.length-1].indexOf(".")&&n.splice(n.length-1,1),e=e.concat(n)}var o=ph.normalize(e.join("/"));return"/"==arguments[0].substr(0,1)&&(o=desktop?"file:////"+o:"/"+o),o},parent:function(e){e=ph.removeFilename(e);var t=ph.normalizedArray(e);t.splice(t.length-1,1);var n=t.join("/");return arguments.length&&"/"==e.substr(0,1)&&(n="/"+n),n}};var startDate=Date.now(),LoggerWorker;try{var loggerWorker=new Worker(rootDir+"js/app/workers/logger.js");loggerWorker.addEventListener("error",function(){loggerWorker=null},!1)}catch(e){}var kLog=function(e){if(debug){null==e&&(e="null"),debugDuration&&(e=Date.now()-startDate+" "+e);try{if(loggerWorker)return void loggerWorker.postMessage({func:"log",params:arguments})}catch(e){}try{console.log.apply(this,arguments)}catch(e){}}},log=kLog;function guid(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function randStr(e,t){return null==t&&(t="s"),t+Math.random().toString(36).substring(5).substr(0,e)}function getDateTime(){var e=new Date,t=e.getFullYear(),n=e.getMonth()+1,o=e.getDate(),r=e.getHours(),i=e.getMinutes(),a=e.getSeconds();if(1==n.toString().length)n="0"+n;if(1==o.toString().length)o="0"+o;if(1==r.toString().length)r="0"+r;if(1==i.toString().length)i="0"+i;if(1==a.toString().length)a="0"+a;return t+"/"+n+"/"+o+" "+r+":"+i+":"+a}function getFormData(e){e=e||{};var t=new FormData;for(var n in e)e[n]&&t.append(n,e[n]);return t}function newBlob(t,n){try{return new Blob([t],{type:n})}catch(e){if(window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,"TypeError"==e.name&&window.BlobBuilder){var o=new BlobBuilder;return o.append(t.buffer),o.getBlob(n)}if("InvalidStateError"==e.name)return new Blob([t.buffer],{type:n})}}var Base64Binary={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decodeArrayBuffer:function(e){var t=e.length/4*3,n=new ArrayBuffer(t);return this.decode(e,n),n},decode:function(e,t){var n,o,r,i,a,s,c,l=this._keyStr.indexOf(e.charAt(e.length-1)),d=this._keyStr.indexOf(e.charAt(e.length-2)),u=e.length/4*3;64==l&&u--,64==d&&u--;var p=0,f=0;for(n=t?new Uint8Array(t):new Uint8Array(u),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),p=0;p<u;p+=3)o=this._keyStr.indexOf(e.charAt(f++))<<2|(a=this._keyStr.indexOf(e.charAt(f++)))>>4,r=(15&a)<<4|(s=this._keyStr.indexOf(e.charAt(f++)))>>2,i=(3&s)<<6|(c=this._keyStr.indexOf(e.charAt(f++))),n[p]=o,64!=s&&(n[p+1]=r),64!=c&&(n[p+2]=i);return n}},currentIndex,currentVIndex;function clone(e){if(null==e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=clone(e[n]));return t}function rgb2hex(e){if(/^#[0-9A-F]{6}$/i.test(e))return e;function t(e){return("0"+parseInt(e).toString(16)).slice(-2)}return(e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+t(e[1])+t(e[2])+t(e[3]):void 0}function timeOut(e,t){var n=setInterval(function(){clearInterval(n),e()},t);return n}function wrapNode(e,t){var n=document.createRange();n.selectNode(e),n.surroundContents(document.createElement(t))}function wrapNodeFromTo(e,t,n,o){var r=document.createRange();r.setStart(e,n),r.setEnd(e,o),r.surroundContents(document.createElement(t))}function XMLEscape(e,t){for(var n="",o=0;o<e.length;o++){var r=e.charAt(o);n+="&"==r?"&amp;":"'"==r?t?"&apos;":"&#39;":r}return n}function replaceHTML(e,t){var n="string"==typeof e?document.getElementById(e):e,o=n.cloneNode(!1);return o.innerHTML=t,n.parentNode.replaceChild(o,n),o}function kTemplate(e){return mobile?(config.overflowScroll?"templates/mobileOverflow/":"templates/mobile/")+e:"templates/web/"+e}function arrayContainsProperty(e,t,n){for(var o=0;o<e.length;o++)if(e[o][t]==n)return!0;return!1}function cacheBust(e){if(desktop&&(0==e.indexOf("/")||0==e.indexOf("file://")||0==e.indexOf("chrome-extension://")))return e;var t="?";return 0<=e.indexOf("?")&&(t="&"),e+t+Math.floor(9999*Math.random())}function addPrefixedEvent(e,t,n){for(var o=["webkit","moz","MS","o",""],r=0;r<o.length;r++)o[r]||(t=t.toLowerCase()),e.addEventListener(o[r]+t,n,!1)}function removePrefixedEvent(e,t,n){for(var o=["webkit","moz","MS","o",""],r=0;r<o.length;r++)o[r]||(t=t.toLowerCase()),e.removeEventListener(o[r]+t,n,!1)}function redrawForChrome(e){e=e||document.body,-1!=navigator.userAgent.toLowerCase().indexOf("chrome")&&(e.style.display="inline-block",e.offsetHeight,e.style.display="")}function pauseVideoAndAudio(e){for(var t=(e=e||document).getElementsByTagName("audio"),n=t.length;n--;)try{t[n].pause()}catch(e){}var o=e.getElementsByTagName("video");for(n=o.length;n--;)try{o[n].pause()}catch(e){}}function isEmpty(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return JSON.stringify(e)===JSON.stringify({})}function asyncCheck(e,t,n,o){return e?o():(n.push(o),t.apply(this,n))}function autoprefixTransform(e,t){t=t||"",e.style.transform=e.style.msTransform=e.style.webkitTransform=e.style.mozTransform=t}function deleteTransform(e){e&&(e.style.transform=e.style.msTransform=e.style.webkitTransform=e.style.mozTransform=null)}function deleteTransformOrigin(e){e&&(e.style.transformOrigin=e.style.msTransformOrigin=e.style.webkitTransformOrigin=e.style.mozTransformOrigin=null)}function getChildIndex(e){for(var t=0;null!=(e=e.previousSibling);)t++;return t}function getFilteredChildIndex(e){for(var t=0;e=e.previousSibling;)"#text"!=e.nodeName&&8!=e.nodeType&&t++;return t}function autoprefixTransformOrigin(e,t){t=t||"",e.style.transformOrigin=e.style.msTransformOrigin=e.style.webkitTransformOrigin=e.style.mozTransformOrigin=t}function detectIE(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(0<t)return!0;if(0<e.indexOf("Trident/"))return!0;e.indexOf("Edge/");return!1}function getImgDataSrc(e,t){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){var e=new FileReader;e.onloadend=function(){t&&t(e.result)},e.readAsDataURL(n.response)},n.send()}function isAbsoluteURLPath(e){return 0==e.trim().indexOf("http://")||(0==e.trim().indexOf("https://")||(0==e.trim().indexOf("//")||(0==e.trim().indexOf("data:")||(0==e.trim().indexOf("file://")||(0==e.trim().indexOf("kotobee://")||(!!e.trim().match(/^[A-Z]:\//g)||void 0))))))}function isAbsoluteURLAndNotDataPath(e){return 0==e.trim().indexOf("http://")||(0==e.trim().indexOf("https://")||(0==e.trim().indexOf("//")||(0==e.trim().indexOf("file://")||(0==e.trim().indexOf("kotobee://")||void 0))))}function isKotobeeHosted(e){var t=(e=e||window.location.href).split("://");if(!(t.length<=1)){for(var n=t[1],o=["kotobee.com"],r=0;r<o.length;r++){if(0<=n.indexOf(o[r]+"/ebook"))return!0;if(0<=n.indexOf(o[r]+"/library"))return!0;if(0<=n.indexOf(o[r]+"/lti"))return!0}var i="kotobee.com";"undefined"!=typeof hostingDomain&&hostingDomain&&0==(i=hostingDomain.replace(/https?:\/\//g,"")).indexOf("www.")&&(i=i.substr(4)),"undefined"==typeof hostUrlMode&&(hostUrlMode="subdomain");var a="folder"==hostUrlMode?"":".";if(0<=e.indexOf(a+i)){if("folder"==hostUrlMode)return!0;var s=i.replace(".","\\."),c=new RegExp("https?:\\/\\/(.*?\\.)"+s+".*","g"),l=e.replace(c,"$1");if(l){var d=l.replace(/(.*?)\./g,"$1");if(0<=i.indexOf("kotobee.com")){if("www"==d)return!1;if("dev"==d)return!1;if("test"==d)return!1;if("qa"==d)return!1}else if("www"==d)return!1;return!0}}}}function decodeHTMLEntities(e){for(var t=[["amp","&"],["apos","'"],["#x27","'"],["#x2F","/"],["#39","'"],["#47","/"],["lt","<"],["gt",">"],["nbsp"," "],["quot",'"']],n=0,o=t.length;n<o;++n)e=e.replace(new RegExp("&"+t[n][0]+";","g"),t[n][1]);return e}function addFormHiddenInput(e,t,n){var o=document.createElement("input");o.setAttribute("name",e),o.setAttribute("type","hidden"),o.setAttribute("value",t),n.appendChild(o)}function getElemMargin(e,t){return getElemDim(e,"margin",t)}function getElemPadding(e,t){return getElemDim(e,"padding",t)}function getElemDim(e,t,n){var o={},r=(n=n||{}).computed?getComputedStyle(e):e.style;return o.left=r[t+"Left"].split("px")[0],o.right=r[t+"Right"].split("px")[0],"auto"==o.left?o.x="auto":"auto"==o.left?o.x="auto":o.x=Math.round(o.left)+Math.round(o.right),o.top=r[t+"Top"].split("px")[0],o.bottom=r[t+"Bottom"].split("px")[0],"auto"==o.top?o.y="auto":"auto"==o.bottom?o.y="auto":o.y=Math.round(o.top)+Math.round(o.bottom),o}function makeArrayUnique(e){for(var t=0;t<e.length;t++)for(var n=e[t],o=e.length;o--;)t!=o&&e[o].length+"  "+n.length&&e[o]==n&&e.splice(o,1);return e}function makeObjectArrayUnique(e){for(var t=0;t<e.length;t++)for(var n=e[t],o=e.length;o--;)t!=o&&e[o]&&n&&JSON.stringify(e[o])==JSON.stringify(n)&&e.splice(o,1);return e}function cloneNodeAttributes(e){var t=document.createElement(e.nodeName);return copyAttributes(e,t),t}function copyAttributes(e,t){for(var n=0;n<e.attributes.length;n++)t.setAttribute(e.attributes[n].name,e.attributes[n].value)}function getBoundingBox(e){if(3!=e.nodeType)return e.getBoundingClientRect();var t=document.createRange();t.selectNode(e);var n=t.getBoundingClientRect();return t.detach(),n}function parents(e,t){t=t||{};for(var n=[];e&&e&&(!t.stopAtId||e.id!=t.stopAtId);e=e.parentNode){if(t.stopAtIds){for(var o,r=0;r<t.stopAtIds.length;r++)if(e.id==t.stopAtIds[r]){o=!0;break}if(o)break}t.filterByClass&&!e.classList.contains(t.filterByClass)||n.unshift(e)}return n}function getCurrentTime(){return Math.floor(Date.now()/1e3)}function getQueryStringValue(e){var t=window.location.href.split("?");if(!(t.length<=1))for(var n=t[1].split("&"),o=0;o<n.length;o++){var r=n[o].split("=");if(r[0]==e)return r[1]}}function copyObjToObj(e,t,n){for(var o in n=n||{},e)n.onlyIfNotExists&&null!=t[o]||(t[o]=e[o])}function traverseToBottom(e,t){for(;e&&e.children.length;){if(t&&e.id==t)return e;e=e.children[0]}return e}function traverseToTop(e,t){for(;e&&e.parentNode;){if(t&&e.id==t)return e;e=e.parentNode}return!e||e.parentNode?null:e.id!=t?null:e}function traverseToTopWithClass(e,t){for(;e&&e.parentNode;){if(t&&e.classList.contains(t))return e;e=e.parentNode}return!e||e.parentNode?null:e.classList.contains(t)?e:null}function getDomainFromURL(e){var t=new URL(e);return t.protocol+"//"+t.hostname}function hasParent(e,t,n,o){n=n||3;for(var r=0;r<n;r++){if(!(e=e.parentNode))return;if("body"==e.nodeName.toLowerCase())return;if(hasClass(e,t))return!0}}function hasParentWithId(e,t,n,o){n=n||3;for(var r=0;r<n;r++){if(!(e=e.parentNode))return;if("body"==e.nodeName.toLowerCase())return;if(e.id==t)return!0}}function hasParentNode(e,t,n){n=n||3;for(var o=0;o<n;o++){if(!(e=e.parentNode))return;var r=e.nodeName.toLowerCase();if("body"==r)return;if(r==t)return!0}}function XORCipher(){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return{encode:function(e,t){return function(e){var t,n,o,r,i,a,s,c,l=0,d="";if(!e)return e;for(;t=e[l++],n=e[l++],o=e[l++],r=(s=t<<16|n<<8|o)>>12&63,i=s>>6&63,a=63&s,d+=u.charAt(s>>18&63)+u.charAt(r)+u.charAt(i)+u.charAt(a),l<e.length;);return((c=e.length%3)?d.slice(0,c-3):d)+"===".slice(c||3)}(t=function(n,e){return r(e,function(e,t){return e.charCodeAt(0)^o(n,t)})}(e,t))},decode:function(e,t){return function(n,e){return r(e,function(e,t){return String.fromCharCode(e^o(n,t))}).join("")}(e,t=function(e){var t,n,o,r,i,a,s,c,l=0,d=[];if(!e)return e;e+="";for(;r=u.indexOf(e.charAt(l++)),i=u.indexOf(e.charAt(l++)),a=u.indexOf(e.charAt(l++)),s=u.indexOf(e.charAt(l++)),t=(c=r<<18|i<<12|a<<6|s)>>16&255,n=c>>8&255,o=255&c,d.push(t),64!==a&&(d.push(n),64!==s&&d.push(o)),l<e.length;);return d}(t))}};function o(e,t){return e.charCodeAt(Math.floor(t%e.length))}function r(e,t){for(var n=[],o=0;o<e.length;o++)n[o]=t(e[o],o);return n}}function isFunction(e){return e&&"[object Function]"==={}.toString.call(e)}function digits(e,t){return 1==t?e:e<Math.pow(10,t-1)?"0"+digits(e,t-1):e}function cleanURL(e){if(native&&mobile)try{e=(e=window.Ionic.WebView.convertFileSrc(e)).replace(/([^:])\/\//g,"$1/")}catch(e){}return e}function parseHtml(e){var t=parser.parseFromString(e,"text/html");return t&&t.documentElement||(t=parser.parseFromString(e,"text/xml")),t}function parseXml(e){var t=parser.parseFromString(e,"text/xml");return t&&t.documentElement||(t=parser.parseFromString(e,"text/html")),t}function getTopOffsetRelativeTo(e,t){for(var n=0;e&&e!=t;)n+=e.offsetTop,e=e.offsetParent;return n}function existsInArray(e,t){for(var n=t.length;n--;)if(t[n]==e)return!0}function removeFromArray(e,t){for(var n=t.length;n--;)t.splice(n,1)}function serializeObject(e,t,n){var o=Object.prototype.toString.call(e);if(void 0===n)if("[object Object]"===o)n={};else{if("[object Array]"!==o)return;n=[]}for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=e[r];if(null!=i)switch(Object.prototype.toString.call(i)){case"[object Array]":case"[object Object]":serializeObject(i,a(t,r),n);break;default:n[a(t,r)]="boolean"==typeof i?Number(i):encodeURIComponent(i)}}function a(e,t){return null!=e?e+"["+t+"]":t}return n}function getBaseSuffix(){return window.location.protocol+"//"+window.location.host+window.location.pathname}function waitFor(e,t,n){n=n||0,"string"==typeof e&&window[e]||Array.isArray(e)&&e.length||/#|\./.test(e)&&document.querySelector(e)?t():n<3e3&&setTimeout(function(){waitFor(e,t,n+100)},100)}function base64URL(e){return e.toString(CryptoJS.enc.Base64).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function getClosest(e,t){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null}function removePx(e){if(e){var t=e.split("px");return t.length?Number(t[0]):void 0}}function addDigitsToArray(e,t){if(!e)return e;for(var n=0;n<e.length;n++)e[n]=digits(e[n],t);return e}function UAParser(){this.ua="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:"",this.UNKNOWN="?",this.OBJ_TYPE="object",this.STR_TYPE="string",this.NAME="name",this.VERSION="version",this.BLACKBERRY="BlackBerry",this.BROWSER="Browser",this.CHROME="Chrome",this.FIREFOX="Firefox",this.OPERA="Opera",this.oldSafariMap={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},this.windowsVersionMap={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},this.regexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[this.NAME,this.VERSION],[/opios[\/ ]+([\w\.]+)/i],[this.VERSION,[this.NAME,this.OPERA+" Mini"]],[/\bopr\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.OPERA]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[this.NAME,this.VERSION],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[this.VERSION,[this.NAME,"UC"+this.BROWSER]],[/\bqbcore\/([\w\.]+)/i],[this.VERSION,[this.NAME,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[this.VERSION,[this.NAME,"WeChat"]],[/konqueror\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[this.VERSION,[this.NAME,"IE"]],[/yabrowser\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[this.NAME,/(.+)/,"$1 Secure "+this.BROWSER],this.VERSION],[/\bfocus\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.FIREFOX+" Focus"]],[/\bopt\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.OPERA+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[this.VERSION,[this.NAME,"Dolphin"]],[/coast\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.OPERA+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[this.VERSION,[this.NAME,"MIUI "+this.BROWSER]],[/fxios\/([-\w\.]+)/i],[this.VERSION,[this.NAME,this.FIREFOX]],[/\bqihu|(qi?ho?o?|360)browser/i],[[this.NAME,"360 "+this.BROWSER]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[this.NAME,/(.+)/,"$1 "+this.BROWSER],this.VERSION],[/(comodo_dragon)\/([\w\.]+)/i],[[this.NAME,/_/g," "],this.VERSION],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[this.NAME,this.VERSION],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[this.NAME],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[this.NAME,"Facebook"],this.VERSION],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[this.NAME,this.VERSION],[/\bgsa\/([\w\.]+) .*safari\//i],[this.VERSION,[this.NAME,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[this.VERSION,[this.NAME,this.CHROME+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[this.NAME,this.CHROME+" WebView"],this.VERSION],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[this.VERSION,[this.NAME,"Android "+this.BROWSER]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[this.NAME,this.VERSION],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[this.VERSION,[this.NAME,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[this.VERSION,this.NAME],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[this.NAME,[this.VERSION,this.strMapper,this.oldSafariMap]],[/(webkit|khtml)\/([\w\.]+)/i],[this.NAME,this.VERSION],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[this.NAME,"Netscape"],this.VERSION],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[this.VERSION,[this.NAME,this.FIREFOX+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[this.NAME,this.VERSION]],os:[[/microsoft (windows) (vista|xp)/i],[this.NAME,this.VERSION],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[this.NAME,[this.VERSION,this.strMapper,this.windowsVersionMap]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[this.NAME,"Windows"],[this.VERSION,this.strMapper,this.windowsVersionMap]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[this.VERSION,/_/g,"."],[this.NAME,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[this.NAME,"Mac OS"],[this.VERSION,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[this.VERSION,this.NAME],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[this.NAME,this.VERSION],[/\(bb(10);/i],[this.VERSION,[this.NAME,this.BLACKBERRY]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[this.VERSION,[this.NAME,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[this.VERSION,[this.NAME,this.FIREFOX+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[this.VERSION,[this.NAME,"webOS"]],[/crkey\/([\d\.]+)/i],[this.VERSION,[this.NAME,this.CHROME+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[this.NAME,"Chromium OS"],this.VERSION],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[this.NAME,this.VERSION],[/(sunos) ?([\w\.\d]*)/i],[[this.NAME,"Solaris"],this.VERSION],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[this.NAME,this.VERSION]]},this.has=function(e,t){return typeof e===this.STR_TYPE&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},this.strMapper=function(e,t){for(var n in t)if(typeof t[n]===this.OBJ_TYPE&&0<t[n].length){for(var o=0;o<t[n].length;o++)if(this.has(t[n][o],e))return n===this.UNKNOWN?void 0:n}else if(this.has(t[n],e))return n===this.UNKNOWN?void 0:n;return e},this.rgxMapper=function(e,t,n){for(var o,r,i,a,s,c,l=0;l<n.length&&!s;){var d=n[l],u=n[l+1];for(o=r=0;o<d.length&&!s;)if(s=d[o++].exec(t))for(i=0;i<u.length;i++)c=s[++r],typeof(a=u[i])===this.OBJ_TYPE&&0<a.length?2==a.length?"function"==typeof a[1]?e[a[0]]=a[1].call(e,c):e[a[0]]=a[1]:3==a.length?"function"!=typeof a[1]||a[1].exec&&a[1].test?e[a[0]]=c?c.replace(a[1],a[2]):void 0:e[a[0]]=c?a[1].call(e,c,a[2]):void 0:4==a.length&&(e[a[0]]=c?a[3].call(e,c.replace(a[1],a[2])):void 0):e[a]=c||void 0;l+=2}},this.getBrowserDetails=function(){var e={name:void 0,version:void 0};return this.rgxMapper(e,this.ua,this.regexes.browser),e},this.getOSDetails=function(){var e={name:void 0,version:void 0};return this.rgxMapper(e,this.ua,this.regexes.os),e}}function phpDateToJS(e){var t=(e=(e=(e=e.split("+")[0]).split(".")[0]).replace("T"," ")).split(/[- :]/);return new Date(t[0],t[1]-1,t[2],t[3],t[4],t[5])}String.prototype.includes=function(e){return-1!==this.indexOf(e)},String.prototype.toCamelCase=function(){return this.toLowerCase().replace(/(?:(^.)|(\s+.))/g,function(e){return e.charAt(e.length-1).toUpperCase()})};var parser=new DOMParser,preview,previewParams,app,mobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),mobileDebug=!1,ios=/iPhone|iPad|iPod/i.test(navigator.userAgent);isIpad()&&(mobile=1,ios=!0);var readerV=1.6,debug=!1,native,bookPath,noFlash,isReaderApp,isRelease=!0,desktop,chromeApp,os,miniapps={},uuid,kotobee={},loggerWorker,partitionEnabled="Android"==mobile&&config.kotobee.segregate,isKotobee=!0,debugDuration=!1,overflowScroll=!mobile|config.overflowScroll;if("undefined"==typeof rootDir&&(rootDir=""),"undefined"==typeof hostingDomain&&(hostingDomain=""),"undefined"==typeof hostUrlMode&&(hostUrlMode=""),"null"==hostingDomain&&(hostingDomain=""),"null"==hostUrlMode&&(hostUrlMode=""),null==config.mediaTab&&(config.mediaTab=!0),null==config.settingsTab&&(config.settingsTab=!0),null==config.notebookTab&&(config.notebookTab=!0),null==config.textSizeControls&&(config.textSizeControls=!0),null==config.chaptersTab&&(config.chaptersTab=!0),null==config.showCategories&&(config.showCategories=!0),null==config.showFavorites&&(config.showFavorites=!0),null==config.styleControls&&(config.styleControls=!1),null==config.imagesInMediaTab&&(config.imagesInMediaTab=!0),debug){var sdkProfilesEnabled=localStorage.sdkProfilesEnabled,sdkProfile=localStorage.sdkProfile;sdkProfilesEnabled&&JSON.parse(sdkProfilesEnabled)&&sdkProfile&&JSON.parse(sdkProfile)&&(config.kotobee=JSON.parse(sdkProfile),delete config.kotobee.name,delete config.kotobee.locked,sdkProfile=null)}function isIpad(){var e=window.navigator.userAgent;if(-1<e.indexOf("iPad"))return!0;if(-1<e.indexOf("Macintosh"))try{return document.createEvent("TouchEvent"),!0}catch(e){}return!1}function stopAllAudio(){for(var e=document.getElementsByTagName("audio"),t=0;t<e.length;t++)e[t].pause(),e[t].src="";try{document.bgAudio&&(document.bgAudio.pause(),document.bgAudio.src="")}catch(e){}}function applyPreview(e){var t=angular.element(document.body).scope();t.config=config=e,t.$apply(),angular.element(document.body).scope().injectUserCSS(e)}function previewPage(e,t){var n=angular.element(document.body).scope();n.previewPage&&n.previewPage(e,t)}function getCookie(e){var t=("; "+document.cookie).split("; "+e+"=");if(2==t.length)return t.pop().split(";").shift()}function getVar(e){return Modernizr.localstorage?localStorage[e]:getCookie("continueWithoutHTML5")}function setVar(e,t){Modernizr.localstorage?localStorage[e]=t:document.cookie=e+"="+t}function getGlobal(){return angular.element(document.body).scope()}function closePrintIframe(){var e=document.getElementById("printContainer");e&&e.parentNode.removeChild(e)}function putTest(e){}function continueLocally(){setVar("continueLocally","true"),location.reload()}function continueWithoutHTML5(){setVar("continueWithoutHTML5","true"),location.reload()}config.kotobee||(config.kotobee={}),window.location.origin&&config.kotobee.liburl&&0==window.location.origin.indexOf("https://")&&-1!=window.location.origin.indexOf(".kotobee.com")&&(config.kotobee.liburl=window.location.origin+"/"),function(){function e(){for(var e,t=document.getElementsByTagName("head")[0],n=t.innerHTML,o=[],r=document.getElementsByTagName("script"),i=0;i<r.length;i++)if(r[i].getAttribute("src")&&0<=r[i].getAttribute("src").indexOf("lib/ionic/release/js")){var a=r[i].getAttribute("src").split("lib/ionic/release/js");rootDir=a[0];break}try{(loggerWorker=new Worker(rootDir+"js/workers/logger.js")).addEventListener("error",function(){loggerWorker=null},!1)}catch(e){}e=[rootDir+"lib/ionic/release/css/ionic.min.css"];for(i=0;i<o.length;i++)n+='<script src="'+o[i]+'" type="text/javascript"><\/script>';for(i=0;i<e.length;i++)n='<link rel="stylesheet" href="'+e[i]+'">'+n;t.innerHTML=n,config.noLoadingScreen&&document.body.classList.add("noLoadingScreen")}if(detectIE()||ios){!function e(){var t=document.getElementsByTagName("body");if(!t.length)return timeOut(e,100);ios?(addClass(t[0],"ios"),addClass(t[0],"fullscreen")):addClass(t[0],"ie")}()}var t=document.getElementsByTagName("head");if(0<window.location.href.indexOf("?preview")){mobileDebug=preview=!0;var n=window.location.href.split("?");n=n[1].split("&"),previewParams={};for(var o=0;o<n.length;o++){var r=n[o].split("=");previewParams[r[0]]=r[1]}mobile=previewParams.mobile}else{if(config.gAnalyticsID){var i="";isKotobeeHosted()&&(i="/bundles/vijualib/templates/reader/public/");var a="";(native||desktop)&&(a="ga('set','checkProtocolTask',null);ga('set','anonymizeIp',true);ga('set','forceSSL',true)");var s="'auto'";native?s="{'storage':'none','clientId':device.uuid}":desktop&&(s="{'storage':'none'}"),(c=document.createElement("script")).innerHTML="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','"+i+"lib/gAnalytics/analytics.js','ga');ga('create', '"+config.gAnalyticsID+"', "+s+");"+a,t.length&&t[0].appendChild(c)}if(config.js)for(o=0;o<config.js.length;o++){var c;(c=document.createElement("script")).src=config.js[o],c.className="kotobeeInjectedScript",document.getElementsByTagName("body")[0].appendChild(c)}if(config.css)for(o=0;o<config.css.length;o++){var l=document.createElement("link");l.rel="stylesheet",l.href=config.css[o],l.className="kotobeeInjectedScript",document.getElementsByTagName("body")[0].appendChild(l)}if("undefined"!=typeof cordova)native=!0;else if("file:"==window.location.protocol||"kotobee:"==window.location.protocol||"undefined"!=typeof require){if(mobile)native=!0;else if("undefined"!=typeof require){desktop=!0,os="mac",process.env.OS&&0<=process.env.OS.toLowerCase().indexOf("windows")&&(os=0<=process.env.PROCESSOR_ARCHITECTURE.indexOf("64")?"win64":"win32"),0<=String(require("nw.gui").App.argv).indexOf("--mobile")&&(mobile=1)}else if(window.chrome&&chrome.app&&chrome.app.runtime&&chrome.storage){try{if(!chromeEnabled)return}catch(e){return}chromeApp=!0}else if("true"!=getVar("continueLocally"))return timeOut(function(){document.getElementById("localFallback").style.display="block",document.getElementById("kotobeeLink").style.display="none",document.getElementsByTagName("body")[0].style.cssText="overflow-y: scroll;"},100),e()}else"chrome-extension:"==window.location.protocol&&(chromeApp=!0)}if(!chromeApp){if("true"!=getVar("continueWithoutHTML5")&&!(Modernizr.audio&&Modernizr.video&&Modernizr.backgroundsize&&Modernizr.borderradius&&Modernizr.canvas&&Modernizr.opacity&&Modernizr.localstorage&&Modernizr.rgba))return timeOut(function(){document.getElementById("html5Fallback").style.display="block",document.getElementById("kotobeeLink").style.display="none",document.getElementsByTagName("body")[0].style.cssText="overflow-y: scroll;"},100),e();setVar("continueLocally","false"),setVar("continueWithoutHTML5","false")}e(),angular.module("ngIOS9UIWebViewPatch",["ng"]).config(["$provide",function(e){"use strict";e.decorator("$browser",["$delegate","$window",function(e,t){if(a=t.navigator.userAgent,/(iPhone|iPad|iPod).* OS 9_\d/.test(a)&&!/Version\/9\./.test(a))return r=null,i=(o=e).url,o.url=function(){return arguments.length?(r=arguments[0],i.apply(o,arguments)):r||i.apply(o,arguments)},window.addEventListener("popstate",n,!1),window.addEventListener("hashchange",n,!1),o;function n(){r=null}var o,r,i,a;return e}])}]);var d=["ionic","angular.css.injector","ngIOS9UIWebViewPatch","templates"];"undefined"!=typeof scormEnabled&&scormEnabled&&d.push("scormwrapper");try{angular.module("templates")}catch(e){angular.module("templates",[]).run(["$templateCache",function(e){}])}app=angular.module("reader.Kotobee",d),ionic.Platform.isFullScreen=!1,app.config(["$stateProvider","$urlRouterProvider","$ionicConfigProvider","$compileProvider",function(e,t,n,o){(chromeApp||desktop||native)&&(o.imgSrcSanitizationWhitelist(/^\s*((https?|ftp|file|kotobee|blob|chrome-extension):|data:image\/)/),o.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|kotobee|chrome-extension):/)),n.views.swipeBackEnabled(!1),e.state("loading",{url:"/loading",templateUrl:kTemplate("views/blank.html")}).state("landing",{url:"/landing",templateUrl:kTemplate("views/landing.html")}).state("oauth",{url:"/oauth/:provider/:idToken/:accessToken",templateUrl:kTemplate("views/oauth.html")}).state("payment",{url:"/payment/:provider/:state/:bookID/:userID",templateUrl:kTemplate("views/payment.html")}).state("paymentMultiple",{url:"/payment/:provider/:state/:userID",templateUrl:kTemplate("views/payment.html")}).state("invoice",{url:"/invoice",templateUrl:kTemplate("views/invoice.html")}).state("login",{url:"/login",templateUrl:kTemplate("views/login.html")}).state("register",{url:"/register",templateUrl:kTemplate("views/register.html")}).state("forgotPwd",{url:"/forgotpwd",templateUrl:kTemplate("views/forgotPwd.html")}).state("redeemCode",{url:"/redeemcode",templateUrl:kTemplate("views/redeemCode.html")}).state("library",{url:"/library",templateUrl:kTemplate("views/library.html")}).state("library_tab",{url:"/library/tab/:tab",templateUrl:kTemplate("views/library.html")}).state("reader",{url:"/reader",templateUrl:kTemplate("views/reader.html")}).state("reader.chapter",{url:"/chapter/:ch",templateUrl:kTemplate("views/reader.html")}).state("reader.chapterhash",{url:"/chapter/:ch/:hash",templateUrl:kTemplate("views/reader.html")}).state("libraryreader",{url:"/book/:book/reader",templateUrl:kTemplate("views/reader.html")}).state("libraryreader.chapter",{url:"/chapter/:ch",templateUrl:kTemplate("views/reader.html")}).state("libraryreader.chapterhash",{url:"/chapter/:ch/:hash",templateUrl:kTemplate("views/reader.html")}).state("app",{url:"/app",templateUrl:kTemplate("views/app.html")})}]),putTest("prerun timeout start"),window.setTimeout(function(){putTest("prerun timeout found!!")},300),app.run(["$ionicPlatform","$location","chapters","library","$injector","initializer",function(e,t,n,o,r,i){var a,s=t.path();if(0==s.indexOf("/book/"))0<(a=s.split("/book/")[1].split("/")).length&&(o.startBook=Number(a[0]));else if(-1!=window.location.href.indexOf("?book=")){var c=window.location.href.replace(/.*\?book=(\d*).*/g,"$1");Number(c)&&(o.startBook=c)}0<=s.indexOf("/reader/chapter/")&&(0<(a=s.split("/reader/chapter/")[1].split("/")).length&&(n.startChapter=Number(a[0])),1<a.length&&(n.startHash=a[1]));if("undefined"!=typeof kTemplates&&kTemplates(r),!i.handleRedirect(s)){for(var l=["/oauth","/invoice"],d=0;d<l.length;d++)if(-1!=s.indexOf(l[d]))return;i.initialize()}}])}();var log=kLog;app.directive("iframeOnload",[function(){return{scope:!1,link:function(e,t,n){t.on("load",function(){return e.modal.siteOptions.loaded()})}}}]),app.directive("containerScroll",["$timeout",function(i){return{scope:!1,link:function(e,t,n){var o=Math.round(99999*Math.random());addClass(t[0],"containerMobileScroll containerScroll"+o),function n(){i(function(){var t=document.getElementsByClassName("containerScroll"+o);function e(e){t[0].getElementsByClassName("kbContent");e.touches&&1<e.touches.length||e.stopPropagation()}t.length?t[0].addEventListener("touchstart",e):++r<50&&n()},40)}();var r=0}}}]),app.directive("enterWithoutShift",function(){return function(t,e,n){e.bind("keydown keypress",function(e){e.shiftKey||13===e.which&&(t.$apply(function(){t.$eval(n.enterWithoutShift)}),e.preventDefault())})}}),app.directive("enterWithCtrl",function(){return function(t,e,n){e.bind("keydown keypress",function(e){e.ctrlKey&&13===e.which&&(t.$apply(function(){t.$eval(n.enterWithCtrl)}),e.preventDefault())})}}),app.directive("searchheader",["$timeout","$parse",function(i,a){return{restrict:"E",replace:!1,scope:{obj:"=obj",prop:"=prop",kotobeeGradient:"=kotobeeGradient",onValue:"=onValue",offValue:"=offValue",noCancel:"=noCancel",searchKeyOb:"=searchKeyOb",onsearch:"&"},templateUrl:kTemplate("headers/headerSearch.html"),link:function(n,o,r){n.$watch("obj[prop]",function(e,t){e===a(r.onValue)(n)&&i(function(){o[0].getElementsByTagName("input")[0].focus()})}),n.hide=function(){n.obj[n.prop]=n.offValue}}}}]),app.directive("ngEnter",function(){return function(t,e,n){e.bind("keydown keypress",function(e){13===e.which&&(t.$apply(function(){t.$eval(n.ngEnter)}),e.preventDefault())})}}),app.directive("nextchapterscroll",function(){return{restrict:"E",templateUrl:kTemplate("components/nextChapterScroll.html")}}),app.directive("autofocusme",["$timeout",function(o){return{link:function(e,t,n){o(function(){t[0].focus()},350)}}}]),app.directive("readerheader",function(){return{restrict:"E",templateUrl:kTemplate("headers/readerHeader.html"),scope:!1}}),app.directive("headerdefault",function(){return{restrict:"E",templateUrl:kTemplate("headers/headerDefault.html"),scope:!1}}),app.directive("headerselection",function(){return{restrict:"E",templateUrl:kTemplate("headers/headerSelection.html"),scope:!1}}),app.directive("headersearchitems",function(){return{restrict:"E",templateUrl:kTemplate("headers/headerSearchItems.html"),scope:!1}}),app.directive("headertextsize",function(){return{restrict:"E",templateUrl:kTemplate("headers/headerTextSize.html"),scope:!1}}),app.directive("headerfreehand",function(){return{restrict:"E",templateUrl:kTemplate("headers/headerFreehand.html"),scope:!1}}),app.directive("headerlibrary",function(){return{restrict:"E",templateUrl:kTemplate("headers/headerLibrary.html"),scope:!1}}),app.directive("mouseEvents",["$ionicGesture","settings","nav","stg","$ionicScrollDelegate",function(e,t,o,n,r){return{restrict:"A",link:function(e,t,n){o.init(t)}}}]),app.directive("vanillaScroll",function(){return{restrict:"A",link:function(e,t,n){t[0].addEventListener("scroll",function(){e.scroll(this)})}}}),app.directive("selectOptions",function(){return{restrict:"E",templateUrl:kTemplate("headers/selectOptions.html")}}),app.directive("selectionOptions",function(){return{restrict:"E",templateUrl:kTemplate("components/selectionOptions.html")}}),app.directive("tabMenu",function(){return{restrict:"E",replace:!0,templateUrl:kTemplate("panels/tabMenu.html")}}),app.directive("media",function(){return{restrict:"E",replace:!0,templateUrl:kTemplate("panels/media.html"),scope:!1}}),app.directive("noteitem",function(){return{restrict:"E",templateUrl:kTemplate("components/noteItem.html")}}),app.directive("bookmarkitem",function(){return{restrict:"E",templateUrl:kTemplate("components/bookmarkItem.html")}}),app.directive("hlightitem",function(){return{restrict:"E",templateUrl:kTemplate("components/hlightItem.html")}}),app.directive("bookThumb",function(){return{restrict:"E",replace:!0,templateUrl:kTemplate("panels/bookThumb.html")}}),app.directive("thumbnail",function(){return{restrict:"A",link:function(e,t,n){t.attr("style","background-size:cover,width:50px,height:50px")}}}),app.directive("onimgload",function(){return{restrict:"A",link:function(t,n,o){n.bind("load",function(e){t[o.onimgload](n),t.$apply()})}}}),app.directive("showafterimageload",function(){return{restrict:"A",link:function(e,t,n){t.bind("load",function(e){e.currentTarget.style.opacity=1,autoprefixTransform(e.currentTarget,"translate(-50%, -100%) scale(1)")})}}}),app.directive("headerShrink",["autohide",function(o){return{restrict:"A",link:function(e,t,n){o.setup(e,t,n)}}}]),app.directive("categoryList",["autohide",function(e){return{restrict:"E",templateUrl:kTemplate("components/categoryList.html"),scope:{rtl:"=rtl",list:"=list",parent:"=parent",backlist:"=backlist",odd:"=odd",level:"=level",categoryClicked:"=clicked",categoryBackClicked:"=backClicked"}}}]),app.directive("sdk",function(){return{restrict:"E",templateUrl:mobile?"":"templates/web/panels/sdk.html"}}),app.directive("sdkProfileForm",function(){return{restrict:"E",templateUrl:kTemplate("panels/sdkProfileForm.html"),scope:{profile:"=profile",save:"=save",cancel:"=cancel"}}}),app.directive("bookInfo",function(){return{restrict:"E",templateUrl:kTemplate("panels/bookInfo.html"),scope:{pageview:"=pageview",book:"=book"}}}),app.directive("stars",function(){return{restrict:"E",templateUrl:kTemplate("components/stars.html"),scope:{rating:"=rating",type:"=type",onselect:"=onselect"},link:function(t,e,n){t.rating||(t.rating=0),"input"==t.type&&(t.rating=t.selectedRating=0),t.over=function(e){"input"==t.type&&(t.rating=e)},t.select=function(e){"input"==t.type&&(t.rating=t.selectedRating=e,t.onselect&&t.onselect(e))},t.leave=function(){"input"==t.type&&null!=t.selectedRating&&(t.rating=t.selectedRating)}}}}),app.controller("BookInfoCtrl",["$scope","np","$timeout","bookinfo","$element","$rootScope","translit","crdv","sync","status","stg","book","modals","chapters","$location","backend",function(o,n,e,r,t,i,a,s,c,l,d,u,p,f,h,g){function m(e){(e=e||{}).bid=o.modal.bookInfoOptions.book.id,o.loadingReviews=!0,g.getReviews(e,function(e){o.loadingReviews=!1,o.totalReviews=e.total,o.reviews=e.reviews,o.rating=e.rating,o.totalRating=e.totalRating?e.totalRating:0,i.$$phase||i.$apply()})}o.init=function(){o.pageview&&(o.modal=p.getScope().modal,o.data=d.data,o.book.coverImg=d.data.epub.bookThumb,o.book.coverStyle={"background-image":"url('"+o.book.coverImg+"')"},o.book.name=o.book.meta.dc.title,r.show({book:o.book,categoryClicked:o.categoryClicked},{noModal:!0}),i.$$phase||i.$apply()),config.kotobee.cloudid&&config.kotobee.reviews&&(o.loadingReviews=!0,setTimeout(function(){m({max:10})},2e3))},o.getAllReviews=function(){m({})},o.openRemotely=function(e){e,u.open(e,{openRemotely:!0})},o.open=function(e){e,u.open(e)},o.download=function(e){r.download(e)},o.actionBtnClicked=function(e,t){e.redirect?desktop?n.openLink(e.redirect):native&&s.openInNativeBrowser(e.redirect):r.action(e,t)},o.delete=function(e){r.delete(e)},o.update=function(e){r.update(e)},o.addToFav=function(e){r.addToFav(e)},o.toggleFav=function(e){r.toggleFav(e)},o.removeFav=function(e){r.removeFav(e)},o.categoryClicked=function(e){p.hide(),o.modal.bookInfoOptions.categoryClicked(e)},o.redeemCodeClicked=function(){r.redeemCode()},o.backBtnClicked=function(e){r.prevStage()},o.toLoginScreen=function(){h.path("/login")},o.selectRating=function(e){o.entryRating=e},o.submitReview=function(e){if(config.kotobee.cloudid&&config.kotobee.reviews){var t=e.target.parentNode.getElementsByTagName("textarea")[0],n={};n.content=t.value,config.kotobee.reviewsrating&&(n.rating=o.entryRating),n.bid=o.modal.bookInfoOptions.book.id,g.addReview(n,function(e){if(e.error)return p.hide(),void p.show({mode:"generalError",errorOptions:{msg:a.get("s_reviewExists")}});t.value="",m({max:10})})}}}]),app.controller("BookSettingsCtrl",["$scope","stg","crdv","spread","$element","nav","backend","$location","$ionicSideMenuDelegate","cssParser","modals","sync","markers","settings","$timeout",function(t,e,n,o,r,i,a,s,c,l,d,u,p,f,h){t.init=function(){t.navAnims=[{label:"flip",val:"navBookBlock"},{label:"card",val:"navFlip"},{label:"slide",val:"navSlide"},{label:"stack",val:"navStack"},{label:"fade",val:"navFade"}],t.navModes=[{label:"vertical",val:"vertical"},{label:"horizontal",val:"horizontal"}],t.viewModes=[{label:"auto",val:"auto"},{label:"singlePage",val:"single"},{label:"doublePage",val:"double"}]},t.stylingChanged=function(){h(f.stylingChanged,300)},t.navAnimChanged=function(){f.saveSettings()},t.viewModeChanged=function(){h(f.viewModeChanged,300),e.writeSlot("settings"+e.getBookId(!0),e.data.settings)},t.navModeChanged=function(){f.saveSettings()},t.lineAdjustChanged=function(){h(f.lineAdjustChanged,300)},t.singlePageScrollChanged=function(){h(f.viewModeChanged,300)},t.editFontSize=function(){t.header.mode="textSize",c.toggleRight(!1),c.toggleLeft(!1)},t.langChanged=function(){c.toggleLeft(!1),c.toggleRight(!1),h(f.langChanged,500)},t.sync=function(){c.toggleRight(!1),c.toggleLeft(!1),f.sync()},t.fullscreen=function(){c.toggleRight(!1),c.toggleLeft(!1),i.fullscreen()},t.share=function(){d.show({mode:"share",dynamic:!0,animation:"slide-in-up"})},t.logout=function(){c.toggleRight(!1),c.toggleLeft(!1),a.logout()},t.about=function(){t.openAuthorWebsite()},t.exit=function(){d.show({mode:"exit",backdropClickToClose:!1,exitOptions:{exit:function(){n.exit()}}})},t.profileClicked=function(e){d.show({mode:"profile",dynamic:!0,scope:t,animation:"slide-in-up"})}}]),app.controller("CartCtrl",["$scope","cart",function(e,t){e.cart=t,e.addBook=function(e){t.add(e)},e.removeBook=function(e){t.remove(e)},e.showCart=function(){t.show()},e.showCheckout=function(){t.checkout()},e.backToCart=function(){t.back()},e.makePayment=function(e){"library"==config.kotobee.mode&&t.pay(e)}}]),app.controller("CatMenuCtrl",["$scope","backend","translit","$ionicScrollDelegate","$ionicModal","$timeout","stg",function(e,t,n,o,r,i,a){}]),app.controller("ChaptersCtrl",["$scope","initializer","$stateParams","status","stg","nav","modals","backend","events","$ionicHistory","crdv","virt","chapters","$ionicGesture","cache","$q","book","$timeout","$ionicPopup","$ionicSideMenuDelegate","$location","$ionicScrollDelegate","selection","$filter",function(e,t,n,o,r,i,a,s,c,l,d,u,p,f,h,g,m,v,b,y,k,w,x,C){var I;function E(e,t){if(I&&clearTimeout(),currentIndex==t.currentChapterIndex)return I=setTimeout(function(){E(e,t)},1e3);var n={neighbor:t.currentChapterIndex+("next"==e?1:-1),ch:t.currentChapterTitle,chIndex:t.currentChapterIndex,dir:e,targetIndex:currentIndex,targetCh:r.data.book.chapter.title};c.add({action:"navBtnClicked",param:JSON.stringify(n)})}e.init=function(){e.$on("$stateChangeStart",function(e,t,n){if(0==t.name.indexOf("reader")||0==t.name.indexOf("libraryreader")){var o=n.ch?n.ch:0,r=n.hash?n.hash:null,i=getQueryStringValue("vi");p.loadChapterByIndex(Number(o),{hash:r,vIndex:i})}}),e.native||e.desktop||e.$on("$ionicView.beforeEnter",function(){if(!t.initialized||!config.kotobee.public&&!s.userLoggedIn()){var e="loading";l.forwardView()?e=l.forwardView().stateId:l.backView()&&(e=l.backView().stateId),l.nextViewOptions({disableAnimate:!0}),k.path("/"+e)}})},e.nextChapter=function(){var t={};return t.currentChapterTitle=r.data.book.chapter.title,t.currentChapterIndex=currentIndex,p.nextChapter({},function(e){E("next",t)})},e.prevChapter=function(){var t={};return t.currentChapterTitle=r.data.book.chapter.title,t.currentChapterIndex=currentIndex,p.prevChapter({},function(e){E("previous",t)})},e.pinched=function(e){},e.showBookInfo=function(){native&&d.vibrate();var e=r.data.book;e.coverImg=r.data.epub.bookThumb,e.coverStyle={"background-image":"url('"+e.coverImg+"')"},e.name=e.meta.dc.title;var t={};t.book=e,t.stage="info",config.kotobee.cloudid&&"book"==config.kotobee.mode&&(t.book.stats=config.kotobee.stats),t.noAction=!0,a.show({mode:"bookInfo",dynamic:!0,animation:"slide-in-up",bookInfoOptions:t})},e.gotoPageClicked=function(e){e.stopPropagation();var t={};t.page=r.data.currentPageOb.index+1,config.gotoPageOffset&&(t.page-=config.gotoPageOffset),t.submit=function(){if(!isNaN(t.page)){var e=Number(t.page);config.gotoPageOffset&&(e+=config.gotoPageOffset),p.loadChapterByIndex(e),a.hide()}},a.show({mode:"gotoPage",gotoPageOptions:t})}}]),app.controller("ContentCtrl",["$location","nav","virt","$sce","$filter","$attrs","stg","crdv","$controller","$rootScope","$element","cache","$scope","settings","$ionicSideMenuDelegate","$http","chapters","$timeout","selection","book","$ionicScrollDelegate",function(e,t,o,n,r,i,a,s,c,l,d,u,p,f,h,g,m,v,b,y,k){p.init=function(){},p.mouseDown=function(){mobile&&t.resize(),o.enable()},p.mouseUp=function(){o.disableAfter(2e3)};var w;p.scroll=function(){if(a.data.book){try{var e=k.$getByHandle("content"),t=new Event("kotobeeScrolled");if(e){var n=e.getScrollPosition();t.left=n.left,t.top=n.top,t.zoom=n.zoom}document.dispatchEvent(t)}catch(e){}kotobee&&kotobee.dispatchEvent("scrolled",n),config.preserveLoc&&"app"!=config.kotobee.mode&&(w&&clearTimeout(w),w=setTimeout(function(){if("app"!=config.kotobee.mode){var e=k.$getByHandle("content");if(e){var t=e.getScrollPosition();t&&a.writeSlot("lastLocY"+a.getBookId(),t.top)}}},2e3)),mobile||(o.enable(),o.disableAfter(2e3))}}}]),app.controller("ForgotPwdCtrl",["$scope","initializer","popovers","crdv","$rootScope","design","stg","$location","modals","$ionicHistory","error","backend","auth","cache","translit","$window",function(e,t,n,o,r,i,a,s,c,l,d,u,p,f,h,g){e.init=function(){mobile||(i.stylize("forgotPwd",i.getBgStyle()),u.addListener("pathsChanged",function(){i.stylize("forgotPwd",i.getBgStyle())})),e.$on("$ionicView.afterEnter",function(){f.setOb("title",replaceHTML(f.getOb("title"),h.get("forgotPwd")))}),e.native||e.desktop||e.$on("$ionicView.beforeEnter",function(){if(!t.initialized||u.cloudParam("public")||a.data.user&&u.userLoggedIn()){var e="loading";l.forwardView()?e=l.forwardView().stateId:l.backView()&&(e=l.backView().stateId),l.nextViewOptions({disableAnimate:!0}),s.path("/"+e)}})},e.showMenu=function(){var e=[{name:h.get("exit"),func:function(){n.hide(),c.show({mode:"exit",backdropClickToClose:!1,exitOptions:{exit:function(){o.exit()}}})}}];n.show({mode:"cornerList",listOb:e,backdropClickToClose:!1})},e.submit=function(){e.user&&e.user.email&&u.forgotPwd(e.user,function(e){e.error?d.update({error:"s_authError"==e.error?"accessDenied":e.error}):(c.show({mode:"success",successOptions:{msg:h.get("pwdEmailSent")}}),l.goBack())})},e.backClicked=function(){l.goBack()}}]),app.controller("FreehandCtrl",["$scope","freehand","stg","$injector",function(t,n,e,o){t.init=function(){t.mode=n.mode,t.currentStyle=n.currentStyle,t.smoothingValue=n.smoothing},t.backClicked=function(){n.deactivate()},t.smoothingClicked=function(){if("smoothing"==t.currentOptions)return t.closeOptions();t.currentOptions="smoothing",t.smoothing=n.defs.smoothing,t.smoothingValue=n.smoothing},t.brushesClicked=function(){if("brushes"==t.currentOptions)return t.closeOptions();t.currentOptions="brushes",t.brushes=n.defs.brushes},t.colorsClicked=function(){if("colors"==t.currentOptions)return t.closeOptions();t.currentOptions="colors",t.colors=n.defs.colors,t.currentStyle=n.currentStyle},t.eraserClicked=function(){this.mode="eraser",n.mode="eraser"},t.penClicked=function(){this.mode="pen",n.mode="pen"},t.clearClicked=function(){n.clear()},t.undoClicked=function(){n.undo()},t.redoClicked=function(){n.redo()},t.closeOptions=function(){t.currentOptions=null},t.selectColor=function(e){n.currentStyle.color=e,t.closeOptions()},t.selectBrush=function(e){n.currentStyle.brush=e,t.closeOptions()},t.selectSmoothing=function(e){n.smoothing=e,t.closeOptions()}}]),app.controller("GlobalCtrl",["cache","modals","popovers","$ionicPlatform","np","book","$http","$compile","$injector","$rootScope","initializer","translit","error","notes","$sce","design","settings","status","tinCan","$scope","backend","stg","$location",function(e,t,n,o,r,i,a,s,c,l,d,u,p,f,h,g,m,v,b,y,k,w,x){putTest=function(e){},y.init=function(){y.mobile=mobile,y.native=native,y.desktop=desktop,y.ios=ios,y.preview=preview,y.config=config,y.cloudParam=k.cloudParam,y.started=!0,t.setScope(y),n.setScope(y)},y.tinCanShortcut=function(e){b.send(e)},y.questionsAddToNotebookShortcut=function(e,t){f.addNotesFromQuestions(e,t||angular.noop)},y.getNotebookShortcut=function(r,i){w.getNotes(function(e){var t=[currentIndex];w.data.currentRPageOb&&t.push(w.data.currentRPageOb.index);for(var n=0;n<t.length;n++)for(var o=0;o<e.length;o++)e[o].chapter==t[n]&&0==e[o].location.indexOf(r.rootIndex)&&(e[o].location=e[o].location.split(r.rootIndex)[1],f.addIcon(e[o],r.root));i&&i()})},y.location=function(e){x.path(e)},y.kTemplate=function(e){return kTemplate(e)},y.translit=function(e){return u.get(e)},y.htmlSafe=function(e){return h.trustAsHtml(e)},y.openAuthorWebsite=function(){var e=w.data.settings.language;"en"!=e&&"es"!=e&&"ar"!=e&&"fr"!=e&&(e="en"),window.open("https://www.kotobee.com/"+e+"/products/author#ref=readerwatermark","_system")},y.applyNativeScroll=function(t){var n,e=t.getElementsByClassName("kbContent");if(e.length&&!(e[0].scrollHeight<=t.offsetHeight)){t.children.length&&"ion-scroll"==t.children[0].nodeName.toLowerCase()&&(n=t.children[0],t.appendChild(e[0]),t.removeChild(n),t.scrollTop=0),(n=document.createElement("ion-scroll")).setAttribute("scrollY","true"),n.setAttribute("overflow-scroll","false"),n.setAttribute("style","width:100%;height:100%"),n.setAttribute("container-scroll","true");for(var o=0;o<t.children.length;o++)n.appendChild(t.children[o]);setTimeout(function(){var e=s(n.outerHTML)(y);angular.element(t).append(e)},0)}},y.globalClick=function(){},y.globalTouch=function(){},y.refreshSignatures=function(){k.refreshSignatures()},y.getService=function(e){return c.get(e)},y.testModals=function(){t.show({mode:"loading",loadingMsg:u.get("pleaseWait")});t.show({mode:"login",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"login",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"login",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"bookInfo",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"bookInfo",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"update",dynamic:!0,animation:"slide-in-up",backdropClickToClose:!0}),t.show({mode:"bookInfo",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"generalError"}),t.show({mode:"loading",loadingMsg:u.get("pleaseWait"),backdropClickToClose:!0}),t.show({mode:"note",dynamic:!0,animation:"slide-in-up",backdropClickToClose:!0}),t.show({mode:"hlight"}),t.show({mode:"externalSite",dynamic:!0,animation:"slide-in-up",backdropClickToClose:!0}),t.show({mode:"bookInfo",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"flashUnsupported",flashOb:{text:"Text for flash unsupported site"}}),t.show({mode:"success",successOptions:{msg:"SUCCESS MSG"}}),t.show({mode:"localOnlyError"}),t.show({mode:"xFrameError"}),t.show({mode:"networkError"}),t.show({mode:"exit"}),t.show({mode:"waitTimeout"}),t.show({mode:"backToLib"}),t.show({mode:"notebook",dynamic:!0,animation:"slide-in-up",scope:{notebookClose:t.hide}}),t.show({mode:"search",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"image",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"libraryInfo",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"bookInfo",dynamic:!0,animation:"slide-in-up"}),t.show({mode:"encryptionKey",backdropClickToClose:!0});t.show({mode:"loading",loadingMsg:u.get("pleaseWait"),timeLimit:3e3})},y.injectUserCSS=function(e){g.injectUserCSS(e)},y.langSelected=function(e,t){var n=t.currentTarget;angular.element(n).scope().$parent.$parent.langDropdownExpanded=!1,w.data.settings.language=e,m.langChanged()}}]),app.controller("InvoiceCtrl",["$scope","$stateParams","chapterAPI","backend","$injector","initializer","design","stg","settings","$rootScope","translit","payment",function(r,e,t,n,o,i,a,s,c,l,d,u){r.init=function(){mobile||(a.stylize("invoice",a.getBgStyle()),n.addListener("pathsChanged",function(){a.stylize("register",a.getBgStyle())})),r.loading=!0,function(e){s.initialize(),s.initializeSettings(function(){t.initialize(),c.langChanged(e)})}(function(){var e=new URLSearchParams(window.location.hash.split("?")[1]),t={uid:e.get("uid")||"",orderid:e.get("orderid")||""};n.getOrder(t,function(e){if(r.loading=!1,e.error)return modals.show({mode:"generalError",errorOptions:{msg:d.get(e.error)}});r.order=e.order,r.user=e.user,s.data.user=e.user,r.paymentOptions=e.paymentoptions,function(){var n=[];r.paymentOptions.forEach(function(e){if(e.enabled){var t=Object.assign({},e);delete t.provider,t.params&&t.params.clientsecret&&delete t.params.clientsecret,(native||"paypal"!=e.provider)&&"paypal"==e.provider||(n[e.provider]=t)}}),Object.keys(n).length&&(config.kotobee.payment=n);u.initialize()}(),setTimeout(function(){u.renderPaypalButton({order:r.order})},1e3),l.$$phase||l.$apply()})})},r.pay=function(e){var t=r.order,n=r.user;if("moyasar"===e){var o={orderid:t.id,redirecturl:native?"http://localhost:8100":window.location.protocol+"//"+window.location.host+window.location.pathname,price:100*t.amount,name:u.getOrderName(t)};u.moyasarSettings.payment(o)}else"stripe"===e&&u.stripeMakePayment(e,{order:t},{paymentEmail:n.email},{id:""})}}]),app.controller("LandingCtrl",["$scope","bookinfo",function(e,t){e.init=function(){},e.showBookInfo=function(){}}]),app.controller("LibraryCtrl",["$scope","error","bookinfo","autohide","$sce","$location","$ionicPlatform","$rootScope","$element","$ionicHistory","auth","modals","popovers","translit","library","chapters","status","book","$timeout","$ionicPopup","$ionicModal","$ionicScrollDelegate","backend","crdv","$filter","stg","settings",function(r,t,n,o,e,i,a,s,c,l,d,u,p,f,h,g,m,v,b,y,k,w,x,C,I,E,S){var T,O,A,N,L;function B(e){for(var t=0;t<r.sortOb.options.length;t++)if(r.sortOb.options[t].val==e)return r.sortOb.options[t]}function M(){if(h.initialize(),h.addListener(R),function e(){if(!document.getElementById("libraryHeader"))return setTimeout(e,100);o.libInitialized()}(),r.initialized=!0,r.catList=E.data.currentLibrary.categories,x.userLoggedIn()&&("account"!=E.data.currentLibrary.authbookview||x.cloudParam("public")||(r.supportsAccountView=!0)),"categories"==E.data.currentLibrary.startingpage)F(),P("categories");else if(0==i.path().indexOf("/library/tab/downloads"))r.downloadedClicked();else if(r.supportsAccountView)P("account"),b(function(){D({account:!0})});else if(!native&&!desktop||x.userLoggedIn()||config.kotobee.public||!config.kotobee.offline){if(P("all"),!x.libraryHasPublicBooks()&&!x.cloudParam("public")&&"hide"==E.data.currentLibrary.authbookview&&!x.userLoggedIn())return r.paneMsg="noEbooksAvailable",void F();b(D)}else P("downloaded"),r.paneMsg=null,0==E.data.downloaded.length&&(r.paneMsg="noEbooksDownloaded"),F();h.startBook&&(function(e){if(!config.kotobee.public&&!x.userLoggedIn())return;if(E.data.currentLibrary&&E.data.currentLibrary.books)for(var t=0;t<E.data.currentLibrary.books.length;t++)if(E.data.currentLibrary.books[t].id==e)return v.open(E.data.currentLibrary.books[t]);x.getEbook({bid:e},function(e){v.open(e)})}(h.startBook),h.startBook=null)}function R(){var e,t=arguments[0];"preload"==t&&(arguments[1].accumulated||(e=!0),mobile||(e=!0),r.paneMsg=null,e&&function(){for(var e=document.getElementsByClassName("libLoaderAnim"),t=0;t<e.length;t++)removeClass(e[t],"hide")}());if("postload"==t){var n=arguments[2];e=!1,r.stopInfiniteScroll(),T=!1,r.stopRefresher();var o=function(e){{if(L){for(var t=0,n=0;n<e.length;n++)if(e[n].searchresults)for(var o=0;o<e[n].searchresults.length;o++)e[n].searchresults[o].results&&(t+=e[n].searchresults[o].results.length);return t}return e.length}}(n);r.moreData=o>=h.maxResults,r.moreData&&h.setMax(o)}}function P(e){if(r.tab=e,r.currentCustomCat=null,"category"==r.subMode)for(var t=0;t<E.data.currentLibrary.categories.length;t++){var n=E.data.currentLibrary.categories[t];n.tab&&n.id==A.id&&(r.currentCustomCat=n,r.tab="customCat")}try{mobile?w.$getByHandle("thumbs").scrollTop(!1):document.getElementById("libraryThumbs").scrollTop=0}catch(e){}}function D(e){e=e||{},r.paneMsg=null,A&&(e.catid=A.id,e.listmode=A.listmode),O&&(e.key=O),L&&(e.contentkey=L),h.getEbooks(e,function(e){r.bookSource=e,"all"!=r.tab&&"customCat"!=r.tab&&"account"!=r.tab||(e.empty&&(r.paneMsg="noEbooksAvailable"),r.$$phase||r.$apply(),setTimeout(function(){r.spaceAvailable()||F()}))})}function F(){for(var e=document.getElementsByClassName("libLoaderAnim"),t=0;t<e.length;t++)addClass(e[t],"hide")}function H(e,t){t=t||E.data.currentLibrary.categories;for(var n=0;n<t.length;n++){if(t[n].id==e)return t[n];if(t[n].children){var o=H(e,t[n].children);if(o)return o}}}function $(){N&&N(),N=a.registerBackButtonAction(function(e){kInteractive.frameIsOpen?kInteractive.closeFrame():kInteractive.alertIsOpen?kInteractive.closeAlert():kInteractive.videoIsFullscreen?kInteractive.closeFullscreenVideo():r.searchOb.enabled?r.disableSearch():"categories"==r.tab&&r.catList!=E.data.currentLibrary.categories?r.categoryBackClicked():A?r.back():O?r.back():L&&r.back(),r.$apply()},102)}r.initialized=!1,r.init=function(){document.getElementsByClassName("libraryView");x.setLibraryLoginCallback(function(){M()}),x.setLibraryLogoutCallback(function(){r.supportsAccountView&&"all"!=r.tab&&(P("all"),b(D)),r.supportsAccountView=!1,F()}),r.sortOb={},r.sortOb.options=[{name:"dateAddedNewestFirst",data:"date",dir:"desc",val:"dateDesc"},{name:"dateAddedOldestFirst",data:"date",dir:"asc",val:"dateAsc"},{name:"titleA-Z",data:"name",dir:"asc",val:"titleAsc"},{name:"titleZ-A",data:"name",dir:"desc",val:"titleDesc"},{name:"categoryA-Z",data:"cat",dir:"asc",val:"catAsc"},{name:"categoryZ-A",data:"cat",dir:"desc",val:"catDesc"}],E.data.currentLibrary&&E.data.currentLibrary.defaultsort&&(r.sortOb.method=B(E.data.currentLibrary.defaultsort)),r.sortOb.method||(r.sortOb.method=B("dateDesc")),h.sortMethod=r.sortOb.method,r.$on("$ionicView.beforeEnter",function(e,t){if(v.removeBookConfigElem(),g.clearContent(),null,!(r.native||r.desktop||d.authenticated&&"library"==config.kotobee.mode)){var n="loading";l.forwardView()?n=l.forwardView().stateId:l.backView()&&(n=l.backView().stateId),l.nextViewOptions({disableAnimate:!0}),i.path("/"+n)}l.forwardView()&&l.forwardView().stateId,l.backView()&&l.backView().stateId,"forward"==t.direction&&(E.data.currentLibrary.books=[],E.data.favorites=[])}),r.$on("$ionicView.afterEnter",function(e,t){if(mobile&&"neverShow"==config.autohideLibMode&&o.hideBtns(),"back"==t.direction)return F(),h.setBrowserTitle(),void E.resetBook();x.cloudParam("public")?M():x.cloudParam("entry")?x.login().then(function(e){e.error&&M()}):M()})},r.userLogin=function(){x.userLoggedIn()?x.logout():t.update({error:"s_authError"})},r.langSelected=function(e){r.langDropdownExpanded=!1,E.data.settings.language=e,S.langChanged()},r.showLibraryMenu=function(){p.show({mode:"libraryMenu",menuItem:r.menuItemClicked,backdropClickToClose:!1})},r.spaceAvailable=function(e){var t=L?.95:.8;e=e||document.getElementById("libraryThumbs");var n=document.getElementById("libraryThumbsContent");if(t<e.scrollTop/(document.getElementById("libraryThumbsContent").offsetHeight-e.offsetHeight)||e.offsetHeight>n.offsetHeight){if(T)return;if(!r.moreDataExists())return;return T=!0,r.loadMore(),!0}},r.scroll=function(e){return r.spaceAvailable(e)},r.bookClicked=function(e){config.skipLibBookInfo?n.immediateEnter(e):n.show({book:e,categoryClicked:r.categoryClicked})},r.refresherExists=function(){try{if(!E.data.currentLibrary)return!1;if("categories"==r.tab)return!1;if("downloaded"==r.tab)return!1;if("favorites"==r.tab)return!0;if("account"==r.tab)return!0;if("all"==r.tab)return!0}catch(e){return!1}return!0},r.doRefresh=function(){var e={accumulated:!0};"all"==r.tab?D(e):"account"==r.tab?(e.account=!0,D(e)):"favorites"==r.tab?r.loadFavorites(e):r.stopRefresher()},r.sort=function(){h.sortMethod=r.sortOb.method,"downloaded"==r.tab?I("orderBy")(r.data.downloaded,r.sortOb.method.data):"account"==r.tab?D({account:!0}):"favorites"==r.tab?r.loadFavorites():D()},r.menuItemClicked=function(e){"language"==e&&S.langChanged(),"redeemCode"==e&&(p.hide(),r.redeemCodeClicked()),"info"==e&&(p.hide(),u.show({mode:"libraryInfo",dynamic:!0,animation:"slide-in-up",libraryInfo:E.data.currentLibrary.libraryinfo})),"logout"==e&&(p.hide(),r.data.user.pwd||r.data.user.code?x.logout():t.update({error:"s_authError"})),"exit"==e&&(p.hide(),u.show({mode:"exit",backdropClickToClose:!1,exitOptions:{exit:function(){C.exit()}}}))},r.loadFavorites=function(e){e=e||{},r.paneMsg=null,A&&(e.catid=A.id),O&&(e.key=O),L&&(e.contentkey=L),e.favs=!0,h.getEbooks(e,function(e){r.bookSource=e,"favorites"==r.tab&&(e.error&&(r.paneMsg="failedToGetFavs"),0==e.length&&(r.paneMsg="noFavsAvailable"),r.spaceAvailable()||F())})},r.searchEbooks=function(e){if(e&&e.length&&0!=e.length){if(e.length<3)return t.update({error:"lessThan3Characters"}),void u.hide();r.subMode="search",r.title="searchResults",config.searchLibContent?L=h.currentContentKey=e:O=h.currentKey=e,A=h.currentCat=null,r.currentCat=A,r.supportsAccountView&&"all"!=r.tab?(P("account"),b(function(){D({account:!0})})):(P("all"),b(D)),$()}},r.enableSearch=function(){r.searchOb.enabled=!0,$()},r.disableSearch=function(){r.searchOb.enabled=!1,N&&N()},r.loadMore=function(){var e={more:!0,accumulated:!0};"all"==r.tab?D(e):"customCat"==r.tab?D(e):"account"==r.tab?(e.account=!0,D(e)):"favorites"==r.tab?r.loadFavorites(e):(r.stopInfiniteScroll(),T=!0)},r.stopInfiniteScroll=function(){s.$broadcast("scroll.infiniteScrollComplete")},r.stopRefresher=function(){s.$broadcast("scroll.refreshComplete")},r.moreDataExists=function(){try{if(!E.data.currentLibrary)return!1;if("categories"==r.tab)return!1;if("downloaded"==r.tab)return!1;var e;if("favorites"==r.tab&&(e=r.data.favorites),"all"==r.tab&&(e=E.data.currentLibrary.books),"customCat"==r.tab&&(e=E.data.currentLibrary.books),"account"==r.tab&&(e=E.data.currentLibrary.books),0==e.length)return!1}catch(e){return!1}return r.moreData},r.back=function(){r.subMode=!1,r.title=null,O=h.currentKey=null,L=h.currentContentKey=null,A=h.currentCat=null,r.currentCat=A,r.supportsAccountView&&"all"!=r.tab?(P("account"),b(function(){D({account:!0})})):(P("all"),b(D)),N&&N()},r.categoryBackClicked=function(){if(r.catList&&r.catList.length){var e=r.catList[0].parent;for(e=H(e.id);;){if(!(e=e.parent))return void(r.catList=E.data.currentLibrary.categories);if("separate"==(e=H(e.id)).submode)return void(r.catList=e.children)}}},r.categoryClicked=function(e){native&&C.vibrate(),"expand"!=e.submode?"categories"!=r.tab||"separate"!=e.submode?(A=h.currentCat=e,O=h.currentKey=null,L=h.currentContentKey=null,r.subMode="category",r.title=A.name,r.currentCat=A,r.supportsAccountView?(P("account"),b(function(){D({account:!0})})):(P("all"),b(D)),$()):r.catList=e.children:e.expand=!e.expand},r.categoriesClicked=function(){native&&C.vibrate(),A=O=null,L=null,r.title=r.subMode=null,P("categories"),r.paneMsg=null,F()},r.accountClicked=function(){native&&C.vibrate(),A=O=null,L=null,r.title=r.subMode=null,P("account"),F(),b(function(){D({account:!0})})},r.allClicked=function(){native&&C.vibrate(),A=O=null,L=null,r.title=r.subMode=null,P("all"),b(D)},r.downloadedClicked=function(){native&&C.vibrate(),A=O=null,L=null,r.title=r.subMode=null,P("downloaded"),r.paneMsg=null,0==E.data.downloaded.length&&(r.paneMsg="noEbooksDownloaded"),r.bookSource=E.data.downloaded,F()},r.favoritesClicked=function(){native&&C.vibrate(),A=O=null,L=null,r.title=r.subMode=null,P("favorites"),r.loadFavorites()},r.redeemCodeClicked=function(){d.redeemCode({source:"topmenu"},function(){r.allClicked()})}}]),app.controller("LoginCtrl",["$scope","initializer","crdv","$ionicHistory","popovers","design","modals","error","backend","auth","stg","cache","translit","$location",function(t,n,o,r,i,e,a,s,c,l,d,u,p,f){t.model={};t.init=function(){mobile||(e.stylize("login",e.getBgStyle()),c.addListener("pathsChanged",function(){e.stylize("login",e.getBgStyle())})),"email"==config.kotobee.loginmode||config.kotobee.promocodesdisabled?t.canLoginByEmail=!0:"code"==config.kotobee.loginmode?t.canLoginByCode=!0:t.canLoginByEmail=t.canLoginByCode=!0,t.mode=t.canLoginByEmail?"email":"code",t.$on("$ionicView.afterEnter",function(){u.setOb("title",replaceHTML(u.getOb("title"),p.get("login")))}),t.native||t.desktop||t.$on("$ionicView.beforeEnter",function(){if(!n.initialized||config.kotobee.public||c.userLoggedIn()){var e="loading";r.forwardView()?e=r.forwardView().stateId:r.backView()&&(e=r.backView().stateId),r.nextViewOptions({disableAnimate:!0}),f.path("/"+e)}})},t.showMenu=function(){var e=[{name:p.get("exit"),func:function(){i.hide(),a.show({mode:"exit",backdropClickToClose:!1,exitOptions:{exit:function(){o.exit()}}})}}];i.show({mode:"cornerList",listOb:e,backdropClickToClose:!1})},t.login=function(){if(t.model){if("code"==t.mode){if(!t.model.code)return void s.update({error:"enterYourCode"});d.data.user.code=t.model.code,d.data.user.email=d.data.user.pwd=null}else{if(!d.data.user.email)return void s.update({error:"enterYourEmail"});if(!t.model.pwd)return void s.update({error:"enterYourPwd"});d.data.user.pwd=t.model.pwd,d.data.user.code=null}config.kotobee.permsLoaded?e():l.getPermissions(e)}function e(){c.login({dontShowErrorDialog:!0,userInput:!0}).then(function(e){e.error?s.update({error:"s_authError"==e.error?"accessDenied":e.error}):(t.model.pwd=null,t.model.code=null,l.startup())})}},t.register=function(){a.hide(),f.path("/register")},t.forgotPassword=function(){f.path("/forgotpwd")},t.signInByEmail=function(){t.mode="email"},t.redeemCode=function(){t.mode="code"}}]),app.controller("MediaCtrl",["$ionicScrollDelegate","media","$ionicModal","$location","$rootScope","$scope","selection","crdv","stg","$ionicLoading",function(e,t,n,o,r,i,a,s,c,l){i.init=function(){},i.mediaClicked=function(e){t.show(e)},i.hide=function(){t.hide()}}]),app.controller("MiniappsCtrl",["$scope","miniapps",function(e,t){e.init=function(){},e.miniappClicked=function(e){t.openFromMenu(e)}}]),app.controller("NotebookCtrl",["$scope","$ionicScrollDelegate","$timeout","crdv","translit","$rootScope","annotations","selection","bookmarks","book","chapters","$location","modals","$stateParams","notes","hlights","stg",function(o,r,i,a,d,n,t,s,c,u,l,e,p,f,h,g,m){o.model={},o.ui={},o.noteBtns={notes:!0,bookmarks:!0,hlights:!0};o.init=function(){},o.notebookClose=function(){p.hide(),o.bookmarkContent=null,o.noteContent=null,o.hlightContent=null,o.notebook={}},o.noteBtnClicked=function(e,t,n){n&&n.stopPropagation(),"all"==e?t.notes=t.bookmarks=t.hlights=!(t.notes&&t.bookmarks&&t.hlights):(t.notes=t.bookmarks=t.hlights=!1,t[e]=!0),overflowScroll?document.getElementById("notebookContent").scrollTop=0:r.$getByHandle("notebookScroll").scrollTop()},o.pdfExport=function(e){e&&e.stopPropagation();var t=o.serializeNotebookHtml(),n=(m.data.book.meta.dc.title?m.data.book.meta.dc.title:d.get("book"))+".pdf";i(function(){a.createPDF(t,n,function(e){})},500)},o.loadAllNotebook=function(e){e&&e.stopPropagation(),o.loadingMoreNotes=!0,t.sync({all:!0},function(e){t.updateNotebookArray({},function(){o.loadingMoreNotes=!1,n.$$phase||n.$apply()})})},o.serializeNotebookHtml=function(){var e="<br/>",t='<html><head><meta charset="UTF-8" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body>';t+='<div id="container">',t+=l([d.get("notebookFor"),' "'+m.data.book.meta.dc.title+'"'],"h1","style='font-size:22px'"),t+="<hr/>";for(var n,o=m.data.notebookContent.results,r=0;r<o.length;r++)if(o[r]){var i="";i+=l(u.getTitleByIndex(r),"h2",'style="font-size:18px;margin: 16px 0 3px;"')+e;for(var a=0;a<o[r].length;a++){var s=o[r][a],c="";null!=s.nid?"page"==s.type?c+=l([d.get("pageNote")+": ",(n=s.note,n.replace(/(?:\r\n|\r|\n)/g,"<br/>"))],"div","style='font-weight:bold'")+e:"content"==s.type&&(c+=l([d.get("noteFor"),' "'+s.src+'"'],"p","style='font-weight:bold;margin: 8px 0;'"),s.note.includes("<img ")&&(s.note=s.note.replace(/\sstyle="(.*?)"/,""),s.note=s.note.replace(/\sclass="(.*?)"/,""),s.note=s.note.replace("<img ",'<img height="100"')),c+=l([s.note],"div","style='border: solid 1px #ddd;;border-radius: 5px;padding: 10px;'")+e):null!=s.hid?c+=l([d.get("highlight"),': "'+s.src+'"'],"div",'style="background-color:'+s.color+'"')+e:null!=s.bmid&&(c+=l([d.get("contentBookmark")],"div")+e),i+=l([c],"div")}t+=l([i],"div",'style=""')}function l(e,t,n){for(var o="",r=0;r<e.length;r++)o+=e[r];return"<"+t+(n?" "+n:"")+">"+o+"</"+t+">"}return t+="</div>",t+="</body></html>"},o.shareNotebook=function(){var e=o.serializeNotebookTxt();a.share(e)},o.serializeNotebookTxt=function(){for(var e="\n",t=d.get("notebookFor")+' "'+m.data.book.meta.dc.title+'"'+e,n=t.length;n--;)t+="#";t+=e+e;for(var o=m.data.notebookContent.results,r=0;r<o.length;r++)if(o[r]){var i=d.get("chapter")+" "+(r+1);t+=i+e;for(n=i.length;n--;)t+="_";t+=e+e;for(var a=0;a<o[r].length;a++){var s=o[r][a];null!=s.nid?"page"==s.type?t+=d.get("pageNote")+": "+s.note+e:"content"==s.type&&(s.src?t+=d.get("noteFor")+' "'+s.src+'"'+e:t+=d.get("note")+e,t+=d.get("note")+": "+s.note+e):null!=s.hid?(t+=d.get("highlightFor")+' "'+s.src+'"'+e,t+=d.get("highlightColor")+" "+s.color+e):null!=s.bmid&&(t+=d.get("contentBookmark")+e),t+="........................\n\n"}}return t},o.deleteFromNotebookContent=function(e,t){for(var n=m.data.notebookContent.results,o=0;o<n.length;o++)if(n[o])for(var r=0;r<n[o].length;r++)if(n[o][r][e]==t)return n[o].splice(r,1),void(n[o].length||n.splice(o,1))},o.noteItemClicked=function(e){var t=e.chapter,n=e.location;n=String(n).split(",")[0],n=String(n).split("-")[0],p.hide(),i(function(){l.redirect(t,{hash:n})},100)},o.deleteNote=function(e,t){h.confirmDeletion(function(){h.delete(e,null,function(e){o.noteContent=e,n.$$phase||n.$apply()})}),t.stopPropagation()},o.deleteBookmark=function(t,e){c.confirmDeletion(function(){m.deleteBookmark(t,null,function(e){o.bookmarkContent=e,s.deleteBookMarker(t),o.deleteFromNotebookContent("bmid",t),n.$$phase||n.$apply()}),e.stopPropagation()})},o.deleteHlight=function(t,e){g.confirmDeletion(function(){g.delete(t,null,function(e){o.hlightContent=e,o.deleteFromNotebookContent("hid",t),n.$$phase||n.$apply()})}),e.stopPropagation()}}]),app.controller("NoteCtrl",["$scope","$element","$ionicScrollDelegate","$timeout","crdv","translit","$rootScope","annotations","selection","bookmarks","book","chapters","$location","modals","$stateParams","notes","hlights","stg",function(t,n,e,o,r,i,a,s,c,l,d,u,p,f,h,g,m,v){var b,y;function k(){if(config.htmlInNotes){var e=document.getElementById("noteTextArea");if(!e)return setTimeout(function(){k()},30);(y=new Quill(e,{theme:"snow"})).clipboard.dangerouslyPasteHTML(0,b.note?b.note.note:"")}}t.init=function(){var e=f.getScope();if(b=e.modal.noteOptions,config.htmlInNotes){var t=document.getElementById("noteTextArea");if(!t||t.children.length)return;setTimeout(k)}setTimeout(function(){if(n.length){var e=n[0].getElementsByClassName("previousNotes");e.length&&(e[0].scrollTop=e[0].scrollHeight)}},100)},t.save=function(e){config.htmlInNotes&&(e.note=y.container.children[0].innerHTML),b.save(e)},t.delete=function(e){b.delete(e)},t.edit=function(e){t.editing==e&&(e=null),t.editing=e,b.note=e,config.htmlInNotes&&(b.note?y.clipboard.dangerouslyPasteHTML(0,b.note.note):y.setText(""))}}]),app.controller("OAuthCtrl",["$scope","$stateParams","backend","$injector","initializer","design","stg","sso",function(e,n,t,o,r,i,a,s){e.init=function(){i.stylize("oauth",i.getBgStyle()),t.getFingerprint(function(e){var t=!0;n.state&&n.state!=e&&(t=!1),t&&s.setTokens(n.provider,decodeURIComponent(n.idToken),decodeURIComponent(n.accessToken)),r.initialize()})}}]),app.controller("PaymentCtrl",["$scope","$stateParams","design","$location","stg","backend","library","bookinfo","modals",function(e,t,n,o,r,i,a,s,c){e.init=function(){mobile||(n.stylize("payment",n.getBgStyle()),i.addListener("pathsChanged",function(){n.stylize("payment",n.getBgStyle())})),config.kotobee.payment&&(e.config=config,e.state=t.state,e.bookID=t.bookID,e.userID=t.userID,r.data.payment||(r.data.payment={}),"success"==t.state?(r.data.payment.success=!0,$injector.get("backend").sendRawPost("http://localhost:9092/book/"+e.bookID+"/"+e.userID,{},{responseType:"json"},function(e){e.error&&c.show({mode:"networkError"})})):r.data.payment.success=!1)},e.openBook=function(){i.getEbook({bid:e.bookID},function(e){native?(o.path("/library"),s.show({book:e})):(a.startBook=e.id,o.path("/library"))})},e.backToLib=function(){o.path("/library")}}]),app.controller("PreviewCtrl",["cache","modals","popovers","bookinfo","crdv","np","book","$http","$rootScope","initializer","translit","error","notes","$sce","design","settings","status","tinCan","$scope","backend","stg","$location",function(e,t,n,o,r,i,a,s,c,l,d,u,p,f,h,g,m,v,b,y,k,w){b.init=function(){b.mobile=mobile,b.native=native,b.desktop=desktop,b.ios=ios,b.preview=preview,b.config=config,b.start()},b.start=function(){c.data=k.data,c.view=k.view,b.cloudParam=y.cloudParam,t.setScope(b),n.setScope(b),b.started=!0},b.previewPage=function(e,t){b.started?(t=t||{lang:"en",book:{name:"Alice",description:"A great book indeed"}},"bookInfo"==(e=e||"bookInfo")&&(config=t.config?t.config:{kotobee:{entry:1,mode:"library"}},k.data.user=t.user?t.user:{loggedIn:!0},k.data.currentLibrary=t.library?t.library:{},y.getS3Paths(function(){d.setLang(t.lang?t.lang:"en"),o.show({book:t.book},{animation:"none"})}))):setTimeout(function(){b.previewPage(e,t)},100)},b.kTemplate=function(e){return kTemplate(e)},b.translit=function(e){return d.get(e)},b.htmlSafe=function(e){return f.trustAsHtml(e)}}]),app.controller("ProfileCtrl",["$scope","stg","backend","$rootScope",function(t,n,o,r){t.model={},t.ui={},t.tab="info";var i;t.init=function(){if(!i){for(var e in i=!0,t.user=n.data.user,t.fields=0,config.kotobee.registrationsettings)t.fields++;o.getUserProfile({},function(e){t.user=e.info,t.user.dob&&(t.user.dob=phpDateToJS(t.user.dob)),t.activity=e.activity,t.payments=e.payments,r.$$phase||r.$apply()}),setTimeout(function(){i=!1},2e3)}},t.setTab=function(e){t.tab=e},t.updateInfo=function(){t.saving=!0;var e=Object.assign({},t.user);o.updateProfile(e,function(e){t.saving=!1,e&&!e.error||t.hideModal()})}}]),app.controller("ReaderCtrl",["$ionicScrollDelegate","modals","library","$sce","$location","$rootScope","$scope","selection","$ionicSideMenuDelegate","$state","$ionicPopover","chapters","book","$timeout","stg",function(e,t,n,o,r,i,a,s,c,l,d,u,p,f,h){a.init=function(){a.mode="reading"},a.chapterClicked=function(e){u.displayChapters()},a.backClicked=function(e){c.isOpenLeft()||t.show({mode:"backToLib",backdropClickToClose:!1,backToLibOptions:{back:function(){t.hide(),r.path("/library")}}})},a.searchClicked=function(e){a.applyHeader("search")},a.menuClicked=function(e){},a.setting1Clicked=function(e){},a.setting2Clicked=function(e){},a.setting3Clicked=function(e){},a.linkClicked=function(){}}]),app.controller("RedeemCodeCtrl",["$scope","initializer","popovers","crdv","design","stg","$location","modals","$ionicHistory","error","backend","auth","cache","translit","$window",function(t,n,o,r,e,i,a,s,c,l,d,u,p,f,h){t.init=function(){mobile||(e.stylize("redeemCode",e.getBgStyle()),d.addListener("pathsChanged",function(){e.stylize("redeemCode",e.getBgStyle())})),t.$on("$ionicView.afterEnter",function(){p.setOb("title",replaceHTML(p.getOb("title"),f.get("redeemCode")))}),t.native||t.desktop||t.$on("$ionicView.beforeEnter",function(){if(!n.initialized||d.cloudParam("public")||i.data.user&&d.userLoggedIn()){var e="loading";c.forwardView()?e=c.forwardView().stateId:c.backView()&&(e=c.backView().stateId),c.nextViewOptions({disableAnimate:!0}),a.path("/"+e)}})},t.showMenu=function(){var e=[{name:f.get("exit"),func:function(){o.hide(),s.show({mode:"exit",backdropClickToClose:!1,exitOptions:{exit:function(){r.exit()}}})}}];o.show({mode:"cornerList",listOb:e,backdropClickToClose:!1})},t.submit=function(){function e(){d.cloudParam("entry")?(c.goBack(),d.login()):d.login().then(function(e){e.error?l.update({error:"s_authError"==e.error?"accessDenied":e.error}):u.startup()})}t.user&&t.user.code&&(i.data.user.code=t.user.code,i.data.user.email=i.data.user.pwd=null,config.kotobee.permsLoaded?e():u.getPermissions(e))},t.backClicked=function(){c.goBack()}}]),app.controller("RegisterCtrl",["$scope","initializer","popovers","crdv","modals","design","stg","$ionicHistory","$location","backend","translit","cache","error","$window",function(n,t,o,r,i,e,a,s,c,l,d,u,p,f){n.init=function(){n.user={email1:"",email2:""},mobile||(e.stylize("register",e.getBgStyle()),l.addListener("pathsChanged",function(){e.stylize("register",e.getBgStyle())})),n.$on("$ionicView.afterEnter",function(){u.setOb("title",replaceHTML(u.getOb("title"),d.get("register")))}),n.native||n.desktop||n.$on("$ionicView.beforeEnter",function(){if(!t.initialized||config.kotobee.public||l.userLoggedIn()){var e="loading";s.forwardView()?e=s.forwardView().stateId:s.backView()&&(e=s.backView().stateId),s.nextViewOptions({disableAnimate:!0}),c.path("/"+e)}})},n.showMenu=function(){var e=[{name:d.get("exit"),func:function(){o.hide(),i.show({mode:"exit",backdropClickToClose:!1,exitOptions:{exit:function(){r.exit()}}})}}];o.show({mode:"cornerList",listOb:e,backdropClickToClose:!1})},n.create=function(){!function(){var e=n.user;if(-1==e.email1.indexOf("@"))return p.update({error:"emailFormatError"}),!1;if(!/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(e.email1))return p.update({error:"emailFormatError"}),!1;if(e.email1!=e.email2)return p.update({error:"emailsDontMatch"}),!1;var t=config.kotobee.registrationsettings;t=t||{};if(t.namerequired&&!e.name)return p.update({error:"fillInAllFields"}),!1;if(t.dobrequired&&!e.dob)return p.update({error:"fillInAllFields"}),!1;if(!t.organizationrequired||e.organization)return(!t.deptrequired||e.dept)&&(!t.countryrequired||e.country)&&(!t.cityrequired||e.city)&&(!t.phonerequired||e.phone)&&!(t.inforequired&&!e.info)||(p.update({error:"fillInAllFields"}),!1);return p.update({error:"fillInAllFields"}),!1}()||l.register(n.user,function(e){if(e.error)p.update(e);else{var t="d_accountCreated";e.success&&e.success.approvalRequired&&(t="d_accountCreatedApprovalRequired"),i.show({mode:"success",successOptions:{msg:d.get(t)}}),s.goBack()}})},n.backClicked=function(){s.goBack()}}]),app.controller("RendererCtrl",["$rootScope","$ionicHistory","modals","events","freehand","nav","backend","traverser","library","settings","book","auth","status","popovers","$sce","error","translit","cache","$ionicPlatform","bookmarks","hlights","notes","$ionicSideMenuDelegate","$scope","$ionicScrollDelegate","$filter","chapters","$ionicPopup","$location","$timeout","selection","crdv","$ionicLoading","stg","search","$ionicModal",function(s,t,c,e,o,n,r,l,i,a,d,u,p,f,h,g,m,v,b,y,k,w,x,C,I,E,S,T,O,A,N,L,B,M,R,P){function D(e){"c"==e.key&&(e.ctrlKey||e.metaKey)&&N.copyToClipboard(),e.shiftKey&&("ArrowRight"==e.key?N.extendRight():"ArrowLeft"==e.key&&N.extendLeft())}C.init=function(){s.renderScope=C,N.listener=C.selection,C.searchContent={},C.sideMenuMode="bookSettings";var e=b.registerBackButtonAction(function(e){var t=O.path();kInteractive.frameIsOpen?kInteractive.closeFrame():kInteractive.alertIsOpen?kInteractive.closeAlert():kInteractive.videoIsFullscreen?kInteractive.closeFullscreenVideo():"default"!=C.header.mode?"selection"==C.header.mode?N.reset():C.applyHeader("default"):M.data.book.chapter.viewport&&n.getFxlScale()!=n.getFxlFit().bestFit?n.fxlZoomFit():"library"==config.kotobee.mode&&0==t.indexOf("/book")?O.path("/library"):isReaderApp&&"/app"!=t?O.path("/app"):c.show({mode:"exit",backdropClickToClose:!1,exitOptions:{exit:function(){L.exit()}}}),C.$apply()},103);C.$on("$destroy",e),C.native||C.desktop||C.$on("$ionicView.beforeEnter",function(){if(!u.authenticated){var e="loading";t.forwardView()?e=t.forwardView().stateId:t.backView()&&(e=t.backView().stateId),t.nextViewOptions({disableAnimate:!0}),O.path("/"+e)}})},C.setSideMenuMode=function(e){C.sideMenuMode=e},C.applyHeader=function(e){try{C.header.mode=e}catch(e){}},C.header={mode:"default"},C.selection=function(e){mobile?"activated"==e||"selectionFixed"==e?(C.applyHeader("selection"),kotobee.dispatchEvent("textSelected",{text:N.getSelectedText()})):"deactivated"==e&&(C.applyHeader("default"),kotobee.dispatchEvent("textDeselected")):"selectionFixed"==e?(addClass(document.getElementById("selectionOptions"),"showBar"),document.getElementById("copyBtn").setAttribute("data-clipboard-text",N.getSelectedText()),window.addEventListener("keydown",D),kotobee.dispatchEvent("textSelected",{text:N.getSelectedText()})):"deactivated"==e&&(removeClass(document.getElementById("selectionOptions"),"showBar"),window.removeEventListener("keydown",D),kotobee.dispatchEvent("textDeselected"))},C.contentLink=function(e){S.applyChapterStateFromURL(e.getAttribute("href"))},C.chapterLink=function(e){if(0<e.parentElement.getElementsByTagName("ol").length){var t=e.offsetHeight+20;if(overflowScroll||I.$getByHandle("chapters").scrollBy(0,t,!0),!e.getAttribute("href")||e.getAttribute("data-dontshow"))return void(hasClass(e.parentElement,"expanded")?removeClass(e.parentElement,"expanded"):addClass(e.parentElement,"expanded"));addClass(e.parentElement,"expanded")}x.toggleLeft(!1),x.toggleRight(!1),O.search("vi");var n=S.getIndexFromTocElem(e);S.applyChapterStateFromURL(e.getAttribute("href"),{vIndex:0,index:n}),C.$$phase||C.$apply()},C.targetCurrentChapter=function(e){S.highlightCurrentTocChapter()},C.externalLink=function(e){var t=e.getAttribute("href"),n=e.getAttribute("target");r.externalLink(t,{target:n}),kInteractive.events&&kInteractive.events.add({action:"linkClicked",param:t,elem:e})},C.bookmarkClicked=function(e){y.addBookmark()},C.freehandClicked=function(e,t){var n=e.target;n.classList.contains("active")?o.deactivate():o.activate(),n.classList.toggle("active")},C.noteClicked=function(e,t){w.noteClicked(e?[e]:null,t)},C.miniappsClicked=function(){if(M.data.settings.rtl){if(x.isOpenLeft()&&"miniapps"!=C.sideMenuMode)return x.toggleLeft(),void A(C.settingsClicked,300)}else if(x.isOpenRight()&&"miniapps"!=C.sideMenuMode)return x.toggleRight(),void A(C.settingsClicked,300);native&&L.vibrate(),C.setSideMenuMode("miniapps"),mobile&&n.resize(),M.data.settings.rtl?x.toggleLeft():x.toggleRight()},C.search=function(e,n,t,o){if(e&&e.length&&0!=e.length){if(e.length<3)return g.update({error:"lessThan3Characters"}),void c.hide();C.applyHeader("default"),null==t&&(C.searchStack=[0]),p.update(m.get("searching"),null,{dots:!0,timeoutDuration:6e4}),n||(n="all",t=t||0);var r={key:e,mode:n,limit:40,start:t,array:o};A(function(){R.start(r,function(e){p.update(null),C.searchContent=e;for(var t=0;t<C.searchContent.results.length;t++)if(C.searchContent.results[t]&&C.searchContent.results[t].matches.length){C.searchContent.notEmpty=!0;break}"all"==n?(C.$broadcast("scroll.infiniteScrollComplete"),overflowScroll?document.getElementById("searchScroll").scrollTop=0:I.$getByHandle("searchScroll").scrollTop()):"chapter"==n&&A(function(){C.applyHeader("searchItems")},500)})},500)}},C.searchMore=function(){for(var e,t=C.searchContent.results.length;t--;)if(C.searchContent.results[t]&&C.searchContent.results[t].matches[0]){e=C.searchContent.results[t].matches[0];break}e?(C.searchStack.push(e.chapter+1),overflowScroll?document.getElementById("searchScroll").scrollTop=0:I.$getByHandle("searchScroll").scrollTop(),C.search(C.searchContent.key,"all",e.chapter+1)):C.searchContent.more=!1},C.searchBack=function(){if(!(C.searchStack.length<=1)){C.searchStack.pop();var e=C.searchStack.pop();overflowScroll?document.getElementById("searchScroll").scrollTop=0:I.$getByHandle("searchScroll").scrollTop(),C.search(C.searchContent.key,"all",e)}},C.locateInChapter=function(e){c.hide(),C.search(e,"chapter")},C.clearResults=function(){C.searchContent={},C.applyHeader("default"),overflowScroll?document.getElementById("searchScroll").scrollTop=0:I.$getByHandle("searchScroll").scrollTop()},C.searchItemClickedVeryOld=function(e){var o=e.item;e.index,e.matches;c.hide(),timeOut(function(){S.addListener(function e(t){if("newChapter"==t){S.removeListener(e);var n=l.getElemsByLocation(o.location)[0];timeOut(function(){addClass(n,"searchItemHighlightFade"),timeOut(function(){removeClass(n,"searchItemHighlightFade")},2200)},1200)}}),O.path(d.root+"/reader/chapter/"+o.chapter+"/"+o.location)},300)},C.searchItemClicked=function(e){R.searchItemClicked(e,{timer:!0},function(){s.renderScope.applyHeader(""),A(function(){s.renderScope.applyHeader("searchItems"),s.$$phase||s.$apply()})})},C.searchItemClickedOld=function(e,t){var i=e.item,n=e.index,o=e.matches;function a(e){"renderedChapter"==e&&(p.update(),S.removeListener(a),o.index=n,C.applyHeader("searchItems"))}c.hide(),timeOut(function(){p.update(m.get("pleaseWait"),null,{dots:!0}),S.addListener(a);var n=i.chapter,o=i.location,r={hash:o};S.getPageOb({page:n},function(e){if(S.shouldBePaged(e)){var t=l.getPageByLocation(e,o);null!=t&&(r.vIndex=t,O.search({vi:t}))}if(O.path(d.root+"/reader/chapter/"+n+"/"+o,r),e.index==currentIndex){if(r.vIndex&&r.vIndex==currentVIndex)return void a("renderedChapter");S.loadChapterByIndex(currentIndex,r)}s.$$phase||s.$apply()})},300)},C.fxlZoomIn=function(e){n.fxlZoomIn(e)},C.fxlZoomOut=function(e){n.fxlZoomOut(e)},C.fxlZoomFit=function(e){n.fxlZoomFit(e)}}]),app.controller("SdkCtrl",["$scope","modals","stg","$element",function(r,i,a,e){var s,t={name:"Local book",mode:"book",locked:!0,liburl:"http://dev.kotobee.com/"};function c(e){e=e||r.profiles;for(var t=[],n=0;n<e.length;n++){var o={};o.name=e[n].name,o.mode=e[n].mode,o.liburl=e[n].liburl,o.cloudid=e[n].cloudid,o.hostPath=e[n].hostPath,o.locked=e[n].locked,t.push(o)}a.writeSlot("sdkProfiles",t,function(){})}function n(e){hasParentWithId(e.target,"sdkProfiler",50)||hasParent(e.target,"modal",50)||r.close()}r.init=function(){debug||e[0].parentNode.removeChild(e[0])},r.profilerClicked=function(){r.expanded?r.close():r.open(),a.readSlot("sdkProfiles",function(e){e&&e.length||(e=[clone(t)]),r.profiles=e,r.$$phase||r.$apply()}),a.readSlot("sdkProfilesEnabled",function(e){r.useProfiles=e,r.$$phase||r.$apply()})},r.toProfiles=function(){e[0].getElementsByClassName("profiles")[0].scrollIntoViewIfNeeded()},r.open=function(){r.expanded=!0,document.addEventListener("click",n)},r.close=function(){r.expanded=!1,document.removeEventListener("click",n)},r.lockedProfileClicked=function(e){i.show({mode:"generalError",errorOptions:{msg:"The default profile is always locked. You can never delete it."}})},r.delProfile=function(t){if(!s){i.hide();var n={title:"Confirmation",msg:"Are you sure you want to delete this profile?",barStyle:"bar-dark"},e={label:"delete",style:"button-assertive",func:function(){n.dontAskChecked&&(s=!0),i.hide();for(var e=0;e<r.profiles.length;e++)if(t==r.profiles[e])return r.profiles.splice(e,1),void c()}},o={label:"cancel",func:function(){n.dontAskChecked&&(s=!0),i.hide()}};n.dontAsk=!0,n.btns=[e,o],i.show({mode:"confirm",confirmOptions:n})}},r.editProfile=function(e){e.editing=!0},r.saveEditedProfile=function(e){c(),e.editing=!1},r.cancelEditingProfile=function(e){e.editing=!1},r.cancelNewProfileForm=function(){r.addingProfile=!1},r.showNewProfileForm=function(){r.newProfile={mode:"book",liburl:"http://dev.kotobee.com/",cloudid:null},r.addingProfile=!0},r.addProfile=function(e){e.hostType=e.hostPath?"kotobee":null,e.name||(e.name="Untitled profile"),r.profiles.push(e),c(),r.addingProfile=!1},r.useProfilesChanged=function(){a.writeSlot("sdkProfilesEnabled",r.useProfiles,function(){})},r.connect=function(e){i.hide();var t={title:"Confirmation",msg:"Restart the reader?",barStyle:"bar-dark"},n={label:"Restart",style:"button-balanced",func:function(){i.hide(),a.writeSlot("sdkProfile",e,function(){setTimeout(function(){location.reload()},300)})}},o={label:"cancel",func:function(){i.hide()}};t.btns=[n,o],i.show({mode:"confirm",confirmOptions:t})}}]),app.controller("SearchItemsCtrl",["$ionicScrollDelegate","search","book","chapters","cache","traverser","$ionicModal","$location","virt","$rootScope","$scope","selection",function(e,n,t,r,o,i,a,s,c,l,d,u){d.index=0;d.init=function(){d.index=0,d.titleMode=3,d.results=[];var e=d.searchContent.results[currentIndex];e&&(d.results=e.matches),d.results.index&&(d.index=d.results.index),0==d.results.length?d.titleMode="empty":d.highlightCurrentItem({initial:!0}),d.$on("$destroy",function(){n.removeHighlights()})},d.backClicked=function(){d.applyHeader("default")},d.up=function(){0==d.index&&(d.index=d.results.length),d.index--,d.highlightCurrentItem()},d.down=function(){d.index==d.results.length-1&&(d.index=-1),d.index++,d.highlightCurrentItem()},d.highlightCurrentItem=function(e){var t;d.results&&r.getPageOb({page:currentIndex},function(e){n.removeHighlights(),t=d.results[d.index].location,r.addListener(o),r.redirect(currentIndex,{hash:t})});function o(e){if("renderedChapter"==e){0,r.removeListener(o),r.hideLoader();var t=r.getCurrentHash(),n=i.getElemsByLocation(t);n[0]&&(n[0].offsetParent?(d.titleMode="title",addClass(n[0],"searchItemHighlight"),c.safeScrollToElem("content",n[0],!0)):d.titleMode="hidden")}}}}]),app.controller("SelectionCtrl",["$ionicScrollDelegate","chapters","translit","error","status","modals","notes","$window","$location","$sce","$rootScope","backend","hlights","$scope","selection","crdv","stg",function(e,t,r,i,a,n,s,o,c,l,d,u,p,f,h,g,m){function v(e){return e.replace(/^[!?., {}()]*(.*?)[!?.,{} ()]*$/g,"$1")}f.init=function(){},f.tts=function(e){if(config.tts){e=e||0;var t=h.getSelectedText();if(t)if(desktop)i.update({error:"speechUnsupportedInDesktop"});else if(preview)i.update({error:"speechUnsupportedInPreview"});else if(native&&"undefined"!=typeof TTS)g.tts(t,function(e){});else try{if("speechSynthesis"in window&&SpeechSynthesisUtterance){a.showAndHide(r.get("preparingVoice"),600,{dots:!0}),window.speechSynthesis.cancel();var n=new SpeechSynthesisUtterance,o=window.speechSynthesis.getVoices();if(!o.length){if(20<e)return;return setTimeout(function(){f.tts(++e)},50)}if(n.lang=config.defaultTtsLanguage?config.defaultTtsLanguage:"en-US",n.rate=(config.ttsRate?config.ttsRate:100)/100,n.voice=o.filter(function(e){return e.lang==n.lang})[0],!n.voice)return;n.text=t,window.speechSynthesis.speak(n)}else i.update({error:"speechUnsupported"})}catch(e){i.update({error:"speechUnsupported"})}}},f.copy=function(){h.copyToClipboard()},f.share=function(){if(config.share){var e=h.getSelectedText();e&&g.share(e)}},f.note=function(e){if(config.annotations){var t,n=h.getLocation(),o=[];n.left?((t={type:"content"}).location=n.leftRange,t.chapter=m.data.currentPageOb.index,t.src=h.getSelectedText(void 0),t.event=e,o.push(t)):n.right&&((t={type:"content"}).location=n.rightRange,t.chapter=m.data.currentRPageOb.index,t.src=h.getSelectedText(void 0),t.event=e,o.push(t)),s.noteClicked(o,function(e){h.reset()})}},f.highlight=function(){if(config.annotations){var e,t=h.getSelectedNodes(),n=h.getLocation(),o=[];n.left&&((e={}).location=n.leftRange,e.chapter=m.data.currentPageOb.index,e.src=h.getSelectedText(t),o.push(e)),n.right&&((e={}).location=n.rightRange,e.chapter=m.data.currentRPageOb.index,e.src=h.getSelectedText(t),o.push(e));for(var r=0;r<t.length;r++)if(hasClass(t[r],"contentHlightBG")){for(var i=getClassThatStartsWith(t[r],"hlight"),a=0;a<o.length;a++)o[a].hid=i.substr(6);return void m.getHlightById(o[0].hid,function(e){for(var t=0;t<o.length;t++)o[t].color=e.color;s()})}s()}function s(){p.showPopup(o,function(e){h.reset()})}},f.google=function(){if(config.googleLookup){var e=v(h.getSelectedText());if(e)try{var t="http://www.google.com/custom?q="+e;return void u.externalLink(t,{secure:!0})}catch(e){}}},f.wikipedia=function(){if(config.wikipediaLookup){var e=v(h.getSelectedText());if(e)try{var t="https://"+(config.wikipediaLang?config.wikipediaLang:"en")+".wikipedia.org/wiki/"+e;u.externalLink(t,{secure:!0})}catch(e){}}},f.backClicked=function(){h.reset()}}]),app.controller("SelectionOptionsCtrl",["$scope","$http","stg","$ionicScrollDelegate","$ionicPopup","$timeout","selection",function(e,t,n,o,r,i,a){e.init=function(){},e.expand=function(){a.expand()},e.extendRight=function(){a.extendRight()},e.extendLeft=function(){a.extendLeft()}}]),app.controller("ShareCtrl",["$scope","$element","stg","modals","book","selection",function(r,t,i,e,n,o){function a(){var e={};e.url=window.location.href,r.options.bookAuthor&&(e.creator=i.data.book.meta.dc.creator),e.language=i.data.book.meta.dc.language,r.options.bookPublisher&&(e.publisher=i.data.book.meta.dc.publisher),r.options.bookTitle&&(e.title=i.data.book.meta.dc.title),e.iconUrl=i.data.epub.bookThumb,isAbsoluteURLPath(e.iconUrl)||(e.iconUrl=window.location.origin+"/"+e.iconUrl),e.url=r.shareLink,e.iconUrl=e.url+i.data.epub.bookThumb,r.options.bookDescription&&(e.description=i.data.book.meta.dc.description),e.lang=i.data.settings.language;var t=encodeURI(JSON.stringify(e)),n=config.kotobee.liburl,o="";return o+="\x3c!-- Kotobee Embed Code --\x3e\n",o+="<script data-props='"+t+'\' type="text/javascript" src="'+(n=n||"https://www.kotobee.com/")+'js/kembed.js?v=1"><\/script>\n',o+="\x3c!-- --\x3e\n"}r.init=function(){r.options={bookTitle:!0},r.currentTab="embed",r.shareLink=window.location.href.split("#")[0],r.shareLink.endsWith("/")||(r.shareLink+="/"),r.embedCode=a(),r.twitterLink="https://twitter.com/share?url="+r.shareLink,r.fbLink="https://www.facebook.com/sharer.php?u="+r.shareLink,r.whatsappLink="whatsapp://send?text="+r.shareLink},r.embedCodeClicked=function(){var e=t[0].getElementsByClassName("embedCode");e.length&&e[0].select()},r.shareLinkClicked=function(){var e=t[0].getElementsByClassName("shareLink");e.length&&e[0].select()},r.optionChanged=function(){r.updateEmbedCode()},r.copyEmbedCode=function(){o.copyToClipboard(r.embedCode,!0)},r.copyLink=function(){o.copyToClipboard(r.shareLink,!0)},r.openTab=function(e){r.currentTab=e},r.shareClose=function(){e.hide()},r.updateEmbedCode=function(){r.embedCode=a()}}]),app.controller("TabMenuCtrl",["$scope","cache","modals","nav","settings","book","notes","annotations","$rootScope","$ionicSideMenuDelegate","library","$stateParams","$location","$sce","$ionicScrollDelegate","chapters","virt","translit","$ionicModal","hlights","$timeout","$filter","stg","crdv","selection",function(t,e,n,o,r,i,a,s,l,c,d,u,p,f,h,g,m,v,b,y,k,w,x,C,I){t.init=function(){t.$watch(function(){return c.isOpenRight()},function(e){e||k(function(){t.setSideMenuMode("bookSettings")},100)})},t.chaptersClicked=function(){g.displayChapters()},t.mediaClicked=function(){if(x.data.settings.rtl){if(c.isOpenLeft()&&"media"!=t.sideMenuMode)return c.toggleLeft(),void k(t.mediaClicked,300)}else if(c.isOpenRight()&&"media"!=t.sideMenuMode)return c.toggleRight(),void k(t.mediaClicked,300);native&&C.vibrate(),t.setSideMenuMode("media"),mobile&&o.resize(),x.data.settings.rtl?c.toggleLeft():c.toggleRight()},t.notebookClicked=function(e){if(!(e=e||{}).popupOnly&&l.widescreen)return t.chaptersClicked();a.notebookClicked(t)},t.pdfClicked=function(){g.convertPDF()},t.printClicked=function(){g.print()},t.shareClicked=function(){n.show({mode:"share",dynamic:!0,animation:"slide-in-up"})},t.settingsClicked=function(){if(x.data.settings.rtl){if(c.isOpenLeft()&&"bookSettings"!=t.sideMenuMode)return c.toggleLeft(),void k(t.settingsClicked,300)}else if(c.isOpenRight()&&"bookSettings"!=t.sideMenuMode)return c.toggleRight(),void k(t.settingsClicked,300);native&&C.vibrate(),t.setSideMenuMode("bookSettings"),mobile&&o.resize(),x.data.settings.rtl?c.toggleLeft():c.toggleRight()},t.searchClicked=function(e){native&&C.vibrate(),mobile&&o.resize(),n.show({mode:"search",dynamic:!0,animation:"slide-in-up",scope:t,cb:function(){t.searchContent.notEmpty||k(function(){C.showKeyboard()},200),e&&e()}})},t.settingsClose=function(){n.hide(),x.writeSlot("settings"+x.getBookId(!0),t.data.settings)};var E=[];t.customTabClicked=function(e,t){var n=document.createElement("div");if(e.relToRoot=!0,"audio"==e.type){var o,r=ph.join(bookPath,e.audio);r=cleanURL(r),e.id||(e.id=Math.round(1e4*Math.random()));for(var i=0;i<E.length;i++){if(E[i].getAttribute("id")=="audio-"+e.id&&!(o=E[i]).paused)return o.pause(),void(o.src="");E[i].paused||(E[i].pause(),E[i].src="")}if(!o){(o=document.createElement("audio")).setAttribute("data-dontclose",!0),o.setAttribute("id","audio-"+e.id),o.setAttribute("controls","true"),o.setAttribute("autoplay","true"),o.setAttribute("data-tap-disabled","false");var a=document.createElement("source");a.src=r,o.appendChild(a),o.appendChild(document.createTextNode("Your browser does not support the audio element")),o.className="ki-noHighlight",o.oncanplay=function(){kInteractive.tinCan({verb:"played",activity:"Audio: "+r})}}if(o.setAttribute("src",r),o.play(),E.push(o),kInteractive.scorm){var s={};s.id=kInteractive.getScormId(e.title,r),s.description="Played audio link: "+r,s.type="other",s.learnerResponses="Played",s.objective=e.options?e.options.objective:null,s.timestamp=new Date,kInteractive.scorm.setInteractions([s])}kInteractive.events&&kInteractive.events.add({action:"audioPlayed",param:r,elem:o})}else{kInteractive.writeData(n,e);var c=e.url;if(e.hash&&(c+=e.hash),n.className="kInteractive link",!c)return kInteractive.action(n,t),void t.stopPropagation();c&&n.setAttribute("href",c),e.target&&"_blank"==e.target.toLowerCase()&&n.setAttribute("target","_BLANK"),c.match(/http[s]?:/g)?l.renderScope.externalLink(n):0==c.indexOf("/")?window.open(c):0==c.indexOf("mailto:")?window.location.href=c:(0!=c.indexOf("#")&&(c=ph.join(x.data.book.chapter.url,c)),g.applyChapterStateFromURL(c))}}}]),app.controller("TextSizeCtrl",["$scope","$location","cssParser","stg","settings","markers","$injector",function(t,e,n,o,r,i,a){function s(){"rfl"==o.data.book.chapter.layout&&("double"!=o.data.book.chapter.view&&o.data.settings.pageScroll||a.get("chapters").regenerateSpreads(null,function(){}))}t.backClicked=function(){t.applyHeader("default")},t.plus=function(){var e=r.getTextSize();30<e||(e=Math.round(10*(e+.1))/10,t.data.settings.textSize=e+"em",r.updateTextSize(),r.writeTextSize(),s())},t.minus=function(){var e=r.getTextSize();e<=.2||(e=Math.round(10*(e-.1))/10,t.data.settings.textSize=e+"em",r.updateTextSize(),r.writeTextSize(),s())}}]),app.controller("ThumbCtrl",["$scope","$filter","$rootScope","np","$element","stg","$ionicModal","modals","chapters","backend","book","$location","$timeout","$ionicLoading","$ionicPopup","crdv",function(o,e,t,n,r,i,a,s,c,l,d,u,p,f,h,g){o.imgLoading=!0,o.init=function(){p(function(){if(o.book.coverImg=d.getCoverImgPath(o.book),chromeApp)if(i.data.chromeAssets[o.book.coverImg])o.book.coverImg=i.data.chromeAssets[o.book.coverImg];else{var t=o.book.coverImg;delete o.book.coverImg,getImgDataSrc(t,function(e){o.book.coverImg=e,i.data.chromeAssets[t]=e,o.$apply()})}})},o.coverLoaded=function(e){o.imgLoading=!1;var t=e[0];if(getClosest(t,".bookThumb").classList.add("loaded"),config.bookThumbShadow){var n=t.parentNode.getElementsByClassName("bookShadow");n.length&&(n[0].style.transform="scale("+t.width/t.parentNode.offsetWidth+")")}}}]),app.filter("bookSetup",["$rootScope","stg","selection","media","chapters","cache","$ionicScrollDelegate",function(l,d,r,u,p,i,e){return function(){var e=document.getElementById("chaptersContent"),c=document.getElementById("epubContainer");function t(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}i.setOb("epubContainer",c),i.setOb("chaptersContent",e),e.addEventListener("contextmenu",function(e){t(e)}),e.addEventListener("mousedown",function(e){if(2===e.which)return t(e),!1}),e.addEventListener("click",function(e){if(2===e.which)return t(e),!1}),document.getElementById("chapters").addEventListener("click",function(e){var t=e.target;if("a"==t.nodeName.toLowerCase()){if(!o(t))return;var n=t.getAttribute("href");if(n){if(n.match(/http[s]?:/g))return;if(0==n.indexOf("/"))return;l.renderScope.chapterLink(t)}else l.renderScope.chapterLink(t)}else if("i"==t.nodeName.toLowerCase()){if(!o(t))return;if(0<t.parentElement.getElementsByTagName("ol").length)t.offsetHeight,t.parentElement.classList.toggle("expanded")}function o(e){for(var t=e.parentNode;t&&t!=document.body;){if(hasClass(t,"menu")&&(hasClass(t,"menu-left")||hasClass(t,"menu-right")))return!0;t=t.parentNode}}});var n=document.getElementById("chapters");function o(e){if(hasParentWithId(e.target,"epubContainer",99)){r.active()&&r.reset();var t=e.target;if("sections"!=t.nodeName.toLowerCase()&&!hasClass(t,"k-section")&&"video"!=t.nodeName.toLowerCase()&&"audio"!=t.nodeName.toLowerCase()){if(t.hasAttribute("contenteditable"))return e.stopPropagation(),void t.focus();for(var n=t.childNodes.length;n--;)if("#text"==t.childNodes[n].nodeName&&""!=t.childNodes[n].nodeValue.replace(/\s+/g," ").trim())return void r.elementDown(t,e)}}}n.addEventListener("touchstart",o),n.addEventListener("mousedown",o),n.addEventListener("keyup",function(e){if(hasParentWithId(e.target,"epubContainer",99)){var t=e.target;t&&hasClass(t,"ki-textfield")&&(kInteractive.events.add({action:"answerClicked",disableRemote:!0,param:null,elem:t}),kInteractive.action(t,e),e.stopPropagation())}}),n.addEventListener("change",function(e){if(hasParentWithId(e.target,"epubContainer",99)){var t=e.target;t&&hasClass(t,"ki-textfield")&&(kInteractive.action(t,e),e.stopPropagation())}}),n.addEventListener("dragend",function(e){if(hasParentWithId(e.target,"epubContainer",99)){var t=e.target;t&&hasClass(t,"ki-draggable")&&(kInteractive.events.add({action:"answerClicked",disableRemote:!0,param:null,elem:t}),kInteractive.action(t,e),e.stopPropagation())}}),n.addEventListener("click",function(e){if(hasParentWithId(e.target,"epubContainer",99)){var t=e.target;if(t){for(var n=t;n&&n!=c;){if("a"==n.nodeName.toLowerCase()){if(hasClass(n,"ki-btn"))kInteractive.action(n,e);else{var o=n.getAttribute("href");if(!o)return kInteractive.action(n,e),void e.stopPropagation();o.match(/http[s]?:/g)?l.renderScope.externalLink(n):0==o.indexOf("/")?window.open(o):0==o.indexOf("mailto:")?window.location.href=o:(0!=o.indexOf("#")&&(o=ph.join(d.data.book.chapter.url,o)),p.applyChapterStateFromURL(o))}return void e.stopPropagation()}if("input"==n.nodeName.toLowerCase()&&"submit"!=n.type)return hasClass(n,"ki-inputbox")&&(kInteractive.events.add({action:"answerClicked",disableRemote:!0,param:null,elem:t}),kInteractive.action(t,n)),void e.stopPropagation();n=n.parentNode}if("video"!=t.nodeName.toLowerCase()&&"audio"!=t.nodeName.toLowerCase()){if("img"==t.nodeName.toLowerCase()){if(hasClass(t,"kInteractive")&&"none"!=kInteractive.readData(t).behavior)return kInteractive.action(t,e),void e.stopPropagation();var r=t.parentNode;if(hasClass(r,"kInteractive")){if(hasClass(r,"widget"))return kInteractive.action(t,e),void e.stopPropagation();if(hasClass(r,"questions"))return kInteractive.action(t,e),void e.stopPropagation()}var i=!0,a=kInteractive.readData(t);if(a&&a.popup||(i=!1),t.hasAttribute("static")&&(i=!1),t.hasAttribute("data-static")&&(i=!1),i){var s={};return s.thumbnail=s.src=cleanURL(a.path?ph.join(d.data.book.chapter.absoluteURL,a.path):t.getAttribute("src")),s.large="large"==a.popupSize,s.title=t.getAttribute("alt")?t.getAttribute("alt"):ph.basename(s.thumbnail),s.ext=ph.getExtension(s.thumbnail),s.type="image",u.show(s),void e.stopPropagation()}}return hasClass(t,"ki-btn")?(kInteractive.action(t,e),void e.stopPropagation()):hasClass(t,"kInteractive")?(kInteractive.action(t,e),void e.stopPropagation()):t.hasAttribute("contenteditable")?(t.focus(),void e.stopPropagation()):void("input"!=t.nodeName.toLowerCase()||e.stopPropagation())}}}})}}]),app.filter("chapterHtml",["$injector","events","translit",function(e,t,n){return function(e){if(e){for(var t=e.getElementsByTagName("li"),n=t.length;n--;){addClass(t[n],"item"),t[n].getElementsByTagName("ol").length&&addClass(t[n],"parent");var o=t[n].getElementsByTagName("ol").length?" parent":"";t[n].innerHTML='<i class="icon'+o+'"> </i> '+t[n].innerHTML}var r=e.getElementsByTagName("a");for(n=r.length;n--;)"true"==r[n].getAttribute("data-expand")&&addClass(r[n].parentNode,"expanded");e.innerHTML=e.innerHTML.replace(/(<a .*?)(>)/g,'$1 onclick="return false;" $2')}}}]),app.filter("contentHtml",["$rootScope","$filter","selection","stg","htmlParser",function(e,t,n,x,C){return function(e,t){var n=document.createElement("div");n.setAttribute("id","epubContent"),t=t||x.data.book.chapter.absoluteURL,C.wrapOrphans(e),kInteractive&&kInteractive.preRender(e,{chapterUrl:t});for(var o=getElementsByAttribute(e,"*","src"),r=0;r<o.length;r++){if(shouldParse(d=o[r].getAttribute("src"))&&o[r].setAttribute("src",ph.join(ph.removeHash(t),d)),"img"==o[r].nodeName.toLowerCase()&&(hasClass(o[r],"kInteractive")||hasClass(o[r].parentNode,"kInteractive")||o[r].style.height||o[r].getAttribute("height")||(o[r].style.maxWidth="100%"),chromeApp&&o[r].getAttribute("src"))){var i=o[r],a=i.getAttribute("src");if(isAbsoluteURLAndNotDataPath(a)){var s=i.getAttribute("chrome");x.data.chromeAssets[a]?i.setAttribute("src",x.data.chromeAssets[a]):s&&x.data.chromeAssets[s]?i.setAttribute("src",x.data.chromeAssets[s]):(s=Math.round(1e5*Math.random()),i.setAttribute("src",""),i.setAttribute("chrome",s),getImgDataSrc(a,function(t){setTimeout(function(){x.data.chromeAssets[s]=t;var e=getElementsByAttribute(document,"img","chrome",s);e.length&&e[0].setAttribute("src",t)},300)}))}}}var c=getElementsByAttribute(e,"*","poster");for(r=0;r<c.length;r++){shouldParse(d=c[r].getAttribute("poster"))&&c[r].setAttribute("poster",ph.join(ph.removeHash(t),d))}var l=getElementsByAttribute(e,"image","xlink:href");for(r=0;r<l.length;r++){var d;shouldParse(d=l[r].getAttribute("xlink:href"))&&l[r].setAttribute("xlink:href",ph.join(ph.removeHash(t),d))}var u=getElementsByAttribute(e,"*","style");for(r=0;r<u.length;r++){var p=u[r].getAttribute("style");-1!=p.toLowerCase().indexOf("url(")&&(hasParent(u[r],"kInteractive",5)||u[r].setAttribute("style",p.replace(/(.*?url\()(.+?)(\).*?)/g,f)))}function f(){var e=arguments[2];return 0==e.indexOf('"')&&(e=e.split('"')[1]),0==e.indexOf("'")&&(e=e.split("'")[1]),0==e.indexOf("&quot;")&&(e=e.split("&quot;")[1]),-1!=e.indexOf("http://")?arguments[0]:-1!=e.indexOf("https://")?arguments[0]:0==e.indexOf("data:")?arguments[0]:(e=ph.join(ph.removeHash(t),e),arguments[1]+e+arguments[3])}var h=document.createElement("sections"),g=e.getElementsByTagName("body")[0];if(partitionEnabled){for(var m=new Array,v=0;;){var b=!0,y=!1,k=0;m[v]=document.createElement("section"),m[v].setAttribute("sec",v),addClass(m[v],"k-section");for(r=g.childNodes.length;r--;)if(!g.childNodes[r].style||"absolute"!=g.childNodes[r].style.position){if(!((k+=(null!=g.childNodes[r].textContent?g.childNodes[r].textContent:g.childNodes[r].data).length)<4e3||b)){y=!0;break}b=!1,m[v].insertBefore(g.childNodes[r],m[v].firstChild)}if(!y)break;v++}for(r=0;r<m.length;r++)h.insertBefore(m[r],h.firstChild)}else{var w=document.createElement("section");w.setAttribute("sec","0"),addClass(w,"k-section");for(r=g.childNodes.length;r--;)w.insertBefore(g.childNodes[r],w.firstChild);h.appendChild(w)}return g.appendChild(h),n.innerHTML=e.getElementsByTagName("body")[0].innerHTML,pauseVideoAndAudio(n),n}}]),app.filter("contentJs",["$rootScope","cache","cssParser","$filter","selection","stg","$q","settings","chapters","freehand","bookmarks","hlights","notes",function(e,a,t,n,o,r,s,c,i,l,d,u,p){return function(e){var r,i=s.defer(),t=a.getOb("epubContent");return document.getElementById("epubMeta")?(document.getElementById("epubMeta").innerHTML="",r=document.getElementById("epubMeta")):((r=document.createElement("div")).setAttribute("id","epubMeta"),r.className="hide",t.parentNode.insertBefore(r,t.nextSibling)),a.setOb("epubMeta",r),o.newChapter(),function(){function e(){if(t++,"#e7e3d9"==rgb2hex(window.getComputedStyle(a.getOb("epubContent")).getPropertyValue("background-color"))){clearInterval(o),removeClass(r,"hide");for(var e=document.getElementsByTagName("style"),t=0;t<e.length;t++)if(e[t].hasAttribute("kotobee")){var n=e[t].innerHTML;n=n.replace(/[^}]*?{[^}]*?background-color:#e7e3d9 !important;.*?}/g,""),e[t].innerHTML=n}c.initialize(),i.resolve({})}}removeClass(a.getOb("epubContent"),"bgInherit");var o=setInterval(e,30);e()}(),i.promise}}]),app.filter("contentVirt",["stg","bookmarks","notes","workers","hlights","$timeout","$filter","htmlParser","cache","$ionicScrollDelegate","$injector",function(x,e,t,C,n,o,r,I,E,i,a){var S,T,O,A,N=[];return function(e,t,i){if(config.parseCachingVer)i&&i();else try{function n(e){if(e){for(var t=N.length;t--;)if(N[t]==e)return;var n=E.getOb("epubContent").className;addClass(E.getOb("epubContent"),"reveal");var o=e.offsetTop-E.getOb("epubContent").offsetTop;0!=o&&(e.style.marginTop=o+"px",N.push(e),E.getOb("epubContent").className=n)}}var a=[];function o(e,t){(t=t||{}).id=Math.round(9999*Math.random());t.cb;if(null==t.includeAnnotations&&(t.includeAnnotations=!0),hasClass(e,"parsed"))return t.cb&&t.cb(e),e;addClass(e,"parsed");var n=e.innerHTML,r={};if(C.supported()&&t.allowWorkers){return a.push({html:n,el:e,options:t}),1==a.length&&function o(){r.html=a[0].html;r.WEBVIEW_SERVER_URL=window.WEBVIEW_SERVER_URL;r.native=window.native;r.mobile=window.mobile;C.call("htmlParser","parse",[r],function(e){var t=replaceHTML(a[0].el,e),n=a[0].options;n.includeAnnotations,a.shift(),n.cb&&n.cb(t),a.length&&o()})}(),!0}var o=replaceHTML(e,n=I.parse(n));return t.includeAnnotations,i&&i(o),o}if("reset"==e)return S=T=null,O=!0,void(N=[]);var r=E.getOb("epubContent");if("reveal"==e)return void addClass(r,"reveal");if("undoReveal"==e)return void removeClass(r,"reveal");if("parse"==e)return void o(t,{includeAnnotations:!1,allowWorkers:!0,source:"parse mode",cb:i});if("parseAndAnnotations"==e)return void o(t,{allowWorkers:!0,source:"parseAndAnnotations mode"});var s,c,l,d=r.parentNode.parentNode,u=d.style.webkitTransform||d.style.mozTransform||d.style.transform,p=(s=null==e&&null!=t?t:!overflowScroll||!config.overflowScroll&&preview&&mobile?-Number(u.split(",")[1].slice(0,-2)):E.getOb("epubContainer").scrollTop)<A?"up":"down",f=(A=s)+d.parentNode.offsetHeight,h=r.children;if(O){for(var g=[],m=0,v=0;v<h.length;v++){for(var b=[],y=h[v],k=0;k<y.childNodes.length;k++)b[k]={},y.childNodes[k].offsetTop+y.childNodes[k].offsetHeight<s-200?b[k].add=["cNone","noMargin"]:y.childNodes[k].offsetTop>f+200?b[k].add=["cNone","noMargin"]:(0==m&&(b[k].setMargin=!0,m=1,c=k),b[k].remove=["cNone","noMargin"],b[k].setParse=!0,l=k);for(k=0;k<b.length;k++)b[k].setMargin&&n(y.childNodes[k]),b[k].setParse&&g.push([y.childNodes[k],{source:"from clean",allowWorkers:!0}]),addRemoveClass(y.childNodes[k],b[k].add,b[k].remove);for(k=0;k<b.length;k++);null!=c&&(S=y.childNodes[c]),null!=l&&(T=y.childNodes[l])}if(O=!1,g.length)for(k=0;k<g.length;k++){var w=g[k];k==g.length-1&&(w[1].cb=i),o(w[0],w[1])}else i&&i();return}if("fxl"==x.data.book.chapter.layout)return;if(1<h.length)return;if(1==h[0].childNodes.length)return;y=h[0];if("up"==p){if(!(S.offsetTop+S.offsetHeight)<s-0&&!(S.offsetTop>s-200))return;if(T==y.childNodes[0])return}else if("down"==p){if(!(T.offsetTop>f+0||T.offsetTop+T.offsetHeight<f+200))return;if(S==y.childNodes[y.childNodes.length-1])return}S&&(S.offsetTop+S.offsetHeight<s-0?(addClass(S,"cNone"),addClass(S,"noMargin"),S.nextSibling&&(removeClass(S=S.nextSibling,"noMargin"),n(S),S=o(S,{source:"topElem1"}))):S.offsetTop>s-200&&S.previousSibling&&(addClass(S,"noMargin"),removeClass(S=S.previousSibling,"cNone"),removeClass(S,"noMargin"),n(S),S=o(S,{source:"topElem2"}))),T&&(T.offsetTop>f+0?(addClass(T,"cNone"),T.previousSibling&&(removeClass(T=T.previousSibling,"cNone"),T=o(T,{source:"bottomElem1"}))):T.offsetTop+T.offsetHeight<f+200&&T.nextSibling&&(removeClass(T=T.nextSibling,"cNone"),T=o(T,{source:"bottomElem2"})))}catch(e){}}}]),app.filter("js",["$rootScope","$q","jsParser",function(e,c,l){return function(e,t){var n=c.defer();t=t||{};for(var o=[],r=e.getElementsByTagName("script"),i=0;i<r.length;i++)if(r[i].getAttribute("src")){var a=r[i].getAttribute("src");if(0<=a.indexOf("/kotobeeInteractive.js"))continue;a.indexOf(":/"),o.push({mode:"url",val:a})}else o.push({mode:"code",val:r[i].innerHTML});var s=e.getElementsByTagName("body")[0];return s.getAttribute("onload")&&o.push({mode:"code",val:s.getAttribute("onload")}),t.noJsParse?n.resolve():l.inject(o,function(e){n.resolve(e)}),n.promise}}]),app.filter("coverPath",["stg",function(o){return function(e,t){var n=(config.kotobee.liburl?config.kotobee.liburl:"")+"img/ui/defaultCover.png";return e?isAbsoluteURLPath(e)?e:e=cleanURL(e=t?(config.kotobee.liburl?config.kotobee.liburl:"../../")+"books/"+t+"/EPUB/"+e:ph.join(bookPath,o.data.packageURL,e)):n}}]),app.filter("categoryStyle",["stg",function(e){return function(e){var t="";isKotobeeHosted()&&(t=publicRoot);var n="";"image"!=e.display&&"imagetext"!=e.display||!e.img||(n+="background-image:url("+(t+"imgUser/"+e.img)+");");return"image"==e.display&&(n+="color:transparent;"),e.css&&(n+=e.css),n}}]),app.filter("catImgPath",["stg",function(e){return function(e){var t=(config.kotobee.liburl?config.kotobee.liburl:"")+"imgUser/"+e;return config.kotobee.liburl+"/"+ph.join(bookPath,t)}}]),app.filter("decodeHtmlEntities",function(){return function(e){return decodeHTMLEntities(e)}}),app.filter("nativeLinks",function(){return function(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.getElementsByTagName("a"),o=0;o<n.length;o++){var r=n[o].getAttribute("href");n[o].setAttribute("onclick","window.open('"+r+"', '_system');"),n[o].setAttribute("href","#")}return t.innerHTML}}),app.filter("moreDataExists",["stg",function(o){return function(e,t){try{if(!o.currentLibrary)return!1;if("categories"==t)return!1;if("downloaded"==t)return!1;var n;if("favorites"==t&&(n=o.favorites),"all"==t&&(n=o.currentLibrary.books),0==n.length)return!1}catch(e){return!1}return e}}]),app.filter("round",function(){return function(e){return Math.round(e)}}),app.filter("arrayEmpty",["$filter",function(n){return function(e){if(!e)return!0;for(var t=0;t<e.length;t++)if(Array.isArray(e[t])){if(!n("arrayEmpty")(e[t]))return!1}else if(e[t])return!1;return!0}}]),app.filter("langFromId",["stg",function(n){return function(e){for(var t=0;t<n.data.languages.length;t++)if(n.data.languages[t].val==e)return n.data.languages[t].label;return e}}]),app.filter("cleanurl",function(){return cleanURL}),app.filter("unsafe",["$sce",function(e){return e.trustAsHtml}]),app.filter("nl2br",function(){return function(e){return e?0<=e.indexOf("</")?e:e.replace(/\n/g,"<br>"):""}}),app.filter("releasePlatform",function(){return function(e){switch(e){case"win32":return"Windows 32-bit";case"win64":return"Windows 64-bit";case"win":return"Windows";case"mac":return"Macintosh"}}}),app.filter("filesizeLabel",function(){return function(e){return e?1e6<e?Math.round(10*e/1e6)/10+" GB":1e3<e?Math.round(10*e/1e3)/10+" MB":Math.round(10*e)/10+" KB":""}}),app.filter("miniappIconPath",["miniapps",function(o){return function(e){var t=o.getRoot(),n="icon.png";if(e.dataJson._listingIcon){if(isAbsoluteURLPath(n=e.dataJson._listingIcon))return n;n="userdata/"+n}return t+"miniapps/"+e.folder+"/"+n}}]),app.filter("metaExists",function(){return function(e){if(e&&"N/A"!=e&&"No rights specified"!=e)return e}}),app.filter("noteEntryStyle",["stg",function(o){return function(e,t){var n=[];return t==e&&n.push("editing"),e.public?(n.push("public"),(e.uid=o.data.user.id)?n.push("mine"):o.data.user.perms&&o.data.user.perms.globaldata&&n.push("mine"),n.push("hasAvatar")):n.push("mine"),n.join(" ")}}]),app.filter("noteUsernameChar",["stg",function(t){return function(e){return e.name?e.name.substr(0,1):e.uid==t.data.user.id?"ME":e.email?e.email.substr(0,1):"N/A"}}]),app.filter("noteUsername",["translit","stg",function(t,n){return function(e){return e.name?e.name:e.uid==n.data.user.id?t.get("me"):e.email?e.email.substr(0,1)+"***@***.***":t.get("anonymous")}}]),app.filter("dateTimeFromServer",function(){return function(e){return e?phpDateToJS(e).toUTCString():""}}),app.filter("styles",["$rootScope","$q","cssParser","$filter","selection","stg",function(e,u,p,t,n,o){return function(e,t){var n=u.defer();t=t||{};for(var o,r=[],i=e.getElementsByTagName("link"),a=0;a<i.length;a++)if("text/css"==i[a].getAttribute("type")&&i[a].getAttribute("href").length){var s=ph.join(t.path,i[a].getAttribute("href")),c=!1;if(isAbsoluteURLPath(i[a].getAttribute("href"))&&(s=i[a].getAttribute("href"),c=!0),l(s))continue;s==bookPath+"EPUB/css/base.css"&&(o=!0),r.push({type:"path",val:s,dontCache:c})}function l(e){if(0<=e.indexOf("/css/kotobeeInteractive.css"))return!0}o||config.dontForceBaseCss||r.unshift({type:"path",val:bookPath+"EPUB/css/base.css",dontCache:!1});var d=e.getElementsByTagName("style");for(a=0;a<d.length;a++)r.push({type:"local",val:d[a].innerHTML,root:t.path});return t.noCssParse?n.resolve():p.inject(r,t,function(e){n.resolve(e)}),n.promise}}]),app.filter("t",["translit",function(n){return function(e,t){return n.getLang()?n.get(e,Array.prototype.slice.call(arguments,2)):""}}]),app.factory("annotations",["$injector","stg","backend","cache","freehand","notes","bookmarks","hlights","chapters","$timeout","$sce","book","traverser",function(o,v,b,y,s,c,l,d,u,i,n,p,k){var r,f,h,a={};function w(e){return e.children.length?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}function x(e){for(var t="",n=0;n<e.length;n++)t+=e[n].textContent;return t}return a.initialize=function(e){u.addListener(function(e,t){if("renderedChapter"==e){if(r&&r.index==currentIndex)return a.show();r={index:currentIndex,vIndex:currentVIndex},b.cloudParam("sync")&&!h?a.sync():a.show()}})},a.reset=function(){f=h=r=null},a.sync=function(i,a){if(b.cloudParam("sync")){var e={};(i=i||{}).all||(e.chapter=currentIndex,e.chaptername=v.data.currentPageOb.title,e.file=v.getChapterFilename()),function(e,t){var n={};n.ver=readerV,null!=e.chapter&&(n.chapter=e.chapter);null!=e.chaptername&&(n.chaptername=e.chaptername);null!=e.file&&(n.file=e.file);b.getNotebook(n,function(e){t(f=e)})}(e,function(e){if(e&&!e.error){var t=e.notes&&e.notes.items?e.notes.items:e.notes,n=e.bookmarks&&e.bookmarks.items?e.bookmarks.items:e.bookmarks,o=e.hlights&&e.hlights.items?e.hlights.items:e.hlights,r=e.sketches&&e.sketches.items?e.sketches.items:e.sketches;s.addSketchesFromSync(r||{},function(){c.addNotesFromSync(t||{},function(){l.addBookmarksFromSync(n||{},function(){d.addHlightsFromSync(o||{},function(){i.all&&(h=!0),a&&a()})})})})}else a&&a()})}},a.show=function(e,r){for(var t=e=e||y.getOb("epubContent");null!=(t=t.previousSibling);)0;var n=[];n.push(o.get("chapters").getUnanchoredIndex(currentIndex)),v.data.currentRPageOb&&n.push(v.data.currentRPageOb.index),i(function(){v.getBookmarks(function(o){v.getNotes(function(n){v.getHlights(function(t){v.getSketches(function(e){l.addBookmarksFromOffline(o),c.addNotesFromOffline(n),d.addHlightsFromOffline(t),s.addSketchesFromOffline(e),r&&r()})})})})},1e3)},a.updateNotebookArray=function(c,l){c=c||{};var d=new Array;v.getBookmarks(function(s){for(var e=0;e<s.length;e++){var t=s[e];t.chapter=u.getUnanchoredIndex(t.chapter),null!=t.chapter?(d[t.chapter]||(d[t.chapter]=new Array),d[t.chapter].push(t)):s.splice(e--,1)}v.getNotes(function(a){for(var e=0;e<a.length;e++){var t=a[e];t.chapter=u.getUnanchoredIndex(t.chapter),null!=t.chapter?(d[t.chapter]||(d[t.chapter]=new Array),t.noteTrusted="",t.note&&(t.noteTrusted=n.trustAsHtml(t.note.replace(new RegExp("\r?\n","g"),"<br />"))),d[t.chapter].push(t)):a.splice(e--,1)}v.getHlights(function(e){for(var t=0;t<e.length;t++){(n=e[t]).chapter=u.getUnanchoredIndex(n.chapter),null!=n.chapter?(d[n.chapter]||(d[n.chapter]=new Array),d[n.chapter].push(n)):e.splice(t--,1)}for(var n in d)d[n].title=p.getTitleByIndex(n);for(t=0;t<d.length;t++)if(d[t])for(var o=0;o<d[t].length;o++)if(d[t][o].location){var r=String(d[t][o].location).split(",");r=String(r[0]).split("-"),d[t][o].locationDec=Number("0."+addDigitsToArray(r[0].split("."),3).join(""))}for(t=0;t<d.length;t++)d[t]&&(d[t]=d[t].sort(function(e,t){return e.locationDec>t.locationDec?1:-1}));var i={};b.cloudParam("sync")&&f&&(s.length<f.bookmarks.total&&(i.moreExist=!0),a.length<f.notes.total&&(i.moreExist=!0),e.length<f.hlights.total&&(i.moreExist=!0),h=!i.moreExist),i.results=d,i.showDelete=c.showDelete,v.data.notebookContent=i,l&&l()})})})},a.getMatchingElements=function(o,e){var t=k.getElemsByLocation(o.location,e);if(n(x(t))==n(o.src))return t;function n(e){return e?e.toLowerCase().trim().replace(/\s+?/g,""):e}if(o.locations&&o.locations.length)for(var r=0;r<o.locations.length;r++)if(v.data.book.version==o.locations[r].version&&o.location!=o.locations[r].location){var i=k.getElemsByLocation(o.locations[r].location,e);if(n(x(i))==n(o.src))return m(i,o.locations[r].version,"fromVersionElems")}var a=y.getOb("epubContent"),s=(a=y.getOb("epubContent"),y.getOb("epubContent"));for(t.length&&(s=t[0].parentNode);s&&s!=a&&!(0<=n(s.textContent).indexOf(n(o.src)));)s=s.parentNode;var c=o.src.split(" ");for(r=c.length;r--;)n(c[r])||c.splice(r,1);for(var l=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,w,!1);p=l.nextNode();)if(l.currentNode=p,-1!=n(l.currentNode.textContent).indexOf(n(c[0]))){for(var d=1,u=[l.currentNode];h=l.nextNode();){if(g=n(h.textContent)){if(-1==g.indexOf(n(c[d])))break;if(u.push(h),++d>=c.length)break}}if(d>=c.length)return m(u,null,"fromWordLooping")}var p;for(l=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,w,!1);p=l.nextNode();){var f=n(o.src);if(l.currentNode=p,-1!=f.indexOf(n(l.currentNode.textContent))){f=f.replace(n(l.currentNode.textContent),"");var h;for(u=[l.currentNode];h=l.nextNode();){var g;if(g=n(h.textContent)){if(-1==f.indexOf(g))break;if(f=f.replace(g,""),u.push(h),f.length<=0)break}}if(f.length<=0)return m(u,null,"fromSlackSearching")}}function m(e,t){if(!config.kotobee.sync)return e;var n={};return n.bid=v.data.book.id,n.cloudid=config.kotobee.cloudid,n.nid=o.nid,n.hid=o.hid,n.location=t,n.location||(n.location=k.convertElemsToLocation(e).leftRange),b.updateAnnotation(n),e}return[]},a}]),app.factory("auth",["$q","backend","modals","$location","sync","miniapps","$ionicHistory","$injector","design","status","stg","book","view","chapters","$compile","translit","login","payment",function(t,r,i,n,o,a,s,e,c,l,d,u,p,f,h,g,m,v){var b={};function y(){if((config.kotobee.rememberme&&(d.data.user.rememberMe=!0),config.src="library"==config.kotobee.mode?"library":"book",config.kotobee&&(config.kotobee.js||config.kotobee.css))&&!document.getElementsByClassName("kotobeeInjectedScript").length){document.getElementsByTagName("head");if(config.kotobee.js)for(var e=0;e<config.kotobee.js.length;e++){var t=document.createElement("script");t.src=cacheBust(config.kotobee.js[e]),t.className="kotobeeInjectedScript",document.body.appendChild(t)}if(config.kotobee.css)for(e=0;e<config.kotobee.css.length;e++){var n=document.createElement("link");n.rel="stylesheet",n.href=cacheBust(config.kotobee.css[e]),n.className="kotobeeInjectedScript",document.body.appendChild(n)}}if(config.kotobee&&config.kotobee.sso)if(config.kotobee.sso.length){if(Array.isArray(config.kotobee.sso)){var o={};config.kotobee.sso.forEach(function(e){if(e.enabled){var t=Object.assign({},e);delete t.provider,t.params.clientsecret&&delete t.params.clientsecret,t.params.pkce&&delete t.params.pkce,t.params.version&&delete t.params.version,o[e.provider]=t}native&&"google"==e.provider&&delete o[e.provider]}),Object.keys(o).length?config.kotobee.sso=o:delete config.kotobee.sso}}else delete config.kotobee.sso;if(config.kotobee&&config.kotobee.payment)if(config.kotobee.payment.length){if(Array.isArray(config.kotobee.payment)){var r={};config.kotobee.payment.forEach(function(e){if(e.enabled){var t=Object.assign({},e);delete t.provider,t.params&&t.params.clientsecret&&delete t.params.clientsecret,(native||"paypal"!=e.provider)&&"paypal"==e.provider||(r[e.provider]=t)}}),Object.keys(r).length?config.kotobee.payment=r:delete config.kotobee.payment}config.kotobee.pricing&&config.kotobee.pricing.purchasable&&"book"==config.kotobee.mode&&(config.kotobee.landing=!0),v.initialize()}else delete config.kotobee.payment}return b.authenticate=function(){var e=t.defer();return putTest("inside"),b.getPermissions(function(t){p.generate();try{if("book"==config.kotobee.mode&&isKotobeeHosted())if(config.kotobee.public)bookPath=publicRoot+"epub/";else{var e=publicRoot.split("/books/")[1].split("/")[0];bookPath="/books/"+e+"/EPUB/epub/"}var n="kotobee"==config.kotobee.hostType;asyncCheck(!n,r.getS3Paths,[],function(e){n&&(bookPath=config.kotobee.public?d.data.paths.private+"books/"+config.kotobee.hostPath+"/EPUB/epub/":config.kotobee.liburl+"books/"+config.kotobee.hostPath+"/EPUB/epub/"),(native||desktop)&&t&&r.cloudParam("offline")&&"offline"==t.error&&b.startup({tab:"downloads"})})}catch(e){}m.start()}),e.promise},b.getPermissions=function(n){"library"==config.kotobee.mode?r.getUnauthLibrary(function(e){if("offline"!=(e=e||{}).error){if(e.cloud)for(var t in e.cloud)config.kotobee[t]=config.kotobee[t]&&Array.isArray(config.kotobee[t])?config.kotobee[t].concat(e.cloud[t]):e.cloud[t];config.kotobee.permsLoaded=!0,config.kotobee.offline=e.offline,config.kotobee.offlinedelete=e.offlinedelete,config.kotobee.js=e.js,config.kotobee.css=e.css,y(),n()}else n(e)}):"book"==config.kotobee.mode?config.kotobee.cloudid?r.getPermissions(function(e){for(var t in e)"sso"==t&&config.testSSO&&config.kotobee.sso&&config.kotobee.sso.length||(config.kotobee[t]=e[t]);config.kotobee.permsLoaded=!0,y(),n()}):(config.kotobee.public=!0,y(),n()):e.get("app").getPermissions(n)},b.startup=function(e){if(e=e||{},native&&function(){if({}.watermarkPlaceholder){var e='<div id="watermark"><span>'+g.get("createdUsing")+'</span><a href="#" class="inlineBlock" style="vertical-align: sub" onclick="window.open(\'https://www.kotobee.com\', \'_system\');return false;"><img width="163" src="'+rootDir+'img/ui/authorLogo.png"></a></div>',t=document.createElement("div");t.innerHTML=e,document.body.insertBefore(t,document.getElementById("html5Fallback")),setTimeout(function(){addClass(document.getElementById("watermark"),"show")},4e3)}}(),-1!=d.data.initPath.indexOf("/payment"))b.authenticated=!0,n.path(d.data.initPath),s.clearHistory();else if("library"==config.kotobee.mode){b.authenticated=!0;var t="";e.tab&&(t="/tab/"+e.tab);try{n.path("/library"+t)}catch(e){}a.initialize({mode:"library"}),c.applyRichTextLibrary(),s.clearHistory()}else"book"==config.kotobee.mode?u.loadBook().then(function(){c.applyRichTextLibrary(),b.authenticated=!0,n.path("/reader"),s.clearHistory(),a.initialize(),o.initialize(),setTimeout(function(){f.initialize(),kotobee.dispatchEvent("bookOpened",d.data.book)},1e3)}):"app"==config.kotobee.mode&&(b.authenticated=!0,n.path("/app"),s.clearHistory());kotobee&&kotobee.dispatchEvent("ready")},b.redeemCode=function(e,t){var n=clone(e),o={model:{},submit:function(){i.hide(),n.code=o.model.code,n.code&&(l.update(g.get("pleaseWait"),null,{dots:!0}),r.redeemCode(n,function(e){e&&!e.error?(l.update(),t()):l.showAndHide(g.get(e?e.error:"unexpectedError"),3e3)}))}};i.show({mode:"redeemCode",redeemCodeInfo:o})},b}]),app.factory("autohide",["$document","$injector","cache","selection","chapters","library","stg",function(i,r,e,o,a,t,s){var c,l,d,u,p,f,h,g,n={},m=!0;function v(){var e={},t=document.getElementById("libraryThumbs");if(t&&0<=window.location.href.indexOf("#/library"))e.mode="library",e.header=i[0].getElementById("libraryHeader"),e.footer=i[0].getElementById("libraryFooter"),e.footer&&(e.footerHeight=e.footer.offsetHeight),e.scope=angular.element(t).scope(),e.libTabs=i[0].getElementById("libraryTabs"),e.libTabs&&(e.libTabHeight=e.libTabs.offsetHeight);else{e.mode="reader",e.header=i[0].getElementById("readerHeader"),e.scope=angular.element(e.header).scope(),e.tabMenu=i[0].getElementById("tabMenu"),e.tabMenu&&(e.tabMenuHeight=e.tabMenu.offsetHeight);var n=i[0].body.getElementsByClassName("navControls");if(n.length){var o=(n=n[n.length-1]).getElementsByClassName("next");o.length&&(e.navNext=o[0]);var r=n.getElementsByClassName("prev");r.length&&(e.navPrev=r[0]),e.navWidth=e.navNext.offsetWidth}}return e.headerHeight=e.header?e.header.offsetHeight:0,e}function b(e){if(e.target){if(function(e){var t=e.nodeName.toLowerCase();if("a"==t)return!0;if("video"==t)return!0;if("audio"==t)return!0;if(hasClass(e,"kInteractive"))return!0;if(hasParent(e,"kInteractive"))return!0}(e.target))return;var t=e.target.nodeName.toLowerCase();if("button"==t)return;if("a"==t)return;if("input"==t)return;if(hasParentNode(e.target,"button"))return;if(hasParentNode(e.target,"a"))return;if(hasParentNode(e.target,"input"))return}var n=v();"reader"==n.mode&&"alwaysShow"==config.autohideReaderMode||"library"==n.mode&&"alwaysShow"==config.autohideLibMode||(l=!0,o.active()?o.reset():"hidden"==c?S("buttons"):"buttons"==c?S("hidden"):"midway"==c&&S("buttons"))}function y(o){f=null;o.target.parentNode.nodeName.toLowerCase();var e=v();if("reader"==e.mode)"neverShow"==config.autohideReaderMode&&h&&(new Date).getTime()-g<800&&Math.abs(x(o).x-h.x)<50&&function(e,t){var n=x(o).y;if(n-h.y<15)return;n<h.y?h.y>.85*document.body.clientHeight&&S(e):n>.85*document.body.clientHeight&&S(t);n>h.y?h.y<.15*document.body.clientHeight&&S(e):n<.15*document.body.clientHeight&&S(t)}("tab","hidden");else if("library"==e.mode)if("showOnScroll"==config.autohideLibMode){var t=document.getElementsByClassName("bookThumbsContainer")[0],n=document.getElementById("libraryThumbs"),r=Number(getElemPadding(n).top);r=r||0,t.offsetHeight<n.offsetHeight-r&&S("buttons")}else if("showOnTap"==config.autohideLibMode);else if("neverShow"==config.autohideLibMode&&h){if((new Date).getTime()-g<800&&Math.abs(x(o).x-h.x)<50&&h.y<100&&x(o).y>h.y)return S("header");S("hidden")}h=null}function k(e){if("library"==v().mode&&"showOnTap"==config.autohideLibMode){var t=e.target,n=t.parentNode.nodeName.toLowerCase();if("a"==n||"button"==n)return;if(!hasParentWithId(t,"library",99))return;if(t.classList.contains("thumbImg"))return;S("buttons"==c?"hidden":"buttons")}}function w(e){h=x(e),g=(new Date).getTime()}function x(e){return e.changedTouches&&e.changedTouches.length?{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}:e.touches&&e.touches.length?{x:e.touches[0].clientX,y:e.touches[0].clientY}:{x:e.clientX,y:e.clientY}}function C(e){var t=40;if(h){var n=f=f||v();if("library"==n.mode&&(t=5),"reader"!=n.mode||"showOnTap"!=config.autohideReaderMode){if("library"==n.mode){if("showOnTap"==config.autohideLibMode)return;if("neverShow"==config.autohideLibMode)return}if(p=p||Math.max(t,e.detail.scrollTop),l)return l=!1,p=Math.max(t,e.detail.scrollTop),void("hidden"==c&&(p-=n.headerHeight,u=n.headerHeight));if("reader"==n.mode){if(m)return;if("default"!=n.scope.header.mode)return;if(r.get("nav").transforming)return}else if("library"==n.mode){if(n.scope.subMode)return;if(n.scope.searchOb.enabled)return}d=n.headerHeight-(n.headerHeight-(e.detail.scrollTop-p)),c=d>=n.headerHeight?(p=e.detail.scrollTop-n.headerHeight,d=n.headerHeight,"hidden"):d<0?(p=Math.max(t,e.detail.scrollTop),d=0,"buttons"):"midway",null==u&&(u=0);var o=removeClass;if(u==n.headerHeight){if(d==n.headerHeight)return;if(14<d)return;p=Math.max(t,e.detail.scrollTop),d=0,o=addClass}d+u!=0&&(u=d,I(o,{dims:n}))}}}function I(e,t){var n=(t=t||{}).dims;if(n=n||v(),e(n.header,"ease"),E(n.header,d,n.headerHeight,"up",!!ios),"reader"==n.mode){if(t.headerOnly)return;if(t.tabOnly)return void o();e(n.navNext,"ease"),e(n.navPrev,"ease"),E(n.navNext,d*n.navWidth/n.headerHeight,n.navWidth,s.data.settings.rtl?"left":"right"),E(n.navPrev,d*n.navWidth/n.headerHeight,n.navWidth,s.data.settings.rtl?"right":"left"),o()}else if("library"==n.mode){if(!n.libTabs)return t.dims=v(),void setTimeout(function(){I(e,t)},20);if(e(n.libTabs,"ease"),E(n.libTabs,d,n.libTabHeight,"up"),t.headerOnly)return;n.footer&&(e(n.footer,"ease"),E(n.footer,d*n.footerHeight/n.headerHeight,n.footerHeight,"down",!!ios))}function o(){e(n.tabMenu,"ease"),E(n.tabMenu,d*n.tabMenuHeight/n.headerHeight,n.tabMenuHeight,"down",!!ios)}}function E(o,r,e,i,a){var s=1-(r=Math.min(e,r))/44;ionic.requestAnimationFrame(function(){var e;if(o&&("up"==i?e="translate3d(0, -"+r+"px, 0)":"down"==i?e="translate3d(0, "+r+"px, 0)":"right"==i?e="translate3d("+r+"px, 0, 0)":"left"==i&&(e="translate3d(-"+r+"px, 0, 0)"),o.style[ionic.CSS.TRANSFORM]=e,a))for(var t=0,n=o.children.length;t<n;t++)o.children[t].style.opacity=s})}function S(e){if(c!=e){var t=v();if("buttons"==e)u=d=0,I(addClass);else if("header"==e)u=d=0,I(addClass,{headerOnly:!0});else if("tab"==e)u=d=0,I(addClass,{tabOnly:!0});else if("hidden"==e){u=d=t.headerHeight;var n="translate3d(100%, 0, 0)",o="translate3d(-100%, 0, 0)";if(t.tabMenu&&(t.tabMenu.style[ionic.CSS.TRANSFORM]="translate3d(0, 100%, 0)"),t.header&&(t.header.style[ionic.CSS.TRANSFORM]="translate3d(0, -100%, 0)"),t.libTabs&&(t.libTabs.style[ionic.CSS.TRANSFORM]="translate3d(0, -44px, 0)"),t.navPrev&&(t.navPrev.style[ionic.CSS.TRANSFORM]=s.data.settings.rtl?n:o),t.navNext&&(t.navNext.style[ionic.CSS.TRANSFORM]=s.data.settings.rtl?o:n),!t.header||!t.navPrev||!t.navNext)return;if(!("library"!=t.mode||t.tabMenu&&t.libTabs))return}c=e}}return n.initialize=function(){mobile&&(document.body.addEventListener(mobile&&!mobileDebug?"touchend":"mouseup",y),document.body.addEventListener(mobile&&!mobileDebug?"touchstart":"mousedown",w),document.body.addEventListener(mobile&&!mobileDebug?"tap":"click",k),config.autohideHeader&&!config.autohideReaderMode&&(config.autohideReaderMode="showOnScroll"),config.autohideHeader||(config.autohideReaderMode="alwaysShow"),config.autohideLibHeader&&!config.autohideLibMode&&(config.autohideLibMode="showOnScroll"),config.autohideLibHeader||(config.autohideLibMode="alwaysShow"),r.get("nav").addListener("tap",b))},n.setup=function(e,t,n){if(c="buttons","reader"==n.headerShrink){if("alwaysShow"==config.autohideReaderMode)return;if("neverShow"==config.autohideReaderMode)return S("hidden"),addClass(document.getElementById("chapters"),"fillSpace"),e.$watch("header.mode",function(e,t){e!=t&&S("selection"==e||"searchItems"==e||"textSize"==e?"header":"hidden")}),void addClass(document.getElementById("tabMenu"),"transparent");"showOnTap"==config.autohideReaderMode&&(S("hidden"),addClass(document.getElementById("chapters"),"transparentBtns"),addClass(document.getElementById("chapters"),"fillSpace"))}if("library"==n.headerShrink){if("alwaysShow"==config.autohideLibMode)return;if("neverShow"==config.autohideLibMode)return void S("hidden");config.autohideLibMode}var o,r;"reader"==n.headerShrink?(e.$watch("data.settings.textSize",function(e,t){!o&&(o=!0,"showOnTap"==config.autohideReaderMode)||S("buttons")}),e.$watch("header.mode",function(e,t){!r&&(r=!0,"showOnTap"==config.autohideReaderMode)||S("buttons")}),a.addListener(function(e){"newChapter"==e&&setTimeout(function(){m=!1},1500)}),"showOnTap"==config.autohideReaderMode&&S("hidden")):"library"==n.headerShrink&&(e.$watch("subMode",function(e,t){S("buttons")}),e.$watch("searchOb.enabled",function(e,t){S("buttons")}));t.bind("scroll",C)},n.hideBtns=function(){S("hidden")},n.showBtns=function(){S("buttons")},n.libInitialized=function(){mobile&&setTimeout(function(){"neverShow"==config.autohideLibMode&&S("hidden"),"showOnTap"==config.autohideLibMode&&S("hidden")})},n}]),app.factory("backend",["khttp","$http","error","translit","cache","$location","$injector","$ionicHistory","$rootScope","modals","$window","status","crdv","$sce","$timeout","stg","$q","sync","payment",function(o,l,d,u,e,n,p,t,s,f,c,r,h,g,m,v,b,i,a){var y,k,w={},x=[],C={transformRequest:angular.identity,headers:{"Content-Type":void 0}};function I(){try{if("undefined"!=typeof lti&&lti&&email&&hash){v.data.user.email=email,v.data.user.pwd=hash,v.data.user.rememberMe=!0;var e=document.getElementsByTagName("head")[0];if(e.length){e[0];for(var t=document.getElementsByTagName("script"),n=0;n<t.length;n++)if(t[n].hasAttribute("lti")){t[n].parentNode.removeChild(t[n]);break}}}}catch(e){}}w.getAuthVarsOld=function(){return{libid:config.kotobee.libid,email:v.data.user.email,pwd:v.data.user.pwd}},w.getAuthVars=function(){var e={email:v.data.user.email,pwd:v.data.user.pwd,code:v.data.user.code,env:config.kotobee.mode};return I(),e.cloudid=config.kotobee.cloudid,"library"==e.env&&v.data.book&&(e.bid=v.data.book.id),uuid&&(e.fingerprint=uuid),e},w.addListener=function(e,t){x.push({event:e,func:t})},w.initialize=function(){putTest("X");var n=b.defer();return putTest("Y"),putTest("Z"),putTest("J"),d.detect("s_authError",w.loginErrorDetection),putTest("K"),v.readSlot("user"+config.kotobee.cloudid,function(e){if(config.kotobee.cloudid){var t=e;t&&(v.data.user=t)}v.data.user||(v.data.user={}),0==v.data.user.length&&(v.data.user={}),v.data.user.loggedIn=!1,putTest("L"),preview?n.resolve():w.getFingerprint(function(e){uuid=e,n.resolve()})}),n.promise},w.getFingerprint=function(i){function a(){var e={excludeUserAgent:!0,excludeScreenResolution:!0,excludeDoNotTrack:!0,excludeAvailableScreenResolution:!0,excludeOpenDatabase:!0,excludePlugins:!0,excludeCanvas:!0,excludeWebGL:!0,excludeJsFonts:!0,excludeCanvas:!1,excludeWebGL:!1};new Fingerprint2(e).get(function(e,t){try{e=e||process.env.USERNAME,v.writeSlot("fingerprint",e,function(){i(e)})}catch(e){}})}native&&window.plugins&&window.plugins.uniqueDeviceID?window.plugins.uniqueDeviceID.get(function(e){e&&e.length?i(e):a()},a):desktop?"mac"==os?a():require("child_process").exec("wmic CPU get ProcessorId",{cwd:"."},function(e,t,n){if(t){var o=t.toUpperCase().split("PROCESSORID");if(o.length){var r=o[1].trim();r.length?i(r):a()}else a()}else a()}):a()};var E=null,S=null;w.setLibraryLoginCallback=function(e){E=e},w.setLibraryLogoutCallback=function(e){S=e},w.loginErrorDetection=function(t){v.data.user.loggedIn=!1,t&&("email"==config.kotobee.loginmode||config.kotobee.promocodesdisabled?t.loginOptions.canLoginByEmail=!0:"code"==config.kotobee.loginmode?t.loginOptions.canLoginByCode=!0:t.loginOptions.canLoginByEmail=t.loginOptions.canLoginByCode=!0,t.loginOptions.mode=t.loginOptions.canLoginByEmail?"email":"code",t.loginOptions.signIn=function(){f.hide(),setTimeout(function(){if("code"==t.loginOptions.mode){if(!t.model||!t.model.code)return void d.update({error:"enterYourCode"});v.data.user.code=t.model.code,v.data.user.email=v.data.user.pwd=null}else{if(!v.data.user.email)return void d.update({error:"enterYourEmail"});if(!t.model||!t.model.pwd)return void d.update({error:"enterYourPwd"});v.data.user.pwd=t.model.pwd,v.data.user.code=null}function e(){w.login({userInput:!0}).then(function(e){e.error||t.model&&(t.model.pwd=t.model.code=null)})}config.kotobee.permsLoaded?e():p.get("auth").getPermissions(e)},800)},t.loginOptions.register=function(){f.hide(),n.path("/register")},t.loginOptions.forgotPassword=function(){f.hide(),n.path("/forgotpwd")},t.loginOptions.redeemCode=function(){t.loginOptions.mode="code"},t.loginOptions.signInByEmail=function(){t.loginOptions.mode="email"})};var T,O=null;w.refreshSignatures=function(t){var e=config.kotobee.liburl+"user/signatures";l.post(e,getFormData(w.getAuthVars()),C).success(function(e){e.error||(v.data.user.signatures=e.signatures,t&&t())})};var A={ping:!0};function N(e){if((v.data.currentLibrary=e)&&e.categories){for(var t=[],n=0;n<e.categories.length;n++)t.push(e.categories[n]);for(n=0;n<e.categories.length;n++)for(var o=e.categories[n],r=0;r<t.length;r++)t[r].parent&&t[r].parent.id==o.id&&(o.children||(o.children=[]),o.children.push(t[r]),t[r].nested=!0);for(n=0;n<e.categories.length;n++)e.categories[n].nested&&(e.categories.splice(n,1),n--)}}function L(){kotobee.popup(u.get("unexpectedError"),{okBtn:u.get("ok"),raw:!1,noBackdrop:!1,cb:function(){}})}function B(e){var t=getFormData(w.getAuthVars());t.append("software",isReaderApp?"readerapp":"reader"),t.append("platform",navigator.userAgent),t.append("assetType",config.kotobee.mode);try{t.append("assetName","book"==config.kotobee.mode?v.data.book.meta.dc.title:v.data.currentLibrary.name)}catch(e){}var n=window.location.href;return t.append("assetPath",n.split("#")[0]),config.kotobee.cloudid&&t.append("assetId",config.kotobee.cloudid),"library"==config.kotobee.mode&&(v.data.book&&null!=v.data.book.id?t.append("bid",v.data.book.id):e.bid&&t.append("bid",e.bid)),v.data.user.email&&t.append("email",v.data.user.email),v.data.user.code&&t.append("code",v.data.user.code),e.action&&t.append("action",e.action),e.param&&t.append("param",e.param),v.data.book&&v.data.book.chapter&&v.data.book.chapter.title&&t.append("chapter",v.data.book.chapter.title),t}return w.login=function(r,e){r=r||{};var t={func:arguments.callee,args:arguments};document.body.focus=null;var i,n,a=b.defer();r.ping||(i=f.show({mode:"loading",loadingMsg:u.get("pleaseWait"),timeLimit:1e4}),v.data.user.loggedIn=!1),e&&(O=e),"book"==config.kotobee.mode&&(n=config.kotobee.liburl+"library/auth"),"library"==config.kotobee.mode&&(n=config.kotobee.liburl+"library/get"),I(),preview||(w.fingerprint=uuid);var o=w.getAuthVars(),s={},c=Boolean(r.accessToken||r.idToken);return v.data.sso&&v.data.sso.oauth?(s.ssoprovider=v.data.sso.oauth.provider,s.ssoaccesstoken=v.data.sso.oauth.accessToken,s.ssoidtoken=v.data.sso.oauth.idToken,c=Boolean(s.ssoaccesstoken||s.ssoidtoken)):r.ssoProvider&&c&&(s.ssoprovider=r.ssoProvider,s.ssoaccesstoken=r.accessToken,s.ssoidtoken=r.idToken),Object.keys(s).length&&(o=Object.assign(o,s)),r.userInput&&(o.input=!0),o.platformdesc=navigator.userAgent,native?(o.platform="mobile",device&&(o.platformdesc=device.platform+" "+device.model+" "+device.version+" "+(device.manufacturer?device.manufacturer:""))):o.platform=desktop?"desktop":"web",o.v=readerV,r.ping&&(o.ping=!0,o.pwd=r.pwd),o.v=config.v,c&&(v.data.user.rememberMe=!0),l.post(n,getFormData(o),C).success(function(e){if(clearTimeout(T),i&&f.hide(i),e.error)return e.public&&(k=!0),r.dontShowErrorDialog||d.update(e),v.data.user.pwd=null,v.data.user.code=null,v.writeSlot("user"+config.kotobee.cloudid,{}),r.ping&&w.logout({dontSignoutSSO:!0}),void a.resolve(e);var t=3e5;if(void 0===t&&(t=3e5),y&&clearTimeout(y),y=setTimeout(function(){e.pwd&&(A.pwd=e.pwd),w.login(A)},t),!r.ping)if(c&&e.email&&(v.data.user.email=e.email),v.data.user.pwd=e.pwd,v.data.user.id=e.userid,v.data.user.name=e.username,v.data.user.lastchap=e.lastchap,v.data.user.perms=e.perms,v.data.user.signatures=e.signatures,v.data.user.role=e.role,"book"==config.kotobee.mode&&e.chapters&&p.get("book").setAllowedChapters(e.chapters),v.data.user.rememberMe){var n={rememberMe:!0};v.data.user.email&&v.data.user.pwd?(n.email=v.data.user.email,n.pwd=v.data.user.pwd):v.data.user.code&&(n.code=v.data.user.code),v.writeSlot("user"+config.kotobee.cloudid,n,o)}else v.clearSlot("user"+config.kotobee.cloudid,o);function o(){if(!e.cloudid&&!e.success)return r.dontShowErrorDialog||d.update({error:"s_authError"}),void a.resolve({error:"s_authError"});v.data.user.loggedIn=!0,"library"==config.kotobee.mode&&(N(e),function(e){if(!e)return;if(!v.data.user)return;if(!config.kotobee.offline)return;if(!config.kotobee.offlinedelete)return;if(!v.data.downloaded.length)return;for(var t="",n=0;n<v.data.downloaded.length;n++)t+=(t?",":"")+v.data.downloaded[n].id;w.hasAccessTo({testagainst:t},function(e){if(Array.isArray(e)||(e=[e]),e.length!=v.data.downloaded.length){for(var t=[],n=0;n<v.data.downloaded.length;n++){for(var o=v.data.downloaded[n],r=!1,i=0;i<e.length;i++)if(o.id==e[i].bid){r=!0;break}r||t.push(o)}var a=-1;!function e(){if(++a>=t.length)return;native?h.deleteEbook(t[a],e):desktop&&p.get("np").deleteEbook(t[a],e)}()}})}(e),E&&E()),a.resolve(e),O&&(O(e),O=null)}}).error(function(e){clearTimeout(T),f.hide(),d.update({error:"networkError",ref:t})}),a.promise},w.libraryHasPublicBooks=function(){return k},w.logout=function(e){(e=e||{}).dontSignoutSSO||p.get("login").logout(),v.data.user.pwd=null,v.data.user.loggedIn=!1,v.data.user.email=null,v.data.user.code=null,v.data.sso&&v.data.sso.oauth&&delete v.data.sso.oauth,v.writeSlot("user"+config.kotobee.cloudid,v.data.user,function(){"library"==config.kotobee.mode?m(function(){if(d.update({error:"s_authError"}),w.cloudParam("entry")){for(var e=0;e<v.data.currentLibrary.books.length;e++)v.data.currentLibrary.books[e].favorite=!1;p.get("library").applyExistingBooks()}else v.data.currentLibrary={};S&&S()},200):p.get("login").toLoginScreen()})},w.getPermissions=function(n){var o={func:arguments.callee,args:arguments},e={};return e.env=config.kotobee.mode,e.cloudid=config.kotobee.cloudid,l.post(config.kotobee.liburl+"library/permissions",getFormData(e),C).success(function(e){if(e.error){d.update({error:"errorAndCallback",msg:e.error,cb:h.exit});var t=document.getElementsByClassName("loaded");t.length&&t[0].parentNode.removeChild(t[0])}else n&&n(e)}).error(function(e,t){(native||desktop)&&w.cloudParam("offline")?n&&n({error:"offline"}):d.update({error:"networkError",ref:o})})},w.register=function(e,t){var n={func:arguments.callee,args:arguments},o=f.show({mode:"loading",loadingMsg:u.get("registeringAccount")}),r=w.getAuthVars();if(r.email=e.email1,r.promocode=e.promocode,r.name=e.name,e.dob){var i=new Date(e.dob);r.dob=i.getDate()+"-"+i.getMonth()+"-"+i.getFullYear()}r.organization=e.organization,r.dept=e.dept,r.country=e.country,r.city=e.city,r.phone=e.phone,r.info=e.info,r.root=config.kotobee.liburl;var a=getFormData(r);return a.append("platform",navigator.userAgent),l.post(config.kotobee.liburl+"user/register",a,C).success(function(e){f.hide(o),e.error?d.update(e):t&&t(e)}).error(function(e){d.update({error:"networkError",ref:n})})},w.forgotPwd=function(e,t){var n={func:arguments.callee,args:arguments},o=f.show({mode:"loading",loadingMsg:u.get("retrieving")}),r=w.getAuthVars();r.email=e.email,r.root=config.kotobee.liburl;var i=getFormData(r);return l.post(config.kotobee.liburl+"user/forgotpwd",i,C).success(function(e){f.hide(o),e.error?d.update(e):t&&t(e)}).error(function(e){d.update({error:"networkError",ref:n})})},w.redeemCode=function(e,t){var n={func:arguments.callee,args:arguments},o=getFormData(w.getAuthVars());o.append("redeemcode",e.code),o.append("platform",navigator.userAgent),l.post(config.kotobee.liburl+"user/redeemcode",o,C).success(function(e){t(e)}).error(function(){d.update({error:"networkError",ref:n})})},w.getNotebook=function(e,t){var n=getFormData(w.getAuthVars());null!=e.chapter&&n.append("chapter",e.chapter),null!=e.chaptername&&n.append("chaptername",e.chaptername),null!=e.file&&n.append("file",e.file),n.append("ver",e.ver),l.post(config.kotobee.liburl+"library/notebook/all",n,C).success(function(e){e.error&&d.update(e),t&&t(e)}).error(function(e){v.data.syncing=!1,t&&t()})},w.userLoggedIn=function(){if(v.data.user.loggedIn)return!0;try{if("library"==config.kotobee.mode&&v.data.book&&("public"==v.data.book.accessmode||"all"==v.data.book.accessmode))return!0}catch(e){}},w.downloadEbookTest=function(e,t){var n={id:e.id,mode:e.binary};return w.sendRawPost("http://192.168.1.5/files/test.zip",n,{responseType:"blob",onProgress:function(e){}},function(e){if(e.error)return d.update(e),void t();t(e)})},w.downloadEbook=function(e,t,n){try{var o={responseType:"blob",onProgress:t};mobile&&native&&(o.responseType="arraybuffer");var r={id:e.id,mode:"binary",requester:"reader"};return w.sendRawPost(config.kotobee.liburl+"library/ebook/download",r,o,function(e){if(e.error)return d.update(e),void n();n(e)})}catch(e){}},w.tincan=function(e,t){var n=getFormData(w.getAuthVars());for(var o in e)n.append(o,e[o]);l.post(config.kotobee.liburl+"tincan",n,C).success(function(e){t&&t()}).error(function(e,t){})},w.getUnauthLibrary=function(n){if("library"==config.kotobee.mode){var o={func:arguments.callee,args:arguments},e=getFormData(w.getAuthVars());l.post(config.kotobee.liburl+"library/getbasic",e,C).success(function(e){N(e),n&&n(e)}).error(function(e,t){(native||desktop)&&w.cloudParam("offline")?n&&n({error:"offline"}):d.update({error:"networkError",ref:o})})}},w.addtoFav=function(e,t){var n={func:arguments.callee,args:arguments},o=getFormData(w.getAuthVars());o.append("bid",e.id),o.append("cloudid",w.cloudParam("cloudid")),o.append("type","book"),l.post(config.kotobee.liburl+"library/favorite/add",o,C).success(function(e){if(e.error)return d.update(e),void t();t(e)}).error(function(){d.update({error:"networkError",ref:n})})},w.removeFav=function(e,t){var n={func:arguments.callee,args:arguments},o=getFormData(w.getAuthVars());o.append("bid",e.id),o.append("cloudid",w.cloudParam("cloudid")),o.append("type","book"),l.post(config.kotobee.liburl+"library/favorite/remove",o,C).success(function(e){if(e.error)return d.update(e),void t();t(e)}).error(function(e){d.update({error:"networkError",ref:n})})},w.updateAnnotation=function(e,t){var n=getFormData(w.getAuthVars());n.append("cloudid",e.cloudid),n.append("location",e.location),e.bid&&n.append("bid",e.bid),e.nid&&n.append("nid",e.nid),e.hid&&n.append("hid",e.hid),l.post(config.kotobee.liburl+"library/notebook/update",n,C).success(function(e){t&&t(e)}).error(function(e){})},w.createOrder=function(e,t){var n=getFormData(w.getAuthVars());e.bid&&n.append("bid",e.bid),e.platform&&n.append("platform",e.platform),e.accountemail&&n.append("accountemail",e.accountemail),e.items&&n.append("items",e.items),l.post(config.kotobee.liburl+"library/order/add",n,C).success(function(e){t&&(e.order&&e.order.id||L(),t(e))}).error(function(e){L()})},w.getOrder=function(e,t){var n=getFormData();n.append("orderid",e.orderid),n.append("uid",e.uid),n.append("valid",e.valid),l.post(config.kotobee.liburl+"library/order/get",n,C).success(function(e){t&&t(e)}).error(function(e){})},w.checkBookUpdates=function(e,t){var n=getFormData(w.getAuthVars());n.append("bid",e.bid),null!=e.checksum&&n.append("checksum",e.checksum),null!=e.ver&&n.append("ver",e.ver),l.post(config.kotobee.liburl+"library/ebook/checkupdates",n,C).success(function(e){e.error?t():t(e)}).error(function(e){})},w.getServerLang=function(e,t){if(!isKotobeeHosted()||config.loadLangsLocally)return o.get(cacheBust(rootDir+"locales/"+e.lang+".js"));var n=getFormData();return n.append("lang",e.lang),n.append("root",rootDir),n.append("v",readerV),n.append("base",publicRoot),o.post(config.kotobee.liburl+"library/getlang",n,C)},w.getS3Paths=function(t){var e=getFormData();l.post(config.kotobee.liburl+"library/s3paths",e,C).success(function(e){v.data.paths=e,function(e){for(var t=0;t<x.length;t++)x[t].event==e&&x[t].func()}("pathsChanged"),t&&t(e)}).error(function(){})},w.verifyCloudEmail=function(e,t){var n=getFormData(w.getAuthVars());n.append("cloudemail",e.cloudemail),l.post(config.kotobee.liburl+"user/verify",n,C).success(function(e){t&&t(e)}).error(function(){})},w.addBookStat=function(e,t){if(e=e||{},!preview&&config.kotobee.cloudid){window.location.href;0;var n=getFormData(w.getAuthVars());n.append("type",e.type),l.post(config.kotobee.liburl+"library/ebook/stat",n,C).success(function(e){}).error(function(){})}},w.addEvent=function(e,t){if(e=e||{},!preview){var n=window.location.href;if(debug||!(0<=n.indexOf("localhost/")||0<=n.indexOf("localhost:"))){var o=B(e);l.post(config.kotobee.liburl+"event/add",o,C).success(function(e){t&&t(e)}).error(function(){})}}},w.addStat=function(e,t){if(e=e||{},!preview){var n=window.location.href;if(!(0<=n.indexOf("localhost/")||0<=n.indexOf("localhost:"))){var o=B(e);l.post(config.kotobee.liburl+"stat/add",o,C).success(function(e){t&&t(e)}).error(function(){})}}},w.getUserProfile=function(e,t){var n={func:arguments.callee,args:arguments},o=getFormData(w.getAuthVars());l.post(config.kotobee.liburl+"user/profile",o,C).success(function(e){if(e.error)return d.update(e),void t();t(e)}).error(function(e){d.update({error:"networkError",ref:n})})},w.updateProfile=function(e,t){var n={func:arguments.callee,args:arguments},o=getFormData(w.getAuthVars());if(delete e.cloudid,e.dob){var r=new Date(e.dob);e.dob=r.getDate()+"-"+r.getMonth()+"-"+r.getFullYear()}for(var i in e)o.append(i,e[i]);l.post(config.kotobee.liburl+"user/update",o,C).success(function(e){if(e.error)return d.update(e),void t();t(e)}).error(function(){d.update({error:"networkError",ref:n})})},w.setUserData=function(e,t){var n=getFormData(w.getAuthVars());n.append("label",e.label),n.append("data",e.data),e.overwrite&&n.append("overwrite",e.overwrite),e.category&&n.append("category",e.category),e.subcategory&&n.append("subcategory",e.subcategory),e.options&&n.append("options",e.options),l.post(config.kotobee.liburl+"cloud/set",n,C).success(function(e){if(e.error)throw e;t(e)}).error(function(){throw"Network Error. Please try again"})},w.getUserData=function(e,t){var n=getFormData(w.getAuthVars());e.label&&n.append("label",e.label),e.category&&n.append("category",e.category),e.subcategory&&n.append("subcategory",e.subcategory),e.allUsers&&n.append("allUsers",!0),e.options&&n.append("options",e.options),l.post(config.kotobee.liburl+"cloud/get",n,C).success(function(e){if(e.error)throw e;t(e)}).error(function(){throw"Network Error. Please try again"})},w.getDataPerms=function(t){var e=getFormData(w.getAuthVars());l.post(config.kotobee.liburl+"cloud/perms",e,C).success(function(e){if(e.error)throw e;t(e)}).error(function(){throw"Network Error. Please try again"})},w.getUserList=function(e,t){var n=getFormData(w.getAuthVars());e.role&&n.append("role",e.role),l.post(config.kotobee.liburl+"cloud/users",n,C).success(function(e){if(e.error)throw e;t(e)}).error(function(){throw"Network Error. Please try again"})},w.getUserDataArray=function(e,t){var n=getFormData(w.getAuthVars());e.array&&n.append("array",e.array),l.post(config.kotobee.liburl+"cloud/getarray",n,C).success(function(e){if(e.error)throw e;t(e)}).error(function(){throw"Network Error. Please try again"})},w.setUserDataArray=function(e,t){var n=getFormData(w.getAuthVars());e.array&&n.append("array",e.array),l.post(config.kotobee.liburl+"cloud/setarray",n,C).success(function(e){t(e)}).error(function(){throw"Network Error. Please try again"})},w.deleteUserData=function(e,t){var n=getFormData(w.getAuthVars());n.append("label",e.label),n.append("data",e.data),e.all&&n.append("all",e.all),e.category&&n.append("category",e.category),e.subcategory&&n.append("subcategory",e.subcategory),e.options&&n.append("options",e.options),l.post(config.kotobee.liburl+"cloud/delete",n,C).success(function(e){if(e.error)throw e;t(e)}).error(function(){throw"Network Error. Please try again"})},w.sendEmail=function(e,t){var n=getFormData(w.getAuthVars());n.append("to",e.to),n.append("message",e.message),n.append("subject",e.subject),e.cc&&n.append("cc",e.cc),e.html&&n.append("html",e.html),e.fromEmail&&n.append("fromEmail",e.fromEmail),e.fromName&&n.append("fromName",e.fromName),l.post(config.kotobee.liburl+"cloud/send",n,C).success(function(e){if(e.error)throw e;t(e)}).error(function(){throw"Network Error. Please try again"})},w.getReviews=function(e,t){var n=getFormData(w.getAuthVars());e.uid&&n.append("uid",e.uid),e.bid&&n.append("bid",e.bid),e.max&&n.append("max",e.max),l.post(config.kotobee.liburl+"library/review/all",n,C).success(function(e){t(e)}).error(function(){})},w.addReview=function(e,t){var n=getFormData(w.getAuthVars());n.append("content",e.content),n.append("bid",e.bid),null!=e.rating&&n.append("rating",e.rating),l.post(config.kotobee.liburl+"library/review/add",n,C).success(function(e){t(e)}).error(function(){})},w.externalLink=function(n,e){try{if((e=e||{}).secure&&!native&&!desktop&&!preview)return void c.open(n);function o(e,t){native?h.openInNativeBrowser(e,t):desktop?require("nw.gui").Shell.openExternal(e):window.open(e,"_blank")}if(e.target&&"_blank"==e.target.toLowerCase())return void o(n,!0);if(native)return void o(n);var r={title:u.get("externalLink"),src:g.trustAsResourceUrl(n),openInNativeBrowser:o,status:"loading"},i=setTimeout(function(){r.status="",r.error=u.get("errorLoadingPage"),s.$$phase||s.$apply()},1e4);r.loaded=function(e,t,n){r.status="loaded",clearTimeout(i),s.$$phase||s.$apply()};var a=f.show({mode:"externalSite",animation:"slide-in-up",dynamic:!0,backdropClickToClose:!1,siteOptions:r});desktop||preview||w.getXframeOptions({url:n},function(e){if(r.status="loaded",s.$$phase||s.$apply(),e&&e.success){var t=e.success.toLowerCase();"sameorigin"!=t&&"deny"!=t||(f.hide(a),setTimeout(function(){f.show({mode:"xFrameError",errorOptions:{url:n,openInNativeBrowser:o}})},500))}})}catch(e){}},w.createRequest=function(e,t,n){t=t||{};var o=getFormData(w.getAuthVars());for(var r in t)o.append(r,t[r]);l.post(e,o,C).success(function(e){n(e)}).error(function(){n(!1)})},w.convertPDF=function(e,t){if(e=e||{},!preview){var n=getFormData(w.getAuthVars());n.append("url",e.url),l.post(config.kotobee.liburl+"library/pdf",n,C).success(function(e){t(e)}).error(function(){})}},w.validatePdfConversion=function(e,t){var n=getFormData(w.getAuthVars());for(var o in e)n.append(o,e[o]);l.post(config.kotobee.liburl+"library/pdf/validate",n,C).success(function(e){t(e)}).error(function(e){})},w.getXframeOptions=function(e,t){var n=getFormData(w.getAuthVars());n.append("url",e.url),l.post(config.kotobee.liburl+"getxframe",n,C).success(function(e){e.error?t():t(e)}).error(function(e){})},w.hasAccessTo=function(e,n){var t=getFormData(w.getAuthVars());for(var o in e=e||{})t.append(o,e[o]);t.append("v",readerV),l.post(config.kotobee.liburl+"user/access",t,C).success(function(e){if(config.kotobee.payment);n&&n(e)}).error(function(e,t){n&&n({error:""})})},w.setLastChapter=function(n){var e=getFormData(w.getAuthVars());e.append("chapter",currentIndex),l.post(config.kotobee.liburl+"user/lastchap",e,C).success(function(e){n&&n(e)}).error(function(e,t){n&&n({error:""})})},w.cloudParam=function(e){return config.kotobee[e]},w.getEbook=function(e,t){var n={func:arguments.callee,args:arguments},o=getFormData(w.getAuthVars());for(var r in e)o.append(r,e[r]);l.post(config.kotobee.liburl+"library/ebook/get",o,C).success(function(e){e.error&&d.update(e),e.pricing||(e.pricing=[]),config.kotobee.payment,t&&t(e)}).error(function(e){d.update({error:"networkError",ref:n}),t&&t({error:"networkError"})})},w.getEbooks=function(e,t,n){var o={func:arguments.callee,args:arguments},r=getFormData(w.getAuthVars());for(var i in e)r.append(i,e[i]);r.append("v",readerV),l.post(config.kotobee.liburl+"library/ebook/all",r,C).success(function(e){e.error&&d.update(e),config.kotobee.payment,n&&n(e,t)}).error(function(e){d.update({error:"networkError",ref:o}),n&&n({error:"networkError"},t)})},w.sendRawPost=function(t,n,o,r,i){i=i||0;var e="",a={};if(!o.ignoreCredentials){var s=w.getAuthVars();a=Object.assign(a,s)}if(a=Object.assign(a,n),o.queryString)e=Object.entries(a).map(function(e){var t=e[1];return Array.isArray(t)?(t=serializeObject(t,e[0]),Object.entries(t).map(function(e){return e[0]+"="+encodeURIComponent(e[1])}).join("&")):e[0]+"="+encodeURIComponent(t)}).join("&"),t+=e?"?"+e:"";else if(o.requestType&&"json"==o.requestType.toLowerCase())e=JSON.stringify(a);else for(var c in a){var l=a[c];null!=l&&"object"!=typeof l&&("string"==typeof l&&(l=encodeURIComponent(l=("."+l).substr(1))),"boolean"==typeof l&&(l=l?1:0),e+="&"+c+"="+l)}var d,u=new XMLHttpRequest;return u.open(o.method?o.method:"POST",t,!0),"GET"!=o.method&&u.setRequestHeader("Content-type",o.requestType&&"json"==o.requestType.toLowerCase()?"application/json;charset=UTF-8":"application/x-www-form-urlencoded"),o.onProgress&&(u.onprogress=function(e){var t;if(e.lengthComputable)t=e.loaded/e.total;else{if(!e.target.getResponseHeader("x-decompressed-content-length"))return;t=e.loaded/Number(e.target.getResponseHeader("x-decompressed-content-length"))}o.onProgress(t)}),o.responseType&&(u.responseType=o.responseType),u.addEventListener("error",function(e){r({error:"networkError"}),d=!0},!1),u.onreadystatechange=function(e){u.aborted||4==u.readyState&&(200==u.status?m(function(){r(u.response)}):u.onerror())},u.onerror=function(e){if(!d){if(!(3<=i))return w.sendRawPost(t,n,o,r,++i);m(function(){r({error:"d_connectionTimedOut"})})}},o.queryString||"GET"==o.method?u.send():u.send(e),u},w.abort=function(e){e&&4!=e.readyState&&(e.aborted=!0,e.abort())},w}]),app.factory("book",["$http","error","$timeout","$rootScope","crdv","khttp","translit","miniapps","freehand","modals","design","$location","library","np","sync","cssInjector","jsParser","chapters","cssParser","$q","status","backend","tinCan","stg","$sce","$filter",function(e,i,t,n,r,w,x,a,s,C,c,l,o,d,u,p,f,I,h,g,E,m,S,T,v,O){var b,A={};return A.root="",A.currentBook=null,A.initialize=function(){},A.getCoverImgPath=function(e,t){if(t=t||e.path,!e.cover)return"img/ui/defaultCover.png";var n="";return n=T.data.currentLibrary.cloud&&T.data.currentLibrary.cloud.public?T.getPublicRoot("book")+e.path+"/EPUB/"+e.cover:O("coverPath")(e.cover,t),e.exists&&(native?n=r.libEbooksDirectory.nativeURL+t+"/EPUB/"+e.cover.replace(/_thumb/g,""):desktop&&(n=ph.normalize(d.getBooksPath()+t+"/"+e.cover.replace(/_thumb/g,"")))),n=cleanURL(n)},A.getBgImgPath=function(e,t){if(t=t||e.path,!e.cover)return"";var n=T.getPublicRoot("book");return n+=e.path+"/"+e.bgimg},A.setAllowedChapters=function(e){if(A.allowedChapters=null,e&&e.length){for(var t=e.split(","),n=0;n<t.length;n++)t[n]=t[n];A.allowedChapters=t}},A.reload=function(){A.open(A.currentBook,{defaultIndex:currentIndex})},A.open=function(n,o){if(o=o||{},preview)return C.hide(),void setTimeout(function(){C.show({mode:"generalError",errorOptions:{msg:x.get("cantPreviewLibBook")}})},500);var t="download";n.openmethod&&0==n.openmethod.indexOf("download")&&(t="download"),o.openRemotely&&(t="open"),native&&"download"==t?(r.vibrate(),bookPath=cleanURL(r.libEbooksDirectory.nativeURL+n.path+"/EPUB/")):desktop&&"download"==t?(bookPath=d.getBooksPath()+n.path+"/","mac"==os&&(bookPath="file://"+bookPath)):(bookPath=T.data.currentLibrary.cloud.public?T.getPublicRoot("book"):config.kotobee.liburl+"books/",bookPath+=n.path+"/EPUB/"),A.currentBook=n,C.hide(),setTimeout(function(){var e;E.update(x.get("pleaseWait"),null,{dots:!0}),e=function(e){e.success?(A.setAllowedChapters(e.chapters),A.loadBook().then(function(){!function(e,r){if(!e.dver||e.dver<2)return r();if(config.noBookOverride)return r();w.get(cacheBust(ph.join(bookPath,"_kmeta/config.js"))).success(function(e){if(-1!=e.indexOf("var config")){e=e.replace("var config","var bookConfig");var t=document.createElement("script");t.setAttribute("bookconfig",!0);var n=document.getElementsByTagName("head");for(var o in n.length&&n[0].appendChild(t),t.innerHTML=e,b=b||clone(config),bookConfig)"kotobee"!=o&&(config[o]=bookConfig[o]);config.htmlInNotes=bookConfig.htmlInNotes,config.src="book",c.injectUserCSS(config),c.applyRichTextLibrary(),c.convertTabs(),r&&r()}else r()}).error(function(){r&&r()})}(n,function(){if(T.data.book.accessmode=n.accessmode,T.data.book.id=n.id,T.data.epub.bookThumb=A.getCoverImgPath(n,T.data.book.path),chromeApp)if(T.data.chromeAssets[T.data.book.bookThumb])T.data.epub.bookThumb=T.data.chromeAssets[T.data.book.bookThumb];else{var t=T.data.epub.bookThumb;delete T.data.epub.bookThumb,getImgDataSrc(t,function(e){T.data.epub.bookThumb=e,T.data.chromeAssets[t]=e})}E.update(),A.root="/book/"+T.data.book.id;var e="";null!=o.defaultIndex&&(e="/chapter/"+o.defaultIndex),l.path(A.root+"/reader"+e),u.initialize(),a.initialize(),s.initialize(),setTimeout(function(){I.initialize(o.defaultIndex),kotobee.dispatchEvent("bookOpened",T.data.book)},1e3)})})):E.update()},(native||desktop)&&"download"==t&&n.exists?e({success:!0}):m.hasAccessTo({testagainst:n.id,open:!0},e)},200)},A.removeBookConfigElem=function(){for(var e=document.getElementsByTagName("script"),t=0;t<e.length;t++)if(e[t].hasAttribute("bookconfig")){e[t].parentNode.removeChild(e[t]);break}if(b){for(var n in config)"kotobee"!=n&&delete config[n];for(var n in b)config[n]=b[n];c.injectUserCSS(config)}},A.loadBook=function(b){b=b||{};var n={func:arguments.callee,args:arguments},y=g.defer();function k(){O("chapterHtml")(T.data.toc),function(){var e=T.data.toc;if(!A.allowedChapters)return;for(var t=e.getElementsByTagName("a"),n=0;n<A.allowedChapters.length;n++){var o,r,i=A.allowedChapters[n],a=null;if(isNaN(i)){if((r=i.replace(/['"](.*?)['"]/g,"$1")).match(/\[\*\]$/g)&&(a=!0,r=r.replace(/\[\*\]$/g,"")),r.match(/^index::/g)){var s=r.replace(/^index::/g,"");o=I.getChapterURL(Number(s)),r=""}}else o=I.getChapterURL(Number(i));for(var c=0;c<t.length;c++){var l=null;r&&r==t[c].textContent&&(l=!0),o&&o==t[c].getAttribute("href")&&(l=!0),l&&(t[c].setAttribute("data-allow",!0),a&&t[c].setAttribute("data-allow-children",!0))}}for(c=0;c<t.length;c++){if(l=t[c].hasAttribute("data-allow")||t[c].hasAttribute("data-dontshow")||hasClass(t[c],"parentNotRestricted")){if(t[c].removeAttribute("data-allow"),t[c].hasAttribute("data-allow-children"))if((u=t[c].nextElementSibling)&&"ol"==u.nodeName.toLowerCase()){var d=u.getElementsByTagName("a");for(n=0;n<d.length;n++)addClass(d[n],"parentNotRestricted")}}else{t[c].className="restricted",t[c].setAttribute("data-index",c);var u,p=document.createElement("label");p.className="restrictedLabel",p.textContent=x.get("restricted"),t[c].parentNode.appendChild(p),(u=t[c].parentNode.getElementsByTagName("ol")[0])&&t[c].parentNode.appendChild(u)}}for(c=0;c<t.length;c++){var f=t[c].getAttribute("href"),h=getElementsByAttribute(T.data.epub.manifest,"item","href",f);if(h.length){var g=getElementsByAttribute(T.data.epub.spine,"itemref","idref",h[0].id);if(g.length&&"restricted"==t[c].className)for(var m=g.length;m--;)if("no"!=g[m].getAttribute("linear")){g[m].setAttribute("linear","no");break}}}var v=e.getElementsByClassName("restricted");for(c=0;c<v.length;c++)v[c].setAttribute("href","")}(),"files"==config.serialNavMode&&function(){T.data.toc;for(var e=T.data.epub.spine.getElementsByTagName("itemref"),t=1;t<e.length;t++){for(var n=null,o=t-1;0<=o;o--)if("no"!=e[o].getAttribute("linear")&&e[o].getAttribute("idref")==e[t].getAttribute("idref")){n=!0;break}n&&e[t].setAttribute("linear","no")}}(),T.data.book.chapters=T.data.toc.innerHTML,y.resolve()}return T.resetBook(),h.clearCache(),f.clearCache(),I.clearCache(),w.get(cacheBust(ph.join(bookPath,"META-INF/container.xml?v="+readerV))).success(function(e){config.kotobee.encodekey&&!kInteractive.isSDK()&&(e=1.1<=config.v?CryptoJS.AES.decrypt(e,config.kotobee.encodekey).toString(CryptoJS.enc.Utf8):kInteractive.XORCipher().decode(config.kotobee.encodekey,e));var t=parseXml(e);T.data.epub={};try{T.data.packageURL=t.getElementsByTagName("rootfile")[0].getAttribute("full-path")}catch(e){return E.update(),void i.update({error:"errorAndCallback",msg:native?"errorLoadingBookNative":"errorLoadingBook",cb:r.exit})}c.convertTabs();var m=config.v,v=native||isKotobeeHosted();!function(e,t){var n=e.sharedTemplateJs,o=e.version,r=(window.location.origin,Math.round(9999*Math.random()));"book"==config.kotobee.mode&&!isReaderApp&&1.3<=o&&!n?w.get("js/templates.js?c="+r).success(t).error(function(){i.update({error:"networkError",ref:ref})}):t()}({sharedTemplateJs:v,version:m},function(g){var e=b.getInfoOnly?"&info":"";w.get(cacheBust(ph.join(bookPath,T.data.packageURL))+e).success(function(e){if(T.data.packageOpf=e,"book"==config.kotobee.mode&&!isReaderApp)if(1.3<=m){var t=CryptoJS.MD5(e.replace(/\s+/g,"")).toString();if(config.kotobee.hostPath&&"kotobee"==config.kotobee.hostType&&(t=""),v){if(0!=config.checksum.indexOf(t))return void o()}else{var n=CryptoJS.MD5(g).toString();if(t+n!=config.checksum&&(g=g.replace(/(\S)\n/g,"$1\r\n"),t+(n=CryptoJS.MD5(g).toString())!=config.checksum))return o()}}else if(1.2<=m&&CryptoJS.MD5(e).toString()!=config.checksum)return void o();function o(){E.update(),C.show({mode:"generalError",errorOptions:{msg:x.get("errorLoadingPage")}});var e=document.getElementsByClassName("loaded");e.length&&e[0].parentNode.removeChild(e[0])}config.kotobee.encodekey&&!kInteractive.isSDK()&&(e=1.1<=config.v?CryptoJS.AES.decrypt(e,config.kotobee.encodekey).toString(CryptoJS.enc.Utf8):kInteractive.XORCipher().decode(config.kotobee.encodekey,e));var r=parseXml(e=e.replace(/href="([^"]*?&[^"]*?)"/g,function(e,t){return'href="'+t.replace(/&/g,"")+'"'}));T.data.epub.metadata=r.getElementsByTagName("metadata")[0],T.data.epub.manifest=r.getElementsByTagName("manifest")[0],T.data.epub.spine=r.getElementsByTagName("spine")[0],T.data.epub.guide=r.getElementsByTagName("guide")[0],T.data.mediaList=[],T.data.book.meta={},T.data.book.version=3;try{for(var i=0;i<T.data.epub.metadata.childNodes.length;i++){var a;if(8!=(a=T.data.epub.metadata.childNodes[i]).nodeType&&"#text"!=a.nodeName)if(a.hasAttribute("name")&&"meta"==a.nodeName.toLowerCase())T.data.book.meta[a.getAttribute("name")]=a.getAttribute("content");else for(var s=(a.hasAttribute("property")?a.getAttribute("property"):a.nodeName).split(":"),c=T.data.book.meta,l=0;l<s.length;l++)l==s.length-1?c[s[l].toLowerCase()]=a.innerHTML?a.innerHTML:a.textContent:(c[s[l].toLowerCase()]||(c[s[l].toLowerCase()]={}),c=c[s[l].toLowerCase()])}}catch(e){}if(T.data.book.meta.kotobee&&T.data.book.meta.kotobee.spine){var d=kInteractive.readRawData(T.data.book.meta.kotobee.spine);if(d&&d.raw){var u=document.createElement("div");u.innerHTML=d.raw.replace(/\/>/g,"></itemref>"),T.data.epub.spine=u.children[0]}}var p=getElementsByAttribute(T.data.epub.manifest,"item","properties","cover-image");if(0<p.length?T.data.epub.bookThumb=O("coverPath")(p[0].getAttribute("href")):T.data.book.meta.cover&&0<(p=getElementsByAttribute(T.data.epub.manifest,"item","id",T.data.book.meta.cover)).length&&(T.data.epub.bookThumb=O("coverPath")(p[0].getAttribute("href"))),chromeApp&&T.data.epub.bookThumb&&(T.data.chromeAssets[T.data.epub.bookThumb]?T.data.epub.bookThumb=T.data.chromeAssets[T.data.epub.bookThumb]:getImgDataSrc(T.data.epub.bookThumb,function(e){T.data.chromeAssets[T.data.epub.bookThumb]=e,T.data.epub.bookThumb=e})),b.getInfoOnly)return y.resolve(),y.promise;function f(e,t){t=t||{};for(var n=getElementsByAttribute(T.data.epub.manifest,"item","media-type",e+"/.*"),o=0;o<n.length;o++){var r=n[o].getAttribute("href");if(0!=r.indexOf("js/widgets/")&&(0!=r.indexOf("xhtml/pdf")||-1==r.indexOf("/page"))){var i={};i.thumbnail=cleanURL(t.thumb?t.thumb:ph.join(bookPath,T.data.packageURL,n[o].getAttribute("href"))),i.title=ph.removeExtension(ph.basename(i.thumbnail));var a=n[o].getAttribute("media-type");i.ext=a.split(e+"/")[1],i.type=e,i.src=cleanURL(ph.join(bookPath,T.data.packageURL,n[o].getAttribute("href"))),T.data.mediaList.push(i),chromeApp&&isAbsoluteURLAndNotDataPath(i.thumbnail)&&(T.data.chromeAssets[i.thumbnail]?i.thumbnail=T.data.chromeAssets[i.thumbnail]:s(i))}}function s(t,n){getImgDataSrc(t.thumbnail,function(e){T.data.chromeAssets[t.thumbnail]=e,t.thumbnail=e,n&&n()})}}T.initializeSettings(),config.videosInMediaTab&&f("video",{thumb:"img/ui/videoFile.png"}),config.audioInMediaTab&&f("audio",{thumb:"img/ui/audioFile.png"}),config.imagesInMediaTab&&f("image",{});try{T.data.tocPath=getElementsByAttribute(T.data.epub.manifest,"item","properties","[s]*nav[s]*")[0].getAttribute("href")}catch(e){var h=T.data.epub.spine.getAttribute("toc");if(!h)return void k();try{T.data.book.version=2,T.data.tocPath=getElementsByAttribute(T.data.epub.manifest,"item","id",h)[0].getAttribute("href")}catch(e){return void k()}}w.get(cacheBust(ph.join(bookPath,T.data.packageURL,T.data.tocPath))).success(function(e){if(config.kotobee.encodekey&&!kInteractive.isSDK()&&(e=1.1<=config.v?CryptoJS.AES.decrypt(e,config.kotobee.encodekey).toString(CryptoJS.enc.Utf8):kInteractive.XORCipher().decode(config.kotobee.encodekey,e)),2==T.data.book.version){var t=parseXml(e).getElementsByTagName("navMap");t.length&&(T.data.toc=function e(t){var n=document.createElement("ol");for(var o=0;o<t.childNodes.length;o++)if(t.childNodes[o]){var r=t.childNodes[o];if(8!=r.nodeType&&"#text"!=r.nodeName&&"navpoint"==r.nodeName.toLowerCase()){for(var i,a,s,c=0;c<r.childNodes.length;c++)if(r.childNodes[c]){var l=r.childNodes[c].nodeName.toLowerCase();"content"==l?a=r.childNodes[c].getAttribute("src"):"navlabel"==l?i=r.childNodes[c].textContent.trim():"navpoint"==l&&(s=s||e(r))}var d=document.createElement("li"),u=document.createElement("a");u.innerHTML=i||"",u.setAttribute("href",a?ph.join(T.data.tocPath,a):""),d.appendChild(u),s&&d.appendChild(s),n.appendChild(d)}}return n}(t[0]))}else for(var n=parseHtml(e).getElementsByTagName("nav"),o=0;o<n.length;o++)if(!n[o].hasAttribute("epub:type")||"toc"==n[o].getAttribute("epub:type"))for(var r=n[o].getElementsByTagName("ol"),i=0,a=0;a<r.length;a++){var s=r[a].getElementsByTagName("a");if(!(s.length<i)){i=s.length,T.data.toc=r[a];for(var c=s.length;c--;)s[c].getAttribute("href")?s[c].setAttribute("href",ph.join(T.data.tocPath,s[c].getAttribute("href"))):s[c].setAttribute("href","")}}k()}),S.send({verb:"opened",activity:"Book: "+T.data.book.meta.dc.title})}).error(function(){i.update({error:"networkError",ref:n})})})}).error(function(e){E.update(),native||desktop||"file://"!=window.location.origin?i.update({error:"errorAndCallback",msg:native?"errorLoadingBookNative":"errorLoadingBook",cb:r.exit}):i.update({error:"This browser failed to run the ebook app locally. Please try a different browser, or upload the web files to your server and run the web app online"})}),y.promise},A.getTitleByIndex=function(e){if(T.data.toc)try{for(var t=T.data.toc.getElementsByTagName("li"),n=[],o=0;o<t.length;o++)if(t[o]){var r=t[o].getElementsByTagName("a");r.length&&"true"!=r[0].getAttribute("data-dontshow")&&n.push(t[o])}return n[e].getElementsByTagName("a")[0].textContent}catch(e){}},A}]),app.factory("bookinfo",["khttp","error","$timeout","auth","$rootScope","crdv","np","library","book","sync","$location","events","translit","modals","$injector","cssInjector","jsParser","chapters","cssParser","$q","status","backend","tinCan","stg","$sce","$filter","payment",function(a,e,r,t,s,c,l,n,d,o,i,u,p,f,h,g,m,v,b,y,k,w,x,C,I,E,S){var T,O,A,N,L={};function B(e){var t={};return t.background="url('"+e+"')",t["background-size"]="cover",t["background-position"]="center center",t.opacity="1",t}function M(){D();var e="download"==T||"open"==T;"book"==config.kotobee.mode?O.privilege=T="loading":((native||desktop)&&e&&(O.exists?O.privilege=T="open":"public"!=O.accessmode&&"all"!=O.accessmode&&(O.privilege=T="loading")),native||desktop||!e||"public"!=O.accessmode&&"all"!=O.accessmode&&(O.privilege=T="loading"),"login"==T&&(O.unauthredirect&&(O.redirect=C.data.currentLibrary.unauthredirect),O.overrideunauthredirect&&(O.redirect=O.unauthredirect))),F()}function R(t){if("loading"==T){if("book"==config.kotobee.mode)return config.kotobee.pricing&&config.kotobee.pricing.purchasable?(O.price=config.kotobee.pricing.price,O.price_localized="$"+config.kotobee.pricing.price,"https:"==location.protocol?O.privilege=T="buy":O.privilege=T="insecure"):D(),F(),s.$$phase||s.$apply(),t?t():null;if("public"==O.accessmode||"all"==O.accessmode||config.kotobee.payment&&config.kotobee.pricing&&!config.kotobee.pricing.purchasable&&"book"==config.kotobee.mode)return t?t():null;O.redirect=null,w.hasAccessTo({testagainst:O.id},function(e){return e.success?D():e.error&&e.purchasable?native?S.isInAppPurchaseEnabled()?S.handleInAppProduct(O):(O.privilege=T="denied",O.redirect=C.data.currentLibrary.unauthredirect,O.overrideunauthredirect&&(O.redirect=O.unauthredirect)):(O.price=e.price,O.price_localized="$"+e.price,"https:"==location.protocol?O.privilege=T="buy":O.privilege=T="insecure"):(O.privilege=T="denied",O.redirect=C.data.currentLibrary.unauthredirect,O.overrideunauthredirect&&(O.redirect=O.unauthredirect)),native&&"buy"==T||(F(),s.$$phase||s.$apply()),t?t():null})}}function P(e){return C.data.info||(C.data.info={}),C.data.info["book"+e.id]||(C.data.info["book"+e.id]={}),C.data.info["book"+e.id]}function D(){O&&("book"==config.kotobee.mode?T="login":native||desktop?"download"==(T=O.updating?"updating":O.exists?"open":P(O).loading?"downloading":P(O).extracting?"extracting":w.cloudParam("public")?"download":C.data.user.loggedIn?"download":"public"==O.accessmode||"all"==O.accessmode?"download":w.cloudParam("entry")?"login":"download")&&"open"==O.openmethod&&(T="open"):w.cloudParam("public")?T="open":C.data.user.loggedIn?T="open":"public"==O.accessmode||"all"==O.accessmode?T="open":w.cloudParam("entry")&&(T="login"),O.privilege=T)}function F(){A&&A.ui&&(A.ui.privilege=T,A.ui.actionBtnIcon=function(){if("open"==T)return"icon kb-book-open size20 vAlignTop";if("login"==T)return"icon kb-user size14";if("download"==T)return"icon kb-download size20";if("downloading"==T)return null;if("updating"==T)return null;if("loading"==T)return null;if("buy"==T)return null;if("unavailable"==T)return null}(),A.ui.actionBtnSpinnerIcon=function(){if("downloading"==T)return"dots";{if("updating"==T)return"dots";if("loading"==T)return"dots"}}(),A.ui.actionBtnLabel=function(){if("buy"==T){var e=O.pricing;"book"==config.kotobee.mode&&(e=config.kotobee.pricing);var t=p.get("buyWithPrice");if(t=t.replace("{{price}}","$"+e.price),e.issubscr&&e.subscrcycle){var n="";n=7==e.subscrcycle?p.get("week"):30==e.subscrcycle?p.get("month"):365==e.subscrcycle?p.get("year"):p.get("xDays").replace("{{x}}",e.subscrcycle),t="<span class='subscr'>"+p.get("buyWithSubscr").replace("{{price}}",e.price).replace("{{cycle}}",n)+"</span>"}return t}if("unavailable"==T)return p.get("bookUnavailable");if("open"==T)return p.get("read");if("login"==T)return p.get("loginToRead");if("download"==T)return p.get("download");if("downloading"==T)return p.get("downloading");if("updating"==T)return p.get("updating");if("extracting"==T)return p.get("extracting");if("loading"==T)return p.get("pleaseWait");if("denied"==T)return p.get("bookAccessDenied");if("insecure"==T)return p.get("securityInfo")}(),A.ui.actionBtnStyle="buy"==T?"buyBtn":"unavailable"==T?"unavailableBtn":"open"==T?"openBtn":"login"==T?"openBtn":"downloading"==T?"downloadingBtn":"updating"==T?"downloadingBtn":"extracting"==T?"downloadingBtn":"loading"==T?"loadingBtn":"denied"==T?"deniedBtn":"insecure"==T?"insecureBtn":"downloadBtn",A.ui.paymentOptions=S.getPaymentOptions())}function H(){L.show(N),r(function(){L.update(O)},800)}return L.redeemCode=function(){f.hide(),t.redeemCode({source:"bookinfo"},function(){L.show(N)})},L.show=function(t,e){e=e||{},O=(N=t).book,native&&c.vibrate();var n={};for(var o in t.book.meta||(t.book.meta={}),t.book.meta)"object"!=typeof t.book.meta[o]&&(n[o]=t.book.meta[o]);t.book.meta.dc=Object.assign({},t.book.meta.dc,n),!t.book.meta.dc.creator&&t.book.meta.author&&(t.book.meta.dc.creator=t.book.meta.author),t.book.coverStyle||(t.book.coverImg=d.getCoverImgPath(t.book),t.book.coverStyle=t.book.bannerStyle={"background-image":"url('"+t.book.coverImg+"')"},t.book.bgimg&&(t.book.bannerStyle=B(d.getBgImgPath(t.book))),chromeApp&&(C.data.chromeAssets[t.book.coverImg]?t.book.coverStyle=t.book.bannerStyle={"background-image":"url('"+C.data.chromeAssets[t.book.coverImg]+"')"}:getImgDataSrc(t.book.coverImg,function(e){C.data.chromeAssets[t.book.coverImg]=e,t.book.coverStyle={"background-image":"url('"+e+"')"},t.book.bgimg||(t.book.bannerStyle=t.book.coverStyle)}),t.book.bgimg&&(C.data.chromeAssets[t.book.bgImg]?t.book.bannerStyle=B(C.data.chromeAssets[t.book.bgImg]):getImgDataSrc(d.getBgImgPath(t.book),function(e){C.data.chromeAssets[t.book.bgImg]=e,t.book.bannerStyle=B(e)}))));var r={};r.book=t.book,r.categoryClicked=t.categoryClicked,r.ui={},r.stage="info",A=r;var i="slide-in-up";"none"==e.animation&&(i="none"),e.noModal?f.getScope().modal.bookInfoOptions=r:f.show({mode:"bookInfo",dynamic:!0,animation:i,bookInfoOptions:r},function(){}),M(),function(t){if("library"!=config.kotobee.mode)return;if(!native&&!desktop)return;if(!O.exists)return;!function(o){var r=l.getBooksPath()+O.path;"mac"==os&&(r="file://"+r);native&&(r=cleanURL(c.libEbooksDirectory.nativeURL+O.path+"/EPUB"));function e(n){a.get(cacheBust(ph.join(r,"_kmeta/config.js"))).success(function(e){if(!e)return n();e=e.replace("var config = ","");var t=JSON.parse(e).checksum;if(!t)return n();n(t)}).error(function(){n()})}!function(t){a.get(cacheBust(ph.join(r,"ver.txt"))).success(function(e){t(e)}).error(function(){t()})}(function(n){asyncCheck(null!=n,e,[],function(e){var t={};t.bid=O.id,null!=n&&(t.ver=n),null!=e&&(t.checksum=e),w.checkBookUpdates(t,function(e){if(e){if(null==t.ver&&(desktop?l.writeFile(r+"/ver.txt",e.ver):native&&c.writeFile(e.ver,O.path+"/EPUB/ver.txt",c.libEbooksDirectory)),e.latestVer>e.ver)return o(!0);o()}})})})}(function(e){t.updateAvailable=e,s.$$phase||s.$apply()})}(r),setTimeout(R,mobile?1e3:500)},L.refetch=function(){T="loading",O&&R()},L.setBusy=function(e){A&&(A.busy=e)},L.getCurrentBook=function(){return O},L.inAppPurchaseCallback=function(e){function t(){e&&e.price?(O.price=e.priceMicros/1e6,O.price_localized=e.price,O.privilege=T="buy"):O.privilege=T="unavailable",F(),s.$$phase||s.$apply()}e&&e.loaded&&e.valid&&e.transaction&&e.transaction.id&&S.isCurrentUserID(e)&&S.validateInAppPurchase(e,function(e){e&&D(),t()},{cache:!0}),t()},L.update=function(e){O.updating||(O.updating=!0,L.download(e,function(){O.updating=!1}),s.$$phase||s.$apply())},L.immediateEnter=function(e){(O=e).clicked=!0,M(),R(function(){e.clicked=!1,"open"==T?d.open(e):"download"==T?L.download(e):(f.hide(),f.show({mode:"generalError",errorOptions:{msg:p.get("errorNoAccessToBook")}}))})},L.download=function(n,o){function e(e){P(n).progress=Math.ceil(100*e),s.$$phase||s.$apply()}P(n).loading||(c.vibrate(),c.toast(p.get("bookIsDownloading")),P(n).loading=!0,D(),F(),P(n).progress=0,setTimeout(function(){w.downloadEbook(n,e,function(t){P(n).loading=null,t&&(P(n).extracting=!0,D(),F(),r(function(){!function(e,t,n,o){native?c.writeEbook(e,t,n,o):desktop&&l.writeEbook(e,t,n,o)}("src.zip",n,t,function(e){t=null,P(n).extracting=null,D(),F(),f.hide(),r(function(){f.show({mode:"bookDownloaded",downloadedOptions:{book:n,open:d.open},apply:!0}),h.get("library").applyExistingBooks(C.data.currentLibrary.books),w.addBookStat({type:"download"}),o&&o()},1e3)})}))})},500))},L.prevStage=function(){"paymentMethod"==A.stage?"book"==config.kotobee.mode?A.stage="emailCollection":A.stage="info":"emailCollection"==A.stage&&(A.stage="info")},L.nextStage=function(){if("info"==A.stage){if("book"==config.kotobee.mode)return A.paymentEmail1=null,A.paymentEmail2=null,A.paymentEmailError=null,A.stage="emailCollection";var e={id:A.book.id,amount:A.book.price.toString()};return S.renderPaypalButton(e,L.refetch),A.stage="paymentMethod"}if("emailCollection"==A.stage)return A.paymentEmail1&&A.paymentEmail2?A.paymentEmail1!=A.paymentEmail2?A.paymentEmailError=p.get("emailsDontMatch"):(A.verifyingEmail=!0,w.verifyCloudEmail({cloudemail:A.paymentEmail1},function(e){if(A.verifyingEmail=!1,e&&"book"==e.mode)return A.paymentEmailError=p.get("emailAlreadyExists"),void(s.$$phase||s.$apply());var t={id:A.book.id,amount:A.book.price.toString(),accountemail:A.paymentEmail1};S.renderPaypalButton(t,L.refetch),A.stage="paymentMethod"}),!0):A.paymentEmailError=p.get("emailFormatError")},L.action=function(e,t){if("loading"!=T)if("denied"!=T){if("insecure"==T)return f.hide(),void r(function(){f.show({mode:"generalError",errorOptions:{msg:p.get("insecureProtocolDesc")}})},500);if("unavailable"!=T)if("buy"!=T){if("open"==T){if(A.updateAvailable)return f.hide(),void r(function(){f.show({mode:"bookUpdateAvailable",updateAvailableOptions:{book:O,open:d.open,update:H},apply:!0})},500);d.open(e)}else"login"==T?(f.hide(),setTimeout(w.login,1e3)):"download"==T&&L.download(e);D(),F()}else{if(L.nextStage())return;if(t){A.paying=t;var n={};n.bookOb=e,n.paymentEmail=A.paymentEmail1,S.makePayment(t,n)}else f.hide(),f.show({mode:"generalError",errorOptions:{msg:p.get("missingPaymentMethod")}})}else u.add({action:"bookUnavailableBtnClicked",param:e.name,bid:e.id})}else u.add({action:"accessDeniedBtnClicked",param:e.name,bid:e.id})},L.delete=function(e){c.toast(p.get("deletingBook")),c.vibrate(),function(e,t){native?c.deleteEbook(e,t):desktop&&l.deleteEbook(e,t)}(e,function(){D(),F(),s.$$phase||s.$apply()})},L.toggleFav=function(e){e.favorite?L.removeFav(e,!0):L.addToFav(e,!0)},L.addToFav=function(e,t){t?e.favorite=!0:k.update(p.get("addingToFavorites"),null,{dots:!0}),w.addtoFav(e,function(){e.favorite=!0,t||k.update()})},L.removeFav=function(e,t){t?e.favorite=!1:k.update(p.get("removingFromFavorites"),null,{dots:!0}),w.removeFav(e,function(){e.favorite=!1,t||k.update(),angular.element(document.getElementById("library")).scope().loadFavorites()})},L}]),app.factory("cache",function(){var n={},o={};return n.initialize=function(){n.setOb("body",document.getElementsByTagName("body")[0]);var e=document.getElementsByTagName("title"),t=null;e.length?t=e[0]:(t=document.createElement("title"),document.head.appendChild(t)),n.setOb("title",t)},n.setOb=function(e,t){return o[e]=t},n.getOb=function(e){return o[e]},n}),app.factory("cart",["stg","modals","$injector","translit","payment","bookinfo",function(a,s,r,i,c,e){a.data.cartData=[];var l={currency:"$"};function d(){s.hide(),kotobee.popup(i.get("cartConfirmationMsg"),{title:i.get("cartTitle"),okBtn:i.get("ok"),raw:!1,noBackdrop:!1,cb:function(){}})}function u(){a.readSlot("cart",function(e){a.data.cartData=e})}function t(e){l.bids=[];for(var t=0;t<e.length;t++)l.bids.push({type:"book",id:+e[t].bookId,amount:+e[t].bookPrice,bookname:e[t].bookName});for(var n=0;n<a.data.cartData.length;n++)for(var o=a.data.cartData[n],r=0;r<e.length;r++){var i=e[r];o.bookId==i.bookId&&(i.bookImgUrl=o.bookImgUrl)}a.data.cartData=e,a.writeSlot("cart",a.data.cartData),s.show({mode:"cart",dynamic:!0,animation:"slide-in-up"},function(){})}function p(){a.data.cartData=[],a.clearSlot("cart",function(){})}return u(),l.add=function(e){u();var t={bookId:e.id,bookName:e.name,bookPrice:e.price_localized,bookImgUrl:e.coverImg};if(a.data.cartData.length){for(var n=[],o=0;o<a.data.cartData.length;o++){var r=a.data.cartData[o];if(t.bookId==r.bookId){n.push(!0);break}}n.length||(a.data.cartData.push(t),a.writeSlot("cart",a.data.cartData)),d()}else a.data.cartData.push(t),a.writeSlot("cart",a.data.cartData),d()},l.remove=function(o){a.data.cartData.forEach(function(e,t,n){e.bookId==o&&n.splice(t,1)}),a.writeSlot("cart",a.data.cartData)},l.getTotalPrice=function(){for(var e=[],t=0;t<a.data.cartData.length;t++){var n=+a.data.cartData[t].bookPrice.trim();e.push(n)}return e.reduce(function(e,t){return e+t},0)},l.show=function(){l.load(t)},l.load=function(o){"library"==config.kotobee.mode&&a.readSlot("cart",function(e){for(var t="",n=0;n<e.length;n++){t+=e[n].bookId+","}t=t.replace(/\,$/,""),r.get("backend").sendRawPost(config.kotobee.liburl+"library/order/getproducts",{bids:t},{responseType:"json"},function(e){e.error?kotobee.popup(i.get("cartErrorMessageDesc"),{title:i.get("cartTitle"),okBtn:i.get("ok"),raw:!1,noBackdrop:!1,cb:function(){}}):o(e)})})},l.checkout=function(o){s.hide(),s.show({mode:"checkout",dynamic:!0,animation:"slide-in-up"},function(){for(var e=c.getPaymentOptions(),t=0;t<e.length;t++){var n=e[t];"paypal"!==n.gateway||n.logo||(n.logo="img/ui/paypal.png"),n.logo&&(n.logo=n.logo.replace(/(\/payment)/,""))}l.paymentOptions=e,l.currentOrder=o,config.kotobee.payment.paypal&&setTimeout(function(){var e;if(l.currentOrder)e={order:l.currentOrder};else{var t=kotobee&&kotobee.user&&kotobee.user.email?kotobee.user.email:"";e={items:l.bids,accountemail:t}}c.renderPaypalButton(e,p)},200)})},l.pay=function(n){var o=kotobee&&kotobee.user&&kotobee.user.email?kotobee.user.email:"";!function(e,t){if(l.currentOrder)return t(l.currentOrder);r.get("backend").createOrder(e,function(e){e.order&&e.order.id?t(e.order):kotobee.popup(i.get("unexpectedError"),{title:i.get("checkoutTitle"),okBtn:i.get("ok"),raw:!1,noBackdrop:!1,cb:function(){}})})}({platform:n,items:JSON.stringify(l.bids),accountemail:o},function(e){if("moyasar"===n){var t={orderid:e.id,redirecturl:native?"http://localhost:8100":window.location.protocol+"//"+window.location.host+window.location.pathname,price:100*+e.amount,name:c.getOrderName(e)};c.moyasarSettings.payment(t,p)}else"stripe"===n&&c.stripeMakePayment(n,{order:e},{paymentEmail:o},{id:""},p)})},l.back=function(){s.hide(),s.show({mode:"cart",dynamic:!0,animation:"slide-in-up"},function(){})},l}]),app.factory("chapterAPI",["chapters","stg","$ionicSideMenuDelegate","nav","notes","modals","traverser","translit","events","scorm","selection","$ionicScrollDelegate","$rootScope","$location","backend","tinCan","settings","miniapps",function(r,i,e,t,a,n,s,o,c,l,d,u,p,f,h,g,m,v){var b={},y=[];function k(){if(!(arguments.length<2)){var e,t=arguments[0],n={};e=2==arguments.length?arguments[1]:(n=arguments[1],arguments[2]),n.unique&&x(t);var o={event:t,cb:e};y.push(o)}}function w(e,t){if(e){t=t||{};for(var n=function(e){if(!e)return;for(var t=[],n=y.length;n--;)y[n].event==e&&t.push(y[n]);return t}(e),o=0;o<n.length;o++){var r=n[o];if(r&&r.cb&&(r.cb.apply(this,[t]),t.firstMatch))break}}}function x(e){for(var t=y.length;t--;)e&&y[t].event!=e||y.splice(t,1)}function C(){var e=document.getElementById("tabMenu");if(e)return angular.element(e).scope()}function I(e){var t=C();t&&t.notebookClicked(e)}function E(){var e=C();e&&e.pdfClicked()}function S(){var e=C();e&&e.printClicked()}function T(){var e=C();e&&e.settingsClicked()}function O(){var e=C();e&&e.searchClicked()}function A(n){var e=C();e&&e.searchClicked(function(){if(n){var e=document.getElementById("readerBody"),t=angular.element(e).scope();t.clearResults(),p.$$phase||p.$apply(),setTimeout(function(){document.getElementById("searchModalField").value=n,t.search(n)},30)}})}function N(){var e=C();e&&e.mediaClicked()}function L(){var e=C();e&&e.chaptersClicked()}function B(){e.toggleRight(!1),e.toggleLeft(!1),t.fullscreen()}function M(){return i.data.settings.language}function R(e,t){i.data.settings.language=e,m.langChanged(t)}function P(e){o.setDirection(e)}function D(){n.hide()}function F(){e.toggleLeft(!1),e.toggleRight(!1)}function H(){return"undefined"!=typeof window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:null}function $(){r.nextChapter()}function U(){r.prevChapter()}function _(e){r.loadChapterByIndex(e)}function j(e){f.search("vi"),r.applyChapterStateFromURL(e,{vIndex:0}),p.$$phase||p.$apply()}function z(e,t,n){r.preloadChapterFromApi(e,t,n)}function V(){r.clearCache()}function q(e){r.neverCache(e)}function W(){var e,t=u.$getByHandle("content");if(t&&(e=t.getScrollPosition()),1==e.zoom){var n=document.getElementById("epubContainer");if(hasClass(n.children[0],"scroll")){var o=n.children[0].style.transform.replace(/.*?scale\((.*?)\).*?/g,"$1");o&&(e.zoom=Number(o))}}return e}function K(e){var t=u.$getByHandle("content");t&&t.scrollTo(0,0,e)}function G(e,t){var n=u.$getByHandle("content");n&&n.scrollTo(0,e,t)}function J(e){v.openById(e)}function X(e,t){var n=clone(t=t||{});n.content=e,kInteractive.alert(n)}function Y(e,t){var n={};n.content=e,isFunction(t)?(n.okBtn="Yes",n.noBtn="No",n.cb=t):(t.okBtn&&(n.okBtn=t.okBtn),t.noBtn&&(n.noBtn=t.noBtn),n.cb=t.cb,n.noBackdrop=t.noBackdrop),kInteractive.confirm(n)}function Z(e,t){h.externalLink(e,t)}function Q(e,t){var n=s.convertElemsToLocation([t]),o={};o.chapter=r.getElemChapterIndex(t),o.location=n.left?n.left:n.right,o.type="content",o.src=t.textContent,o.note=e,i.addNote(o,function(){a.addIcon(o)})}function ee(e,t){l.setManual(e,t)}function te(e){e=e||{},g.send(e)}function ne(e,t){if(!i.data.user.loggedIn)throw"User must be logged in.";if(!e.label)throw"'label' variable required.";if(!e.data)throw"'data' variable required.";h.setUserData(e,t)}function oe(e,t){if(!i.data.user.loggedIn)throw"User must be logged in.";h.getUserData(e,t)}function re(e,t){if(!i.data.user.loggedIn)throw"User must be logged in.";h.getUserList(e,t)}function ie(e,t){if(!i.data.user.loggedIn)throw"User must be logged in.";h.getUserDataArray({array:JSON.stringify(e)},t)}function ae(e,t){if(!i.data.user.loggedIn)throw"User must be logged in.";kInteractive.helpers&&kInteractive.helpers.persister&&kInteractive.helpers.persister.instances?Object.values(kInteractive.helpers.persister.instances).find(function(e){return 1==e.testMode})?h.setUserDataArray({array:JSON.stringify(e)},function(e){setTimeout(function(){t(e)},5e3)}):h.setUserDataArray({array:JSON.stringify(e)},t):h.setUserDataArray({array:JSON.stringify(e)},t)}function se(e){if(!i.data.user.loggedIn)throw"User must be logged in.";h.getDataPerms(e)}function ce(e,t){if(!i.data.user.loggedIn)throw"User must be logged in.";if(!e.label)throw"'label' variable required.";h.deleteUserData(e,t)}function le(){kotobee.getDataArray([{}],function(e){!e.hasOwnProperty("error")&&e.length&&kInteractiveCommon.unique(e[0].results.map(function(e){return e.label})).forEach(function(e){e&&kotobee.deleteData({label:e},console.warn)})})}function de(){kotobee.clearLocalData(),kotobee.clearRemoteData()}function ue(e,t){if(!i.data.user.loggedIn)throw"User must be logged in.";if(!e.to)throw"'to' variable required.";if(!e.message)throw"'message' variable required.";if(!e.subject)throw"'subject' variable required.";if(!e.fromName)throw"'fromName' variable required.";if(!e.fromEmail)throw"'fromEmail' variable required.";h.sendEmail(e,t)}function pe(e,t,n){if(!i.data.user.loggedIn)throw"User must be logged in.";if(!e)throw"Event name is required.";2==arguments.length&&isFunction(t)&&(n=t,t=null);var o={};o.event=e,o.data=JSON.stringify(t||{}),c.add({action:"customEvent",param:JSON.stringify(o)},n)}return b.initialize=function(){kotobee.addEventListener=k,kotobee.dispatchEvent=w,kotobee.clearListeners=x,kotobee.openNotebook=I,kotobee.exportPDF=E,kotobee.print=S,kotobee.openSettings=T,kotobee.openSearch=O,kotobee.search=A,kotobee.openMedia=N,kotobee.openChapters=L,kotobee.toggleFullscreen=B,kotobee.getLanguage=M,kotobee.setLanguage=R,kotobee.setDirection=P,kotobee.closePopups=D,kotobee.closeSidepanels=F,kotobee.openMiniapp=J,kotobee.getEnvironment=H,kotobee.nextChapter=$,kotobee.prevChapter=U,kotobee.gotoChapterIndex=_,kotobee.gotoChapterHref=j,kotobee.getChapter=z,kotobee.clearCache=V,kotobee.neverCache=q,kotobee.getScrollPosition=W,kotobee.scrollToTop=K,kotobee.scrollTo=G,kotobee.view={},kotobee.popup=X,kotobee.confirm=Y,kotobee.openLink=Z,kotobee.addToNotebook=Q,kotobee.sendScorm=ee,kotobee.sendTinCan=te,kotobee.setData=ne,kotobee.getData=oe,kotobee.getDataArray=ie,kotobee.setDataArray=ae,kotobee.getDataPerms=se,kotobee.getUsers=re,kotobee.deleteData=ce,kotobee.clearRemoteData=le,kotobee.sendEmail=ue,kotobee.triggerEvent=pe,kotobee.clearData=de,Object.defineProperty(kotobee,"user",{get:function(){var e=clone(i.data.user);return delete e.pwd,delete e.rememberMe,delete e.signatures,e},set:function(e){return null}}),Object.defineProperty(kotobee,"book",{get:function(){return i.data.book},set:function(e){return null}}),Object.defineProperty(kotobee,"epub",{get:function(){return i.data.epub},set:function(e){return null}}),Object.defineProperty(kotobee,"currentPage",{get:function(){return i.data.currentPageOb},set:function(e){return null}}),Object.defineProperty(kotobee,"currentChapter",{get:function(){return i.data.currentPageOb},set:function(e){return null}}),Object.defineProperty(kotobee.view,"swipe",{get:function(){return!t.options.swipeDisabled},set:function(e){t.options.swipeDisabled=!e}}),Object.defineProperty(kotobee.view,"doubletap",{get:function(){return!t.options.doubletapDisabled},set:function(e){t.options.doubletapDisabled=!e}}),Object.defineProperty(kotobee.view,"leftMenuOpen",{get:function(){return e.isOpenLeft()}}),Object.defineProperty(kotobee.view,"rightMenuOpen",{get:function(){return e.isOpenRight()}}),Object.defineProperty(kotobee.view,"scroll",{get:function(){var e=u.$getByHandle("content");if(e)return e.getScrollView().options.scrollingY},set:function(e){var t=u.$getByHandle("content");t&&(t.getScrollView().options.scrollingY=e)}}),Object.defineProperty(kotobee,"documentation",{get:function(){var e=[];e.push({method:"openNotebook()",desc:"Opens the reader's notebook panel."}),e.push({method:"exportPDF()",desc:"Exports the current chapter as a PDF file."}),e.push({method:"print()",desc:"Prints the current chapter."}),e.push({method:"openSettings()",desc:"Opens the reader's settings panel."}),e.push({method:"openSearch()",desc:"Opens the reader's search panel."}),e.push({method:"search(keyword)",desc:"Search for a certain keyword, and display the results in the search panel."}),e.push({method:"openMedia()",desc:"Opens the reader's media panel."}),e.push({method:"openChapters()",desc:"Opens the reader's chapters panel (table of contents)."}),e.push({method:"toggleFullscreen()",desc:"Toggle reader into fullscreen mode."}),e.push({method:"getLanguage()",desc:"Get the reader language. Possible return values: en,fr,es,pt,nl,de,hu,it,sw,ms,no,pl,ro,ru,tr,ar,zh,jp,ko."}),e.push({method:"setLanguage(lang)",desc:"Set the reader language. This method takes the language's 2 character abbreviation as input. Possible values: en,fr,es,pt,nl,de,hu,it,sw,ms,no,pl,ro,ru,tr,ar,zh,jp,ko."}),e.push({method:"setDirection(dir)",desc:'Set the reader layout direction. Provided argument is "ltr" or "rtl".'}),e.push({method:"closePopups()",desc:"Close all displayed popups."}),e.push({method:"closeSidepanels()",desc:"Close any open sidepanels."}),e.push({method:"openMiniapp(id)",desc:"Open a specific miniapp, passing its id."}),e.push({method:"getEnvironment()",desc:"Get all details about the browser and OS"});var t=[];t.push({method:"nextChapter()",desc:"Jump to the next chapter, relative to the current chapter."}),t.push({method:"prevChapter()",desc:"Jump to the previous chapter, relative to the current chapter."}),t.push({method:"gotoChapterIndex(index)",desc:"Jump to a certain chapter, passing its index as input."}),t.push({method:"gotoChapterHref(url)",desc:"Jump to a certain chapter, passing its relative URL as input."}),t.push({method:"getChapter(url, callback, errorCallback)",desc:"Retrieve the chapter object, passing its relative URL as input. This method also takes 2 more arguments: a success callback with the chapter object, and an error callback."}),t.push({method:"clearCache()",desc:"Clear any cached chapter content."}),t.push({method:"neverCache(chapterOb)",desc:"Set the reader never to cache a specific chapter. This will cause chapters to be continuously loaded and never stored in memory. The chapter object is passed an input."}),t.push({method:"getScrollPosition()",desc:"Get the current chapter's scroll position."}),t.push({method:"scrollToTop(animate)",desc:"Scroll to the top of the chapter. This method also takes a second argument, to indicate whether scroll animation should be used."}),t.push({method:"scrollTo(y, animate)",desc:"Scroll to a certain y location. The y location is provided as an input. This method also takes a second argument, to indicate whether scroll animation should be used."});var n=[];n.push({method:"view.doubletap",desc:"Property to enable or disable double tapping (or double clicking) to zoom in."}),n.push({method:"view.swipe",desc:"Property to enable or disable swiping."}),n.push({method:"view.scroll",desc:"Property to enable or disable vertical scrolling."});var o=[];o.push({method:"popup(html, options)",desc:"Display certain HTML content inside the reader's popup. Takes an optional object with the following properties:",args:[{Property:"title",Description:"The text appearing in the title bar of the popup."},{Property:"okBtn",Description:"The label of the default OK button at the footer of the popup."},{Property:"cb",Description:"A callback function, called when the user clicks on OK."},{Property:"raw",Description:"Display only the passed HTML (raw) as a popup, without a frame and OK button. The above properties won't be effective if raw is set to true."},{Property:"noBackdrop",Description:"Don't display a backdrop when the popup is opened."}]}),o.push({method:"confirm(html,callback)",desc:"Display certain content inside a confirmation box. The second argument represents the callback function in case the user confirms.",args:[{Property:"okBtn",Description:"The label of the 'Yes' button at the footer of the popup. Defaults to 'Yes'"},{Property:"noBtn",Description:"The label of the 'No' button at the footer of the popup. Defaults to 'No'"},{Property:"cb",Description:"A callback function, called when the user clicks on the 'Yes' button."},{Property:"noBackdrop",Description:"Don't display a backdrop when the popup is opened."}]}),o.push({method:"openLink(url)",desc:"Open a certain URL inside a sliding panel."}),o.push({method:"addToNotebook(note, element)",desc:"Add certain content to the notebook. The note is provided as the first argument, and the element to attach the note to is provided as the second argument."});var r=[];r.push({method:"sendScorm(element,value)",desc:"Set a SCORM run-time element with a value. This requires that the ebook is running as a SCORM package inside an LMS."}),r.push({method:"sendTinCan(activityOb)",desc:"Send a Tin Can activity to the LRS configured in the ebook/library settings. Available for cloud ebooks and libraries only."});var i=[];i.push({method:"setData(dataOb, callback)",desc:"Write data into the database for the currently logged in user. You will be able to fully label that data, for easy retrieval later. This methods takes an object with the following options:",args:[{Property:"label",Description:"The label (key) representing this slot of data (required)."},{Property:"data",Description:"The data to write (required)."},{Property:"overwrite",Description:"In case this data exists, overwrite it"},{Property:"category",Description:"For better organization, set a category for this data. This will make queries more efficient."},{Property:"subcategory",Description:"For further organization, set a subcategory for this data. This will make queries more efficient."},{Property:"options",Description:"Set options for this data. This is treated as normal text, and can be used when querying for data."}]}),i.push({method:"setDataArray(array, callback)",desc:"Set a collection of data items into the database in a single request, for the currently logged in user. It takes an array of objects, each taking the same parameters as 'setData' method above."}),i.push({method:"getData(queryOb, callback)",desc:"Retrieve data for the currently logged in user. It takes an object with the following options, and triggers a callback (the second argument) passing back the array of data.",args:[{Property:"label",Description:"The label (key) representing this slot of data."},{Property:"category",Description:"The category assigned to this data, to use as a search parameter."},{Property:"subcategory",Description:"The subcategory assigned to this data, to use as a search parameter."},{Property:"options",Description:"The options for this data, to use as a search parameter."},{Property:"allUsers",Description:"Expand the scope of search to all users with access to this cloud ebook or library. To use this option, the user must have global data permissions."},{Property:"role",Description:"Search by user role."}]}),i.push({method:"getDataArray(array, callback)",desc:"Send a collection of search queries for the currently logged in user, all in a single request. It takes an array of objects specified in the getData method, in addition to an 'id' object to label the results returned in an array."}),i.push({method:"getDataPerms(callback)",desc:"Get the list of permissions or allowed writing limits for this cloud ebook or library."}),i.push({method:"getUsers",desc:"For logged in users with global data permissions, get an array of all users added to this cloud ebook/library.",args:[{Property:"role",Description:"Limit the results to a specific user role."}]}),i.push({method:"deleteData(queryOb, callback)",desc:"Delete a certain data slot for the currently logged in user. It takes an object with the following options:",args:[{Property:"label",Description:"The label (key) representing this slot of data (required)."},{Property:"category",Description:"The category assigned to this data, to use as a search parameter."},{Property:"subcategory",Description:"The subcategory assigned to this data, to use as a search parameter."},{Property:"options",Description:"Set options for this data. This is treated as normal text, and can be used when querying for data."},{Property:"all",Description:"If this is true, all matching results will be deleted. It not, only the first result is deleted."}]}),i.push({method:"sendEmail(emailOb, callback)",desc:"Send a custom email. Note you must first contact Kotobee Support and have email sending credentials in order to activate email sending through the API. This method takes an object with the following options:",args:[{Property:"to",Description:"The email address of the recipient."},{Property:"message",Description:"The message body to send."},{Property:"html",Description:"An optional boolean specifying whether the message body is HTML formatted. Default: false."},{Property:"subject",Description:"The email subject."},{Property:"fromName",Description:"The sender name."},{Property:"fromEmail",Description:"The sender email."},{Property:"cc",Description:"An optional array of other email addresses to send a copy to."}]}),i.push({method:"triggerEvent(event, params, callback)",desc:"Trigger a custom event to notify subscribers using email, software, or push notifications. The optional params variable holds any kind of data that is needed to be sent as it is to the subscribers"});var a=[];a.push({prop:"epub",desc:"The parsed epub object, showing the metadata, manifest, spine, and book thumbnail."}),a.push({prop:"book",desc:"The book object obtained from the epub, by the reader."}),a.push({prop:"currentChapter",desc:"The current chapter object, containing all its parsed properties."}),a.push({prop:"currentPage",desc:"In the case that a reflowable layout is paginated (displayed without a scrollbar, as single page or double page view), the currently displayed page(s) is(are) returned by this property."}),a.push({prop:"user",desc:"The currently logged in user. Return an object containing his id, name, email, and user role (if exists)."});var s=[];s.push({event:"addEventListener(event, [options], callback)",desc:"Listen to a certain event (string) and call a function once the event is fired. This function takes an optional second argument (options) with the following properties:",args:[{Property:"unique",Description:"If an event listener already exists for this event, it will be removed, before adding the new one."}]}),s.push({event:null,desc:"An event object will be passed to the callback function containing the DOM element and any additional data associated with the event."}),s.push({event:"dispatchEvent(event, [options])",desc:"Fire a certain event. The function takes the event name (as a string) and an optional second argument (options) with the following properties:",args:[{Property:"firstMatch",Description:"Fire the event only for the first event listener registered."}]}),s.push({event:"clearListeners(event)",desc:"Clear all listeners that are listening to a certain event (as a string). If no event is passed, then all listeners attached to the kotobee object are cleared."});var c=[];c.push({event:"initialized",desc:"Triggered when the app is initialized."}),c.push({event:"ready",desc:"Triggered from the document object, whenever the ebook or library initialization is complete. It is fired just once."}),c.push({event:"bookOpened",desc:"Triggered when a book is opened. An object is passed back containing the book object."}),c.push({event:"chapterLoaded",desc:"Triggered whenever a new chapter is loaded and ready for use."}),c.push({event:"chapterViewed",desc:"Similar to chapterLoaded, but is triggered when the chapter is viewed on the screen."}),c.push({event:"textSelected",desc:"Text is selected in the page."}),c.push({event:"textDeselected",desc:"Text is deselected in the page."}),c.push({event:"scrolled",desc:"Triggered whenever a chapter is scrolled. An object is passed back containing the scroll position."}),c.push({event:"transformationChanged",desc:"Triggered when a chapter's scale has changed, through a zoom action."}),c.push({event:"languageChanged",desc:"Triggered when the reader UI language had changed."}),c.push({event:"directionChanged",desc:"Triggered when the reader UI language direction had changed (from left-to-right or right-to-left)."}),c.push({event:"linkClicked",desc:"Triggered when the user clicks on an external link inside any chapter."}),c.push({event:"audioPlayed",desc:"Triggered when the user clicks an audio play button."}),c.push({event:"audioLinkClicked",desc:"Triggered when a text hyperlinked to audio is clicked."}),c.push({event:"videoPlayed",desc:"Triggered when the user clicks a video play button."}),c.push({event:"popup",desc:"Triggered when a link popup is clicked and displayed on the screen."}),c.push({event:"questionPopup",desc:"Triggered when a questions component, set to display in a popup, is opened."}),c.push({event:"questionsSubmitted",desc:"Triggered when a question set is answered and submitted."}),c.push({event:"answerClicked",desc:"Triggered when a question answer box (radiobox, checkbox, textfield, etc) is changed. In the case of drag and drop questions, this even is triggered when an item is dragged into a category box."}),c.push({event:"3dModelViewed",desc:"Triggered when a 3D model is activated."});var l="color: #000; font-weight: bold; font-size:18px",d="color: #224e97; font-size:12px; font-weight:bold",u="color: #224e97; font-size:12px; font-weight:bold",p="margin-left:6px;",f="font-weight:bold;";setTimeout(console.clear.bind(console)),v("%cKotobee Reader API","color: #000; font-weight: bold; font-size:22px;border:solid 1px #000;border-radius:8px;padding:5px 10px;"),v("%cThis documentation lists brief explanations of the different Kotobee Reader API methods, properties, and events, used to interact with the reader and build scalable ebook applications. A backend Developer API is also available for remotely controlling different aspects of your cloud ebooks and libraries, here: http://support.kotobee.com/en/support/solutions/folders/8000082574."),g(),v("%cUI Methods",l),v("%cThese methods are used to interact with the reader's different UI elements and components.",f);for(var h=0;h<e.length;h++)v("%c"+e[h].method,d),v("%c"+e[h].desc,p);g(),v("%cContent Methods",l),v("%cThese methods are used to display/set content in different ways.",f);for(h=0;h<o.length;h++)v("%c"+o[h].method,d),v("%c"+o[h].desc,p),o[h].args&&m(o[h].args);g(),v("%cNavigation Methods",l),v("%cThese methods are used mainly to navigate to different chapters efficiently.",f);for(h=0;h<t.length;h++)v("%c"+t[h].method,d),v("%c"+t[h].desc,p);g(),v("%cView Options",l),v("%cThese properties are used to control viewing options.",f);for(h=0;h<n.length;h++)v("%c"+n[h].method,d),v("%c"+n[h].desc,p);g(),v("%cSCORM / Tin Can Methods",l),v("%cThese methods are used to send progress to an LMS or LRS.",f);for(h=0;h<r.length;h++)v("%c"+r[h].method,d),v("%c"+r[h].desc,p);g(),v("%cCloud Methods",l),v("%cThese methods are used to store and retrieve user data into the database, for that cloud ebook or library. These methods are available for logged in users only.",f);for(h=0;h<i.length;h++)v("%c"+i[h].method,d),v("%c"+i[h].desc,p),i[h].args&&m(i[h].args);g(),v("%cProperties",l),v("%cThese properties are used to describe the book and user.",f);for(h=0;h<a.length;h++)v("%c"+a[h].prop,"color: #224e97; font-size:12px; font-weight:bold"),v("%c"+a[h].desc,p);g(),v("%cEvents Methods",l),v("%cThese methods are used to listen to and manage events fired by kotobee.",f);for(h=0;h<s.length;h++)s[h].event&&v("%c"+s[h].event,u),v("%c"+s[h].desc,p),s[h].args&&m(s[h].args);v("%cEvent types","font-weight:bold;font-size:14px;margin-top:6px;margin-bottom:6px;");for(h=0;h<c.length;h++)v("%c"+c[h].event,u),v("%c"+c[h].desc,p);function g(){v("")}function m(e){setTimeout(console.table.bind(console,e))}function v(e,t){setTimeout(console.log.bind(console,e,t||""))}return null},set:function(e){return null}}),document.dispatchEvent(new Event("kotobeeApiReady"))},b}]),app.factory("chapters",["khttp","tinCan","backend","context","events","library","error","crdv","traverser","htmlParser","skeleton","$stateParams","sync","$ionicSideMenuDelegate","scorm","cache","modals","status","$injector","$timeout","virt","$ionicPopup","translit","selection","$ionicScrollDelegate","$filter","$rootScope","cssInjector","cssParser","jsParser","$location","$sce","$q","stg",function(o,h,g,m,r,e,s,i,c,t,l,d,n,a,u,v,b,y,k,p,w,f,x,C,I,E,S,T,O,A,N,L,B,M){var R,P,D,F,H,$,U,_,j,z,V,q,W={},K=[],G=[],J=[];function X(e){for(var t=0;t<J.length;t++)if(J[t]==e)return!0}function Y(t,n){var o={leftOb:{}};W.getPageOb({page:t.index,source:"getNextIndex"},function(e){if(!e)return n();e.pages?t.vIndex<e.pages.length-1?(o.leftOb.index=t.index,o.leftOb.vIndex=t.vIndex+1):(o.leftOb.index=t.index+1,o.leftOb.vIndex=0):o.leftOb.index=t.index+1,n(o)})}function Z(t,n){var o={leftOb:{}};if(W.shouldBePaged(t)){if(!t.vIndex||0==t.vIndex)return void W.getPageOb({page:t.index-1,source:"stepBack"},function(e){o.leftOb.index=t.index-1,e.pages&&e.pages.length&&(o.leftOb.vIndex=e.pages.length-1),n(o)});o.leftOb.index=t.index,o.leftOb.vIndex=t.vIndex-1}else o.leftOb.index=t.index-1;n(o)}function Q(e){if(!(e<0||e>=M.data.epub.spine.getElementsByTagName("itemref").length-1)){var t=M.data.epub.spine.getElementsByTagName("itemref")[e];if(t){var n=t.getAttribute("properties");if(n)for(var o=n.split(" "),r=0;r<o.length;r++)if(0<o[r].indexOf("-spread-"))return o[r].split("-spread-")[1]}}}function ee(e,t,n){var o=W.cacheLookup(e);o?n(o):W.preloadChapter(e,t,n)}function te(){"undefined"!=typeof kotobeeReady&&kotobeeReady(),void 0!==kotobee&&kotobee.ready&&kotobee.ready()}function ne(e){for(var t=0;t<K.length;t++)K[t](e);if("renderedChapter"==e){try{document.dispatchEvent(new Event("kotobeeChapterLoaded"))}catch(e){}if(kotobee){var n=Object.assign({},M.data.currentPageOb);n.container=document.getElementById("spreadL"),kotobee.dispatchEvent("chapterLoaded",n),M.data.currentRPageOb&&((n=Object.assign({},M.data.currentRPageOb)).container=document.getElementById("spreadR"),kotobee.dispatchEvent("chapterLoaded",n))}u.setBookmark(currentIndex);var o={};o.id="chapter-"+currentIndex,o.description="View chapter: "+M.data.book.chapter.title,o.learnerResponses="Viewed",o.type="other",o.timestamp=new Date,u.setInteractions([o]),r.add({action:"chapterViewed",param:M.data.book.chapter.title,data:currentIndex}),oe()}}function oe(){var e=(new Date).getTime(),t=(e-z)/1e3;0!=t&&M.data.book&&(r.add({action:"activeTime",param:t,data:{title:M.data.book.chapter.title,index:currentIndex}}),z=e)}function re(){l.isFirstChapter({first:F},function(t){l.isLastChapter({last:R},function(e){M.data.book.chapter.notLastChapter=!e,M.data.book.chapter.notFirstChapter=!t,S.$$phase||S.$apply()})})}function ie(){timeOut(function(){y.update(null)},1e3)}function ae(e,t,n){o.get(cacheBust(e)).success(function(e){config.kotobee.encodekey&&!kInteractive.isSDK()&&(e=1.1<=config.v?CryptoJS.AES.decrypt(e,config.kotobee.encodekey).toString(CryptoJS.enc.Utf8):kInteractive.XORCipher().decode(config.kotobee.encodekey,e)),e=(e=e.replace(/<br\s*?\/>/g,"<br>")).replace(/(<)([^ >]+)([^>]*?)(\/>)/g,"$1$2$3></$2>"),t&&t(e)}).error(function(){n&&n()})}W.busy=!0,W.maxIndex=null,W.initialize=function(a){if(document.getElementById("chaptersInner")){V||(V=!0,function(){var e,t;window.onpageshow=window.onfocus=function(){z=(new Date).getTime()},window.onpagehide=window.onblur=function(){oe()},void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange");document.addEventListener(t,function(){document[e]?oe():z=(new Date).getTime()},!1)}()),config.firstDoublePage||(config.firstDoublePage=0),null==M.data.settings.pageScroll&&(M.data.settings.pageScroll=!0),m.initialize(),k.get("annotations").reset(),z=(new Date).getTime(),currentIndex=null,M.data.currentPageOb=null,W.maxIndex=M.data.epub.spine.getElementsByTagName("itemref").length,R=W.maxIndex;for(var e=M.data.epub.spine.getElementsByTagName("itemref"),t=e.length;t--;)if(!e[t].hasAttribute("linear")||"no"!=e[t].getAttribute("linear")){R=t+1;break}for(t=F=0;t<e.length;t++)if(!e[t].hasAttribute("linear")||"no"!=e[t].getAttribute("linear")){F=t;break}W.displayTOC(),g.addBookStat({type:"view"}),H||(x.addListener(function(){var e=document.getElementById("chaptersInner");e&&replaceHTML(e,M.data.book.chapters?M.data.book.chapters:'<h5 class="panelEmpty"><i class="icon kb-notice vAlignMiddle size20"></i><span class="hSpace5"></span>'+x.get("noTOC")+"</h5>")}),H=!0);var n=document.getElementById("chaptersInner").getElementsByClassName("restricted");for(t=0;t<n.length;t++)n[t].addEventListener("click",function(e){var t={ch:e.currentTarget.textContent,chIndex:e.currentTarget.getAttribute("data-index"),currentCh:M.data.book.chapter.title};r.add({action:"restrictedTocClicked",param:JSON.stringify(t)})});E("bookSetup")(),W.showLoader(),W.resetPages(),W.preloadEdgeChapters(function(){var r=0,i=0;if(null!=W.startChapter){var e=k.get("book").root+"/reader/chapter/"+W.startChapter;return W.startHash&&(e+="/"+W.startHash),N.path(e),W.hideLoader(),void(S.$$phase||S.$apply())}M.readSlot("lastLoc"+M.getBookId(),function(o){M.readSlot("lastLocY"+M.getBookId(),function(e){config.preserveLoc&&"app"!=config.kotobee.mode&&(r=o?Number(o):0,i=e?Number(e):0),M.data.user&&null!=M.data.user.lastchap&&(r=Number(M.data.user.lastchap));var t=u.getBookmark();t&&(r=Number(t)),null!=a&&(r=a);var n={};i&&(n.scroll=i),W.loadChapterByIndex(r,n).then(function(){W.hideLoader()})})})})}else setTimeout(W.initialize,50)},W.displayTOC=function(){var e=document.getElementById("chaptersInner");e&&(replaceHTML(e,M.data.book.chapters?M.data.book.chapters:'<h5 class="panelEmpty"><i class="icon kb-notice vAlignMiddle size20"></i><span class="hSpace5"></span>'+x.get("noTOC")+"</h5>"),M.data.book.meta&&v.setOb("title",replaceHTML(v.getOb("title"),M.data.book.meta.dc.title)))},W.preloadEdgeChapters=function(t){W.getPageOb({page:F,source:"preloadEdgeChapters"},function(e){W.getPageOb({page:R-1,source:"preloadEdgeChapters"},function(e){D=P=null,e.pages&&(P=e.pages.length)<=1?W.getPageOb({page:R-2,source:"preloadEdgeChapters2"},function(e){e.pages&&(D=e.pages.length),t()}):t()})})},W.displayChapters=function(){if(!S.widescreen||config.notebookTab){var e=a.$getByHandle("menus");e._instances[0].left.width=e._instances[0].right.width=330,e._instances[0].left.el.style.width=e._instances[0].right.el.style.width="330px",S.widescreen&&(M.data.settings.rtl?(e._instances[0].right.width=480,e._instances[0].right.el.style.width="480px"):(e._instances[0].left.width=480,e._instances[0].left.el.style.width="480px"),k.get("annotations").updateNotebookArray({},function(){S.$$phase||S.$apply()})),mobile&&k.get("nav").resize(),M.data.settings.rtl?a.toggleRight():a.toggleLeft(),native&&i.vibrate()}},W.clearCache=function(){G=[]},W.neverCache=function(e){e&&(X(e.url)||J.push(e.url))},W.hideLoader=function(){var e=document.getElementById("ebookLoaderAnim");e&&addClass(e,"hide")},W.showLoader=function(){var e=document.getElementById("ebookLoaderAnim");e&&removeClass(e,"hide")},W.addListener=function(e){K.push(e)},W.removeListener=function(e){for(var t=K.length;t--;)K[t]==e&&K.splice(t,1)},W.redirectToHashPage=function(r,e){var i=e.leftOb;if(i.pages&&i.pages.length){var a=parseHtml(i.raw?i.raw:i.content);E("contentVirt")("parse",a.getElementById("epubContent"),function(){var e=a.getElementById(r);if(!e){var t=a.getElementsByName(r);t.length&&(e=t[0])}if(e){var n=c.convertElemsToLocation([e],a.getElementById("epubContent")).left,o=c.getPageByLocation(i,n);W.loadChapterByIndex(i.index,{hash:r,vIndex:o})}})}},W.redirect=function(e,t){t=t||{};var n=k.get("book").root+"/reader/chapter/"+e;t.hash&&(n+="/"+t.hash);var o=W.getCurrentHash();if(t.hash?N.search("vi"):N.search({vi:t.vIndex}),N.path(n),currentIndex==e){if(!o)return W.loadChapterByIndex(e,t);if(o==t.hash)return W.loadChapterByIndex(e,t)}try{document.dispatchEvent(new Event("kotobeeBeforeChapterLoaded"))}catch(e){}kotobee.dispatchEvent("beforeChapterLoaded"),kotobee.dispatchEvent("kotobeeBeforeChapterLoaded"),S.$$phase||S.$apply()},W.getCurrentHash=function(){var e=N.path(),t=(e=e.replace(/\?.*/g,"")).split("/"+currentIndex+"/");if(!(t.length<2))return t[1]},W.loadLocation=function(a,e){var s=B.defer();e=e||{};var n=!a.match(/[^0-9.]/g);return W.showLoader(),W.getPageOb({page:e.index},function(r){if(!r.pages||!r.pages.length){if(n){var e=c.getElemsByLocation(a);if(!e[0])return s.resolve();w.safeScrollToElem("content",e[0],!0)}else w.safeAnchorScroll("content",a,!0);return W.hideLoader(),s.resolve()}if(n){var t=c.getPageByLocation(r,a);return W.loadChapterByIndex(r.index,{vIndex:t}),s.resolve()}var i=parseHtml(r.raw?r.raw:r.content);E("contentVirt")("parse",i.getElementById("epubContent"),function(){var e,t;if(!(e=i.getElementById(a))){var n=i.getElementsByName(a);n.length&&(e=n[0])}e&&(t=c.convertElemsToLocation([e],i.getElementById("epubContent")).left);var o=0;return t&&(o=c.getPageByLocation(r,t)),W.loadChapterByIndex(r.index,{vIndex:o}),s.resolve()})}),s.promise},W.indexFromUrl=function(e,t){var n;t=t||{};var o=ph.getHash(e);t.hash&&(o=t.hash),e=ph.removeHash(ph.normalize(e));for(var r=M.data.epub.manifest.getElementsByTagName("item"),i=0;i<r.length;i++)if(ph.removeHash(ph.normalize(r[i].getAttribute("href")))==e){n=r[i].getAttribute("id");break}r=M.data.epub.spine.getElementsByTagName("itemref");var a,s=t.order?t.order:1;for(i=0;i<r.length;i++)if(r[i].getAttribute("idref")==n&&r[a=i].getAttribute("id")==o){if(--s)continue;return i}return a},W.arePagesAppearingTogether=function(t,n,o){var r=W.getCurrentView(n.index),i=t.vIndex;i<0&&t.pages&&t.pages.length&&(i+=t.pages.length),isNaN(i)&&(i=null);var a=n.vIndex;if(a<0&&n.pages&&n.pages.length&&(a+=n.pages.length),isNaN(a)&&(a=null),n.index==t.index&&n.vIndex==t.vIndex)return o(!0);!function(e,n,o){l.getNextLinearIndex({index:e,vIndex:n},function(t){l.getPrevLinearIndex({index:e,vIndex:n},function(e){t.leftOb.index,e.leftOb.index;o({first:e.leftOb,last:t.leftOb})})})}(t.index,t.vIndex,function(e){if(function(e,t){if(e.index>t.first.index&&e.index<t.last.index)return!0;if(t.first.index==t.last.index&&e.index==t.first.index){if(e.vIndex>t.first.vIndex&&e.vIndex<t.last.vIndex)return!0}else{if(e.index==t.first.index&&e.vIndex>t.first.vIndex)return!0;if(e.index==t.last.index&&e.vIndex<t.last.vIndex)return!0}}(n,e))return o(!0);if("double"!=r.view)return o();if("rfl"==t.layout){if(t.index==n.index&&i==a+1)return o(!0);if(n.pages&&1==n.pages.length&&t.index==n.index+1&&0==i)return o(!0)}return"fxl"==t.layout&&t.index==n.index+1?o(!0):o()})},W.getNextIndexOld=function(t,n){var o={},e=W.getCurrentView(t.index);if(o.leftOb={index:t.index+1,vIndex:0},t.vIndex||(t.vIndex=0),"double"==e.view)if(o.double=!0,"rfl"==t.layout)if(2<=t.pages.length-1-t.vIndex)o.leftOb.index=t.index,o.leftOb.vIndex=t.vIndex+2;else{if(t.pages.length-1-t.vIndex!=1)return void W.getPageOb({page:t.index+1,source:"getNextIndex"},function(e){1==e.pages.length?(o.leftOb.vIndex=0,o.leftOb.index=t.index+2):(o.leftOb.vIndex=1,o.leftOb.index=t.index+1),n(o)});o.leftOb.index=t.index+1,o.leftOb.vIndex=0}else o.leftOb.index++;else"rfl"!=t.layout||M.data.settings.pageScroll||(1<=t.pages.length-1-t.vIndex?(o.leftOb.index=t.index,o.leftOb.vIndex=t.vIndex+1):(o.leftOb.index=t.index+1,o.leftOb.vIndex=0));return n(o),o},W.getElemChapterIndex=function(e,t){var n;return t=t||{},"single"==M.data.currentView?n=currentIndex:traverseToTop(e,"spreadL")?n=currentIndex:traverseToTop(e,"spreadR")&&(n=M.data.currentRPageOb.index),t.ignoreAnchors&&(n=W.getUnanchoredIndex(n)),n},W.getElemChapterTitle=function(e){return"single"==M.data.currentView?M.data.currentPageOb.title:traverseToTop(e,"spreadL")?M.data.currentPageOb.title:traverseToTop(e,"spreadR")?M.data.currentRPageOb.title:M.data.currentPageOb.title},W.getElemChapterFilename=function(e){return"single"==M.data.currentView?M.getChapterFilename():traverseToTop(e,"spreadL")?M.getChapterFilename():traverseToTop(e,"spreadR")?ph.relative(ph.join(bookPath,M.data.packageURL),M.data.currentRPageOb.url):M.getChapterFilename()},W.getUnanchoredIndex=function(e){var t=W.getChapterURL(e);if(t)return t=ph.removeHash(t),W.indexFromUrl(t)},W.getNextIndex=function(e,t){var n=W.getCurrentView(e.index,{vIndex:e.vIndex});Y(e,function(e){if(!e)return t();"double"==n.view?e.leftOb.index>=R-1?t(e):Y(e.leftOb,t):t(e)})},W.getPrevIndexOld=function(t,n){var o={};o.leftOb={index:t.index-1,vIndex:0},t.vIndex||(t.vIndex=0);if("double"==W.getCurrentView(t.index-1,{}).view)if(o.double=!0,config.firstDoublePage||(config.firstDoublePage=0),"rfl"==t.layout)if(1<t.vIndex)o.leftOb.index=t.index,o.leftOb.vIndex=t.vIndex-2,o.leftOb.index<config.firstDoublePage&&o.leftOb.vIndex++;else{if(1!=t.vIndex)return void W.getPageOb({page:t.index-1,source:"getPrevIndex"},function(e){1==e.pages.length?(o.leftOb.index=t.index-2,o.leftOb.vIndex=-1,o.leftOb.index<config.firstDoublePage&&(o.leftOb.index=t.index-1,o.leftOb.vIndex=0)):(o.leftOb.index=t.index-1,o.leftOb.vIndex=t.vIndex-2,o.leftOb.index<config.firstDoublePage&&(o.leftOb.vIndex=t.vIndex-1)),n(o)});o.leftOb.index=t.index-1,o.leftOb.vIndex=-1,o.leftOb.index<config.firstDoublePage&&(o.leftOb.index=t.index,o.leftOb.vIndex=0)}else o.leftOb.index=t.index-2,o.leftOb.index<config.firstDoublePage&&(o.leftOb.index=t.index-1);else"rfl"!=t.layout||M.data.settings.pageScroll||(0<t.vIndex?(o.leftOb.index=t.index,o.leftOb.vIndex=t.vIndex-1):(o.leftOb.index=t.index-1,o.leftOb.vIndex=-1));return n(o),o},W.getPrevIndex=function(e,t){Z(e,function(e){"double"==W.getCurrentView(e.leftOb.index,{vIndex:e.leftOb.vIndex}).view?e.leftOb.index<=F?t(e):Z(e.leftOb,t):t(e)})},W.nextChapter=function(e,n){l.isLastChapter(null,function(e){e?i.toast(x.get("inLastChapter")):(m.interruptAnimation(),l.getNextIndex({index:currentIndex,vIndex:currentVIndex},function(e){if(e){e.leftOb.index=m.nextLinearIndex(e.leftOb.index),e.leftOb.index>=M.data.epub.spine.getElementsByTagName("itemref").length-1&&i.toast(x.get("inLastChapter"));var t=M.data.epub.spine.getElementsByTagName("itemref")[e.leftOb.index].getAttribute("id");S.renderScope.applyHeader("default"),null!=e.leftOb.vIndex&&(t=null),W.redirect(e.leftOb.index,{hash:t,vIndex:e.leftOb.vIndex}),S.$$phase||S.$apply(),n&&n(e)}}))})},W.prevChapter=function(e,o){l.isFirstChapter(null,function(e){e?i.toast(x.get("inFirstChapter")):(m.interruptAnimation(),l.getPrevIndex({index:currentIndex,vIndex:currentVIndex},function(e){e.vIndex;e.leftOb.index<0&&(e.leftOb.index=0),e.leftOb.index=m.prevLinearIndex(e.leftOb.index),e.leftOb.index<0&&i.toast(x.get("inFirstChapter"));var t=M.data.epub.spine.getElementsByTagName("itemref")[e.leftOb.index];S.renderScope.applyHeader("default");var n=t.getAttribute("id");null!=e.leftOb.vIndex&&(n=null),W.redirect(e.leftOb.index,{hash:n,vIndex:e.leftOb.vIndex}),S.$$phase||S.$apply(),o&&o(e)}))})},W.getCurrentView=function(e,t){var n=(t=t||{}).returnType;if(null!=e){var o=l.getCurrentView(e,t);if(o)return i(o);if(e<config.firstDoublePage)return i({view:null,index:e});var r=M.data.settings.viewMode;return"single"==r?i({view:null,index:e,scroll:M.data.settings.pageScroll}):"double"!=r?"auto"==r?"left"==Q(e)&&"right"==Q(e+1)?i({view:"double",index:e}):"right"==Q(e)&&"left"==Q(e-1)?i({view:"double",index:e-1}):i({view:null,index:e,scroll:M.data.settings.pageScroll}):i({view:null,index:e,scroll:M.data.settings.pageScroll}):config.singleViewOnPortrait&&1.3*window.innerWidth<window.innerHeight?i({view:null,index:e}):i(l.isSingle(e,t.vIndex)?{view:null,index:e}:{view:"double",index:e})}function i(e){return e.view||(e.view="single"),"view"==n?(t.cb&&t.cb(e.view),e.view):"page"==n?(t.cb&&t.cb(e.page),e.page):(t.cb&&t.cb(e),e)}},W.loadChapterByIndex=function(r,i){var a=(i=i||{}).deferred;return a=a||B.defer(),null==r&&(r=currentIndex),r<0?(a.resolve(),a.promise):(r>W.maxIndex&&(r=W.maxIndex-1),function(e){var t=k.get("book");return k.get("chapters"),!!t.allowedChapters&&!!hasClass(M.data.toc.getElementsByTagName("a")[e],"restricted")}(r)?W.nextChapter():(W.showLoader(),W.getPageOb({page:r,source:"loadChapterByIndex"},function(o){if(!o)return W.loadChapterByIndex(0,i);W.getSurroundingPages({index:o.index,vIndex:i.vIndex},function(){W.hideLoader();var e={index:r,vIndex:i.vIndex};if(l.normalize(e),!i.hash&&(e.index!=r||null!=e.vIndex&&e.vIndex!=i.vIndex))return W.loadChapterByIndex(e.index,{hash:i.hash,vIndex:e.vIndex,reload:i.reload,deferred:a}),a.promise;var n=W.getChapterURL(r),t=!1;if(0==n.indexOf("#")&&(t=!0),i.hash&&o.pages&&o.pages.length&&(t=!0),t)return W.loadLocation(i.hash,{index:r,source:"from loadChapterByIndex"}).then(function(e){});i.leftOb=o,i.leftOb.index=r,i.leftOb.currentVIndex=i.leftOb.vIndex,i.leftOb.vIndex=i.vIndex,asyncCheck(!(o.pages&&i.leftOb.vIndex>=o.pages.length-1),W.getPageOb,[{page:r+1,source:"loadChapterByIndex"}],function(){W.planPageMapping(i,function(e){if((e=e||{}).redirect)return W.redirect(e.redirect.index,{hash:i.hash,vIndex:i.vIndex,reload:i.reload,deferred:a}),a.promise;if(i.deferred=null,M.data.currentPageOb||(M.data.currentPageOb=i.leftOb),W.urlMatchesIndex(n,currentIndex)&&!i.reload&&currentVIndex==i.vIndex){currentIndex=r,re();var t=i.hash;return(t=t||ph.getHash(i.leftOb.url))?W.loadLocation(t,{index:currentIndex,source:"from loadChapterByIndex2"}).then(function(){ne("renderedChapter"),W.highlightCurrentTocChapter()}):(I.$getByHandle("content").scrollTop(!0),ne("renderedChapter"),W.highlightCurrentTocChapter()),M.data.book.chapter.url=n,M.data.book.chapter.absoluteURL=ph.join(bookPath,M.data.packageURL,M.data.book.chapter.url),a.resolve(),a.promise}m.startTransition(i,a)})})})}),a.promise))},W.getSurroundingPages=function(e,t){if("single"==M.data.settings.viewMode)return t();if(!e)return t();var n=l.getJoint(e.index,e.vIndex);if(n&&1<n.length)return W.getPageOb({page:e.index-1},t);asyncCheck(n,W.getPageOb,[{page:e.index}],function(){W.getPageOb({page:e.index+1},function(){W.getPageOb({page:e.index-1},t)})})},W.planPageMapping=function(t,e){var n=W.getCurrentView(t.leftOb.index,{vIndex:t.leftOb.vIndex});if(n.index==t.leftOb.index)if(W.shouldBePaged(t.leftOb)||"double"==n.view)if(t.view="double",t.rightOb||(t.rightOb={}),"fxl"==t.leftOb.layout){W.getChapterURL(t.leftOb.index+1)?(t.rightOb.index=t.leftOb.index+1,t.rightOb.url=ph.join(bookPath,M.data.packageURL,W.getChapterURL(t.leftOb.index+1))):t.rightOb=null,i()}else{if(t.rightOb.url=t.leftOb.url,t.leftOb.viewport=k.get("spread").getViewport(t.leftOb),t.vIndex=Number(t.vIndex),isNaN(t.vIndex)&&(t.vIndex=0),t.leftOb.vIndex=t.vIndex,t.vIndex<0||t.vIndex>=t.leftOb.pages.length){var o=0;return t.vIndex<0&&(o=t.vIndex),t.vIndex=t.leftOb.pages.length+o,t.leftOb.vIndex=t.leftOb.pages.length+o,t.rightOb.vIndex=t.leftOb.vIndex+1,t.rightOb.index=t.leftOb.index,void e({redirect:{index:n.index}})}if(t.leftOb.content=t.leftOb.pages[t.vIndex].content,"single"==n.view)return t.rightOb=null,void i();if(t.vIndex+1<t.leftOb.pages.length)t.rightOb=clone(t.leftOb),t.rightOb.vIndex=t.vIndex+1,t.rightOb.index=t.leftOb.index,t.rightOb.content=t.leftOb.pages[t.rightOb.vIndex].content,i();else{if(t.leftOb.index>=W.maxIndex-1)return t.rightOb=null,void i();t.rightOb.index=t.leftOb.index+1;var r=W.getChapterURL(t.rightOb.index);W.getPageOb({page:t.rightOb.index},function(e){t.rightOb=e,t.rightOb.vIndex=0,t.rightOb.url=ph.join(bookPath,M.data.packageURL,r),t.rightOb.pages&&t.rightOb.pages.length&&(t.rightOb.content=t.rightOb.pages[0].content),t.rightOb.viewport=k.get("spread").getViewport(t.rightOb),i()})}}else t.view="single","fxl"!=t.leftOb.layout&&(t.leftOb.viewport=null),t.leftOb.raw&&(t.leftOb.content=t.leftOb.raw),i();else e({redirect:{index:n.index}});function i(){e&&e({url:t.leftOb.url})}},W.getCacheOrPreload=ee,W.currentUrlMatchesVIndex=function(e){return getQueryStringValue("vi")==e},W.urlMatchesIndex=function(e,t){if(null!=t){e=ph.normalize(e);ph.getHash(e);var n,o=ph.removeHash(e),r=M.data.epub.spine.getElementsByTagName("itemref")[t];if(r){for(var i=M.data.epub.manifest.getElementsByTagName("item"),a=0;a<i.length;a++)i[a].getAttribute("id")==r.getAttribute("idref")&&(n=i[a].getAttribute("href"));return!!n&&ph.removeHash(ph.normalize(n))==ph.removeHash(ph.normalize(o))}}},W.applyChapterStateFromURL=function(e,t){if(t=t||{},0!=e.indexOf("#")){var n=ph.getHash(e),o=t.index?t.index:W.indexFromUrl(e);null!=o&&(S.renderScope.applyHeader("default"),W.redirect(o,{hash:n,vIndex:t.vIndex}),S.$$phase||S.$apply())}else W.redirect(currentIndex,{hash:e.substr(1)})},W.loadChapterByURL=function(t,n){var e=ph.relative(ph.join(bookPath,M.data.packageURL),t.leftOb.url);t=t||{};var o=B.defer(),r=t.hash?t.hash:ph.getHash(e),i=t.leftOb.index;if(0==e.indexOf("#")&&(r=e.substr(1)),null!=i){if(!t.reload&&W.urlMatchesIndex(e,currentIndex)&&currentVIndex==t.vIndex)return currentIndex=i,re(),r?(n&&n(),W.loadLocation(r,{index:currentIndex,source:"from loadChapterByUrl"})):(d.hash&&I.$getByHandle("content").scrollTop(!0),o.resolve(),n&&n(),o.promise);if(desktop)require("nw.gui").App.clearCache();kInteractive.clearAudioVideo(document),currentVIndex=t.vIndex;var a=W.getCurrentView(i,{vIndex:currentVIndex});M.data.currentView=a.view,q=null==currentIndex;var s=currentIndex;return currentIndex=i=a.index,re(),M.data.currentPageOb=t.leftOb,M.data.currentRPageOb=t.rightOb,delete t.leftOb.currentVIndex,mobile&&I.$getByHandle("content").resize(),W.busy=!0,W.loadChapterByURLRaw(t).then(function(e){W.busy=!1,t.scroll&&I.$getByHandle("content").scrollTo(0,t.scroll,!1);config.kotobee.cloudid&&(config.kotobee.public||g.setLastChapter()),setTimeout(function(){w.reset(t.scroll?t.scroll:0,function(){r?W.loadLocation(r,{index:currentIndex,source:"loadChapterByURLRaw"}).then(function(){!q&&currentIndex==s||(A.replaceScript(e||[]),kInteractive.postRender(document)),ne("renderedChapter"),W.highlightCurrentTocChapter(),ie(),te(),n&&n()}):(A.replaceScript(e||[]),kInteractive.postRender(document),ne("renderedChapter"),W.highlightCurrentTocChapter(),ie(),te(),n&&n())},30)})})}n&&n()},W.cacheLookup=function(e,t){if(!X(e))for(var n=0;n<G.length;n++)if(G[n].url==ph.removeHash(e)){var o=G[n];return G.splice(n,1),G.push(o),o}},W.removeFromCache=function(e,t){for(var n=0;n<G.length;n++)if(G[n].url==ph.removeHash(e)&&G[n].view==t)return void G.splice(n,1)},W.addToCache=function(e,t){if(t=t||{},e.url=ph.removeHash(e.url),!X(e.url)){var n=W.cacheLookup(e.url,e.view);n?t.update&&(n.url=e.url,n.title=e.title,n.viewport=e.viewport,n.content=e.content,n.layout=e.layout,n.styles=e.styles,e.script&&(n.script=e.script)):(20<G.length&&G.shift(),t.lowPriority?G=[e].concat():G.push(e))}},W.loadChapterByURLRaw=function(u){u=u||{};var e=ph.relative(ph.join(bookPath,M.data.packageURL),u.leftOb.url),p=B.defer();M.data.book.chapter.url=e,M.data.book.chapter.absoluteURL=ph.join(bookPath,M.data.packageURL,M.data.book.chapter.url);ph.getHash(M.data.book.chapter.url);w.disable(),w.lock(),y.update(null);var f=[];return function(t){var n;if(n=W.cacheLookup(M.data.book.chapter.absoluteURL,"single"))return copyObjToObj(n,t.leftOb,{onlyIfNotExists:!0}),t.leftOb.cached=!0,r();var o={showError:!0,deferred:p,view:t.view,id:t.id,view:null};function r(){if("single"!=t.view&&t.rightOb){var e=t.rightOb.url;(n=W.cacheLookup(e,"single"))?(copyObjToObj(n,t.rightOb,{onlyIfNotExists:!0}),t.rightOb.cached=!0,i(t)):W.preloadChapter(e,o,function(e){copyObjToObj(e,t.rightOb,{onlyIfNotExists:!0}),i(t)})}else i(t)}W.preloadChapter(M.data.book.chapter.absoluteURL,o,function(e){copyObjToObj(e,t.leftOb,{onlyIfNotExists:!0}),r()})}(u),p.promise;function i(e){var t=(e=e||{}).leftOb.title,n=(e.leftOb.content,e.leftOb.bodyClass),o=e.leftOb.viewport,r=(e.leftOb.styles,e.leftOb.script,e.leftOb.layout),i=e.isCached,a=e.leftOb,s=e.rightOb;a&&(f=f.concat(a.script)),s&&(f=f.concat(s.script)),makeArrayUnique(f),t=t||a.title,M.data.book.chapter.title=t,h.send({verb:"navigated",activity:(currentIndex?"Chapter "+currentIndex+": ":"")+t}),mobile||!q&&Boolean(o)==Boolean(M.data.book.chapter.viewport)||k.get("nav").resetEpubContainer(o);var c=document.getElementById("epubInner");e.source="from chapters",pauseVideoAndAudio(c=m.populateSpreads(c,e)),v.setOb("epubContent",document.getElementById("epubContent")),v.getOb("epubContainer").focus(),i||m.setContentSize(v.getOb("epubContent"),u),n&&addClass(v.getOb("epubContent").getElementsByTagName("section")[0],n),M.data.book.chapter.viewport=o,M.data.book.chapter.layout=r,M.data.book.chapter.view=e.view,M.data.book.chapter.paged=W.shouldBePaged(a),re();var l=document.getElementById("chapters");removeClass(l,["rfl","fxl","double","single"]),addClass(l,M.data.book.chapter.viewport?"fxl":"rfl"),addClass(l,e.view),M.data.book.chapter.paged?addClass(l,"paged"):removeClass(l,"paged");i||(O.replaceStyles(""),O.replaceStyles(a.styles.replace(/#spreadR/g,"#spreadL"),{append:!0}),s&&s.viewport&&O.replaceStyles(s.styles.replace(/#spreadL/g,"#spreadR"),{append:!0})),O.replaceStyles("#epubContainer div#epubContent, #epubContainer.stylesEnabled div#epubContent { background-color:#e7e3d9 !important;}",{append:!0}),config.preserveLoc&&"app"!=config.kotobee.mode&&M.writeSlot("lastLoc"+M.getBookId(),currentIndex),M.writeSlot("lastLocY"+M.getBookId(),0);for(var d=0;d<K.length;d++)K[d]("newChapter");E("contentJs")(i).then(function(){C.reset(),w.unlock(),p.resolve(f)})}},W.preloadChapterFromApi=function(e,t){return W.preloadChapter(ph.join(bookPath,M.data.packageURL,e),{},t)},W.loadAndDecrypt=function(e,t,n){return ae(ph.join(bookPath,M.data.packageURL,e),t,n)};var se,ce,le,de=[];function ue(e,t){var n=(e=e||{}).first,o=e.page,r=e.vIndex;(null==o&&(o=currentIndex),null==r&&(r=currentVIndex),"single"==W.getCurrentView(o,{vIndex:r}).view)?W.shouldBePaged(e.page?e:M.data.currentPageOb)?t(o<=n&&0==currentVIndex):t(o<=n):M.data.currentPageOb.pages?t(o<=n&&0==currentVIndex):t(o<=n)}function pe(e,t){var n=(e=e||{}).max,o=e.page,r=e.vIndex,i=e.view;return null==o&&(o=currentIndex,r=currentVIndex,i=W.getCurrentView(o,{returnType:"view"})),"single"==i?(null==e.index&&(e.index=e.page),W.shouldBePaged(null!=e.page?e:M.data.currentPageOb,i)?a(n-1<=o&&P-1<=r):a(n-1<=o)):a(n-1<=o?!P||P-2<=r:n-2<=o&&(!(P&&D-1<=r)||P<=1));function a(e){return t&&t(e),e}}function fe(){var e=ph.removeHash(window.location.href),t=document.getElementsByTagName("base");if(t.length)for(var n=0;n<t.length;n++)if(t[n].getAttribute("href")){e=window.location.origin+"/"+t[n].getAttribute("href");break}return 0<=e.indexOf("chrome-extension://")?M.data.book.chapter.absoluteURL:isAbsoluteURLPath(M.data.book.chapter.absoluteURL)?M.data.book.chapter.absoluteURL:"/"==M.data.book.chapter.absoluteURL[0]?getDomainFromURL(e)+M.data.book.chapter.absoluteURL:ph.join(e,M.data.book.chapter.absoluteURL)}function he(){return"library"==config.kotobee.mode?M.data.paths.private+"books/"+M.data.book.chapter.absoluteURL.split("/books/")[1]:M.data.paths.private+M.data.book.chapter.absoluteURL.substr(1)}return W.preloadChapter=function(h,g,m){var e={func:arguments.callee,args:arguments};if(g=g||{},existsInArray(h,de))return setTimeout(function(){W.preloadChapter(h,g,m)},50);de.push(h),ae(h,function(e){var a=parseHtml(e),s="",t=a.getElementsByTagName("body");t.length&&(s=t[0].className);for(var c=E("contentHtml")(a,h),n=a.getElementsByTagName("meta"),l=null,o=0;o<n.length;o++){var r=n[o].getAttribute("name");if(r&&"viewport"==r.toLowerCase()){l={};var i=n[o].getAttribute("content");if(!i)break;for(var d=i.split(","),u=0;u<d.length;u++){var p=d[u].split("=");p[1]&&(p[1]=p[1].replace("px",""),l[p[0].trim()]=Number(p[1].trim()))}}}var f=l?"fxl":"rfl";E("js")(a).then(function(i){E("styles")(a,{path:h,id:g.id}).then(function(e){var t,n=a.getElementsByTagName("title");if(n.length)t=n[0].textContent.trim();else{var o=a.getElementsByTagName("h1");o.length&&(t=o[0].textContent.trim())}t=t||M.data.book.meta.dc.title;var r={url:h,title:t,bodyClass:s,viewport:l,layout:f,content:c.outerHTML,styles:e,script:i};g.dontCache||W.addToCache(r,g),removeFromArray(h,de),m&&m(r)})})},function(){removeFromArray(h,de),g.showError&&(s.update({error:"networkError",ref:e}),g.deferred&&g.deferred.reject({}),ie())})},W.clearContent=function(){document.getElementById("epubInner")&&replaceHTML("epubInner",""),oe()},W.getChapterURL=function(e){var t;null==e&&(e=currentIndex),e<0&&(e=0);try{var n=M.data.epub.spine.getElementsByTagName("itemref");if(e>=n.length)return;t=n[e]}catch(e){}var o=getElementsByAttribute(M.data.epub.manifest,"item","id",t.getAttribute("idref"))[0].getAttribute("href"),r=t.getAttribute("id");return r&&(o+="#"+r),o},W.isFirstChapter=function(e){ue({first:0},e)},W.isFirstVisibleChapter=function(e){ue({first:F},e)},W.isLastChapter=function(e){return pe({max:W.maxIndex},e)},W.isLastVisibleChapter=function(e){return pe({max:R},e)},W.isLastVisibleSingleChapter=function(e,t,n){return pe({max:R,page:e,vIndex:t,view:"single"},n)},W.getPageOb=function(e,n){var o=(e=e||{}).page;null==o&&(o=currentIndex);var t=W.getChapterURL(o);if(!t)return n?n():null;ee(ph.join(bookPath,M.data.packageURL,t),{},function(t){if(t.index=o,"fxl"==t.layout&&(t.spread=Q(t.index)),t.nonlinear=function(e){if(M.data.epub.spine){var t=M.data.epub.spine.getElementsByTagName("itemref")[e];return t?"no"==t.getAttribute("linear"):void 0}}(t.index),t.pages||"fxl"==t.layout||!W.shouldBePaged(t)||e.dontParse)return l.add(t),n?n(t):null;k.get("spread").parseReflowableChapter(t,function(e){return t.pages=e.pages,t.raw=e.raw,l.add(t),n?n(t):null})})},W.shouldBePaged=function(e,t){return(!e||"fxl"!=e.layout)&&("double"==M.data.settings.viewMode||("single"==M.data.settings.viewMode?!M.data.settings.pageScroll:(!t&&e&&(t=W.getCurrentView(e.index).view),"single"!=t||!M.data.settings.pageScroll)))},W.convertPDF=function(){var t={func:arguments.callee,args:arguments};if(preview)s.update({error:"savePdfUnsupportedInPreview"});else if(!desktop&&!native)if(config.pdfsavingOptions||config.pdfbooksaving){var e={scale:100,range:"chapter",submit:function(){b.hide(),n(e)}};b.show({mode:"pdfSave",pdfSaveOptions:e})}else n();function n(u){(u=u||{}).scale||(u.scale=100),u.range||(u.range="chapter");var p=fe();isKotobeeHosted()&&config.kotobee.cloudid&&!config.kotobee.public&&(p=he()),-1!=window.location.href.indexOf("http://localhost:8080/#/book/")&&(p=he());var e=M.data.book.chapter.title,f={url:p,filename:e};y.update(x.get("pleaseWait"),null,{dots:!0,timeoutDuration:12e4}),g.createRequest(config.kotobee.liburl+"library/pdf/status",{},function(e){if("converting"==e.status)return y.update(),y.showAndHide(x.get("pdfInProgress"),2500);g.createRequest(config.kotobee.liburl+"link/pdfgenerate/url",f,function(e){if(!e)return y.update(),void s.update({error:"networkError",ref:t});var d=e;asyncCheck(!u.includeNotes,M.getHlights,[],function(l){asyncCheck(!u.includeNotes,M.getNotes,[],function(e){$&&$.parentNode&&$.parentNode.removeChild($),($=document.createElement("iframe")).setAttribute("style","display:none"),$.setAttribute("name","pdfFrame"),document.body.appendChild($),U&&U.parentNode&&U.parentNode.removeChild(U),(U=document.createElement("form")).setAttribute("style","visibility:hidden:position:absolute"),U.setAttribute("method","post"),U.setAttribute("action",d),U.setAttribute("target","pdfFrame"),addFormHiddenInput("url",p,U),addFormHiddenInput("filename",M.data.book.chapter.title,U),addFormHiddenInput("fileext","pdf",U),addFormHiddenInput("scale",u.scale,U),addFormHiddenInput("range",u.range,U);var t=g.getAuthVars();for(var n in t)t[n]&&addFormHiddenInput(n,t[n],U);if("book"==u.range&&addFormHiddenInput("bid",M.data.book.id,U),e){for(var o=0;o<e.length;o++)if(e[o]&&e[o].location){var r=String(e[o].location).split(",");e[o].locationDec=Number("0."+addDigitsToArray(r[0].split("."),3).join(""))}e=e.sort(function(e,t){return e.locationDec>t.locationDec?1:-1});var i=[];for(o=0;o<e.length;o++)"book"!=u.range&&e[o].chapter!=currentIndex||i.push({chapter:e[o].chapter,note:e[o].note,src:e[o].src});addFormHiddenInput("notes",JSON.stringify(makeObjectArrayUnique(i)),U)}if(l){for(o=0;o<l.length;o++)if(l[o]&&l[o].location){r=String(l[o].location).split(",");l[o].locationDec=Number("0."+addDigitsToArray(r[0].split("."),3).join(""))}l=l.sort(function(e,t){return e.locationDec>t.locationDec?1:-1});var a=[];for(o=0;o<l.length;o++)"book"!=u.range&&l[o].chapter!=currentIndex||a.push({chapter:l[o].chapter,color:l[o].color,src:l[o].src,location:l[o].location});addFormHiddenInput("hlights",JSON.stringify(makeObjectArrayUnique(a)),U)}addFormHiddenInput("format",config.pdfMode?config.pdfMode:"imgpdf",U);var s=config.kotobee.encodekey&&!kInteractive.isSDK();function c(){$&&$.parentNode&&$.parentNode.removeChild($),U&&U.parentNode&&U.parentNode.removeChild(U),y.update()}l&&l.length&&(s=!0),asyncCheck(!s,ae,[M.data.book.chapter.absoluteURL],function(e){s&&addFormHiddenInput("data",f.data=e,U),document.body.appendChild(U),setTimeout(function(){g.validatePdfConversion(f,function(e){if(e.error)return b.show({mode:"generalError",errorOptions:{msg:x.get("errorConvertingPDF")}}),void c();U.submit(),setTimeout(function(){var t=setInterval(function(){var e=d.replace(/(https?:\/\/.*?\/).*/g,"$1");g.createRequest(e+"library/pdf/status",{},function(e){"converting"!=e.status&&(clearInterval(t),c())})},2e3)},4e3)})})})})})})})}},W.pdfPrintOld=function(){preview?s.update({error:"savePdfUnsupportedInPreview"}):desktop||native||(y.update(x.get("pleaseWait"),null,{dots:!0}),window.location.href="https://www.kotobee.com/link/pdfgenerate?url="+fe(),setTimeout(function(){y.update()},4e3))},W.printAsBitmap=function(){var r={func:arguments.callee,args:arguments};if(!native&&!mobile){var i=fe();isKotobeeHosted()&&config.kotobee.cloudid&&!config.kotobee.public&&(i=he());var a=M.data.book.chapter.title,e={url:i,filename:a};y.update(x.get("pleaseWait"),null,{dots:!0}),g.createRequest(config.kotobee.liburl+"link/pdfgenerate/url",e,function(e){if(!e)return y.update(),void s.update({error:"networkError",ref:r});var t=e;function n(){try{var e=this.contentWindow;setTimeout(function(){e.__container__=this,e.focus(),e.print(),y.update()},2500)}catch(e){y.update()}}_&&_.parentNode&&_.parentNode.removeChild(_),(_=document.createElement("iframe")).setAttribute("style","display:none"),_.setAttribute("name","printFrame"),_.id="printContainer",_.style.visibility="hidden",_.style.position="fixed",_.style.right="0",_.style.bottom="0",document.body.appendChild(_),j&&j.parentNode&&j.parentNode.removeChild(j),(j=document.createElement("form")).setAttribute("style","visibility:hidden:position:absolute"),j.setAttribute("method","post"),j.setAttribute("action",t),j.setAttribute("target","printFrame"),addFormHiddenInput("url",i,j),addFormHiddenInput("filename",M.data.book.chapter.title,j),addFormHiddenInput("fileext","pdf",j),addFormHiddenInput("print",!0,j),addFormHiddenInput("format","imghtml",j);var o=config.kotobee.encodekey&&!kInteractive.isSDK();asyncCheck(!o,ae,[M.data.book.chapter.absoluteURL],function(e){o&&addFormHiddenInput("data",e,j),document.body.appendChild(j);var t={url:i,filename:a};g.validatePdfConversion(t,function(e){if(e.error)return W.print({force:!0});j.submit(),setTimeout(function(){y.update()},8e3)}),_.onload=n})})}},W.print=function(e){e=e||{},native||mobile||(e.force||"fxl"!=M.data.book.chapter.layout?(y.update(x.get("pleaseWait"),null,{dots:!0}),closePrintIframe(),ae(fe(),function(e){var t,n=ph.removeFilename(fe());return e=(e=(e=e.replace("<head>","<head><meta http-equiv=\"Content-Security-Policy\" content=\"default-src * gap://ready file: filesystem: data:; style-src * 'self' 'unsafe-inline' filesystem: data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' kotobee: https://*.amazonaws.com https://*.google.com https://*.googleapis.com https://*.youtube.com https://*.stripe.com https://*.paypal.com https://*.kotobee.com http://*.youtube.com https://*.ytimg.com http://*.ytimg.com;img-src * filesystem: data: blob: android-webview-video-poster:\">")).replace("<head>","<head><script> window.onload = function() { window.print(); setTimeout(parent.closePrintIframe,1000); }<\/script>")).replace("<head>","<head><base href='"+n+"/'/>"),(t=document.createElement("iframe")).id="printContainer",t.style.visibility="hidden",t.style.position="fixed",t.style.right="0",t.style.bottom="0",t.setAttribute("srcdoc",e),document.body.appendChild(t),void y.update()})):W.printAsBitmap())},W.regenerateSpreads=function(e,n){var o;e=e||{},W.shouldBePaged(M.data.currentPageOb)&&(W.regeneratingSpreads?ce=!0:(ce=!1,v.getOb("epubContainer").style.opacity=0,W.showLoader(),M.data.currentPageOb.pages&&M.data.currentPageOb.pages.length&&(o=currentVIndex/M.data.currentPageOb.pages.length),se&&clearTimeout(se),se=setTimeout(function(){W.regeneratingSpreads=!0,le&&clearTimeout(le),le=setTimeout(function(){W.regeneratingSpreads=!1,W.regenerateSpreads(e,n)},2e4),W.resetPages(),W.preloadEdgeChapters(function(){W.getPageOb({page:currentIndex},function(e){var t={};t.viewMode=M.data.settings.viewMode,t.vIndex=currentVIndex,o&&e.pages&&(t.vIndex=Math.floor(e.pages.length*o),t.vIndex!=currentVIndex&&N.search({vi:t.vIndex})),t.reload=!0,W.loadChapterByIndex(currentIndex,t).then(function(){W.regeneratingSpreads=!1,clearTimeout(le),ce?setTimeout(function(){ce=!1,W.regenerateSpreads(t,n)},100):(n&&n(),v.getOb("epubContainer").style.opacity=1,W.hideLoader())})})})},e.resize?600:30)))},W.resetPages=function(e){e=e||{};for(var t=0;t<G.length;t++)G[t].pages=null;return l.reset(),e.buildChapterMode?l.initialize({first:F,last:R}):M.data.book.meta.rendition&&"pre-paginated"==M.data.book.meta.rendition.layout?l.initialize({first:F,last:R}):"single"==M.data.settings.viewMode&&M.data.settings.pageScroll?l.initialize({first:F,last:R}):void 0},W.getIndexFromTocElem=function(e){for(var t=e.getAttribute("href"),n=document.getElementById("chaptersInner").getElementsByTagName("a"),o=0,r=0;r<n.length&&(n[r].getAttribute("href")!=t||"restricted"==n[r].className||(o++,e!=n[r]));r++);return W.indexFromUrl(e.getAttribute("href"),{order:o})},W.highlightCurrentTocChapter=function(){if(mobile&&k.get("nav").resize(),M.data.currentPageOb){var e=M.data.currentPageOb.index;if(M.data.book){for(var t=M.data.book.chapter.url,n=document.getElementById("chaptersInner").getElementsByTagName("a"),o=[],r=0;r<n.length;r++)-1!=n[r].getAttribute("href").indexOf(t)&&W.getIndexFromTocElem(n[r])==e&&o.push({elem:n[r],id:ph.getHash(n[r].getAttribute("href"))});W.deApplySelectedChapter(),o.length&&W.applySelectedChapter(function e(t){try{if("none"!=t.style.display)return t;if(t.previousElementSibling)return e(t.previousElementSibling);if("none"!=t.parentNode.style.display)return e(t.parentNode);var n=t.parentNode.previousElementSibling.getElementsByTagName("li");return e(n[n.length-1])}catch(e){return t}}(o[0].elem.parentNode))}}},W.applySelectedChapter=function(e,t){if(e&&(null==t&&(t=!0),addClass(e,"selected"),addClass(e,"currentChapter"),t)){for(var n=e,o=v.getOb("chaptersContent");(e=e.parentNode)&&e!=o;)"li"==e.nodeName.toLowerCase()&&(addClass(e,"expanded"),addClass(e,"containsSelection"));overflowScroll?o.scrollTo?o.scrollTo(0,Math.round(getTopOffsetRelativeTo(n,o)),!0):o.scrollTop=Math.round(getTopOffsetRelativeTo(n,o)):I.$getByHandle("chapters").scrollTo(0,Math.round(n.offsetTop-o.parentNode.offsetHeight/2),!1)}},W.deApplySelectedChapter=function(){for(var e=v.getOb("chaptersContent"),t=e.getElementsByClassName("containsSelection"),n=t.length;n--;)removeClass(t[n],"containsSelection");var o=e.getElementsByClassName("selected");for(n=o.length;n--;)removeClass(o[n],"selected");for(n=(o=e.getElementsByClassName("currentChapter")).length;n--;)o[n].removeAttribute("name")},W.elemInChapterElem=function(e,t){return!(M.data.currentPageOb.index!=t||!hasParentWithId(e,"spreadL",99))||(!(!M.data.currentRPageOb||M.data.currentRPageOb.index!=t||!hasParentWithId(e,"spreadR",99))||void 0)},W}]),app.factory("context",["$interpolate","skeleton","cssParser","cache","$rootScope","stg","$injector","khttp",function(e,i,s,O,t,A,k,c){var w,N,L,x,B={};function o(n,o){var r;null!=A.data.currentPageOb.currentVIndex&&(isNaN(A.data.currentPageOb.currentVIndex)||(r=A.data.currentPageOb.vIndex,A.data.currentPageOb.vIndex=currentVIndex)),i.getNextLinearIndex({index:A.data.currentPageOb.index,vIndex:A.data.currentPageOb.vIndex},function(t){null!=r&&(A.data.currentPageOb.vIndex=r);var e=t?[n,t.leftOb]:null;asyncCheck(!t,w.arePagesAppearingTogether,e,function(e){if(e&&t)return o("next");null!=currentVIndex&&(A.data.currentPageOb.vIndex=currentVIndex),i.getPrevLinearIndex({index:A.data.currentPageOb.index,vIndex:A.data.currentPageOb.vIndex},function(e){null!=r&&(A.data.currentPageOb.vIndex=r),w.arePagesAppearingTogether(n,e.leftOb,function(e){return o(e?"prev":null)})})})})}function r(e){if(!(e=e||{}).reload){var t=O.getOb("epubContainer");null!=t.style.opacity&&(t.style.opacity=null,w.hideLoader()),native&&(t.scrollTop=0);var n=document.getElementsByClassName("activeSlidePage");if(n.length){var o=n[0];"navSlide"==A.data.settings.navAnim?o.style.transform=null:"navStack"==A.data.settings.navAnim?o.style.transform=null:"navFade"==A.data.settings.navAnim?o.style.opacity=null:"navFlip"==A.data.settings.navAnim?autoprefixTransform(o,null):"navBookBlock"==A.data.settings.navAnim&&(deleteTransform(o),deleteTransform(t),t.style.opacity=null);for(var r=0;r<t.children.length;r++)if("shadow"==t.children[r].className){t.removeChild(t.children[r]);break}removeClass(o,"anim"),removeClass(o,"activeSlidePage");var i='<h3 id="ebookLoaderAnim"><div class="splashSpinner large"><div class="dot1"></div><div class="dot2"></div></div></h3>';document.getElementById("nextPage").innerHTML=i,document.getElementById("prevPage").innerHTML=i}}}function a(o,r){if(L)r(s.applyRoot(o,L));else{var i=isKotobeeHosted(),e="lib/ionic/release/css/ionic.min.css";i&&(e="/bundles/vijualib/templates/reader/cloud/lib/ionic/release/css/ionic.min.css"),c.get(e).success(function(e){if(N=e,i)c.get("/bundles/vijualib/templates/reader/cloud/css/styles.min.css").success(function(e){L=e,a()}).error(function(){r(s.applyRoot(o,L))});else{var t="css/styles.min.css",n="http://localhost:8080"==window.location.origin;n&&(t="css/style.css"),c.get(t).success(function(e){L=e,n?c.get("css/base.css").success(function(e){L=e+" "+L,c.get("css/kotobeeInteractive.css").success(function(e){L+=e,a()}).error(function(){a()})}).error(function(){a()}):a()}).error(function(){r(s.applyRoot(o,L))})}}).error(function(){r(s.applyRoot(o,L))})}function a(){r(L)}}function l(t,n){t=t||{};t.container&&(w.shouldBePaged(t.leftOb)&&(t.leftOb&&(t.leftOb.viewport=k.get("spread").getViewport(t.leftOb)),t.rightOb&&(t.rightOb.viewport=k.get("spread").getViewport(t.rightOb))),t.simulate?d(t,n):w.getPageOb({page:t.leftOb.index},function(e){copyObjToObj(e,t.leftOb,{onlyIfNotExists:!0}),t.leftOb.pages&&t.leftOb.vIndex<0&&(t.leftOb.vIndex+=t.leftOb.pages.length),t.rightOb?w.getPageOb({page:t.rightOb.index},function(e){copyObjToObj(e,t.rightOb,{onlyIfNotExists:!0}),t.rightOb.pages&&t.rightOb.vIndex<0&&(t.rightOb.vIndex+=t.rightOb.pages.length),d(t,n)}):d(t,n)}))}function d(t,e){t.id=Math.round(999*Math.random());var n=t.container,r=t.leftOb,o=t.rightOb,i=r.url,a=ph.removeHash(window.location.href),s=document.createElement("html"),c=document.createElement("head");ios&&(c.innerHTML="<meta http-equiv=\"Content-Security-Policy\" content=\"default-src * filesystem: data:; style-src 'self' 'unsafe-inline' filesystem: data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.youtube.com http://*.youtube.com https://*.ytimg.com http://*.ytimg.com;img-src * filesystem: data: file:\">"),s.appendChild(c);var l=document.getElementsByTagName("base");if(l.length)for(var d=0;d<l.length;d++){var u=l[d].getAttribute("href");if(u){a=0==u.indexOf("/")||isAbsoluteURLPath(u)?u:ph.join(window.location.origin,u);break}}var p=document.createElement("base");function f(e){var t="";N&&(t+=N);var n=!mobile&&!r.viewport,o=" body{margin:0; padding-top:0px;} #epubContainer{padding-top:0px;position:absolute;top:0;left:0;right:0;bottom:0 !important}";return mobile||(o+="body, #epubContainer{padding-top:1px;}"),t+=o,t+="html,#epubContainer{overflow-y:"+(n?"auto":"hidden")+"}",t+="#epubScroller{position: static;height: 100%;width: 100%;box-sizing: border-box;transform-origin:left top;}",n&&(t+="#epubContainer{overflow:auto !important}"),mobile&&(t+=" #epubContent ::-webkit-scrollbar {display: none;} #epubContent {-ms-overflow-style: none;overflow: -moz-scrollbars-none;}"),t+="#epubScroller{padding:"+getElemPadding(O.getOb("epubContainer").getElementsByClassName("scroll")[0],{computed:!0}).left+"px}",r.viewport&&r.viewport.width&&(t+="#epubContent{width:"+r.viewport.width+"px;height:"+r.viewport.height+"px; overflow:hidden}",t+="html{overflow-x:"+(mobile?"hidden":"auto")+"}",t+=" #epubInner{height:0;} ",t+=" #spreadL,#spreadR{position:absolute !important; top:0 !important;font-size: 1em !important;overflow:hidden;}"),r.viewport||mobile||(t+="#epubScroller{overflow:auto}"),t+=" html{overflow-x:hidden} ",t+=" #epubContent{padding:0px; line-height: 1.6;} ",t+=" #epubContent{box-sizing:border-box; font-size:"+A.data.settings.textSize+" !important;}",t+=" #epubContent.hide{display:block !important}",t+=" #epubContent section{margin-top:0 !important}",A.data.settings.textSize&&(t+=" #epubContent{font-size: "+A.data.settings.textSize+"}"),t+=L,t=(t+=e=(e=e||"").replace(/#spreadL /g,"")).replace("background-color:#e7e3d9 !important;","")}function h(){var e=arguments[2];if(0==e.indexOf('"')&&(e=e.split('"')[1]),0==e.indexOf("'")&&(e=e.split("'")[1]),0==e.indexOf("&quot;")&&(e=e.split("&quot;")[1]),-1!=e.indexOf("http://"))return arguments[0];if(-1!=e.indexOf("https://"))return arguments[0];if(0==e.indexOf("data:"))return arguments[0];if(0==e.indexOf("kotobee:"))return arguments[0];var t=1<e.split(" ").length,n=1<(e='"'+ph.relative(ph.removeFilename(i),e)+'"').split(" ").length;return!t&&n&&(e='"'+e+'"'),cleanURL(arguments[1]+e+arguments[3])}0==i.indexOf("/")||isAbsoluteURLPath(i)?p.setAttribute("href",cleanURL(ph.removeFilename(i)+"/")):p.setAttribute("href",cleanURL(ph.join(a,ph.removeFilename(i))+"/")),t.simulate||c.appendChild(p);var g=document.createElement("div");g.className="stylesEnabled",g.id="epubContainer";var m=document.createElement("div");m.id="epubScroller",m.className="scroll",g.appendChild(m);var v=document.createElement("div");function b(e){e=(e=(e=(e=e||"").replace(/<div class="answer correct">/g,'<div class="answer">')).replace(/<div class="correct">/g,"<div>")).replace(/<p class="explanation">.*?<\/p>/g,""),t.simulate||(e=e.replace(/(style=".*?url\()(.+?)(\).*?")/g,h));isKotobeeHosted();isReaderApp||t.simulate||(e=(e=e.replace(/src="(?!http[s]?\:\/\/)([^"]*)?"/g,function(e,t){return'src="'+ph.relative(i,t)+'"'})).replace(/xlink:href="(?!http[s]?\:\/\/)([^"]*)?"/g,function(e,t){return'xlink:href="'+ph.relative(i,t)+'"'}));r.title;return native&&mobile&&(e=e.replace(/(<img[^>]*src=)"(.*?)"/g,function(e,t){return t+'"'+cleanURL(arguments[2])+'"'})),e}v.id="epubInner",m.appendChild(v);var y=document.createElement("style");y.setAttribute("type","text/css"),r.pages&&null!=r.vIndex?r.content=r.pages[r.vIndex].content:!r.content&&r.raw&&(r.content=r.raw),r.content=b(r.content),o&&(o.pages&&null!=o.vIndex?o.content=o.pages[o.vIndex].content:!o.content&&o.raw&&(o.content=o.raw),o.content=b(o.content)),t.cached=!1,v=B.populateSpreads(v,t),t.cached||(r.styles=r.styles.replace(/#spreadR/g,"#spreadL"),t.simulate||(r.styles=r.styles.replace(/(url\()(.*?)(\))/g,h)),o&&(o.styles=o.styles.replace(/#spreadL/g,"#spreadR"),t.simulate||(o.styles=o.styles.replace(/(url\()(.*?)(\))/g,h))));r.styles;var k=f(r.styles);!t.cached&&o&&(k+=" "+f(o.styles),o.styles),y.innerHTML=k,c.appendChild(y);var w=v.getElementsByTagName("audio");for(d=w.length;d--;){try{w[d].pause(),w[d].children.length||(w[d].src="")}catch(e){}var x=w[d].parentNode;x.previousSibling&&hasClass(x.previousSibling,"playBtn")&&removeClass(x.previousSibling,"hide"),x.removeChild(w[d])}var C=v.getElementsByTagName("video");for(d=C.length;d--;){try{C[d].pause(),C[d].children.length||(C[d].src="")}catch(e){}var I=C[d].parentNode;I.previousSibling&&hasClass(I.previousSibling,"playBtn")&&removeClass(I.previousSibling,"hide"),I.removeChild(C[d])}var E=document.createElement("body");A.data.settings.rtl&&addClass(E,"rtl"),addClass(E,r.layout),addClass(E,t.view),addClass(E,"transitionFrame"),E.appendChild(g),s.appendChild(E);var S=document.createElement("iframe");if(S.setAttribute("srcdoc",s.outerHTML),S.style.visibility="hidden",detectIE()||native&&ios){var T="javascript: window.frameElement.getAttribute('srcdoc');";S.setAttribute("src",T),S.contentWindow&&(S.contentWindow.location=T)}S.onload=function(){S.style.visibility="visible",M(S,t)},n&&(n.innerHTML="",n.appendChild(S),e&&e(S))}function M(e,t){var n=(t=t||{}).leftOb,o={},r=!!t.rightOb,i=e.contentDocument,a=i.getElementById("epubContent"),s=i.getElementById("epubContainer");if(B.setContentSize(a,t),n.viewport){o.epubContainer=s,o.epubContent=a,o.viewport=n.viewport,o.view=r?"double":"single",o.stylesFromEpubContent=!0;var c=k.get("nav").getFxlFit(o,"FROM CONTEXT"),l=c.scrollContainer;autoprefixTransform(l,"scale("+c.bestFit+")"),autoprefixTransformOrigin(l,"top left;"),l.style.height="100%",k.get("nav").fxlAdjustAlignment(o)}else{deleteTransform(a);var d=i.getElementById("spreadL");d.style.width=d.style.height=null;var u=i.getElementById("spreadR");u&&u.parentNode.removeChild(u)}}return B.initialize=function(){w=k.get("chapters")},B.startTransition=function(t,n){r(t),setTimeout(function(){var e={animID:x=Math.round(1e4*Math.random()),reload:t.reload,pageOb:t.leftOb};!function m(v,b){v=v||{};if(v.reload)return void(b&&b());var y=O.getOb("epubContainer");if(null==currentIndex)return y.style.opacity=0,w.showLoader(),void(b&&b());o(v.pageOb,function(e){if(!e)return y.style.opacity=0,v.pageOb.index!=currentIndex&&w.showLoader(),void(b&&b());var t=document.getElementById(e+"Page");t.style.opacity=null;var n=t.getElementsByTagName("iframe");if(n.length){var o=n[0].contentDocument.getElementById("epubContent"),r=n[0].srcdoc;if(o||!r){if(n[0].style.visibility="visible",o){var i=k.get("nav").viewFromElem(o);"fxl"==i.layout&&M(n[0],i)}}else if(requestAnimationFrame)return void requestAnimationFrame(function(){m(v,b)})}if("navSlide"==A.data.settings.navAnim)A.data.settings.rtl?t.style.transform="translate3d("+("next"==e?"-":"")+y.offsetWidth+"px,0,0)":t.style.transform="translate3d("+("next"==e?"":"-")+y.offsetWidth+"px,0,0)",setTimeout(function(){v.animID==x&&(A.data.settings.rtl?autoprefixTransform(y,"translate3d("+("next"==e?"":"-")+y.offsetWidth+"px,0,0)"):autoprefixTransform(y,"translate3d("+("next"==e?"-":"")+y.offsetWidth+"px,0,0)"),t.style.transform="translate3d(0,0,0)",addClass(y,"anim"),addClass(t,"anim"),addClass(t,"activeSlidePage"),setTimeout(function(){v.animID==x&&(autoprefixTransform(y,null),removeClass(y,"anim"),b&&b())},330))},30);else if("navStack"==A.data.settings.navAnim)setTimeout(function(){v.animID==x&&(A.data.settings.rtl?autoprefixTransform(y,"translate3d("+("next"==e?"":"-")+y.offsetWidth+"px,0,0)"):autoprefixTransform(y,"translate3d("+("next"==e?"-":"")+y.offsetWidth+"px,0,0)"),t.style.transform="translate3d(0,0,0)",addClass(y,"anim"),addClass(t,"anim"),addClass(t,"activeSlidePage"),setTimeout(function(){v.animID==x&&(autoprefixTransform(y,null),removeClass(y,"anim"),b&&b())},330))},30);else if("navFade"==A.data.settings.navAnim)t.style.left=0,t.style.opacity=1,addClass(t,"anim"),addClass(t,"activeSlidePage"),setTimeout(function(){v.animID==x&&b&&b()},330);else if("navFlip"==A.data.settings.navAnim)addClass(y,"anim"),A.data.settings.rtl?(autoprefixTransform(y,"next"==e?"rotateY(90deg)":"rotateY(-90deg)"),autoprefixTransform(t,"next"==e?"rotateY(-90deg)":"rotateY(90deg)")):(autoprefixTransform(y,"next"==e?"rotateY(-90deg)":"rotateY(90deg)"),autoprefixTransform(t,"next"==e?"rotateY(90deg)":"rotateY(-90deg)")),y.style.opacity=0,setTimeout(function(){v.animID==x&&(autoprefixTransform(t,null),addClass(t,"anim"),addClass(t,"activeSlidePage"),setTimeout(function(){v.animID==x&&(removeClass(y,"anim"),autoprefixTransform(y,null),b&&b())},630))},30);else if("navBookBlock"==A.data.settings.navAnim){var a=document.createElement("div");a.className="shadow",a.style.opacity=0,a.appendChild(document.createElement("div")),y.appendChild(a),addClass(y,"anim"),A.data.settings.rtl?autoprefixTransform(y,"next"==e?"rotateY(90deg)":"rotateY(-90deg)"):autoprefixTransform(y,"next"==e?"rotateY(-90deg)":"rotateY(90deg)");var s=y.style.transform||y.style.webkitTransform||y.style.mozTransform,c="right";if(A.data.book.chapter.viewport){var l=k.get("nav").getFxlFit();c=l.innerWidth+l.marginLeft+"px"}var d="left";A.data.book.chapter.viewport&&(d=y.style.paddingLeft||"left"),autoprefixTransformOrigin(y,"rotateY(90deg)"==s?c+" top":d+" top"),y.style.opacity=0,addClass(t,"anim"),addClass(t,"activeSlidePage");var u=document.createElement("div");u.className="shadow",u.style.opacity=.7,t.appendChild(u),a.style.opacity=0,a.style.height=y.scrollHeight+"px",u.style.width=y.style.width,u.style.height=y.style.height,A.data.book.chapter.viewport&&(u.style.right=a.style.right="auto",u.style.marginLeft=a.style.marginLeft=y.style.paddingLeft,a.style.width=y.style.width,v.pageOb.viewport||(t.style.opacity=0)),u.style.marginRight=y.style.marginRight,u.style.marginBottom=y.style.marginBottom;var p=getElemMargin(y);p.top||(p.top=0);var f=getComputedStyle(y).paddingTop.split("px");u.style.marginTop=Number(p.top)+Number(f[0])+"px";var h=getComputedStyle(y).backgroundColor,g="rgba(0,0,0,0)"==(h=h.replace(/ /g,""));g&&(y.style.backgroundColor="#fff"),setTimeout(function(){v.animID==x&&(u.style.opacity=null,setTimeout(function(){a.style.opacity=.4,setTimeout(function(){autoprefixTransformOrigin(y,null),u.parentNode&&u.parentNode.removeChild(u),a.parentNode&&a.parentNode.removeChild(a),v.animID==x&&(removeClass(y,"anim"),y.style.opacity=null,g&&(y.style.backgroundColor=null),autoprefixTransform(y,null),b&&b())},430)},200))},30)}})}(e,function(){w.loadChapterByURL(t,function(){setTimeout(function(){e.animID==x&&(r(t),function(o){function r(n,o,r){n&&w.getPageOb({page:n.leftOb.index},function(e){if(e){var t={};t.leftOb=clone(e),t.vIndex=n.leftOb.vIndex,t.vIndex<0&&e.pages&&e.pages.length&&(t.vIndex+=e.pages.length),w.planPageMapping(t,function(e){a(t.leftOb.url,function(e){t.styles=e,t.container=document.getElementById(o),t.view=w.getCurrentView(t.leftOb.index,t.leftOb).view,t.source="from preloadchapters",l(t,r)})})}})}w.isFirstChapter(function(n){w.isLastChapter(function(e){if(!e){var t={index:o.leftOb.index,vIndex:o.leftOb.vIndex};i.getNextLinearIndex(o.leftOb,function(e){w.getSurroundingPages(e?e.leftOb:null,function(){r(e,"nextPage")})})}if(!n){t={index:o.leftOb.index,vIndex:o.leftOb.vIndex};i.getPrevLinearIndex(t,function(e){w.getSurroundingPages(e?e.leftOb:null,function(){r(e,"prevPage")})})}})})}(t),n&&n.resolve())},500)})})})},B.interruptAnimation=function(){r()},B.simulateChapter=function(o,r){a(o.url,function(e){var t=document.createElement("div"),n={};n.styles=e,n.styles+="#spreadL{left:0 !important;width:auto !important;height:auto !important;position:static !important;}",n.styles+="#epubContent{width:auto !important;height: auto !important;}",n.container=t,n.leftOb=clone(o),w&&("double"==w.getCurrentView(n.leftOb.index).view&&(n.rightOb={},n.rightOb.content="<div><sections class='blankForSimulation'></sections></div>",n.rightOb.styles="",n.rightOb.layout="rfl"),n.simulate=!0,l(n,r))})},B.nextLinearIndex=function(e){for(var t=A.data.epub.spine.getElementsByTagName("itemref")[e];t&&t.hasAttribute("linear")&&"no"==t.getAttribute("linear");){if(++e>=t.length-1)return e;t=A.data.epub.spine.getElementsByTagName("itemref")[e]}return e},B.prevLinearIndex=function(e){for(var t=A.data.epub.spine.getElementsByTagName("itemref")[e];t&&t.hasAttribute("linear")&&"no"==t.getAttribute("linear");){if(--e<0)return 0;t=A.data.epub.spine.getElementsByTagName("itemref")[e]}return e},B.populateSpreads=function(e,t){var n=0;"rfl"==(t=t||{}).leftOb.layout&&"double"==t.view&&(n=config.spreadSpacing?config.spreadSpacing:0);var o=t.leftContent?t.leftContent:t.leftOb.content;if(!t.cached){(l=document.createElement("div")).innerHTML=t.leftContent?t.leftContent:t.leftOb.content;var r=l.children[0],i=r.children[0];copyAttributes(r,i),removeClass(i,"adjustedLineHeight"),i.id="spreadL",i.style.transform=i.style.transformOrigin=i.style.height=null,t.leftOb.viewport?(i.style.left="0px",i.style.width=t.leftOb.viewport.width+"px",i.style.height=t.leftOb.viewport.height+"px",A.data.settings.rtl&&(i.style.left="auto",i.style.right="0px")):(i.style.left=null,i.style.width=null,i.style.height=null),addClass(i,t.leftOb.layout),t.leftOb.bodyClass&&addClass(l.getElementsByTagName("section")[0],t.leftOb.bodyClass),o=l.innerHTML}var a=replaceHTML(e,o);if(t.rightOb){var s;if(1<a.children[0].children.length)for(var c=0;c<a.children[0].children.length;c++)if("spreadR"==a.children[0].children[c].id){s=a.children[0].children[c];break}if(!s){var l;(l=document.createElement("div")).innerHTML=t.rightContent?t.rightContent:t.rightOb.content;var d=l.children[0];copyAttributes(d,s=d.children[0]),removeClass(s,"adjustedLineHeight"),s.id="spreadR",s.style.transform=s.style.transformOrigin=s.style.height=null,a.children[0].appendChild(s)}t.rightOb.viewport&&(t.leftOb.viewport&&(s.style.left=t.leftOb.viewport.width+n+"px",A.data.settings.rtl&&(s.style.right=s.style.left,s.style.left="auto")),s.style.width=t.rightOb.viewport.width+"px",s.style.height=t.rightOb.viewport.height+"px",addClass(s,t.rightOb.layout))}return a},B.test=function(e){},B.setContentSize=function(e,t){var n=(t=t||{}).leftOb,o=t.rightOb;e.style.width=e.style.height=null;var r=0;"rfl"==t.leftOb.layout&&"double"==t.view&&(r=config.spreadSpacing?config.spreadSpacing:0);var i=n.viewport;if(i){if(i.width){var a=i.width;o&&o.viewport&&(a+=o.viewport.width+r),e.style.width=a+0+"px"}if(i.height){var s=i.height;o&&o.viewport&&(s=Math.max(s,o.viewport.height)),e.style.height=s+0+0+"px"}}},B}]),app.factory("crdv",["stg","status","error","translit","$rootScope","$injector","khttp","$ionicSideMenuDelegate",function(a,c,t,u,n,s,e,o){var r,p={};function i(e){a.data.settings.rtl?o.toggleLeft():o.toggleRight()}function l(){try{return cordova,!0}catch(e){return!1}}function d(r,i,a,s){try{c.updateProgress(0),r.getEntries(function(e){var o=0;!function t(){if(o>=e.length)r.close(function(){a&&a()});else{c.updateProgress(o/e.length);var n=e[o];o++,n.getData(new zip.BlobWriter,function(e){try{if("/"==n.filename.substr(-1))return void t();p.writeFile(e,ph.join(i,n.filename),p.libEbooksDirectory,function(){t()})}catch(e){s&&s()}},function(e,t){})}}()})}catch(e){s&&s()}}function f(e){switch(e.code){case FileError.QUOTA_EXCEEDED_ERR:"QUOTA_EXCEEDED_ERR";break;case FileError.NOT_FOUND_ERR:"NOT_FOUND_ERR";break;case FileError.SECURITY_ERR:"SECURITY_ERR";break;case FileError.INVALID_MODIFICATION_ERR:"INVALID_MODIFICATION_ERR";break;case FileError.INVALID_STATE_ERR:"INVALID_STATE_ERR";break;default:"Unknown Error"}}return p.initialize=function(c){putTest("in1"),l()?(putTest("in3"),a.data.cordova=!0,putTest("in4"),document.addEventListener("deviceready",function(){(function(){try{StatusBar&&(StatusBar.overlaysWebView(!1),ios?StatusBar.styleDefault():StatusBar.styleLightContent())}catch(e){}try{document.addEventListener("deviceready",function(){},!1)}catch(e){}try{navigator.splashscreen&&setTimeout(function(){navigator.splashscreen.hide()},1e3)}catch(e){}try{mobile&&native&&"undefined"!=typeof Keyboard&&Keyboard.hideFormAccessoryBar(!1)}catch(e){}})(),n.$$phase||n.$apply();a.copyLocalToNativeStorage(),p.initAds(),p.initDirectories({},function(){e.get("permit.json").success(function(a){function s(){var e={error:"errorAndCallback",msg:"noAppPermit",cb:p.exit};t.update(e),n.$$phase||n.$apply()}("udid"==a.type?window.plugins.uniqueDeviceID.get:"mac"==a.type?window.MacAddress.getMacAddress:window.plugins.imeiplugin.getImei)(function(e){e||s();try{for(var t,n=a.list.split("\n"),o=0;o<n.length;o++){var r=n[o].trim().split(" ")[0].trim(),i=n[o].trim().split("/")[0].trim();if(r==e||i==e){t=!0;break}}}catch(e){return void s()}t?c():s()},s)}).error(function(){c()})}),document.addEventListener("menubutton",i,!1),n.$$phase||n.$apply()},!1),putTest("in5")):c()},p.showKeyboard=function(){try{if(!l())return;Keyboard.show()}catch(e){}},p.hideKeyboard=function(){try{Keyboard.hide()}catch(e){}},p.tts=function(e,t){var n={text:e,rate:1};try{"iOS"==window.device.platform&&("9"==window.device.version.charAt(0)?n.rate=1.5:"10"==window.device.version.substr(0,2)?n.rate=1.5:"11"==window.device.version.substr(0,2)&&(n.rate=1.5))}catch(e){}TTS.speak(n,function(){t(!0)},function(e){p.toast(u.get("ttsUnavailableMsg")),t(!1)})},p.toast=function(e,t){if(l()){var n=2e3;(t=t||{}).long&&(n=4e3),t.duration&&(n=t.duration);var o=document.getElementById("kReaderToast");o||((o=document.createElement("div")).id="kReaderToast",document.body.appendChild(o),setTimeout(function(){o.className="fadeIn"},30)),removeClass(o,"fadeOut"),o.innerHTML=e,r&&clearTimeout(r),r=setTimeout(p.hideToast,n)}},p.hideToast=function(){if(l()){var e=document.getElementById("kReaderToast");e&&(hasClass(e,"fadeOut")||(addClass(e,"fadeOut"),e.addEventListener("transitionend",function(){hasClass(e,"fadeOut")&&e.parentNode&&e.parentNode.removeChild(e)})))}},p.copyToClipboard=function(e){if(l())try{cordova.plugins.clipboard?cordova.plugins.clipboard.copy(e):window.plugins.clipboard.copy(e),p.toast(u.get("copiedToClipboard"))}catch(e){}},p.share=function(e){if(l())try{window.plugins.socialsharing.share(e)}catch(e){}},p.createPDF=function(l,d,e){try{if(document.body.querySelector('script[src*="pdf/pdf"]'))n();else{var t=document.createElement("script");t.src=rootDir+"lib/pdf/pdf.js",t.addEventListener("load",n),document.body.appendChild(t)}}catch(e){}function n(){var e=new jspdf.jsPDF("p","pt","a4");l.match(/[\u0600-\u06FF\u0750-\u077F]+/g)&&(l=l.replace("<html>",'<html lang="ar">'),l=e.processArabic(l));var t=parser.parseFromString(l,"text/html");t.getElementById("container").style.fontFamily="Amiri-Regular";var n,o,r=!0,i=0,a=0,s=t.querySelector("h1");(n=document.createElement("h1")).innerHTML=s.innerHTML,document.body.appendChild(n),i+=n.offsetHeight,document.body.removeChild(n),t.querySelectorAll("h2,p,div").forEach(function(e){(n=document.createElement(e.nodeName.toLowerCase())).innerHTML=e.innerHTML,document.body.appendChild(n),e.textContent.match(/[а-яА-ЯЁё]+/g)&&(e.style.fontFamily="NotoSansCJKjp-Regular");var t=n.offsetHeight;document.body.removeChild(n),o=a*t,(r&&842<=i+o||!r&&842<=o)&&(r=!1,0,a=0,e.style.pageBreakAfter="always"),a++});var c=t.getElementById("container");c.style.width="550px",t.querySelector("body").style.width="550px",e.html(c,{x:20,y:20,margin:[0,0,0,0],callback:function(t){try{cordova,p.docDirectory.getFile(d,{create:!0},function(e){e.createWriter(function(e){e.onwriteend=function(e){},e.onerror=function(e){},e.write(t.output()),p.toast(u.get("pdfSaved"))},f)},f)}catch(e){try{setTimeout(function(){t.save(d)},1e3)}catch(e){}}}})}},p.initDirectories=function(n,o){function r(e){}n=n||{},window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem,window.requestFileSystem(LocalFileSystem.TEMPORARY,10485760,function(e){p.cacheDirectory=e.root,window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(e){p.docDirectory=e.root,n.useDir&&(p.docDirectory=n.useDir);var t="kotobeeReader";isReaderApp?t="kotobeeReaderApp":config.kotobee.cloudid&&(t+=config.kotobee.cloudid),p.docDirectory.getDirectory(t,{create:!0},function(e){p.appDirectory=e,p.appDirectory.getDirectory("library",{create:!0},function(e){p.libEbooksDirectory=e,p.appDirectory.getDirectory("temp",{create:!0},function(e){p.tempDirectory=e,p.appDirectory.getDirectory("local",{create:!0},function(e){p.localDirectory=e,p.localDirectory.getDirectory("books",{create:!0},function(e){p.localBooksDirectory=e,p.localDirectory.getDirectory("thumbs",{create:!0},function(e){p.localThumbsDirectory=e,p.libEbooksDirectory.getFile(".nomedia",{create:!0},function(){p.localDirectory.getFile(".nomedia",{create:!0},function(){o()},r)},r)},r)},r)},r)},r)},r)},function(){p.docDirectory.nativeURL!=cordova.file.dataDirectory&&window.resolveLocalFileSystemURL(cordova.file.dataDirectory,function(e){p.initDirectories({useDir:e},o)})})},r)},r)},p.exit=function(){l()&&(navigator.app?navigator.app.exitApp():navigator.device&&navigator.device.exitApp())},p.vibrate=function(e){l()&&(config.noVibration||(e=e||28,ios||(ios&&(e/=4),"high"==config.vibrationIntensity?e=40:"medium"==config.vibrationIntensity?e=28:"low"==config.vibrationIntensity&&(e=15),navigator&&navigator.vibrate?navigator.vibrate(e):navigator&&navigator.notification&&navigator.notification.vibrate&&navigator.notification.vibrate(e))))},p.deleteEbook=function(t,n){p.libEbooksDirectory.getDirectory(t.path,{},function(e){e.removeRecursively(function(){for(var e=0;e<a.data.downloaded.length;e++)a.data.downloaded[e].path==t.path&&(t.exists=!1,a.data.downloaded.splice(e,1),e--);a.writeSlot("downloaded"+a.getBookId(!0),a.data.downloaded,function(){n()})},function(e){})},f)},p.writeEbook=function(n,o,e,r){var i=e;e=null,p.libEbooksDirectory.getDirectory(o.path,{create:!0},function(e){var t=ph.join(o.path,n);p.writeFile(i,t,p.libEbooksDirectory,function(){p.unzipViaPlugin(ph.join(p.libEbooksDirectory.nativeURL,t),ph.join(p.libEbooksDirectory.nativeURL,o.path,"EPUB"),function(e){o.exists=!0,a.data.downloaded.push(o),s.get("library").applyExistingBooks(a.data.currentLibrary.books),a.writeSlot("downloaded"+a.getBookId(!0),a.data.downloaded,function(){i=null,r()})},function(e){})})})},p.unzip=function(e,t,n,o){p.unzipBlob(e,t,n,o)},p.unzipBlob=function(e,t,n,o){zip.workerScriptsPath="lib/zip/",zip.createReader(new zip.BlobReader(e),function(e){d(e,t,n,o)})},p.unzipViaPlugin=function(e,t,n,o){zip.unzip(e,t,n,o)},p.unzipData64=function(e,t,n,o){zip.workerScriptsPath="lib/zip/",setTimeout(function(){zip.createReader(new zip.Data64URIReader(e),function(e){setTimeout(function(){d(e,t,n,o)},100)})},100)},p.writeFile=function(i,e,t,a){"number"==typeof i&&(i+="");var n=ph.basename(e);try{p.getDirectoryRelativeToBooks(ph.normalize(e),t,function(e){try{e.getFile(n,{create:!0,exclusive:!1},function(e){e.createWriter(function(n){var o=i.byteLength?i.byteLength:i.size,r=0;function t(){var e=Math.min(4194304,o-r);try{var t=i.slice(r,r+e)}catch(e){}n.write(t),r+=e}n.onwrite=function(e){r<o?t():(i=null,a&&a(!0))},n.onerror=function(e){i=null,a&&a(!1)},t()},f)},function(e,t){})}catch(e){}})}catch(e){}},p.getDirectoryRelativeToBooks=function(e,t,n){t=t||p.libEbooksDirectory;var o=e.split("/");if(1!=o.length){var r=o[0];t.getDirectory(r,{create:!0},function(e){o.shift();var t=o.join("/");p.getDirectoryRelativeToBooks(t,e,n)},function(e){})}else n(t)},p.openInNativeBrowser=function(e,t){e=e.toString();try{if(t)return void window.open(e,"_system");try{if(cordova.InAppBrowser){p.toast("  "+u.get("loadingExternalPage")+"  ",{duration:4e3});var n=ios?"yes":"no",o=cordova.InAppBrowser.open(e,"_blank","location=no,hidden=no,clearcache=yes,closebuttoncaption=Go back to App,toolbar="+n+",presentationstyle=formsheet");return o.addEventListener("loadstart",function(){}),o.addEventListener("loadstop",function(){ios||p.hideToast()}),void o.addEventListener("loaderror",function(){if(!ios){try{o&&o.close()}catch(e){}p.hideToast(),p.toast("  "+u.get("errorLoadingPage")+"  ",{long:!0})}})}}catch(e){}try{if(window.inAppBrowserXwalk){return void window.inAppBrowserXwalk.open(e,{toolbarColor:"#FFFFFF",toolbarHeight:"40",closeButtonText:"< Close",closeButtonSize:"25",closeButtonColor:"#000000",openHidden:!1})}}catch(e){}return void window.open(e,"_system")}catch(e){}},p.initAds=function(){try{if("undefined"==typeof admob)return;if(!admob)return}catch(e){return}config.kotobee.admobId&&(admob.setOptions({publisherId:config.kotobee.admobId}),admob.createBannerView())},p.mobileDownload=function(o){if(l()&&cordova.plugins.fileOpener2){var r=new XMLHttpRequest;r.open("GET",cleanURL(o.replace("../../","epub/EPUB/"))),r.responseType="arraybuffer",r.addEventListener("error",function(e){}),r.addEventListener("load",function(){var n=r.response,e="";switch(device.platform.toLowerCase()){case"android":e=cordova.file.externalRootDirectory;break;case"ios":e=cordova.file.documentsDirectory}var t=e;window.resolveLocalFileSystemURL(t,function(e){e.getFile(ph.basename(o),{create:!0,exclusive:!1},function(t){t.createWriter(function(e){e.write(n),e.onwriteend=function(){var e=t.toURL();cordova.plugins.fileOpener2.open(e,n.type,{error:function(e){},success:function(){}})},e.onerror=function(e){}},function(e){})},function(e){})},function(e){})}),r.send()}},p}]),app.factory("cssParser",["khttp","cache","stg","workers",function(c,e,t,w){var i,x={},o=[];function C(e){e=e.replace(/\r?\n|\r/g," ");var t,n=[],o="key",r=[0],i=n,a=[i];function s(e){return e=e||1,r[r.length-e]}for(var c=0;c<e.length;c++)t=t||{},"}"==e[c]?("properties"==o&&(t.properties=e.substring(s(),c).trim(),t.keys&&t.keys.length&&(t.keys[t.keys.length-1]=t.keys[t.keys.length-1].trim()),i.push(t)),"key"==o&&1<a.length&&(a.pop(),i=a[a.length-1]),t=null,o="key",r.push(c+1)):"{"==e[c]?("properties"==o&&(t.children||(t.children=[]),t.keys&&t.keys.length&&(t.keys[t.keys.length-1]=t.keys[t.keys.length-1].trim()),n.push(t),i=t.children,a.push(i),(t={keys:[]}).keys.push(e.substring(s(),c).trim())),r.push(c+1),o="properties"):"key"==o&&(t.keys||(t.keys=[""]),","==e[c]?t.keys.push(""):t.keys[t.keys.length-1]+=e[c]);return n}return x.clearCache=function(){o=[]},x.inject=function(r,b,e){b=b||{};var i="",a=0;function s(e,t){for(var n=0;n<o.length;n++)if(o[n].url==e&&o[n].id==t)return o.push(o[n]),o[n]}function y(e){7<o.length&&o.shift(),o.push(e)}function k(e){var t=e;return t=(t=(t=(t=(t=t.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"")).replace(/ {2,}/g," ")).replace(/ ([{:}]) /g,"$1")).replace(/([;,]) /g,"$1")).replace(/ !/g,"!")}!function t(g,n){if(!g)return g={},void v();if("path"==g.type){var m=g.val;if(!m||0<=m.indexOf("EPUB/css/kotobeeInteractive.css"))return void v();var e=s(m,b.id);e?v(e.val):c.get(g.dontCache?m:cacheBust(m)).success(function(e){o(e,m,"url")}).error(function(){v()})}else o(g.val,g.root);function o(e,t,n){if(!e)return v();if(config.dontParseCss)return"url"==n&&y({url:m,val:e,id:b.id}),void v(e);if(w.supported()){var o={};return o.data=e,o.rootPath=t,o.cssOb=g,o.desktop=desktop,o.native=native,o.mobile=mobile,void w.call("cssParser","parse",[o],function(e){"url"==n&&y({url:m,val:e,id:b.id}),v(e)})}e=(e=(e=(e=(e=(e=x.applyRoot(t,e)).replace(/\/\*[\s\S]*?\*\//g,"")).replace(/<!--/g,"")).replace(/-->/g,"")).replace(/@charset.*?;/g,"")).replace(/@namespace.*?;/g,"");var r="spreadL";b.id&&(r=b.id);var i=(g.parentClass?g.parentClass:"#epubContainer.stylesEnabled")+" #"+r,a=C(e),s="";try{for(var c=0;c<a.length;c++){var l=h(a[c].keys);if(s+=l.joined,s+="{",a[c].children&&a[c].children.length)for(var d=0;d<a[c].children.length;d++){var u=h(a[c].children[d].keys);if(s+=u.joined,s+="{"+a[c].children[d].properties+"}",u.hasBody){var p=f(a[c].properties);p&&(s+="#epubContainer{"+p+"}")}}if(a[c].properties&&(s+=a[c].properties),s+="}",l.hasBody){var p=f(a[c].properties);p&&(s+="#epubContainer{"+p+"}")}}}catch(e){}function f(e){if(e){for(var t=e.split(";"),n="",o=0;o<t.length;o++)t[o]&&-1!=t[o].trim().indexOf("background")&&(n=t[o].trim().replace(/url\(.*?\)/g,"")+";");return n}}function h(e){for(var t={},n=0;n<e.length;n++)if(e[n]){var o=e[n].trim();0!=o.indexOf("body")?0!=o.indexOf("html")?0!=o.indexOf("@media")&&0!=o.indexOf("@")&&isNaN(o[0])&&"from"!=o&&"to"!=o&&(e[n]=i+" "+o):e[n]=o.replace("html",i):(e[n]=o.replace("body",i),0==e[n].indexOf("html")&&(e[n]=e[n].replace("html",i)),t.hasBody=!0)}return t.joined=e.join(","),t}e=k(e=s),"url"==n&&y({url:m,val:e,id:b.id}),v(e)}function v(e){e&&(i+=e),++a<r.length?t(r[a],n):n&&n(i)}}(r[a],e)},x.applyRoot=function(i,e){if(e){return e.replace(/url\((.*?)\)/g,function(e,t){var n="";if(0==t.indexOf('"')?(t=t.substr(1,t.length-2),n='"'):0==t.indexOf("'")&&(t=t.substr(1,t.length-2),n="'"),-1!=t.indexOf("http://"))return e;if(-1!=t.indexOf("https://"))return e;if(0==t.indexOf("data:"))return e;if(0==t.indexOf("kotobee:"))return e;var o=1<t.split(" ").length,r=1<(t=ph.join(i,t)).split(" ").length;return!o&&r&&(n='"'),"url("+cleanURL(n+t+n)+")"})}},x.getStyles=function(){return i},x.replaceStyles=function(e,t){var n;t=t||{};for(var o=document.getElementsByTagName("style"),r=0;r<o.length;r++)if(null!=o[r].getAttribute("kotobee")){n=o[r];break}i=e,t.append&&(i=n.innerHTML+" "+e),n=replaceHTML(n,i)},x.hideStyles=function(){removeClass(e.getOb("epubContainer"),"stylesEnabled")},x.showStyles=function(){addClass(e.getOb("epubContainer"),"stylesEnabled")},x.stylize=function(e,t){var n=document.getElementById(e);if(n){for(var o=n.getAttribute("style"),r=Object.keys(t),i=o?o+";":"",a=0;a<r.length;a++)i+=r[a]+":"+t[r[a]]+";";n.setAttribute("style",i)}},x}]),app.factory("design",["cssParser","$interpolate","stg","khttp",function(n,o,i,e){var t,r,a={};return a.getBgStyle=function(){if(!t){var e="";isKotobeeHosted()&&(e=publicRoot),"stretch"==(t={"background-image":'url("'+(config.splashBg?e+"imgUser/"+config.splashBg:"none")+'")',"background-color":config.splashBgColor?config.splashBgColor:"#3f3248",color:(config.splashColor?config.splashColor:"#fff")+" !important","background-size":config.splashBgSize?config.splashBgSize:"cover"})["background-size"]&&(t["background-size"]="100% 100%")}return t},a.convertTabs=function(){if(config.tabs){config.customTabs=[];for(var e=0;e<config.tabs.length;e++){var t=document.createElement("div");if(t.setAttribute("data-kotobee",config.tabs[e]),config.customTabs[e]=kInteractive.readData(t),config.customTabs[e]&&config.customTabs[e].icon){var n="";isKotobeeHosted()&&(n=publicRoot),isReaderApp&&(n=ph.join(bookPath,"_kmeta")+"/");var o=cleanURL(n+"imgUser/"+config.customTabs[e].icon);if("book"==config.src)if(native||desktop)o=cleanURL(bookPath+"_kmeta/imgUser/"+config.customTabs[e].icon);else{var r=bookPath.split("/books/")[1].split("/")[0];o=config.kotobee.public?cleanURL(i.data.paths.private+"books/"+r+"/EPUB/_kmeta/imgUser/"+config.customTabs[e].icon):cleanURL(config.kotobee.liburl+"books/"+r+"/EPUB/_kmeta/imgUser/"+config.customTabs[e].icon)}config.customTabs[e].iconStyle={"background-image":'url("'+o+'")'}}}}},a.injectUserCSS=function(n){function t(){for(var e=document.getElementsByTagName("style"),t=0;t<e.length;t++)if(e[t].hasAttribute("user")){e[t].innerHTML=o(r)(n);break}}r?t():e.get(cacheBust(rootDir+"css/user.css")).success(function(e){r=e,t()})},a.applyRichTextLibrary=function(){for(var e,t,n=document.getElementsByTagName("script"),o=0;o<n.length;o++)if(n[o].getAttribute("src")&&0<=n[o].getAttribute("src").indexOf("quill/quill.min.js")){e=n[o];break}var r=document.getElementsByTagName("link");for(o=0;o<r.length;o++)if(r[o].getAttribute("href")&&0<=r[o].getAttribute("href").indexOf("quill/quill.snow.css")){t=r[o];break}if(config.htmlInNotes){var i=document.getElementsByTagName("head")[0];if(!e){var a=document.createElement("script");a.src=rootDir+"lib/quill/quill.min.js",i.appendChild(a)}if(!t){var s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("href",rootDir+"lib/quill/quill.snow.css"),i.appendChild(s)}}else e&&e.parentNode.removeChild(e),t&&t.parentNode.removeChild(t)},a.stylize=function(e,t){n.stylize(e,t)},a}]),app.factory("error",["modals","translit","$injector","$location","$ionicHistory",function(r,i,a,e,t){var s={},c=[];return s.modal=null,s.update=function(e){var t,n=a.get("backend");if(e)switch(e.error){case"s_authError":"library"==config.kotobee.mode&&n.cloudParam("entry")?t={mode:"login",dynamic:!0,animation:"slide-in-up",loginOptions:{}}:a.get("login").toLoginScreen();break;case"networkError":t={mode:"networkError",errorOptions:{ref:e.ref,retry:s.retry}};break;case"localonlyError":t={mode:"localOnlyError",errorOptions:{ref:e.ref,retry:s.retry}};break;case"errorAndCallback":t={mode:"generalError",errorOptions:{msg:i.get(e.msg),cb:e.cb}};break;case"ssoEmailError":t={mode:"ssoEmailError",errorOptions:{provider:{name:e.provider},cb:e.cb}};break;default:t={mode:"generalError",errorOptions:{msg:i.get(e.error)}}}for(var o=0;o<c.length;o++)c[o].error==e.error&&c[o].func(t);t&&r.show(t)},s.retry=function(e){r.hide(),timeOut(function(){e.func.apply(null,e.args)},100)},s.detect=function(e,t){c.push({error:e,func:t})},s.removeDetection=function(e,t){for(var n=0;n<c.length;n++)if(t==c[n].func&&e==c[n].error)return void c.splice(n,1)},s}]),app.factory("events",["backend",function(n){var e={};return e.initialize=function(){readerV<1.5||(kInteractive.events=this)},e.add=function(e,t){readerV<1.5||(e.target=e.currentTarget=e.elem,kotobee.dispatchEvent(e.action,e),e.disableRemote||n.addEvent(e,t))},e}]),app.factory("htmlParser",function(){var e={wrapOrphans:function(e){for(var t=[],n=e.getElementsByTagName("body")[0],o=0;o<n.childNodes.length;o++)3==n.childNodes[o].nodeType&&t.push(n.childNodes[o]);for(o=0;o<t.length;o++){var r=t[o],i=document.createElement("span");i.textContent=r.textContent,r.nextSibling?n.insertBefore(i,r.nextSibling):n.appendChild(i),n.removeChild(r)}},parse:function(e){var t,n=[];n.push(/([< \/][^>]*?>)((\s*[^<\s]+\s+?)+)([^<\s]+\s*)(<)/g),t=/(>)([^<\n]*?[^<]+?)(<[^\/])/g;for(var o=0;o<n.length;o++){var r=n[o];e=e.replace(r,function(e,t){if(0<=t.indexOf('class="parsed"'))return e;if(0==t.indexOf("<pre"))return e;if(0==t.indexOf("<code"))return e;if(0==t.indexOf("<script"))return e;var n="",o=arguments[2].split(" ");""==o[o.length-1]&&o.splice(-1,1),o.push(arguments[4]);for(var r=0;r<o.length;r++){var i=r==o.length-1?"":" ";n+="<span>"+o[r]+i+"</span>"}return t+n+"<"})}return e=(e=e.replace(t,function(e,t){return arguments[2].trim()?t+("<span>"+arguments[2]+"</span>")+arguments[3]:e})).replace(/(<a [\s\S]*?)(>)/g,'$1 onclick="return false;" $2'),native&&mobile&&(e=e.replace(/(<img[^>]*src=)"(.*?)"/g,function(e,t){return t+'"'+cleanURL(arguments[2])+'"'})),e}};return e}),app.factory("initializer",["$rootScope","$injector","np","chapterAPI","miniapps","$timeout","translit","freehand","autohide","annotations","scorm","events","workers","cssParser","status","tinCan","book","$location","chapters","error","modals","popovers","$ionicHistory","$ionicPlatform","crdv","cache","auth","design","stg","backend","settings",function(l,r,e,i,t,n,d,a,s,c,u,p,f,o,h,g,m,v,b,y,k,w,x,C,I,E,S,T,O,A,N){var L,B,M,R={},P=[];function D(e,t){e.className="",setTimeout(function(){e.className="icon fa fa-cog fa-spin size16",setTimeout(t,400)},500)}function F(){var o=require("nw.gui");L=L||new o.Menu({type:"menubar"});var e=new o.Menu;e.append(c({label:d.get("exit")},a)),L.append(c({label:d.get("file")},a,e));for(var t=new o.Menu,n=new o.Menu,r=O.data.languages,i=0;i<r.length;i++)n.append(c({label:r[i].label},s));function a(e){this.label.toLowerCase()==d.get("exit").toLowerCase()&&o.App.quit()}function s(e){var t=this.label;setTimeout(function(){for(var e=0;e<O.data.languages.length;e++)if(O.data.languages[e].label==t)return O.data.settings.language=O.data.languages[e].val,N.langChanged(),void(l.$$phase||l.$apply())},300)}function c(e,t,n){return t&&(e.click=t),n&&(e.submenu=n),new o.MenuItem(e)}t.append(c({label:d.get("language")},a,n)),L.append(c({label:d.get("settings")},a,t)),o.Window.get().menu=L}return R.initialize=function(){R.initialized||R.initializing||(O.data.initPath=v.path(),v.path("/loading"),function(o){putTest("preInitialize"),R.initializing=!0,e.initialize(),I.initialize(function(){T.injectUserCSS(config);var e=R.getLogo();R.playAudio(),R.displayBg(),A.addListener("pathsChanged",R.playAudio),A.addListener("pathsChanged",R.displayBg);for(var t=document.getElementsByTagName("link"),n=0;n<t.length;n++)if("shortcut icon"==t[n].getAttribute("rel")){t[n].getAttribute("href")||t[n].setAttribute("href",config.icon?config.icon:e.logo);break}putTest("preInitialize2"),E.initialize(),g.initialize(),f.initialize(),O.initialize(),u.initialize(),p.initialize(),s.initialize(),i.initialize(),a.initialize(),c.initialize(),O.initializeSettings(function(){N.langChanged(),putTest("preInitialize3"),window.addEventListener("message",function(e){var t=e.data&&"string"==typeof e.data?e.data.split(":"):[""];if("next"==t[0])b.nextChapter();else if("prev"==t[0])b.prevChapter();else if("notebook"==t[0])angular.element(document.getElementById("tabMenu")).scope().notebookClicked();else if("goto"==t[0])v.path(r.get("library").root+"/reader/chapter/"+Number(t[1]));else if("zoom"==t[0])for(var n=document.getElementsByTagName("meta"),o=0;o<n.length;o++)"viewport"==n[o].getAttribute("name")&&n[o].setAttribute("content","initial-scale="+t[1])},!1),window.kbOpenChapterURL=function(e){e&&(isAbsoluteURLPath(e)?window.location.href=e:(e=ph.join(O.data.book.chapter.url,e),b.applyChapterStateFromURL(e)))},window.addEventListener("keydown",function(e){if("a"==e.key&&(e.ctrlKey||e.metaKey)){var t=e.target;if(!t||!t.nodeName)return;"input"!=t.nodeName.toLowerCase()&&"textarea"!=t.nodeName.toLowerCase()||t.select()}}),setTimeout(function(){ionic.tap.requiresNativeClick=function(e){return!(!ionic.Platform.isWindowsPhone()||"A"!=e.tagName&&"BUTTON"!=e.tagName&&!e.hasAttribute("ng-click")&&("INPUT"!=e.tagName||"button"!=e.type&&"submit"!=e.type))||!!(!e||e.disabled||/^(file|range)$/i.test(e.type)||/^(object|video|audio)$/i.test(e.tagName)||ionic.tap.isLabelContainingFileInput(e))||ionic.tap.isElementTapDisabled(e)}},1e3),desktop&&F(),native||(document.onkeydown=function(e){"app"!=config.kotobee.mode&&document.activeElement&&"epubContainer"==document.activeElement.id&&(k.shown()||kotobee.disableKeyboardInteraction||(e=e||window.event).shiftKey||("37"==e.keyCode?(O.data.settings.rtl?b.nextChapter():b.prevChapter(),l.$$phase||l.$apply()):"39"==e.keyCode&&(O.data.settings.rtl?b.prevChapter():b.nextChapter(),l.$$phase||l.$apply())))}),putTest("preInitialize4"),E.setOb("title",replaceHTML(E.getOb("title"),d.get("loading")+"..")),d.addListener(function(){desktop&&function(){if(L)for(;L.items.length;)L.removeAt(0);F()}(),B||O.data.book||O.data.book.meta||E.setOb("title",replaceHTML(E.getOb("title"),d.get("loading")+"..")),putTest("translit.addListener2")}),putTest("preInitialize5"),config.kotobee.cloudid&&A.getS3Paths(),B=!0,o&&o()})})}(function(){C.ready(function(){setTimeout(function(){!function(e){putTest("postInitialize start"),function e(t){if(preview&&-1!=window.location.href.indexOf("&screenshot")&&0<=window.location.href.indexOf("&startup"))return;return t();if("localhost"==location.hostname)return t();var n=document.getElementById("iconDetector");if(preview&&-1!=window.location.href.indexOf("&screenshot"))return void(-(n.style.opacity=1)==window.location.href.indexOf("&startup")&&t&&t());D(n,function(){M=M||setTimeout(function(){n.style.opacity=1,t&&t()},8e3),n.offsetWidth<10?setTimeout(function(){e(t)},1e3):(clearTimeout(M),n.style.opacity=1,setTimeout(function(){t&&t()},1e3))})}(function(){putTest("postInitialize start2"),A.initialize().then(function(){if(putTest("MM"),"library"==config.kotobee.mode||isReaderApp){try{O.readSlot("downloaded"+O.getBookId(!0),function(e){O.data.downloaded=e,putTest("MMMM")})}catch(e){O.data.downloaded=[]}O.data.downloaded||(O.data.downloaded=[])}else"book"==config.kotobee.mode?(bookPath="epub/",preview&&(bookPath=config.kotobee.bookPath),bookPath=bookPath||"epub/"):"app"==config.kotobee.mode||(h.update(),y.update({error:"errorAndCallback",msg:"cantReadConfigFile",cb:I.exit}));S.authenticate(),e&&e()}),n(function(){C.registerBackButtonAction(function(e){var t=x.currentView();kInteractive.frameIsOpen?kInteractive.closeFrame():kInteractive.alertIsOpen?kInteractive.closeAlert():kInteractive.videoIsFullscreen?kInteractive.closeFullscreenVideo():"forgotPwd"==t.stateId?x.goBack():"register"==t.stateId?x.goBack():"library"==t.stateId&&isReaderApp?v.path("/app"):k.show({mode:"exit",backdropClickToClose:!1,exitOptions:{exit:function(){I.exit()}}}),l.$apply()},101)},500),l.$apply(),R.initialized=!0,R.initializing=!0,kotobee.dispatchEvent("initialized"),function(){for(var e=0;e<P.length;e++)P[e].apply(this,arguments)}()})}(function(){config.noLoadingScreen&&removeClass(document.body,"loading")})},config.noLoadingScreen?0:700)})}))},R.displayBg=function(){T.stylize("home",T.getBgStyle())},R.playAudio=function(){if(config.audio&&!document.bgAudio){var e="";isKotobeeHosted()&&(e=publicRoot);var t=e+"imgUser/"+config.audio,n=document.createElement("audio");n.setAttribute("data-dontclose",!0),n.setAttribute("controls","true"),n.setAttribute("autoplay","true"),n.setAttribute("src",t),config.audioLoop&&n.setAttribute("loop","true"),n.setAttribute("data-tap-disabled","false");var o=document.createElement("source");o.src=t,n.appendChild(o),n.appendChild(document.createTextNode("Your browser does not support the audio element")),n.oncanplay=function(){kInteractive.tinCan({verb:"played",activity:"Audio: "+t})},n.play(),document.bgAudio=n}},R.getLogo=function(){var e="";return isKotobeeHosted()&&(e=publicRoot),{logo:config.logo?e+"imgUser/"+config.logo:rootDir+"img/ui/defaultWelcomeLogoNew.png",slogan:config.slogan?config.slogan:""}},R.addListener=function(e){P.push(e)},R.handleRedirect=function(e){var t=!1,n=new URLSearchParams(window.location.search),o=n.get("provider")||"",r=n.get("state")||"",i=n.get("payment")||"",a=n.get("success")||"",s=n.get("book_id")||"",c=n.get("user_id")||"";if(o){var l=new URLSearchParams("?"+e.slice(1)),d=l.get("id_token")||"",u=l.get("access_token")||"";if(d||u){var p=getBaseSuffix()+"#/oauth/"+o+"/"+encodeURIComponent(d)+"/"+encodeURIComponent(u);t=!0,v.path("/oauth/"+o+"/"+encodeURIComponent(d)+"/"+encodeURIComponent(u))}}else if(r)t=!0,window.location.replace(getBaseSuffix());else if(i&&a&&c){t=!0;p=getBaseSuffix()+"#/payment/"+i+"/"+("true"==a?"success":"cancel");s&&(p+="/"+s),p+="/"+c,window.location.replace(p)}return t},R}]),app.factory("jsParser",["khttp","cache",function(u,e){var p,o,r,t={},n=[];return t.clearCache=function(){n=[]},t.inject=function(a,e){var s=[];function c(e){for(var t=0;t<n.length;t++)if(n[t].url==e)return n.push(n[t]),n[t]}function l(e){5<n.length&&n.shift(),n.push(e)}function d(){for(var e=0;e<s.length;e++){var t;if(s[e])0<=s[e].indexOf("window.location.href")&&(t=/window\.location\.href[\s]*?=(.*?)[;\n]/g,s[e]=s[e].replace(t,"try { kbOpenChapterURL($1); } catch(er){};")),0<=s[e].indexOf("event.stopPropagation()")&&(t=/event\.stopPropagation\(\)/g,s[e]=s[e].replace(t,"void(0)")),0<=s[e].indexOf("<![CDATA[")&&(t=/<!\[CDATA\[/g,s[e]=s[e].replace(t,"//<![CDATA["),t=/\]\]>/g,s[e]=s[e].replace(t,"//]]>"))}}(function e(t,n){if(!t)return void i();if("code"==t.mode)s.push(t.val),i();else{var o=c(t.val);function r(e){e&&s.push(e),i()}o?r(o.val):u.get(cacheBust(t.val)).success(function(e){l({url:t.val,val:e}),r(e)}).error(function(){r()})}function i(){++p<a.length?e(a[p],n):(d(),n&&n(s))}})(a[p=0],e)},t.getScript=function(){return o},t.replaceScript=function(e){if(o=e,r&&r.length)for(var t=0;t<r.length;t++)r[t].parentNode&&r[t].parentNode.removeChild(r[t]);r=[];for(t=0;t<e.length;t++){var n=document.createElement("script");n.setAttribute("kotobee",""),n.setAttribute("type","text/javascript"),n.innerHTML=e[t],r.push(n);try{document.head.appendChild(n)}catch(e){}try{try{document.dispatchEvent(new Event("DOMContentLoaded"))}catch(e){}}catch(e){}}},t}]),app.factory("khttp",["$http",function(r){var e={};return e.get=function(e){return r.get(cleanURL(e))},e.post=function(e,t,n,o){return r.post(cleanURL(e),t,n,o)},e}]),app.factory("landing",["$http",function(e){return{}}]),app.factory("library",["stg","translit","cache","$rootScope","backend","crdv","payment",function(s,e,t,c,r,n,i){var a,l={},o=[];function d(e){e=e||{},l.maxResults=e.large?40:20}function u(){for(var e=0;e<o.length;e++)o[e].apply(this,arguments)}return l.sortMethod={},l.root="",l.initialize=function(){l.setBrowserTitle(),d(),o=[],u("initialized")},l.setMax=function(e){l.maxResults=e},l.setBrowserTitle=function(){t.setOb("title",replaceHTML(t.getOb("title"),s.data.currentLibrary.name?s.data.currentLibrary.name:e.get("library")))},l.addListener=function(e){o.push(e)},l.getEbooks=function(n,o){n=n||{},a=Math.round(1e5*Math.random()),u("preload",n),n.accumulated||addClass(document.getElementById("libraryThumbs"),"dim");n.more?function(e){e=e||{},l.maxResults+=e.large?20:6}(n.contentkey?{large:!0}:{}):d(n.contentkey?{large:!0}:{}),n.sort=l.sortMethod.data,n.sortDir=l.sortMethod.dir,n.max=l.maxResults,r.getEbooks(n,a,function(e,t){t==a&&(removeClass(document.getElementById("libraryThumbs"),"dim"),e.error||(l.applyExistingBooks(e),i.registerInAppProducts(e),function(e){try{n.favs?s.data.favorites=e:s.data.currentLibrary.books=e}catch(e){}}(e)),e&&e.length||(e.empty=!0),u("postload",n,e),o&&o(e))})},l.applyExistingBooks=function(e){if((native||desktop)&&(e||s.data.currentLibrary&&(e=s.data.currentLibrary.books),e)){for(var t=[],n=0;n<e.length;n++)e[n].exists=!1;for(var o=0;o<s.data.downloaded.length;o++)s.data.downloaded[o].favorite=!1;for(o=0;o<s.data.downloaded.length;o++){t.push(s.data.downloaded[o].id);var r=s.data.downloaded[o].path;s.data.downloaded[o].favorite=null;for(n=0;n<e.length;n++)if(e[n].path==r){e[n].exists=!0,s.data.downloaded[o].favorite=e[n].favorite;break}}var i=s.data.downloaded;for(o=i.length;o--;)2<=a(i[o].id,t)&&i.splice(o,1);c.$$phase||c.$apply()}function a(e,t){for(var n=0,o=0;o<t.length;o++)t[o]==e&&n++;return n}},l}]),app.factory("login",["$rootScope","$location","$injector","error","modals","backend","stg","sso","$ionicHistory",function(e,t,n,r,o,i,a,s,c){var l={};function d(e,t,n,o){e&&t&&(n||o)&&(a.data.user={email:t,loggedIn:!0},i.login({accessToken:n,idToken:o,ssoProvider:e}).then(function(e){a.data.sso.ssoBusy=!1,e.error?r.update({error:"s_authError"==e.error?"accessDenied":e.error}):u(!0)}).catch(function(e){}))}function u(e){function t(e){!a.data.user.email&&a.data.sso&&a.data.sso.oauth?n.get("login").toLoginScreen():(o.hide(),e&&e.error||n.get("auth").startup())}i.cloudParam("public")||i.cloudParam("entry")?n.get("auth").startup():e?t():i.login().then(t)}return e.$on("SignIn",function(e,t){s.signInBrowser(t,d)}),l.init=function(){},l.start=function(){config.kotobee&&config.kotobee.sso?s.initialize(function(){if(!a.data.user.email&&a.data.sso&&a.data.sso.oauth){var e=a.data.sso.oauth.provider;s.getSSOEmail(e,function(e){u()})}else u()}):u()},l.logout=function(){config.kotobee&&config.kotobee.sso&&a.data.sso.oauth&&s.signOutBrowser(a.data.sso.oauth.provider),a.data.user.rememberMe=!1},l.toLoginScreen=function(){config.kotobee.landing?n.get("book").loadBook({getInfoOnly:!0}).then(function(){t.path("/landing")}):t.path("/login"),setTimeout(function(){c.clearHistory();var e=document.getElementById("chapters");e&&e.parentNode.removeChild(e)},1e3)},l}]),app.factory("markers",["$rootScope","error","cache","stg","$location","$injector","$ionicScrollDelegate",function(e,t,w,x,n,C,o){var r={},i=new Array,a={};return r.addMarker=function(e){i.push(e),r.refreshMarker(e)},r.deleteMarker=function(e){for(var t=0;t<i.length;t++)i[t].id==e&&i.splice(t,1)},r.windowResize=function(){(function(){if(n.path()&&0<=n.path().indexOf("/reader"))return!1;return!0})()||a.width==window.innerWidth&&a.height==window.innerHeight||(r.refreshMarkers(),a.width=window.innerWidth,a.height=window.innerHeight)},r.refreshMarkers=function(){for(var e=0;e<i.length;e++)r.refreshMarker(i[e])},r.refreshMarkerById=function(e){for(var t=0;t<i.length;t++)if(i[t].id==e)return void r.refreshMarker(i[t])},r.getMarker=function(e){for(var t=0;t<i.length;t++)if(i[t].id==e)return i[t]},r.refreshMarker=function(e){var t=e.target();if(t&&e.elem){var n="",o="page";(hasClass(e.elem,"contentSideNoteMarker")||hasClass(e.elem,"contentBookMarker"))&&(o="side");var r=w.getOb("epubContainer").getElementsByClassName("scroll")[0],i=w.getOb("epubContent");if(r){var a,s,c=t.getBoundingClientRect(),l=r.getBoundingClientRect(),d=i.getBoundingClientRect(),u=getElemPadding(w.getOb("epubContainer")),p=1;a=r.scrollTop,s=r.scrollLeft;var f=C.get("nav");x.data.book.chapter.viewport&&(p=f.getFxlScale());var h,g,m,v=(c.top+a-(l.top+0))/p;if("side"==o){h=0;var b=Number(u.left)+(d.left-l.left+s),y=l.right-d.right+s;(m=x.data.book.chapter.viewport?b:b<y?b:y)<30&&(m=30),x.data.settings.rtl&&(g=0,h=null),h-=b}else{if(0==e.elem.offsetWidth)return;h=(c.left+s-l.left)/p}null!=v&&(n+="top: "+(v+e.offsetTop)+"px; "),null!=h&&(n+="left: "+(h+e.offsetLeft)+"px; "),null!=g&&(n+="right: "+(g-e.offsetLeft)+"px; "),null!=m&&(n+="width: "+m+"px; ");var k=1/p;""!=(n+="transform:translateZ(0) scale("+k+");-webkit-transform:translateZ(0) scale("+k+");-moz-transform:translateZ(0) scale("+k+");")&&(e.elem.style.cssText=n),e.callback&&e.callback()}}},r.checkMarkerExistsAtSameLocation=function(r,i){x.getNotes(function(e){for(var t=0;t<e.length;t++){var n=e[t];if("page"==n.type){var o=document.getElementById("note"+n.nid);if(o&&o!=r&&o.style.top==r.style.top)return i(!0)}}x.getBookmarks(function(e){for(var t=0;t<e.length;t++){var n=e[t],o=document.getElementById("bookmark"+n.bmid);if(o&&(o!=r&&o.style.top==r.style.top))return i(!0)}i()})})},r.show=function(){for(var e=0;e<i.length;e++)i[e].elem.style.visibility="shown"},r.hide=function(){for(var e=0;e<i.length;e++)i[e].elem.style.visibility="hidden"},window.addEventListener("resize",r.windowResize,!0),r}]),app.factory("media",["$ionicModal","tinCan","$rootScope","modals",function(e,t,n,o){var r={};return r.show=function(e){"image"==e.type?(t.send({verb:"viewed image",activity:e.title?e.title:e.thumbnail}),o.show({mode:"image",dynamic:!0,animation:"slide-in-up",image:e,large:e.large})):"video"==e.type?(t.send({verb:"viewed video",activity:e.title?e.title:e.thumbnail}),o.show({mode:"video",animation:"slide-in-up",video:e,large:e.large},null,pauseVideoAndAudio)):"audio"==e.type&&(t.send({verb:"listened to audio",activity:e.title?e.title:e.thumbnail}),o.show({mode:"audio",animation:"slide-in-up",audio:e,large:e.large},null,pauseVideoAndAudio))},r.hide=function(){o.hide()},r}]),app.factory("miniapps",["khttp","$rootScope","$injector","backend","translit","stg","$ionicSideMenuDelegate",function(khttp,$rootScope,$injector,backend,translit,stg,$ionicSideMenuDelegate){var service={},miniappsConfig={},log=kLog;function openPreviewApp(){if(previewParams&&previewParams.appfolder)for(var e=0;e<stg.data.miniapps.length;e++)if(stg.data.miniapps[e].folder==previewParams.appfolder){var t=document.getElementById("readerHeader");return angular.element(t).scope().miniappsClicked(),void setTimeout(function(){service.openFromMenu(stg.data.miniapps[e])},1e3)}}function validate(e,t){if(kInteractive.isSDK())return!0;var n,o=e.join(";");"book"==config.kotobee.mode?n=CryptoJS.MD5(stg.data.packageOpf.replace(/\s+/g,"")+o).toString():"library"==config.kotobee.mode&&(n=CryptoJS.MD5(config.kotobee.cloudid+o).toString());return n==t[window.atob("Y2hlY2tzdW0=")]}return service.initialize=function(ob){ob=ob||{},ob.mode||(ob.mode="book");var book=$injector.get("book");if("library"!=config.kotobee.mode||"book"!=ob.mode||!config.noBookOverride){var appids=[],miniapps=stg.data.miniapps=[],css="",root=service.getRoot();khttp.get(cacheBust(root+"miniapps.js")).success(function(miniappScript){if(miniappScript){eval(miniappScript);var json=miniappJson.apps,arr=[];for(var item in json)arr.push({folder:item,code:json[item]});arr.length&&next(0)}function next(index){if(index>=arr.length)return finalize();var folder=arr[index].folder;khttp.get(cacheBust(root+"miniapps/"+folder+"/config.js")).success(function(configScript){function proceed(dataJson){dataJson=dataJson||{},eval(configScript);var configJson=window.miniappConfig;"string"==typeof configJson&&(configJson=JSON.parse(configJson));var appid=configJson.appid;appids.push(appid);var regex=new RegExp("{{"+appid+"Root}}","g"),regexEncoded=new RegExp(encodeURIComponent("{{"+appid+"Root}}"),"g"),code=arr[index].code;code=code.replace(regex,root+"miniapps/"+folder),code=code.replace(regexEncoded,root+"miniapps/"+folder),code=code.replace(/{{www}}/g,root+"../..");try{eval(code)}catch(e){return void next(++index)}var miniappClass=window.miniappOutput;if(css+=arr[index].css,!miniappClass.open)return next(++index);var lang=translit.getLang();"fr"!=lang&&"es"!=lang&&"ar"!=lang&&(lang="en"),miniapps.push({appid:appid,folder:folder,appClass:miniappClass,configJson:configJson,dataJson:dataJson}),delete window.miniappConfig,delete window.miniappOutput,next(++index)}kInteractive.isSDK()?proceed():khttp.get(cacheBust(root+"miniapps/"+folder+"/userdata/data.json")).success(proceed).error(proceed)})}function finalize(){if(validate(appids,miniappJson)){var e=document.createElement("style");e.setAttribute("data-miniapps","stylesheet"),e.setAttribute("type","text/css"),e.innerHTML=css,document.body.appendChild(e),$rootScope.$$phase||$rootScope.$apply(),preview&&setTimeout(openPreviewApp,1e3)}}})}},service.openFromMenu=function(e){e.appClass.externalLink||service.open(e),$ionicSideMenuDelegate.isOpenLeft()?$ionicSideMenuDelegate.toggleLeft():$ionicSideMenuDelegate.toggleRight()},service.openById=function(t){(stg.data.miniapps||[]).forEach(function(e){e.appid==t&&service.open(e)})},service.open=function(e){e.appClass&&e.appClass.open&&(kInteractive.events&&kInteractive.events.add({action:"miniappOpened",param:e.appid,data:e}),e.appClass.open())},service.getRoot=function(){var e;if("library"==config.src)e="undefined"!=typeof publicRoot?publicRoot:"./";else if(e=bookPath+"_kmeta/",isKotobeeHosted())if(isAbsoluteURLPath(bookPath))e=bookPath+"_kmeta/";else if(config.kotobee.public)e=publicRoot+"epub/_kmeta/";else{var t=publicRoot.split("/books/")[1].split("/")[0];e=config.kotobee.liburl+"books/"+t+"/EPUB/epub/_kmeta/"}return e},service}]),app.factory("modals",["$ionicModal","$q","$injector","$ionicPlatform","$rootScope",function(n,o,r,e,t){var i,a,s,c,l={},d=[],u={animation:"zoom-in",focusFirstInput:!1,backdropClickToClose:!1};l.setScope=function(e){(a=e).hideModal=l.hide,i||p(),a.$on("modal.shown",function(e){s&&s._cb&&s._cb(e.target||e)}),a.$on("modal.hidden",function(e){c&&clearTimeout(c),s&&s._closeCb&&s._closeCb(event.target),setTimeout(function(){d.shift(),f(),function(){for(var e=document.getElementsByClassName("modal-backdrop"),t=e.length;t--;)hasClass(e[t],"hide")&&e[t].parentNode.removeChild(e[t])}()},500)})},l.getScope=function(){return a};var p=function(){var t=o.defer(),e=clone(u);return e.scope=a,n.fromTemplateUrl(kTemplate("modals/modals.html"),e).then(function(e){i=e,t.resolve()}),t.promise};function f(){if(s=null,d.length){var e=d[0];if(e){if((s=e).hidden)return d.shift(),void(1<d.length&&f());u.backdropClickToClose=!!e.backdropClickToClose&&e.backdropClickToClose,u.animation=e.animation?e.animation:"zoom-in",e.large?addClass(document.body,"largeModal"):removeClass(document.body,"largeModal"),p().then(function(){a.modal=e,i&&(i.show(),a.$$phase||a.$apply(),s&&s.timeLimit&&(c=setTimeout(function(){var e=s;l.hide(s);var t={wait:function(){l.hide(),l.show(e)}};l.show({mode:"waitTimeout",timeoutOptions:t})},s.timeLimit)),setTimeout(function(){e.cb&&e.cb(i)},750))})}}}return l.show=function(e,t,n){if(i)return t&&(e._cb=t),n&&(e._closeCb=n),d.push(e),1==d.length&&f(),e;p().then(function(){l.show(e)})},l.obShown=function(e){return s==e},l.shown=function(){return!!i&&i.isShown()},l.hide=function(e,t){i&&(e?s==e?(i.hide(),native&&r.get("crdv").hideKeyboard()):e.hidden=!0:(i.hide(),native&&r.get("crdv").hideKeyboard()),t&&t())},l}]),app.factory("nav",["cache","crdv","$ionicGesture","$location","$compile","$rootScope","$ionicSideMenuDelegate","selection","markers","settings","$timeout","chapters","$ionicScrollDelegate","stg",function(I,t,n,e,a,s,o,c,l,d,r,i,u,E){var p,f,h,g,m,S={},v=15,b=0,y={},k=[];function w(e,t){for(var n=0;n<k.length;n++)k[n].event==e&&k[n].func(t)}function x(e){if("newChapter"==e){var t=I.getOb("epubContainer"),n=(I.getOb("epubContent"),(f=u.$getByHandle("content")).getScrollView().options);if(n.scrollbarFadeDelay=0,n.scrollingY=!0,n.minZoom=.2,n.maxZoom=3.5,n.zooming=!0,E.data.book.chapter.viewport){n.deceleration=.85,n.scrollingX=!0,n.scrollbarY=!1,f.scrollTo(0,0,!1);try{S.getFxlFit(null,"from setChapterLayout").bestFit}catch(e){}S.fxlZoomFit({noAnim:!0,immediateScrollRefresh:!0})}else t.style.marginLeft=null,t.style.paddingLeft=null,t.style.paddingTop=null,f.scrollTo(0,0,!1),n.zooming&&f.zoomTo(1,!1,0,0),n.deceleration=.95,n.scrollbarY=!0,mobile||(n.scrollingY=!1),setTimeout(function(){config.textSizeControls||(n.zooming=!1),n.scrollingX=!1,config.textSizeControls||(n.zooming=!1)},500);setTimeout(l.refreshMarkers,1e3);var o=t.getElementsByClassName("scroll");o.length&&(removeClass(o[0],"afterDelay"),setTimeout(function(){addClass(o[0],"afterDelay")},2e3))}}function C(){if(!config.hideTOCAtWidescreen){var e=1300<=y.width;s.widescreen!=e&&(w("widescreenChanged"),s.widescreen=e),e?(addClass(document.body,"widescreen"),o.toggleLeft(!1),o.toggleRight(!1)):removeClass(document.body,"widescreen"),s.$$phase||s.$apply()}}function T(e){var t=I.getOb("epubContainer");"margin"==e?(t.style.paddingLeft&&(t.style.setProperty("margin-left",t.style.paddingLeft,"important"),t.style.paddingLeft=null),t.style.paddingTop&&(t.style.setProperty("margin-top",t.style.paddingTop,"important"),t.style.paddingTop=null)):(t.style.marginLeft&&(t.style.setProperty("padding-left",t.style.marginLeft,"important"),t.style.marginLeft=null),t.style.marginTop&&(t.style.setProperty("padding-top",t.style.marginTop,"important"),t.style.marginTop=null))}function O(e){e=e||S.getFxlScale();var t=S.getFxlFit(null,"from fxlRefreshHorizontalVerticalScrolling"),n=f.getScrollView().options;e*t.widthFit<=t.widthFit?n.scrollingX=!1:n.scrollingX=!0,e*t.widthFit<=t.heightFit?n.scrollingY=!1:n.scrollingY=!0}function A(e){if(!S.options.swipeDisabled&&!(v<b||mobile&&function(){var e=document.getElementById("readerBody").style.transform||document.getElementById("readerBody").style.webkitTransform;if(e&&"translate3d(0px, 0px, 0px)"!=e&&"translate3d(0px, 0, 0)"!=e)return!0}())){var t=E.data.book.chapter.viewport?1:.8,n=E.data.book.chapter.viewport?100:70;if(!(Math.abs(e.gesture.velocityX)<t||Math.abs(e.gesture.distance)<n||1<e.gesture.touches.length))return!0}}function N(){return!(e.path()&&0<=e.path().indexOf("/reader"))}function L(){m&&clearTimeout(m),m=setTimeout(function(){kotobee.dispatchEvent("transformationChanged")},500)}function B(e,t){e=S.getFxlFit({scale:e/t});I.getOb("epubContainer").style.setProperty("padding-left",e.marginLeft-0+"px","important")}function M(){if(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullscreenElement||document.msFullscreenElement)return document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozExitFullscreen?document.mozExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen(),!0}return S.options={},S.init=function(e){mobile&&(n.on("swipeleft",S.swipeLeft,e),n.on("swiperight",S.swipeRight,e)),n.on("dragstart",S.dragStart,e),n.on("drag",S.drag,e),n.on("tap",S.tap,e),n.on("doubletap",S.fxlToggleTapZoom,e),n.on("transformstart",S.transformstart,e),n.on("transformend",S.transformend,e),p||(window.addEventListener("resize",S.windowResize,!0),y.width=window.innerWidth,y.height=window.innerHeight,mobile||C(),i.addListener(x),p=!0,S.addListener("widescreenChanged",function(){setTimeout(S.fxlZoomFit,400)}),document.body.addEventListener("keyup",function(e){27==e.keyCode&&M()}))},S.resetEpubContainer=function(e){var t=document.getElementsByClassName("perspectiveContainer")[0],n=I.getOb("epubContainer");angular.element(n).scope().$destroy(),n.parentNode.removeChild(n);for(var o=u._instances.length;o--;)"content"==u._instances[o].$$delegateHandle&&u._instances.splice(o,1);var r='<ion-content id="epubContainer" ng-controller="ContentCtrl" class="ebook-content has-header has-footer" ng-init="init()"                             has-header="true" has-footer="true" delegate-handle="content" padding="true"                             scroll="true" direction="xy" zooming="true" overflow-scroll="'+!e+'" tabIndex="0" has-bouncing="true"                     on-touch="mouseDown()" on-release="mouseUp()" on-scroll="scroll()" mouse-events ';mobile&&(r+='has-bouncing="true" header-shrink="reader"');var i=a(r+='><div id="epubInner"></div>            </ion-content>')(s);t.insertBefore(i[0],t.firstChild),I.setOb("epubContainer",document.getElementById("epubContainer"))},S.addListener=function(e,t){k.push({event:e,func:t})},S.windowResize=function(){N()||y.width==window.innerWidth&&y.height==window.innerHeight||(S.fxlZoomFit(),y.width=window.innerWidth,y.height=window.innerHeight,mobile||C(),i.regenerateSpreads({resize:!0}))},S.getScroller=function(){return f},S.transformstart=function(){S.transforming=!0,E.data.book.chapter.viewport&&(function(e){if(!e){var t=I.getOb("epubContainer");(e=t.getElementsByClassName("scroll")).length&&(e=e[0])}e&&deleteTransformOrigin(e)}(),h=(new Date).getTime(),g=S.getFxlScale(),T("margin"))},S.transformend=function(){if(S.transforming=!1,!N()){if(E.data.book.chapter.viewport){var e=(new Date).getTime(),t=S.getFxlScale();if(mobile&&t<g&&e-h<800)return void S.fxlZoomFit();var n=S.getFxlFit(null,"from transformend").bestFit;t<n?(u.$getByHandle("content").zoomTo(n,!0),t=n):3<t&&(u.$getByHandle("content").zoomTo(3,!0),t=n),O(3,"transformend"),setTimeout(l.refreshMarkers,1e3),S.repaint()}else{if(!config.textSizeControls)return;var o=f.getScrollPosition().zoom,r=d.getTextSize(),i=Math.round(o*r*10)/10;i<.2&&(i=.2),E.data.settings.textSize=i+"em",d.updateTextSize(),d.writeTextSize(),f.zoomTo(1,!0);var a=angular.element(I.getOb("epubContent")).scope();a.header.mode="textSize",a.$$phase||a.$apply(),setTimeout(l.refreshMarkers,1e3)}L()}},S.repaint=function(){redrawForChrome(I.getOb("epubContent"))},S.resize=function(){(f=f||u.$getByHandle("content")).resize()},S.swipeRight=function(e){N()||A(e)&&(f.resize(),native&&t.vibrate(),E.data.settings.rtl?i.nextChapter():i.prevChapter())},S.swipeLeft=function(e){N()||A(e)&&(f.resize(),native&&t.vibrate(),E.data.settings.rtl?i.prevChapter():i.nextChapter())},S.dragStart=function(){N()||(E.data.book.chapter.viewport||f.zoomTo(1,!1),b=0,f.freezeScroll(!1))},S.drag=function(e){b++},S.tap=function(e){w("tap",e)},S.fxlToggleTapZoom=function(e){try{if(!e.gesture.srcEvent.isTrusted)return}catch(e){}if(!S.options.doubletapDisabled&&I.getOb("epubContent")&&E.data.book.chapter.viewport&&E.data.book.chapter.viewport.width){var t=S.getFxlScale(),n=S.getFxlFit(null,"from fxlToggleTapZoom").bestFit,o=f.getScrollView().options.minZoom;if(null==o&&(o=t-1),Math.round(100*t)!=Math.round(100*n)&&o<t)S.fxlZoomFit(e);else{var r=2*S.getFxlFit(null,"from fxlToggleTapZoom").bestFit,i=S.getFxlFit(null,"from fxlToggleTapZoom");u.$getByHandle("content").zoomTo(r,!0,e.gesture.center.pageX-i.marginLeft,e.gesture.center.pageY-i.marginTop),c.reset(),B(r,i.bestFit),T("margin"),O(r)}setTimeout(l.refreshMarkers,1e3),setTimeout(S.repaint,1e3),L()}},S.fxlZoomIn=function(e){c.reset();var t=1.2*S.getFxlScale(),n=S.getFxlFit(null,"from fxlZoomIn");n.bestFit;3<t&&(t=3),u.$getByHandle("content").zoomTo(t,!0),B(t,n.bestFit),T("margin");I.getOb("epubContent"),document.getElementById("readerBody");O(t),setTimeout(l.refreshMarkers,1e3),L()},S.fxlZoomOut=function(e){c.reset();var t=.8*S.getFxlScale(),n=S.getFxlFit(null,"from fxlZoomOut").bestFit;t<n&&(t=n),u.$getByHandle("content").zoomTo(t,!0),B(t,n),T("margin"),O(t),setTimeout(l.refreshMarkers,1e3),L()},S.fxlZoomFit=function(e){if(e=e||{},I.getOb("epubContent")&&E.data.book&&E.data.book.chapter.viewport&&E.data.book.chapter.viewport.width){c.reset();var t=S.getFxlFit(null,"from fxlZoomFit"),n=e.noAnim;f.zoomTo(t.bestFit,!n),S.fxlAdjustAlignment(),T("padding"),O(t.bestFit),setTimeout(l.refreshMarkers,1e3),L()}},S.fxlAdjustAlignment=function(e){(e=e||{}).epubContent||(e.epubContent=I.getOb("epubContent")),e.epubContainer||(e.epubContainer=I.getOb("epubContainer"));var t=S.getFxlFit(e,"from fxlAdjustAlignment"),n=getElemMargin(e.epubContent,{computed:!0});"auto"==n.left&&(n.left=0),"auto"==n.top&&(n.top=0);var o=e.newScale?e.newScale:t.widthFit;autoprefixTransform(e.epubContent,"scale("+o+")"),autoprefixTransformOrigin(e.epubContent,-n.left+"px "+-n.top+"px"),e.epubContainer.style.marginLeft=e.epubContainer.style.marginRight=null,e.epubContainer.style.paddingLeft=e.epubContainer.style.paddingRight=null,e.epubContainer.style.setProperty("padding-left",t.marginLeft+"px","important"),e.epubContainer.style.setProperty("padding-top",t.marginTop+"px","important");e.epubContainer.getElementsByClassName("scroll")[0];e.epubContainer.style.width=t.outerWidth+"px"},S.getSpreadHeight=function(e){for(var t=0,n=0;n<e.children.length;n++){var o=e.children[n];o.id&&0==o.id.indexOf("spread")&&(t=Math.max(t,Number(o.style.height.split("px")[0])))}return t},S.getSpreadWidth=function(e){for(var t=0,n=0;n<e.children.length;n++){var o=e.children[n];o.id&&0==o.id.indexOf("spread")&&(t+=Number(o.style.width.split("px")[0]))}return t},S.viewFromElem=function(e){for(var t={maxHeight:0,totalWidth:0},n=0;n<e.children.length;n++){var o=e.children[n];if(o.id&&0==o.id.indexOf("spread")){var r=Number(o.style.height.split("px")[0]),i=Number(o.style.width.split("px")[0]),a={width:i,height:r};"spreadL"==o.id?(t.leftOb||(t.leftOb={}),t.leftOb.viewport=a,t.leftOb.layout=hasClass(o,"fxl")?"fxl":"rfl",t.layout=t.leftOb.layout):"spreadR"==o.id&&(t.view="double",t.rightOb||(t.rightOb={}),t.rightOb.left=Number(o.style.left.split("px")[0]),t.rightOb.viewport=a,t.rightOb.layout=hasClass(o,"fxl")?"fxl":"rfl"),t.maxHeight=Math.max(r,t.maxHeight),t.totalWidth+=i}}return t.leftOb&&t.rightOb&&t.rightOb.left&&(t.totalWidth+=t.rightOb.left-t.leftOb.viewport.width),t},S.getFxlFit=function(e,t){(e=e||{}).viewport||(e.viewport=E.data.book.chapter.viewport);var n={};e.epubContent||(e.epubContent=I.getOb("epubContent"));var o=e.view;o=o||E.data.currentView;var r={x:0};e.epubContainer||(e.epubContainer=I.getOb("epubContainer"));var i=e.epubContainer.getElementsByClassName("scroll");i.length&&(r=getElemPadding(i[0],{computed:!0}),n.scrollContainer=i[0]),"auto"==r.x&&(r.x=0),"auto"==r.y&&(r.y=0);var a=getElemMargin(e.epubContent,{computed:!0}),s=getElemPadding(e.epubContent,{computed:!0}),c=a.x,l=a.y;"auto"==c&&(c=0),"auto"==l&&(l=0);var d=s.x,u=s.y;"auto"==d&&(d=0),"auto"==u&&(u=0),e.scale||(e.scale=1);var p=e.viewport.width*e.scale+c,f=e.viewport.height+l;if("double"==o){var h=S.viewFromElem(e.epubContent);p=h.totalWidth,f=h.maxHeight}var g=document.getElementById("readerBody"),m=document.getElementById("readerHeader"),v=document.getElementById("tabMenu"),b=g.getBoundingClientRect().width,y=g.getBoundingClientRect().height;mobile&&"alwaysShow"!=config.autohideReaderMode&&"showOnScroll"!=config.autohideReaderMode||(y-=m.getBoundingClientRect().height+v.getBoundingClientRect().height),e.includeScrollPadding||(b-=r.x,y-=r.y);var k=b/p,w=y/f;if(n.readerWidth=b,n.readerHeight=y,n.widthFit=k,n.heightFit=w,config.fitToScreen)n.bestFit=w<k?w:k,n.bestFitType=w<k?"vertical":"horizontal";else{var x=k;1<=x&&(x=1);var C=w/x;n.bestFitType="vertical",C<1&&.7<=C&&(x=w,n.bestFitType="vertical"),n.bestFit=x}return n.bestFit=n.bestFit/n.widthFit,n.innerWidth=p,n.innerHeight=f,n.outerWidth=b,n.outerHeight=y,n.marginLeft=Math.round((n.outerWidth-n.widthFit*n.bestFit*n.innerWidth)/2),n.marginTop=Math.round((n.outerHeight-n.widthFit*n.bestFit*n.innerHeight)/2),n.marginTop<0&&(n.marginTop=0),n},S.getFxlScale=function(){return u.$getByHandle("content").getScrollPosition().zoom},S.fullscreen=function(){var e=document.body;M()||(e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen())},S}]),app.factory("np",["stg","status","error","translit","$rootScope","crdv","$injector","modals","$http","$ionicSideMenuDelegate",function(a,e,t,n,o,r,s,i,c,l){var d,u,p,f,h,g,m,v,b,y={},k=kLog;return y.initialize=function(e){if(desktop){try{p=require("nw.gui"),require("child_process").exec,f=p.Window.get(),process.cwd(),(process.env.HOME||process.env.USERPROFILE)+"/Desktop",h=require("path").dirname(process.execPath),b=h+"/node_modules/","mac"==os&&(b=""),isReaderApp&&(b=""),debug||(b=""),d=require(b+"fs.extra"),require(b+"async"),u=require(b+"buckle"),g=p.App.dataPath,m=g+"/temp",v=g+"/Books",y.createIfNotExists(v),y.createIfNotExists(m);try{f.removeAllListeners()}catch(e){k("ERROR "+e,1)}f.on("close",function(){y.exit()})}catch(e){}e&&e()}else e&&e()},y.createIfNotExists=function(t,n){desktop&&d.exists(t,function(e){e?n&&n():y.createIfNotExists(ph.parent(t),function(){d.mkdirSync(t),n&&n()})})},y.createIfNoParentsExists=function(t,n){desktop&&d.exists(t,function(e){e?n&&n():y.createIfNoParentsExists(ph.parent(t),function(){d.mkdirSync(t),n&&n()})})},y.writeEbook=function(e,r,t,i){desktop&&y.createTempDir(function(n){var o=new FileReader;o.onload=function(){var e=ph.join(n,"book.zip");"mac"==os&&(e=n+"/book.zip"),d.writeFileSync(e,Buffer.from(new Uint8Array(o.result)));var t=ph.join(v,r.path);"mac"==os&&(t=v+"/"+r.path),y.extractZip(e,t,function(){r.exists=!0,a.data.downloaded.push(r),s.get("library").applyExistingBooks(a.data.currentLibrary.books),a.writeSlot("downloaded"+a.getBookId(!0),a.data.downloaded,function(){y.removeDirectory(n,function(){i&&i()})})})},o.readAsArrayBuffer(t)})},y.deleteEbook=function(t,n){y.removeDirectory(ph.join(v,t.path),function(){for(var e=0;e<a.data.downloaded.length;e++)a.data.downloaded[e].path==t.path&&(t.exists=!1,a.data.downloaded.splice(e,1),e--);a.writeSlot("downloaded"+a.getBookId(!0),a.data.downloaded,function(){n&&n()})})},y.fileExists=function(e,t){d.exists(e,function(e){t(e)})},y.removeFile=function(e,t){y.removeDirectory(e,t)},y.removeDirectory=function(e,t){d.rmrf(e,function(e){t&&t(e)})},y.extractZip=function(e,t,n){u.open(e,t,function(){d.readdir(t,n)})},y.readFile=function(e){return d.readFileSync(e)+""},y.writeFile=function(e,t,n){d.writeFileSync(e,t,n)},y.createTempDir=function(t){var n=m+"/f"+randStr(5);y.fileExists(n,function(e){e?y.createTempDir(t):d.mkdir(n,function(){t(n)})})},y.openLink=function(e){p.Shell.openExternal(e)},y.getBooksPath=function(){return v+"/"},y.writeArrayBuffer=function(e,t,n,o){var r=arrayBufferToBuffer(e);d.open(t,"w",function(e,t){if(e)throw"error opening file: "+e;d.write(t,r,0,r.length,null,function(e){e?o&&o(!1):d.close(t,function(){o&&o(!0)})})})},y.copy=function(n,e,t,o){if((t=t||{}).replace)for(var r=0;r<t.replace.length;r++)n=n.replace(t.replace[r].key,t.replace[r].val);t.header&&(n=t.header+n),t.footer&&(n+=t.footer),t.encoding||(t.encoding="ascii"),n=(n+="").replace(/\xA0/g," "),n=utf8Encode(n),d.writeFile(e,n,t.encoding,function(e,t){o&&o(n)})},y.exit=function(){a.getActions(function(e){if(e&&e.length){i.hide();var t={title:"confirmation",msg:"annotationsSyncExitWarning",barStyle:"bar-dark"},n={label:"delete",style:"button-assertive",func:function(){p.App.quit()}},o={label:"cancel",func:function(){i.hide()}};t.btns=[n,o],i.show({mode:"confirm",confirmOptions:t})}else p.App.quit()})},y}]),app.factory("payment",["$location","$ionicHistory","$injector","translit","stg","modals",function(s,c,l,a,d,u){var p={},f="http://localhost:8100",t=!1;function h(e){return"b"+("library"==config.kotobee.mode?e.id:"0")+"xid"+config.kotobee.cloudid}function o(e){return t?"android.test.purchased":e&&e.pricing&&e.pricing[device.platform.toLowerCase()+"inappid"]||""}function r(e){if("function"!=typeof l.get("bookinfo").getCurrentBook)return!1;var t=l.get("bookinfo").getCurrentBook();return t&&o(t)==e.id}function i(e){if(p.isInAppPurchaseEnabled())return e&&e!="com.kotobee."+d.data.currentLibrary.subdomain}function g(e){"function"==typeof l.get("bookinfo").inAppPurchaseCallback&&l.get("bookinfo").inAppPurchaseCallback(e)}function m(e){r(e)&&l.get("bookinfo").refetch(),e.finish(),l.get("bookinfo").setBusy(!1)}p.initialize=function(){if(config.kotobee.payment){if(d.data.payment||(d.data.payment={}),config.kotobee.payment.stripe){if(native);else if(!document.head.querySelector("#stripe-sdk"))(e=document.createElement("script")).id="stripe-sdk",e.src="https://js.stripe.com/v3/",document.head.appendChild(e);d.data.payment.stripe=!0,d.data.payment.stripeLogo=rootDir+"img/ui/payment/stripe.png"}if(config.kotobee.payment.paypal){var e;if(native);else if(!document.head.querySelector("#paypal-sdk"))(e=document.createElement("script")).id="paypal-sdk",e.src="https://www.paypal.com/sdk/js?client-id="+config.kotobee.payment.paypal.params.clientid+"&disable-funding=card",document.head.appendChild(e);d.data.payment.paypal=!0}config.kotobee.payment.moyasar&&(native||v.sdk(),d.data.payment.moyasar=!0,d.data.payment.moyasarLogo=rootDir+"img/ui/payment/moyasar.png"),p.isInAppPurchaseEnabled()&&(store.verbosity=store.QUIET,store.error(function(e){l.get("bookinfo").setBusy(!1),store.verbosity,store.QUIET}))}},p.getPaymentOptions=function(){var e=config.kotobee.payment?Object.keys(config.kotobee.payment).map(function(e){return{gateway:e,logo:d.data.payment?d.data.payment[e+"Logo"]:null}}):[];return e=native?e.filter(function(e){return-1!=e.gateway.indexOf("inapp")}):e.filter(function(e){return-1==e.gateway.indexOf("inapp")})},p.getOrderName=function(e){return e&&e.orderitems&&Array.isArray(e.orderitems)&&e.orderitems.length?e.orderitems.map(function(e){return e.book&&e.book.name?e.book.name:e.subscr&&e.subscr.name?e.subscr.name:"N/A"}).join(", "):"N/A"},p.renderPaypalButton=function(o,n){var r="paypal";!native&&config.kotobee.payment&&config.kotobee.payment.paypal&&setTimeout(function(){var e="#paypal-button-container";if(native);else{if(!document.body.querySelector(e)){var t=document.createElement("div");t.id=e.slice(1),document.body.querySelector("#paypal-button-wrapper").appendChild(t)}waitFor("paypal",function(){paypal.Buttons({style:{color:"blue",label:"pay"},createOrder:function(e,t){return new Promise(function(t,n){if(o.order)return t(o.order);var e={platform:r,accountemail:o.accountemail};"library"===config.kotobee.mode&&(e.items=JSON.stringify(o.items?o.items:[{type:"book",id:o.id}])),l.get("backend").createOrder(e,function(e){if(!e.order||!e.order.id)return n();t(e.order)})}).then(function(e){return t.order.create({payer:{email_address:o.accountemail?o.accountemail:d.data.user.email},purchase_units:[{reference_id:e.id,amount:{value:e.amount,currency_code:"USD",breakdown:{item_total:{value:e.amount,currency_code:"USD"}}},redirect_urls:{return_url:config.kotobee.liburl+"library/payment/paypalsuccess",cancel_url:config.kotobee.liburl},items:[{name:p.getOrderName(e),unit_amount:{value:e.amount,currency_code:"USD"},quantity:"1",sku:e.product}]}]})})},onApprove:function(e,t){return t.order.capture().then(function(e){l.get("backend").sendRawPost(config.kotobee.liburl+"library/payment/paypalsuccess",{checkoutid:e.id,bid:o.id},{responseType:"json"},function(e){e.error?(u.hide(),u.show({mode:"generalError",errorOptions:{msg:a.get(e.error)}})):n&&n()})})},onError:function(e){u.hide(),u.show({mode:"generalError",errorOptions:{msg:a.get("errorProcessingPayment")}})}}).render(e)})}},100)},p.registerInAppProducts=function(e){p.isInAppPurchaseEnabled()&&(e.forEach(function(e){var t=o(e);!store.get(t)&&i(t)&&(store.register({id:t,alias:h(e),type:store.CONSUMABLE}),store.when(t).updated(function(e){r(e)&&(e.state==store.APPROVED&&p.isCurrentUserID(e)&&e.finish(),g(e))}),store.when(t).approved(function(n){r(n)&&p.validateInAppPurchase(n,function(e,t){e?m(n):(l.get("bookinfo").setBusy(!1),u.hide(),u.show({mode:"generalError",errorOptions:{msg:a.get(t.error.message)}}))})}),store.when(t).cancelled(function(e){}))}),store.refresh().finished(function(){}).cancelled(function(){}).failed(function(e){}))},p.isInAppPurchaseEnabled=function(){return!!native&&(!!config.kotobee.payment&&(!!window.store&&(config.kotobee.payment.iosinapp||config.kotobee.payment.androidinapp)))},p.isCurrentUserID=function(e){return!!e.additionalData&&e.additionalData.applicationUsername==d.data.user.id},p.handleInAppProduct=function(e){if(p.isInAppPurchaseEnabled()){var t=o(e);if(i(t)){var n=store.get(t);n&&n.loaded&&!n.valid?g():store.update()}else g()}},p.validateInAppPurchase=function(n,o,r){try{r=r||{},n&&n.id?"function"!=typeof o?o(!1,{code:store.INTERNAL_ERROR,error:{message:a.get("internalError")}}):n.transaction?function(t,n){n&&(t&&t.id||n(!1),d.readSlot("in-app-transactions",function(e){n(e.find(function(e){return e.uid=d.data.user.id&&e.tid==t&&e.type==t.type}))}))}(n.transaction,function(e){var t;e?o(!0,n.transaction):(r.cache&&(t=JSON.parse(sessionStorage.getItem("transaction"+n.transaction.id)||"{}")),t?i(t):l.get("backend").sendRawPost(config.kotobee.liburl+"library/payment/inapp",{id:n.id,cloudid:n.transaction.cloudid,priceMicros:n.priceMicros,currency:n.currency,transactionType:n.transaction.type,transactionReceipt:n.transaction.receipt,transactionPurchaseToken:n.transaction.purchaseToken,transactionAppStoreReceipt:n.transaction.appStoreReceipt,applicationUsername:String(d.data.user.id)},{requestType:"json",responseType:"json"},i))}):o(!1,{code:store.INVALID_PAYLOAD,error:{message:a.get("invalidTransaction")}}):o(!1,{code:store.NEED_MORE_DATA,error:{message:a.get("invalidProductId")}})}catch(e){o(!1,{code:store.NEED_MORE_DATA,error:{message:e.message||e.toString()}})}function i(e){r.cache&&sessionStorage.setItem("transaction"+n.transaction.id,JSON.stringify(e)),e.error?o(!1,{code:e.error.code?store[e.error.code]:0,error:{message:a.get(e.error.message||e.error.toString())}}):e.success?(n.transaction&&n.transaction.id&&function(t){d.readSlot("in-app-transactions",function(e){e.push({uid:d.data.user.id,tid:t.id,type:t.type}),d.writeSlot("in-app-transactions",e.filter(function(t,e,n){return n.findIndex(function(e){return e.uid==t.uid&&e.tid==t.tid&&e.type==t.type})==e}))})}(n.transaction),o(!0,n.transaction)):o(!1,{code:store.INVALID_PAYLOAD,error:{message:a.get("invalidTransaction")}})}},p.makePayment=function(n,o){var r=o.bookOb;if(-1==n.indexOf("inapp")){if("paypal"!=n){var e={platform:n,accountemail:o.paymentEmail};"library"===config.kotobee.mode&&(e.items=JSON.stringify([{type:"book",id:r.id}])),l.get("backend").createOrder(e,function(e){if(e.order&&e.order.id){if("moyasar"===n){var t={orderid:e.order.id,redirecturl:native?f:window.location.protocol+"//"+window.location.host+window.location.pathname,price:100*+o.bookOb.price,name:o.bookOb.name||"N/A"};return v.payment(t)}"stripe"===n&&p.stripeMakePayment(n,{order:e.order},o,r)}})}}else{if(!window.store)return;var t=h(r),i=store.get(t);i&&i.loaded&&(i.canPurchase||i.owned)&&(store.getApplicationUsername()||(store.applicationUsername=""+d.data.user.id),store.order(t).error(function(e){l.get("bookinfo").setBusy(!1)}),l.get("bookinfo").setBusy(!0))}};var v={delay:2e3,url:null,sdk:function(){!function(){if(!document.getElementById("moyasar-style")){var e=document.createElement("link");e.id="moyasar-style",e.rel="stylesheet",e.href="https://cdn.moyasar.com/mpf/1.5.0/moyasar.css",document.head.appendChild(e)}}(),function(){if(!document.getElementsByClassName("mysr-form")[0]){var e=document.createElement("div");e.className="mysr-form";var t=document.createElement("div");t.className="moyasar-form-warpper";var n=document.createElement("button");n.type="button",n.className="moyasar-form-warpper--closeBtn",n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"></path></svg>',n.addEventListener("click",function(e){t&&"block"==t.style.display&&v.resetMoyasar()}),t.appendChild(n),t.appendChild(e),document.body.appendChild(t)}}(),[{src:"https://polyfill.io/v3/polyfill.min.js?features=fetch",id:"moyasar-polyfill"},{src:"https://cdn.moyasar.com/mpf/1.5.0/moyasar.js",id:"moyasar-sdk"}].forEach(function(e){if(!document.getElementById(e.id)){var t=document.createElement("script");t.id=e.id,t.src=e.src,document.body.appendChild(t)}})},payment:function(o,r){if(!native){v.resetMoyasar(),v.sdk();var e={element:".mysr-form",amount:o.price,currency:"USD",description:o.name,publishable_api_key:config.kotobee.payment.moyasar.params.clientid,methods:["creditcard"],metadata:o,callback_url:config.kotobee.liburl+"library/payment/moyasar_redirect?orderid="+o.orderid,on_redirect:function(e){v.url=e},on_completed:function(e){var t=config.kotobee.liburl+"library/payment/moyasar_save_payment",n="&orderid="+o.orderid+"&paymentid="+e.id;v.ajax(t,n,r)},on_failure:function(e){}};Moyasar.init(e),v.showMoyasar()}},ajax:function(e,t,n){var o=new XMLHttpRequest;o.open("POST",e,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4===o.readyState)if(4===o.readyState&&200<=o.status&&o.status<=299){var e=JSON.parse(o.responseText);e.success?(n&&n(),v.success()):e.error&&v.error(e.error)}else v.error()},o.onerror=function(e){v.error(e)},o.send(t)},success:function(){setTimeout(function(){null!==v.url&&window.location.replace(v.url)},v.delay)},error:function(e){v.tryAgain()},tryAgain:function(){v.resetMoyasar(),kotobee.popup(a.get("moyasarErrorMessageDesc"),{title:a.get("moyasarErrorMessageTitle"),okBtn:a.get("ok"),raw:!1,noBackdrop:!1,cb:function(){}})},resetMoyasar:function(){v.url=null;var e=document.getElementsByClassName("moyasar-form-warpper")[0];e&&e.remove();var t=Array.from(document.getElementsByClassName("paymentOption"));t.length&&t.forEach(function(e){if(e){var t=e.getElementsByTagName("a")[0];t&&-1===t.className.split(" ").indexOf("enableBtn")&&(t.className+=" enableBtn")}})},showMoyasar:function(){var e=document.getElementsByClassName("moyasar-form-warpper")[0];e&&(e.style.display="block")}};return p.moyasarSettings=v,p.stripeMakePayment=function(t,e,n,o,r){var i=config.kotobee.liburl+"library/payment/getstripesession",a={url:native?f:window.location.protocol+"//"+window.location.host+window.location.pathname};a.gateway=t,a.gatewayid=config.kotobee.payment[t].id,a.orderid=e.order.id,l.get("backend").sendRawPost(i,a,{responseType:"json"},function(e){e.error||(e.success?(r&&r(),native?function(e,t){if(cordova.InAppBrowser){var n="location=no,hidden=no,clearsessioncache=yes,clearcache=yes,closebuttoncaption=Go back to App,toolbar="+(ios?"yes":"no")+",presentationstyle=formsheet",r=cordova.InAppBrowser.open("about:blank","_blank",n);r.addEventListener("loadstart",function(e){if(0===e.url.indexOf(f)){r.close();var t=new URL(e.url),n=new URLSearchParams(t.search),o="/payment/"+n.get("gateway")+"/success/"+n.get("book_id")+"/"+n.get("user_id");u.hide(),s.path(o),c.clearHistory()}}),r.addEventListener("loadstop",function(){r.executeScript({code:t})}),r.addEventListener("loaderror",function(e){if(!ios)try{r&&r.close()}catch(e){}}),r.addEventListener("exit",function(e){})}}(0,"var script = document.createElement('script');                      script.src = 'https://js.stripe.com/v3/';                      script.onload = function() {                          var stripe = Stripe('"+config.kotobee.payment[t].params.clientid+"');                          stripe.redirectToCheckout({                              sessionId:'"+e.session+"'                          }).then(function(result) {                              console.error(result.error.message);                          });                      };                      document.head.appendChild(script);"):waitFor("Stripe",function(){Stripe(config.kotobee.payment[t].params.clientid).redirectToCheckout({sessionId:e.session}).then(function(e){})})):(a.cloudid=config.kotobee.cloudid,a.accountemail=n.paymentEmail))})},p}]),app.factory("popovers",["$ionicPopover","$q","$rootScope",function(e,n,o){var r,i,t={},a=[];t.setScope=function(e){i=e,r||s()};var s=function(){var t=n.defer();return i=i||o,e.fromTemplateUrl(kTemplate("modals/popovers.html"),{scope:i}).then(function(e){r=e,t.resolve()}),t.promise};function c(){if(0!=a.length){var e=a.shift();e.apply?i.$apply(function(){i.popover=e}):i.popover=e,r&&(r.isShown()||r.show(e.event))}}return t.show=function(e){r?(a.push(e),1==a.length&&c()):s().then(function(){t.show(e)})},t.shown=function(){return!!r&&r.isShown()},t.hide=function(){r&&(i.popover=null,r&&r.hide(),c())},t}]),app.factory("scorm",["$injector",function(i){var f,h,a,g={};function s(){a.doLMSCommit("")}function m(e,t,n){var o=v(e+"."+t+"."+n);return o&&""!=o||(o=v(e+"_"+t+"."+n)),o}function v(e){return a.doLMSGetValue(e)}function b(e,t){return a.doLMSSetValue(e,t)}return g.initialize=function(){if(!(config.v<1.2)){kInteractive.scorm=this;try{if(!scormEnabled)return}catch(e){return}(a=i.get("scormWrapper")).doLMSInitialize(""),1.2==(h=a.getAPIVersion())?"not attempted"==v("cmi.core.lesson_status")&&(b("cmi.core.lesson_status","browsed"),s()):"not attempted"==v("cmi.completion_status")&&(b("cmi.completion_status","unknown"),s()),f=function(){try{var e=v("cmi.suspend_data");return JSON.parse(e)}catch(e){return[]}}();try{for(var e=0;e<config.scorm.objectives.length;e++){for(var t=Number(v("cmi.objectives._count")),n=t=t||0,o=config.scorm.objectives[e],r=0;r<t;r++)m("cmi.objectives",r,"id")==o.id&&(n=r);b("cmi.objectives."+n+".id",o.id),1.2!=h&&b("cmi.objectives."+n+".description",o.name)}}catch(e){}s()}},g.setBookmark=function(e,t){try{if(!scormEnabled)return}catch(e){return}b(1.2==h?"cmi.core.lesson_location":"cmi.location",e),t||s()},g.getBookmark=function(){try{if(!scormEnabled)return}catch(e){return}return v(1.2==h?"cmi.core.lesson_location":"cmi.location")},g.setInteractions=function(e){try{if(!scormEnabled)return}catch(e){return}for(var t=0;t<e.length;t++){for(var n=f.length,o=0;o<f.length;o++)f[o].id==e[t].id&&(n=o);f[n]=e[t],g.setInteraction(n,e[t],!0)}!function(){if(!f.length)return;for(var e=Number(v("cmi.objectives._count")),t={},n=0;n<f.length;n++)t[f[n].qid]=f[n];for(n=0;n<e;n++){var o=v("cmi.objectives."+n+".id");if(o){var r=0;for(var i in t)t[i].objective==o&&(r+=t[i].scoreMax);g.setObjective({id:o,scoreMax:r},!0),g.setObjective({id:o,scoreRaw:0},!0)}}r=0;for(var i in t)r+=t[i].scoreMax;b(1.2==h?"cmi.core.score.max":"cmi.score.max",r),b(1.2==h?"cmi.core.score.min":"cmi.score.min",0),b(1.2==h?"cmi.core.score.raw":"cmi.score.raw",0);for(var a=0;a<f.length;a++){var s=f[a],c=null,l=null;for(n=0;n<e;n++)s.objective==m("cmi.objectives",n,"id")&&(c=s.objective,l=n);if(c){var d=Number(v("cmi.objectives."+l+".score.raw"));d=d||0;var u={};u.id=c,u.scoreRaw=s.result*s.weighting+d,u.scoreMin=0,u.scoreScaled=u.scoreRaw/u.scoreMax,u.completionStatus="unknown",u.successStatus="unknown",g.setObjective(u,!0)}var p=Number(v(1.2==h?"cmi.core.score.raw":"cmi.score.raw"));p=p||0,b(1.2==h?"cmi.core.score.raw":"cmi.score.raw",s.result*s.weighting+p)}}(),function(e){try{b("cmi.suspend_data",JSON.stringify(e))}catch(e){}}(f),s()},g.setInteraction=function(e,t,n){try{if(!scormEnabled)return}catch(e){return}t.id&&b("cmi.interactions."+e+".id",t.id),t.result&&b("cmi.interactions."+e+".result",t.result),t.correctResponses&&b("cmi.interactions."+e+".correct_responses.0.pattern",t.correctResponses),t.type&&b("cmi.interactions."+e+".type",t.type),t.weighting&&b("cmi.interactions."+e+".weighting",t.weighting),t.objective&&b("cmi.interactions."+e+".objectives.0.id",t.objective),1.2==h?(t.timestamp&&b("cmi.interactions."+e+".time",function(e){var t=e.getSeconds();t<10&&(t="0"+t);var n=e.getMinutes();n<10&&(n="0"+n);var o=e.getHours();return o<10&&(o="0"+o),o+":"+n+":"+t}(t.timestamp)),t.latency&&b("cmi.interactions."+e+".latency",function(e){var t=Math.floor(e/3600);e-=60*t*60;var n=Math.floor(e/60);return(e-=60*n)<10&&(e="0"+e),t<10&&(t="0"+t),n<10&&(n="0"+n),t+":"+n+":"+e}(t.latency)),t.learnerResponses&&b("cmi.interactions."+e+".student_response",t.learnerResponses)):(t.timestamp&&b("cmi.interactions."+e+".timestamp",function(e){var t=e.toISOString().split(".");return t.splice(t.length-1,1),t.join(".")}(t.timestamp)),t.latency&&b("cmi.interactions."+e+".latency",function(e){var t=e,n=Math.floor(t/31104e3);t=e-31104e3*n;var o=Math.floor(t/2592e3);t=e-2592e3*o;var r=Math.floor(t/86400);t=e-86400*r;var i=Math.floor(t/3600);t=e-3600*i;var a=Math.floor(t/60);return"P"+n+"Y"+o+"M"+r+"DT"+i+"H"+a+"M"+(t=e-60*a)+"S"}(t.latency)),t.learnerResponses&&b("cmi.interactions."+e+".learner_responses",t.learnerResponses),t.description&&b("cmi.interactions."+e+".description",t.description)),n||s()},g.setObjective=function(e,t){try{if(!scormEnabled)return}catch(e){return}for(var n=Number(v("cmi.objectives._count")),o=n,r=0;r<n;r++)m("cmi.objectives",r,"id")==e.id&&(o=r);null!=e.id&&b("cmi.objectives."+o+".id",e.id),null!=e.scoreRaw&&b("cmi.objectives."+o+".score.raw",e.scoreRaw),null!=e.scoreMin&&b("cmi.objectives."+o+".score.min",e.scoreMin),null!=e.scoreMax&&b("cmi.objectives."+o+".score.max",e.scoreMax),1.2==h?null!=e.successStatus&&b("cmi.objectives."+o+".status",e.successStatus):(null!=e.description&&b("cmi.objectives."+o+".description",e.description),null!=e.successStatus&&b("cmi.objectives."+o+".success_status",e.successStatus),null!=e.completionStatus&&b("cmi.objectives."+o+".completion_status",e.completionStatus),null!=e.scoreScaled&&b("cmi.objectives."+o+".score.scaled",e.scoreScaled)),t||s()},g.setManual=function(e,t){b(e,t),s()},g.interactionExistsOld=function(e){try{if(!scormEnabled)return}catch(e){return}for(var t=Number(v("cmi.interactions._count")),n=0;n<t;n++)if(m("cmi.interactions",n,"id")==e)return!0},g.interactionExists=function(e){try{if(!scormEnabled)return}catch(e){return}for(var t=0;t<f.length;t++)if(f[t].id==e)return!0},g.objectiveExists=function(e){try{if(!scormEnabled)return}catch(e){return}for(var t=Number(v("cmi.objectives._count")),n=0;n<t;n++)if(m("cmi.objectives",n,"id")==e)return!0},g}]),app.factory("sdk",["$document","$injector","cache","selection","skeleton","chapters","stg","$filter",function(e,t,n,o,r,i,a,s){var c={};return c.initialize=function(){},c}]),app.factory("search",["$http","error","book","$rootScope","modals","status","$location","chapters","cache","$timeout","traverser","$filter","translit","virt","selection","stg",function(e,t,n,c,l,d,o,u,r,i,s,a,p,f,h,g){var m,v={};function b(e,i,a,t){if(e)if(0!=e.children.length){for(var n=0;n<e.children.length;n++)0!=r(e.children[n])&&(t=!1,hasClass(e.children[n],"k-section")&&f.checkIfRequiresParse(e.children[n]),b(e.children[n],i,a,!0));t&&o(e)}else 0<r(e)&&o(e);function o(e){for(var t=e,n=s.convertElemsToLocation([t],i).left,o='<span class="searchItem">'+t.textContent+"</span>",r=(o.toLowerCase().indexOf(v.key.toLowerCase()),o.length+Math.round((70-o.length)/2));t.previousSibling&&!(o.length>=r);)t.previousSibling.textContent&&(o=t.previousSibling.textContent+o),t=t.previousSibling;o.length;for(t=e;t.nextSibling&&!(70<=o.length);)t.nextSibling.textContent&&(o+=t.nextSibling.textContent),t=t.nextSibling;v.result[a].matches.push({chapter:a,elem:e,hint:o.trim(),location:n})}function r(e){return(e.textContent.toLowerCase().match(new RegExp(v.key.toLowerCase(),"g"))||[]).length}}function y(){for(var e=0,t=v.result.length;t--;)if(v.result[t])for(var n=v.result[t].matches.length;n--;)e++;return e}function k(r,i){var e=g.data.epub.spine.getElementsByTagName("itemref");return r>e.length-1?i(!1):(r=m[r],u.getPageOb({page:r,dontParse:!0},function(e){var t=document.createElement("div"),n=parseHtml(e.raw?e.raw:e.content),o=n.getElementById("epubContent");t.appendChild(o);n.getElementsByTagName("title");v.result[r]=[],v.result[r].title=e.title,v.result[r].matches=[],a("contentVirt")("parse",o,function(e){b(e,e,r),i(!0)})}))}return v.start=function(e,t){if(v.key=e.key,e.array?v.result=e.array:v.result=new Array,"all"==e.mode)!function(t,n){var o=0;t.start&&(o=t.start);m=function(){for(var e=[],t=g.data.epub.spine.getElementsByTagName("itemref"),n=0;n<t.length;n++)e.push(u.getUnanchoredIndex(n));return e}();var r=y(),i=function(e){t.limit&&y()-r>=t.limit?n({results:v.result,more:!0,key:v.key}):e?k(++o,i):n({results:v.result,key:v.key})};k(o,i)}(e,t);else if("chapter"==e.mode){var n=r.getOb("epubContent");v.result[currentIndex]=[],v.result[currentIndex].matches=[],b(n,n,currentIndex),t({results:v.result,key:v.key})}},v.removeHighlights=function(){for(var e=document.getElementsByClassName("searchItemHighlight"),t=e.length;t--;)removeClass(e[t],"searchItemHighlight")},v.searchItemClicked=function(e,t,n){t=t||{};var o=e.item,r=e.index,i=e.matches;function a(){d.update(p.get("pleaseWait"),null,{dots:!0}),u.addListener(s);var t=o.chapter,n=o.location;u.getPageOb({page:t},function(e){if(v.removeHighlights(),e.pages&&e.pages.length);u.redirect(t,{hash:n}),c.$$phase||c.$apply()})}function s(e){"renderedChapter"==e&&(d.update(),u.removeListener(s),i.index=r,c.renderScope.applyHeader("searchItems"),n&&n())}l.hide(),t.timer?timeOut(a,300):a()},v}]),app.factory("selection",["markers","cache","error","stg","virt","$rootScope","$injector","traverser","$ionicScrollDelegate","translit",function(a,s,e,n,o,t,r,c,l,d){var u,p,f,h,g,m,v,b,y,k,w,x,C,I,E,S,T,O,A,N,L,B={};function M(e){return 0<parents(e,{stopAtIds:["spreadL","spreadR"],filterByClass:"ki-noHighlight"}).length}B.getLocation=function(){return E},B.elementDown=function(e,t){k=e;var n=!0;mobile||("a"==e.nodeName.toLowerCase()&&(n=!1),M(e)&&(n=!1),e.parentNode&&"a"==e.parentNode.nodeName.toLowerCase()&&(n=!1),n&&addClass(e,"highlightOver")),redrawForChrome(k.parentElement);var o=mobile&&!mobileDebug?400:100;if(n||(o*=4),x=setTimeout(B.elementHeld,o),mobile&&!mobileDebug){if(!t.touches||!t.touches.length)return;I=t.touches[0],A=I.clientX,N=I.clientY}else A=t.clientX,N=t.clientY,I=t;document.body.addEventListener(mobile&&!mobileDebug?"touchend":"mouseup",B.elementUp),document.body.addEventListener(mobile&&!mobileDebug?"touchmove":"mousemove",R)};var R=function(e){I=mobile&&!mobileDebug?e.touches[0]:e,"activated"==S&&e.stopPropagation()};function P(e){g=e.parents1,m=e.parents2,v=e.index1,b=e.index2,y=e.commonParent,C=e.reversed}function D(e){return 8==e.nodeType||"#text"==e.nodeName||"br"==e.nodeName.toLowerCase()||(0==e.offsetWidth||void 0)}B.elementUp=function(e){k&&(mobile||removeClass(k,"highlightOver"),k=null,clearTimeout(x)),L&&removeClass(s.getOb("epubContent"),"disableEvents"),L=!1,document.body.removeEventListener(mobile&&!mobileDebug?"touchend":"mouseup",B.elementUp),document.body.removeEventListener(mobile&&!mobileDebug?"touchmove":"mousemove",R),t.$$phase||t.$apply()},B.elementHeld=function(){k&&(r.get("nav").transforming||I&&(Math.abs(I.clientX-A)>(mobile?30:10)||Math.abs(I.clientY-N)>(mobile?30:10)||M(k)||(addClass(k,"highlightSelected"),W(k),B.elementUp())))},B.getSelectedText=function(e){e=e||document.getElementsByClassName("highlightSelected");for(var t="",n=0;n<e.length;n++)t+=e[n].textContent;return t},B.expand=function(){f=f.parentNode,P(c.analyzeNodes(f,h)),f=h=y,$(),mobile&&F(),H()},B.extendRight=function(e){if(e||"rtl"!=getComputedStyle(f).direction){if(C){var t=c.nextTextNode(f,s.getOb("epubContent"));if(D(f=t.parentNode))return void B.extendRight(e)}else{t=c.nextTextNode(h,s.getOb("epubContent"));if(D(h=t.parentNode))return void B.extendRight(e)}P(c.analyzeNodes(f,h)),$(),mobile&&F(),H()}else B.extendLeft(!0)},B.extendLeft=function(e){if(e||"rtl"!=getComputedStyle(f).direction){if(C){var t=c.prevTextNode(f,s.getOb("epubContent"));if(D(h=t.parentNode))return void B.extendLeft(e)}else{t=c.prevTextNode(f,s.getOb("epubContent"));if(D(f=t.parentNode))return void B.extendLeft(e)}P(c.analyzeNodes(f,h)),$(),mobile&&F(),H()}else B.extendRight(!0)},B.newChapter=function(){mobile&&(a.deleteMarker("anchor1Marker"),a.deleteMarker("anchor2Marker"),u=B.createAnchorMarker("anchor1"),p=B.createAnchorMarker("anchor2"),addClass(u,"disable"),addClass(p,"disable"))};var F=function(){a.refreshMarkerById("anchor1Marker"),a.refreshMarkerById("anchor2Marker")},H=function(){return E=c.convertElemsToLocation(document.getElementsByClassName("highlightSelected"))};B.refreshSelectionLocation=H;var $=function(){try{if(_(),addClass(f,"highlightSelected"),addClass(h,"highlightSelected"),f==h)return void(E={left:c.getAbsoluteIndex(f)});if(f==y)return void(E={left:c.getAbsoluteIndex(f)});if(h==y)return void(E={left:c.getAbsoluteIndex(h)});U(C?h:f,C?f:h)}catch(e){}},U=function(e,t,n){var o;if("first"==(n=n||"first")){if(e.parentNode==y)return void U(e,t,"second");for(o=e;(o=o.nextSibling)&&o;)"#text"!=o.nodeName&&8!=o.nodeType&&addClass(o,"highlightSelected");U(e.parentNode,t,"first")}else if("second"==n){if(t.parentNode==y)return void U(e,t,"third");for(o=t;(o=o.previousSibling)&&o;)"#text"!=o.nodeName&&8!=o.nodeType&&addClass(o,"highlightSelected");U(e,t.parentNode,n)}else if("third"==n){var r,a=C?m[b-1]:g[v-1],s=C?g[v-1]:m[b-1];for(i=0;i<y.childNodes.length;i++)if(a!=y.childNodes[i]){if(s==y.childNodes[i])break;r&&"#text"!=y.childNodes[i].nodeName&&8!=y.childNodes[i].nodeType&&addClass(y.childNodes[i],"highlightSelected")}else r=!0}},_=function(){try{var e=document.getElementsByClassName("highlightSelected");if(!e)return;for(var t=e.length;t--;)removeClass(e[t],"highlightSelected");mobile&&o.forceRepaint()}catch(e){}};function j(e){var t=1;return n.data.book.chapter.viewport&&(t=r.get("nav").getFxlScale()),e.getBoundingClientRect().width/t}B.listener=null,B.addSpanAtCloseTag=function(){var e=document.createElement("span"),t=C?f:h;return t.parentNode.insertBefore(e,t.nextSibling),e},B.getSelectedNodes=function(){return document.getElementsByClassName("highlightSelected")},B.reset=function(){_(),mobile&&(u&&(addClass(u,"disable"),addClass(p,"disable")),p&&(removeClass(u,"tween"),removeClass(p,"tween"))),C=S=null,B.listener&&B.listener("deactivated")},B.deleteNoteMarker=function(e){var t=document.getElementById("knote"+e);t&&t.parentNode&&t.parentNode.removeChild(t),a.deleteMarker("noteMarker"+e)},B.getNoteMarker=function(e){return a.getMarker("noteMarker"+e)},B.createAnchorMarker=function(o){var t=document.createElement("span");return t.setAttribute("id",o+"Marker"),t.setAttribute("anchor",o),addClass(t,"anchorMarker"),s.getOb("epubMeta").appendChild(t),t.addEventListener(mobileDebug?"mousedown":"touchstart",function(e){addClass(w=t,"selected"),O=null,document.addEventListener(mobileDebug?"mousemove":"touchmove",z),T&&clearInterval(T),T=setInterval(V,60),document.addEventListener(mobileDebug?"mouseup":"touchend",q),addClass(s.getOb("epubContent"),"defaultCursor"),S="anchorDragged",e.stopPropagation()}),a.addMarker({id:o+"Marker",elem:t,offsetTop:-45,offsetLeft:-10,target:function(){var e,t=0;if("anchor1"==o){if(!(e=f))return void(this.offsetLeft=-10);try{n="rtl"==getComputedStyle(e).direction}catch(e){}t=C?n?0:j(e):n?j(e):0}else{if(!(e=h))return void(this.offsetLeft=-10);var n;try{n="rtl"==getComputedStyle(e).direction}catch(e){}t=C?n?j(e):0:n?0:j(e)}return this.offsetLeft=-10+t,e}}),t},B.createNoteMarker=function(n,e,t){if(t=t||{},!document.getElementById("knote"+n.nid)){var o=document.createElement("span");o.setAttribute("id","knote"+n.nid),addClass(o,t.class?t.class:"contentNoteMarker"),s.getOb("epubMeta").appendChild(o);var r=0;return r=r||0,r=-18,a.addMarker({id:"noteMarker"+n.nid,elem:o,offsetTop:r,target:function(){return hasClass(this.elem,"contentNoteMarker")?this.offsetLeft=j(e)-13:this.offsetLeft=0,hasClass(this.elem,"contentNoteMarker")||this.offsetTop<10&&(this.offsetTop=10),e},callback:function(){var t=this;a.checkMarkerExistsAtSameLocation(this.elem,function(e){return e?(t.offsetTop+=39,void a.refreshMarker(t)):n.callback?n.callback():void 0})}}),o}},B.deleteBookMarker=function(e){var t=document.getElementById("bookmark"+e);t&&t.parentNode&&t.parentNode.removeChild(t),a.deleteMarker("bookMarker"+e)},B.createBookMarker=function(n,e){var t=document.createElement("span");t.setAttribute("id","bookmark"+n.bmid),addClass(t,"contentBookMarker"),s.getOb("epubMeta").appendChild(t);var o=0;return o=o||0,a.addMarker({id:"bookMarker"+n.bmid,elem:t,offsetLeft:0,offsetTop:o,target:function(){return this.offsetTop<10&&(this.offsetTop=10),e},callback:function(){var t=this;a.checkMarkerExistsAtSameLocation(this.elem,function(e){return e?(t.offsetTop+=39,void a.refreshMarker(t)):n.callback?n.callback():void 0})}}),t},B.embedAnchorMarker=function(e){};var z=function(e){(O=e).stopPropagation()},V=function(e){try{if(e&&e.stopPropagation(),mobile){if("anchorDragged"!=S)return;if(!O)return}var t;if(mobile){var n=mobileDebug?O:O.targetTouches[0];t=document.elementFromPoint(n.clientX,Math.round(n.clientY+u.offsetHeight/2))}else t=e.target;if(s.getOb("epubContent")==t)return;if(!s.getOb("epubContent").contains(t))return;if(1<(t.textContent.match(new RegExp(" ","g"))||[]).length)return;if(mobile)if("anchor1"==w.getAttribute("anchor")){if(f==t)return;f=t}else{if(h==t)return;h=t}else h=t;P(c.analyzeNodes(f,h)),$(),redrawForChrome(f.parentElement),redrawForChrome(h.parentElement),mobile&&F()}catch(e){}},q=function(e){try{var t=s.getOb("epubContainer");document.removeEventListener(mobile&&!mobileDebug?"touchend":"mouseup",q),mobile?(document.removeEventListener(mobileDebug?"mousemove":"touchmove",z),removeClass(w,"selected"),clearInterval(T)):t.removeEventListener("mousemove",V),removeClass(s.getOb("epubContent"),"defaultCursor"),w=null,E=H(),S="selectionFixed",B.listener&&B.listener(S),e.stopPropagation()}catch(e){}},W=function(e){try{var t=s.getOb("epubContainer");f=h=e,mobile?(removeClass(u,"disable"),removeClass(p,"disable"),timeOut(function(){addClass(u,"tween"),addClass(p,"tween")},100),F()):(t.addEventListener("mousemove",V),document.addEventListener("mouseup",q)),H(),S="activated",B.listener&&B.listener(S)}catch(e){}};return B.active=function(){return"selectionFixed"==S||"activated"==S},B.copyToClipboard=function(t,e){if((config.clipboardCopy||e)&&(t=t||B.getSelectedText()))if(native)r.get("crdv").copyToClipboard(t);else if(desktop){require("nw.gui").Clipboard.get().set(t,"text"),status.showAndHide(d.get("copiedToClipboard"),500)}else{var n=document.createElement("textarea");document.body.appendChild(n),n.value=t,n.focus(),n.select();try{document.execCommand("Copy"),r.get("status").showAndHide(d.get("copiedToClipboard"),500)}catch(e){r.get("modals").show({mode:"flashUnsupported",flashOb:{text:t}}),setTimeout(function(){document.getElementById("clipboardText").focus(),document.getElementById("clipboardText").select()},200)}n.remove()}},B}]),app.factory("settings",["$http","error","spread","book","cache","modals","$ionicScrollDelegate","translit","$timeout","virt","selection","$injector","stg","markers","sync","crdv","cssParser",function(e,t,n,o,d,r,u,i,a,p,s,c,f,l,h,g,m){var v={};return v.pinchActive=!1,v.stylesInitialize=function(){},v.initialize=function(){v.stylingChanged(),v.lineAdjustChanged(),v.updateTextSize(),l.refreshMarkers()},v.getTextSize=function(){return Number(f.data.settings.textSize.slice(0,-2))},v.viewModeChanged=function(){n.applyMode(f.data.settings.viewMode)},v.updateTextSize=function(){try{var e=d.getOb("epubContent"),t=d.getOb("epubContent").style;if(t.fontSize==f.data.settings.textSize)return;t.fontSize=f.data.settings.textSize;for(var n=0;n<e.children.length;n++)try{e.children[n].style.fontSize="1em"}catch(e){}var o,r=d.getOb("epubContainer"),i=e.parentNode.parentNode,a=i.style.webkitTransform||i.style.mozTransform||i.style.transform;o=overflowScroll?d.getOb("epubContainer").scrollTop:Number(a.split(",")[1].slice(0,-2));var s=e.offsetHeight,c=r.offsetTop,l=r.offsetHeight;s+o<l+c?p.safeScroll("content",0,c+s-l,!0):s<l&&u.$getByHandle("content").scrollTop(!1),p.reset()}catch(e){}},v.writeTextSize=function(){f.writeSlot("settings"+f.getBookId(!0),f.data.settings,function(){l.refreshMarkers()})},v.stylingChanged=function(){f.data.settings.styling?m.showStyles():m.hideStyles(),l.refreshMarkers()},v.saveSettings=function(){f.writeSlot("settings"+f.getBookId(!0),f.data.settings)},v.langChanged=function(e){c.get("nav").fxlZoomFit(),f.readSlot("settings"+f.getBookId(!0),function(e){var t=e.language||"en";kotobee.dispatchEvent&&kotobee.dispatchEvent("languageChanged",{from:t,to:f.data.settings.language})}),f.writeSlot("settings"+f.getBookId(!0),f.data.settings,function(){i.setLang(f.data.settings.language,e),l.refreshMarkers()})},v.lineAdjustChanged=function(){f.data.settings.lineAdjust?addClass(d.getOb("epubContent"),"adjustedLineHeight"):removeClass(d.getOb("epubContent"),"adjustedLineHeight"),l.refreshMarkers()},v.sync=function(){h.onOnline(function(){native?g.toast(i.get("syncComplete")):r.show({mode:"success",successOptions:{msg:i.get("syncComplete")}})})},v}]),app.factory("skeleton",["stg",function(t){var i,a,d={},s=[],c=[];function u(){var e=t.data.settings.viewMode;return"double"==e&&config.singleViewOnPortrait&&1.3*window.innerWidth<window.innerHeight&&(e="single"),e}function p(e){s=[],(e=e||{}).firstBone||(e.firstBone=l());for(var t=e.firstBone,n=u(),o=e.lastJoint;t;){var r=[];if(t.joint=r,"single"==n?r.push(t):"double"==n?(r.push(t),o&&delete t.alone,t.alone||t.index>=config.firstDoublePage&&t.next&&(r.push(t=t.next),t.joint=r)):"auto"==n&&r.push(t),o&&((r.prev=o).next=r),s.push(r),o=null,t.next&&(o=r),e.lastBone==t)break;t=f(t,e)}return s[s.length-1]}function l(e){var t;e=e||0;for(var n=0;n<c.length;n++)c[n].index<e||(t?c[n].index<t.index?t=c[n]:c[n].index==t.index&&c[n].vIndex<t.vIndex&&(t=c[n]):t=c[n]);return t}function r(e){for(var t,n=0;n<c.length;n++)c[n].index>e||(t?c[n].index>t.index?t=c[n]:c[n].index==t.index&&c[n].vIndex>t.vIndex&&(t=c[n]):t=c[n]);return t}function f(e,t){return t=t||{},e.next?e.next:t.connectedOnly?void 0:h(e.index+1)}function h(e){var t,n,o=r();if(o)for(;e<=o.index;){if(t&&(e=t.index+1),n=d.getBone(e))return n;t=null,e++}}function g(e){var t=h(e);if(t)return t.joint}function m(e){var t;for("";e;)e.index+"."+e.vIndex,(e=(t=e).next)&&"->";return t}function v(e,t){var n;for(t=t||"";e;){t+=" [";for(var o=0;o<e.length;o++)t+=e[o].index+"."+e[o].vIndex+",";t=t.substr(0,t.length-1)+"]",(e=(n=e).next)&&(t+="->")}return n}return d.reset=function(){c=[],s=[]},d.initialize=function(e){d.reset();for(var t=(e=e||{}).first;t<e.last;t++)d.add({index:t})},d.trace=function(){var e=-1;for(;;){var t=h(e+1);if(!t)break;var n=m(t);e=n.index}var o=-1;for(;;){var r=g(o+1);if(!r)break;var i=v(r);o=i[i.length-1].index}},d.add=function(e){var t,n,o,r,i=d.getBone(e.index);if(i){var a=e.pages&&e.pages.length;if(i.total&&a)return;if(!i.total&&!a)return;d.remove(i)}if(e.pages&&e.pages.length)for(var s=0;s<e.pages.length;s++)(r={}).index=e.index,r.vIndex=s,r.total=e.pages.length,t&&((r.prev=t).next=r),c.push(r),t=r,0==s&&(n=r),s==e.pages.length-1&&(o=r);else(r={}).index=e.index,r.vIndex=null,c.push(r),n=o=r;!function(e,t){var n=d.getBone(e.index-1);if(n){var o=n;1<n.total&&(o=d.getBone(e.index-1,n.total-1)),(o.next=e).prev=o}var r,i=d.getBone(t.index+1);i&&((i.prev=t).next=i);if("double"==u()){var a=d.getJoint(e.index-1),s=d.getJoint(t.index+1);if(a)return p();var c=t.total?t.total:1;if(s&&1==s.length&&s[0].index>=config.firstDoublePage&&(r=!0),s){var l;if(r||c%2==0&&(l=!0),r&&c%2==1&&(l=!0),l)return p();e.alone=!0}}p()}(n,o)},d.remove=function(e){e.prev&&e.prev.next&&(e.prev.next=null),e.next&&e.next.prev&&(e.next.prev=null);for(var t=0;t<c.length;t++)if(c[t]==e)return void c.splice(t,1)},d.getBone=function(e,t){for(var n=0;n<c.length;n++)if(c[n].index==e){if(null==t)return c[n];if(c[n].vIndex==t)return c[n]}},d.normalize=function(e){if("double"==d.getCurrentView(e.index,e).view)if(null!=e.vIndex){var t=d.getJoint(e.index,e.vIndex);if(t){var n=t[0].index,o=t[0].vIndex;(n!=e.index||null!=o&&o!=e.vIndex)&&(e.index=n,null!=o&&(e.vIndex=o))}}else(e.index-config.firstDoublePage)%2==1&&e.index--},d.getJoint=function(e,t){for(var n=0;n<s.length;n++)for(var o=0;o<s[n].length;o++)if(s[n][o].index==e){if(t<=-1&&s[n][o].total&&(t+=s[n][o].total),null==t)return s[n];if(null==s[n][o].vIndex)return s[n];if(s[n][o].vIndex==t)return s[n]}},d.nextJoint=function(e,t){var n=d.getBone(e,t);if(n){var o=n.joint.next;if(o)return{index:o.index,vIndex:o.vIndex}}},d.prevJoint=function(e,t){var n=d.getBone(e,t);if(n){var o=n.joint.prev;if(o)return{index:o.index,vIndex:o.vIndex}}},d.getNextLinearIndex=function(n,o){var r=t.data.epub.spine.getElementsByTagName("itemref"),e=r[n.index];i=i||e.getAttribute("idref"),d.getNextIndex(n,function(e){if(!e)return o({leftOb:n});if(e.leftOb.index>=r.length-1)return o(e);var t=r[e.leftOb.index];if(t){if(null==e.leftOb.vIndex&&t.getAttribute("idref")==i)return d.getNextLinearIndex({index:e.leftOb.index,vIndex:e.leftOb.vIndex},o);if("no"==t.getAttribute("linear"))return d.getNextLinearIndex({index:e.leftOb.index,vIndex:e.leftOb.vIndex},o)}return i=null,o(e)})},d.getNextIndex=function(e,t){var n={},o=d.getJoint(e.index,e.vIndex);return o?(o&&o.next?n.leftOb={index:o.next[0].index,vIndex:o.next[0].vIndex}:n.leftOb={index:o[o.length-1].index+1,vIndex:0},t&&t(n),n):t?t():null},d.getPrevLinearIndex=function(n,o){if(0==n.index){if(null==n.vIndex)return o({leftOb:n});if(0==n.vIndex)return o({leftOb:n})}var r=t.data.epub.spine.getElementsByTagName("itemref"),e=r[n.index];a=a||e.getAttribute("idref"),d.getPrevIndex(n,function(e){if(!e)return o({leftOb:n});var t=r[e.leftOb.index];if(t){if(null==e.leftOb.vIndex&&t.getAttribute("idref")==a)return d.getPrevLinearIndex({index:e.leftOb.index,vIndex:e.leftOb.vIndex,source:"first"},o);if("no"==t.getAttribute("linear"))return d.getPrevLinearIndex({index:e.leftOb.index,vIndex:e.leftOb.vIndex,source:"second"},o)}return a=null,o(e)})},d.getPrevIndex=function(e,t){var n={},o=d.getJoint(e.index,e.vIndex);return o?(o&&o.prev?n.leftOb={index:o.prev[0].index,vIndex:o.prev[0].vIndex}:(n.leftOb={index:o[0].index-1,vIndex:-1},n.leftOb.index<0&&(n.leftOb.index=0),n.leftOb.vIndex<0&&(n.leftOb.vIndex=null==e.vIndex?null:0)),t&&t(n),n):t?t():null},d.isSingle=function(e,t){var n=d.getJoint(e,t);if(n)return 1==n.length},d.getCurrentView=function(e,t){var n=d.getJoint(e,t.vIndex);if(n){var o={};return o.view=1==n.length?"single":"double",o.index=e,o}},d.isLastChapter=function(e,t){var n=null==(e=e||{}).index?currentIndex:e.index,o=null==e.vIndex?currentVIndex:e.vIndex;return t(d.getJoint(n,o)==r(e.last).joint)},d.isFirstChapter=function(e,t){return e=e||{},t(d.getJoint(currentIndex,currentVIndex)==l(e.first).joint)},d.isNeighbor=function(e,t){for(var n=d.getJoint(currentIndex,currentVIndex),o=n.next,r=n.prev,i=0;i<2;i++){var a=[o,r][i],s=["next","prev"][i];if(a)for(var c=0;c<a.length;c++)if(a[c].index==e.index){if(null==a[c].vIndex)return t(s);if(a[c].vIndex==e.vIndex)return t(s)}}t()},d}]),app.factory("spread",["$document","$injector","cache","selection","skeleton","chapters","stg","$filter","traverser",function(e,t,n,o,r,l,d,u,k){var i={};function w(e){if(!e.childNodes.length)return!1;if(e.className.indexOf&&0<=e.className.indexOf("kInteractive")){if(hasClass(e,"video"))return!1;if(hasClass(e,"gallery"))return!1;if(hasClass(e,"audio"))return!1;if(hasClass(e,"widget"))return!1;if(hasClass(e,"widget"))return!1;if(hasClass(e,"threed"))return!1}return!0}function x(e){try{if("span"==e.nodeName.toLowerCase())return!1;if(e.style){if("always"==e.style.pageBreakBefore||"always"==getComputedStyle(e).pageBreakBefore)return e;if(e.previousSibling&&e.previousSibling.nodeName&&"span"!=e.previousSibling.nodeName.toLowerCase()&&e.previousSibling.style&&("always"==e.previousSibling.style.pageBreakAfter||"always"==getComputedStyle(e).pageBreakAfter))return e}for(var t=0;t<e.childNodes.length;t++){var n=x(e.childNodes[t]);if(n)return n}}catch(e){}return!1}function C(e,t){var n=getFilteredChildIndex(t);if(0<n){var o=e.parentNode,r=getFilteredChildIndex(e);n!=r&&(o.getAttribute("kb-offset")||o.setAttribute("kb-offset",n-r))}}return i.initialize=function(){},i.applyMode=function(e){"double"==e?i.activateDblPage():"single"==e?i.activateSinglePage():"auto"==e&&i.activateAutoPage()},i.activateSinglePage=function(){if(l.shouldBePaged(d.data.currentPageOb))l.regenerateSpreads();else{l.resetPages({buildChapterMode:!0});var e={viewMode:"single",reload:!0};l.loadChapterByIndex(currentIndex,e,function(){})}},i.activateDblPage=function(){if(l.shouldBePaged(d.data.currentPageOb))l.regenerateSpreads();else{l.resetPages({buildChapterMode:!0});var e={viewMode:"double",reload:!0};l.loadChapterByIndex(currentIndex,e,function(){})}},i.activateAutoPage=function(){"double"==l.getCurrentView(currentIndex,{vIndex:currentVIndex}).view?i.activateDblPage():i.activateSinglePage()},i.getViewport=function(e){e=e||{};var t=document.getElementById("readerBody"),n=document.getElementById("readerHeader"),o=document.getElementById("tabMenu"),r=t.getBoundingClientRect().width,i=t.getBoundingClientRect().height;mobile&&"alwaysShow"!=config.autohideReaderMode&&"showOnScroll"!=config.autohideReaderMode&&"showOnTap"!=config.autohideReaderMode||(i-=n.getBoundingClientRect().height+o.getBoundingClientRect().height);var a=l.getCurrentView(e.index,{vIndex:e.vIndex});a=a||{view:"double"};var s={},c=config.spreadSpacing?config.spreadSpacing:0;return"double"==a.view?s.width=Math.round((r-c)/2):(s.width=r,"double"==d.data.settings.viewMode&&(s.width=r/2),1.3*window.innerWidth<window.innerHeight&&(s.width=r)),s.height=i,s},i.parseReflowableChapter=function(e,l){e.raw&&!e.pages&&(e.content=e.raw),t.get("context").simulateChapter(e,function(a){var s=i.getViewport(e),c={pages:[]};c.pageWidth=s.width,c.pageHeight=s.height,c.url=e.url,c.index=e.index,a.style.width="100%",a.style.height="100%",a.style.position="absolute",a.style.zIndex=-1,a.style.visibility="hidden",a.setAttribute("data-index",c.index),document.body.appendChild(a),a.addEventListener("error",function(e){}),a.addEventListener("load",function(){var e=a.contentDocument.documentElement,n=e.getElementsByTagName("body")[0];n.style.width=s.width+"px",n.style.height=2*s.height+"px";var t=e.getElementsByTagName("style")[0].innerHTML;c.supportsPageBreakStyles=0<=t.indexOf("page-break-after")||0<=t.indexOf("page-break-before");var o=a.contentDocument.getElementById("spreadR");o&&o.parentNode.removeChild(o),a.contentDocument.getElementById("epubScroller").style.overflowY="hidden";var r=a.contentDocument.getElementById("epubContent"),i=r.outerHTML;u("contentVirt")("parse",r,function(){var e=function(e,o){o.pages||(o.pages=[]);o.index||(o.index=0);o.lastStop||(o.lastStop=document.createElement("div"));var t=o.lastStop,n=[];e.style.width=o.pageWidth+"px";var r=e,i=o.pageHeight-0,a=getElemMargin(e,{computed:!0}),s=getElemPadding(e,{computed:!0}),c=a.top,l=a.bottom,d=s.top,u=s.bottom;"auto"==c&&(c=0);"auto"==l&&(l=0);"auto"==d&&(d=0);"auto"==u&&(u=0);c=c||0;l=l||0;d=d||0;u=u||0;a=Number(a),s=Number(s);var p=c+d,f=l+u,h=traverseToBottom(e,"epubContent");for(;;){if(!r||8==r.nodeType){if("continue"==y())continue;break}var g=getBoundingBox(r);if(g.bottom<i-f){if(o.supportsPageBreakStyles&&x(r)){if(b(r,{src:"breakStyle"}),i=g.bottom+o.pageHeight-p-f,"break"==y())break;continue}var m=r.cloneNode(!0);if(t.appendChild(m),n.length&&C(m,r,"less"),"break"==y())break}else if(w(r)){m=cloneNodeAttributes(r);t.appendChild(m),n.length&&C(m,r,"canDigInside"),t=t.childNodes[t.childNodes.length-1],r=r.childNodes[0]}else if(b(r,{src:"end"}),"break"==y())break}function v(e){if(!e)return"";o.url;for(var t=getElementsByAttribute(e,"*","src"),n=0;n<t.length;n++){t[n].getAttribute("src");0}return e.outerHTML}function b(e){i=g.top+o.pageHeight-p-f,t&&(n.length,n.push({content:v(traverseToTop(t,"epubContent")),lastLocation:k.convertElemsToLocation([e],h).left})),(t=function(e){({});var t,n=parents(e);for(var o=0;o<n.length-1;o++)if("#document"!=n[o].nodeName.toLowerCase()&&"html"!=n[o].nodeName.toLowerCase()){var r=cloneNodeAttributes(n[o]);t=t?(t.appendChild(r),C(r,n[o],"duplicate"),t.childNodes[0]):r}return t}(e)).appendChild(e.cloneNode(!0))}function y(){return r.nextSibling?(r=r.nextSibling,"sibling"):r.parentNode&&"body"!=r.nodeName.toLowerCase()?(r=r.parentNode,t=t.parentNode?t.parentNode:traverseToBottom(t,"epubContent"),y()):(t&&n.push({content:v(traverseToTop(t,"epubContent"))}),"break")}if(1==n.length){r=traverseToBottom(e,"epubContent");n[0].content=v(r)}return n}(n,c);a.parentNode.removeChild(a);var t={};t.pages=e,t.raw=i,t.viewport=s,l(t)})})})},i}]),app.factory("sso",["$rootScope","$location","stg","$ionicHistory","translit","$injector","modals","error",function(e,c,r,l,t,i,d,u){var p={},f=ios?"yes":"no",a="http://localhost:8100";function n(e){config.kotobee.sso[e]&&(r.data.sso[e]=!0,r.data.sso[e+"Logo"]=rootDir+"img/ui/sso/"+e+".png")}function s(e){if(!r.data.sso.oauth)return null;var t=Object.assign({},r.data.sso.oauth);return t.provider==e?t:null}function h(e,t){var n=getBaseSuffix();return native&&(n=a,n+=window.location.pathname),t||(n+=function(e){return"?provider="+e}(e)),config.ssoRedirectUrl&&(localStorage.kotobeeRedirect=JSON.stringify({url:n.split("?")[0],provider:e}),n=config.ssoRedirectUrl),n}function g(e,n){if(native){if(cordova.InAppBrowser){var o=cordova.InAppBrowser.open(e.url,"_blank",e.options);o.addEventListener("loadstart",function(e){if(0===e.url.indexOf(a)){o.close();var t=new URL(e.url);n&&n(t)}}),o.addEventListener("loaderror",function(e){if(!ios)try{o&&o.close()}catch(e){}}),o.addEventListener("exit",function(e){})}}else window.location.replace(e.url)}return p.initialize=function(e){r.data.sso||(r.data.sso={}),Object.keys(config.kotobee.sso).forEach(n),e&&e()},p.setTokens=function(e,t,n){r.data.sso||(r.data.sso={});var o={provider:e,idToken:t,accessToken:n};r.data.sso.oauth=o},p.getSSOEmail=function(n,o){var e=s(n);if(e)switch(n){case"facebook":var t={fields:"id,email",access_token:e.accessToken};i.get("backend").sendRawPost("https://graph.facebook.com/v7.0/me",t,{ignoreCredentials:!0,queryString:!0,responseType:"json"},function(e){if(e){var t=e.email;r.data.user.email=t,r.data.user.loggedIn="string"==typeof e.email,t||u.update({error:"ssoEmailError",provider:n.toCamelCase()}),o(t)}else o()});break;default:o()}else o()},p.signInBrowser=function(i,a){var e,t,n;switch(i){case"okta":e=("/"==config.kotobee.sso[i].params.domain.slice(-1)?config.kotobee.sso[i].params.domain.slice(0,-1):config.kotobee.sso[i].params.domain)+"/oauth2/default/v1/authorize";break;case"google":e="https://accounts.google.com/o/oauth2/v2/auth";break;case"microsoft":e="https://login.microsoftonline.com/common/oauth2/v2.0/authorize";break;case"facebook":e="https://www.facebook.com/v7.0/dialog/oauth",t="token",n="public_profile email";break;case"auth0":e="https://"+config.kotobee.sso[i].params.domain.replace(/http[s]?:\/\//g,"")+"/authorize";break;case"fusionauth":e="https://"+config.kotobee.sso[i].params.domain.replace(/http[s]?:\/\//g,"")+"/oauth2/authorize"}t=encodeURIComponent(t||"token id_token"),n=encodeURIComponent(n||"openid profile email");var s=randStr(11,""),o=h(i);"microsoft"==i&&(o=o.replace(/\/\?/,"?"));var r=e+"?client_id="+config.kotobee.sso[i].params.clientid+"&response_type="+t+"&scope="+n+"&state="+uuid+"&nonce="+s+"&redirect_uri="+encodeURIComponent(o);switch(i){case"fusionauth":config.kotobee.sso[i].params.tenantid&&(r+="&tenant_id="+config.kotobee.sso[i].params.tenantid)}g({url:r,options:"location=no,hidden=no,clearsessioncache=yes,clearcache=yes,closebuttoncaption=Go back to App,toolbar="+f+",presentationstyle=formsheet"},function(e){var t=new URLSearchParams(e.hash.slice(1));if(t.get("state")!=uuid);else{var n=t.get("access_token")||"",o=t.get("id_token")||"";if(p.setTokens(i,o,n),o){var r=function(e){var t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(n)}(o);r.nonce!=s||a&&(a(i,r.email,n,o),d.hide(),c.path("/"),l.clearHistory())}else if(n)switch(i){case"facebook":p.getSSOEmail(i,function(e){e?a&&(a(i,e,n,o),d.hide(),c.path("/"),l.clearHistory()):(d.hide(),u.update({error:"ssoEmailError",provider:i.toCamelCase()}))})}}})},p.signOutBrowser=function(e){var t="location=no,hidden=yes",n=s(e);if(n)switch(e){case"okta":g({url:o=("/"==config.kotobee.sso[e].params.domain.slice(-1)?config.kotobee.sso[e].params.domain.slice(0,-1):config.kotobee.sso[e].params.domain)+"/oauth2/default/v1/logout?id_token_hint="+n.idToken+"&state="+uuid+"&post_logout_redirect_uri="+encodeURIComponent(h(e,!0)),options:t});break;case"google":i.get("backend").sendRawPost("https://oauth2.googleapis.com/revoke",{token:n.accessToken},{ignoreCredentials:!0},function(e){native||(delete r.data.sso.oauth,i.get("login").toLoginScreen())});break;case"microsoft":native||(delete r.data.sso.oauth,i.get("login").toLoginScreen());break;case"facebook":i.get("backend").sendRawPost("https://graph.facebook.com/v7.0/me/permissions",{token:n.accessToken},{method:"delete",ignoreCredentials:!0},function(e){native||(delete r.data.sso.oauth,i.get("login").toLoginScreen())});break;case"auth0":"/"==config.kotobee.sso[e].params.domain.slice(-1)?config.kotobee.sso[e].params.domain.slice(0,-1):config.kotobee.sso[e].params.domain;g({url:o="https://"+config.kotobee.sso[e].params.domain+"/v2/logout?client_id="+config.kotobee.sso[e].params.clientid+"&returnTo="+h(e,!0),options:t});break;case"fusionauth":"/"==config.kotobee.sso[e].params.domain.slice(-1)?config.kotobee.sso[e].params.domain.slice(0,-1):config.kotobee.sso[e].params.domain;var o="https://"+config.kotobee.sso[e].params.domain+"/oauth2/logout?client_id="+config.kotobee.sso[e].params.clientid+"&post_logout_redirect_uri="+h(e,!0);config.kotobee.sso[e].params.tenantid&&(o+="&tenant_id="+config.kotobee.sso[e].params.tenantid),g({url:o,options:t})}},p}]),app.factory("status",["$ionicLoading","translit","$q",function(a,e,s){var t,c={},l=1e4;function d(){t&&(clearTimeout(t),t=null)}function u(){d(),l&&(t=setTimeout(function(){c.update().then(function(){c.showAndHide(e.get("statusTimeoutError"),3e3)})},l))}return c.update=function(e,t,n){var o=s.defer();if((n=n||{}).dots&&(e+=' <ion-spinner icon="dots" class="loadingSpinner"></ion-spinner>'),n.progress&&(e+='<div class="loadingProgress"></div>'),l=n.timeoutDuration?n.timeoutDuration:1e4,d(),e){u();var r={template:e};for(var i in n)r[i]=n[i];a.show(r),c.updateProgress()}else a.hide();return timeOut(function(){o.resolve()},t||250),o.promise},c.updateProgress=function(e){1<(e=e||0)&&(e=1);var t=document.getElementsByClassName("loadingProgress");t.length&&(t[0].style.width=Math.round(100*e)+"%"),0<e&&u()},c.showAndHide=function(e,t){c.update(e,t).then(function(){c.update()})},c}]),app.factory("stg",["sync","$rootScope",function(a,e){var s={data:{},view:{}};return s.initialize=function(){e.data=s.data,e.view=s.view,s.reset(),s.setLanguages(),preview&&s.clearSlots()},s.initializeSettings=function(t){try{s.readSlot("settings"+s.getBookId(!0),function(e){s.data.settings=e,0==s.data.settings.length&&(s.data.settings={}),n()})}catch(e){s.data.settings={},n()}function n(){s.applyDefaultSettings();try{if(config.defaultLanguage&&(s.data.settings.language=config.defaultLanguage,s.langChanged()),s.data.settings.navAnim=config.defaultNavAnim?config.defaultNavAnim:"navBookBlock",s.data.settings.viewMode=config.defaultViewMode?config.defaultViewMode:"auto",s.data.settings.pageScroll=null==config.defaultPageScroll||config.defaultPageScroll,!preview)return void s.readSlot("settings"+s.getBookId(!0),function(e){e&&(e.language&&(s.data.settings.language=e.language,s.langChanged()),e.navAnim&&(s.data.settings.navAnim=e.navAnim),e.viewMode&&(s.data.settings.viewMode=e.viewMode)),config.forcedLanguage&&(s.data.settings.language=config.forcedLanguage,s.langChanged()),config.forcedViewMode&&(s.data.settings.viewMode=config.viewMode=config.forcedViewMode),config.forcedNavAnim&&(s.data.settings.navAnim=config.navAnim=config.forcedNavAnim),t&&t()})}catch(e){}t&&t()}},s.langChanged=function(){"ar"==s.data.settings.language?s.data.settings.rtl=!0:s.data.settings.rtl=!1},s.reset=function(){s.resetBook(),s.resetLibrary()},s.setLanguages=function(){s.data.languages=[{label:"English",val:"en"},{label:"Français",val:"fr"},{label:"Español",val:"es"},{label:"Português",val:"pt"},{label:"Nederlands",val:"nl"},{label:"Deutsch",val:"de"},{label:"Magyar",val:"hu"},{label:"Italiano",val:"it"},{label:"Svenska",val:"sw"},{label:"Melayu",val:"ms"},{label:"Norsk",val:"no"},{label:"Polski",val:"pl"},{label:"Român",val:"ro"},{label:"Pусский",val:"ru"},{label:"Türkçe",val:"tr"},{label:"العربية",val:"ar"},{label:"汉语",val:"zh-cn"},{label:"漢語",val:"zh-tw"},{label:"日本語",val:"jp"},{label:"한국어",val:"ko"}]},s.resetBook=function(){s.data.epub={},s.data.toc="",s.data.mediaList=[],s.data.packageURL="",s.data.book={},s.data.book.chapter={},s.data.chromeAssets=[]},s.resetLibrary=function(){s.data.downloaded=[],s.data.favorites=[],s.data.currentLibrary={}},s.applyDefaultSettings=function(){s.data.settings&&(s.data.settings.styling||(s.data.settings.styling=!0),s.data.settings.textSize||(s.data.settings.textSize="1em"),s.data.settings.lineAdjust||(s.data.settings.lineAdjust=!0),s.data.settings.language||(s.data.settings.language="en"),null==config.viewModeOptional&&(config.viewModeOptional=!0),null==config.pageScrollOptional&&(config.pageScrollOptional=!0),null==config.navAnimOptional&&(config.navAnimOptional=!0),null==config.languageOptional&&(config.languageOptional=!0))},s.getBookId=function(e){if(config.kotobee.cloudid)return"book"==config.kotobee.mode?"_"+config.kotobee.cloudid:"library"==config.kotobee.mode?"_"+config.kotobee.cloudid+"_"+(e?"":s.data.book?s.data.book.id:""):void 0;var t,n="",o="";try{t=s.data.book.meta.dc.identifier}catch(e){}if(desktop){var r=require("nw.gui");o=t||r.App.manifest.name+(r.App.manifest.rand?r.App.manifest.rand:"")}else if(native)o=t||(cordova.rand?cordova.rand:"");else{o=(o=(o=(o=location.href.split("#")[0]).replace("https://","http://")).replace("http://www.","http://")).replace("http://","");try{n=e?"":t||s.data.book.meta.dc.title}catch(e){}}var i="_"+(o+n).replace(/[\/\s:#]/g,"");return config.ignoreQueryStringInLocalStorage&&(i=i.replace(/\?.*/g,"")),i},s.isManipulated=function(e){if(!e.file&&e.chapter==currentIndex&&e.chaptername!=s.data.currentPageOb.title)return!0;if(e.file==s.getChapterFilename()){if(e.chapter!=currentIndex)return!0;if(e.chaptername!=s.data.currentPageOb.title)return!0}},s.isManipulatedOld=function(e){var t=0;return e.chapter!=currentIndex&&t++,e.chaptername!=s.data.currentPageOb.title&&t++,"library"==config.kotobee.mode&&e.file!=s.getChapterFilename()&&t++,1==t||2==t},s.addBookmark=function(o,r){s.readSlot("bookmark"+s.getBookId(),function(e){var t=e;function n(e){e&&(t=e),o.chapter=currentIndex,o.chaptername||(o.chaptername=s.data.currentPageOb.title),o.file||(o.file=s.getChapterFilename()),o.cloudid=config.kotobee.cloudid,t.push(o),s.writeSlot("bookmark"+s.getBookId(),t,function(){return a.queue("bookmark/add",o),r&&r(!0),!0})}null!=o.bmid?s.deleteBookmark(o.bmid,null,n):s.uniqueId(t,"bmid",function(e){o.bmid=e,n()})})},s.getChapterFilename=function(){try{return s.data.book.chapter.url}catch(e){return s.data.currentPageOb.url.replace(/.*?\/(xhtml\/.*)/g,"$1")}},s.getBookmarks=function(t){s.readSlot("bookmark"+s.getBookId(),function(e){t&&t(e)})},s.deleteBookmark=function(o,r,i){s.readSlot("bookmark"+s.getBookId(),function(e){for(var t=0;t<e.length;t++)if(e[t].bmid==o){var n=e[t];return e.splice(t,1),void s.writeSlot("bookmark"+s.getBookId(),e,function(){r||a.queue("bookmark/delete",n),i&&i(e)})}i&&i(e)})},s.addSketch=function(r,i){try{s.readSlot("sketch"+s.getBookId(),function(o){function e(e){e&&(o=e),null==r.chapter&&(r.chapter=currentIndex),r.chaptername||(r.chaptername=s.data.currentPageOb.title),r.file||(r.file=s.getChapterFilename()),r.cloudid=config.kotobee.cloudid;var t={};for(var n in r)"event"!=n&&(t[n]=r[n]);o.push(t),s.writeSlot("sketch"+s.getBookId(),o,function(){return a.queue("freehand/add",t),i&&i(!0),!0})}null!=r.id?s.deleteSketch(r.id,null,e):e()})}catch(e){}return!0},s.getSketches=function(t){s.readSlot("sketch"+s.getBookId(),function(e){t&&t(e)})},s.deleteSketch=function(o,r,i){s.readSlot("sketch"+s.getBookId(),function(e){for(var t=0;t<e.length;t++)if(e[t].id==o){var n=e[t];return e.splice(t,1),void s.writeSlot("sketch"+s.getBookId(),e,function(){r||a.queue("freehand/delete",n),i&&i(e)})}i&&i(e)})},s.deleteNote=function(o,r,i){s.readSlot("note"+s.getBookId(),function(e){for(var t=0;t<e.length;t++)if(e[t].nid==o){var n=e[t];return e.splice(t,1),void s.writeSlot("note"+s.getBookId(),e,function(){r||a.queue("note/delete",n),i&&i(e)})}i&&i(e)})},s.addNote=function(r,i){try{s.readSlot("note"+s.getBookId(),function(o){function t(e){e&&(o=e),null==r.chapter&&(r.chapter=currentIndex),r.chaptername||(r.chaptername=s.data.currentPageOb.title),r.file||(r.file=s.getChapterFilename()),r.cloudid=config.kotobee.cloudid;var t={};for(var n in r)"event"!=n&&(t[n]=r[n]);o.push(t),s.writeSlot("note"+s.getBookId(),o,function(){return a.queue("note/add",t),i&&i(!0),!0})}null!=r.nid?s.deleteNote(r.nid,null,t):s.uniqueId(o,"nid",function(e){r.nid=e,t()})})}catch(e){}return!0},s.getNotes=function(e){s.readSlot("note"+s.getBookId(),e)},s.deleteHlight=function(o,r,i){s.readSlot("hlight"+s.getBookId(),function(e){for(var t=0;t<e.length;t++)if(e[t].hid==o){var n=e[t];return e.splice(t,1),void s.writeSlot("hlight"+s.getBookId(),e,function(){r||a.queue("hlight/delete",n),i&&i(e)})}i&&i(e)})},s.addHlight=function(o,r){s.readSlot("hlight"+s.getBookId(),function(t){function n(e){e&&(t=e),null==o.chapter&&(o.chapter=currentIndex),o.chaptername||(o.chaptername=s.data.currentPageOb.title),o.file||(o.file=s.getChapterFilename()),o.cloudid=config.kotobee.cloudid,t.push(o),s.writeSlot("hlight"+s.getBookId(),t,function(){return a.queue("hlight/add",o),r&&r(!0),!0})}null!=o.hid?s.deleteHlight(o.hid,null,n):s.uniqueId(t,"hid",function(e){o.hid=e,n()})})},s.getHlightById=function(n,o){s.getHlights(function(e){for(var t=0;t<e.length;t++)if(e[t].hid==n)return o&&o(e[t]),e[t]})},s.getHlights=function(e){s.readSlot("hlight"+s.getBookId(),e)},s.addAction=function(t,n){s.readSlot("actions"+s.getBookId(),function(e){e.push(t),s.writeSlot("actions"+s.getBookId(),e,function(){return n&&n(!0),!0})})},s.deleteAction=function(n,o){s.readSlot("actions"+s.getBookId(),function(e){for(var t=0;t<e.length;t++)if(JSON.stringify(n)==JSON.stringify(e[t]))return e.splice(t,1),void s.writeSlot("actions"+s.getBookId(),e,function(){return o&&o(e),e});o&&o(e)})},s.getActions=function(e){s.readSlot("actions"+s.getBookId(),e)},s.readSlot=function(t,n){var o;if(chromeApp)chrome.storage.local.get(t,function(e){e=e?isEmpty(e)?[]:e[t]:[],n&&n(e)});else if(native)try{NativeStorage.getItem(t,function(e){e||n([]);var t=JSON.parse(e);n&&n(t)},function(){n&&n([])})}catch(e){r()}else r();function r(){if(!(o=localStorage[t]))return n&&n([]),[];var e=JSON.parse(o);return n&&n(e),e}},s.writeSlot=function(e,t,n){if(chromeApp){var o={};o[e]=t,chrome.storage.local.set(o,function(){n&&n()})}else if(native)try{NativeStorage.setItem(e,JSON.stringify(t),function(){n&&n()},function(e){r()})}catch(e){r()}else r();function r(){localStorage[e]=JSON.stringify(t),n&&n()}},s.clearSlot=function(e,t){if(chromeApp)chrome.storage.local.remove(e,function(){t&&t()});else if(native)try{NativeStorage.remove(e,function(){t&&t()},function(){n()})}catch(e){}else n();function n(){delete localStorage[e],t&&t()}},s.clearSlots=function(r){if(chromeApp)chrome.storage.local.clear(r);else if(native)try{NativeStorage.clear(r,function(){e()})}catch(e){}else e();function e(){var n=[];for(var e in localStorage)n.push(e);var o=-1;!function e(){o++;if(o>=n.length)return void(r&&r());var t=n[o];0==t.indexOf("note_")?s.clearSlot(t,e):0==t.indexOf("bookmark_")?s.clearSlot(t,e):0==t.indexOf("hlight_")?s.clearSlot(t,e):0==t.indexOf("settings_")&&s.clearSlot(t,e)}()}},s.copyLocalToNativeStorage=function(){if(native)try{for(var e in localStorage)NativeStorage.setItem(e,localStorage[e]),delete localStorage[e]}catch(e){}},s.uniqueId=function(e,n,o){var r=0;n=n||"id";for(var t=0;t<e.length;t++)Number(e[t][n])>r&&(r=Number(e[t][n]));s.readSlot("actions"+s.getBookId(),function(e){for(var t=0;t<e.length;t++)Number(e[t].data[n])>r&&(r=Number(e[t].data[n]));return o&&o(r+1),r+1})},s.getPublicRoot=function(e){var t="";return s.data.paths&&("book"==config.kotobee.mode||"book"==e?t=s.data.paths.books:"library"!=config.kotobee.mode&&"library"!=e||(t=s.data.paths.libraries)),t=t||""},s}]),app.factory("sync",["$injector","translit","$rootScope","$http","error",function(i,e,t,a,s){var c,l,n,o,r,d,u,p,f={},h={transformRequest:angular.identity,headers:{"Content-Type":void 0}};function g(){t.data.syncing||(t.data.syncing=!0,t.$$phase||t.$apply())}function m(){t.data.syncing&&(t.data.syncing=!1,t.$$phase||t.$apply())}return f.initialize=function(){config.kotobee.cloudid&&(l=l||i.get("stg"),n=n||i.get("bookmarks"),o=o||i.get("notes"),r=r||i.get("hlights"),u=u||i.get("chapters"),d=d||i.get("freehand"),l.getActions(function(e){c=e,window.addEventListener?(window.addEventListener("offline",f.onOffline,!1),window.addEventListener("online",f.onOnline,!1)):(document.addEventListener("offline",f.onOffline,!1),document.addEventListener("online",f.onOnline,!1))}))},f.trigger=function(){f.offline()?f.onOffline():f.onOnline()},f.offline=function(){if(i.get("backend").cloudParam("sync"))try{return"NONE"==navigator.network.connection.type.toUpperCase()&&"UNKNOWN"==navigator.network.connection.type.toUpperCase()}catch(e){return!1}},f.onOffline=function(){i.get("backend").cloudParam("sync")},f.onOnline=function(e){i.get("backend").cloudParam("sync")&&(p||f.applyChanges(function(){g(),i.get("annotations").sync({},function(){m(),e&&e()})}))},f.queue=function(e,t){if(l&&config.kotobee.cloudid&&!config.kotobee.public){var n={type:e,data:clone(t)};c.push(n),l.addAction(n,function(){f.offline()||p||f.applyChanges()})}},f.applyChanges=function(e){if(m(),i.get("backend").cloudParam("sync")&&l&&l.data.user&&(l.data.user.email||l.data.user.code))try{var t={func:arguments.callee,args:arguments};if(0==c.length)return p=!1,e?e():null;g(),p=!0;var n=c[0],o=getFormData(i.get("backend").getAuthVars());for(var r in n.data)o.append(r,n.data[r]);a.post(config.kotobee.liburl+"library/"+n.type,o,h).success(function(e){c.splice(0,1),l.deleteAction(n,function(){f.applyChanges()})}).error(function(e){p=!1,setTimeout(m,300),s.update({error:"syncOnConnectionMsg",ref:t})})}catch(e){}},f}]),app.factory("tinCan",["stg","backend",function(t,n){var e={};return e.initialize=function(){},e.send=function(e){!function(e){try{if(!config.gAnalyticsID)return;if(!ga)return}catch(e){return}ga("send","event",e.activity,e.verb,t.data.book.meta.dc.title)}(e),n.cloudParam("tincan")&&(e.name=t.data.user.name?t.data.user.name:"User",t.data.user.email?e.email=t.data.user.email:t.data.user.code&&(e.email=t.data.user.code+"@promocode"),n.tincan(e))},e}]),app.factory("translit",["$interpolate","$http","$injector","$rootScope","cache",function(o,e,a,s,c){var r,i,l={},d={},u=[];return l.addListener=function(e){u.push(e)},l.setLangOld=function(e){r=e},l.setDirection=function(e){if("rtl"==e||"ltr"==e){var t=a.get("stg");if(t.data.settings){var n=t.data.settings.rtl;"rtl"==e?(t.data.settings.rtl=!0,c.getOb("body")&&addClass(c.getOb("body"),"rtl"),c.getOb("viewContainer")&&c.getOb("viewContainer").setAttribute("dir","rtl")):(t.data.settings.rtl=!1,c.getOb("body")&&removeClass(c.getOb("body"),"rtl"),c.getOb("viewContainer")&&c.getOb("viewContainer").removeAttribute("dir","rtl"));var o=document.getElementById("spreadR");if(o&&"double"==t.data.currentView){var r=document.getElementById("spreadL");if(n&&"rtl"!=e||!n&&"rtl"==e){var i=r.style.cssText;r.style.cssText=o.style.cssText,o.style.cssText=i}}s.$$phase||s.$apply(),setTimeout(function(){var e=a.get("chapters");e.displayTOC(),e.highlightCurrentTocChapter(),kotobee.dispatchEvent&&kotobee.dispatchEvent("directionChanged",t.data.settings.rtl)},200)}}},l.setLang=function(t,n){a.get("backend").getServerLang({lang:t}).success(function(e){i=e,r=t,s.data&&(s.data.lc||(s.data.lc=0),s.data.lc=Number(s.data.lc)+1),c.getOb("viewContainer")||c.setOb("viewContainer",document.getElementsByClassName("view-container")[0]),l.setDirection("ar"==t?"rtl":"ltr"),kotobee.dispatchEvent&&kotobee.dispatchEvent("languageChanged"),function(){for(var e=0;e<u.length;e++)u[e](r)}(),n&&n()}).error(function(e,t){n&&n()})},l.getLang=function(){return r},l.get=function(e,t){if(!i)return e;if(!r)return e;if(i[e]&&(e=i[e]),t)for(var n=0;n<t.length;n++)e=o(e)(t[n]);return e},l.getOld=function(e,t){if(d[r][e]&&(e=d[r][e]),t)for(var n=0;n<t.length;n++)e=o(e)(t[n]);return e},l}]),app.factory("traverser",["$injector","stg","virt","cache","$ionicScrollDelegate",function(e,c,d,f,h){var l={};function i(e,t){var n=(t=t||{}).root;n=n||f.getOb("epubContent");var o=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,u,!1),r=[],i=p(e.from,{root:n,skipLevels:1}),a=p(e.to,{root:n,skipLevels:1});if(i=i||o.firstChild(),a=a||o.lastChild(),!function(e,t){var n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,u,!1);var o=n.firstChild();var r=l.getAbsoluteIndex(o,t);r.index="0."+r.index,n.currentNode=t;var i=n.lastChild();var a=l.getAbsoluteIndex(i,t);if(a.index="0."+a.index,s(e.from,r.index)&&s(e.to,r.index))return;if(c(e.from,a.index)&&c(e.to,a.index))return;return!0;function s(e,t){for(var n=e.split("."),o=t.split("."),r=0;r<n.length;r++){if(Number(n[r])>Number(o[r]))return!1;if(Number(n[r])<Number(o[r]))return!0;if(null==o[r])return!1}return!0}function c(e,t){for(var n=e.split("."),o=t.split("."),r=0;r<n.length;r++){if(Number(n[r])<Number(o[r]))return!1;if(Number(n[r])>Number(o[r]))return!0;if(null==o[r])return!0}return!0}}(e,n))return r;for(var s=o.currentNode=i;s&&(r.push(s),s!=a);)s=o.nextNode();return r}function u(e){return e.children.length?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}function p(e,t){var n=(t=t||{}).root;t.skipLevels&&(e=e.substr(2*t.skipLevels));var o=e.split("."),r=n,i=1;t.skipLevels&&(i-=t.skipLevels);for(var a=0;a<o.length;a++)if(r){var s=Number(o[a]),c=0;r.hasAttribute("kb-offset")&&(c=Number(r.getAttribute("kb-offset")));var l=r.children[s-c];if(a==i&&l&&d.checkIfRequiresParseAndAnnotations(l),r.parentNode&&-1!=r.parentNode.className.indexOf("kInteractive questions")&&o.length-a==2&&(r=r.children[0]),!l&&!r.children.length)break;r=l}return r}function r(e,t){var n=e.split("."),o=t.split(".");if(e==t)return 0;for(var r=0;r<n.length;r++){if(Number(n[r])>Number(o[r]))return 1;if(Number(n[r])<Number(o[r]))return-1}return n.length>o.length?1:-1}function a(e){var t=0;for(e&&e.parentNode&&e.parentNode.hasAttribute("kb-offset")&&(t=Number(e.parentNode.getAttribute("kb-offset")));e=e.previousSibling;)"#text"!=e.nodeName&&8!=e.nodeType&&t++;return t}return l.getElemsByLocation=function(e,t){t=t||{};var n=[],o=e.split("-");if(1<o.length){var r={from:o[0],to:o[1]};n=i(r,{root:t.root?t.root:document.getElementById("spreadL")}),"double"==c.data.currentView&&(n=n.concat(i(r,{root:document.getElementById("spreadR")})))}else n=function(e,t){var n=new Array,o=t.root;o=o||f.getOb("epubContent");if("double"==c.data.currentView){for(var r=[],i=0;i<e.length;i++){var a=e[i];a="1"+a.substr(1),r.push(a)}e=e.concat(r)}for(i=0;i<e.length;i++)if(e[i]){var s=p(e[i],{root:o});s&&n.push(s)}return n}(o=e.split(","),t);return n},l.getPageByLocation=function(e,t){var n=e.pages;if(n&&n.length){for(var o=0;o<n.length-1;o++){if(r(t,n[o].lastLocation)<=0)return o}return n.length-1}},l.getAbsoluteIndex=function(e,t){t=t||f.getOb("epubContent");for(var n="";e!=t;){n=a(e)+"."+n,e=e.parentNode}var o="left";return""==n?{index:"",side:o}:("1"==n[0]&&(n="0"+n.substr(1),o="right"),{index:n.substr(0,n.length-1),side:o})},l.convertElemsToLocation=function(e,t){t=t||f.getOb("epubContent");for(var n="",o="",r="",i="",a=0;a<e.length;a++){var s=l.getAbsoluteIndex(e[a],t);"left"==s.side?(n+=(n?",":"")+s.index,0==a&&(r=s.index),a==e.length-1&&(r+="-"+s.index)):(o+=(o?",":"")+s.index,0==a&&(i=s.index),a==e.length-1&&(i+="-"+s.index))}return r&&-1==r.indexOf("-")&&i&&0==i.indexOf("-")&&(i=r+=i),{left:n,right:o,leftRange:r,rightRange:i}},l.getTopCornerLocation=function(){return l.convertElemsToLocation([l.getTopCornerElement()]).left},l.getTopCornerElement=function(){for(var e=f.getOb("epubContent"),t=f.getOb("epubContainer"),n=e.children[0],o=h.$getByHandle("content").getScrollPosition().top+25,r=new Array,i=n.getElementsByClassName("k-section"),a=0;a<i.length;a++)hasClass(i[a],"cNone")||r.push(i[a]);var s,c=document.getElementById("readerHeader").offsetHeight+10;for(a=0;a<r.length;a++)for(var l=r[a].getElementsByTagName("*"),d=0;d<l.length;d++)if(!l[d].children.length){var u=l[d].getBoundingClientRect();if(u.bottom>c){if(u.top>c&&u.top<c+10)return l[d];var p=u.top-c;if(!s){s={elem:l[d],bounds:u,distance:p};continue}if(0<p&&p<50)return l[d];p<s.distance&&u.bottom<c+t.offsetHeight&&(s={elem:l[d],bounds:u,distance:p})}}if(s)return s.elem;for(a=0;a<r.length;a++)if(0<r[a].offsetTop-o)return r[a];return r[0]},l.analyzeNodes=function(e,t){var n,o,r,i,a,s;n=new Array,o=new Array;for(var c=f.getOb("epubContent").parentNode,l=e;n.push(l),(l=l.parentNode)!=c;);for(l=t;o.push(l),(l=l.parentNode)!=c;);var d=function(){for(var e=0;e<n.length;e++)for(var t=0;t<o.length;t++)if(o[t]==n[e])return[o[t],e,t]}();a=d[0],r=d[1],i=d[2];for(var u=0;u<a.childNodes.length;u++){if(a.childNodes[u]==n[r-1]){s=!1;break}if(a.childNodes[u]==o[i-1]){s=!0;break}}var p={};return p.parents1=n,p.parents2=o,p.index1=r,p.index2=i,p.commonParent=a,p.reversed=s,p},l.nextTextNode=function(e,t){for(t=t||e;!e.nextSibling;)if((e=e.parentNode)==t)return;for(e=e.nextSibling;e.childNodes[0];)e=e.childNodes[0];return"#text"==e.nodeName&&e.textContent.trim()?e:l.nextTextNode(e,t)},l.prevTextNode=function(e,t){for(t=t||e;!e.previousSibling;)if((e=e.parentNode)==t)return;for(e=e.previousSibling;e.childNodes.length;)e=e.childNodes[e.childNodes.length-1];return"#text"==e.nodeName&&e.textContent.trim()?e:l.prevTextNode(e,t)},l}]),app.factory("view",["stg",function(o){var e={};return e.generate=function(){var e=o.data.currentLibrary,t=o.data.currentLibrary.cloud,n=o.view;n.registration={},n.registration.promocode=t&&!t.public&&e&&!e.cloud.promocodesdisabled&&e.promocodesettings.inregistration,n.topmenu={},n.topmenu.promocode=t&&!t.public&&e&&!e.cloud.promocodesdisabled&&e.promocodesettings.intopmenu,n.topmenu={},n.topmenu.promocode=t&&!t.public&&e&&!e.cloud.promocodesdisabled&&e.promocodesettings.intopmenu,n.bookinfo={},n.bookinfo.promocode=t&&!t.public&&e&&!e.cloud.promocodesdisabled&&e.promocodesettings.inbookinfo},e}]),app.factory("virt",["$ionicScrollDelegate","$filter","$location","cache","$q",function(c,n,e,l,i){var t,d,o,r,u={};u.lock=function(){d=!0},u.unlock=function(){d=!1},u.enable=function(){t||d||(t=!0,r&&clearInterval(r),o=setInterval(a,60),a())},u.disableAfter=function(e){r&&clearInterval(r),r=setInterval(function(){u.disable(),clearInterval(r)},e)},u.disable=function(){t&&(d||(t=!1,clearInterval(o)))};var a=function(){d||n("contentVirt")()};return u.reset=function(e,t){d||(u.reveal(!0),n("contentVirt")("reset"),n("contentVirt")(null,e,function(){u.reveal(!1),t&&t()}))},u.checkIfRequiresParse=function(e){hasClass(e,"parsed")||n("contentVirt")("parse",e)},u.checkIfRequiresParseAndAnnotations=function(e){hasClass(e,"parsed")||n("contentVirt")("parseAndAnnotations",e)},u.reveal=function(e){d||n("contentVirt")(e?"reveal":"undoReveal")},u.safeAnchorScroll=function(e,t,n){if(!d){var o=i.defer();u.reveal(!0);var r=document.getElementById(t);return u.safeScrollToElem(e,r,n),timeOut(function(){u.reset(),o.resolve()},1300),o.promise}},u.safeScroll=function(e,t,n,o){if(!d){var r=i.defer();return o=o||!0,u.reveal(!0),c.$getByHandle(e).scrollTo(Math.round(t),Math.round(n),o),timeOut(function(){u.reset(),r.resolve()},1300),r.promise}},u.safeScrollToElem=function(e,t,n){if(t&&!d){u.reveal(!0);var o=l.getOb("epubContainer"),r=0,i=getComputedStyle(o).paddingTop;i&&(r=Number(i.split("px")[0]));var a=c.$getByHandle(e).getScrollPosition().top;mobile||"auto"==getComputedStyle(o).overflowY&&(a=o.scrollTop);var s=a-(o.getBoundingClientRect().top+r)-25;return u.safeScroll(e,0,t.getBoundingClientRect().top+s,n)}},u.forceRepaint=function(){try{var e=document.createTextNode(" ");document.body.appendChild(e),setTimeout(function(){},0)}catch(e){}},u}]),app.factory("workers",["stg",function(e){var o,r,i,t,n={},a=[],s=[],c=[];function l(e){t=!0}n.initialize=function(){if(h()){try{o=new Worker(rootDir+"js/workers/cssParser.js"),r=new Worker(rootDir+"js/workers/htmlParser.js"),i=new Worker(rootDir+"js/workers/search.js"),o.addEventListener("error",l,!1),r.addEventListener("error",l,!1),i.addEventListener("error",l,!1),o.addEventListener("message",p,!1),r.addEventListener("message",p,!1),i.addEventListener("message",p,!1)}catch(e){t=!0}navigator.serviceWorker&&navigator.serviceWorker.register("service-worker.js")}};var d=0;function u(e){if(e.length){var t=e[0].args,n=e[0].id;f(t[0]).postMessage({func:t[1],params:t[2],id:n})}}function p(e){var t=function(e){if(e==o)return a;if(e==r)return s;if(e==i)return c}(e.target),n=t[0].args[3];n&&n(e.data.data),t.shift(),u.apply(this,[t])}function f(e){return"cssParser"==e?o:"htmlParser"==e?r:"search"==e?i:void 0}function h(){return!t&&"undefined"!=typeof Worker}return n.call=function(e,t,n,o){if(++d,f(e)){var r=function(e){if("cssParser"==e)return a;if("htmlParser"==e)return s;if("search"==e)return c}(e),i=[e,t,n,o];r.push({args:i,id:d}),1==r.length&&u(r)}},n.supported=function(){return h()},n}]),app.factory("bookmarks",["selection","translit","crdv","$injector","popovers","stg","cache","modals","virt","traverser","chapters",function(r,i,t,a,s,c,l,d,u,p,f){var h,g={};return g.addBookmarksFromOffline=function(e){for(var t=l.getOb("epubContent"),n=0;null!=(t=t.previousSibling);)n++;var o=[];o.push(a.get("chapters").getUnanchoredIndex(currentIndex)),c.data.currentRPageOb&&o.push(c.data.currentRPageOb.index);for(var r=0;r<o.length;r++)for(var i=0;i<e.length;i++)e[i].chapter==o[r]&&String(e[i].location).split(".")[1]==n&&g.addIcon(e[i])},g.addBookmark=function(){var e={};e.chapter=currentIndex,e.chaptername||(e.chaptername=c.data.currentPageOb.title),e.file||(e.file=c.getChapterFilename()),e.location=p.getTopCornerLocation(),c.addBookmark(e,function(){g.addIcon(e),t.toast(i.get("bookmarked"))})},g.addBookmarksFromSync=function(n,o){g.deleteAll(!0,function(){var t=-1;!function e(){++t>=n.length?o&&o():function(t,n){c.readSlot("bookmark"+c.getBookId(),function(e){e=e||[],t.file==c.getChapterFilename()&&(f.busy||arrayContainsProperty(e,"bmid",t.bmid)||g.addIcon(t)),e.push(t),c.writeSlot("bookmark"+c.getBookId(),e,function(){var e;c.isManipulated(t)&&c.addBookmark(e=Object.assign(t,{chapter:null,chaptername:null,file:null}),function(){g.addIcon(e)}),n&&n()})})}(n[t],function(){t%100==0?setTimeout(e,10):e()})}()})},g.addIconIfNotShown=function(e){g.addIcon(e)},g.addIcon=function(n){var e=p.getElemsByLocation(n.location);if(e[0]){var o=r.createBookMarker(n,e[0]);if(o.className="contentBookMarker",o.setAttribute("bmid",n.bmid),o.setAttribute("bloc",e[0].offsetTop),o.addEventListener("tap",function(e){e.stopImmediatePropagation()}),o.addEventListener("click",function(e){u.safeScrollToElem("content",o,!0);var t={};t.bmid=this.getAttribute("bmid"),t.location=this.getAttribute("bloc")}),o.addEventListener("hold",function(e){var t=[{name:i.get("delete"),func:function(){g.delete(n.bmid),s.hide()}},{name:i.get("cancel"),func:function(){s.hide()}}];s.show({mode:"list",listOb:t,backdropClickToClose:!1})}),!mobile){var t=document.createElement("span");t.className="editIcon icon kb-close",t.addEventListener("click",function(e){g.confirmDeletion(function(){g.delete(n.bmid),d.hide()})}),t.addEventListener("tap",function(e){e.stopImmediatePropagation()}),o.appendChild(t),o.addEventListener("mouseover",function(e){addClass(o,"edit"),o.addEventListener("mouseout",function(e){removeClass(o,"edit")})})}}},g.confirmDeletion=function(e){if(h)return e();d.hide();var t={title:"confirmation",msg:"bookmarkDeleteConfirm",barStyle:"bar-dark"},n={label:"delete",style:"button-assertive",func:function(){t.dontAskChecked&&(h=!0),e&&e(),d.hide()}},o={label:"cancel",func:function(){t.dontAskChecked&&(h=!0),d.hide()}};t.dontAsk=!0,t.btns=[n,o],d.show({mode:"confirm",confirmOptions:t})},g.delete=function(e,t,n){r.deleteBookMarker(e),c.deleteBookmark(e,t,n)},g.deleteAll=function(o,r){c.getBookmarks(function(t){var n=-1;!function e(){n++;if(n>=t.length)return void(r&&r());g.delete(t[n].bmid,o,function(){n%100==0?setTimeout(e,30):e()})}()})},g}]),app.factory("freehand",["$rootScope","$injector","$location","crdv","sync","stg","cache","chapters",function(e,i,t,n,o,a,s,r){var c,l,d,u,p={},f=[],h=[],g={},m={brushes:[2,4,6,8,10,12],colors:["yellow","red","blue","green","black"],smoothing:[1,2,3,4,5]};function v(){var e,t=s.getOb("epubContainer");t&&((c=c||document.getElementById("freehandCanvasLeft"))||((c=document.createElement("canvas")).className="freehandCanvas",c.id="freehandCanvasLeft",c.width=t.offsetWidth,c.height=t.offsetHeight,c.addEventListener("mousedown",x),c.addEventListener("touchstart",x),u=c.getContext("2d")),(e=b(document.getElementById("spreadL")))&&e.appendChild(c),"double"==a.data.currentView&&((l=l||document.getElementById("freehandCanvasRight"))||((l=document.createElement("canvas")).className="freehandCanvas",l.id="freehandCanvasRight",l.width=t.offsetWidth,l.height=t.offsetHeight,l.addEventListener("mousedown",x),l.addEventListener("touchstart",x),u=l.getContext("2d")),(e=b(document.getElementById("spreadR")))&&e.appendChild(l)))}function b(e){return getElementsByAttribute(e,"div","id","fxlChapter")[0]}function y(e){if((!(e=e||{}).checkLayout||"fxl"==a.data.book.chapter.layout)&&(config.freehand||preview))return!0}function k(){var e=b(document.getElementById("spreadL"));if(c.width=removePx(e.style.width),c.height=removePx(e.style.height),"double"==a.data.currentView&&l){e=b(document.getElementById("spreadR"));l.width=removePx(e.style.width),l.height=removePx(e.style.height)}!function(){for(var e=0;e<f.length;e++){var t=S(f[e].chapter);t.beginPath();var n=f[e].points[0];"pen"==f[e].type?t.globalCompositeOperation="source-over":"eraser"==f[e].type&&(t.globalCompositeOperation="destination-out"),t.moveTo(n[0],n[1]),t.strokeStyle="orange",t.lineWidth=5,f[e].style&&f[e].style.color&&(t.strokeStyle=f[e].style.color),f[e].style&&f[e].style.brush&&(t.lineWidth=f[e].style.brush),t.lineCap="round",t.lineJoin="round";for(var o=1;o<f[e].points.length;o++)E(t,f[e].points[o-1],f[e].points[o],f[e].points[o+1]);t.stroke()}}()}function w(e){if(e.touches){var t=e.touches[0],n=getBoundingBox(d),o=Number(d.getAttribute("width")),r=Number(d.getAttribute("height"));return{offsetX:(t.pageX-n.left)*o/n.width,offsetY:(t.pageY-n.top)*r/n.height}}return{offsetX:e.offsetX,offsetY:e.offsetY}}function x(e){e.stopPropagation(),(d=e.currentTarget).addEventListener("mousemove",C),d.addEventListener("mouseup",I),d.addEventListener("touchmove",C),d.addEventListener("touchend",I);var t=w(e);(u=d.getContext("2d")).beginPath(),u.moveTo(t.offsetX,t.offsetY),u.strokeStyle=p.currentStyle.color,u.lineWidth=p.currentStyle.brush,u.lineCap="round",u.lineJoin="round",(g={type:p.mode,points:[],style:clone(p.currentStyle)}).points.push([t.offsetX,t.offsetY])}function C(e){e.stopPropagation(),"pen"==p.mode?u.globalCompositeOperation="source-over":"eraser"==p.mode&&(u.globalCompositeOperation="destination-out");var t=w(e);u.lineTo(t.offsetX,t.offsetY),u.stroke(),g.points.push([t.offsetX,t.offsetY])}function I(e){e.stopPropagation(),d.removeEventListener("mousemove",C),d.removeEventListener("mouseup",I),u.closePath(),function(e,t){for(var n=[],o=0;o<e.points.length;o+=t)n.push(e.points[o]);e.points=n}(g,p.smoothing),g.chapter=function(e){if(c==e)return a.data.currentPageOb.index;if("double"==a.data.currentView&&l==e)return a.data.currentRPageOb.index}(d),g.chaptername=function(e){if(c==e)return a.data.currentPageOb.title;if("double"==a.data.currentView&&l==e)return a.data.currentRPageOb.title}(d),g.file=function(e){if(c==e)return ph.relative(ph.join(bookPath,a.data.packageURL),a.data.currentPageOb.url);if("double"==a.data.currentView&&l==e)return ph.relative(ph.join(bookPath,a.data.packageURL),a.data.currentRPageOb.url)}(d),f.push(g),h=clone(f),T(),k()}function E(e,t,n,o,r,i){void 0===r&&(r=.3),void 0===i&&(i=.6);var a,s,c,l,d,u=0,p=t,f=n;s=(c=o)?(l=p,u=((d=c)[1]-l[1])/(d[0]-l[0]),(a=(c[0]-f[0])*-r)*u*i):a=0,e.bezierCurveTo(p[0]-0,p[1]-0,f[0]+a,f[1]+s,f[0],f[1])}function S(e){return"double"==a.data.currentView&&a.data.currentRPageOb&&a.data.currentRPageOb.index==e?l.getContext("2d"):c.getContext("2d")}function T(){for(var e={},t=0;t<f.length;t++)e[f[t].chapter]=f[t];for(var n in e){var o={},r=clone(e[n]);delete r.chapter,delete r.chaptername,delete r.file,o.data=LZString.compressToUTF16(JSON.stringify(r)),o.chapter=n,o.chaptername=e[n].chaptername,o.file=e[n].file,a.addSketch(o)}}return p.initialize=function(){y()&&(function(){for(var e=document.getElementsByTagName("script"),t=0;t<e.length;t++)if(e[t].getAttribute("src")&&0<=e[t].getAttribute("src").indexOf("lz-string/lz-string.min.js"))return;var n=document.getElementsByTagName("head")[0],o=document.createElement("script");o.src=rootDir+"lib/lz-string/lz-string.min.js",n.appendChild(o)}(),p.defs=m,p.currentStyle={color:"blue",brush:3},p.smoothing=2,!0,window.addEventListener("resize",function(){y({checkLayout:!0})&&!function(){if(t.path()&&0<=t.path().indexOf("/reader"))return!1;return!0}()&&(v(),k(),p.deactivate(),e.$$phase||e.$apply())}))},p.addSketchesFromOffline=function(e){if(config.freehand||preview){p.initNewChapter();for(var t=s.getOb("epubContent");null!=(t=t.previousSibling);)0;var n=[];n.push(i.get("chapters").getUnanchoredIndex(currentIndex)),a.data.currentRPageOb&&n.push(a.data.currentRPageOb.index);for(var o=0;o<n.length;o++)for(var r=0;r<e.length;r++)e[r].chapter==n[o]&&p.loadAndDisplay(e[r])}},p.activate=function(){v(),p.mode="pen",addClass(c,"active"),c.addEventListener("mousedown",x),c.addEventListener("touchstart",x),"double"==a.data.currentView&&l&&(addClass(l,"active"),l.addEventListener("mousedown",x),l.addEventListener("touchstart",x)),e.renderScope.applyHeader("freehand")},p.deactivate=function(){removeClass(c,"active"),c.removeEventListener("mousedown",x),c.removeEventListener("touchstart",x),"double"==a.data.currentView&&l&&(removeClass(l,"active"),l.removeEventListener("mousedown",x),l.removeEventListener("touchstart",x)),e.renderScope.applyHeader("default"),s.getOb("epubContainer").focus()},p.initNewChapter=function(){y({checkLayout:!0})&&(v(),f=[],k())},p.loadAndDisplay=function(e){v();var t=e.data;if(t&&t.length){var n=JSON.parse(LZString.decompressFromUTF16(t));n.chapter=e.chapter,n.chaptername=e.chaptername,n.file=e.file,f.push(n)}k()},p.clear=function(){for(var e=0;e<f.length;e++)a.deleteSketch(f[e].id);f=[],c.getContext("2d").clearRect(0,0,c.width,c.height),"double"!=a.data.currentView||l&&l.getContext("2d").clearRect(0,0,l.width,l.height)},p.undo=function(){0!=f.length&&(f=h.slice(0,f.length-1),T(),k())},p.redo=function(){h.length<=f.length||(f.push(h[f.length]),T(),k())},p.addSketchesFromSync=function(n,o){if(!y({checkLayout:!0}))return o?o():o;p.deleteAll(!0,function(){try{p.initNewChapter()}catch(e){}var t=-1;!function e(){if(++t>=n.length)return o?o():o;!function(t,n){a.readSlot("sketch"+a.getBookId(),function(e){e=e||[],t.file==a.getChapterFilename()&&(r.busy||arrayContainsProperty(e,"id",t.id)||p.loadAndDisplay(t)),e.push(t),a.writeSlot("sketch"+a.getBookId(),e,function(){var e;a.isManipulated(t)&&a.addSketch(e=Object.assign(t,{chapter:null,chaptername:null,file:null}),function(){p.loadAndDisplay(e)}),n&&n()})})}(n[t],function(){t%100==0?setTimeout(e,10):e()})}()})},p.deleteAll=function(o,r){a.getSketches(function(t){var n=-1;!function e(){n++;if(n>=t.length)return void(r&&r());p.delete(t[n].id,o,function(){n%100==0?setTimeout(e,30):e()})}()})},p.delete=function(e,t,n){a.deleteSketch(e,t,n)},p}]),app.factory("hlights",["selection","cache","crdv","backend","stg","$rootScope","modals","chapters","$injector",function(a,s,e,t,c,l,d,u,p){var r,f={};return f.addHlightsFromOffline=function(e){for(var t=s.getOb("epubContent"),n=0;null!=(t=t.previousSibling);)n++;var o=[];o.push(p.get("chapters").getUnanchoredIndex(currentIndex)),c.data.currentRPageOb&&o.push(c.data.currentRPageOb.index);for(var r=0;r<o.length;r++)for(var i=0;i<e.length;i++)e[i].chapter==o[r]&&String(e[i].location).split(".")[1]==n&&f.addHlight(e[i])},f.addHlightsFromSync=function(n,o){f.deleteAll(!0,function(){var t=-1;!function e(){++t>=n.length?o&&o():function(t,n){c.readSlot("hlight"+c.getBookId(),function(e){e=e||[],t.file==c.getChapterFilename()&&(u.busy||arrayContainsProperty(e,"hid",t.hid)||f.addHlight(t)),e.push(t),c.writeSlot("hlight"+c.getBookId(),e,function(){var e;c.isManipulated(t)&&c.addHlight(e=Object.assign(t,{chapter:null,chaptername:null,file:null}),function(){f.addHlight(e)}),n&&n()})})}(n[t],function(){t%100==0?setTimeout(e,10):e()})}()})},f.addHlight=function(e){for(var t=document.getElementsByClassName("hlight"+e.hid),n=t.length;n--;)t[n].style.backgroundColor=null,removeClass(t[n],"contentHlightBG"),removeClass(t[n],"hlight"+e.hid);for(n=(t=p.get("annotations").getMatchingElements(e)).length;n--;)t[n]&&("double"==c.data.currentView&&!u.elemInChapterElem(t[n],e.chapter)||(addClass(t[n],"contentHlightBG"),addClass(t[n],"hlight"+e.hid),t[n].style.backgroundColor=e.color));return f},f.showPopup=function(r,i){l.$new(!0).hlightOb={},r=r||[];var e={save:function(e){for(var t=0;t<r.length;t++){var n=r[t];null==n.chapter&&(n.chapter=u.getElemChapterIndex(a.getSelectedNodes()[0])),n.chaptername||(n.chaptername=u.getElemChapterTitle(a.getSelectedNodes()[0])),n.file||(n.file=c.getChapterFilename()),n.color=e,null==n.src&&(n.src=a.getSelectedText());var o=t==r.length-1;c.addHlight(n,function(){f.addHlight(n),o&&timeOut(function(){d.hide(),i&&i(!0),l.$$phase||l.$apply()},300)})}}};e.color=r[0].color?r[0].color:"#fffb85",r[0].hid&&(e.delete=function(){for(var e=0;e<r.length;e++)f.delete(r[0].hid,null,function(){e==r.length-1&&timeOut(function(){d.hide(),i&&i()},300)})}),d.show({mode:"hlight",hlightOptions:e})},f.confirmDeletion=function(e){if(r)return e();d.hide();var t={title:"confirmation",msg:"hlightDeleteConfirm",barStyle:"bar-dark"},n={label:"delete",style:"button-assertive",func:function(){t.dontAskChecked&&(r=!0),e&&e(),d.hide()}},o={label:"cancel",func:function(){t.dontAskChecked&&(r=!0),d.hide()}};t.dontAsk=!0,t.btns=[n,o],d.show({mode:"confirm",confirmOptions:t})},f.delete=function(e,t,n){for(var o=document.getElementsByClassName("hlight"+e),r=o.length;r--;)r==o.length-1&&removeClass(o[r],"last"),removeClass(o[r],"contentHlightBG"),o[r].style.backgroundColor=null,removeClass(o[r],"hlight"+e);c.deleteHlight(e,t,n)},f.deleteAll=function(o,r){c.getHlights(function(t){var n=-1;!function e(){n++;if(n>=t.length)return void(r&&r());f.delete(t[n].hid,o,function(){n%100==0?setTimeout(e,30):e()})}()})},f}]),app.factory("notes",["selection","translit","crdv","$ionicGesture","stg","$rootScope","cache","modals","popovers","$injector","nav","$ionicScrollDelegate","virt","$timeout","chapters","book","$sce","traverser",function(c,l,t,e,b,n,s,d,u,p,o,r,f,h,y,i,a,k){var g,m,v={};function w(e){for(var t=e.split(" "),n=0;n<t.length;n++)if(t[n]&&0==t[n].trim().indexOf("knote"))return t[n].trim().split("knote")[1]}function x(n,o){v.getCurrentNotes(function(e){for(var t=0;t<e.length;t++)if(e[t].nid==n)return o(e[t]);return o()})}function C(e,t){v.confirmDeletion(function(){v.delete(e,null,function(){h(function(){d.hide(),t&&t()},300)})})}function I(t){var r=this.obs,i=this.cb,a=this.public;asyncCheck(!a,v.confirmPublic,[],function(){for(var e=0;e<r.length;e++){var n=r[e];n.chapter||(n.chapter=y.getElemChapterIndex(c.getSelectedNodes()[0],{ignoreAnchors:!0})),n.chaptername||(n.chaptername=y.getElemChapterTitle(c.getSelectedNodes()[0])),n.file||(n.file=b.getChapterFilename()),n.location||(n.location=k.getTopCornerLocation()),n.type||(n.type="page"),n.src||(n.src="content"==n.type?c.getSelectedText():""),n.nid=t.nid,t.date?n.date=t.date:delete n.date,n.dateLocal=t.dateLocal;var o=null==n.nid;o&&(n.dateLocal=new Date,delete n.date),n.note=t.note,a?n.public=!0:delete n.public;b.addNote(n,function(){if(o)v.addIcon(n);else{E(c.getNoteMarker(n.nid).elem,n);var e=k.getElemsByLocation(n.location),t=e[e.length-1];t&&E(t,n)}h(function(){d.hide(),i&&i(!0)},300)})}})}function E(){}return v.addNotesFromOffline=function(e){for(var t=s.getOb("epubContent"),n=0;null!=(t=t.previousSibling);)n++;var o=[];o.push(p.get("chapters").getUnanchoredIndex(currentIndex)),b.data.currentRPageOb&&o.push(b.data.currentRPageOb.index);for(var r=0;r<o.length;r++)for(var i=0;i<e.length;i++)e[i].chapter==o[r]&&String(e[i].location).split(".")[1]==n&&v.addIcon(e[i])},v.addNotesFromSync=function(n,o){v.deleteAll(!0,function(){var t=-1;!function e(){++t>=n.length?o&&o():function(t,n){b.readSlot("note"+b.getBookId(),function(e){e=e||[],t.file==b.getChapterFilename()&&(y.busy||arrayContainsProperty(e,"nid",t.nid)||v.addIcon(t)),e.push(t),b.writeSlot("note"+b.getBookId(),e,function(){var e;b.isManipulated(t)&&b.addNote(e=Object.assign(t,{chapter:null,chaptername:null,file:null}),function(){v.addIcon(e)}),n&&n()})})}(n[t],function(){t%100==0?setTimeout(e,10):e()})}()})},v.getCurrentNotes=function(o){for(var r=[],e=s.getOb("epubContent"),i=0;null!=(e=e.previousSibling);)i++;var a=[];a.push(p.get("chapters").getUnanchoredIndex(currentIndex)),b.data.currentRPageOb&&a.push(b.data.currentRPageOb.index),b.readSlot("note"+b.getBookId(),function(e){for(var t=0;t<a.length;t++)for(var n=0;n<e.length;n++)e[n].chapter==a[t]&&String(e[n].location).split(".")[1]==i&&r.push(e[n]);o(r)})},v.getCurrentNotesByLocation=function(n,o){var r=[];if(!n)return o([]);v.getCurrentNotes(function(e){for(var t=0;t<e.length;t++)e[t].location==n&&r.push(e[t]);r.sort(function(e,t){var n=phpDateToJS(e.date?e.date:e.dateLocal);return phpDateToJS(t.date?t.date:t.dateLocal)<n?1:-1}),o(r)})},v.addNotesFromQuestions=function(e,t){for(var n=e.elem.getElementsByClassName("ques"),o=[],r=[],i=0;i<n.length;i++){var a=n[i],s=a.getElementsByClassName("questionTxt");s.length||(s=a.getElementsByTagName("p"));for(var c=s[0].textContent,l=a.getElementsByClassName("ans"),d=0;d<l.length;d++){var u,p=l[d],f=p.className;f=f.split(" "),"radio"==p.type?u="mcq":"checkbox"==p.type?u="mmcq":"text"==p.type?u="sa":"textarea"==p.type&&(u="sa");var h=w(p.className),g="";if("mcq"==u||"mmcq"==u){if(!p.checked){h&&r.push({nid:h,elem:p});continue}g=p.nextElementSibling.textContent}if("sa"==u){if(""==p.value){h&&r.push({nid:h,elem:p});continue}g=p.value}var m={};m.chapter||(m.chapter=y.getElemChapterIndex(p,{ignoreAnchors:!0})),m.chaptername||(m.chaptername=y.getElemChapterTitle(p)),m.file||(m.file=y.getElemChapterFilename()),m.location||(m.location=k.convertElemsToLocation([p],e.root).left,e.rootIndex&&(m.location=e.rootIndex+"."+m.location)),m.type||(m.type="content"),m.src||(m.src=c),m.note=g,h&&(m.nid=h),o.push({ob:m,elem:p})}}function v(e){e>=r.length?t&&t():b.deleteNote(r[e].nid,null,function(){removeClass(r[e].elem,"knote"+r[e].nid),v(++e)})}!function e(t){if(t>=o.length)return void v(0);b.addNote(o[t].ob,function(){addClass(o[t].elem,"knote"+o[t].ob.nid),e(++t)})}(0)},v.addIcon=function(n,e){if("page"==n.type){if(!(i=k.getElemsByLocation(n.location))[0])return;var o=c.createNoteMarker(n,i[0],{class:"contentSideNoteMarker"});if(E(o,n),o.addEventListener("click",function(t){f.safeScrollToElem("content",o,!0),x(this.id.split("knote")[1],function(e){v.noteClicked([e]),t.stopImmediatePropagation()})}),o.addEventListener("tap",function(e){e.stopImmediatePropagation()}),o.addEventListener("hold",function(e){var t=[{name:l.get("edit"),func:function(){u.hide(),v.noteClicked([n])}},{name:l.get("delete"),func:function(){b.deleteNote(n.nid,null,function(){c.deleteNoteMarker(n.nid),u.hide()})}},{name:l.get("cancel"),func:function(){u.hide()}}];u.show({mode:"list",listOb:t,backdropClickToClose:!1})}),!mobile){var t=document.createElement("span");t.className="editIcon icon kb-close",t.addEventListener("click",function(e){v.confirmDeletion(function(){b.deleteNote(n.nid,null,function(){c.deleteNoteMarker(n.nid)})}),e.stopImmediatePropagation()}),t.addEventListener("tap",function(e){e.stopImmediatePropagation()}),o.appendChild(t),o.addEventListener("mouseover",function(e){addClass(o,"edit"),o.addEventListener("mouseout",function(e){removeClass(o,"edit")})})}}if("content"==n.type){for(var r,i=p.get("annotations").getMatchingElements(n,{root:e}),a=0;a<i.length;a++)i[a]&&addClass(i[a],"knote"+n.nid);if(1==i.length&&i[0]){var s=i[0].type;if("radio"==s||"checkbox"==s)return void(i[0].checked=!0);if("text"==s||"textarea"==s)return void(i[0].value=n.note)}for(a=0;a<i.length;a++)i[a]&&("double"==b.data.currentView&&!y.elemInChapterElem(i[a],n.chapter)||addClass(r=i[a],"contentNoteBG"));if(!r)return;E(r,n),addClass(r,"last"),h(function(){try{var e=c.createNoteMarker(n,r);e&&(e.onclick=function(t){var e=this.getAttribute("id");x(e.split("knote")[1],function(e){v.noteClicked([e]),t.stopImmediatePropagation(),t.preventDefault()})},e.addEventListener("tap",function(e){e.stopImmediatePropagation()}))}catch(e){}})}},v.confirmDeletion=function(e){if(g)return e();d.hide();var t={title:"confirmation",msg:"noteDeleteConfirm",barStyle:"bar-dark"},n={label:"delete",style:"button-assertive",func:function(){t.dontAskChecked&&(g=!0),e&&e(),d.hide()}},o={label:"cancel",func:function(){t.dontAskChecked&&(g=!0),d.hide()}};t.dontAsk=!0,t.btns=[n,o],d.show({mode:"confirm",confirmOptions:t})},v.confirmPublic=function(e){if(m)return e();d.hide();var t={title:"confirmation",msg:"notePublicConfirm",barStyle:"bar-dark"},n={label:"ok",style:"button-positive",func:function(){t.dontAskChecked&&(m=!0),e&&e(),d.hide()}},o={label:"cancel",func:function(){t.dontAskChecked&&(m=!0),d.hide()}};t.dontAsk=!0,t.btns=[n,o],d.show({mode:"confirm",confirmOptions:t})},v.noteClicked=function(n,o){try{n=n||[{}],v.getCurrentNotesByLocation(n[0]?n[0].location:null,function(e){var t={};t.cb=o,t.obs=n,t.save=I,t.note={},t.delete=C,t.allNotes=e,d.show({mode:"note",dynamic:!0,animation:"slide-in-up",noteOptions:t,event:n[0].event})})}catch(e){}},v.noteClickedOld=function(t,n){try{t=t||[{}];var e={};e.cb=n,e.obs=t,e.save=I,t[0]&&t[0].note&&(Object.assign(e,t[0]),e.delete=function(){v.confirmDeletion(function(){for(var e=0;e<t.length;e++)v.delete(t[0],null,function(){e==t.length-1&&h(function(){d.hide(),n&&n()},300)})})}),d.show({mode:"note",dynamic:!0,animation:"slide-in-up",noteOptions:e,event:t[0].event})}catch(e){}},v.delete=function(e,t,n){var o=e.nid;c.deleteNoteMarker(o);for(var r=document.getElementsByClassName("knote"+o),i=r.length;i--;){var a=r[i];i==r.length-1&&(removeClass(r[i],"last"),v.deleteNoteAttribute(r[i])),removeClass(r[i],"knote"+o),-1==a.className.indexOf("knote")&&removeClass(a,"contentNoteBG")}b.deleteNote(o,t,n)},v.deleteAll=function(o,r){b.getNotes(function(t){var n=-1;!function e(){n++;if(n>=t.length)return void(r&&r());v.delete(t[n],o,function(){n%100==0?setTimeout(e,30):e()})}()})},v.deleteNoteAttribute=function(e){},v.notebookClicked=function(e){native&&t.vibrate(),p.get("annotations").updateNotebookArray({},function(){overflowScroll||o.resize(),d.show({mode:"notebook",dynamic:!0,scope:e,animation:"slide-in-up",cb:function(){overflowScroll?document.getElementById("notebookContent").scrollTop=0:r.$getByHandle("notebookScroll").scrollTop()}})})},v}]);var kInteractive={preRender:function(e,t){var n,o=(t=t||{}).singleElem,r=e||document;o?(n=[e],r=document):n=r.getElementsByClassName("kInteractive"),void 0!==isKotobee&&(kInteractive.absoluteURL=t.chapterUrl?t.chapterUrl:angular.element(document.body).scope().data.book.chapter.absoluteURL);for(var i=n.length;i--;){var a=n[i];this.hasClass(a,"gallery")&&kInteractive.gallery.preRender(a,r,i),this.hasClass(a,"questions")&&kInteractive.questions.preRender(a,r,i),!this.hasClass(a,"image")&&"img"!=a.nodeName.toLowerCase()||kInteractive.image.preRender(a,r,i),this.hasClass(a,"link")&&kInteractive.link.preRender(a,r,i),this.hasClass(a,"container")&&kInteractive.container.preRender(a,r,i),this.hasClass(a,"equation")&&kInteractive.equation.preRender(a,r,i),this.hasClass(a,"lipsync")&&kInteractive.lipsync.preRender(a,r,i)}},postRender:function(t,e){var n=(e=e||{}).singleElem;void 0!==isKotobee&&(kInteractive.absoluteURL=e.chapterUrl?e.chapterUrl:angular.element(document.body).scope().data.book.chapter.absoluteURL),kInteractive.videoIsFullscreen=!1,kInteractive.timestamp=new Date,kInteractive.currentVideo=kInteractive.currentAudio=null,kInteractive.clearAudioVideo(t);var o,r=t||document;n?(o=[t],r=document):o=r.getElementsByClassName("kInteractive");for(var i=o.length;i--;){var a=o[i],s=i;null!=e.forcedIndex&&(s=e.forcedIndex),this.hasClass(a,"container")?kInteractive.container.postRender(r,a,s,e):this.hasClass(a,"questions")?kInteractive.questions.postRender(r,a,s,e):this.hasClass(a,"widget")?kInteractive.widget.postRender(r,a,s,e):this.hasClass(a,"video")?kInteractive.video.postRender(r,a,s):this.hasClass(a,"audio")?kInteractive.audio.postRender(r,a,s):this.hasClass(a,"threed")?kInteractive.threed.postRender(r,a,s,e):this.hasClass(a,"gallery")?kInteractive.gallery.postRender(r,a,s):this.hasClass(a,"image")?kInteractive.image.postRender(r,a,s):this.hasClass(a,"equation")?kInteractive.equation.postRender(r,a,s):this.hasClass(a,"lipsync")&&kInteractive.lipsync.postRender(r,a,s)}this.firstRun&&(window.addEventListener("resize",function(e){kInteractive.resizeEvent(t,n)}),this.firstRun=!1),kInteractive.resizeEvent(t,n)},actionEvent:function(e){return kInteractive.action(e.target,e)},action:function(e,t){if(!kInteractive.isEditorMode()){void 0!==isKotobee&&(kInteractive.absoluteURL=angular.element(document.body).scope().data.book.chapter.absoluteURL);for(var n=e;!this.hasClass(n,"kInteractive");){if(!n.parentNode)return;if((n=n.parentNode)==document.body)return}return this.hasClass(n,"questions")?kInteractive.questions.action(n,e,t):this.hasClass(n,"widget")?kInteractive.widget.action(n):this.hasClass(e,"link")?kInteractive.link.action(n,e,t):this.hasClass(e,"image")?kInteractive.image.action(n,e,t):this.hasClass(n,"gallery")?kInteractive.gallery.action(n,e,t):this.hasClass(n,"audio")?kInteractive.audio.action(n,e,t):this.hasClass(n,"video")?kInteractive.video.action(n,e,t):this.hasClass(n,"threed")?kInteractive.threed.action(n,e,t):this.hasClass(n,"equation")?kInteractive.equation.action(n,e,t):this.hasClass(n,"lipsync")?kInteractive.lipsync.action(n,e,t):void 0}},trigger:function(e,t){this.action(t,e)},resize:function(e,t){kInteractive.resizeEvent(e,t)},resizeEvent:function(e,t){var n=e||document;t&&(n=document);for(var o=n.getElementsByClassName("kInteractive"),r=o.length;r--;){var i=o[r];this.hasClass(i,"image")?kInteractive.image.resize(i):this.hasClass(i,"gallery")?kInteractive.gallery.resize(i):this.hasClass(i,"container")?kInteractive.container.resize(i):this.hasClass(i,"video")?kInteractive.video.resize(i):this.hasClass(i,"widget")?kInteractive.widget.resize(i):this.hasClass(i,"equation")&&kInteractive.equation.resize(i)}},helpers:{},vQueue:[],youTubeReady:!1,firstRun:!0};if(void 0===isKotobee){kotobee={};var kotobeeListeners=[];function getKotobeeListener(e){if(e)for(var t=kotobeeListeners.length;t--;)if(kotobeeListeners[t].event==e)return kotobeeListeners[t]}function clearKotobeeListeners(e){for(var t=kotobeeListeners.length;t--;)e&&kotobeeListeners[t].event!=e||kotobeeListeners.splice(t,1)}function dispatchKotobeeEvent(){}function kInteractionStart(){this.log=function(e){},kInteractive.setDOMParser(),renderMiniapps(),kInteractive.preRender(),kInteractive.postRender()}function kInteractionStartSingleElem(e,t){kInteractive.setDOMParser(),kInteractive.preRender(e,{singleElem:!0}),kInteractive.postRender(e,{singleElem:!0,forcedIndex:t})}function renderMathJax(){MathJax&&MathJax.typeset&&MathJax.typeset()}document.addEventListener("DOMContentLoaded",function(e){"undefined"!=typeof kotobeeReady&&kotobeeReady(e),document.dispatchEvent(new Event("kotobeeReady")),document.dispatchEvent(new Event("kotobeeChapterLoaded")),kotobee.dispatchEvent("ready"),kotobee.dispatchEvent("chapterLoaded"),document.addEventListener("scroll",function(e){kotobee.dispatchEvent("scrolled",e)})}),kotobee.addEventListener=function(){if(!(arguments.length<2)){var e,t=arguments[0],n={};e=2==arguments.length?arguments[1]:(n=arguments[1],arguments[2]),n.unique&&clearKotobeeListeners(t);var o={event:t,cb:e};kotobeeListeners.push(o)}},kotobee.dispatchEvent=function(e,t){if(e){var n=getKotobeeListener(e);n&&n.cb&&n.cb.apply(this,[t])}};try{document.addEventListener("DOMContentLoaded",kInteractionStart,!1)}catch(e){window.addEventListener("load",kInteractionStart,!1)}function renderMiniapps(){if(!window.top||"kAuthor"!=window.top.document.body.id){var chapterBody=document.body.textContent;window.miniapps={},window.miniappsConfig={};var kmetaRoot=getRelativeRoot()+"_kmeta/",appids=[],scriptElem=document.createElement("script");scriptElem.type="text/javascript",document.body.appendChild(scriptElem),scriptElem.onload=function(result){var json=miniappJson.apps,arr=[];for(var item in json)arr.push({folder:item,code:json[item]});if(arr.length){var miniappContainer=document.createElement("div");miniappContainer.id="kiMiniappContainer",miniappContainer.innerHTML="<a href='' class='closeBtn'>X</a>",miniappContainer.getElementsByClassName("closeBtn")[0].addEventListener("click",toggleMiniappsContainer);var miniappsBtn=document.createElement("a");miniappsBtn.id="kiMiniappsBtn",miniappsBtn.setAttribute("href",""),miniappsBtn.innerHTML="Apps",miniappsBtn.addEventListener("click",toggleMiniappsContainer),next(0)}function toggleMiniappsContainer(e){e&&e.preventDefault(),miniappContainer.classList.contains("open")?miniappContainer.classList.remove("open"):miniappContainer.classList.add("open")}function next(index){if(1<=index&&miniappJson.sdk)return finalize();if(index>=arr.length)return finalize();var folder=arr[index].folder,pageLang=document.documentElement.lang;pageLang=-1!=pageLang.indexOf("es")?"es":-1!=pageLang.indexOf("fr")?"fr":-1!=pageLang.indexOf("ar")?"ar":"en";var scriptElem=document.createElement("script");scriptElem.type="text/javascript",document.body.appendChild(scriptElem),scriptElem.onload=function(){scriptElem.parentNode.removeChild(scriptElem);var configJson=window.miniappConfig;"string"==typeof configJson&&(configJson=JSON.parse(configJson));var appid=configJson.appid,code=arr[index].code,regex=new RegExp("{{"+appid+"Root}}","g");code=code.replace(regex,kmetaRoot+"miniapps/"+folder),code=code.replace(/{{www}}/g,kmetaRoot+"../.."),eval(code),appids.push(appid);var miniappObj={};if(miniappObj.config=miniappsConfig[folder],miniappObj.locale=configJson.locale,miniappObj.appid=appid,miniappObj.appClass=window.miniappOutput,miniappObj.name=configJson.locale[pageLang].name,miniappObj.icon=configJson.icon,!miniappObj.appClass.open)return next(++index);function finishedGettingDataJson(){scriptElem.parentNode.removeChild(scriptElem);var e=document.createElement("a");e.className="app";var t=miniappObj.name,n=kmetaRoot+"miniapps/"+folder+"/icon.png";window.miniappData&&(window.miniappData._listingName&&(t=window.miniappData._listingName),window.miniappData._listingIcon&&(n=kInteractive.isAbsolutePath(window.miniappData._listingIcon)?window.miniappData._listingIcon:kmetaRoot+"miniapps/"+folder+"/userdata/"+window.miniappData._listingIcon)),e.innerHTML='<p class="name">'+t+'</p><img class="icon" src="'+n+'"/>',miniappObj.appClass.externalLink&&(e.setAttribute("href",miniappObj.appClass.externalLink),e.setAttribute("target","_blank")),miniappContainer.appendChild(e),e.addEventListener("click",function(){toggleMiniappsContainer(),miniappObj.appClass.externalLink||miniappObj.appClass.open()}),next(++index)}scriptElem=document.createElement("script"),scriptElem.type="text/javascript",document.body.appendChild(scriptElem),scriptElem.onload=finishedGettingDataJson,scriptElem.onerror=finishedGettingDataJson,scriptElem.src=kmetaRoot+"miniapps/"+folder+"/userdata/data.js"},scriptElem.src=kmetaRoot+"miniapps/"+folder+"/config.js"}function finalize(){(miniappJson.sdk||validate(appids,chapterBody))&&(document.body.appendChild(miniappsBtn),document.body.appendChild(miniappContainer))}},scriptElem.src=kmetaRoot+"miniapps.js"}function getRelativeRoot(){var e=window.location.href.split("/");e=e.reverse();for(var t="",n=0;n<e.length&&"EPUB"!=e[n];n++)t+="../";return t}function validate(e,t){for(var n,o=document.getElementsByTagName("meta"),r=0;r<o.length;r++)if(o[r].getAttribute("name")=="m-"+window.atob("Y2hlY2tzdW0=")){n=o[r];break}if(kInteractive.isSDK())return!0;if(!n)return!1;var i=e.join(";"),a=t.replace(/\s+/g,"");return kInteractive.simpleHash(a+i)==n.getAttribute("content")}}}kInteractive.audio={preRender:function(e,t){},postRender:function(e,t,n){var o=e.createDocumentFragment(),r=kInteractive.readData(t);t.setAttribute("id","ki-audio-"+n),t.innerHTML="";var i=document.createElement("div");i.setAttribute("id","ki-audio-"+n+"-container"),i.className="container";var a=document.createElement("a");a.className="playBtn ki-btn",a.appendChild(document.createElement("span")),void 0===isKotobee&&a.addEventListener("click",kInteractive.actionEvent);var s=document.createElement("div");if(r.style&&kInteractive.c.addClass(s,r.style),o.appendChild(a),o.appendChild(i),s.appendChild(o),t.appendChild(s),r.autoplay)kInteractive.action(t)},action:function(e){kInteractive.stopCurrentMedia();var t=kInteractive.readData(e);if(t){t.audioType||(t.audioType=t.type);e.getAttribute("id");e.getElementsByClassName("playBtn")[0].className="playBtn ki-btn hide";var n=t.src;if("file"==t.audioType&&(n=void 0===isKotobee?t.audio:t.relToRoot?ph.join(bookPath,t.audio):ph.join(kInteractive.absoluteURL,t.audio)),kInteractive.scorm){var o={};o.id=kInteractive.getScormId(e.getAttribute("id"),n),o.description="Played audio: "+n,o.type="other",o.learnerResponses="Played",o.objective=t.options?t.options.objective:null,o.timestamp=new Date,kInteractive.scorm.setInteractions([o])}kInteractive.events&&kInteractive.events.add({action:"audioPlayed",param:n,elem:e,data:t});var r=document.createElement("audio");r.setAttribute("controls","true"),r.setAttribute("autoplay","true"),r.setAttribute("data-tap-disabled","false");var i=document.createElement("source");i.src=kInteractive.cleanURL(n),r.appendChild(i),r.appendChild(document.createTextNode("Your browser does not support the audio element")),r.className="ki-noHighlight",r.oncanplay=function(){kInteractive.currentAudio==e&&kInteractive.tinCan({verb:"played",activity:"Audio: "+n})},e.getElementsByClassName("container")[0].appendChild(r),r.play(),kInteractive.currentAudio=e,kInteractive.c.addClass(kInteractive.currentAudio,"playing")}}};var log=console.log,kInteractiveCommon={checkResponsiveFloat:function(e,t){if(e&&e.disableWrapForMobile&&"none"!=e.float){var n=t.parentNode;t.offsetWidth>.6*n.offsetWidth&&.4*(n.offsetWidth-t.offsetWidth)<100?kInteractive.c.addClass(t,"fullRow"):kInteractive.c.removeClass(t,"fullRow")}},openLink:function(n){var e={cb:function(e){var t=document.createElement("iframe");t.src=n,e.appendChild(t)},closed:function(){}};kInteractive.openFrame(e)},openFrame:function(u){var p=document.getElementById("kInteractiveFrame"),f=document.getElementById("kiDarkOverlay"),h="";if(u.dict||(u.dict={}),u.width&&(h+="width:"+u.width+"px;max-width:"+u.width+"px;"),u.height&&(h+="height:"+u.height+"px;max-height:"+u.height+"px;"),p||((f=document.createElement("div")).id="kiDarkOverlay",document.body.appendChild(f),f.style.display="none",f.style.position="fixed",f.addEventListener("click",kInteractive.closeFrame),(p=document.createElement("div")).id="kInteractiveFrame"),u.pos||(u.pos="top"),"none"!=u.pos){var e=document.createElement("a"),t="closeBtn";u.pos&&(t+=" "+u.pos),e.className=t;var n=u.dict.close?u.dict.close:"Close";try{n=angular.element(document.body).scope().translit("close")}catch(e){}"side"!=u.pos&&(e.innerHTML=n),e.addEventListener("click",kInteractive.closeFrame),p.appendChild(e)}var g=u.class?u.class:"";(u.width||u.height)&&(g+=" fixed"),u.aspectRatio&&(g+=" aspectRatio"),p.style.display="block",p.className=g,document.body.appendChild(p),kInteractive.frameIsOpen=!0,kInteractive.frameOb=u;try{if(void 0!==isKotobee&&!native){var o=window.location.hash.split("#");1<o.length&&(window.location.hash+=(-1==o[1].indexOf("?")?"?":"&")+"popup",window.addEventListener("hashchange",this.backBtnPressed))}}catch(e){}function r(){f.style.display="block",f.className="show";var e=window.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName("body")[0].clientHeight,t=window.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth;e-=20,t-=20;var n=1;if(u.width&&u.height){var o=t/u.width,r=e/u.height;1<(n=o<r?o:r)&&(n=1)}var i="display:block;";i+=h;var a=u.width||u.height?"-50%,-50%":"0%,0%";i+="-webkit-transform:translate("+a+") scale("+n+");-moz-transform:translate("+a+") scale("+n+");transform:translate("+a+") scale("+n+");",i+="position:fixed;",void 0===isKotobee&&"-50%,-50%"==a&&(i+="top:"+Math.round(window.innerHeight/2)+"px;",i+="left:"+Math.round(window.innerWidth/2)+"px;"),-1!=g.indexOf("aspectRatio")&&window.innerWidth/window.innerHeight>16/9&&(i+="padding-bottom: "+95*window.innerHeight/Math.round(window.innerWidth)+"%"),p.style.cssText=i,p.className=g+" ready";var s=p.getElementsByClassName("closeBtn");if(s.length){var c=s[0],l=1/n,d="-50%";kInteractive.hasClass(c,"side")&&(d="0%"),c.style.cssText="-webkit-transform: translate("+d+",0%) scale("+l+");-webkit-transform-origin: 50% 50%;-moz-transform: translate("+d+",0%) scale("+l+");-moz-transform-origin: 50% 50%;transform: translate("+d+",0%) scale("+l+");transform-origin: 50% 50%;"}}kInteractive.openFrame.resized=r,window.addEventListener("resize",r),setTimeout(function(){r(),u.cb&&u.cb(p)},100)},closeAlert:function(e){e&&e.stopPropagation();var t=document.getElementById("kiSystemAlertBox"),n=document.getElementById("kiSystemAlertBackdrop");t.parentNode.removeChild(t),n.parentNode.removeChild(n),kInteractive.alertIsOpen=!1,window.removeEventListener("resize",kInteractive.alert.resized),kInteractive.alert.resized=null},backBtnPressed:function(e){e.oldURL&&e.oldURL.match(/[?&]popup/g)&&(window.removeEventListener("hashchange",kInteractive.backBtnPressed),kInteractive.closeFrame())},closeFrame:function(){document.getElementById("kFullscreenGallery")&&kInteractive.gallery.exitFullscreen();var e=document.getElementById("kInteractiveFrame"),t=document.getElementById("kiDarkOverlay");kInteractive.frameIsOpen=!1,window.removeEventListener("resize",kInteractive.openFrame.resized),kInteractive.openFrame.resized=null,kInteractive.c.removeClass(e,"ready");var n=kInteractive.frameOb,o="";n.width&&(o+="width:"+n.width+"px;max-width:"+n.width+"px;"),n.height&&(o+="height:"+n.height+"px;max-height:"+n.height+"px;"),e.style.cssText=o,t.className="",setTimeout(function(){e.innerHTML="",e.style.display=t.style.display="none",n.closed&&n.closed(),kInteractive.frameOb=null},300),window.removeEventListener("hashchange",kInteractive.closeFrame),window.location.hash=window.location.hash.replace(/[?&]popup/g,"")},stopCurrentMedia:function(){if(kInteractive.currentVideo){var e=kInteractive.currentVideo.getAttribute("id")+"-container";if(n=document.getElementById(e)){var t=n.parentNode;n.parentNode.removeChild(n),(o=document.createElement("div")).setAttribute("id",e),o.className="container",(r=kInteractive.currentVideo.getElementsByClassName("playBtn")[0]).className="playBtn ki-btn",kInteractive.c.removeClass(kInteractive.currentVideo,"playing"),t.appendChild(o)}}var n;if(kInteractive.currentAudio)if(e=kInteractive.currentAudio.getAttribute("id")){if(e+="-container",n=document.getElementById(e)){var o,r;t=n.parentNode;n.parentNode.removeChild(n),(o=document.createElement("div")).setAttribute("id",e),o.className="container playerContainer",(r=kInteractive.currentAudio.getElementsByClassName("playBtn")[0])&&(r.className="playBtn ki-btn"),kInteractive.c.removeClass(kInteractive.currentAudio,"playing"),t.appendChild(o)}}else try{var i=kInteractive.currentAudio.getElementsByTagName("audio");i.length&&(i[0].pause(),i[0].src=""),kInteractive.currentAudio.pause&&(kInteractive.currentAudio.pause(),kInteractive.currentAudio.src="");for(var a=document.getElementsByClassName("kiAudioLoader"),s=a.length;s--;)a[s].parentNode.removeChild(a[s])}catch(e){}},hasClass:function(e,t){if(e&&e.className)for(var n=e.className.trim().split(" "),o=0;o<n.length;o++)if(n[o]&&n[o].trim()==t)return!0},appendAfterDelay:function(e,t){setTimeout(function(){e.appendChild(t)},30)},replaceHTML:function(e,t){var n="string"==typeof e?document.getElementById(e):e,o=n.cloneNode(!1);return o.innerHTML=t,n.parentNode.replaceChild(o,n),o},tinCan:function(e){if(void 0!==isKotobee)try{angular.element(document.body).scope().tinCanShortcut(e)}catch(e){}},setDOMParser:function(){!function(e){"use strict";var t=e.prototype,i=t.parseFromString;try{if((new e).parseFromString("","text/html"))return}catch(e){}t.parseFromString=function(e,t){if(/^\s*text\/html\s*(?:;|$)/i.test(t)){var n,o=document.implementation.createHTMLDocument(""),r=o.documentElement;return r.innerHTML=e,n=r.firstElementChild,1===r.childElementCount&&"html"===n.localName.toLowerCase()&&o.replaceChild(n,r),o}return i.apply(this,arguments)}}(DOMParser)},compareVersions:function(e,t){if(e==t)return 0;if(null==e)return 1;if(null==t)return-1;var n=e.split("."),o=t.split(".");return o.length?n.length?Number(n[0])>Number(o[0])?1:Number(o[0])>Number(n[0])?-1:(n.shift(1),o.shift(1),kInteractive.compareVersions(n.join("."),o.join("."))):-1:1},readData:function(e){var t=e.getAttribute("data-kotobee");return t=t||e.getAttribute("data"),this.readRawData(t)},readRawData:function(t){try{var n=1;if(!t)return;return JSON.parse(decodeURI(kInteractive.XORCipher(n).decode("kotobee%%author",t)))}catch(e){try{return JSON.parse(kInteractive.XORCipher(n).decode("kotobee%%author",t))}catch(e){}}},writeData:function(e,t,n){n=n||1;var o=encodeURI(JSON.stringify(t)),r=e.hasAttribute("data-kotobee")?"data-kotobee":"data";e.setAttribute(r,kInteractive.XORCipher(n).encode("kotobee%%author",o))},XORCipher:function(e){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return{encode:function(e,t){return function(e){var t,n,o,r,i,a,s,c,l=0,d="";if(!e)return e;for(;t=e[l++],n=e[l++],o=e[l++],r=(s=t<<16|n<<8|o)>>12&63,i=s>>6&63,a=63&s,d+=u.charAt(s>>18&63)+u.charAt(r)+u.charAt(i)+u.charAt(a),l<e.length;);return((c=e.length%3)?d.slice(0,c-3):d)+"===".slice(c||3)}(t=function(n,e){return r(e,function(e,t){return e.charCodeAt(0)^o(n,t)})}(e,t))},decode:function(e,t){return function(n,e){return r(e,function(e,t){return String.fromCharCode(e^o(n,t))}).join("")}(e,t=function(e){var t,n,o,r,i,a,s,c,l=0,d=[];if(!e)return e;e+="";for(;r=u.indexOf(e.charAt(l++)),i=u.indexOf(e.charAt(l++)),a=u.indexOf(e.charAt(l++)),s=u.indexOf(e.charAt(l++)),t=(c=r<<18|i<<12|a<<6|s)>>16&255,n=c>>8&255,o=255&c,d.push(t),64!==a&&(d.push(n),64!==s&&d.push(o)),l<e.length;);return d}(t))}};function o(e,t){return e.charCodeAt(Math.floor(t%e.length))}function r(e,t){for(var n=[],o=0;o<e.length;o++)n[o]=t(e[o],o);return n}},getScormId:function(e,t){return e+(t=t?"-"+t.replace(/[^a-zA-Z0-9]/g,"-").substr(0,80):"")},confirm:function(e){kInteractive.alert(e)},alert:function(e){if(e){var t=document.createElement("div");if(t.setAttribute("id","kiSystemAlertBox"),e.raw&&(t.className="raw"),t.style.position="fixed",void 0===isKotobee&&(t.style.top=Math.round(window.innerHeight/2)+"px",t.style.left=Math.round(window.innerWidth/2)+"px"),e.raw)t.innerHTML=e.content.replace("&nbsp;","&#160;");else{var n=document.createElement("div");n.innerHTML=e.content.replace("&nbsp;","&#160;"),n.className="content",t.appendChild(n)}if(e.title){var o=document.createElement("div");o.innerHTML=e.title.replace("&nbsp;","&#160;"),o.className="header",t.insertBefore(o,t.firstChild)}kInteractive.alertIsOpen=!0;var r=document.createElement("a");if(!e.raw){var i=document.createElement("div");i.className="footer";var a="OK";try{a=angular.element(document.body).scope().translit("ok")}catch(e){}if(e.okBtn&&(a=e.okBtn),r.innerHTML=a.replace("&nbsp;","&#160;"),r.className="okBtn",r.addEventListener("click",kInteractive.closeAlert),e.cb&&r.addEventListener("click",e.cb),i.appendChild(r),e.noBtn){var s=document.createElement("a");s.innerHTML=e.noBtn,s.className="cancelBtn",s.addEventListener("click",kInteractive.closeAlert),i.appendChild(s)}t.appendChild(i)}var c=document.createElement("div");e.noBackdrop||(c.setAttribute("id","kiSystemAlertBackdrop"),c.addEventListener("click",kInteractive.closeAlert),c.style.position="fixed",document.body.appendChild(c)),document.body.appendChild(t),r.focus(),kInteractive.alert.resized=l,window.addEventListener("resize",l),setTimeout(function(){kInteractive.c.addClass(t,"show"),kInteractive.c.addClass(c,"show")},50)}function l(){void 0===isKotobee&&(t.style.top=Math.round(window.innerHeight/2)+"px",t.style.left=Math.round(window.innerWidth/2)+"px")}},c:{addClass:function(e,t){var n=e.className.trim();if(t instanceof Array){for(var o=!0,r=0;r<t.length;r++)-1==n.indexOf(t[r])&&(o=!1,n+=(""==n?"":" ")+t[r]);if(o)return}else{if(0<=n.indexOf(t))return;n+=(""==n?"":" ")+t}e.className=n},toggleClass:function(e,t){this.strHasClass(e.className,t)?this.removeClass(e,t):this.addClass(e,t)},hasClass:function(e,t){var n=e.className;return e instanceof SVGElement&&(n=n.baseVal),this.strHasClass(n,t)},strHasClass:function(e,t){for(var n=(e=e||"").trim().split(" "),o=0;o<n.length;o++)if(n[o]==t)return!0;return!1},removeClass:function(e,t){var n=e.className;if(t instanceof Array){for(var o=!0,r=0;r<t.length;r++)0<=n.indexOf(t[r])&&(o=!1,n=n.replace(t[r],""));if(o)return}else{if(-1==n.indexOf(t))return;n=(n=n.replace(t,"")).replace(/ {2,}?/g," ")}""==(n=n.trim())?e.removeAttribute("class"):e.className=n},removeHash:function(e){return-1==e.indexOf("#")?e:e.substring(0,e.lastIndexOf("#"))},removeFilename:function(e){var t=kInteractive.c.normalizedArray(e);return-1==t[t.length-1].indexOf(".")?e:(t.splice(t.length-1,1),t.join("/"))},normalizedArray:function(e){for(var t=(e=e.replace(/\\/g,"/")).split("/"),n=t.length;n--;)t[n]?".."==t[n]&&0<n&&".."!=t[n-1]&&(t.splice(n,1),t.splice(n-1,1)):t.splice(n,1);return t[0].match(/http[s]?:$/g)&&(t[0]+="//"+t[1],t.splice(1,1)),t[0].match(/kotobee:$/g)&&(t[0]+="//"+t[1],t.splice(1,1)),"file:"==t[0]&&(t[0]+="///"+t[1],t.splice(1,1)),t}},shuffleArray:function(e){e.sort(function(){return Math.random()-.5})},allowDrop:function(e){e.preventDefault()},drag:function(e){e.stopPropagation(),e.dataTransfer&&e.dataTransfer.setData("text",e.target.id),dragged=e.target},drop:function(e){e.preventDefault(),e.target.hasAttribute("ondragover")&&e.target.appendChild(e.view.dragged)},escapeHtml:function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return e.replace(/[&<>"']/g,function(e){return t[e]})},getChildIndex:function(e){for(var t=0;null!=(e=e.previousSibling);)t++;return t},isAbsolutePath:function(e){if(e)return 0==e.trim().indexOf("http://")||(0==e.trim().indexOf("https://")||(0==e.trim().indexOf("//")||(0==e.trim().indexOf("data:")||(!!/.\:[\\\/].*/g.test(e.trim())||void 0))))},isMobile:function(e){if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))return!0;try{if(0<window.location.href.indexOf("?preview")){var t=window.location.href.split("?");t=t[1].split("&");for(var n={},o=0;o<t.length;o++){var r=t[o].split("=");n[r[0]]=r[1]}if(n.mobile)return!0}}catch(e){}},getChildIndex:function(e){for(var t=0;null!=(e=e.previousSibling);)t++;return t},closeFullscreenVideo:function(){kInteractive.currentVideo&&(kInteractive.currentVideo.webkitExitFullscreen?kInteractive.currentVideo.webkitExitFullscreen():kInteractive.currentVideo.mozCancelFullScreen?kInteractive.currentVideo.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen&&document.mozCancelFullScreen(),kInteractive.videoIsFullscreen=!1)},getWidgetHome:function(e,t){return{},e.path?void 0===isKotobee?e.path:ph.join(angular.element(document.body).scope().data.book.chapter.absoluteURL,e.path):void 0===isKotobee?"../js/widgets/":bookPath+"EPUB/js/widgets/"},getWidgetUrl:function(e,t){var n=kInteractive.getWidgetHome(e,t)+"/"+e.name+"/"+e.src;if(void 0!==isKotobee){var o=angular.element(document.body).scope().data.user;o&&o.email&&o.signatures&&o.signatures.bookwidgets&&e.id&&0==e.id.indexOf("com.kidimedia")&&(n+="?oauth_signature="+o.signatures.bookwidgets.signature,n+="&oauth_nonce="+o.signatures.bookwidgets.nonce,n+="&oauth_timestamp="+o.signatures.bookwidgets.timestamp,n+="&oauth_consumer_key="+o.signatures.bookwidgets.key,n+="&lti_version=LTI-1p0",n+="&oauth_signature_method=HMAC-SHA1",n+="&oauth_version=1.0",n+="&tool_consumer_info_product_family_code=kotobee",n+="&lis_person_contact_email_primary="+o.email,n+="&lis_person_name_full="+(o.name?o.name:""),n+="&user_id="+o.id,n+="&lti_message_type=basic-lti-launch-request",angular.element(document.body).scope().refreshSignatures&&angular.element(document.body).scope().refreshSignatures())}return n=kInteractive.cleanURL(n)},clearAudioVideo:function(e){var t=e||document;kInteractive.stopCurrentMedia();for(var n=t.getElementsByTagName("audio"),o=n.length;o--;)try{if(n[o].hasAttribute("data-dontclose"))continue;n[o].pause(),n[o].children.length||(n[o].src="")}catch(e){}var r=t.getElementsByTagName("video");for(o=r.length;o--;)r[o].pause(),r[o].children.length||(r[o].src="")},cleanURL:function(e){try{native&&mobile&&(e=window.Ionic.WebView.convertFileSrc(e)),e=e.replace(/([^:])\/\//g,"$1/")}catch(e){}return e},listenForSwiping:function(a){a.addEventListener("touchstart",function(e){s=e.touches[0].clientX,c=e.touches[0].clientY},!1),a.addEventListener("touchmove",function(e){if(null===s)return;if(null===c)return;var t=e.touches[0].clientX,n=e.touches[0].clientY,o=s-t,r=c-n;5<o?(a.dispatchEvent(new Event("swipeleft")),i()):o<-5?(a.dispatchEvent(new Event("swiperight")),i()):5<r?(a.dispatchEvent(new Event("swipeup")),i()):r<-5&&(a.dispatchEvent(new Event("swipedown")),i());function i(){c=s=null}e.preventDefault()},!1);var s=null,c=null},unique:function(e){return e.filter(function(e,t,n){return n.indexOf(e)===t})},getFile:function(e,t){var n=new XMLHttpRequest;n.open("GET",e),n.onload=function(){200===n.status&&t(n.responseText)},n.send()},getBookID:function(){var e=document.head.querySelector('meta[name="kotobee-book"]');return void 0!==isKotobee&&kotobee.book?kotobee.book.meta.dc.identifier.replace("urn:uuid:","")+(kotobee.user&&kotobee.user.email?kotobee.user.email:""):e?e.content.replace("urn:uuid:",""):""},getChapterID:function(){var e;if(void 0!==isKotobee)e=kotobee.currentChapter?kotobee.currentChapter.url:"/ch1.xhtml";else{var t=document.head.querySelector('meta[name="kotobee-chapter"]');e=t?t.content:""}return e.substring(e.lastIndexOf("/")+1).replace(".xhtml","")},setStorage:function(e){kInteractive.storage=e||sessionStorage},getLocalData:function(t,e){var n=t.label||t.category;if(t)if(e)if(n){var o=kInteractive.storage.getItem("ebook-"+kInteractive.getBookID())||"[]";e(o=(o=JSON.parse(o)).filter(function(e){return t.label?t.category?t.subcategory?e.label==t.label&&e.category==t.category&&e.subcategory==t.subcategory:e.label==t.label&&e.category==t.category:e.label==t.label:t.subcategory?e.category==t.category&&e.subcategory==t.subcategory:e.category==t.category}))}else e({error:"invalid label or category!"});else;else;},getLocalDataArray:function(e,t){if(Array.isArray(e))if(t){var n=kInteractive.storage.getItem("ebook-"+kInteractive.getBookID())||"[]";n=JSON.parse(n);var o=[];e.forEach(function(t){(t.label||t.category)&&o.push({results:n.filter(function(e){return t.label?t.category?t.subcategory?e.label==t.label&&e.category==t.category&&e.subcategory==t.subcategory:e.label==t.label&&e.category==t.category:e.label==t.label:t.subcategory?e.category==t.category&&e.subcategory==t.subcategory:e.category==t.category})})}),t(o.length?o:n)}else;else t([{error:"invalid array!"}])},setLocalData:function(t,e){if(t)if(e)if(t.label)if(t.data){var n={label:t.label,data:t.data,date:(new Date).toUTCString()};t.category&&(n.category=t.category),t.subcategory&&(n.subcategory=t.subcategory);var o=kInteractive.storage.getItem("ebook-"+kInteractive.getBookID())||"[]";if(o=JSON.parse(o),t.overwrite){var r=o.findIndex(function(e){return t.category?t.subcategory?e.label==t.label&&e.category==t.category&&e.subcategory==t.subcategory:e.label==t.label&&e.category==t.category:e.label==t.label});-1!=r?o.splice(r,1,n):o.push(n)}else o.push(n);kInteractive.storage.setItem("ebook-"+kInteractive.getBookID(),JSON.stringify(o)),e({success:"added"})}else e({error:"invalid data!"});else e({error:"invalid label!"});else;else;},setLocalDataArray:function(e,t){if(Array.isArray(e))if(t){var o=kInteractive.storage.getItem("ebook-"+kInteractive.getBookID())||"[]";o=JSON.parse(o);var r={};e.forEach(function(t){if(t.label){if(!r.hasOwnProperty("error")){var e={label:t.label,data:t.data,date:(new Date).toUTCString()};if(t.category&&(e.category=t.category),t.subcategory&&(e.subcategory=t.subcategory),t.overwrite){var n=o.findIndex(function(e){return t.category?t.subcategory?e.label==t.label&&e.category==t.category&&e.subcategory==t.subcategory:e.label==t.label&&e.category==t.category:e.label==t.label});-1!=n?o.splice(n,1,e):o.push(e)}else o.push(e)}}else r.error="invalid label!"}),r.hasOwnProperty("error")||(r.success="added"),kInteractive.storage.setItem("ebook-"+kInteractive.getBookID(),JSON.stringify(o)),t(r)}else;else t([{error:"invalid array!"}])},deleteLocalData:function(t,e){if(t)if(e)if(t.label){var n=kInteractive.storage.getItem("ebook-"+kInteractive.getBookID())||"[]",o=(n=JSON.parse(n)).findIndex(function(e){return t.category?t.subcategory?e.label==t.label&&e.category==t.category&&e.subcategory==t.subcategory:e.label==t.label&&e.category==t.category:e.label==t.label});-1!=o&&n.splice(o,1),kInteractive.storage.setItem("ebook-"+kInteractive.getBookID(),JSON.stringify(n)),e({success:!0})}else e({error:"invalid label!"});else;else;},deleteLocalDataArray:function(e,t){if(Array.isArray(e))if(t){var n=kInteractive.storage.getItem("ebook-"+kInteractive.getBookID())||"[]";n=JSON.parse(n);var o={};e.forEach(function(t){if(t.label){if(!o.hasOwnProperty("error")){var e=n.findIndex(function(e){return t.category?t.subcategory?e.label==t.label&&e.category==t.category&&e.subcategory==t.subcategory:e.label==t.label&&e.category==t.category:e.label==t.label});-1!=e&&n.splice(e,1)}}else o.error="invalid label!"}),o.hasOwnProperty("error")||(o.success=!0),kInteractive.storage.setItem("ebook-"+kInteractive.getBookID(),JSON.stringify(n)),t(o)}else;else t([{error:"invalid array!"}])},clearLocalData:function(){kInteractive.storage?kInteractive.storage.removeItem("ebook-"+kInteractive.getBookID()):kInteractive.error("unable to find storage!")},isEditorMode:function(){return"undefined"!=typeof editorMode&&editorMode},isPreview:function(){return/\/Kotobee\s?Author\//.test(location.pathname)},isSDK:function(){if(void 0!==isKotobee)return!isRelease;var e=-1!=location.host.indexOf("localhost")&&-1!=["http:","https:"].indexOf(location.protocol);return e=e||-1!=location.href.indexOf("reader/www/epub/EPUB")},getBoundingBox:function(e){if(3!=e.nodeType)return e.getBoundingClientRect();var t=document.createRange();t.selectNode(e);var n=t.getBoundingClientRect();return t.detach(),n},simpleHash:function(e){var t,n=0;for(t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n}};for(var item in kInteractiveCommon)kInteractive[item]=kInteractiveCommon[item];function kPersister(e){this.enabled=!0,this.delegateEvents=!0,this.storage="cloud",this.root=document.body,this.interval=200,this.maxDataSize=0,this.book="",this.chapter="",this.data=[],this.text=[],this.number=[],this.radio=[],this.checkbox=[],this.textarea=[],this.dragdrop=[],this.callback=null,this.silentMode=!1,this.forceNotification=!1,this.saveGlobal=!1,this.isSaveGlobal=!1,this.listener=null,this.testMode=!1,this.enableUncheckRadio=!1,this.setRadioGroup=!0,this.messages={save:"Save",unsaved:"You have unsaved changes",saving:"Saving your responses ..",saved:"Changes has been saved!",dismiss:"Dismiss",lastSaved:"Last saved on",longDataError:"Some answers not saved (marked in red)"},this.design={placement:"bottom-right",unsaved:{color:"#fff",background:"#de7a7a"},success:{color:"#fff",background:"#14c39a"}},this.enable=function(e){this.enabled=!0,this.silentMode=e,this.renderInlineBar(),this.renderFloatingBar()},this.disable=function(){this.enabled=!1,u(".unsaved-changes-"+n.root.id)&&u(".unsaved-changes-"+n.root.id).classList.remove("show")},this.setOptions=function(e){for(var t in e)"messages"==t?this.setMessages(e.messages):"design"==t?this.setDesign(e.design):this.hasOwnProperty(t)&&(this[t]=e[t],"root"==t&&(this[t].id=e[t].id||"_"+Math.random().toString(36).substr(2,9)))},this.setDesign=function(e){for(var t in e)this.design.hasOwnProperty(t)?(-1!=["placement"].indexOf(t)||e[t].color||e[t].background)&&(this.design[t]=e[t]):p("error",["invalid design state:",t])},this.setMessages=function(e){for(var t in e)if(this.messages.hasOwnProperty(t)){if(this.messages[t]=e[t],u(".unsaved-changes-"+this.root.id)&&!kInteractive.isEditorMode()&&u(".unsaved-changes-"+this.root.id+" ."+t))if("button"==u(".unsaved-changes-"+this.root.id+" ."+t).nodeName.toLowerCase())try{u(".unsaved-changes-"+this.root.id+" ."+t).innerText=e[t]}catch(e){}else try{u(".unsaved-changes-"+this.root.id+" ."+t+" span").innerText=e[t]}catch(e){}}else p("error",["invalid message key:",t])},this.waitFor=function(e,t,n){var o=this;n=n||0,window[e]||0==e.indexOf("#")&&"undefined"!=typeof document&&document.querySelector(e)||0==e.indexOf(".")&&"undefined"!=typeof document&&document.querySelector(e)||"document.body"==e&&"undefined"!=typeof document&&document.body?t():n<3e3?setTimeout(function(){o.waitFor(e,t,n+100)},100):(p("error",["unable to find:",e]),t&&t())},this.renderInlineBar=function(){var e=this;if(u(".persist-log-"+e.root.id)&&u(".persist-log-"+e.root.id).parentNode.removeChild(u(".persist-log-"+e.root.id)),e.silentMode&&!kInteractive.isEditorMode()){var t=e.getRootSelector();u(t)?u(t).insertAdjacentHTML("beforeend",'<div class="persist-log persist-log-'+e.root.id+'"><span class="saving" style="display:none;color:'+e.design.unsaved.background+'">'+e.messages.saving+'</span><span class="success" style="display:none;color:'+e.design.success.background+'">'+e.messages.lastSaved.trim()+" "+(new Date).toLocaleDateString()+'</span><span class="error" style="display:none"></span></div>'):p("warn",["unable to find root selector:",t])}},this.renderFloatingBar=function(){var e=this;if(u(".unsaved-changes-"+e.root.id)&&u(".unsaved-changes-"+e.root.id).parentNode.removeChild(u(".unsaved-changes-"+e.root.id)),!e.silentMode&&!kInteractive.isEditorMode()){var t="",n="",o="",r=e.design.placement.split("-");if(r.length&&(o+=r[0]+":70px;"),1<r.length)switch(o+=r[1]+":0px;",r[1]){case"left":t="-",n="";break;case"right":t="",n="-";break;default:p("error",["invalid horizontal placement:",r[1]])}var i="#fff",a="#333";if(void 0!==kotobee){var s=document.querySelectorAll("#kotobee .tabs");s.length&&(i=getComputedStyle(s[0]).backgroundColor,a=getComputedStyle(s[0]).color)}var c='<style id="'+e.root.id+'-persister-styles">.unsaved-changes-'+e.root.id+"{"+o+";display:none;transform:translateX("+t+"100%);background:"+i+";color:"+a+"}.unsaved-changes-"+e.root.id+".show{display:block;transform: translateX("+n+"20px)}.unsaved-changes-"+e.root.id+" button{background-color:"+e.design.unsaved.background+";color:"+e.design.unsaved.color+"}.unsaved-changes-"+e.root.id+".success button{background-color:"+e.design.success.background+";color:"+e.design.success.color+"</style>";document.head.querySelector("#"+e.root.id+"-persister-styles")||document.head.insertAdjacentHTML("beforeend",c);var l=u(".perspectiveContainer")?u(".perspectiveContainer"):document.body;if(l){var d='<div class="unsaved-changes unsaved-changes-'+e.root.id+'"><div class="unsaved"><span>'+e.messages.unsaved+'</span> <button class="dismiss">'+e.messages.dismiss+'</button> <button class="save-now">'+e.messages.save+'</button></div><div class="saving" style="display:none;"><svg width="20px" height="20px" style="background:none;float:left;margin-top:5px;margin-right:5px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="lds-rolling"><circle cx="50" cy="50" fill="none" stroke="#ffffff" stroke-width="10" r="35" stroke-dasharray="164.93361431346415 56.97787143782138" transform="rotate(149.879 50 50)"><animateTransform attributeName="transform" type="rotate" calcMode="linear" values="0 50 50;360 50 50" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animateTransform></circle></svg><span>'+e.messages.saving+'</span></div><div class="saved" style="display:none;"><span>'+e.messages.saved+'</span> <button class="dismiss">'+e.messages.dismiss+'</button></div><div class="notsaved" style="display:none;"><span></span> <button class="dismiss">'+e.messages.dismiss+"</button></div></div>";try{l.insertAdjacentHTML("afterbegin",d),e.waitFor(".unsaved-changes-"+e.root.id,function(){u(".unsaved-changes-"+e.root.id+" .dismiss",!0)?u(".unsaved-changes-"+e.root.id+" .dismiss",!0).forEach(function(e){e.addEventListener("click",function(e){u(e.currentTarget).parents(".unsaved-changes").classList.remove("show")})}):p("error",["unable to find dismiss button!"]),u(".unsaved-changes-"+e.root.id+" .save-now")?u(".unsaved-changes-"+e.root.id+" .save-now").addEventListener("click",function(){e.save()}):p("error",["unable to find save button!"])})}catch(e){p("error",[e,d])}}else p("error",["unable to find suitable container!"])}},this.getRootSelector=function(){return n.root.id?"#"+n.root.id:"."+n.root.className.splice(" ").join(".")},this.setNotify=function(e){this.enabled&&u(".unsaved-changes-"+this.root.id)&&!kInteractive.isEditorMode()&&(e&&e.constructor===Object&&0<Object.keys(e).length&&this.setOptions(e),u(".unsaved-changes-"+this.root.id).classList.contains("show")&&!u(".unsaved-changes-"+this.root.id).classList.contains("success")||this.updateNotification("reset"))},this.save=function(e){var t=this;if(t.enabled){t.collectInputs(),t.updateNotification("saving");var n=[];t.text&&t.text.forEach(function(e){e.id&&n.push(e)}),t.number&&t.number.forEach(function(e){e.id&&n.push(e)}),t.radio&&t.radio.forEach(function(e){e.id&&n.push(e)}),t.checkbox&&t.checkbox.forEach(function(e){e.id&&n.push(e)}),t.textarea&&t.textarea.forEach(function(e){e.id&&n.push(e)}),t.dragdrop&&t.dragdrop.forEach(function(e){e.dataset.category=Array.prototype.slice.apply(e.parentNode.classList).find(function(e){return-1!=e.indexOf("ki-dd-category")})||"",e.id&&n.push(e)}),t.setLocalData(n,function(){"cloud"==t.storage&&c()?void 0!==isKotobee?t.push(e):(t.updateNotification("success"),e&&e()):e&&e()})}},this.setLocalData=function(e,n){var o=this,t={label:kInteractive.getChapterID()+"-"+o.root.id,data:JSON.stringify(e.map(function(e){return{id:e.id,type:e.type||e.nodeName.toLowerCase(),value:-1!=["radio","checkbox"].indexOf(e.type)?e.checked:"div"==e.nodeName.toLowerCase()?e.dataset.category||"":e.value}})),overwrite:!0};kInteractive.setLocalData(t,function(e){window.unsaved="cloud"==o.storage,"cloud"!=o.storage&&o.updateNotification("success");var t={target:o};e.error?t.error=e.error:t.result=e,o.listener.emit("persister.saved",t),"function"==typeof n&&n()})},this.getLocalData=function(){var o=this;return new Promise(function(n){if("cloud"==o.storage&&void 0!==isKotobee&&c())try{kotobee.getData({label:kInteractive.getChapterID()+"-"+o.root.id},function(e){e.length?(o.merge(e),t()):(o.data=[],n())})}catch(e){o.listener.emit("persister.error",e.toString()),n()}else kInteractive.getLocalDataArray([{}],function(e){e.length?kInteractive.setLocalDataArray(o.cleanupData(e).map(function(e){return Object.assign(e,{overwrite:!0})}),t):t()});function t(){kInteractive.getLocalData({label:kInteractive.getChapterID()+"-"+o.root.id},function(t){if(Array.isArray(t)){if(t.length)try{o.data=JSON.parse(t[0].data)}catch(e){o.data=[],u("body.cke_editable")||o.listener.emit("persister.error",{target:o,error:'invalid or empty slot for "'+kInteractive.getChapterID()+"-"+o.root.id+'": '+JSON.stringify(t)})}else o.data=[];n()}else u("body.cke_editable")||o.listener.emit("persister.error",{target:o,error:'invalid or empty slot for "'+kInteractive.getChapterID()+"-"+o.root.id+'": '+JSON.stringify(t)})})}})},this.cleanupData=function(e){return Array.isArray(e)?e.slice(0).sort(function(e,t){return e.date>t.date?-1:e.date<t.date?1:0}).filter(function(t,e,n){return n.findIndex(function(e){return e.label==t.label})==e}):(p("error",["invalid data:",e]),[])},this.clear=function(n){var o=this;function t(e){p("warn",[e]),window.unsaved=!1;var t={target:o};e.error?t.error=e.error:t.result=e,o.listener.emit("persister.unsaved",t),"function"==typeof n&&n()}kInteractive.deleteLocalData({label:kInteractive.getChapterID()+"-"+o.root.id},function(e){e.success&&("cloud"==o.storage&&c()?kotobee.deleteData({label:kInteractive.getChapterID()+"-"+o.root.id},function(e){e.success&&t(e)}):t(e))})},this.merge=function(e){var t=this;if(1<e.length){var n=e.sort(function(e,t){return e.date>t.date?-1:e.date<t.date?1:0});p("warn",["duplicate slots:",n]);var o=n[0];p("warn",["deleting all slots matching",o.label]),kotobee.deleteData({label:o.label,all:!0},function(e){p("warn",[e]),p("warn",["insert only last slot for",o.label]),kotobee.setData(o,function(e){p("warn",[e])})})}var r=t.storageAPI.getItem("ebook-"+kInteractive.getBookID())||"[]",i=(r=JSON.parse(r)).findIndex(function(e){return e.label==kInteractive.getChapterID()+"-"+t.root.id});-1!=i&&r.splice(i,1),r=r.concat(e),r=t.cleanupData(r),t.storageAPI.setItem("ebook-"+kInteractive.getBookID(),JSON.stringify(r))},this.push=function(t){var n=this;if(n.enabled){var e=n.storageAPI.getItem("ebook-"+kInteractive.getBookID())||"[]";if(e=(e=JSON.parse(e)).map(function(e){var t=JSON.parse(JSON.stringify(e));return t.overwrite=!0,delete t.date,t}),"cloud"==n.storage&&c())try{var o=n.cleanupData(e),r=o.filter(function(e){return e.data.length<=n.maxDataSize});r.forEach(function(e){JSON.parse(e.data).forEach(function(e){var t=u("#"+e.id);t&&t.classList.remove("inputError")})});var i=o.filter(function(e){return e.data.length>n.maxDataSize}),a=[];i.length&&i.forEach(function(e){var o=e.data.length;JSON.parse(e.data).filter(function(e){return-1!=["text","textarea"].indexOf(e.type)}).forEach(function(e){var t=e.value.length,n=u("#"+e.id);n&&(a.push(n),p("error",["long answer on:",e.id]),p("error",["answer length:",t]),p("error",["data slot length:",o]),n.classList.add("inputError"))})}),kotobee.setDataArray(r,function(e){p("warn",[e]),s(t,e.error||(a.length?n.messages.longDataError:null))})}catch(e){s(t,e.toString())}else s(t)}function s(e,t){window.unsaved=!1,t?(n.updateNotification("error",t),n.listener.emit("persister.error",{target:n,error:t})):(n.updateNotification("success"),n.listener.emit("persister.pushed",{target:n,result:{success:"pushed"}}),n.isSaveGlobal?("function"==typeof n.saveGlobal?n.saveGlobal():"object"==typeof n.saveGlobal&&n.saveGlobal.hasOwnProperty("callback")&&n.saveGlobal.callback(),n.isSaveGlobal=!1):"function"==typeof e&&e())}},this.updateNotification=function(e,t){var n=this;try{if(n.enabled&&!kInteractive.isEditorMode())if(u(".persist-log-"+n.root.id)&&n.silentMode)switch(e){case"saving":u(".persist-log-"+n.root.id+" span.saving").style.display="block",u(".persist-log-"+n.root.id+" span.success").style.display="none",u(".persist-log-"+n.root.id+" span.error").style.display="none";break;case"success":u(".persist-log-"+n.root.id+" span.saving").style.display="none",u(".persist-log-"+n.root.id+" span.success").style.display="block",u(".persist-log-"+n.root.id+" span.error").style.display="none";break;case"error":u(".persist-log-"+n.root.id+" span.saving").style.display="none",u(".persist-log-"+n.root.id+" span.success").style.display="none",u(".persist-log-"+n.root.id+" span.error").style.display="block",u(".persist-log-"+n.root.id+" span.error").textContent=t||"Unexpected error!"}else if(u(".unsaved-changes-"+n.root.id))switch(e){case"saving":u(".unsaved-changes-"+n.root.id+" .saved").style.display="none",u(".unsaved-changes-"+n.root.id+" .saving").style.display="block",u(".unsaved-changes-"+n.root.id+" .unsaved").style.display="none",u(".unsaved-changes-"+n.root.id+" .notsaved").style.display="none",u(".unsaved-changes-"+n.root.id).classList.contains("success")&&u(".unsaved-changes-"+n.root.id).classList.remove("success"),n.silentMode||u(".unsaved-changes-"+n.root.id).classList.contains("show")||u(".unsaved-changes-"+n.root.id).classList.add("show");break;case"success":u(".unsaved-changes-"+n.root.id+" .saving").style.display="none",n.silentMode||n.isSaveGlobal?u(".unsaved-changes-"+n.root.id).classList.remove("show"):(u(".unsaved-changes-"+n.root.id).classList.add("success"),u(".unsaved-changes-"+n.root.id+" .saved").style.display="block");break;case"error":u(".unsaved-changes-"+n.root.id+" .saving").style.display="none",n.silentMode||n.isSaveGlobal?u(".unsaved-changes-"+n.root.id).classList.remove("show"):(u(".unsaved-changes-"+n.root.id).classList.add("error"),u(".unsaved-changes-"+n.root.id+" .notsaved span").textContent=t||"Unexpected error!",u(".unsaved-changes-"+n.root.id+" .notsaved").style.display="block");break;case"reset":u(".unsaved-changes-"+n.root.id+" .saved").style.display="none",u(".unsaved-changes-"+n.root.id+" .saving").style.display="none",u(".unsaved-changes-"+n.root.id+" .unsaved").style.display=n.silentMode?"none":"block",u(".unsaved-changes-"+n.root.id+" .notsaved").style.display="none",u(".unsaved-changes-"+n.root.id).classList.contains("success")&&u(".unsaved-changes-"+n.root.id).classList.remove("success"),n.silentMode||u(".unsaved-changes-"+n.root.id).classList.contains("show")||u(".unsaved-changes-"+n.root.id).classList.add("show")}}catch(e){}},this.collectInputs=function(){var e=this,t=this.getRootSelector();e.root=u(t),e.root?(e.text=u(e.root).find('input[type="text"]',!0),e.number=u(e.root).find('input[type="number"]',!0),e.radio=u(e.root).find('input[type="radio"]',!0),e.checkbox=u(e.root).find('input[type="checkbox"]:not([name="preserveAnswers"])',!0),e.textarea=u(e.root).find("textarea",!0),e.dragdrop=u(e.root).find(".ki-draggable",!0)):p("error",["unable to re-select root element by:",t])},this.handleChange=function(){this.enabled&&(this.silentMode?this.save():this.saveGlobal&&!this.forceNotification||this.setNotify())},this.processInputs=function(){var o=this;function r(){p("warn",["persister change handler:",this.id,-1!=["radio","checkbox"].indexOf(this.type)?this.checked:this.value]),o.handleChange()}function t(e,t){document.body.addEventListener(e,function(e){e.target.id==t.id&&(-1!=["radio","checkbox"].indexOf(t.type)?t.checked=e.target.checked:t.value=e.target.value,function(o,r,i){var a;return r=r||20,i=i||!0,function(){var e=this,t=arguments,n=i&&!a;clearTimeout(a),a=setTimeout(function(){a=null,i||o.apply(e,t)},r),n&&o.apply(e,t)}}(r.bind(t),o.interval)())})}o.collectInputs();var i=0;if(o.text&&o.text.forEach(function(e){e.id||(e.id=(e.name?e.name:"tx")+"-"+i),i++,e.id&&!e.dataset.freeze&&(t("keyup",e),t("change",e))}),o.number&&o.number.forEach(function(e){e.id||(e.id=(e.name?e.name:"num")+"-"+i),i++,e.id&&!e.dataset.freeze&&(t("keyup",e),t("change",e))}),o.radio&&o.radio.forEach(function(n){n.id||(n.id=(n.name?n.name:"rb")+"-"+i),i++,n.id&&!n.dataset.freeze&&(o.enabledUncheckRadio?document.body.addEventListener("click",function(e){if(e.target.id==n.id){var t=e.target.dataset.state||"";Boolean(t.toString())?(e.target.checked=!1,e.target.dataset.state=""):e.target.dataset.state=e.target.checked,r.call(n)}}):t("change",n))}),o.checkbox&&o.checkbox.forEach(function(e){e.id||(e.id=(e.name?e.name:"cb")+"-"+i),i++,e.id&&!e.dataset.freeze&&t("change",e)}),o.textarea&&o.textarea.forEach(function(e){e.id||(e.id=(e.name?e.name:"ta")+"-"+i),i++,e.id&&!e.dataset.freeze&&(t("keyup",e),t("change",e))}),o.setRadioGroup)try{o.radio&&o.radio.forEach(function(e){e.name=e.id?e.id.match(/(.*?)(\d+)/)[0].replace("-0-",""):e.name})}catch(e){}},this.restore=function(e){var a=this;setTimeout(function(){a.getLocalData().then(function(){a.data.length&&a.data.forEach(function(e){var t=e.id;if(t)if(isNaN(t)){var n=u("#"+t);if(n)switch(e.type){case"text":case"number":case"textarea":n.value=e.value||"";break;case"radio":case"checkbox":n.checked=e.value;break;case"div":if(e.value){var o=n.cloneNode(!0);o.dataset.category=e.value;var r=a.getQContainer(n);if(r){var i=r.getElementsByClassName(e.value)[0];i&&(i.appendChild(o),n.parentNode.removeChild(n))}}break;default:p("warn",["invalid input type:",e.type])}else p("error",["unable to find input by id:",t])}else p("error",["invalid input selector:",t]);else p("error",["invalid input selector:",t])}),a.renderInlineBar(),"function"==typeof e?e():(window.unsaved=!1,a.listener.emit("persister.restored",{target:a}))})},0)},this.getQContainer=function(e){for(;!e.classList.contains("ques");)e=e.parentNode;return e},this.renderSaveTab=function(e){var t=this;if(e)e.addEventListener("click",function(e){e.preventDefault(),t.isSaveGlobal=!0,t.push()});else if(!u("#save-changes")){var n=u("#tabMenu");if(n){var o=n.querySelectorAll("a:not(.chapterBtn)");if(o.length){var r=(o=o[0]).parentNode,i=o.cloneNode(!0);i.id="save-changes",i.querySelector(".icon").className="icon ion-"+(t.saveGlobal.icon||"checkmark-circled"),i.querySelector(".tab-title").innerText=t.saveGlobal.label||t.messages.save,r.insertAdjacentHTML("beforeend",i.outerHTML)}u("#save-changes").addEventListener("click",function(e){e.preventDefault(),t.isSaveGlobal=!0,t.push()})}}},this.init=function(){var t=this;function n(){t.delegateEvents&&t.processInputs(),t.enabled&&(t.renderInlineBar(),t.renderFloatingBar()),window.addEventListener("beforeunload",function(e){void 0!==kotobee&&(-1!=!location.hostname.indexOf("localhost")&&-1!=!location.hostname.indexOf("127.0.0.1")||"undefined"!=typeof config&&!config.kotobee.public||t.testMode)&&window.unsaved&&(t.setNotify(),e.preventDefault(),e.returnValue="",delete e.returnValue)})}kInteractive.isEditorMode()||("cloud"==t.storage&&c()?kotobee.getDataPerms(function(e){e&&e.maxDataSize&&(t.maxDataSize=e.maxDataSize,p("warn",["data size limit:",t.maxDataSize]),n())}):n()),window.unsaved=!1,t.listener.emit("persister.ready",{target:t})},this.listener=new function(){this.listeners={},this.on=function(e,t){return this.addListener(e,t)},this.once=function(e,t){this.listeners[e]=this.listeners[e]||[];var n=function(){t(),this.off(e,n)};return this.listeners[e].push(n),this},this.off=function(e,t){return this.removeListener(e,t)},this.die=function(e){return this.removeAllListeners(e)},this.addListener=function(e,t){return this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t),this},this.removeListener=function(e,t){var n=this.listeners[e]||[];return this.listeners[e]=n.filter(function(e){return e!==t}),this},this.removeAllListeners=function(e){return delete this.listeners[e],this},this.emit=function(){if(arguments.length<1)return!1;var e=arguments[0],t=this.listeners[e];if(!t)return!1;var n=1<arguments.length?Array.prototype.slice.call(arguments).slice(1):[];return t.forEach(function(e){e.apply(this,n)}),!0},this.listListeners=function(e){return this.listeners[e]||[]}};var t,n=this;function u(e){if(arguments.length<1)return null;var t=e,r=null;if("string"==typeof t){var n=!1,o=document;if(1<arguments.length)for(var i,a=Array.prototype.slice.call(arguments).slice(1),s=0;s<a.length;s++)"boolean"==typeof(i=a[s])?n=i:"object"==typeof i&&(o=i);if(0==(r=Array.prototype.slice.call(o.querySelectorAll(t))).length)return null;r=n||1!=r.length?r:r[0]}else r=t;return Array.isArray(r)||(r.find=function(e,t){return u(e,r,t)},r.parents=function e(t){var n=null;var o=-1!=t.indexOf(".")?t.split(".")[1]:"";r.parentNode.nodeName.toLowerCase()==t.toLowerCase()||""!=o&&r.parentNode.classList.contains(o)||r.parentNode.id==t.replace("#","")?n=r.parentNode:"body"==r.parentNode.nodeName.toLowerCase()||n||(r=r.parentNode,n=e(t));return n},r.closest=function(e){return function(e,t){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null}(r,e)},r.ascendants=function(e){return function(e){Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n});for(var t=[];e&&e!==document;e=e.parentNode)t.push(e);return t}(r)}),r}function p(e,t){"dev"==(window.debug||-1!=location.hostname.indexOf(".local")||-1!=location.hostname.indexOf("kotobee.com")||-1!=location.hostname.indexOf("localhost")||-1!=location.hostname.indexOf("localhost")||-1!=location.hostname.indexOf("192.168.")?"dev":"production")&&console[e].apply(null,t)}function c(){return void 0!==kotobee&&kotobee.user&&kotobee.user.loggedIn}(t=this.listener,Object.getOwnPropertyNames(t).filter(function(e){return"function"==typeof t[e]})).forEach(function(e){n[e]||(n[e]=n.listener[e].bind(n.listener))}),e&&this.setOptions(e),this.storageAPI=-1!=["session","cloud"].indexOf(this.storage)?sessionStorage:localStorage,kInteractive.setStorage(this.storageAPI)}kInteractive.setStorage(),kInteractive.container={preRender:function(e,t){kInteractive.readData(e)},postRender:function(e,t,n){var o=kInteractive.readData(t);if(o&&(kInteractive.isMobile()&&"cScroll"==o.type&&void 0!==isKotobee&&angular.element(document.body).scope().applyNativeScroll(t),o.path)){var r=o.path;void 0!==isKotobee&&(r=ph.join(kInteractive.absoluteURL,o.path));var i=t.getAttribute("style");r=kInteractive.cleanURL(r),t.setAttribute("style",i+' background-image:url("'+r+'");')}},action:function(e){},resize:function(e){var t=kInteractive.readData(e);t&&kInteractive.checkResponsiveFloat(t,e)}},kInteractive.equation={preRender:function(e,t){if(!kInteractive.isEditorMode()&&"undefined"==typeof MathJax){MathJax={loader:{load:["input/asciimath","input/mml","input/tex","output/chtml","ui/menu"]}};var n=document.createElement("script"),o="";o=void 0===isKotobee?"../../js/lib/mathjax/startup.js":bookPath+"EPUB/js/lib/mathjax/startup.js",n.src=kInteractive.cleanURL(o),n.setAttribute("type","text/javascript"),document.head.appendChild(n)}},postRender:function(e,t,n){var o=e.createDocumentFragment(),r=kInteractive.readData(t);if(r){t.setAttribute("id","ki-equation-"+n),t.innerHTML="";var i=r.content;"mathml"==r.type?i="<math>"+i+"</math>":"asciimath"==r.type?i="`"+i+"`":"tex"==r.type&&(i="\\("+i+"\\)");var a="inline"==r.placement?"span":"div",s=document.createElement(a);s.setAttribute("id","ki-equation-"+n+"-container"),s.className="parsed container",s.innerHTML=i;var c=document.createElement(a);r.style&&kInteractive.c.addClass(c,r.style),o.appendChild(s),c.appendChild(o),t.appendChild(c),kInteractive.isEditorMode()||MathJax&&MathJax.typeset&&MathJax.typeset()}},action:function(e){kInteractive.readData(e)},resize:function(e){kInteractive.readData(e)}},kInteractive.gallery={preRender:function(e,t){var n=t.createDocumentFragment(),o=kInteractive.readData(e);if(o){e.innerHTML="";var r=e.getAttribute("data-index");r=r||0;var i=document.createElement("div");i.className="imgMask";var a=document.createElement("div");a.className="images "+o.scale,i.appendChild(a);for(var s=0;s<o.imgs.length;s++){var c=document.createElement("div");c.className="imgContainer ki-btn";var l=void 0===isKotobee?o.imgs[s].path:ph.join(kInteractive.absoluteURL,o.imgs[s].path);l=kInteractive.cleanURL(l),c.setAttribute("style","background-color:"+o.bgColor+";background-image:url('"+l+"')"),o.imgs[s].caption&&c.setAttribute("data-caption",o.imgs[s].caption),void 0!==isKotobee||kInteractive.c.hasClass(e,"fullscreen")||c.addEventListener("click",kInteractive.actionEvent),a.appendChild(c)}var d=document.createElement("div");d.className="navBtns";var u=document.createElement("a");u.className="next btn ki-btn",d.appendChild(u);var p=document.createElement("a");p.className="prev btn ki-btn",d.appendChild(p),n.appendChild(d),void 0!==isKotobee&&!kInteractive.c.hasClass(e,"fullscreen")||(u.addEventListener("click",kInteractive.actionEvent),p.addEventListener("click",kInteractive.actionEvent)),n.appendChild(i);var f=document.createElement("div");f.className="kFooter",o.footerShadow&&(f.className+=" shadow"),n.appendChild(f);var h=document.createElement("div");h.className="imgCaption";var g=document.createElement("div");if(g.className="inner",g.style.display="none",o.imgs[0]&&o.imgs[0].caption&&(g.innerHTML=o.imgs[0].caption,g.style.display=null),h.appendChild(g),f.appendChild(h),o.thumbnails){var m=document.createElement("div");m.className="kThumbs",o.thumbShowOnHover&&(m.className+=" showOnHover"),"small"==o.thumbSize?kInteractive.c.addClass(m,"small"):"large"==o.thumbSize?kInteractive.c.addClass(m,"large"):kInteractive.c.addClass(m,"medium"),f.appendChild(m)}if(kInteractive.c.hasClass(e,"fullscreen")){var v=document.createElement("div");v.className="fullscreenControls",v.innerHTML="<a class='closeBtn ki-btn'></a>",e.appendChild(v),v.children[0].addEventListener("click",kInteractive.actionEvent),document.addEventListener("keydown",kInteractive.gallery.detectKey)}var b=document.createElement("div");o.style&&kInteractive.c.addClass(b,o.style),b.appendChild(n),e.appendChild(b),kInteractive.gallery.dimBtns(e),kInteractive.gallery.resize(e),this.showImage(e,{index:r,dontGoFullscreen:!0}),setTimeout(function(){kInteractive.gallery.showImage(e,{index:r,dontGoFullscreen:!0})},80)}},postRender:function(e,t,n){kInteractive.gallery.resize(t);var o=this.getState(t);this.showImage(t,{index:o.selectedIndex,dontGoFullscreen:!0})},action:function(e,t,n){e.getElementsByClassName("images")[0].getElementsByClassName("selected")[0];if(kInteractive.hasClass(t,"btn")){if(kInteractive.hasClass(t,"disable"))return n.stopPropagation();kInteractive.hasClass(t,"next")?kInteractive.gallery.showImage(e,{dir:"next"}):kInteractive.hasClass(t,"prev")&&kInteractive.gallery.showImage(e,{dir:"prev"})}else if(kInteractive.hasClass(t,"closeBtn"))kInteractive.gallery.exitFullscreen();else{if(kInteractive.hasClass(t,"imgContainer"))return kInteractive.gallery.goToFullscreen(e);if(kInteractive.hasClass(t,"kMapItem")){var o=kInteractive.getChildIndex(t);kInteractive.gallery.goToThumb(e,{windowIndex:o,highlightThumb:!1})}else if(kInteractive.hasClass(t,"kThumb")){o=t.getAttribute("data-index");kInteractive.gallery.showImage(e,{index:t.getAttribute("data-index")})}else if(kInteractive.hasClass(t,"thumbNavBtn")){kInteractive.hasClass(t,"next")?kInteractive.gallery.goToThumb(e,{dir:"nextWindow",highlightThumb:!1}):kInteractive.hasClass(t,"prev")&&kInteractive.gallery.goToThumb(e,{dir:"prevWindow",highlightThumb:!1})}}kInteractive.gallery.dimBtns(e)},goToThumb:function(e,t){t=t||{};var n,o,r=this.getState(e),i=r.thumbWindows,a=r.activeWindow,s=r.currentIndex,c=r.selectedIndex,l=r.currentThumb,d=t.index;if(null==d&&(null!=t.windowIndex?d=t.windowIndex*i[0].children[0].children.length:("nextThumb"==t.dir&&(d=c+1),"prevThumb"==t.dir&&(d=c-1),"nextWindow"==t.dir&&(d=s+i[0].children[0].children.length),"prevWindow"==t.dir&&(d=s-i[0].children[0].children.length))),i.length)for(var u=i[0].getElementsByClassName("kThumb"),p=u.length;p--;)if(u[p].getAttribute("data-index")==d){n=u[p],o=n.parentNode;break}if(o){if(a!=o){s<d?(a.style.left=-e.offsetWidth+"px",o.style.left=e.offsetWidth/2+"px"):(a.style.left=e.offsetWidth+"px",o.style.left=-e.offsetWidth/2+"px"),o.style.display="none",setTimeout(function(){o.style.display="block",setTimeout(function(){o.style.left=0},20)},20);var f=e.getElementsByClassName("kMapItem");f.length&&(a&&kInteractive.c.removeClass(f[kInteractive.getChildIndex(a)],"active"),kInteractive.c.addClass(f[kInteractive.getChildIndex(o)],"active")),kInteractive.c.addClass(o,"active"),kInteractive.c.removeClass(a,"active")}t.highlightThumb&&(kInteractive.c.removeClass(l,"active"),kInteractive.c.addClass(n,"active"))}},dimBtns:function(e){for(var t,n=e.getElementsByClassName("kThumbWindow"),o=n.length;o--;)if(kInteractive.c.hasClass(n[o],"active")){t=n[o];break}if(t){var r=e.getElementsByClassName("thumbNavBtn");for(o=0;o<r.length;o++)kInteractive.c.hasClass(r[o],"next")?t.nextElementSibling?kInteractive.c.removeClass(r[o],"disable"):kInteractive.c.addClass(r[o],"disable"):kInteractive.c.hasClass(r[o],"prev")&&(t.previousElementSibling?kInteractive.c.removeClass(r[o],"disable"):kInteractive.c.addClass(r[o],"disable"))}var i=e.getElementsByClassName("imgContainer");if(i.length){var a=kInteractive.c.hasClass(i[0],"selected"),s=kInteractive.c.hasClass(i[i.length-1],"selected"),c=e.getElementsByClassName("btn");for(o=0;o<c.length;o++)kInteractive.c.hasClass(c[o],"next")?s?kInteractive.c.addClass(c[o],"disable"):kInteractive.c.removeClass(c[o],"disable"):kInteractive.c.hasClass(c[o],"prev")&&(a?kInteractive.c.addClass(c[o],"disable"):kInteractive.c.removeClass(c[o],"disable"))}},getState:function(e){var t={};t.images=e.getElementsByClassName("images")[0],t.selectedImg=t.images.getElementsByClassName("selected"),t.imgContainer=e.getElementsByClassName("imgContainer"),t.thumbWindows=e.getElementsByClassName("kThumbWindows");for(var n=0;n<t.imgContainer.length;n++)if(kInteractive.c.hasClass(t.imgContainer[n],"selected")){t.selectedIndex=n;break}if(t.thumbWindows.length){var o=t.thumbWindows[0].getElementsByClassName("active");for(n=0;n<o.length;n++)kInteractive.c.hasClass(o[n],"kThumbWindow")?(t.activeWindow=o[n],t.currentIndex=Number(t.activeWindow.children[0].getAttribute("data-index"))):t.currentThumb=o[n]}return t},goToFullscreen:function(e){if(kInteractive.frameIsOpen=!0,!kInteractive.c.hasClass(e,"fullscreen")){var t=document.createElement("div");t.innerHTML=e.outerHTML;var n=t.children[0];document.body.appendChild(n);var o=this.getState(e),r=e.getBoundingClientRect();n.setAttribute("data-index",o.selectedIndex),n.setAttribute("id","kFullscreenGallery"),n.style.top=r.top+"px",n.style.left=r.left+"px",n.style.width=r.width+"px",n.style.height=r.height+"px",kInteractive.listenForSwiping(n),n.addEventListener("swipeleft",function(){kInteractive.gallery.showImage(n,{dir:"next"})}),n.addEventListener("swiperight",function(){kInteractive.gallery.showImage(n,{dir:"prev"})},!1),void 0===isKotobee&&(n.style.position="fixed"),kInteractive.c.addClass(n,"fullscreen"),kInteractive.preRender(n,{singleElem:!0}),kInteractive.postRender(n,{singleElem:!0}),setTimeout(function(){kInteractive.c.addClass(n,"in")},20)}},showImage:function(e,t){t=t||{};var n=kInteractive.readData(e),o=this.getState(e),r=o.images,i=o.selectedImg,a=o.imgContainer,s=t.index;if(null==s&&i.length&&(s=kInteractive.getChildIndex(i[0])+("next"==t.dir?1:-1)),s<0&&(s=0),null==s&&(s=0),!t.dontGoFullscreen&&s==o.selectedIndex)return kInteractive.gallery.goToFullscreen(e);i.length&&kInteractive.c.removeClass(i[0],"selected"),kInteractive.c.addClass(a[s],"selected"),a[s].style.left=r.offsetWidth*s+"px",a[s].style.display="block",r.style.left=-r.offsetWidth*s+"px",this.goToThumb(e,{index:s,highlightThumb:!0});var c=e.getElementsByClassName("imgCaption");if(c.length){var l=(c=c[0]).getElementsByClassName("inner");if(l.length&&((l=l[0]).style.display="none",a[s].hasAttribute("data-caption")&&(l.innerHTML=a[s].getAttribute("data-caption"),n.captionFontSize&&(l.style.fontSize=n.captionFontSize+"em"),n.captionColor&&(l.style.color=n.captionColor),l.style.display=null),!n.footerOverlap)){var d=e.getElementsByClassName("imgMask");if(!d.length)return;d=d[0];var u=e.getElementsByClassName("kFooter")[0];d.style.bottom=u.offsetHeight+"px"}}},detectKey:function(e){kInteractive.gallery.exitFullscreen()},exitFullscreen:function(){var e=document.getElementById("kFullscreenGallery");e&&(kInteractive.c.removeClass(e,"in"),e.style.opacity=0,setTimeout(function(){e.parentNode.removeChild(e),document.removeEventListener("keydown",kInteractive.gallery.detectKey)},1e3))},resize:function(e){var t=kInteractive.readData(e);if(t&&(kInteractive.checkResponsiveFloat(t,e),t.thumbnails)){var n=kInteractive.gallery.getState(e).selectedIndex;null==n&&(e.getAttribute("data-index"),n=n||0);var o=e.getElementsByClassName("kThumbs")[0];o.innerHTML="";var r=50;"small"==t.thumbSize?r=40:"large"==t.thumbSize&&(r=60);var i,a=Math.floor((e.offsetWidth-80)/r),s=document.createElement("div");s.className="kThumbWindows";for(var c=0;c<t.imgs.length;c++)if(t.imgs[c].thumbPath){var l=document.createElement("a");l.className="ki-btn kThumb"+(c==n?" active":""),l.setAttribute("data-index",c);var d=void 0===isKotobee?t.imgs[c].thumbPath:ph.join(kInteractive.absoluteURL,t.imgs[c].thumbPath);d=kInteractive.cleanURL(d),l.setAttribute("style","background-image:url('"+d+"')"),void 0!==isKotobee&&!kInteractive.c.hasClass(e,"fullscreen")||l.addEventListener("click",kInteractive.actionEvent),c%a==0&&((i=document.createElement("div")).className="kThumbWindow",s.appendChild(i)),c==n&&kInteractive.c.addClass(i,"active"),i.appendChild(l)}if(o.appendChild(s),t.thumbMap){var u=document.createElement("div");u.className="kThumbMap";for(c=0;c<t.imgs.length;c++)if(c%a==0){var p=document.createElement("a");p.className="ki-btn kMapItem"+(c==n?" active":""),u.appendChild(p),void 0!==isKotobee&&!kInteractive.c.hasClass(e,"fullscreen")||p.addEventListener("click",kInteractive.actionEvent)}o.appendChild(u)}if(1<s.children.length){var f=document.createElement("a");f.className="thumbNavBtn next",o.appendChild(f);var h=document.createElement("a");h.className="thumbNavBtn prev",o.appendChild(h),void 0!==isKotobee&&!kInteractive.c.hasClass(e,"fullscreen")||(f.addEventListener("click",kInteractive.actionEvent),h.addEventListener("click",kInteractive.actionEvent))}}}},kInteractive.image={preRender:function(e,t){var n=kInteractive.readData(e);n&&(n.style&&kInteractive.c.addClass(e,n.style),n.popup&&n.splash&&(e.src=n.splash),e.parentNode&&kInteractive.hasClass(e.parentNode,"link")||void 0===isKotobee&&e.addEventListener("click",kInteractive.actionEvent))},postRender:function(e,t,n){kInteractive.readData(t)},action:function(e,o,t){if(o.parentNode&&kInteractive.hasClass(o.parentNode,"kInteractive")&&kInteractive.hasClass(o.parentNode,"link"))kInteractive.action(o.parentNode,event);else{var n=kInteractive.readData(o);if(n){var r=n.behavior;if("none"!=r)s(o,"none"),c(o,"none"),l(o,"none"),setTimeout(function(){"wiggle"==r?(s(o,"wiggle"),c(o,"0.5s"),l(o,"1")):"jump"==r?(s(o,"jump"),c(o,"0.7s"),l(o,"1")):"scale"==r&&(s(o,"scale"),c(o,"0.5s"),l(o,"1"));var n=function(){var e,t=document.createElement("fakeelement"),n={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in n)if(void 0!==t.style[e])return n[e]}();n&&o.addEventListener(n,function e(t){s(o,"none"),c(o,"none"),l(o,"none"),o.removeEventListener(n,e)})}),kInteractive.tinCan({verb:"clicked",activity:r+"image: "+o.getAttribute("src")});else if(n.popup){var i={class:"image"},a=document.createElement("img");a.src=n.path,kInteractive.isAbsolutePath(n.path)||void 0!==isKotobee&&(a.src=ph.join(kInteractive.absoluteURL,n.path)),i.width=a.naturalWidth,i.height=a.naturalHeight,i.pos="side",i.cb=function(e){e.appendChild(a)},i.closed=function(){},kInteractive.openFrame(i)}}}function s(e,t){e.style.webkitAnimation=e.style.mozAnimation=e.style.animation=t}function c(e,t){e.style.webkitAnimationDuration=e.style.mozAnimationDuration=e.style.animationDuration=t}function l(e,t){e.style.webkitAnimationIterationCount=e.style.mozAnimationIterationCount=e.style.animationIterationCount=t}},resize:function(e){var t=kInteractive.readData(e);t&&kInteractive.checkResponsiveFloat(t,e)}},kInteractive.link={preRender:function(e,t){var n=kInteractive.readData(e);if(n&&!kInteractive.isEditorMode()){if("#"==e.getAttribute("href")&&e.setAttribute("href",""),"div"==e.nodeName.toLowerCase()){var o=document.createElement("a"),r=e.getAttribute("href")?e.getAttribute("href"):n.href;e.getAttribute("data-href")&&(r=e.getAttribute("data-href")),r=r||"",o.setAttribute("href",r),o.setAttribute("target",n.target?n.target:""),o.setAttribute("style",e.getAttribute("style")),o.setAttribute("data-kotobee",e.getAttribute("data-kotobee")),o.className=e.className,e.id?o.id=e.id:n.id&&(o.id=n.id),kInteractive.c.addClass(o,"btn"),o.style.opacity=Number(n.transparency)/100,e.parentNode.replaceChild(o,e),e=o}void 0===isKotobee&&("popup"!=n.type&&"audio"!=n.type&&"action"!=n.type||e.setAttribute("onclick","return false;"),e.addEventListener("click",kInteractive.actionEvent))}},postRender:function(e,t,n){},action:function(t,e,n){var o=kInteractive.readData(e);if(o){if("popup"==o.type){var r="<div class='kbAlertScroll'>"+o.msg+"</div>";if(r=r.replace(/src="(.*?)"/g,function(){var e=arguments[1];return void 0!==isKotobee&&(e=ph.join(kInteractive.absoluteURL,e)),'src="'+e+'"'}),"image"==o.popupMode){var i=o.popupImg;void 0!==isKotobee&&(i=o.relToRoot?ph.join(bookPath,i):ph.join(kInteractive.absoluteURL,i)),r="<img src='"+(i=kInteractive.cleanURL(i))+"'/>"}kInteractive.alert({content:r}),setTimeout(function(){if(kInteractive.scorm){var e={};e.id=kInteractive.getScormId("popup",o.msg),e.description="Shown popup message: "+o.msg,e.type="other",e.learnerResponses="Shown",e.timestamp=new Date,kInteractive.scorm.setInteractions([e])}kInteractive.events&&kInteractive.events.add({action:"popup",param:o.msg,elem:t,data:o})})}else if("action"==o.type){var a=o.asset,s=o.action;if(a.remote){if("widget"==a.type){var c=document.createElement("div");c.className="kInteractive widget kbHidden",c.setAttribute("data-kotobee",a.data),document.body.appendChild(c),kInteractive.trigger("click",c)}return}for(var l=document.getElementsByClassName(a.classname),d=0;d<l.length;d++)if(kInteractive.hasClass(l[d],"kInteractive")&&kInteractive.hasClass(l[d],a.type))if("activate"==s)if("gallery"==a.type){var u=l[d].getElementsByClassName("next");kInteractive.trigger("click",u[0])}else if("questions"==a.type){for(var p=l[d].getElementsByClassName("ki-btn"),f=0;f<p.length;f++)if("submit"==p[f].type){kInteractive.trigger("click",p[f]);break}}else kInteractive.trigger("click",l[d]);else"visibility"==s&&kInteractive.c.toggleClass(l[d],"kbHidden")}else if("audio"==o.type){kInteractive.stopCurrentMedia();var h,g=document.createElement("audio"),m=o.src;function v(){h||(kInteractive.c.addClass(y,"hide"),h=!0)}"file"==o.audioType&&(m=void 0===isKotobee?o.audio:ph.join(kInteractive.absoluteURL,o.audio)),m=kInteractive.cleanURL(m),g.setAttribute("src",m);var b=document.createElement("div");b.className="kiAudioLoader",b.style.transform=b.style.webkitTransform=b.style.mozTransform="scale(1)";var y=document.createElement("div");if(y.className="kiAudioSpinner",b.appendChild(y),e.parentNode.insertBefore(b,e),g.onplaying=v,setTimeout(v,5e3),g.play(),kInteractive.currentAudio=g,kInteractive.tinCan({verb:"played",activity:"Audio: "+m}),kInteractive.scorm){var k={};k.id=kInteractive.getScormId(e.textContent,m),k.description="Played audio link: "+m,k.type="other",k.learnerResponses="Played",k.objective=o.options?o.options.objective:null,k.timestamp=new Date,kInteractive.scorm.setInteractions([k])}kInteractive.events&&kInteractive.events.add({action:"audioLinkClicked",param:m,elem:t,data:o})}else if("attachment"==o.type){var w=o.file;if(void 0!==isKotobee&&(w=o.relToRoot?ph.join(bookPath,o.file):ph.join(kInteractive.absoluteURL,o.file)),void 0!==kotobee&&native)return void angular.element(document.body).scope().getService("crdv").mobileDownload(w);var x=document.createElement("a");document.body.appendChild(x),x.setAttribute("style","display: none"),x.href=kInteractive.cleanURL(w),x.target="_blank",x.download=o.file.split("/")[o.file.split("/").length-1],x.setAttribute("onclick","");var C=document.createEvent("MouseEvents");C.initMouseEvent("click"),x.dispatchEvent(C),x.remove()}return!1}}},kInteractive.lipsync={preRender:function(e,t){},postRender:function(e,t,n){var o,r=e.createDocumentFragment(),i=kInteractive.readData(t);t.setAttribute("id",o="ki-lipsync-"+n),t.innerHTML="";var a=document.createElement("div");if(a.className="container",i.sync){var s=document.createElement("div");s.className="audioContainer";var c=document.createElement("a");c.className="playBtn ki-btn",c.appendChild(document.createElement("span")),void 0===isKotobee&&c.addEventListener("click",kInteractive.actionEvent),s.appendChild(c);var l=document.createElement("div");l.setAttribute("id",o+"-container"),l.className="playerContainer",s.appendChild(l),i.interaction.playBtn?i.interaction.btnAlignment&&kInteractive.c.addClass(s,i.interaction.btnAlignment):s.style.display="none",a.appendChild(s)}var d=document.createElement("div");d.className="contentContainer",d.innerHTML=function(e){document.createElement("div");var t=/(>)([^<\n]*?[^<]+?)(<[^\/])/g;e=e.replace(/([< \/][^>]*?>)((\s*[^<\s]+\s+?)+)([^<\s]+\s*)(<)/g,function(e,t){if(0<=t.indexOf('class="parsed"'))return e;if(0==t.indexOf("<pre"))return e;if(0==t.indexOf("<code"))return e;if(0==t.indexOf("<script"))return e;var n=arguments[2].split(" ");""==n[n.length-1]&&n.splice(-1,1),n.push(arguments[4]);for(var o="",r=0;r<n.length;r++){var i=r==n.length-1?"":" ";o+="<span>"+n[r]+i+"</span>"}return t+o+"<"}),e=e.replace(t,function(e,t){return arguments[2].trim()?t+("<span>"+arguments[2]+"</span>")+arguments[3]:e});return e=(e=e.replace(/(<a [\s\S]*?)(>)/g,'$1 onclick="return false;" $2')).replace(/&nbsp;/g,"&#160;")}(i.content),a.appendChild(d);var u=document.createElement("div");i.style&&kInteractive.c.addClass(u,i.style),r.appendChild(a),u.appendChild(r),t.appendChild(u);var p=document.createElement("style");p.className="system parsed";var f="";if(f+="#"+o+" .lipSyncCurrentWord {",f+="color:"+i.layout.color+";",i.layout.underline&&(f+="text-decoration:underline;"),i.layout.scale&&1<Number(i.layout.scale)&&(f+="transform:scale("+i.layout.scale+");",f+="padding:0 3px;",f+="display:inline-block;"),f+="}",p.innerHTML=f,t.appendChild(p),i.autoplay)kInteractive.action(t)},action:function(r,e){kInteractive.stopCurrentMedia();var i=kInteractive.readData(r);if(i){i.audioType||(i.audioType=i.type);r.getAttribute("id");r.getElementsByClassName("playBtn")[0].className="playBtn ki-btn hide";var t=i.src;if("file"==i.audioType&&(t=void 0===isKotobee?i.audio:i.relToRoot?ph.join(bookPath,i.audio):ph.join(kInteractive.absoluteURL,i.audio)),kInteractive.scorm){var n={};n.id=kInteractive.getScormId(r.getAttribute("id"),t),n.description="Played audio: "+t,n.type="other",n.learnerResponses="Played",n.objective=i.options?i.options.objective:null,n.timestamp=new Date,kInteractive.scorm.setInteractions([n])}kInteractive.events&&kInteractive.events.add({action:"audioPlayed",param:t,elem:r,data:i});var o=document.createElement("audio");o.setAttribute("controls","true"),o.setAttribute("autoplay","true"),o.setAttribute("data-tap-disabled","false");var a=document.createElement("source");a.src=kInteractive.cleanURL(t),o.appendChild(a),o.appendChild(document.createTextNode("Your browser does not support the audio element")),o.className="ki-noHighlight",o.oncanplay=function(){kInteractive.currentAudio==r&&kInteractive.tinCan({verb:"played",activity:"Audio: "+t})},o.ontimeupdate=function(e){!function(e){var t,n=i;for(var o=n.sync.length;o--;)if(e>=n.sync[o]){t=o;break}if(null==t)return;c!=t&&(null!=c&&s[c]&&kInteractive.c.removeClass(s[c],"lipSyncCurrentWord"),s[t]&&kInteractive.c.addClass(s[t],"lipSyncCurrentWord"),c=t)}(o.currentTime)},r.getElementsByClassName("playerContainer")[0].appendChild(o),o.play(),kInteractive.currentAudio=r,kInteractive.c.addClass(kInteractive.currentAudio,"playing");var s=function(){for(var e=[],t=r.getElementsByClassName("contentContainer")[0],n=t.getElementsByClassName("lipSyncCurrentWord"),o=n.length;o--;)hasClass(n[o],"lipSyncCurrentWord")&&removeClass(n[o],"lipSyncCurrentWord");for(;t.children&&t.children.length;)t=t.children[0];e.push(t);for(;t;)if(t.nextSibling){for(t=t.nextSibling;t.children&&t.children.length;)t=t.children[0];if(3==t.nodeType)continue;if(""==t.textContent)continue;e.push(t)}else if("contentContainer"==(t=t.parentNode).className)break;return e}(),c=0;kInteractive.c.addClass(s[c],"lipSyncCurrentWord")}}},kInteractive.questions={preRender:function(e,t,n,o){var r=t.createDocumentFragment(),i=kInteractive.readData(e);if(i){var a=i.dict,s=i.userDict;if(a=a||{},s=s||a,i.options||(i.options={}),e.id||(e.id="ki-qs-"+n+"-"+Math.ceil(1e3*Math.random())),e.innerHTML="",i.layout&&i.layout.popup&&!kInteractive.hasClass(e,"inpopup")){var c=document.createElement("img"),l=i.layout.popupImg;return l=kInteractive.cleanURL(l),c.src=l,r.appendChild(c),void 0===isKotobee&&c.addEventListener("click",kInteractive.actionEvent),void e.appendChild(r)}if(i.options.randomize){for(var d=0;d<i.q.length;d++)i.q[d].origin=d;for(var u,p,f=i.q.length;0!==f;)p=Math.floor(Math.random()*(i.q.length-1e-4)),f--,u=i.q[f],i.q[f]=i.q[p],i.q[p]=u;if("slides"==i.options.displayMode){var h="";for(d=0;d<i.q.length;d++)h+=(h?",":"")+i.q[d].origin;e.setAttribute("data-o",h)}}if(i.options.questionsDisplayed){var g=Number(i.options.questionsDisplayed);i.q=i.q.slice(0,g)}if(i.title){var m=document.createElement("span");m.innerHTML="<h4>"+kInteractive.escapeHtml(i.title)+"</h4>",r.appendChild(m)}var v=null;i.options&&i.options.emailForm&&(v=this.f.createEmailForm(s));var b=null;"none"!=i.action&&(b=this.f.createSubmitBtn(s,e));var y=null,k=null,w=null;i.options&&i.options.clearAnswers&&(y=this.f.createClearBtn(s)),i.options&&i.options.addToNotebook&&(w=this.f.createAddToNotebookBtn(s)),i.options&&i.options.preserveAnswers&&(k=this.f.createPreserveBtn(s,e,i.options.preserveAnswers,i.layout.persist||{}));var x=this.f.createSeparator(),C=document.createElement("div");C.className="qContainer";var I=document.createElement("div");if(I.className="btnContainer","slides"==i.options.displayMode)e.qIndex=0,C.appendChild(kInteractive.questions.f.createQElem(i,{questionNo:0,index:0,elem:e,rendered:!1})),r.appendChild(C),r.appendChild(I),kInteractive.questions.f.showNavBtns(0,r,{isFrag:!0,userDict:s,qsData:i});else{var E=0;for(d=0;d<i.q.length;d++)"sp"!=i.q[d].type&&E++,C.appendChild(kInteractive.questions.f.createQElem(i,{questionNo:E,index:d,elem:e,rendered:!1}));r.appendChild(C),v&&I.appendChild(v),b&&I.appendChild(b),w&&I.appendChild(w),y&&I.appendChild(y),k&&I.appendChild(k),x&&r.appendChild(x),r.appendChild(I)}i.options.rtl?(e.setAttribute("dir","rtl"),kInteractive.c.addClass(e,"rtl")):e.setAttribute("dir","ltr");var S=document.createElement("div");i.style&&kInteractive.c.addClass(S,i.style),S.appendChild(r),e.appendChild(S)}},postRender:function(e,t,n){var o=kInteractive.readData(t);if(o){var r=o.dict,i=o.userDict;r=r||{},i=i||r;for(var a=t.getElementsByClassName("ques"),s=t.getElementsByClassName("explanation"),c=s.length;c--;)s[c].parentNode.removeChild(s[c]);var l=t.getElementsByClassName("reference");for(c=l.length;c--;)l[c].parentNode.removeChild(l[c]);kInteractive.questions.f.getItemOrder(t);for(var d=0;d<a.length;d++){var u=a[d].getElementsByClassName("ans"),p=(u.length,d);o.options.randomize&&(p="slides"==o.options.displayMode&&t.originArray?t.originArray[d]:Number(a[d].getAttribute("data-o"))),document[t.id]&&document[t.id].preserve&&document[t.id].q&&document[t.id].q[p]&&kInteractive.questions.f.showExp(o.userDict,a[d],o.q[p]);for(c=0;c<u.length;c++)if(kInteractive.c.removeClass(u[c].parentNode,"correct"),0<=u[c].getAttribute("id").indexOf("ki-tf-"))document[t.id]&&document[t.id].preserve&&document[t.id].q&&document[t.id].q[p]&&(document[t.id].q[p][c]?u[c].setAttribute("checked",!0):u[c].removeAttribute("checked"),o.options&&o.options.highlightCorrect&&(0==c&&o.q[p].a||1==c&&!o.q[p].a)&&kInteractive.c.addClass(u[c].parentNode,"correct"));else if(0<=u[c].getAttribute("id").indexOf("ki-dd-")){if(document[t.id]&&document[t.id].preserve&&document[t.id].q&&document[t.id].q[p])for(var f=0;f<document[t.id].q[p].length;f++){var h=document[t.id].q[p][f];try{for(var g=document.getElementById(h.id),m=g;!kInteractive.c.hasClass(m,"ques");)m=m.parentNode;m.getElementsByClassName("categoryContainer")[0].children[h.category].appendChild(g)}catch(e){}}}else 0<=u[c].getAttribute("id").indexOf("ki-sa-")?document[t.id]&&document[t.id].preserve&&document[t.id].q&&document[t.id].q[p]&&(u[c].removeAttribute("value"),document[t.id].q[p]&&u[c].setAttribute("value",document[t.id].q[p])):document[t.id]&&document[t.id].preserve&&document[t.id].q&&document[t.id].q[p]&&(document[t.id].q[p][c]?u[c].setAttribute("checked",!0):u[c].removeAttribute("checked"),o.options&&o.options.highlightCorrect&&o.q[p].c[c].a&&kInteractive.c.addClass(u[c].parentNode,"correct"));if(document[t.id]){var v=t.getElementsByClassName("questions-preserve");v.length&&(document[t.id].preserve?v[0].setAttribute("checked",!0):v[0].removeAttribute("checked"))}}if(!kInteractive.isEditorMode()&&!kInteractive.isPreview()){var b=t.querySelector("input.questions-preserve");if(b){var y="persist-"+kInteractive.getBookID()+"-"+t.id,k="true"==sessionStorage.getItem(y)||void 0!==b.dataset.auto&&"true"==b.dataset.auto;if(k?b.setAttribute("checked",!0):b.removeAttribute("checked"),kInteractive.helpers&&kInteractive.helpers.persister)if(kInteractive.helpers.persister.instances[t.id])kInteractive.helpers.persister.instances[t.id]instanceof kPersister&&kInteractive.helpers.persister.instances[t.id].restore();else{var w={storage:b.dataset.option,enabled:k,root:t,silentMode:void 0!==b.dataset.auto&&"true"==b.dataset.auto,delegateEvents:!1,messages:{save:i.save?i.save:"Save",unsaved:i.unsaved?i.unsaved:"You have unsaved changes",saving:i.saving?i.saving:"Saving ..",saved:i.saved?i.saved:"Changes has been saved!",dismiss:i.dismiss?i.dismiss:"Dismiss",lastSaved:i.lastSaved?i.lastSaved:"Last saved on",longDataError:i.longDataError?i.longDataError:"Some answers not saved (marked in red)"}};Object.keys(b.dataset).some(function(e){return-1!=e.indexOf("design")})&&(w.design=function(e){var t={};e.designPlacement&&(t.placement=e.designPlacement);(e.designUnsavedColor||e.designUnsavedBackground)&&(t.unsaved={});e.designUnsavedColor&&(t.unsaved.color=e.designUnsavedColor);e.designUnsavedBackground&&(t.unsaved.background=e.designUnsavedBackground);(e.designSuccessColor||e.designSuccessBackground)&&(t.success={});e.designSuccessColor&&(t.success.color=e.designSuccessColor);e.designSuccessBackground&&(t.success.background=e.designSuccessBackground);return t}(b.dataset)),kInteractive.helpers.persister.addInstance(t.id,w),kInteractive.helpers.persister.instances[t.id].on("persister.ready",function(e){e.target.enabled&&e.target.restore()}),kInteractive.helpers.persister.instances[t.id].on("persister.restored",function(e){}),kInteractive.helpers.persister.instances[t.id].on("persister.error",function(e){}),kInteractive.helpers.persister.instances[t.id].on("persister.saved",function(e){}),kInteractive.helpers.persister.instances[t.id].on("persister.unsaved",function(e){}),kInteractive.helpers.persister.instances[t.id].on("persister.pushed",function(e){}),kInteractive.helpers.persister.instances[t.id].init()}}}}},action:function(v,t){var n=kInteractive.readData(v);if(n){var o=n.dict,r=n.userDict;if(o=o||{},r=r||o,n.layout&&n.layout.popup&&!kInteractive.hasClass(v,"inpopup")&&"img"==t.nodeName.toLowerCase()){function i(e){for(var t=0;e=e.previousSibling;)"#text"!=e.nodeName&&8!=e.nodeType&&t++;return t}var e=document.getElementById("epubContent");e&&v.setAttribute("data-loc",function(e,t){for(var n="";e!=t;){n=i(e)+"."+n,e=e.parentNode}return""==n?"":n.substr(0,n.length-1)}(v,e));var b=document.createElement("iframe");b.setAttribute("nwdisable","true"),b.setAttribute("nwfaketop","true"),b.setAttribute("scrolling","yes");var y=document.createElement("div");return y.className="scroller",y.appendChild(b),n.cb=function(e){var t,n=document.createElement("head");if(void 0===isKotobee){for(var o=document.getElementsByTagName("link"),r=0;r<o.length;r++){var i=o[r];if(0<=i.getAttribute("href").indexOf("base.css")){var a=i.getAttribute("href").split("/");delete a[a.length-1],t=a.join("/");break}}if(!t)return}var s=void 0===isKotobee?kInteractive.c.removeHash(window.location.href):kInteractive.absoluteURL;s=kInteractive.cleanURL(kInteractive.c.removeFilename(s)+"/"),void 0!==isKotobee&&(kInteractive.isAbsolutePath(s)||(s=kInteractive.cleanURL(kInteractive.c.removeFilename(kInteractive.c.removeHash(window.location.href))+"/"+s)));for(var c=s.split("EPUB/xhtml"),l=c[c.length-1].split("/").length-1,d="",u=0;u<l;u++)d+="../";n="<head>";if(n+='<base href="'+s+'"/>',n+='<link rel="stylesheet" type="text/css" href="'+(d+"css/base.css")+'" />',n+='<link rel="stylesheet" type="text/css" href="'+(d+"css/global.css")+'" />',n+='<link rel="stylesheet" type="text/css" href="'+(d+"css/kotobeeInteractive.css")+'" />',n+='<script type="text/javascript" src="'+(d+"js/kotobeeInteractive.js")+'"><\/script>',n+='<script type="text/javascript" src="'+(d+"js/global.js")+'"><\/script>',void 0!==isKotobee){var p=clone(config);p.kotobee.email=angular.element(document.body).scope().data.user.email,n+='<script type="text/javascript">var config='+JSON.stringify(p)+";<\/script>"}n+='<meta name="viewport" content="viewport-fit=cover,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width">',n+='<meta charset="utf-8" />',n+="</head>";var f=v.outerHTML;f=(f=(f=(f=(f=(f=f.replace("<img",'<img style="display:none"')).replace(/([;\s]*?height:)(.*)?;/i,"$1auto")).replace(/([;\s]*?width:)(.*)?;/i,"$1auto")).replace(/([;\s]*?top:)(.*)?;/i,"$1auto")).replace(/([;\s]*?left:)(.*)?;/i,"$1auto")).replace('class="','class="inpopup ');var h="<html>"+n+"<body>"+(f+='<div class="vSpace20"></div>')+"</body></html>";b.setAttribute("srcdoc",h);var g="javascript: window.frameElement.getAttribute('srcdoc');";function m(){if(void 0!==isKotobee){var e={};e.root=b.contentDocument.documentElement.ownerDocument.body,e.rootIndex=v.getAttribute("data-loc"),angular.element(document.body).scope().getNotebookShortcut(e,function(){})}}b.setAttribute("src",g),b.contentWindow&&(b.contentWindow.location=g),e.appendChild(y),b.addEventListener?b.addEventListener("load",m,!0):b.attachEvent&&b.attachEvent("onload",m)},n.closed=function(){},n.pos=n.layout.pos,kInteractive.openFrame(n),kInteractive.tinCan({verb:"opened",activity:"Questions: "+n.title}),void setTimeout(function(){if(kInteractive.scorm){var e={};e.id=kInteractive.getScormId("question",n.title),e.description="Opened question popup: "+n.title,e.learnerResponses="Opened",e.type="other",e.timestamp=new Date,kInteractive.scorm.setInteractions([e])}kInteractive.events&&kInteractive.events.add({action:"questionPopup",param:n.title,elem:v,data:n})},800)}if(kInteractive.hasClass(t,"ki-inputbox"))kInteractive.helpers.persister.instances[v.id]&&kInteractive.helpers.persister.instances[v.id].handleChange();else if(kInteractive.hasClass(t,"ki-textfield"))kInteractive.helpers.persister.instances[v.id]&&kInteractive.helpers.persister.instances[v.id].handleChange();else if(kInteractive.hasClass(t,"ki-draggable"))kInteractive.helpers.persister.instances[v.id]&&kInteractive.helpers.persister.instances[v.id].handleChange();else if(!kInteractive.hasClass(t,"kInteractive")){if(kInteractive.hasClass(t,"questions-next")){var a=v.qIndex?v.qIndex:0;if(++a<0)return;if(a>=n.q.length)return;var s=(O=v.getElementsByClassName("qContainer")[0]).children[0];if(n.options.strictNav)if(!(R=kInteractive.questions.f.assess(s,n.q[a-1],n)).correct)return void kInteractive.questions.f.showExp(n.userDict,s,n.q[a-1]);v.getElementsByClassName("btnContainer")[0];return O.innerHTML="",O.appendChild(kInteractive.questions.f.createQElem(n,{questionNo:a,index:a,elem:v,rendered:!0})),s&&(v.questions||(v.questions=[]),v.questions.push(s)),kInteractive.questions.f.showNavBtns(a,v,{userDict:r,qsData:n}),void(v.qIndex=a)}if(kInteractive.hasClass(t,"questions-prev")){if(!v.questions)return;if(!v.questions.length)return;a=v.qIndex?v.qIndex:0;return a--,(O=v.getElementsByClassName("qContainer")[0]).innerHTML="",O.appendChild(v.questions.pop()),kInteractive.questions.f.showNavBtns(a,v,{userDict:r,qsData:n}),void(v.qIndex=a)}if(kInteractive.hasClass(t,"questions-clear")){for(var c=v.getElementsByClassName("ans"),l=[],d=0;d<c.length;d++)c[d].checked=!1,c[d].value=null,kInteractive.c.removeClass(c[d].parentNode,"correct"),kInteractive.c.removeClass(c[d],"incorrect"),kInteractive.c.hasClass(c[d].parentNode,"dCategory")&&l.push(c[d]);for(d=0;d<l.length;d++)l[d].parentNode.parentNode.parentNode.getElementsByClassName("ki-dd-answers")[0].appendChild(l[d]);var u=v.getElementsByClassName("explanation");for(d=u.length;d--;)u[d].parentNode.removeChild(u[d]);var p=v.getElementsByClassName("reference");for(d=p.length;d--;)p[d].parentNode.removeChild(p[d]);return document[v.id]=null,void(kInteractive.helpers.persister.instances&&kInteractive.helpers.persister.instances[v.id].clear())}if(kInteractive.hasClass(t,"questions-notebook")){var f,h=n.layout&&n.layout.popup&&kInteractive.hasClass(v,"inpopup");if(void 0===isKotobee&&!h)return void kInteractive.alert({content:o.kotobeeOnly,title:r.sorry?r.sorry:"Sorry"});var g={elem:v};if(void 0!==isKotobee)f=angular.element(document.body).scope();else{try{f=window.parent.getGlobal()}catch(e){return void kInteractive.alert({content:o.kotobeeOnly,title:r.sorry?r.sorry:"Sorry"})}g.rootIndex=v.getAttribute("data-loc"),g.root=v}return kInteractive.c.addClass(t,"busy"),void f.questionsAddToNotebookShortcut(g,function(){kInteractive.c.removeClass(t,"busy"),kInteractive.alert({content:r.savedToNotebook?r.savedToNotebook:"Saved to notebook!"})})}if(kInteractive.hasClass(t,"questions-preserve")){if(document[v.id]||(document[v.id]={}),document[v.id].preserve=t.checked,kInteractive.helpers.persister.instances){var m="persist-"+kInteractive.getBookID()+"-"+v.id;t.checked?(sessionStorage.setItem(m,"true"),kInteractive.helpers.persister.instances[v.id].enable(void 0!==t.dataset.auto&&"true"==t.dataset.auto)):(sessionStorage.setItem(m,"false"),kInteractive.helpers.persister.instances[v.id].disable())}}else if(kInteractive.hasClass(t,"questions-submit")){var k="Untitled questions",w=v.getElementsByTagName("h4");w.length&&(k=w[0].textContent||w[0].data);var x,C=0,I="",E=0,S=0,T=[];if("slides"==n.options.displayMode){x=v.questions.slice(0);var O=v.getElementsByClassName("qContainer")[0];x.push(O.children[0])}else x=v.getElementsByClassName("ques");var A=0;for(d=0;d<x.length;d++)if(!kInteractive.hasClass(x[d],"sp")){A++;var N=(c=x[d].getElementsByClassName("ans")).length,L=n.q[d],B=kInteractive.questions.f.getItemOrder(v);if(n.options.randomize&&(L="slides"==n.options.displayMode&&B?n.q[Number(B[d])]:n.q[Number(x[d].getAttribute("data-o"))]),L.q||(L.q=""),L.q=L.q.replace(/<html.*<body>(.*?)<\/body><\/html>/g,"$1"),kInteractive.scorm&&n.options&&n.options.answerOnce&&kInteractive.scorm.interactionExists(kInteractive.getScormId(v.id+"-"+A,L.q))){var M="<p style='text-align:center'>"+(r.alreadySubmitted?r.alreadySubmitted:"This test has already been submitted!")+"</p>";return void kInteractive.alert({content:M})}var R,P={},D=c[0].getAttribute("id");T.push(P),P.id=kInteractive.getScormId(v.id+"-"+A,L.q),P.qid=v.id,0<=D.indexOf("ki-tf-")?P.type="true-false":0<=D.indexOf("ki-mcq-")||D.indexOf("ki-mmcq-")?P.type="choice":0<=D.indexOf("ki-dd-")?P.type="drag-drop":0<=D.indexOf("ki-sa-")&&(P.type="short-answer"),P.objective=n.options?n.options.objective:null,P.timestamp=kInteractive.timestamp,P.latency=Math.round(((new Date).getTime()-kInteractive.timestamp.getTime())/1e3),P.description=L.q,(R=kInteractive.questions.f.assess(x[d],L,n)).correctResponses&&(P.correctResponses=R.correctResponses),R.learnerResponses&&(P.learnerResponses=R.learnerResponses);var F=R.ddInteractionOb;F=F||[];N=R.correct;if(F.length)for(var H=0;H<F.length;H++)P.correctResponses&&(P.correctResponses+="; "),P.learnerResponses&&(P.learnerResponses+="; "),P.correctResponses+=F[H].correct,P.learnerResponses+=F[H].learner;P.result=0,null!=L.weight&&(E+=+L.weight,N&&(S+=+L.weight,P.result=+L.weight)),P.scoreMax=n.options?Number(n.options.totalScore):null,kInteractive.questions.f.showExp(n.userDict,x[d],L);var $=document.createElement("div");$.innerHTML=L.q.replace(/'/g,"&#39;");var U=$.textContent,_=r.question?r.question.replace("[no]",A):"Question "+A;N?(I+="<span style='border-bottom: dotted 1px #aaa;' title='"+U+"'>"+_+".</span>  <span style='color:#366c20'>"+r.correct+"</span><br/>",C++):I+="<span style='border-bottom: dotted 1px #aaa;' title='"+U+"'>"+_+".</span>  <span style='color:#7a1818'>"+r.incorrect+"</span><br/>"}for(d=0;d<T.length;d++)T[d].weighting=Math.round(1e3*n.options.totalScore/E)/1e3;function j(){var e="Questions: "+k+". Score: "+C+" questions out of "+A;e+=". Action: "+V,"selfAnswerReport"==V&&(e+=". Details: "+I),kInteractive.tinCan({verb:"solved",activity:e})}var z,V=n.action;if(n.options.totalScore&&E&&(z=Math.round(10*n.options.totalScore*S/E)/10),"selfAnswer"==V||"selfAnswerReport"==V){var q="";"ar"==n.options.language&&(q=' direction="rtl"');M="";if(r.scoreWeight){if(null!=z){var W="";n.options.passScore&&(z>=n.options.passScore||z==n.options.totalScore?W+=r.pass:W+=r.fail),W&&(W+=". "),M+="<h3"+q+">"+(W||"")+r.scoreWeight.replace("[score]",z).replace("[total]",n.options.totalScore)+"</h3>"}M+="<p"+q+">"+r.score.replace("[correct]",C).replace("[total]",A)+"</p>"}else M="You scored "+C+" question(s) out of "+A;"selfAnswerReport"==V&&(M="<p"+q+"><strong>"+M+"</strong></p><p><strong>"+(r.details?r.details:"Details")+"</strong></p><p class='kbAlertScroll'>"+I+"</p>"),kInteractive.alert({content:M}),j()}if("email"==V||n.options.reportEmail||n.options.emailForm||n.options.serverReports){var K="email"==V||n.options.reportEmail||n.options.emailForm,G="selfAnswer"!=V&&"selfAnswerReport"!=V&&"email"!=V;try{if(!config.kotobee.cloudid)return void(G&&kInteractive.alert({content:o.cloudOnly,title:r.sorry?r.sorry:"Sorry"}))}catch(e){return void(G&&kInteractive.alert({content:o.cloudOnly,title:r.sorry?r.sorry:"Sorry"}))}var J={};J.ans=new Array;for(var X=0,Y=0;Y<x.length;Y++){c=x[Y].getElementsByClassName("ans");var Z=kInteractive.questions.f.getQClass(x[Y]),Q=x[Y].getElementsByClassName("questionTxt"),ee=Q.length?Q[0].textContent:"",te=x[Y].id;if("tf"==Z||"mcq"==Z||"mmcq"==Z)for(d=0;d<c.length;d++)c[d].checked&&J.ans.push({q:X,id:te,title:ee,type:Z,index:d,label:c[d].nextSibling.textContent||c[d].nextSibling.data});else if("sa"==Z)J.ans.push({q:X,id:te,title:ee,type:Z,label:c[0].value});else if("dd"==Z)for(d=0;d<c.length;d++)J.ans.push({q:X,id:te,title:ee,type:Z,index:d,label:c[d].textContent,category:kInteractive.hasClass(c[d].parentNode,"dCategory")?c[d].parentNode.children[0].textContent:""});"sp"!=Z&&X++}J.id=v.id,J.title=k,J.score=C,J.total=A;var ne={};if(ne.recipient=n.address,n.options.reportEmail&&(ne.recipient=n.options.reportEmail),n.options.emailForm){var oe=v.getElementsByClassName("emailForm");if(oe.length){var re=oe[0].getElementsByClassName("txtfield");re.length&&(ne.recipient=ne.recipient?ne.recipient+","+re[0].value:re[0].value)}}ne.content=JSON.stringify(J),ne.mode=config.kotobee.mode,ne.cloudid=config.kotobee.cloudid;try{var ie=angular.element(document.body).scope();void 0!==kotobee&&(ne.env=config.kotobee.mode,"library"==config.kotobee.mode&&ie.data.book&&(ne.bid=ie.data.book.id)),ne.email=ie.data.user.email,ne.code=ie.data.user.code,ne.pwd=ie.data.user.pwd}catch(e){}if(K){var ae=t.value;t.value=r.submitting?r.submitting:"Submitting ..",t.setAttribute("disabled","true");var se=(config.kotobee.liburl?config.kotobee.liburl:"http://www.kotobee.com/")+"library/report/questions";kInteractive.questions.f.sendPost(se,ne,function(e){try{if(t.value=ae,t.removeAttribute("disabled"),4===e.readyState&&200===e.status){if(!G)return;JSON.parse(e.responseText).success?kInteractive.alert({content:r.submitted?r.submitted:"Answers submitted!"}):kInteractive.alert({content:r.errorSubmitting?r.errorSubmitting:"An error has occurred while sending answers to the server"})}}catch(e){if(t.value=ae,t.setAttribute("value",t.value),t.removeAttribute("disabled"),!G)return;kInteractive.alert({content:r.errorSubmitting?r.errorSubmitting:"An error has occurred while sending answers to the server"})}})}if(n.options.serverReports){se=(config.kotobee.liburl?config.kotobee.liburl:"http://www.kotobee.com/")+"library/questions/add";kInteractive.questions.f.sendPost(se,ne)}j()}document[v.id]||(document[v.id]={}),document[v.id].q=[];var ce=v.getElementsByClassName("ques");for(Y=0;Y<ce.length;Y++){X=Y,B=kInteractive.questions.f.getItemOrder(v);n.options.randomize&&(X="slides"==n.options.displayMode&&B?Number(B[Y]):Number(ce[Y].getAttribute("data-o"))),document[v.id].q[X]=[];var le=ce[Y].getElementsByClassName("ans");for(d=0;d<le.length;d++)kInteractive.hasClass(le[d],"txtfield")?document[v.id].q[X][d]=le[d].value:le[d].type&&"checkbox"==le[d].type.toLowerCase()?document[v.id].q[X][d]=le[d].checked:le[d].type&&"radio"==le[d].type.toLowerCase()?document[v.id].q[X][d]=le[d].checked:kInteractive.c.hasClass(le[d].parentNode,"dCategory")&&(document[v.id].q[X][d]={id:le[d].id,category:kInteractive.getChildIndex(le[d].parentNode)})}setTimeout(function(){kInteractive.scorm&&kInteractive.scorm.setInteractions(T),kInteractive.events&&kInteractive.events.add({action:"questionsSubmitted",param:k,elem:v,data:n})},500)}}}},f:{showExp:function(e,t,n){if(n.exp&&!t.getElementsByClassName("explanation").length){var o=document.createElement("p");o.className="explanation",o.innerHTML=n.exp,kInteractive.appendAfterDelay(t,o)}if(n.ref&&!t.getElementsByClassName("reference").length){var r=document.createElement("a");r.className="reference",r.innerHTML=e.learnMode?e.learnMode:"Learn more",r.setAttribute("href",kInteractive.escapeHtml(n.ref)),r.setAttribute("target","_blank"),kInteractive.appendAfterDelay(t,r)}},getQClass:function(e){var t=e.className;return-1!=t.indexOf("mmcq")?"mmcq":-1!=t.indexOf("mcq")?"mcq":-1!=t.indexOf("tf")?"tf":-1!=t.indexOf("sa")?"sa":-1!=t.indexOf("dd")?"dd":void 0},getItemOrder:function(e){var t=e.getAttribute("data-o");return t&&(e.originArray=t.split(",")),e.originArray},createQElem:function(e,t){var n=(t=t||{}).index,o=t.elem,r=t.rendered,i=this.getQId(o),a=kInteractive.questions.f.getItemOrder(o),s=e.q[n];e.options.randomize&&a&&"slides"==e.options.displayMode&&(s=e.q[o.originArray[n]]);var c=document.createElement("div");c.className="ques",s.id&&(c.id=s.id),null!=s.origin&&c.setAttribute("data-o",s.origin),s.q||(s.q="");"undefined"!=typeof config&&config.v;var l=e.options.numbering;"sp"==s.type&&(l=!1);var d="";l&&(d="<span class='no'>"+(t.questionNo?t.questionNo:n)+"</span>"),s.q=s.q.replace(/<html.*<body>(.*?)<\/body><\/html>/g,"$1");try{c.innerHTML="<div class='questionTxt'><strong>"+d+"</strong> "+s.q+"</div>"}catch(e){c.innerHTML="<div class='questionTxt'><strong>"+d+kInteractive.escapeHtml(" "+s.q)+"</strong></div>"}if(s.path){var u,p=document.createElement("img");u=r?void 0===isKotobee?s.path:ph.join(kInteractive.absoluteURL,s.path):s.path,p.src=kInteractive.cleanURL(u),p.className=typeof isKotobee,c.appendChild(p)}if(c.classList.add(s.type),"sp"==s.type&&(s.topBorder&&kInteractive.c.addClass(c,"topBorder"),s.bottomBorder&&kInteractive.c.addClass(c,"bottomBorder"),kInteractive.c.addClass(c,"separator")),"sa"==s.type){var f=s.lines?s.lines:1,h=document.createElement(1<f?"textarea":"input"),g="ki-sa-"+i+"-"+n;h.id=g,h.name="sa-"+i+"-"+n,1==f?h.type="text":h.rows=s.lines?s.lines:1,h.className="ki-textfield ans txtfield",void 0===isKotobee&&(h.addEventListener("keyup",kInteractive.actionEvent),h.addEventListener("change",kInteractive.actionEvent)),document[item.id]&&document[item.id].preserve&&document[item.id].q&&document[item.id].q[n]&&(h.value=document[item.id].q[n]),c.appendChild(h)}else if("mcq"==s.type||"mmcq"==s.type)for(var m=s.c,v=0;v<m.length;v++){g="ki-mcq-"+i+"-"+n+"-"+v;var b=document.createElement("input");b.id=g,"mmcq"==s.type?(b.name="name",b.type="checkbox"):(b.name="mcq-"+i+"-"+n,b.type="radio"),b.className="ki-inputbox ans",void 0===isKotobee&&b.addEventListener("click",kInteractive.actionEvent),(y=document.createElement("label")).htmlFor=g,y.innerHTML=" "+kInteractive.escapeHtml(m[v].t),y.className="ki-noHighlight",(w=document.createElement("div")).className="answer",document[item.id]&&document[item.id].preserve&&document[item.id].q&&document[item.id].q[n]&&(b.checked=document[item.id].q[n][v],e.options&&e.options.highlightCorrect&&s.c[v].a&&kInteractive.c.addClass(w,"correct")),w.appendChild(b),w.appendChild(y),c.appendChild(w)}else if("tf"==s.type)for(v=0;v<2;v++){g="ki-tf-"+i+"-"+n+"-"+v;var y,k=document.createElement("input");k.type="radio",k.className="ki-inputbox ans",k.id=g,k.name="tf-"+i+"-"+n,void 0===isKotobee&&k.addEventListener("click",kInteractive.actionEvent),(y=document.createElement("label")).htmlFor=g,s.choice1&&s.choice2?y.innerHTML=kInteractive.escapeHtml(" "+(0==v?s.choice1:s.choice2)):y.innerHTML=" "+(0==v?"True":"False"),y.className="ki-noHighlight";var w=document.createElement("div");document[item.id]&&document[item.id].preserve&&document[item.id].q&&document[item.id].q[n]&&(k.checked=document[item.id].q[n][v],e.options&&e.options.highlightCorrect&&(0==v&&s.a||1==v&&!s.a)&&kInteractive.c.addClass(w,"correct")),w.appendChild(k),w.appendChild(y),c.appendChild(w)}else if("dd"==s.type){var x=document.createElement("div");x.className="categoryContainer";var C=[];for(v=0;v<s.k.length;v++){var I=s.k[v],E=v,S=document.createElement("div");S.className="dCategory ki-noHighlight ki-dd-category-"+E,S.setAttribute("ondragover","kInteractive.allowDrop(event)"),S.setAttribute("ondrop","kInteractive.drop(event)");var T=document.createElement("div");T.innerHTML=I.category.name,T.className="qTitle",S.appendChild(T);for(var O=0;O<I.category.answers.length;O++)C.push(I.category.answers[O].t);x.appendChild(S)}c.appendChild(x);var A=document.createElement("div");A.className="ki-dd-clearfix",c.appendChild(A);var N=document.createElement("div");N.setAttribute("ondragover","kInteractive.allowDrop(event)"),N.setAttribute("ondrop","kInteractive.drop(event)"),N.className="ki-dd-answers ki-noHighlight";var L=[];for(v=0;v<C.length;v++){E=v,w=C[v];var B=document.createElement("div");g="ki-dd-"+i+"-"+n+"-"+E;B.id=g,B.innerHTML="<span></span>",B.children[0].innerText=w,B.className="ki-draggable ans ki-noHighlight",B.draggable=!0,B.setAttribute("ondragstart","kInteractive.drag(event);"),B.setAttribute("onmousedown","event.stopPropagation();"),B.setAttribute("ontouchstart","event.stopPropagation();"),kInteractive.questions.manualDrag.isIOS()&&(B.setAttribute("ontouchstart","kInteractive.questions.manualDrag.dragStart(event);"),B.setAttribute("ontouchmove","kInteractive.questions.manualDrag.dragMove(event);"),document.addEventListener("touchend",function(){kInteractive.questions.manualDrag.isDown=!1})),void 0===isKotobee&&B.addEventListener("dragend",kInteractive.actionEvent),L.push(B)}kInteractive.shuffleArray(L);for(v=0;v<L.length;v++)N.appendChild(L[v]);c.appendChild(N)}var M=document.createElement("p");return M.className="separator",c.appendChild(M),document[item.id]&&document[item.id].preserve&&document[item.id].q&&document[item.id].q[n]&&kInteractive.questions.f.showExp(e.userDict,c,s),c},getQId:function(e){return Number(e.id.replace("ki-qs-",""))},createSubmitBtn:function(e,t){var n=this.getQId(t),o=document.createElement("input"),r="ki-"+n+"-btn";return o.type="submit",o.value=e.submit?e.submit:"Submit Answers",o.id=r,o.className="btn ki-btn questions-submit",void 0===isKotobee&&o.addEventListener("click",kInteractive.actionEvent),o},createClearBtn:function(e){var t=document.createElement("input");return t.type="submit",t.value=e.clear?e.clear:"Clear Answers",t.className="btn ki-btn ki-questions questions-clear",void 0===isKotobee&&t.addEventListener("click",kInteractive.actionEvent),t},createAddToNotebookBtn:function(e){var t=document.createElement("input");return t.type="submit",t.value=e.notebook?e.notebook:"Save to Notebook",t.className="btn ki-btn ki-questions questions-notebook",void 0===isKotobee&&t.addEventListener("click",kInteractive.actionEvent),t},createPreserveBtn:function(e,t,n,o){var r=this.getQId(t),i=document.createElement("div");i.style.marginTop="5px";var a=document.createElement("input");function s(e){return e.slice(0,1).toUpperCase()+e.slice(1)}a.type="checkbox",a.name="preserveAnswers",a.className="ki-btn ki-questions questions-preserve",a.id="ki-"+r+"-preserveAnswersBtn",n&&o&&(a.dataset.option=n.option,0<Object.keys(o).length&&Object.keys(o).forEach(function(t){"placement"==t?a.dataset["design"+s(t)]=o[t]:Object.entries(o[t]).forEach(function(e){a.dataset["design"+s(t)+s(e[0])]=e[1]})}),n.auto?(a.dataset.auto=n.auto,i.style.display="none"):void 0!==isKotobee&&document.body.addEventListener("change",function(e){e.target.matches("input.questions-preserve")&&kInteractive.actionEvent(e)})),document[item.id]&&(a.checked=document[item.id].preserve),i.appendChild(a);var c=document.createElement("label");return c.htmlFor=a.id,c.innerHTML=" "+(e.preserve?e.preserve:"Preserve submitted answers"),c.className="ki-noHighlight",i.appendChild(c),void 0===isKotobee&&a.addEventListener("change",kInteractive.actionEvent),i},createNextBtn:function(e){var t=document.createElement("input");return t.type="submit",t.value=e.next?e.next:"Next",t.className="btn ki-btn ki-questions questions-next",void 0===isKotobee&&t.addEventListener("click",kInteractive.actionEvent),t},createPrevBtn:function(e){var t=document.createElement("input");return t.type="submit",t.value=e.prev?e.prev:"Previous",t.className="btn ki-btn ki-questions questions-prev",void 0===isKotobee&&t.addEventListener("click",kInteractive.actionEvent),t},createSeparator:function(){document.createElement("p").className="separator"},createEmailForm:function(e){var a=document.createElement("div");return a.setAttribute("class","emailForm"),function(e,t,n){var o=document.createElement("div");o.className="address",o.innerHTML="<p><strong>"+e+"</strong><em>"+t+"</em></p>";var r=document.createElement("input");r.name=n,r.type="text",r.className="txtfield",o.appendChild(r);var i=document.createElement("p");i.className="separator",o.appendChild(i),a.appendChild(o)}(e.recipientEmail?e.recipientEmail:"Recipient email",e.separateEmails?e.separateEmails:"Separate multiple emails with commas","recipientEmail"),a},showNavBtns:function(e,t,n){var o;(o=(n=n||{}).isFrag?t.lastElementChild:t.getElementsByClassName("btnContainer")[0]).innerHTML="";var r=kInteractive.questions.f.createPrevBtn(n.userDict);o.appendChild(r),e<=0&&r.classList.add("disabled");var i=kInteractive.questions.f.createNextBtn(n.userDict);if(o.appendChild(i),e>=n.qsData.q.length-1&&i.classList.add("disabled"),e==n.qsData.q.length-1){var a=kInteractive.questions.f.createSubmitBtn(n.userDict,t);a.classList.add("shift"),o.appendChild(a)}},assess:function(e,t,n){for(var o={ddInteractionOb:[]},r=e.getElementsByClassName("ans"),i=0<r.length,a=0;a<r.length;a++)if(0<=r[a].getAttribute("id").indexOf("ki-tf-"))0==a&&t.a?o.correctResponses=t.choice1:1!=a||t.a||(o.correctResponses=t.choice2),r[a].checked?(o.learnerResponses=a?t.choice2:t.choice1,0!=a||t.a?1==a&&t.a&&(i=!1):i=!1):0==a&&t.a?i=!1:1!=a||t.a||(i=!1),n.options&&n.options.highlightCorrect&&(0==a&&t.a||1==a&&!t.a)&&kInteractive.c.addClass(r[a].parentNode,"correct");else if(0<=r[a].getAttribute("id").indexOf("ki-sa-")){var s=r[a].value.toLowerCase();s=s&&s.trim(),i=!0;for(var c="",l=0;l<t.k.length;l++){var d=t.k[l].t;if(!d){i=!1;break}c&&(c+="+"),c+=d=d.toLowerCase();for(var u=d.split(","),p=!1,f=0;f<u.length;f++)if(0<=s.indexOf(u[f].trim())){p=!0;break}if(!p){i=!1;break}}o.correctResponses=c,o.learnerResponses=s}else if(0<=r[a].getAttribute("id").indexOf("ki-dd-")){kInteractive.c.removeClass(r[a],"incorrect");for(var h,g=r[a].id.split("-")[4],m=0,v=0;v<t.k.length;v++){if(g<(m+=t.k[v].category.answers.length)){h=v;break}}var b=e.getElementsByClassName("dCategory")[h],y={};if(y.correct=r[a].innerText+" -> "+b.children[0].innerText,kInteractive.c.hasClass(r[a].parentNode,"ki-dd-answers"))kInteractive.c.addClass(r[a],"incorrect"),i=!1,y.learner=r[a].innerText+" unassigned";else{var k=r[a].parentNode,w=k.children[0].innerText,x=kInteractive.getChildIndex(k);y.learner=r[a].innerText+" -> "+w,x!=h&&n.options&&n.options.highlightCorrect&&(i=!1,kInteractive.c.addClass(r[a],"incorrect"))}o.ddInteractionOb.push(y)}else t.c[a].a&&(o.correctResponses=t.c[a].t),r[a].checked&&(o.learnerResponses=t.c[a].t),r[a].checked&&!t.c[a].a?i=!1:!r[a].checked&&t.c[a].a&&(i=!1),n.options&&n.options.highlightCorrect&&t.c[a].a&&kInteractive.c.addClass(r[a].parentNode,"correct");return o.correct=i,o},sendPost:function(e,t,n){var o=new XMLHttpRequest;n&&(o.onreadystatechange=n),o.open("POST",e),o.setRequestHeader("Content-type","application/x-www-form-urlencoded");var r="a=a";for(var i in t){var a=t[i];null!=a&&"object"!=typeof a&&("string"==typeof a&&(a=encodeURIComponent(a)),"boolean"==typeof a&&(a=a?1:0),r+="&"+i+"="+a)}o.send(r)}},manualDrag:{isDown:null,startX:null,startY:null,currentX:null,currentY:null,walkX:null,walkY:null,margin:0,currentAnswerObj:{},answersContainers:[],store:null,dragStart:function(e){e.stopPropagation(),this.isDown=!0;var t=(e=e||window.event).target;this.getContainers(t);var n=t.getElementsByTagName("span")[0];n&&(n.style.pointerEvents="none"),t.style.zIndex="999",this.startX=Math.round(e.touches[0].clientX)-this.margin,this.startY=Math.round(e.touches[0].clientY)-this.margin,this.dragEnd(t)},dragEnd:function(t){t.addEventListener("touchend",function(){function e(){return kInteractive.questions.manualDrag}e().isDown=!1,t.style.left="initial",t.style.top="initial",t.style.zIndex="initial",null!==e().store&&e().store.container.append(e().store.answer)})},dragMove:function(e){var t=(e=e||window.event).target;this.currentAnswerObj=t.getBoundingClientRect(),this.isDown&&(this.currentX=Math.round(e.touches[0].clientX)-this.margin,this.currentY=Math.round(e.touches[0].clientY)-this.margin,this.walkX=this.currentX-this.startX,this.walkY=this.currentY-this.startY,t.style.left=this.walkX+"px",t.style.top=this.walkY+"px",this.detectBoundaries(t))},detectBoundaries:function(r){function i(){return kInteractive.questions.manualDrag}this.answersContainers.forEach(function(e){if(e){var t=e.getBoundingClientRect(),n={w:t.width,h:t.height,x:t.x,y:t.y},o={w:i().currentAnswerObj.width,h:i().currentAnswerObj.height,x:i().currentAnswerObj.x,y:i().currentAnswerObj.y};kInteractive.questions.manualDrag.hasIntersection(o,n)&&(i().store={container:e,answer:r})}})},hasIntersection:function(e,t){return!(e.y+0>t.y+t.h)&&(!(e.x+e.w+0<t.x)&&(!(e.y+e.h+0<t.y)&&!(e.x+0>t.x+t.w)))},getContainers:function(e){function n(){return kInteractive.questions.manualDrag}var o=e.parentElement,t=o?o.className:"";if(t.includes("ki-dd-answers"))r(o.parentElement.getElementsByClassName("categoryContainer")[0]);else if(t.includes("dCategory")){r(o.parentElement)}function r(e){if(o&&e){var t=e.getElementsByClassName("dCategory");t.length&&(n().answersContainers=Array.from(t))}else n().answersContainers=[]}},isIOS:function(){return void 0!==isKotobee&&void 0!==ios&&ios}}},kInteractive.threed={preRender:function(e,t){},postRender:function(e,t,n,o){var r=e.createDocumentFragment(),i=kInteractive.readData(t);if(i){t.innerHTML="";var a=t.getAttribute("style");if(i.inter.placeholderPath){var s=void 0===isKotobee?i.inter.placeholderPath:ph.join(kInteractive.absoluteURL,i.inter.placeholderPath);a+="background-image:url('"+(s=kInteractive.cleanURL(s))+"');"}t.setAttribute("style",a);var c=document.createElement("a");i.inter.includeMsg?(c.innerHTML=kInteractive.escapeHtml(i.inter.msg),c.className="msgBtn ki-btn"):c.className="invisibleBtn ki-btn",r.appendChild(c),void 0===isKotobee&&c&&c.addEventListener("click",kInteractive.actionEvent),t.appendChild(r)}},action:function(m,e,t){var v=kInteractive.readData(m);if(v){"inPanel"==v.inter.target?kInteractive.c.addClass(m,"running"):m.innerHTML="";var b=document.createElement("div");if(b.className="loading",m.appendChild(b),"undefined"==typeof THREE){var n,o=document.getElementsByTagName("head")[0],r=o.getElementsByTagName("script");if(void 0!==isKotobee)n=bookPath+"EPUB/js/kotobeeInteractive3D.js";else for(var i=0;i<r.length;i++)if(0<=r[i].src.indexOf("kotobeeinteractive.js")){n=r[i].src.replace("kotobeeinteractive.js","kotobeeinteractive3D.js");break}if(!n)return;var a=document.createElement("script");a.type="text/javascript",a.src=n,a.onload=s,a.onreadystatechange=function(){"complete"==this.readyState&&s()},o.appendChild(a)}else s()}function s(){var g,e=m;if("inPanel"==v.inter.target){var t={class:"threed",cb:function(e){var t=document.createElement("div");t.className="container",e.appendChild(t),n(t)},closed:function(){kInteractive.c.removeClass(m,"running")}};kInteractive.openFrame(t)}else n(e);function n(t){var n;setTimeout(function(){if(kInteractive.scorm){var e={};e.id=kInteractive.getScormId("_3D",v.name?v.name:"Model"),e.description="Opened 3D model: "+(v.name?v.name:"No name"),e.learnerResponses="Viewed",e.type="other",e.timestamp=new Date,kInteractive.scorm.setInteractions([e])}kInteractive.events&&kInteractive.events.add({action:"3dModelViewed",param:v.name?v.name:"No name",elem:m,data:v})},800),g&&cancelAnimationFrame(g),n=function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}}()?new THREE.WebGLRenderer({precision:"highp"}):new THREE.CanvasRenderer;var e=t.offsetWidth,o=t.offsetHeight,r=new THREE.PerspectiveCamera(v.camera.viewAngle,e/o,v.camera.near,v.camera.far),c=new THREE.Scene;null!=v.scene.bgColor&&n.setClearColor(v.scene.bgColor,1),c.add(r),r.position.x=v.camera.x,r.position.y=v.camera.y,r.position.z=v.camera.z,n.setSize(e,o),v.scene.floor&&(floor=new THREE.Mesh(new THREE.PlaneGeometry(500,500,1,1),new THREE.MeshPhongMaterial({color:v.scene.floorColor?v.scene.floorColor:10066329})),floor.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2)),floor.position.y=-80,floor.receiveShadow=!0,c.add(floor));var l=new THREE.LoadingManager;l.onProgress=function(e,t,n){},function i(a){if(!(a>=v.objects.length)){var s=v.objects[a],e=void 0===isKotobee?s.path:ph.join(kInteractive.absoluteURL,s.path);e=kInteractive.cleanURL(e),new THREE.OBJLoader(l).load(e,function(r){b&&b.parentNode&&b.parentNode.removeChild(b),n.domElement.parentNode||t.appendChild(n.domElement),r.position.set(s.x,s.y,s.z),r.traverse(function(n){if(n instanceof THREE.Mesh){var o=n==r.children[r.children.length-1];if(s.textPath){var e=new THREE.ImageLoader(l),t=void 0===isKotobee?s.textPath:ph.join(kInteractive.absoluteURL,s.textPath);e.load(t,function(e){var t=new THREE.Texture;t.image=e,t.needsUpdate=!0,n.material.map=t,o&&c.add(r),i(++a)},function(){},function(e){})}else o&&c.add(r),i(++a)}})},function(e){e.lengthComputable&&(e.loaded,e.total)},function(e){})}}(0),new THREE.OrbitControls(r,n.domElement).target=new THREE.Vector3(0,0,0);for(var i=0;i<v.lights.length;i++)if("pointLight"==v.lights[i].type){var a=new THREE.PointLight(v.lights[i].color);a.position.set(v.lights[i].x,v.lights[i].y,v.lights[i].z),c.add(a)}else if("directionalLight"==v.lights[i].type){var s=new THREE.DirectionalLight(v.lights[i].color,v.lights[i].intensity);s.position.set(v.lights[i].x,v.lights[i].y,v.lights[i].z),c.add(s)}else if("hemisphereLight"==v.lights[i].type){var d=new THREE.HemisphereLight(v.lights[i].sky,v.lights[i].ground,v.lights[i].intensity);d.position.set(v.lights[i].x,v.lights[i].y,v.lights[i].z),c.add(d)}else if("spotLight"==v.lights[i].type){var u=new THREE.SpotLight(v.lights[i].color,v.lights[i].intensity,v.lights[i].distance,v.lights[i].angle,v.lights[i].exponent,v.lights[i].decay);u.position.set(v.lights[i].x,v.lights[i].y,v.lights[i].z),c.add(u)}else if("ambientLight"==v.lights[i].type){var p=new THREE.AmbientLight(v.lights[i].color);c.add(p)}else if("areaLight"==v.lights[i].type){var f=new THREE.AreaLight(v.lights[i].color,v.lights[i].intensity);c.add(f)}var h=new THREE.Clock;!function e(){try{n.render(c,r)}catch(e){return}h.getDelta();g=requestAnimFrame(e)}()}}}},kInteractive.video={preRender:function(e,t){},postRender:function(e,t,n){var o=e.createDocumentFragment(),r=kInteractive.readData(t);if(r){var i="";if(r.splash&&(i=void 0===isKotobee?r.splash:ph.join(kInteractive.absoluteURL,r.splash)),i){t.style.backgroundImage=null;var a=t.style.cssText;i=kInteractive.cleanURL(i),t.setAttribute("style","background-image:url('"+i+"');"+a)}t.setAttribute("id","ki-video-"+n),t.innerHTML="";var s=document.createElement("div");s.setAttribute("id","ki-video-"+n+"-container"),s.className="container";var c=document.createElement("div");r.style&&kInteractive.c.addClass(c,r.style);var l=document.createElement("a");l.className="playBtn ki-btn",l.appendChild(document.createElement("span")),void 0===isKotobee&&l.addEventListener("click",kInteractive.actionEvent),o.appendChild(l),o.appendChild(s),c.appendChild(o),t.appendChild(c),r.autoplay&&kInteractive.action(t)}},action:function(a){var s=kInteractive.readData(a);if(s){if(s.popup&&"kInteractiveFrame"!=a.parentNode.id){var e={pos:"side",aspectRatio:"16:9",cb:function(e){var t=document.createElement("div");t.innerHTML=a.outerHTML;var n=t.children[0];n.style.width="100%",n.style.height="100%",n.style.margin="0",n.style.position="absolute",n.style.left=0,n.style.top=0,kInteractive.c.removeClass(n,"kbHidden"),e.appendChild(n);var o=a.id.split("ki-video-")[1];kInteractive.postRender(document,n,o),setTimeout(function(){kInteractive.action(n)},100)}};return kInteractive.openFrame(e)}var t=a.getAttribute("id")+"-container",c=a.getElementsByClassName("playBtn")[0];if(!(0<=c.className.indexOf("loading"))){if(kInteractive.stopCurrentMedia(),c.className="playBtn ki-btn loading",s.autoplay&&(c.className="playBtn ki-btn hide"),kInteractive.scorm){var n={};n.id=kInteractive.getScormId(a.getAttribute("id"),s.src),n.description="Played video: "+s.src,n.type="other",n.learnerResponses="Played",n.objective=s.options?s.options.objective:null,n.timestamp=new Date,kInteractive.scorm.setInteractions([n])}if(kInteractive.events&&kInteractive.events.add({action:"videoPlayed",param:s.src,elem:a,data:s}),"file"==s.type){u(void 0===isKotobee?s.video:ph.join(kInteractive.absoluteURL,s.video))}else{var o,r=new URL(s.src);if(r.origin.includes("youtube.com")||r.origin.includes("youtu.be")){if(!(o=r.origin.includes("youtube.com")?r.searchParams.get("v"):r.pathname.split("/")[1]))return;if(window&&window.iBooks)return setTimeout(function(){c.className="playBtn ki-btn"},1500),void(window.location.href=s.src);var i={videoId:o,playerVars:{autoplay:1,rel:"0"},events:{onReady:function(){},onStateChange:function(e){e.data==YT.PlayerState.PLAYING&&kInteractive.tinCan({verb:"played",activity:"Video: "+s.src})}}};if(kInteractive.youTubeStatus)if("loading"==kInteractive.youTubeStatus){if(kInteractive.vQueue)return;kInteractive.vQueue=function(){c.className="playBtn ki-btn hide",new YT.Player(t,i)}}else"ready"==kInteractive.youTubeStatus&&(c.className="playBtn ki-btn hide",new YT.Player(t,i));else{window.onYouTubePlayerAPIReady=function(){kInteractive.youTubeStatus="ready",kInteractive.vQueue(),kInteractive.vQueue=null};var l=document.createElement("script");l.src="https://www.youtube.com/player_api";var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(l,d),kInteractive.youTubeStatus="loading",kInteractive.vQueue=function(){c.className="playBtn ki-btn hide",new YT.Player(t,i)}}}else u(s.src)}kInteractive.currentVideo=a,kInteractive.c.addClass(kInteractive.currentVideo,"playing")}}function u(e){var t,n=document.createElement("video");n.setAttribute("width","100%"),n.setAttribute("height","100%"),n.setAttribute("src",kInteractive.cleanURL(e)),n.setAttribute("autoplay","true"),n.setAttribute("disablePictureInPicture","true"),n.setAttribute("data-tap-disabled","false"),0!=e.indexOf("http://")&&0!=e.indexOf("https://")||(t=!0),t&&n.setAttribute("crossorigin","anonymous");var o=!1;try{o=-1<navigator.userAgent.toLowerCase().indexOf("android")}catch(e){}o||n.setAttribute("type","video/mp4"),n.setAttribute("webkit-playsinline","true"),n.setAttribute("controls","true");var r="";s.splash&&(r=void 0===isKotobee?s.splash:ph.join(kInteractive.absoluteURL,s.splash)),r&&n.setAttribute("poster",kInteractive.cleanURL(r)),n.className="ki-noHighlight",s.hideDownloadBtn&&(n.className+=" hideDownloadBtn",n.setAttribute("controlsList","nodownload")),n.innerHTML="Your browser doesn't support HTML5 video.",t&&(n.crossOrigin="anonymous"),n.oncanplay=function(){kInteractive.currentVideo==a&&(c.className="playBtn ki-btn hide",kInteractive.tinCan({verb:"played",activity:"Video: "+e}))},n.addEventListener("error",function(e){e.target.error&&kInteractive.stopCurrentMedia()}),n.addEventListener("webkitfullscreenchange",function(e){var t=null!==document.webkitFullscreenElement;kInteractive.videoIsFullscreen=t});var i=a.getElementsByClassName("container")[0];i.setAttribute("data-tap-disabled","true"),i.appendChild(n)}},resize:function(e){var t=kInteractive.readData(e);t&&(kInteractive.checkResponsiveFloat(t,e),t.maintainRatio&&"px"==t.widthUnit&&t.height&&t.width&&"absolute"!=e.style.position&&(e.style.height=e.offsetWidth*(t.height/t.width)+"px"))}},kInteractive.widget={preRender:function(e,t){},postRender:function(e,t,n,o){o=o||{};var r=e.createDocumentFragment(),i=kInteractive.readData(t);if(i){var a=i.name,s=(i.src,i.width),c=i.height;if("page"==i.mode){if(t.children.length)return;var l=document.createElement("div");l.className="cover",r.appendChild(l),i.interaction&&(l.style.pointerEvents="none");var d=document.createElement("div");d.className="iframeContainer";var u=document.createElement("iframe");if(u.setAttribute("nwdisable","true"),u.setAttribute("nwfaketop","true"),u.setAttribute("sandbox","allow-same-origin allow-scripts allow-forms allow-modals allow-popups"),u.setAttribute("width",t.style.width?t.style.width:s+i.widthUnit),u.setAttribute("height",t.style.height?t.style.height:c+"px"),u.src=kInteractive.getWidgetUrl(i,o),void 0!==kotobee&&-1!==u.src.indexOf(".amazonaws.com")){var p=document.createElement("a");p.href=u.src,u.addEventListener("load",function(e){e.target.contentWindow.postMessage({user:{name:kotobee.user.name?kotobee.user.name:"",email:kotobee.user.email?kotobee.user.email:"",loggedIn:kotobee.user.loggedIn},book:kotobee.book.meta.dc.identifier,chapter:kotobee.currentChapter.url.split("EPUB/xhtml/")[1]},p.protocol+"//"+p.hostname)})}d.appendChild(u),r.appendChild(d);var f=t.style.width,h=t.style.height;0<=f.indexOf("px")&&(i.widthUnit="px"),0<=f.indexOf("%")&&(i.widthUnit="%");try{i.widthUnit?i.width=Number(f.split(i.widthUnit)[0]):i.width=Number(f)}catch(e){i.width=Number(f)}try{i.height=Number(h.split("px")[0])}catch(e){i.height=Number(h)}kInteractive.writeData(t,i)}else{if(!t.children.length&&!t.innerHTML.trim()){var g=document.createElement("img");g.src=kInteractive.cleanURL(kInteractive.getWidgetHome(i,o)+"/"+a+"/Icon.png?c="+Math.round(9999*Math.random())),g.className="wdgtIcon",r.appendChild(g)}void 0===isKotobee&&t.addEventListener("click",kInteractive.actionEvent)}t.appendChild(r)}},action:function(t){var n=kInteractive.readData(t);if(n){var o=kInteractive.getWidgetUrl(n),r=document.createElement("iframe");r.setAttribute("nwdisable","true"),r.setAttribute("nwfaketop","true"),r.setAttribute("sandbox","allow-same-origin allow-scripts allow-forms allow-modals allow-popups"),n.cb=function(e){r.src=o,e.appendChild(r)},n.cb1="yes",n.closed=function(){},n.responsive&&(n.width=n.height=null),kInteractive.openFrame(n),kInteractive.tinCan({verb:"opened",activity:"Widget: "+n.name}),setTimeout(function(){if(kInteractive.scorm){var e={};e.id=kInteractive.getScormId("widget",n.name),e.description="Opened popup widget: "+n.name,e.learnerResponses="Opened",e.type="other",e.timestamp=new Date,kInteractive.scorm.setInteractions([e])}kInteractive.events&&kInteractive.events.add({action:"popupWidgetOpened",param:n.name,elem:t,data:n})},800)}},resize:function(e){var t=kInteractive.readData(e);if(t&&"page"==t.mode&&"px"==t.widthUnit){var n=t.width,o=t.height,r=e.parentNode;if(r)if(n>r.offsetWidth){var i=r.offsetWidth/n,a=e.children.length-1;e.children[a].style.transform=e.children[a].style.webkitTransform=e.children[a].style.mozTransform="scale("+i+")",e.children[a].style.transformOrigin=e.children[a].style.webkitTransformOrigin=e.children[a].style.mozTransformOrigin="0 0",e.style.maxWidth=e.style.width,e.style.height=Math.round(o*i)+"px"}else{for(a=0;a<e.children.length;a++)e.children[a].style.transform=e.children[a].style.webkitTransform=e.children[a].style.mozTransform=e.children[a].style.transformOrigin=e.children[a].style.webkitTransformOrigin=e.children[a].style.mozTransformOrigin=null;e.style.maxWidth=null,e.style.height=o+"px"}}}},kInteractive.helpers.persister={instances:{},addInstance:function(e,t){kInteractive.helpers.persister.instances[e]=new kPersister(t)}};