-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkk-ui.min.js
1 lines (1 loc) · 3.25 KB
/
kk-ui.min.js
1
'use strict';((a)=>{!a.viewport,a.ui={}})(kk),(()=>{})(kk),((c)=>{class Billboard{constructor(a){this;this.limit=100,this.source=a,this.width=0,this.heigth=0,this.list=[]}set_size(a,b){if(c.is.s(a)&&(a=parseInt(a)),c.is.s(b)&&(b=parseInt(b)),c.is.n(a)&&c.is.n(b)&&!isNaN(a)&&!isNaN(b))return this.width=a,this.heigth=b,this.limit=(a*b)**2,void this.update();throw console.error(a,b),new Error('\u0420\u0430\u0437\u043C\u0435\u0440\u044B \u043D\u0435 \u0437\u0430\u0434\u0430\u043D\u044B')}static convert(a){return a.map((a)=>{if(c.is.o(a))return a;if(c.is.n(a))return{value:a};throw Error('\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 \u0440\u044F\u0434\u0430')})}static left(a){let b=0,c=a.list.slice(0,a.cursor);return c.forEach((a)=>{b+=a.value}),a.limit-b%a.limit}static process(d){const e=[[0,0],[1,0],[0,1],[1,1],[0,2],[1,2],[2,0],[2,1],[2,2],[0,3],[1,3],[2,3],[3,0],[3,1],[3,2],[3,3],[0,4]];for(let f in e){const g=e[f][0],a=e[f][1],b=Billboard.left({list:d.list,cursor:d.cursor-a,limit:d.limit}),h=d.list[d.cursor+g];if(!c.is.o(h))return d.cursor=d.cursor-a+1,d;if(d.list[d.cursor+g].value<=b){d.list[d.cursor+g]=d.list[d.cursor-a],d.list[d.cursor-a]=h,d.cursor=d.cursor-a+1;break}}return d}update(){const a=this;let b=[];this.source.forEach((a)=>{if(!('width'in a))throw new Error('\u0428\u0438\u0440\u0438\u043D\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430 \u043D\u0435 \u0437\u0430\u0434\u0430\u043D\u0430');a.width<=this.width&&b.push(a)});let c={list:b,cursor:0,limit:a.width};for(;c.cursor<c.list.length;){if(this.limit--,0>this.limit){console.warn('\u041F\u0440\u0438\u0437\u043D\u0430\u043A\u0438 \u0437\u0430\u0446\u0438\u043A\u043B\u0435\u043D\u043D\u043E\u0441\u0442\u0438');break}c=Billboard.process(c)}this.list=c.list}}c.ui.Billboard=Billboard})(kk),((a)=>{a.ElementEvents=class{constructor(b){if(!a.is.E(b))throw new TypeError;const c=this;['mutation','node_addition','node_removal','element_addition','element_removal'].forEach((b)=>{this[`on_${b}`]=new a.Event});const d=new MutationObserver(function(a){c.on_mutation.dispatch(a)});d.observe(b,{childList:!0,subtree:!0}),this.on_mutation.addListener((a)=>{each(a,function(a){each(a.addedNodes,(a)=>{c.on_node_addition.dispatch(a)}),each(a.removedNodes,(a)=>{c.on_node_removal.dispatch(a)})})}),this.on_node_addition.addListener((b)=>{a.is.E(b)&&c.on_element_addition.dispatch(b)}),this.on_node_removal.addListener((b)=>{a.is.E(b)&&c.on_element_removal.dispatch(b)})}}})(kk),(()=>{})(kk),((a)=>{var b={},c=document.querySelector('.layout-top-layer');if(!a.is.E(c))return void console.log('\u0412\u0435\u0440\u0445\u043D\u0438\u0439 \u0441\u043B\u043E\u0439 \u043D\u0435 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D');var d=document.querySelector('.layout-top-layer');if(!a.is.E(d))return void console.log('\u0421\u043B\u043E\u0439 \u0434\u043B\u044F \u043F\u0430\u043D\u0435\u043B\u0435\u0439 \u043D\u0435 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D');var e=document.querySelector('.layout-top-layer');return a.is.E(e)?void(b.show=function(){},a.toplayer=b):void console.log('\u0417\u0430\u0442\u0435\u043D\u044F\u044E\u0449\u0438\u0439 \u0441\u043B\u043E\u0439 \u043D\u0435 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D')})(kk);