UNPKG

d1-web

Version:

Lightweight responsive front-end framework

3 lines 93.4 kB
/*! d1-web v2.7.5 */ !function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function i(t,i,a){return i&&e(t.prototype,i),a&&e(t,a),t}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function n(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function s(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach((function(e){a(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,a=o(t);if(e){var n=o(this).constructor;i=Reflect.construct(a,arguments,n)}else i=a.apply(this,arguments);return h(this,i)}}function u(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return c(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")} /*! app - core of d1-web */()}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=new Array(e);i<e;i++)a[i]=t[i];return a}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var e=this;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null});var v=function(){function e(){t(this,e),this.sequence=0,this.plugins={},this.handlers={},this.opt={plug:{},debug:0,cAct:"act",cHide:"hide",cToggle:"toggle",cOff:"off",cClose:"close",cJs:"js",hClose:"#cancel",hOk:"#ok",sCancel:"Cancel",sOk:"OK"}}return i(e,[{key:"init",value:function(t){var e=this;document.body.classList.add(this.opt.cJs),this.fire("start"),t||(t=document.body.dataset.d1)&&(t=this.parse(t)),this.setOpt(t),this.dbg(["opt",this.opt]),this.fire("options"),this.initPlugins(),this.b([window],"hashchange",(function(t){return e.on("hashchange",t)})),this.b([document],["invalid","focus","blur"],(function(t){return e.on(t.type,t)}),!0),this.b([document],["click","keydown","input","change","submit"],(function(t){return e.on(t.type,t)})),location.hash&&this.on("hashchange"),this.fire("after"),this.fire("ready")}},{key:"on",value:function(t,e){this.fire("before",e),this.fire(t,e),this.fire("after",e)}},{key:"arrange",value:function(t){t&&this.fire("arrange",{n:t})}},{key:"setOpt",value:function(t){var e=this;t&&Object.keys(t).forEach((function(i){return e.opt[i]=t[i]}))}},{key:"plug",value:function(t,e){var i=new t;this.plugins[e||i.name]=i}},{key:"initPlugins",value:function(){var t=this;this.opt.disable&&this.opt.disable.forEach((function(e){return delete t.plugins[e]})),this.dbg(["plugins",this.plugins]),Object.keys(this.plugins).forEach((function(e){t.plugins[e].install(t),t.fire("plugin",{name:e,plugin:t.plugins[e]})})),this.fire("init"),this.fire("arrange"),this.fire("plugins")}},{key:"pf",value:function(t,e){for(var i,a=arguments.length,n=new Array(a>2?a-2:0),s=2;s<a;s++)n[s-2]=arguments[s];this.plugins[t]&&this.plugins[t][e]?(i=this.plugins[t])[e].apply(i,n):this.dbg(["no plugin function",t+"."+e+"()"],-1)}},{key:"toggle",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this.pf.apply(this,["toggle","toggle"].concat(e))}},{key:"fetch",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this.pf.apply(this,["fetch","fetch"].concat(e))}},{key:"dialog",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this.pf.apply(this,["dialog","openDialog"].concat(e))}},{key:"fire",value:function(t,e){var i,a=this;(e=null!==(i=e)&&void 0!==i?i:{}).type||(e.type=t),this.dbg(["fire "+t,e]),this.handlers[t]&&this.handlers[t].forEach((function(t){var i;return null!==(i=e)&&void 0!==i&&i.unfire?null:t.call(a,e)}))}},{key:"listen",value:function(t,e){this.h(t,"",e)}},{key:"h",value:function(t,e,i,a){var n=this;t instanceof Array?t.forEach((function(t){return n.h(t,e,i,a)})):(this.handlers[t]||(this.handlers[t]=[]),this.handlers[t][a?"unshift":"push"]((function(t){e&&(t.recv=t.target.closest?t.target.closest(e):null),e&&!t.recv||i(t)})))}},{key:"dispatch",value:function(t,e,i){i||(i={bubbles:!0,cancelable:!0,view:window}),"function"==typeof Event&&(e instanceof Array?e.forEach((function(e){return t.dispatchEvent(new Event(e,i))})):t.dispatchEvent(new Event(e,i)))}},{key:"isDebug",value:function(t){return this.opt.debug>(t||0)||-1!=location.href.indexOf("d1debug")}},{key:"dbg",value:function(t,e,i){this.isDebug(e)&&console[i||e<0?"error":"log"](t)}},{key:"seq",value:function(){return++this.sequence}},{key:"a",value:function(t){return t?Array.prototype.slice.call(t):t}},{key:"path",value:function(t,e,i){if(e){"string"===this.typeOf(e)&&(e=e.split("."));for(var a=0;a<e.length;a++)if(e[a]||0===e[a]){if(null===t||void 0===t[e[a]])return i;t=t[e[a]]}}return t}},{key:"q",value:function(t,e){try{return(e||document).querySelector(t)}catch(t){return null}}},{key:"qq",value:function(t,e){try{return this.a((e||document).querySelectorAll(t))}catch(t){return[]}}},{key:"next",value:function(t,e,i){for(;t=t[i?"previousElementSibling":"nextElementSibling"];)if(t.matches(e))return t}},{key:"nn",value:function(t){return t?"string"==typeof t?this.qq(t):t.tagName?[t]:this.a(t):[]}},{key:"b",value:function(t,e,i,a){e||this.e(t,i),i&&this.nn(t).forEach((function(t){return e instanceof Array?e.forEach((function(e){return t.addEventListener(e,(function(t){return i(t)}),a)})):t.addEventListener(e,(function(t){return i(t)}),a)}))}},{key:"e",value:function(t,e){var i=this;e&&this.nn(t).forEach((function(t){return e.call(i,t)}))}},{key:"ee",value:function(t,e,i){this.e(this.qq(e,t),i)}},{key:"cls",value:function(t,e,i,a){var n,s,r=this,o=a?[i,e]:[e,i];(o=o.map((function(t){return t&&"array"!==r.typeOf(t)?t.split(/\s+/).filter((function(t){return t})):t})))[1]&&(n=t.classList).remove.apply(n,u(o[1])),o[0]&&(s=t.classList).add.apply(s,u(o[0]))}},{key:"typeOf",value:function(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}},{key:"parse",value:function(t,e){var i="";try{i=JSON.parse(t)}catch(a){this.dbg(["JSON parse failed",t],-1),i=!0===e?t:void 0===e?null:e}return i}},{key:"ins",value:function(t,e,i,a,n){var s=document.createElement(t||"span");if("array"===this.typeOf(e)?e.forEach((function(t){return t.nodeType?s.appendChild(t):s.innerHTML+=t})):e&&e.nodeType?s.appendChild(e):e&&(s.innerHTML=e),i)for(var r in"string"===this.typeOf(i)&&(i={className:i}),i)null!==i[r]&&void 0!==i[r]&&(r.match(/-/)?s.setAttribute(r.replace(/^-/,""),i[r]):s[r]=i[r]);return a?n?a.parentNode.insertBefore(s,n<0?a:a.nextSibling):!1===n?a.insertBefore(s,a.firstChild):a.appendChild(s):s}},{key:"clr",value:function(t){if(t)for(;t.firstChild;)t.removeChild(t.firstChild)}},{key:"x",value:function(t,e,i){return this.ins("a",this.i("close","&#x2715;"),{href:this.opt.hClose,className:i||""},t,e)}},{key:"i",value:function(t,e){return this.plugins.icons?this.plugins.icons.i(t,e):this.ins("span",e||t)}},{key:"vis",value:function(t){return t&&!t.classList.contains(this.opt.cOff)}},{key:"fixIds",value:function(t){var e=this;this.ee(t,"[id]",(function(i){var a=i.id,n="id-"+e.seq();i.id=n,e.ee(t,'a[href="#'+a+'"]',(function(t){return t.href="#"+n})),e.ee(t,'label[for="'+a+'"]',(function(t){return t.htmlFor=n}))}))}}]),e}(),d=function(){function e(){t(this,e)}return i(e,null,[{key:"throttle",value:function(t,e){var i,a,n=!1;return function s(){n?(i=this,a=arguments):(t.apply(this,arguments),n=!0,setTimeout((function(){n=!1,a&&(s.apply(i,a),a=i=null)}),e))}}},{key:"delay",value:function(t,e,i){var a=null;return function(){var n=arguments,s=this;i&&a&&clearTimeout(a),a=setTimeout((function(){t.apply(s,n),a=null}),e)}}},{key:"debounce",value:function(t,i){return e.delay(t,i,!0)}}]),e}(),f=function(){function e(){t(this,e)}return i(e,null,[{key:"parse",value:function(t){var e,i="",a=(t||"").match(/^(\d+)([\-\.\/\s])(\d+)[\-\.\/\s](\d+)(\D(\d+))?(\D(\d+))?(\D(\d+))?(\D(\d+))?$/);a&&(e="."==a[2]?[4,3,1]:"/"==a[2]?[4,1,3]:[1,3,4],i=new Date(a[e[0]],a[e[1]]-1,a[e[2]],a[6]||0,a[8]||0,a[10]||0,a[12]||0));return i}},{key:"fmt",value:function(t,i,a){if(!t)return"";if("i"==a)return new Date(t-6e4*t.getTimezoneOffset()).toISOString().replace(/Z$/,"").substr(0,i?30:10);var n=t.getFullYear(),s=e.n(t.getMonth()+1),r=e.n(t.getDate()),o=e.n(t.getHours()),l=e.n(t.getMinutes()),h=e.n(t.getSeconds());return("m"==a?s+"/"+r+" "+n:"d"==a?r+"."+s+"."+n:n+"-"+s+"-"+r)+(i&&o+l+h>0?" "+e.n(t.getHours())+":"+e.n(t.getMinutes())+":"+e.n(t.getSeconds()):"")}},{key:"n",value:function(t,e){return("000"+t).substr(-(e||2))}}]),e}(),m=function(){function e(){t(this,e)}return i(e,null,[{key:"build",value:function(t,i){t=e.url2a(t);var a=e.get(!0,t);Object.keys(i).forEach((function(t){return a[encodeURIComponent(t)]=encodeURIComponent(i[t])}));var n=Object.keys(a).map((function(t){return t+"="+a[t]})).join("&");return t.host?t.protocol+"//"+t.host+t.pathname+(n?"?"+n:"")+t.hash:t.href.replace(/[\?#].*$/,"")+(n?"?"+n:"")+t.hash}},{key:"get",value:function(t){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!0===i&&(i=location.href),!i)return null;var a,n={},s=(i=e.url2a(i)).search?i.search.replace(/^\?/,"").split("&"):[];for(a=0;a<s.length;a++){var r=s[a].split("=");n[r[0]]=decodeURIComponent(r[1].replace(/\+/g," "))}return!0===t?n:n[t]}},{key:"url2a",value:function(t){if(t&&!t.tagName){var e=t;(t=document.createElement("a")).href=e}return t}}]),e}(),g=function(){function e(i){t(this,e),this.app=null,this.name=i||"plugin",this.opt={}}return i(e,[{key:"install",value:function(t){var e=this;t.opt.plug[this.name]||(t.opt.plug[this.name]={});var i=t.opt.plug[this.name];Object.keys(this.opt).forEach((function(t){return t in i?null:i[t]=e.opt[t]})),this.opt=i,this.app=t,this.app.listen("init",(function(t){return e.init()})),this.arrange&&this.app.listen("arrange",(function(t){return e.arrange(t)}))}},{key:"init",value:function(){console.log("plugin.init()")}}]),e}(),y={menu:[7,"M.5 1h6v1h-6zm0 2h6v1h-6zm0 2h6v1h-6z"],sort:[7,"M1 1h2v1h-2zm0 2h3.5v1h-3.5zm0 2h5v1h-5z"],more:[17,"M7 2h3v3h-3zm0 5h3v3h-3zm0 5h3v3h-3z"],grid:[7,"M1 1h2v2h-2zM4 1h2v2h-2zM1 4h2v2h-2zM4 4h2v2h-2z"],home:[10,"M1 4.8h1v4h2v-3h2v3h2v-4h1l-4-4z"],find:[12,"M5 1a4 4 0 1 0 .01 0zm0 1a3 3 0 1 1-.01 0m3 5l-1 1 3 3 1-1z"],config:[220,"M35 67l75 -44 75 44 0 89-75 44-75-44zm75 8a35 35 0 1 0 .01 0z"],close:[12,"M2 1l4 4 4-4 1 1-4 4 4 4-1 1-4-4-4 4-1-1 4-4-4-4z"],user:[10,"M5 9C13 -1.5 -3 -1.5 5 9zM1 8.5q4 1 8 0-4 -3 -8 0z"],exit:[10,"M1 1h4v1h-3v6h3v1h-4zm2 3h3v-2l3 3-3 3v-2h-3z"],key:[20,"M2 16l7-7v-4l3-3q7 0 7 7l-3 3h-4l-6 6h-4zm3 1h1l6-6h-1zm11-12a1.5 1.5 0 1 0 .01 .01z"],lock:[10,"M1.5 4h7v5h-7zm1 0c0-4 5-4 5 0h-1c0-3-3-3-3 0zm2 1v2h1v-2z"],edit:[10,"M7 1q1.6 .4 2 2l-5 5-3 1 1-3zM2.3 6.3l-.5 1.5.4.4 1.5-.5z"],add:[7,"M3 1h1v2h2v1h-2v2h-1v-2h-2v-1h2z"],delete:[20,"M5 3l5 5 5-5 2 2-5 5 5 5-2 2-5-5-5 5-2-2 5-5-5-5z"],ok:[100,"M10 48l11-9 18 22 40-50 11 9-51 65z"],up:[10,"M1 6l4-4 4 4-1 1-3-3-3 3z"],down:[10,"M1 4l4 4 4-4-1-1-3 3-3-3z"],left:[10,"M6 1l1 1-3 3 3 3-1 1-4-4z"],right:[10,"M4 1l4 4-4 4-1-1 3-3-3-3z"],asc:[12,"M2 7l-1-1 5-5 5 5-1 1 -3.25 -3.2v7h-1.5v-7z"],desc:[12,"M2 5l-1 1 5 5 5-5-1-1 -3.25 3.2v-7h-1.5v7z"],back:[12,"M7 2l-1-1 -5 5 5 5 1-1 -3.2 -3.25h7v-1.5h-7z"],forward:[12,"M5 2l 1-1 5 5 -5 5 -1-1 3.2 -3.25h-7v-1.5h7z"],upload:[10,"M1 8h8v1h-8zm1-4h2v3h2v-3h2l-3-3z"],download:[10,"M1 8h8v1h-8zm1-3.7h2v-3h2v3h2l-3 3z"],first:[12,"M2 2h1.5v8h-1.5zm2 4l6-4v8z"],last:[12,"M2 2v8l6-4zm6.5 0h1.5v8h-1.5z"],folder:[12,"M1 1.5h4l1 2h5v7h-10zm1 3v5h8v-5z"],open:[12,"M.5 1.5h4l1 2h6.3l-2.3 7h-9zm3 3l-2 5h7l2-5z"],file:[12,"M2 1h5l3 3v7h-8zm1 1v8h6v-6h-2v-2z"],attach:[15,"M4.5 11q0 3 3 3t3-3v-8q0-2-2-2t-2 2v7h1v-7q0-1 1-1t1 1v8q0 2-2 2t-2-2v-7h-1z"],audio:[19,"M8 14h-1v-10l8-2v10h-1v-6.5l-6 1.5za3 2 -20 1 1 0 -.01zm7-2a3 2 -20 1 1 0 -.01z"],video:[12,"M1 3h7v2l3-2v6l-3-2v2h-7z"],image:[12,"M1 2h10v8h-10zm1 1v5l3-3 2 2 1-1 2 2 v-5zm5.5 .5a1 1 0 1 0 .001 0z"],text:[12,"M2 1h5l3 3v7h-8zm1 1v8h6v-6h-2v-2zm1 4h4v1h-4zm0 2h4v1h-4z"],tree:[26,"M9 3h8v6h-3v3h8v5h2v6h-6v-6h2v-3h-6v3h2v6h-6v-6h2v-3h-6v3h2v6h-6v-6h2v-5h8v-3h-3z"],list:[7,"M1 1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1z M3 1h3v1h-3zm0 2h3v1h-3zm0 2h3v1h-3z"],link:[17,"M12 1h2l2 2v2l-4 4h-2l5-5-2-2-5 5v-2zm-5 7h-2l-4 4v2l2 2h2l4-4v-2l-5 5-2-2zm-1 4l-1-1 6-6 1 1z"],chart:[10,"M1 9v-3h2v3zm3 0v-5h2v5zm3 0v-7h2v7z"],no:[7,"M1 3h5v1h-5z"],ban:[20,"M10 2a8 8 0 1 0 .01 0m0 2a6 6 0 1 1 -.01 0zm-4.5 .5l-1 1 10 10 1-1z"],warning:[16,"M8 1.7l-7 12h14zm0 9a1 1 0 1 1-.01 0c-3-7 3-7 0 0z"],info:[20,"M10 2a8 8 0 1 0 .01 0zm-1 3h2v2h-2zm-1 4h3v5l1 1h-3v-5"],share:[22,"M6 8a3 3 0 1 0 .01 0zm10-5a3 3 0 1 0 .01 0zm0 10a3 3 0 1 0 .01 0zm-10-3v2l10 5v-2zv2l10-5v-2z"],world:[12,"M6 1.2a4.8 4.8 0 1 0 .01 0zm0 .8a4 4 0 1 1-.01 0za3 4 0 1 0 .01 0za2.2 4 0 1 1-.01 0za.5 4 0 1 0 .01 0zm4 4a4 .2 0 1 0 0 .01z"],flag:[10,"M2 1h1v1q2-1 3 0t3-0v4q-2 1-3 0t-3 0v3h-1z"],pin:[10,"M2 4a3 3 0 0 1 6 0q0 2 -3 5q-3-3-3-5zm3 -2a2 2 0 1 0 .01 0z"],date:[11,"M1 1.5h9v8h-9zm1 2v5h7v-5zm.5-3v2h1.5v-2zm4.5 0v2h1.5v-2z"],time:[24,"M12 1a10 10 0 1 1 -.01 0zm0 2a8 8 0 1 0 .01 0zm-1.2 1h2v6.5l3.5 3.5-1.5 1.5-4-4z"],refresh:[20,"M10 .3v3a7 7 0 1 0 7 7h-2a5 5 0 1 1-5-5v3l5-4z"],view:[12,"m1 6q5-6 10 0v1q-5 -6-10 0zm5-3a2.8 2.8 0 1 1 -.01 0zm0 1.8a1.1 1.1 0 1 0 .01 0z"],card:[14,"M1 3.5q0-1 1-1h10q1 0 1 1v7q0 1 -1 1h-10q-1 0-1-1zm1 0v1h10v-1zm0 3v4h10v-4z"],sum:[12,"M2.5 3v-1h7v1h-5l3 3-3 3h5v1h-7v-1l3-3z"],copy:[12,"M2 3 h1v7h5v1h-6zm2-2h6v8h-6zm1 1v6h4v-6z"],help:[18,"M9 2a7 7 0 1 0 .01 0zm-3 5q0-3 3-3t3 3c0 3-2 2-2 4h-2c0-3 2-2 2-4q0-1-1-1t-1 1zm3 4.5a1.3 1.3 0 1 1 -.01 0z"],phone:[13,"M3 1l2 3-1.2 1.2 4 4 1.2-1.2 3 2c-3 6 -15 -6 -9-9z"],mail:[14,"M1 2.5h12v9h-12zm1 1v1l5 3 5 -3v-1zm0 2v5h10v-5l-5 3z"],chat:[12,"M6 1.2a5 4 0 1 0 .01 0zm0 1a4 3 0 1 1-.01 0zm-3.8 5.5l-1 3 4-2z"],send:[12,"M1 2l10 4-10 4 1.5-3.6 6-.4-6-.4z"],bookmark:[8,"M4 5l-2 2v-6h4v6z"],star:[32,"M16 2 l9 28-23-18 28 0-23 18z"],heart:[6,"M3 2c2-2 4 1 0 3c-4-2-2-5 0-3z"],tag:[9,"M1 5.2l4-4h3v3l-4 4zm6-3.1a.6 .6 0 1 0 .01 .01z"],expand:[10,"M1 1h3v1h-2v2h-1zm5 0h3v3h-1v-2h-2zm2 5h1v3h-3v-1h2zm-7 0h1v2h2v1h-3z"],collapse:[10,"M4 4h-3v-1h2v-2h1zm2 0v-3h1v2h2v1zm0 2h3v1h-2v2h-1zm-2 0v3h-1v-2h-2v-1z"],box:[26,"M3 6l10-2.7 10 2.7-10 3zm-.8 1.2l10 3v13l-10-4zm21.6 0l-10 3v13l10-4z"],columns:[16,"M1.5 2.5h13v11h-13zm1 2v8h5v-8zm6 0v8h5v-8z"],storage:[14,"M1.5 4.5v-3h11v3zm0 4zv-3h11v3zm0 4zv-3h11v3zm8 -2v1h2v-1zm0-4v1h2v-1zm0-4v1h2v-1z"],settings:[11,"M1 2h9v1h-9zm0 3h9v1h-9zm0 3h9v1h-9zm2-7h1v3h-1zm4 3h1v3h-1zm-3 3h1v3h-1z"],power:[18,"M6 3a6.7 6.7 0 1 0 6 0v2a4.9 4.9 0 1 1 -6 0zm2-1.5h2v8h-2z"],energy:[11,"M5 1.5l-2 4h2l-2 5 5-6h-2l2-3z"],sound:[9,"M3 6h-2v-3h2l3-2v7zm3.7-3q2 1.5 0 3z"],mic:[20,"M7 5 a3 3 0 1 1 6 0v4a3 3 0 1 1 -6 0zm-2 4a5 5 0 1 0 10 0zm4 4v3h-3v2h8v-2h-3v-3z"],photo:[10,"M1 2.5h2l1-1h2l1 1h2v5h-8zm4 .5a1.8 1.8 0 1 0 .01 0z"],print:[10,"M1 2.5h2v-1h4v1h2v4h-8zm2 2l-1 4h6l-1-4zm4-1h1v-.5h-1z"],play:[12,"M3 2v8l7-4z"],pause:[9,"M2 2h2v5h-2zm3 0h2v5h-2z"],stop:[9,"M2 2h5v5h-5z"],rec:[10,"M5 2a3 3 0 1 0 .01 0z"],layers:[14,"M1 5.5l6-3 6 3-6 3zm0 3l2-1 4 2 4-2 2 1-6 3z"],none:[1,"M1 1z"]},k=function(e){r(n,e);var a=p(n);function n(){var e;return t(this,n),(e=a.call(this,"icons")).opt={cIcon:"icon",pIcon:"icon-",cEmpty:"empty",qReplace:".replace",re:{"+":["ok","y"],"-":["no","n"],x:["ban","e"],"!":["warning","w"],"?":["help","i"]},iconSize:24,pSvg:"icon-"},e.parsed={},e.icons=y,e}return i(n,[{key:"init",value:function(){var t=this;document.body.classList.add("js-icons"),this.app.listen("active",(function(e){return t.iconize(e.n,e.on)})),this.arrange({n:document.body})}},{key:"arrange",value:function(t){var e=this,i=t.n;i&&(this.app.ee(i,'[class*="'+this.opt.pIcon+'"]',(function(t){return e.iconize(t)})),this.app.ee(i,this.opt.qReplace,(function(t){return e.replace(t)})))}},{key:"iconize",value:function(t,e){var i=t.className.match(new RegExp("(?:^|\\s)"+(e?"(?:act-)":"")+this.opt.pIcon+"([\\w\\-_\\/]+)"));i&&(void 0===e||t.matches('[class*="act-"]'))&&(this.app.ee(t,"svg",(function(t){return t.parentNode.removeChild(t)})),this.addIcon(i[1],t))}},{key:"addIcon",value:function(t,e){var i=e.textContent,a=this.i(t);if(a){var n;e.classList.contains(this.opt.cEmpty)&&(this.app.clr(e),e.hasAttribute("title")||(e.title=i),e.classList.remove(this.opt.cEmpty)),e.firstChild&&!e.firstChild.tagName&&this.app.ins("span",e.firstChild,{},e,!1),e.insertBefore(a,e.firstChild);var s=e.className.match(/\bic_([\w\-_]+)\b/);s&&(n=a.classList).add.apply(n,u(s[1].split("_")))}}},{key:"i",value:function(t,e){var i=t.split(/[\/_]/);if(t=i[0],void 0===this.parsed[t]){var a,n="";if(!1!==this.opt.pSvg){var s=this.opt.pSvg+t,r=document.getElementById(s);r&&"symbol"==r.tagName.toLowerCase()&&(n='<svg><use xlink:href="#'+s+'"></use></svg>')}if(n||"string"!=typeof(n=this.icons[t]||"")&&(n='<svg viewBox="0 0 '+n[0]+" "+n[0]+'"><path d="'+n[1]+'"/></svg>'),n){var o=document.createElement("div");o.innerHTML=n,(a=o.firstChild).getAttribute("width")||a.setAttribute("width",this.opt.iconSize),a.getAttribute("height")||a.setAttribute("height",this.opt.iconSize),a.getAttribute("class")||a.setAttribute("class",this.opt.cIcon)}else a="";this.parsed[t]=a}return this.parsed[t]?this.prepareSvg(this.parsed[t].cloneNode(!0),i.slice(1)):e?this.app.ins("span",e):null}},{key:"prepareSvg",value:function(t,e){var i,a=e.filter((function(t){return t.match(/^\d+$/)})),n=e.filter((function(t){return t&&!t.match(/^\d+$/)}));return a.length&&t.classList.add("js-resized"),a[0]&&(t.style.width=a[0]+"px"),a[1]&&(t.style.height=a[1]+"px"),n.length&&(i=t.classList).add.apply(i,u(n)),t}},{key:"replace",value:function(t){var e=this;this.app.ee(t,"*",(function(i){return e.replaceItem(i,t)}))}},{key:"replaceItem",value:function(t,e){var i="innerText"in t&&!t.firstElementChild?t.innerText.replace(/^\s+|\s+$/g,""):"";if(1==i.length&&i in this.opt.re&&!("val"in t.dataset)){t.innerHTML="";var a=e.dataset[this.opt.re[i][1]]||this.opt.re[i][0];this.app.ins("",this.i(a,i),"text-"+this.opt.re[i][1],t),t.dataset.val=i}}}]),n}(g),b=function(e){r(n,e);var a=p(n);function n(){var e;return t(this,n),(e=a.call(this,"code")).langs={html:{nm:"HTML",re:[[/[a-z0-9_\-]+(?==")/g,"w"],[/".*?"/g,"e"],[/&lt;[^!A-Z][\s\S]*?&gt;/g,"i"],[/&lt;\![\s\S]*?&gt;/g,"n"]]},js:{nm:"JavaScript",re:[[/".*?"|'.*?'/g,"w"],[/(\b|\b\d+\.|\.)\d+\b/g,"e"],[/[{}()\[\]]/g,"y"],[/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|if|import|in|instanceof|new|return|super|switch|this|throw|try|typeof|var|void|while|with|yield|let|await|null|undefined|true|false|arguments|get|set|require)\b/g,"i"],[/\/\*[\s\S]*?\*\/|(\/\/|#\!)[^\n]*/g,"n"]]},css:{nm:"CSS",re:[[/".*?"|'.*?'/g,"w"],[/#[\w\-]+/g,"e"],[/[{}()]/g,"y"],[/\.[A-za-z][\w\-]*/g,"y"],[/((@\w+|\!important)|\b(none|inherit|initial|unset|attr|url|calc|var|rgba?|hsla?))\b/g,"i"],[/\/\*[\s\S]*?\*\//g,"n"]]}},e.opt={defLang:"html",qCode:".code"},e}return i(n,[{key:"init",value:function(){var t=this;this.app.e(this.opt.qCode,(function(e){return t.showCode(e)})),this.app.e('code[class*="language-"]',(function(e){return t.hiliteNode(e)})),this.app.listen("update",(function(e){return t.updateCode(e)}))}},{key:"updateCode",value:function(t){if(t.n){var e=t.n.closest(this.opt.qCode);e&&this.showCode(e)}}},{key:"showCode",value:function(t){var e=t.dataset.lang||this.opt.defLang,i=this.spaces(t.innerHTML);if(!t.vCode){var a=this.app.ins("div","",{classList:"bord"},t,1);a.appendChild(t),t.classList.add("pad");var n="code-"+this.app.seq();this.app.ins("div",this.app.ins("a",(this.langs[e]?this.langs[e].nm:e)||e,{className:"pad",href:"#"+n}),"-r bg small",a);var s=this.app.ins("pre","",{id:n,className:this.app.opt.cToggle+" "+this.app.opt.cOff+" fit pad"},a),r=this.app.ins("code","","language-"+e,s);t.vCode=r}t.vCode.innerHTML=this.hiliteText(i,e)}},{key:"spaces",value:function(t){return t.replace(/^\s*\r?\n|\s+$/g,"").replace(/\t/g," ")}},{key:"hiliteNode",value:function(t){t.innerHTML=this.hiliteText(this.spaces(t.textContent),this.app.a(t.classList).filter((function(t){return t.match(/language-/)}))[0].substr(9))}},{key:"hiliteText",value:function(t,e){var i=this,a=this.langs[e],n=this.app.ins("div");return n.textContent=t,t=n.innerHTML,a&&a.re&&a.re.forEach((function(e){return t=t.replace(e[0],(function(t){return i.token(e[1],t)}))})),t}},{key:"token",value:function(t,e){return"<Span Class = 'text-"+t+"'>"+e+"</Span>"}}]),n}(g),w=function(e){r(n,e);var a=p(n);function n(){var e;return t(this,n),(e=a.call(this,"toggle")).nEsc=0,e.opt={keepHash:!0,mediaSuffixes:["-mobile","-desktop"],dlgUnscroll:!0,qTrg:"[id].target",qPop:".pop>div[id]",qNav:".nav ul",qDlg:".dlg",qTab:".tabs+div>div[id]",qTre:"ul.tree ul",qDrw:".drawer[id]",qAccRoot:"ul.tree.accordion",qAcc:"ul.tree.accordion ul",qGal:".gal>a[id]",qSubMem:".tabs.mem+div>div[id], ul.mem:not(.nav) ul",qDrawer:".drawer[id]:not(.shift)",qTip:'[data-tip=""][title], .tip[title]',qModal:".gal>a[id], .dlg",qMassTgl:"a[data-nodes]:not([data-set])",cMem:"mem",cFade:"fade",cTarget:"target",cToggle:"toggle",hUnhash:"#_"},e}return i(n,[{key:"init",value:function(){var t=this,e=this.app;e.e("a[data-href]",(function(t){return t.href=t.dataset.href})),e.listen("before",(function(e){return"click"==(null==e?void 0:e.type)?t.beforeClick(e):null})),e.listen("keydown",(function(e){return t.onKey(e)})),e.listen("click",(function(e){return t.onClick(e)})),e.h("click",'a[href^="#"]',(function(e){return t.onClickHash(e)})),e.listen("hashchange",(function(e){return t.onHash(e)})),e.listen("esc",(function(e){return t.esc(e)})),e.listen("active",(function(e){return t.hiliteLink(e.n,e.on)})),e.h("click",this.opt.qMassTgl,(function(e){return t.massToggle(e.recv,e)})),e.listen("modal",(function(e){return t.modalStyle(e)}));var i=this.opt;this.opt.qTgl=this.opt.mediaSuffixes.concat([""]).map((function(t){return"."+e.opt.cToggle+t})).join(", "),this.opt.qUnpop=[i.qPop,i.qNav,i.qDlg,i.qDrw].join(", "),this.opt.qUnpopOn=[i.qPop,i.qNav,i.qDlg,i.qDrw].map((function(t){return t+":not(."+e.opt.cOff+")"})).join(", "),this.arrangeOnce()}},{key:"arrangeOnce",value:function(){var t=this,e=null,i=this.app,a=this.opt,n=[a.qTrg,a.qPop,a.qNav,a.qDlg,a.qTab,a.qTre,a.qDrw].join(", ");i.e(n,(function(e){return t.initToggler(e)})),this.opt.mediaSuffixes.forEach((function(e){return i.e(t.opt.qTrg+e,(function(i){return t.initToggler(i,e)}))})),i.e(this.opt.qMassTgl,(function(e){return i.e(e.dataset.nodes,(function(e){return t.initToggler(e,"",!0)}))})),i.ee(e,this.opt.qNav+", "+this.opt.qTre,(function(e){return t.attachSubNav(e)})),i.ee(e,this.opt.qGal+":last-child",(function(t){return i.x(t,1)})),i.ee(e,this.opt.qSubMem,(function(e){return e.classList.add(t.opt.cMem)})),i.ee(e,"[id]",(function(e){return t.restoreVisibility(e)})),i.ee(e,this.opt.qTab+":not(."+i.opt.cOff+") ~ [id]:not(."+i.opt.cOff+")",(function(e){return t.tgl(e,0)})),i.ee(e,this.opt.qTab+":first-of-type",(function(e){return i.qq(t.opt.qTab,e.parentNode).filter((function(t){return i.vis(t)})).length?null:t.tgl(i.q(i.q('a[href^="#"]',e.parentNode.previousElementSibling).hash),1)})),i.ee(e,"."+i.opt.cToggle+"[id]",(function(e){return t.hiliteLinks(e)})),i.ee(e,this.opt.qMassTgl,(function(e){return t.massToggle(e)}))}},{key:"arrange",value:function(t){var e=t.n;this.app.ee(e,this.opt.qTip,(function(t){t.setAttribute("data-tip",t.title.replace(/\s\s+/g,"\n")),t.removeAttribute("title")}))}},{key:"modalStyle",value:function(t,e){var i=document.body.classList.contains(this.opt.cFade),a=this.app.q(this.opt.qDlg+":not(."+this.app.opt.cOff+"), "+this.opt.qGal+'[id="'+location.hash.substr(1)+'"]');if(i!==!!a){var n=window.innerWidth-document.documentElement.clientWidth,s=document.body.style;document.body.classList[a?"add":"remove"](this.opt.cFade),this.opt.dlgUnscroll&&(s.overflow=a?"hidden":"",a&&s.paddingRight||(s.paddingRight=a?n+"px":"")),this.app.dbg(["modalStyle",a,s.paddingRight])}if(a&&null!=t&&t.show){var r=this.app.q('input:not([type="hidden"]), select, textarea, a.btn',a),o=this.app.q(":focus",a);r&&!o&&(this.app.dbg(["focus",a,r,o]),r.focus(),"text"==r.type&&r.select())}}},{key:"esc",value:function(t){this.app.dbg(["esc",t]),t&&t.preventDefault&&t.preventDefault(),this.unpop(),this.addHistory(),this.app.fire("modal",{n:null,src:"esc",show:!1})}},{key:"addHistory",value:function(t){t?history.pushState({},"",t):location.hash&&(location.hash=this.opt.hUnhash,location.hash&&history.replaceState({},"",location.pathname+location.search))}},{key:"onKey",value:function(t){var e=t.keyCode;this.app.dbg(["keydown",e,this.nEsc]),27==e&&this.nEsc>=4&&localStorage.clear(),27==e&&this.app.fire("esc",t),this.nEsc=27==e&&this.nEsc<4?this.nEsc+1:0}},{key:"onHash",value:function(t){var e;if(null===(e=t?t.newURL:location.hash)||void 0===e||!e.match(new RegExp(this.opt.hUnhash+"$")))if(this.app.dbg(["hashchange",location.hash,null==t?void 0:t.newURL]),this.nEsc=0,location.hash&&location.hash!==this.app.opt.hClose)if("#unstore"===location.hash)localStorage.clear();else{var i=this.app.q(location.hash);if(i)i.matches(this.opt.qTgl)&&(this.unpop(),this.toggle(i,!0),this.opt.keepHash||this.addHistory());this.app.fire("modal",{n:i,src:"#",show:null})}else this.app.fire("esc",t)}},{key:"beforeClick",value:function(t){if(location.hash){var e=this.app.q(location.hash);(!e||e.matches(this.opt.qUnpopOn)&&!e.contains(t.target))&&this.addHistory()}this.unpop(t.target,!0)}},{key:"onClickHash",value:function(t){var e=t.recv;if(e&&e.hash===this.app.opt.hClose){t.preventDefault();var i=e.closest(this.opt.qTgl);this.app.dbg(["close",this.opt.qTgl,e,i]),i?(this.tgl(i,!1),this.addHistory(),i.matches(this.opt.qModal)&&this.app.fire("modal",{n:i,src:"x",show:!1})):this.app.fire("esc",t)}else{var a=this.app.q(e.hash);a&&a.matches(this.opt.qTgl)&&(t.preventDefault(),a=this.toggle(a),this.app.vis(a)&&this.opt.keepHash?this.addHistory(e.hash):this.addHistory());var n=t.recv.closest(this.opt.qUnpopOn);a&&n&&!n.contains(a)&&this.toggle(n,!1)}}},{key:"onClick",value:function(t){this.nEsc=0}},{key:"initToggler",value:function(t,e,i){t.classList.remove(this.opt.cTarget+(e||"")),t.classList.add(this.app.opt.cToggle+(e||"")),i||this.tgl(t,0)}},{key:"attachSubNav",value:function(t){var e=this.app.a(t.parentNode.children).filter((function(t){return"A"==t.tagName})),i=e.filter((function(t){return!t.href}))[0]||e[0]||this.app.ins(""," ",{},t.parentNode,!1)&&this.app.ins("a",this.app.i("toggle","[+]"),{},t.parentNode,!1);i&&(t.id||(t.id="ul-"+this.app.seq()),i.href="#"+t.id)}},{key:"toggle",value:function(t,e,i,a){var n=t?t.tagName?t:this.app.q(t):null;if(n){if(n.matches(this.opt.qTab)&&void 0===e&&(e=!0),this.app.fire("beforetoggle",{n:n,on:e,deep:i}),this.tgl(n,e),this.app.dbg(["toggle"+(i?" deep":""),e,n],i?2:1),this.app.vis(n)&&this.fixPosition(n),-1!=i&&(i||(this.toggleDependent(n),a&&this.opt.keepHash&&(n.id=a,this.addHistory("#"+a))),this.storeVisibility(n),!i&&n.matches(this.opt.qModal))){var s=void 0===e?this.app.vis(n):e;this.app.fire("modal",{n:n,src:"toggle",show:s})}this.app.fire("aftertoggle",{n:n,on:e,deep:i})}return n}},{key:"tgl",value:function(t,e){var i;t&&t.classList[e?"remove":void 0===e?"toggle":"add"](this.app.opt.cOff),this.hiliteLinks(t),e=null!==(i=e)&&void 0!==i?i:this.app.vis(t),this.app.fire("toggle",{n:t,on:e})}},{key:"toggleDependent",value:function(t){var e=this;this.app.vis(t)&&(t.matches(this.opt.qDlg)||(t.matches(this.opt.qTab)?this.app.e(t.parentNode.children,(function(i){return i==t?null:e.toggle(i,!1,1)})):t.matches(this.opt.qAcc)&&this.app.ee(t.closest(this.opt.qAccRoot),this.opt.qAcc,(function(i){return i.contains(t)?null:e.toggle(i,!1,1)}))))}},{key:"massToggle",value:function(t,e){var i=this;e&&e.preventDefault();var a=this.app.vis(this.app.q(t.dataset.nodes));e&&(a=!a),this.app.fire("active",{n:t,on:a}),e&&(this.app.qq(t.dataset.nodes).forEach((function(t){return i.toggle(t,a)})),this.addHistory())}},{key:"unpop",value:function(t,e){var i=this,a=[t];if(t){var n=t.closest("a");n&&n.hash&&a.push(this.app.q(n.hash))}this.app.dbg(["unpop",a]);var s=this.app.qq(this.opt.qUnpopOn).filter((function(t){return!(a&&a.filter((function(e){return e&&e.tagName&&t.contains(e)})).length)}));e||(s=s.filter((function(t){return!i.app.q(i.opt.qUnpopOn,t)}))),s=s.filter((function(t){return!i.containsRels(t)})),this.app.e(s,(function(t){return i.toggle(t,!1,!e)}))}},{key:"containsRels",value:function(t){return this.app.qq(this.opt.qUnpopOn).map((function(t){return t.vRel})).filter((function(t){return t})).filter((function(e){return t.contains(e)})).length}},{key:"storeVisibility",value:function(t){t&&t.id&&t.classList.contains(this.opt.cMem)&&localStorage.setItem("vis#"+t.id,this.app.vis(t)?1:-1)}},{key:"restoreVisibility",value:function(t){if(t&&t.id&&t.classList&&t.classList.contains(this.opt.cMem)){var e=localStorage.getItem("vis#"+t.id);e&&this.toggle(t,e>0,-1)}}},{key:"hiliteLinks",value:function(t){var e=this,i=this.app.vis(t);t.id&&this.app.e('a[href="#'+t.id+'"]',(function(t){return e.app.fire("active",{n:t,on:i})}))}},{key:"hiliteLink",value:function(t,e){t.classList[e?"add":"remove"](this.app.opt.cAct),this.app.cls(t,t.dataset.act,t.dataset.inact,!e)}},{key:"fixPosition",value:function(t){var e=t.matches(this.opt.qNav),i=e?window.getComputedStyle(t.parentNode.parentNode):null,a=!!i&&"flex"!=i.display;if(t.matches(this.opt.qPop)||e){var n=t.style,s=t.parentNode,r=s.nextElementSibling,o=(r=r&&"INPUT"==r.tagName?r:null)||t.parentNode;if(o){var l=document.documentElement.clientWidth;n.right="auto",n.left=a?"100%":0,n.top=a?0:"100%";var h=t.getBoundingClientRect(),p=o.getBoundingClientRect(),u=h.right>l,c=h.bottom>window.innerHeight,v=p.width>300;a?n.left=u||v?"3em":"100%":u&&h.width>p.width&&p.right>h.width?n.left=p.width-h.width+"px":n.left=0,a?n.top=u||v?"90%":0:c&&p.top>h.height?n.top=(r?-p.height:0)-h.height+"px":n.top="100%",r&&(s.style.verticalAlign="bottom")}}}}]),n}(g),q=function(e){r(n,e);var a=p(n);function n(){var e;return t(this,n),(e=a.call(this,"form")).opt={},e}return i(n,[{key:"init",value:function(){var t=this;this.app.h("click",'a[href^="#"][data-value]',(function(e){e.preventDefault(),t.setValue(e.recv)})),this.app.h("click","input[data-group]",(function(e){return t.checkBoxes(e.target)}))}},{key:"arrange",value:function(t){var e=this,i=t.n;i||(this.app.ee(i,"form[data-q]",(function(t){return e.initValues(t,t.dataset.q)})),this.app.ee(i,"[name][data-q]",(function(t){return e.initValue(t,t.dataset.q)}))),this.app.ee(i,'input[type="color"]',(function(t){return e.prepareColor(t)}))}},{key:"initValues",value:function(t,e){var i=this;this.app.ee(t,"[name]",(function(t){return i.initValue(t,e?e+"["+t.name+"]":t.name)}))}},{key:"initValue",value:function(t,e){if(e){var i,a=m.get(e);if(void 0!==a)"checkbox"==t.type?t.checked=a&&"0"!==a:"radio"==t.type?t.checked=a&&t.value===a:null!==(i=t.type)&&void 0!==i&&i.match(/^date/)?t.value=f.fmt(f.parse(a),t.type.match(/^datetime/),"i"):t.value=a}}},{key:"checkBoxes",value:function(t){var e=this;this.app.ee(t.form,'input[type="checkbox"]',(function(i){i.classList.contains(t.dataset.group)&&(i.checked=t.checked,e.app.dispatch(i,["input","change"]))}))}},{key:"setValue",value:function(t){var e=this.app.q(t.hash);e&&(e.value=t.dataset.value||"",this.app.dispatch(e,["input","change"]),this.app.pf("toggle","unpop",e,!0))}},{key:"prepareColor",value:function(t){if(!t.dataset.ready){t.dataset.ready=1;var e=this.app.ins("input","",{type:"text",value:t.value,size:7,className:"color"},t,-1);this.app.ins(""," ",{},e,1),this.app.b([t,e],"input",(function(i){return(i.target==t?e:t).value=i.target.value}))}}}]),n}(g),C=function(e){r(n,e);var a=p(n);function n(){var e;return t(this,n),(e=a.call(this,"calendar")).opt={cBtn:"pad hover",dateFormat:"d",hCancel:"#close",hNow:"#now",addIcons:[["date","#","#open"],["ok","&check;","#now"],["delete","&#x2715;","#clear"]],idPicker:"pick-date",minWidth:801,minWidthDropdown:801,qsCalendar:"input.calendar",showModal:0,stepMinutes:1,inPop:0},e.win=null,e}return i(n,[{key:"init",value:function(){var t=this;this.win=this.app.ins("div","",{id:this.opt.idPicker,className:this.app.opt.cToggle+" "+this.app.opt.cOff+" pad"}),this.win.style.whiteSpace="nowrap",document.body.appendChild(this.win),this.app.h("click",this.opt.qsCalendar,(function(e){return t.openDialog(e.target,null,e)})),this.app.h("input",this.opt.qsCalendar,(function(e){return t.validate(e.target,0)})),this.app.h("click","#"+this.opt.idPicker+" a",(function(e){return t.onClick(e)})),this.app.h("click",".calendar-tools a",(function(e){return t.onClick(e,!0)}))}},{key:"arrange",value:function(t){var e=this,i=t.n;window.innerWidth>=this.opt.minWidth&&this.app.ee(i,this.opt.qsCalendar,(function(t){return e.prepare(t)}))}},{key:"onClick",value:function(t,e){var i=t.recv,a=i.hash;if(a){var n,s=this.opt.qsCalendar;if(e)n=this.opt.inPop?this.app.q(s,this.app.next(i.parentNode,".pop",!0)):this.app.next(i.parentNode,s,!0);else if(this.win.vRel)n=this.win.vRel;else{var r=i.closest("#"+this.opt.idPicker);n=this.opt.inPop?this.app.next(r,s,!0):this.app.next(r.parentNode,s)}var o=this.win.vCur,l="#prev-year"==a?-1:"#next-year"==a?1:0,h="#prev-month"==a?-1:"#next-month"==a?1:0,p="#prev-hour"==a?-1:"#next-hour"==a?1:0,u="#prev-min"==a?-this.opt.stepMinutes:"#next-min"==a?this.opt.stepMinutes:0;l||h?this.switchMonths(n,o.getFullYear()+l,o.getMonth()+h,o.getDate()):p||u?this.setTime(n,p,u):a==this.opt.hNow?this.closeDialog(n,!0):a==this.opt.hCancel?this.closeDialog(n,null):"#open"==a?this.openDialog(n,null):"#clear"==a?this.closeDialog(n,""):a.match(/#\d\d?/)&&this.closeDialog(n,this.fmt(o,a.substr(1))),t.preventDefault(),t.stopPropagation()}}},{key:"toggle",value:function(t,e){if(e){var i=e.dataset.mode;if(i=i?"m"===i[0]:this.opt.showModal||Math.min(window.innerWidth,window.innerHeight)<this.opt.minWidthDropdown,t){if(this.win.className=this.app.opt.cToggle+" "+this.app.opt.cOff+" pad "+(i?"dlg":""),(i?document.body:this.opt.inPop?e.parentNode:e.previousElementSibling).appendChild(this.win),i){var a=this.win.style;a.left=a.right=a.top=a.bottom=""}this.win.vRel=e}}this.app.toggle(this.win,t),t||document.body.appendChild(this.win)}},{key:"prepare",value:function(t){if(!t.dataset.ready){t.dataset.ready=1,t.dataset.tm="datetime-local"==t.type||t.classList.contains("datetime")?"1":"",t.type="text",t.autocomplete="off",t.value&&(t.value=t.defaultValue=this.fmt(this.parse(t.value),0,t.dataset.tm));var e=this.app.ins("div","","pop l",t,-1);if(this.opt.inPop||(e.style.verticalAlign="bottom"),this.opt.addIcons.length>0){var i=this.app.ins("span","","input-tools calendar-tools nobr",t,1);for(var a in this.opt.addIcons){var n=this.opt.addIcons[a];this.app.ins(""," ",{},i),this.app.ins("a",this.app.i.apply(this.app,n.slice(0,2)),{href:n[2],className:"let"},i)}}this.opt.inPop&&e.appendChild(t)}}},{key:"openDialog",value:function(t,e,i){t.dataset.ready&&(i&&i.preventDefault(),this.build(t,e||t.value),this.toggle(!0,t))}},{key:"closeDialog",value:function(t,e){t&&(this.setValue(t,e),t.focus()),this.toggle(!1)}},{key:"n",value:function(t,e){return("000"+t).substr(-(e||2))}},{key:"getLimit",value:function(t,e,i){return t[e]?this.fmt(this.parse(t[e]),0,i,"y"):"max"==e?"9999":"0000"}},{key:"errLimits",value:function(t){var e=this.getLimit(t,"min",t.dataset.tm),i=this.getLimit(t,"max",t.dataset.tm),a=this.fmt(this.parse(t.value),0,t.dataset.tm,"y");return e&&a<e||i&&a>i?e+" .. "+i:""}},{key:"validate",value:function(t,e){t.setCustomValidity(e||""==t.value?"":this.errLimits(t)),t.checkValidity(),t.reportValidity&&t.reportValidity()}},{key:"update",value:function(t,e){var i=this.win.vDays;this.app.clr(i);var a=e.getFullYear(),n=e.getMonth(),s=e.getDate(),r=this.getLimit(t,"min",0),o=this.getLimit(t,"max",0);this.win.vNodeCur.textContent=this.n(n+1)+"."+a,this.win.vHours.textContent=this.n(t.dataset.tm?e.getHours():0),this.win.vMinutes.textContent=this.n(t.dataset.tm?e.getMinutes():0);for(var l,h,p,u,c,v,d=new Date(a,n+1,0).getDate(),f=(new Date(a,n,1).getDay()+6)%7,m=7*Math.ceil((f+d)/7)-f,g=1-f;g<=m;g++)1==(c=(f+g-1)%7+1)&&(v=this.app.ins("div","","row",i)),g<1||g>d?l=this.app.ins("a","","pad c center",v):(h=this.fmt(e,g,0,"y"),p=g==s,!1,u=r&&h<r||o&&h>o,l=this.app.ins("a",g,"pad c center "+(p?"bg-w ":"")+(u?"text-n ":"hover ")+(c>5?"text-e ":""),v),u||(l.href="#"+g));this.win.vNodeTime.classList[t.dataset.tm?"remove":"add"](this.app.opt.cHide)}},{key:"build",value:function(t,e){var i=this.app;if("string"==typeof e&&(e=this.parse(e||t.dataset.def||"")),this.win.vCur=e,!this.win.vDays){i.clr(this.win);var a=i.ins("p","","c",this.win);this.btn(this.opt.hNow,"ok","&check;",a),this.btn("#prev-year","prev2","&laquo;",a),this.btn("#prev-month","prev","&lsaquo;",a),this.win.vNodeCur=i.ins("span","","pad",a),this.btn("#next-month","next","&rsaquo;",a),this.btn("#next-year","next2","&raquo;",a),this.btn(this.opt.hCancel,"close","&#x2715;",a),i.ins("hr","",{},this.win),this.win.vDays=i.ins("div","",{},this.win);var n=i.ins("div","",{},this.win);this.win.vNodeTime=n,i.ins("hr","",{},n);var s=i.ins("p","","c",n);this.btn("#prev-hour","prev","&lsaquo;",s),this.win.vHours=i.ins("span","","pad",s),this.btn("#next-hour","next","&rsaquo;",s),i.ins("span",":","pad",s),this.btn("#prev-min","prev","&lsaquo;",s),this.win.vMinutes=i.ins("span","","pad",s),this.btn("#next-min","next","&rsaquo;",s)}this.update(t,e)}},{key:"switchMonths",value:function(t,e,i,a){if(a>28){var n=new Date(e,i+1,0).getDate();a=Math.min(a,n)}var s=parseInt(this.win.vHours.textContent,10),r=parseInt(this.win.vMinutes.textContent,10);this.build(t,new Date(e,i,a,s,r))}},{key:"setTime",value:function(t,e,i){var a=e||i,n=e?24:60,s=this.win[e?"vHours":"vMinutes"],r=parseInt(s.textContent,10),o=r%Math.abs(a);r+=o?a>0?a-o:-o:n+a,s.textContent=this.n(r%n),this.setValue(t,this.fmt(this.parse(t.value)))}},{key:"setValue",value:function(t,e){if(null!==e){t.value=!0===e?this.fmt(0,0,t.dataset.tm):e;var i=this.win.vHours,a=this.win.vMinutes;t.dataset.tm&&!0!==e&&""!==e&&i&&a&&(t.value+=" "+this.n(i.textContent)+":"+this.n(a.textContent)),this.app.dispatch(t,["input","change"]),this.validate(t,0)}}},{key:"parse",value:function(t){return f.parse(t)||new Date}},{key:"fmt",value:function(t,e,i,a){return t||(t=new Date),e&&(t=new Date(t.getFullYear(),t.getMonth(),e)),f.fmt(t,i,a||this.opt.dateFormat)}},{key:"btn",value:function(t,e,i,a){return i=this.app.i(e,i),this.app.ins("a",i,{href:t,className:this.opt.cBtn},a)}}]),n}(g),z=function(e){r(n,e);var a=p(n);function n(){var e;return t(this,n),(e=a.call(this,"lookup")).opt={cacheLimit:0,pList:"lookup-list-",max:10,wait:300,inPop:0},e.win=null,e}return i(n,[{key:"init",value:function(){var t=this,e=this.app;this.win=e.ins("div","",{id:this.opt.pList+e.seq(),className:e.opt.cToggle+" "+e.opt.cOff}),this.closeList(),document.body.appendChild(this.win);var i=d.debounce(this.find.bind(this),this.opt.wait);e.h("input",".lookup-input",i),e.h("keydown",".lookup-input",(function(e){return t.key(e)})),e.h("click",".lookup-item",(function(e){return t.choose(e)})),e.h("click",".lookup-goto",(function(e){return t.go(e)})),e.h("change","[data-chain]",(function(e){return t.updateChain(e.target)}))}},{key:"arrange",value:function(t){var e=this,i=t.n;this.app.ee(i,"input[data-lookup]",(function(t){return e.prepare(t)})),this.app.ee(i,"[data-chain]",(function(t){return e.updateChain(t)}))}},{key:"prepare",value:function(t){if(!t.dataset.ready){t.dataset.ready=1;var e=this.app;t.vLabel="label"in t.dataset?t.dataset.label:t.value||"";var i=e.ins("div","","pop l lookup-pop",t,1);this.opt.inPop||(i.style.verticalAlign="bottom"),t.classList.add("bg-n","lookup-id"),t.classList.add(e.opt.cHide);var a=e.ins("input","",{type:"text",value:t.vLabel,className:"lookup-input subinput"},i,this.opt.inPop?0:1);a.name="lookup-"+t.name,t.id&&(a.id="lookup-"+t.id,t.title&&(a.title=t.title),e.e('[for="'+t.id+'"]',(function(t){return t.htmlFor=a.id}))),t.placeholder&&(a.placeholder=t.placeholder),a.autocomplete="off";if("url"in t.dataset){var n=e.ins("span","","input-tools nobr",this.opt.inPop?i:a,1);e.ins("a",e.i("forward","&rarr;"),{href:"#goto",className:"let lookup-goto"},n).style.cursor="pointer",e.ins(""," ",{},n,-1)}this.initCaption(t)}}},{key:"initCaption",value:function(t){var e=this,i=t.dataset.cap||"";if(i&&t.value&&!("label"in t.dataset)){var a=encodeURI(decodeURI(m.build(i,{time:(new Date).getTime()})).replace(/\{q\}/,t.value));this.app.fetch(a,(function(i){var n=e.app.parse(i.responseText);if(n){var s=a.split("#");!s[1]&&n.data&&(n=n.data),e.fix(t,t.value,e.app.path(n,s[1]||"",t.value))}}))}}},{key:"ident",value:function(t,e){return"t"==e||"i"!=e&&!this.opt.inPop||(t=t.closest(".lookup-pop")),this.app.next(t,".lookup-id",!0)}},{key:"cap",value:function(t){return this.opt.inPop?this.app.q(".lookup-input",this.pop(t)):this.app.next(t,".lookup-input")}},{key:"pop",value:function(t){return this.app.next(t,".lookup-pop")}},{key:"find",value:function(t){var e=t.target,i=this.ident(e);if(i){var a=e.value;if(""===a)this.fix(i,"","");else if(i.vCache&&i.vCache[a])this.openList(i,i.vCache[a]);else{var n=encodeURI(decodeURI(m.build(i.dataset.lookup||"",{time:(new Date).getTime()})).replace(/\{q\}/,a));i.vCur=null,this.app.fetch(n,this.list.bind(this,n,a,i))}}}},{key:"list",value:function(t,e,i,a){var n=this.app.parse(a.responseText);if(n){var s=t.split("#");!s[1]&&n.data&&(n=n.data),n=this.norm(this.app.path(n,s[1]||"",[]),s[2],s[3],s[4]),e===this.cap(i).value&&this.openList(i,n),this.store(i,e,n)}}},{key:"openList",value:function(t,e,i){this.closeList(),this.pop(t).appendChild(this.win),this.app.toggle(this.win,!0),this.build(t,e)}},{key:"closeList",value:function(){this.app.toggle(this.win,!1)}},{key:"build",value:function(t,e){var i=this.app;i.clr(this.win);var a,n=i.ins("ul","","nav let hover",this.win),s=0,r=t.dataset.goto||"";for(var o in e){a=i.ins("li","",{},n);var l=i.ins("a","",{href:r?r.replace(/\{id\}/,e[o].id):"#"+e[o].id,className:"-pad -hover"+(r?"":" lookup-item")},a);if(i.ins("span",e[o].nm,{},l),e[o].info&&(i.ins("br","",{},l),i.ins("small",e[o].info,"text-n",l)),++s>=this.opt.max)break}n.firstChild&&this.hilite(t,n.firstChild.firstChild)}},{key:"hilite",value:function(t,e){t.vCur&&t.vCur.classList.remove(this.app.opt.cAct),e.classList.add(this.app.opt.cAct),t.vCur=e}},{key:"hiliteNext",value:function(t,e){if(t.vCur){var i=t.vCur.parentNode[e?"previousSibling":"nextSibling"];i||(i=t.vCur.parentNode.parentNode[e?"lastChild":"firstChild"]),i=i.firstChild,this.hilite(t,i)}}},{key:"choose",value:function(t){t&&t.preventDefault();var e=t.recv,i=this.ident(e,"i");i.vCur=e,this.fix(i,e.hash.substr(1),e.firstChild.textContent)}},{key:"fix",value:function(t,e,i){t.vCur=null,t.value=e,t.vLabel=this.cap(t).value=i,this.app.dispatch(t,["input","change"]),this.closeList()}},{key:"key",value:function(t){var e=t.target?this.ident(t.target):null;e&&(27==t.keyCode?this.fix(e,e.value,e.vLabel||""):40!=t.keyCode||this.app.vis(this.win)?38==t.keyCode||40==t.keyCode?this.hiliteNext(e,38==t.keyCode):13==t.keyCode&&e.vCur&&(this.app.vis(this.win)&&t.preventDefault(),e.vCur.click()):this.find(t))}},{key:"go",value:function(t){var e=t.recv?this.ident(t.recv.parentNode,"t"):null;if(e){t.preventDefault();var i=e.dataset.url||"";e.value.length>0&&i&&(location.href=encodeURI(decodeURI(i).replace(/\{id\}/,e.value)))}}},{key:"updateChain",value:function(t){var e=this.app.q(t.dataset.chain||"");if(e)if(t.value){var i=(e.dataset.list||"").replace(/\{q\}/,t.value);e.vCache&&e.vCache[i]?this.setOptions(e,e.vCache[i]):this.app.fetch(i,this.onChainData.bind(this,i,e))}else this.setOptions(e,[])}},{key:"onChainData",value:function(t,e,i){var a=this.app.parse(i.responseText);if(a){var n=t.split("#");!n[1]&&a.data&&(a=a.data),a=this.norm(this.app.path(a,n[1]||"",[]),n[2],n[3]),this.setOptions(e,a),this.store(e,t,a)}else this.setOptions(e,[])}},{key:"setOptions",value:function(t,e){var i=this;if(t.list)t.list&&(this.app.clr(t.list),t.value="",e&&e.forEach((function(e){return i.app.ins("option","",{value:e.nm},t.list)})));else{this.app.clr(t);var a=t.dataset.placeholder||"";e&&0!=e.length&&!a||this.app.ins("option",a||"-",{value:""},t),e&&e.forEach((function(e){return i.app.ins("option",e.nm,{value:e.id},t)}))}}},{key:"store",value:function(t,e,i){var a=1*(t.dataset.cache||this.opt.cacheLimit);a&&((!t.vCache||Object.keys(t.vCache).length>=a)&&(t.vCache={}),i&&(t.vCache[e]=i))}},{key:"norm",value:function(t,e,i,a){var n=this;return"array"!==this.app.typeOf(t)?[]:t.map((function(t){var s,r;return{id:n.app.path(t,e||"id"),nm:i?n.app.path(t,i):null!==(s=null!==(r=t.name)&&void 0!==r?r:t.nm)&&void 0!==s?s:t.title,info:n.app.path(t,a||"info")}}))}}]),n}(g),x=function(e){r(n,e);var a=p(n);function n(){var e;return t(this,n),(e=a.call(this,"edit")).opt={qAdjust:"textarea.adjust",qEdit:"textarea.edit",height:30,tools:"/*@xbi_.#123p|c,s^vdqf~T(=)j+-"},e.btn={"/":["src","","/","Source"],"*":["insertimage","~","*","Image"],"@":["createlink","~","@","Link"],x:["unlink","","&times;","Unlink"],b:["bold","","<b>B</b>","Bold"],i:["italic","","<i>I</i>","Italic"],_:["removeformat","","_","Unformat"],".":["insertUnorderedList","","&bull;","List"],"#":["insertOrderedList","","#","Ordered"],1:["formatblock","<h1>","H1","Head 1"],2:["formatblock","<h2>","H2","Head 2"],3:["formatblock","<h3>","H3","Head 3"],p:["formatblock","<p>","&sect;","Paragraph"],"|":["tools","","&hellip;","Tools"],c:["inserthtml","<code>^</code>","{}","Code"],",":["inserthtml",'<abbr title="~">^</abbr>',"A.B.","Abbreviation"],s:["strikeThrough","","<s>S</s>","Strike through"],"^":["subscript","","a<sub>x</sub>","Subscript"],v:["superscript","","a<sup>x</sup>","Superscript"],d:["formatblock","<div>","D","Div"],q:["formatblock","<blockquote>","&#8220;","Block quote"],f:["formatblock","<pre>","[]","Preformatted"],"~":["inserthorizontalrule","","&minus;","Horizontal ruler"],T:["inserthtml","<table><tr><th>#<th>#<tr><td>-<td>-</table>","T","Table"],"(":["justifyLeft","","&lt;","Justify left"],"=":["justifyCenter","","=","Justify center"],")":["justifyRight","","&gt;","Justify right"],j:["justifyFull","","&equiv;","Justify full"],"+":["indent","","&raquo;","Increase indent"],"-":["outdent","","&laquo;","Decrease indent"]},e}return i(n,[{key:"init",value:function(){var t=this,e=this.app;e.h("click","label[for]",(function(e){return t.setFocus(e.recv)})),e.h("click","a[data-cmd]",(function(e){return t.cmd(e)})),e.h(["input","blur"],".edit-wysiwyg",(function(e){return t.up(0,e.target)})),e.listen("value",(function(e){if(e.n.matches(t.opt.qEdit)){var i=t.getWys(e.n);i&&(t.up(1,i),e.modeAuto&&t.modeAuto(e.n))}})),e.b([window],"paste",(function(e){return t.onPaste(e)}),!0),e.h("input",this.opt.qAdjust,(function(e){return t.adjust(e.target)})),e.b([window],"mouseup",(function(e){var i,a;return null!==(i=(a=e.target).matches)&&void 0!==i&&i.call(a,t.opt.qAdjust)?t.resized(e.target):null})),e.b([window],"resize",(function(e){return t.adjustAll()}))}},{key:"arrange",value:function(t){var e=this,i=t.n;this.app.ee(i,this.opt.qEdit,(function(t){return e.prepare(t)})),this.app.ee(i,this.opt.qAdjust,(function(t){return e.setStyle(t)})),this.adjustAll(i)}},{key:"setFocus",value:function(t){var e=this.app.q("#"+t.htmlFor),i=e?this.getWys(e):null;i&&this.app.vis(i)&&i.focus()}},{key:"prepare",value:function(t){if(!t.dataset.ready){t.dataset.ready=1;var e=this.app,i=e.ins("nav","","bg",t,-1),a=e.ins("div","",{className:e.opt.cToggle+" "+e.opt.cOff}),n=e.ins("div","",{className:e.opt.cToggle+" bord pad subinput edit-wysiwyg"},t,1);n.setAttribute("contenteditable",!0),t.classList.add(e.opt.cToggle),t.id&&(n.id="wys-"+t.id);var s=(t.dataset.tools||this.opt.tools).split(""),r=i;for(var o in s){var l=this.btn[s[o]];e.ins("a",l[2],{href:"#cmd-"+l[0],title:l[3],className:e.opt.cToggle+" pad hover","data-cmd":s[o]},r),"tools"==l[0]&&(r=a)}i.appendChild(a),t.className+=" bord pad",t.style.width="100%",this.setStyle(t),this.setStyle(n),this.up(1,this.getWys(t)),this.modeAuto(t)}}},{key:"getNav",value:function(t){return t.previousElementSibling.previousElementSibli