/** * Dom7 3.0.0 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API * https://framework7.io/docs/dom7.html * * Copyright 2020, Vladimir Kharlampidi * * Licensed under MIT * * Released on: November 9, 2020 */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Dom7=e()}(this,(function(){"use strict";function t(t){return null!==t&&"object"==typeof t&&"constructor"in t&&t.constructor===Object}function e(n,r){void 0===n&&(n={}),void 0===r&&(r={}),Object.keys(r).forEach((function(i){void 0===n[i]?n[i]=r[i]:t(r[i])&&t(n[i])&&Object.keys(r[i]).length>0&&e(n[i],r[i])}))}var n={body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},createElementNS:function(){return{}},importNode:function(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function r(){var t="undefined"!=typeof document?document:{};return e(t,n),t}var i={document:n,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState:function(){},pushState:function(){},go:function(){},back:function(){}},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){},matchMedia:function(){return{}},requestAnimationFrame:function(t){return"undefined"==typeof setTimeout?(t(),null):setTimeout(t,0)},cancelAnimationFrame:function(t){"undefined"!=typeof setTimeout&&clearTimeout(t)}};function o(){var t="undefined"!=typeof window?window:{};return e(t,i),t}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function u(t,e,n){return(u=l()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&a(i,n.prototype),i}).apply(null,arguments)}function f(t){var e="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return u(t,arguments,s(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),a(r,t)})(t)}var h=function(t){var e,n;function r(e){var n,r,i;return n=t.call.apply(t,[this].concat(e))||this,r=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n),i=r.__proto__,Object.defineProperty(r,"__proto__",{get:function(){return i},set:function(t){i.__proto__=t}}),n}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r}(f(Array));function c(t){void 0===t&&(t=[]);var e=[];return t.forEach((function(t){Array.isArray(t)?e.push.apply(e,c(t)):e.push(t)})),e}function p(t,e){return Array.prototype.filter.call(t,e)}function d(t,e){var n=o(),i=r(),s=[];if(!e&&t instanceof h)return t;if(!t)return new h(s);if("string"==typeof t){var a=t.trim();if(a.indexOf("<")>=0&&a.indexOf(">")>=0){var l="div";0===a.indexOf("0})).length>0},attr:function(t,e){if(1===arguments.length&&"string"==typeof t)return this[0]?this[0].getAttribute(t):void 0;for(var n=0;n=0&&(n[(e=o.name.split("data-")[1],e.toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})))]=o.value)}for(var s in n)"false"===n[s]?n[s]=!1:"true"===n[s]?n[s]=!0:parseFloat(n[s])===1*n[s]&&(n[s]*=1);return n}},val:function(t){if(void 0===t){var e=this[0];if(!e)return;if(e.multiple&&"select"===e.nodeName.toLowerCase()){for(var n=[],r=0;r=0;else o.value=t}return this},value:function(t){return this.val(t)},transform:function(t){for(var e=0;e=0;p-=1){var d=c[p];o&&d.listener===o||o&&d.listener&&d.listener.dom7proxy&&d.listener.dom7proxy===o?(h.removeEventListener(u,d.proxyListener,s),c.splice(p,1)):o||(h.removeEventListener(u,d.proxyListener,s),c.splice(p,1))}}return this},once:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r0})),f.dispatchEvent(h),f.dom7EventData=[],delete f.dom7EventData}}return this},transitionEnd:function(t){var e=this;return t&&e.on("transitionend",(function n(r){r.target===this&&(t.call(this,r),e.off("transitionend",n))})),this},animationEnd:function(t){var e=this;return t&&e.on("animationend",(function n(r){r.target===this&&(t.call(this,r),e.off("animationend",n))})),this},width:function(){var t=o();return this[0]===t?t.innerWidth:this.length>0?parseFloat(this.css("width")):null},outerWidth:function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},height:function(){var t=o();return this[0]===t?t.innerHeight:this.length>0?parseFloat(this.css("height")):null},outerHeight:function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},offset:function(){if(this.length>0){var t=o(),e=r(),n=this[0],i=n.getBoundingClientRect(),s=e.body,a=n.clientTop||s.clientTop||0,l=n.clientLeft||s.clientLeft||0,u=n===t?t.scrollY:n.scrollTop,f=n===t?t.scrollX:n.scrollLeft;return{top:i.top+u-a,left:i.left+f-l}}return null},hide:function(){for(var t=0;te-1)return d([]);if(t<0){var n=e+t;return d(n<0?[]:[this[n]])}return d([this[t]])},append:function(){for(var t,e=r(),n=0;n=0;n-=1)this[e].insertBefore(o.childNodes[n],this[e].childNodes[0])}else if(t instanceof h)for(n=0;n1)for(var r=0;r1)for(var r=0;r0?t?this[0].nextElementSibling&&d(this[0].nextElementSibling).is(t)?d([this[0].nextElementSibling]):d([]):this[0].nextElementSibling?d([this[0].nextElementSibling]):d([]):d([])},nextAll:function(t){var e=[],n=this[0];if(!n)return d([]);for(;n.nextElementSibling;){var r=n.nextElementSibling;t?d(r).is(t)&&e.push(r):e.push(r),n=r}return d(e)},prev:function(t){if(this.length>0){var e=this[0];return t?e.previousElementSibling&&d(e.previousElementSibling).is(t)?d([e.previousElementSibling]):d([]):e.previousElementSibling?d([e.previousElementSibling]):d([])}return d([])},prevAll:function(t){var e=[],n=this[0];if(!n)return d([]);for(;n.previousElementSibling;){var r=n.previousElementSibling;t?d(r).is(t)&&e.push(r):e.push(r),n=r}return d(e)},siblings:function(t){return this.nextAll(t).add(this.prevAll(t))},parent:function(t){for(var e=[],n=0;n0||0===s,m=i>0||0===i;if(void 0===l&&(l="swing"),v&&(e=d.scrollTop,a||(d.scrollTop=s)),m&&(n=d.scrollLeft,a||(d.scrollLeft=i)),a){v&&(r=d.scrollHeight-d.offsetHeight,f=Math.max(Math.min(s,r),0)),m&&(o=d.scrollWidth-d.offsetWidth,h=Math.max(Math.min(i,o),0));var g=null;v&&f===e&&(v=!1),m&&h===n&&(m=!1),t.requestAnimationFrame((function r(i){void 0===i&&(i=(new Date).getTime()),null===g&&(g=i);var o,s=Math.max(Math.min((i-g)/a,1),0),y="linear"===l?s:.5-Math.cos(s*Math.PI)/2;v&&(c=e+y*(f-e)),m&&(p=n+y*(h-n)),v&&f>e&&c>=f&&(d.scrollTop=f,o=!0),v&&fn&&p>=h&&(d.scrollLeft=h,o=!0),m&&h0?a[0].scrollTop:null:a.scrollTo(void 0,r,i,o,s)},scrollLeft:function(){for(var t=arguments.length,e=new Array(t),n=0;n0?a[0].scrollLeft:null:a.scrollTo(r,void 0,i,o,s)}});var g=Object.freeze({__proto__:null,animate:function(t,e){var n,r=o(),i=this,s={props:Object.assign({},t),params:Object.assign({duration:300,easing:"swing"},e),elements:i,animating:!1,que:[],easingProgress:function(t,e){return"swing"===t?.5-Math.cos(e*Math.PI)/2:"function"==typeof t?t(e):e},stop:function(){s.frameId&&r.cancelAnimationFrame(s.frameId),s.animating=!1,s.elements.each((function(t){delete t.dom7AnimateInstance})),s.que=[]},done:function(t){if(s.animating=!1,s.elements.each((function(t){delete t.dom7AnimateInstance})),t&&t(i),s.que.length>0){var e=s.que.shift();s.animate(e[0],e[1])}},animate:function(t,e){if(s.animating)return s.que.push([t,e]),s;var n=[];s.elements.each((function(e,i){var o,a,l,u,f;e.dom7AnimateInstance||(s.elements[i].dom7AnimateInstance=s),n[i]={container:e},Object.keys(t).forEach((function(s){o=r.getComputedStyle(e,null).getPropertyValue(s).replace(",","."),a=parseFloat(o),l=o.replace(a,""),u=parseFloat(t[s]),f=t[s]+l,n[i][s]={initialFullValue:o,initialValue:a,unit:l,finalValue:u,finalFullValue:f,currentValue:a}}))}));var o,a,l=null,u=0,f=0,h=!1;return s.animating=!0,s.frameId=r.requestAnimationFrame((function c(){var p,d;o=(new Date).getTime(),h||(h=!0,e.begin&&e.begin(i)),null===l&&(l=o),e.progress&&e.progress(i,Math.max(Math.min((o-l)/e.duration,1),0),l+e.duration-o<0?0:l+e.duration-o,l),n.forEach((function(r){var i=r;a||i.done||Object.keys(t).forEach((function(r){if(!a&&!i.done){p=Math.max(Math.min((o-l)/e.duration,1),0),d=s.easingProgress(e.easing,p);var h=i[r],c=h.initialValue,v=h.finalValue,m=h.unit;i[r].currentValue=c+d*(v-c);var g=i[r].currentValue;(v>c&&g>=v||v