-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkk.es5.min.js
1 lines (1 loc) · 15.6 KB
/
kk.es5.min.js
1
"use strict";var _slicedToArray=function(){function a(a,b){var c,d=[],e=!0,f=!1;try{for(var g,h=a[Symbol.iterator]();!(e=(g=h.next()).done)&&(d.push(g.value),!(b&&d.length===b));e=!0);}catch(a){f=!0,c=a}finally{try{!e&&h["return"]&&h["return"]()}finally{if(f)throw c}}return d}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}(function(){var a={v:"0.21.0",w:null,d:null};if(a.msg={cb:"\u041E\u0431\u0440\u0430\u0442\u043D\u044B\u0439 \u0432\u044B\u0437\u043E\u0432 \u043D\u0435 \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0451\u043D \u0438\u043B\u0438 \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0444\u0443\u043D\u043A\u0446\u0438\u0435\u0439",ae:"\u0423\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442"},a.err={},Object.keys(a.msg).forEach(function(b){a.err[b]=Error(a.msg[b])}),a.__d=function(){return console.warn("Depricated")},("function"==typeof Window||Window instanceof Function)&&window instanceof Window)a.w=window,a.global=a.r=a.w;else throw console.warn(Window,Window instanceof Function,Function),console.warn(window,window instanceof Window,Window),Error("\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u043E \u0447\u0442\u043E");Object.defineProperty(a,"d",{get:function(){return a.r.document}}),a.ts=function(){return Date.now()},a.r.kk=a.r.kenzo=a})(),function(a){a.is=function(){var b={u:"undefined",b:"boolean",n:"number",s:"string",o:"object",f:"function",c:"function"};return Object.keys(b).forEach(function(a){var c=b[a];b[a]=function(){for(var a=arguments.length,b=Array(a),d=0;d<a;d++)b[d]=arguments[d];return!(0<b.filter(function(a){return("undefined"==typeof a?"undefined":_typeof(a))!==c}).length)}}),b.addTest=function(c,d){if(b.hasOwnProperty(c))throw new a.err.ae;if(!b.c(d))throw new TypeError;b[c]=function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return!(0<b.filter(function(a){return!(a instanceof d)}).length)}},[["A",Array],["AB",ArrayBuffer],["D",Date],["E",Element],["N",Node],["NL",NodeList],["C",HTMLCollection],["S",Set]].forEach(function(a){b.addTest.apply(b,_toConsumableArray(a))}),b}()}(kk),function(a){a.each=function(){var b=arguments,c=[],d=b[0],e=b[1];if(!a.is.f(e))throw a.err.cb;var f,g,h=!!a.is.f(b[2])&&b[2],i=b[b.length-1],j=!!a.is.b(i)&&i,k=!1;if(!a.is.u(d)){if(a.is.s(d)&&a.d?c=a.d.querySelectorAll(d):a.is.n(d)?(c=Array(Math.floor(Math.max(0,d))),k=!0):ArrayBuffer.isView(d)&&0<d.length?c=Array.prototype.slice.call(d):(a.is.A(d)||a.is.NL(d)||a.is.C(d))&&(c=d),0<c.length)if(j){for(f=c.length-1;0<=f;f--)if(g=e(k?f:c[f],f,c),!a.is.u(g))return g;}else for(f=0;f<c.length;f++)if(g=e(k?f:c[f],f,c),!a.is.u(g))return g;return h?h():void 0}},void 0===a.r.each&&(a.r.each=a.each)}(kk),function(a){var b=Math.floor;a.rand=function(c,d){var e=Math.pow,f=void 0,g=void 0;if(a.is.A(c))return c[a.rand(0,c.length-1)];if(!a.is.n(c))return!Math.round(Math.random());if(!a.is.n(d)){var h=b(Math.abs(c));if(16<=h)throw new Error("\u041D\u0435\u043B\u044C\u0437\u044F \u0437\u0430\u0434\u0430\u0442\u044C \u0447\u0438\u0441\u043B\u043E \u0431\u043E\u043B\u0435\u0435 \u0447\u0435\u043C \u0432 16 \u0437\u043D\u0430\u043A\u043E\u0432");return 0===h?0:(f=1===h?0:e(10,h-1),a.rand(f,e(10,h)-1))}return f=c,g=d+1,b(Math.random()*(g-f))+f}}(kk),function(a){a.class=function(b,c,d){if(!a.is.E(b))throw new TypeError;if(a.is.s(c)&&(c=[c]),!a.is.A(c))throw new TypeError;a.is.A(d)||(d=[]),d.forEach(function(b){if(!a.is.s(b))throw new TypeError}),c.forEach(function(b){if(!a.is.s(b))throw new TypeError}),d.forEach(function(a){0>c.indexOf(a)&&b.classList.remove(a)}),c.forEach(function(a){b.classList.add(a)})}}(kk),function(a){a.class_forever=function(a,b){b.classList.add(a);var c=new MutationObserver(function(c){c.forEach(function(c){"class"!==c.attributeName||c.target!==b||b.classList.contains(a)||b.classList.add(a)})});c.observe(b,{attributes:!0})}}(kk),function(a){a.Event=function(){function a(){_classCallCheck(this,a),this.listeners=[],this.queue=[],this.state={last:void 0,processed:!1,completed:!1}}return _createClass(a,[{key:"hasListener",value:function(a){return this.listeners.find(function(b){return b===a})}},{key:"addListener",value:function(a){if("function"!=typeof a)throw TypeError();this.hasListener(a)||(this.state.completed?a.apply(void 0,_toConsumableArray(this.state.last)):this.listeners.push(a),this.state.processed&&this.queue.push(a))}},{key:"removeListener",value:function(a){"function"!=typeof a||(this.listeners=this.listeners.filter(function(b){return b!==a}))}},{key:"dispatch",value:function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];if(!this.state.completed){for(this.state.processed=!0,this.state.last=b,this.listeners.forEach(function(a){a.apply(void 0,b)});0<this.queue.length;){var d=this.queue.shift();d.apply(void 0,b)}this.state.processed=!1}}},{key:"complete",value:function(){this.state.completed||(this.dispatch.apply(this,arguments),this.state.completed=!0)}}]),a}()}(kk),function(a){function b(a,b,d){return"#"===b[0]?c(a,b.substring(1),d,!0):"."===b[0]?c(a,b.substring(1),d,!1):c(a,b,d,!1)}function c(b,d,e,f){if(!(!1!==e&&0>--e)&&a.is.E(b)&&"parentNode"in b&&a.is.E(b.parentNode)){var g=b.parentNode;if(f){if(g.getAttribute("id")===d)return g;}else if(g.classList.contains(d))return g;return c(g,d,e,f)}}a.find_ancestor=function(c,d,e){if(a.is.n(e)||(e=!1),a.is.s(d)&&(d=[d]),a.is.A(d))return a.each(d,function(d){if(a.is.s(d))return b(c,d,e)})}}(kk),function(a){var b=Math.abs;a.format={};var c=function(b){if(!a.is.s(b))throw new TypeError("Expected a string");var c=b;return c=c.replace(/([\s-–—_]+)/g,"-"),c=c.replace(/([a-z])([A-Z])/g,"$1-$2"),c=c.toLowerCase(),c.split("-")};a.format.camelize=function(a,b){return c(a).map(function(a,c){var d=a.charAt(0);return 0===c&&b||(d=d.toUpperCase()),d+a.substr(1)}).join("")},a.format.capitalize=function(a){return a.charAt(0).toUpperCase()+a.substr(1)},a.format.date_range_to_string=function(b,c){if(a.is.s(b)&&(b=new Date(b)),a.is.s(c)&&(c=new Date(c)),a.is.D(b)&&a.is.D(c))return"\u0441\xA0"+a.date_to_string(b)+" \u043F\u043E\xA0"+a.date_to_string(c);throw new Error(a.msg.ia)},a.format.date_to_string=function(b){var c=[],d=new Date;if(a.is.s(b)&&(b=new Date(b)),!a.is.D(b))return b;var e=b.getDate(),f=["\u044F\u043D\u0432\u0430\u0440\u044F","\u0444\u0435\u0432\u0440\u0430\u043B\u044F","\u043C\u0430\u0440\u0442\u0430","\u0430\u043F\u0440\u0435\u043B\u044F","\u043C\u0430\u044F","\u0438\u044E\u043D\u044F","\u0438\u044E\u043B\u044F","\u0430\u0432\u0433\u0443\u0441\u0442\u0430","\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F","\u043E\u043A\u0442\u044F\u0431\u0440\u044F","\u043D\u043E\u044F\u0431\u0440\u044F","\u0434\u0435\u043A\u0430\u0431\u0440\u044F"][b.getMonth()],g=b.getFullYear();return c.push(e),c.push(f),g!==d.getFullYear()&&c.push(g),c.join("\xA0")},a.format.decamelize=function(a){return c(a).join("-")},a.format.number=function(b){if(a.is.n(b)&&(b+=""),!a.is.s(b)||""===b)throw new TypeError;var c="";return a.each(b.split(""),function(a,d){c=a+c,0!==d&&0==(b.length-d)%3&&(c="\u2009"+c)},!0),c},a.format.phone=function(b){if(a.is.n(b)&&(b+=""),!a.is.s(b)||""===b)throw new TypeError;var c="",d=b.replace(/[^\d]/g,"").match(/^(?:7|8)([\d]{10})/);if(null!==d)return d=d[1],c="+7 ("+d.slice(0,3)+") "+d.slice(3,6)+"-"+d.slice(6,8)+"-"+d.slice(8,10),c},a.format.plural=function(c){for(var d=arguments.length,e=Array(1<d?d-1:0),f=1;f<d;f++)e[f-1]=arguments[f];var g=a.is.n(c)?b(c):a.is.A(c)?c.length:a.is.S(c)?c.size:null;if(null===g)throw TypeError();if(a.is.A(e[0])&&(e=e[0]),3!==e.length)throw Error("\u0424\u043E\u0440\u043C\u044B \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u0442\u0440\u0438");if(a.is.s(e))throw TypeError();var h=e,i=_slicedToArray(h,3),j=i[0],k=i[1],l=i[2],m=g.toString().match(/(\.\d+)/);return null===m?1==g%10&&11!=g%100?j:2<=g%10&&4>=g%10&&(10>g%100||20<=g%100)?k:l:l},a.format.seconds_to_string=function(c){if(!a.is.n(c))return c;var d=[["seconds",1,["\u0441\u0435\u043A\u0443\u043D\u0434\u0430","\u0441\u0435\u043A\u0443\u043D\u0434\u044B","\u0441\u0435\u043A\u0443\u043D\u0434"]],["minutes",60,["\u043C\u0438\u043D\u0443\u0442\u0430","\u043C\u0438\u043D\u0443\u0442\u044B","\u043C\u0438\u043D\u0443\u0442"]],["hours",3600,["\u0447\u0430\u0441","\u0447\u0430\u0441\u0430","\u0447\u0430\u0441\u043E\u0432"]],["days",86400,["\u0434\u0435\u043D\u044C","\u0434\u043D\u044F","\u0434\u043D\u0435\u0439"]],["weeks",604800,["\u043D\u0435\u0434\u0435\u043B\u044F","\u043D\u0435\u0434\u0435\u043B\u0438","\u043D\u0435\u0434\u0435\u043B\u044C"]],["months",2592000,["\u043C\u0435\u0441\u044F\u0446","\u043C\u0435\u0441\u044F\u0446\u0430","\u043C\u0435\u0441\u044F\u0446\u0435\u0432"]],["years",22118400,["\u0433\u043E\u0434","\u0433\u043E\u0434\u0430","\u043B\u0435\u0442"]]].map(function(a){return{unit:a[0],value:b(Math.round(c/a[1])),forms:a[2]}}).filter(function(a){return 1<b(a.value)}).pop();return d.value+" "+a.format.plural(d.value,d.forms)}}(kk),function(a){a.generate_key=function(b){return(!a.is.n(b)||1>b)&&(b=1),Array(b).fill("").reduce(function(b){return b+String.fromCharCode(a.rand(19968,40869))},"")}}(kk),function(a){function b(b){return a.is.n(b)?0<=b?b+"-":b:a.is.A(b)&&a.is.n(b[0])&&0<=b[0]&&a.is.n(b[1])&&0<=b[1]?b[0]+"-"+b[1]:void 0}function c(a){return new Promise(function(b,c){try{var d=new XMLHttpRequest;d.open("GET",a,!0),d.responseType="arraybuffer",d.addEventListener("loadend",function(){200===d.status?b(e(d)):c({url:d.responseURL,status:d.status,range:d.getResponseHeader("Content-Type")})}),d.send()}catch(a){console.error(a)}})}function d(a,c){return new Promise(function(d,f){try{var g=new XMLHttpRequest;g.open("GET",a,!0),g.responseType="arraybuffer",g.setRequestHeader("Range","bytes="+b(c)),g.addEventListener("loadend",function(){if(!(206===g.status))console.error(a,c,g.status),console.log("range >",g.getResponseHeader("Content-Type")),f([a,c,g.status]);else if(g.getResponseHeader("Content-Range")){var b=e(g);b.range=c,d(b)}}),g.send()}catch(a){console.error(a)}})}function e(a){return{headers:a.getAllResponseHeaders(),getHeader:function(b){return a.getResponseHeader(b)},content:a.response}}a.get_buffer=function(){var b=Array.prototype.slice.call(arguments);return new Promise(function(e,f){try{var g,h=b.shift(),i=!1;if(1<b.length&&a.is.b(b[b.length-1])&&(i=b.pop()),g=b,a.is.s(h)||f("URL \u043D\u0435 \u0437\u0430\u0434\u0430\u043D"),0===g.length||1===g.length&&0===g[0])return void c(h).then(e,f);g=g.map(function(b){return(a.is.n(b)||a.is.A(b)&&a.is.n(b[0])&&0<=b[0]&&a.is.n(b[1])&&0<=b[1])&&b}),i||(1===g.length?d(h,g[0]).then(e,f):Promise.all(g.map(function(a){if(!1!==a)return d(h,a)})).then(e,f))}catch(a){console.error(a)}})}}(kk),function(a){a.get_offset=function(a){var b=a.getBoundingClientRect();return{top:b.top+window.pageYOffset,left:b.left+window.pageXOffset,width:b.width,height:b.height}}}(kk),function(a){a.i8to2=function(a){for(var b=a.toString(2);8>b.length;)b="0"+b;return b},a.i8ArrayTo2=function(b){var c="";return b.forEach(function(b){c+=a.i8to2(b)}),c},a.i8ArrayToString=function(a){var b="";return a.forEach(function(a){b+=String.fromCharCode(a)}),b}}(kk),function(a){a.ls=function(a,b){var c={};return c.on_change=new a.Event,c.create=function(d){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(a.is.s(d)&&!b.getItem(d))return c.set(d,e,!0),e},c.get=function(d,e){var f=b.getItem(d);return!f&&a.is.o(e)?c.set(d,e):JSON.parse(f)},c.ts=function(a){return b.getItem("@"+a)},c.set=function(a,d,e){return b.setItem(a,JSON.stringify(d)),b.setItem("@"+a,Date.now()),e||c.on_change.dispatch(),d},c.remove=function(a){b.removeItem(a),b.removeItem("@"+a),c.on_change.dispatch("remove")},c}(a,localStorage)}(kk),function(a){var b=function(){function b(c){if(_classCallCheck(this,b),!a.is.o(c))throw new TypeError;if(!a.is.s(c.name))throw new TypeError;if(!a.is.o(c.store))throw new TypeError;if(!a.is.s(c.store.name))throw new TypeError;if("version"in c&&!a.is.n(c.version))throw new TypeError;var d=this;this.schema=c,this.db=new Promise(function(a,b){var e=indexedDB.open(c.name,c.version);e.onupgradeneeded=d.upgrade.bind(d),e.onsuccess=function(){return a(e.result)},e.onerror=function(a){return b(a)},e.onblocked=function(a){return b(a)}})}return _createClass(b,[{key:"upgrade",value:function(b){var c=this,d=b.target.result,e=this.schema.store.name,f=this.schema.store.key||!1,g=a.is.A(this.schema.store.indexes)?this.schema.store.indexes:[],h={};d.objectStoreNames.contains(e)&&(d.deleteObjectStore(e),console.log("SimpleStore: \u0445\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435 \u0443\u0434\u0430\u043B\u0435\u043D\u043E")),f?h.keyPath=f:h.autoIncrement=!0;var i=d.createObjectStore(e,h);each(g,function(a){i.createIndex(a,a)})}},{key:"put",value:function(a){var b=this;return new Promise(function(c,d){b.db.then(function(e){var f=e.transaction(b.schema.store.name,"readwrite").objectStore(b.schema.store.name).put(a);f.onsuccess=function(a){c(a.target.result)},f.onerror=function(a){d(a)}},d)})}},{key:"get",value:function(b,c){var d=this;return new Promise(function(e,f){d.db.then(function(g){var h=g.transaction(d.schema.store.name,"readonly").objectStore(d.schema.store.name);if(a.is.s(c)&&d.schema.store.indexes.includes(c)){h=h.index(c);var i=IDBKeyRange.only(b),j=h.openCursor(i),k=[];j.onsuccess=function(a){var b=a.target.result;b?(k.push(b.value),b.continue()):0<k.length?e(k):f(a)},j.onerror=function(a){f(a)}}else{var l=h.get(b);l.onsuccess=function(){l.result?e(l.result):f()},l.onerror=function(a){f(a)}}},f)})}},{key:"delete",value:function(){}},{key:"drop",value:function(){}}]),b}();a.SimpleStore=b}(kk),function(a){if(a.d){var b=Object.defineProperty,c=a.d.body,d={body:{}};d.root=d.body,a.viewport=d,a.is.n(a.r.pageXOffset)?(b(d,"x",{get:function(){return a.r.pageXOffset}}),b(d,"y",{get:function(){return a.r.pageYOffset}})):(b(d,"x",{get:function(){return(a.d||c.parentNode||c).scrollLeft}}),b(d,"y",{get:function(){return(a.d||c.parentNode||c).scrollTop}})),b(d,"w",{get:function(){return a.r.innerWidth}}),b(d,"h",{get:function(){return a.r.innerHeight}}),b(d.body,"w",{get:function(){return a.d.clientWidth}}),b(d.body,"h",{get:function(){return a.d.clientHeight}})}}(kk),function(a){function b(c){var d=[],e=function(a){~d.indexOf(a)||d.push(a)};return c.forEach(function(c){a.is.s(c)?e(c):a.is.A(c)&&b(c).forEach(e)}),d}var c="__proxy__";a.ProxyStorage=function a(){_classCallCheck(this,a)},a.watch=function(d){for(var e,f=arguments.length,g=Array(1<f?f-1:0),h=1;h<f;h++)g[h-1]=arguments[h];var i=g.pop();if(!a.is.o(d)||null===d||!a.is.f(i)&&!(i instanceof a.Event)||0<g.length&&!(e=a.is).s.apply(e,_toConsumableArray(g)))throw new TypeError;d.hasOwnProperty(c)||Object.defineProperty(d,c,{enumerable:!1,writable:!0}),d[c]instanceof a.ProxyStorage||(d[c]=new a.ProxyStorage);var j=d[c];g=0===g.length?Object.keys(d):b(g),g.forEach(function(b){b in j||(b in d?(j[b]=d[b],delete d[b]):j[b]=void 0,Object.defineProperty(d,b,{enumerable:!0,get:function(){return j[b]},set:function(c){var d=j[b];j[b]=c,c!==d&&(i instanceof a.Event?i.dispatch(d,c):i(d,c))}}))})}}(kk);