(function framework7ComponentLoader(e,t){void 0===t&&(t=!0);document,window;var o=e.$,n=(e.Template7,e.utils),a=(e.device,e.support),i=e.Class,r=(e.Modal,e.ConstructorMethods),s=(e.ModalMethods,function(e){function t(t,i){void 0===i&&(i={}),e.call(this,i,[t]);var r=this,s={};r.useModulesParams(s),r.params=n.extend(s,i);var c=r.params.el;if(!c)return r;var l=o(c);if(0===l.length)return r;if(l[0].f7Toggle)return l[0].f7Toggle;var g,u=l.children('input[type="checkbox"]');n.extend(r,{app:t,$el:l,el:l[0],$inputEl:u,inputEl:u[0],disabled:l.hasClass("disabled")||u.hasClass("disabled")||u.attr("disabled")||u[0].disabled}),Object.defineProperty(r,"checked",{enumerable:!0,configurable:!0,set:function(e){r&&void 0!==r.$inputEl&&r.checked!==e&&(u[0].checked=e,r.$inputEl.trigger("change"))},get:function(){return u[0].checked}}),l[0].f7Toggle=r;var d,f,h,p,v,m={};function y(e){g||r.disabled||(m.x="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,m.y="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY,f=0,g=!0,d=void 0,p=n.now(),v=r.checked,h=l[0].offsetWidth,n.nextTick(function(){g&&l.addClass("toggle-active-state")}))}function b(e){if(g&&!r.disabled){var o,n="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,a="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,i=t.rtl?-1:1;if(void 0===d&&(d=!!(d||Math.abs(a-m.y)>Math.abs(n-m.x))),d)g=!1;else e.preventDefault(),(f=n-m.x)*i<0&&Math.abs(f)>h/3&&v&&(o=!0),f*i>0&&Math.abs(f)>h/3&&!v&&(o=!0),o&&(m.x=n,r.checked=!v,v=!v)}}function T(){if(!g||r.disabled)return d&&l.removeClass("toggle-active-state"),void(g=!1);var e,o=t.rtl?-1:1;g=!1,l.removeClass("toggle-active-state"),n.now()-p<300&&(f*o<0&&v&&(e=!0),f*o>0&&!v&&(e=!0),e&&(r.checked=!v))}function M(){r.$el.trigger("toggle:change",r),r.emit("local::change toggleChange",r)}r.attachEvents=function(){if(a.touch){var e=!!a.passiveListener&&{passive:!0};l.on(t.touchEvents.start,y,e),t.on("touchmove",b),t.on("touchend:passive",T)}r.$inputEl.on("change",M)},r.detachEvents=function(){if(a.touch){var e=!!a.passiveListener&&{passive:!0};l.off(t.touchEvents.start,y,e),t.off("touchmove",b),t.off("touchend:passive",T)}r.$inputEl.off("change",M)},r.useModules(),r.init()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toggle=function(){this.checked=!this.checked},t.prototype.init=function(){this.attachEvents()},t.prototype.destroy=function(){var e=this;e.$el.trigger("toggle:beforedestroy",e),e.emit("local::beforeDestroy toggleBeforeDestroy",e),delete e.$el[0].f7Toggle,e.detachEvents(),n.deleteProps(e),e=null},t}(i)),c={name:"toggle",create:function(){this.toggle=r({defaultSelector:".toggle",constructor:s,app:this,domProp:"f7Toggle"})},static:{Toggle:s},on:{tabMounted:function(e){var t=this;o(e).find(".toggle-init").each(function(e,o){return t.toggle.create({el:o})})},tabBeforeRemove:function(e){o(e).find(".toggle-init").each(function(e,t){t.f7Toggle&&t.f7Toggle.destroy()})},pageInit:function(e){var t=this;e.$el.find(".toggle-init").each(function(e,o){return t.toggle.create({el:o})})},pageBeforeRemove:function(e){e.$el.find(".toggle-init").each(function(e,t){t.f7Toggle&&t.f7Toggle.destroy()})}},vnode:{"toggle-init":{insert:function(e){var t=e.elm;this.toggle.create({el:t})},destroy:function(e){var t=e.elm;t.f7Toggle&&t.f7Toggle.destroy()}}}};if(t){if(e.prototype.modules&&e.prototype.modules[c.name])return;e.use(c),e.instance&&(e.instance.useModuleParams(c,e.instance.params),e.instance.useModule(c))}return c}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))
