peryl 1.4.47 → 1.4.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/router.d.ts +6 -5
- package/dist/router.js +18 -11
- package/dist/router.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/router.js +1 -1
- package/dist/umd/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +19 -11
package/dist/router.d.ts
CHANGED
|
@@ -19,17 +19,18 @@ export declare class Route {
|
|
|
19
19
|
}
|
|
20
20
|
export declare class Router extends Emitter {
|
|
21
21
|
static default: Router;
|
|
22
|
-
static hash(): string;
|
|
23
|
-
static start(): Router;
|
|
24
22
|
static route(path: string, handler: Function): Router;
|
|
25
|
-
static navigate(path: string): Router;
|
|
23
|
+
static navigate(path: string, force?: boolean): Router;
|
|
24
|
+
static start(): Router;
|
|
25
|
+
static hash(): string;
|
|
26
|
+
static handle(hash: string): Router;
|
|
26
27
|
private _routes;
|
|
27
28
|
constructor();
|
|
28
29
|
route(path: string, handler: Function): this;
|
|
29
|
-
navigate(path: string): this;
|
|
30
|
+
navigate(path: string, force?: boolean): this;
|
|
30
31
|
start(): this;
|
|
31
32
|
hash(): string;
|
|
32
|
-
handle(
|
|
33
|
+
handle(hash: string): this;
|
|
33
34
|
private _onHashChange;
|
|
34
35
|
}
|
|
35
36
|
export declare function route(path: string, handler: Function): Router;
|
package/dist/router.js
CHANGED
|
@@ -109,20 +109,23 @@ class Router extends Emitter {
|
|
|
109
109
|
window.attachEvent("onhashchange", this._onHashChange);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
static
|
|
113
|
-
|
|
112
|
+
static route(path, handler) {
|
|
113
|
+
Router.default.route(path, handler);
|
|
114
|
+
return Router.default;
|
|
115
|
+
}
|
|
116
|
+
static navigate(path, force = false) {
|
|
117
|
+
Router.default.navigate(path, force);
|
|
118
|
+
return Router.default;
|
|
114
119
|
}
|
|
115
120
|
static start() {
|
|
116
121
|
Router.default.start();
|
|
117
122
|
return Router.default;
|
|
118
123
|
}
|
|
119
|
-
static
|
|
120
|
-
Router.default.
|
|
121
|
-
return Router.default;
|
|
124
|
+
static hash() {
|
|
125
|
+
return Router.default.hash();
|
|
122
126
|
}
|
|
123
|
-
static
|
|
124
|
-
Router.default.
|
|
125
|
-
return Router.default;
|
|
127
|
+
static handle(hash) {
|
|
128
|
+
return Router.default.handle(hash);
|
|
126
129
|
}
|
|
127
130
|
route(path, handler) {
|
|
128
131
|
const route = new Route(path);
|
|
@@ -132,8 +135,12 @@ class Router extends Emitter {
|
|
|
132
135
|
});
|
|
133
136
|
return this;
|
|
134
137
|
}
|
|
135
|
-
navigate(path) {
|
|
138
|
+
navigate(path, force = false) {
|
|
139
|
+
const hash = this.hash();
|
|
136
140
|
window.location.hash = path;
|
|
141
|
+
if (force && hash === path) {
|
|
142
|
+
this.handle(path);
|
|
143
|
+
}
|
|
137
144
|
return this;
|
|
138
145
|
}
|
|
139
146
|
start() {
|
|
@@ -143,10 +150,10 @@ class Router extends Emitter {
|
|
|
143
150
|
hash() {
|
|
144
151
|
return window.location.hash.substring(1);
|
|
145
152
|
}
|
|
146
|
-
handle(
|
|
153
|
+
handle(hash) {
|
|
147
154
|
for (const route of this._routes) {
|
|
148
155
|
const params = [];
|
|
149
|
-
if (route.match(
|
|
156
|
+
if (route.match(hash, params)) {
|
|
150
157
|
this.emit(route.path, params, route);
|
|
151
158
|
break;
|
|
152
159
|
}
|
package/dist/router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":";;;AAMA,MAAa,OAAO;IAApB;QAEY,eAAU,GAAkC,EAAE,CAAC;IAuC3D,CAAC;IArCG,EAAE,CAAC,KAAa,EAAE,EAAY;QAC1B,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE;YAC7B,IA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C,IAAY,EAAE,OAAiB;IACjD,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAFD,sBAEC"}
|
package/dist/umd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("IncrementalDOM"));else if("function"==typeof define&&define.amd)define(["IncrementalDOM"],e);else{var s="object"==typeof exports?e(require("IncrementalDOM")):e(t.IncrementalDOM);for(var n in s)("object"==typeof exports?exports:t)[n]=s[n]}}(window,(function(t){return function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=30)}([function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hjoin=e.hsml=e.NBSP=void 0,e.NBSP=" ",e.hsml=function t(e,s,n){if(null!=e)switch(e.constructor){case Array:!function(e,s,n){if("string"!=typeof e[0])return void console.error("HSML tag head not string:",e);const i=e[0],o=e[1],r=o&&o.constructor===Object;let a,c,h=[];const l=e[r?2:1];switch(null!=l&&l.constructor){case Array:h=l;break;case Function:a=l;break;case String:case Boolean:case Number:case Date:h=[l];break;default:c=l}const u=i.split("~"),d=u[1],m=u[0].split("."),p=m[0].split("#"),f=p[0]||"div",_=p[1],g=m.slice(1);let b;b=r?o:{};_&&(b._id=_);g.length&&(b._classes=g);d&&(b._ref=d);c&&(b._hObj=c);const y=s.open(f,b,h,n);a&&s.fnc(a,n);y||h.forEach(e=>t(e,s,n));s.close(f,h,n)}(e,s,n);break;case Function:s.fnc(e,n);break;case String:s.text(e,n);break;case Boolean:s.text(""+e,n);break;case Number:const i=e,o=i.toLocaleString?i.toLocaleString():i.toString();s.text(o,n);break;case Date:const r=e,a=r.toLocaleString?r.toLocaleString():r.toString();s.text(a,n);break;default:s.obj(e,n)}},e.hjoin=function(t,e){const s=t.reduce((t,s)=>(t.push(s,e),t),[]);return s.splice(-1),s}},function(e,s){e.exports=t},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2idomPatch=e.hsml2idomPatch=void 0;const n=s(0),i=s(1);class o{open(t,e,s,n){const o=[];let r=e._id,a=e._classes?e._classes:[],c=e._ref,h=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":r=e[t];break;case"classes":const s=e[t];a=a.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":a=a.concat(e[t].split(" "));break;case"data":const i=e[t];for(const t in i)i.hasOwnProperty(t)&&(i[t].constructor===String?o.push("data-"+t,i[t]):o.push("data-"+t,JSON.stringify(i[t])));break;case"styles":o.push("style",e[t]);break;case"on":const c=e[t];"string"==typeof c[0]?"function"==typeof c[1]?o.push("on"+c[0],c[1]):o.push("on"+c[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(c[1],c[2],t)}):c.forEach(t=>{"function"==typeof t[1]?o.push("on"+t[0],t[1]):o.push("on"+t[0],e=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(t[1],t[2],e)})});break;default:switch(typeof e[t]){case"function":o.push("on"+t,e[t]);break;case"object":o.push(t,e[t]);break;case"boolean":e[t]&&o.push(t,t);break;default:o.push(t,e[t])}}return a.length&&o.unshift("class",a.join(" ")),r&&o.unshift("id",r),i.elementOpen(t,e._key,void 0,...o),e._skip&&i.skip(),n&&c&&(n.refs[c]=i.currentElement()),h&&h.mount&&h.mount.constructor===Function&&(h.mount(i.currentElement()),i.skip()),!!e._skip}close(t,e,s){i.elementClose(t)}text(t,e){i.text(t)}fnc(t,e){t(i.currentElement())&&i.skip()}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function r(t,e){n.hsml(t,new o,e)}e.hsml2idomPatch=function(t,e,s){i.patch(t,t=>t&&r(t,s),e)},e.hsmls2idomPatch=function(t,e,s){i.patch(t,t=>t&&function(t,e){for(const s of t)if(null!=s)if(s.constructor===String)i.text(s);else if("toHsml"in s){const t=s;t.toHsml&&r(t.toHsml(),t)}else r(s,e)}(t,s),e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FormValidator=e.BooleanValidator=e.DateValidator=e.NumberValidator=e.StringValidator=e.SelectValidator=e.tpl=e.Validator=e.rodneCisloRgex=e.pscRgex=e.phoneRgex=e.emailRegex=void 0;e.emailRegex=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,e.phoneRgex=/^(((00)([- ]?)|\+)(\d{1,3})([- ]?))?((\d{3})([- ]?))((\d{3})([- ]?))(\d{3})$/,e.pscRgex=/^\d{3} ?\d{2}$/,e.rodneCisloRgex=/^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$/;class n{constructor(t,e){this.str=null,this.err=null,this.obj=null,this.opts=t||{},this.msgs=e||{}}validate(t){if("string"==typeof t||null==t){const e=t;this.str=e;const s=this.strToObj(e);if(this.obj=s.obj,s.err)return this.err=s.err,{str:null==e?"":e,obj:s.obj,err:s.err};const n=this.objCheck(s.obj);return this.err=n,{str:null==e?"":e,obj:s.obj,err:n}}{this.str=null==t?null:""+t;const e=this.objCheck(t);return this.err=e,{str:this.str,obj:t,err:e}}}format(t,e){const s=this.objToStr(t,e);return{str:void 0===s.str||null===s.str?"":s.str,err:s.err}}}function i(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)}e.Validator=n,e.tpl=i;e.SelectValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{options:"options"in e?e.options.join(", "):""})):"required"}:{obj:void 0===t?null:t,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;return"options"in e&&t&&-1===e.options.indexOf(t)?s.invalid_option?i(s.invalid_option,Object.assign(Object.assign({},e.data),{option:null===t?"":t,options:"options"in e?e.options.join(", "):""})):"invalid_option":""}objToStr(t,e){return{str:t||"",err:""}}};e.StringValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):"",regexp:"regexp"in e?""+(e.regexp||""):""})):"required"}:t?"regexp"in e&&!e.regexp.test(t)?{obj:null,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{regexp:"regexp"in e?""+(e.regexp||""):""})):"invalid_format"}:{obj:t,err:""}:{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t.length>e.max&&(n=!0),"min"in e&&t.length<e.min&&(n=!0),"min"in e&&"max"in e&&t.length>e.max&&t.length<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){return{str:t||"",err:""}}};e.NumberValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"required"};if(t){const n=Number(t);let o=!1;if(isNaN(n)&&(o=!0),e.strict&&t!==this.objToStr(n).str&&(o=!0),o){const t=isNaN(n)?1234.45:n;return{obj:isNaN(n)?null:n,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{num:this.objToStr(t).str||""})):"invalid_format"}}return{obj:n,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t>e.max&&(n=!0),"min"in e&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){let s;return s=null==t?"":"decimals"in this.opts?t.toFixed(this.opts.decimals):String(t),{str:s,err:""}}};const o=t=>t.toLocaleString(),r=t=>t.toLocaleDateString(),a=t=>t.toISOString(),c=t=>new Date(t.toDateString()).toISOString();e.DateValidator=class extends n{constructor(t,e){super(t,e),(null==t?void 0:t.iso)?this.dateToStr=(null==t?void 0:t.dateOnly)?c:a:this.dateToStr=(null==t?void 0:t.dateOnly)?r:o,(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.min)&&(t.min=new Date(t.min.getFullYear(),t.min.getMonth(),t.min.getDate())),(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.max)&&(t.max=new Date(t.max.getFullYear(),t.max.getMonth(),t.max.getDate()+1))}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"required"};if(t){const n=Date.parse(t);let o=new Date(n);e.dateOnly&&(o=new Date(o.getFullYear(),o.getMonth(),o.getDate()));let r=!1;if(isNaN(n)&&(r=!0),r){const t=isNaN(n)?new Date:o;return{obj:isNaN(n)?null:o,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{date:this.objToStr(t).str||""})):"invalid_format"}}return{obj:o,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&e.max&&t.getTime()>e.max.getTime()&&(n=!0),"min"in e&&e.min&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"not_in_range":""}objToStr(t,e){return{str:null==t?"":this.dateToStr(t),err:""}}};e.BooleanValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign({},e.data)):"required"};let n;switch(t){case"true":case"1":case"on":case"yes":n=!0;break;default:n=!1}return{obj:n,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"value"in e&&t!==e.value&&(n=!0),n?s.invalid_value?i(s.invalid_value,Object.assign(Object.assign({},e.data),{value:"value"in e?""+(e.value||""):""})):"invalid_value":""}objToStr(t,e){return{str:null==t?"":""+t,err:""}}};e.FormValidator=class{constructor(){this.validators={}}addValidator(t,e){return this.validators[t]=e,this}validate(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].validate(n);return e.str[s]=i.str,e.obj[s]=i.obj,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}format(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].format(n);return e.str[s]=i.str,e.obj[s]=n,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}data(){return{str:this.str,obj:this.obj,err:this.err,valid:this.valid}}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Events=void 0;e.Events=class{constructor(t){this._cb=[],this._cbs={},t&&(this._ctx=t)}emit(t,e){if(t in this._cbs)for(let s=0,n=this._cbs[t].length;s<n;s++)this._cbs[t][s](e,t,this._ctx);for(let s=0,n=this._cb.length;s<n;s++)this._cb[s](e,t,this._ctx);return this}on(t,e){const s=t;return s in this._cbs||(this._cbs[s]=[]),-1===this._cbs[s].indexOf(e)&&this._cbs[s].push(e),this}any(t){return this._cb.push(t),this}once(t,e){const s=t,n=(t,i,o)=>{this.off(s,n),e(t,i,o)};return this.on(t,n),this}off(t,e){return void 0===t&&(e?this._cb=this._cb.filter(t=>t!==e):this._cb.length=0),t&&t in this._cbs&&(e?this._cbs[t].splice(this._cbs[t].indexOf(e),1):(this._cbs[t].length=0,delete this._cbs[t])),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2htmls=e.hsml2htmls=e.hsmls2html=e.hsml2html=void 0;const n=s(0);class i{constructor(t,e=!1,s=" "){this._depth=0,this._onHtml=t,this._pretty=e,this._indent=s}open(t,e,s,o){const r=[];let a=e._id,h=e._classes?e._classes:[],l=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":a=e[t];break;case"classes":const s=e[t];h=h.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":h=h.concat(e[t].split(" "));break;case"data":const n=e[t];for(const t in n)n.hasOwnProperty(t)&&(n[t].constructor===String?r.push(["data-"+t,n[t]]):r.push(["data-"+t,JSON.stringify(n[t])]));break;case"styles":const i=e[t];let o="";for(const t in i)if(i.hasOwnProperty(t)){o+=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()+":"+i[t]+";"}r.push(["style",o]);break;case"styles":case"on":break;default:"function"==typeof e[t]||("boolean"==typeof e[t]?e[t]&&r.push([t,""]):r.push([t,e[t]]))}h.length&&r.unshift(["class",h.join(" ")]),a&&r.unshift(["id",a]),l&&"type"in l&&r.unshift(["hObj",l.type]);const u=r.map(t=>`${t[0]}="${c(t[1])}"`).join(" ");let d="";this._pretty&&(d+=this._mkIndent(this._depth),this._depth++);if(d+="<"+t+(u?" "+u:"")+(s.length||-1!==i._pairTags.indexOf(t)?">":"/>"),this._pretty&&(d+="\n"),this._onHtml(d),l&&"render"in l&&l.render.constructor===Function){const t=l.render();for(const e of t)if(null!=e)if(e.constructor===String)this._onHtml(e+(this._pretty?"\n":""));else if("toHsml"in e){const t=e;t.toHsml&&n.hsml(t.toHsml(),this)}else n.hsml(e,this)}return!1}close(t,e,s){let n="";const o=e.length||-1!==i._pairTags.indexOf(t);this._pretty&&(this._depth--,o&&(n+=this._mkIndent(this._depth))),o&&(n+="</"+t+">",this._pretty&&(n+="\n"),this._onHtml(n))}text(t,e){let s="";this._pretty&&(s+=this._mkIndent(this._depth)),s+=t instanceof String?t:c(t),this._pretty&&(s+="\n"),this._onHtml(s)}fnc(t,e){}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}_mkIndent(t){let e="";for(let s=0;s<t;s++)e+=this._indent;return e}}function o(t,e,s=!1){const o=new i(e,s);n.hsml(t,o)}function r(t,e,s=!1){for(const n of t)if(null!=n)if(n.constructor===String)e(n+(s?"\n":""));else if("toHsml"in n){const t=n;t.toHsml&&o(t.toHsml(),e,s)}else o(n,e,s)}i._pairTags=["script","iframe","html","head","body","title","div","h1","h2","h3","h4","h5","h6","p","a","pre","blockquote","i","b","em","strong","tt","cite","ol","ul","li","dl","dt","dd","table","tr","td","textarea","select","option"],e.hsml2html=o,e.hsmls2html=r,e.hsml2htmls=function(t,e=!1){const s=[];return o(t,t=>s.push(t),e),s},e.hsmls2htmls=function(t,e=!1){const s=[];return r(t,t=>s.push(t),e),s};const a=/["'&<>]/;function c(t){const e=""+t,s=a.exec(e);if(!s)return e;let n,i="",o=0,r=0;for(o=s.index;o<e.length;o++){switch(e.charCodeAt(o)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}r!==o&&(i+=e.substring(r,o)),r=o+1,i+=n}return r!==o?i+e.substring(r,o):i}},function(t,e,s){"use strict";function n(t,e=300){let s;return function(...n){clearTimeout(s),s=setTimeout(()=>{t.apply(this,n)},e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.Debounce=e.debounce=void 0,e.debounce=n,e.Debounce=function(t=300){return function(e,s,i){const o=i.value;return i.value=n(o,t),i}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.addEventListener=e.html=e.empty=e.remove=e.replace=e.append=e.select=e.selectAll=void 0,e.selectAll=function(t,e){const s=(e||document).querySelectorAll(t),n=[];for(let t=0;t<s.length;t++)n.push(s[t]);return n},e.select=function(t,e){return(e||document).querySelector(t)},e.append=function(t,...e){e.forEach(e=>t.appendChild(e))},e.replace=function(t,e){t.parentElement&&t.parentElement.replaceChild(e,t)},e.remove=function(t){t.parentElement&&t.parentElement.removeChild(t)},e.empty=function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},e.html=function(t){t=t.trim();let e={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],body:[0,"",""],_default:[1,"<div>","</div>"]};e.optgroup=e.option,e.tbody=e.tfoot=e.colgroup=e.caption=e.thead,e.th=e.td;const s=/<\s*\w.*?>/g.exec(t);let n=document.createElement("div");if(null!=s){const i=s[0].replace(/</g,"").replace(/>/g,"").split(" ")[0];if("body"===i.toLowerCase()){const e=document.createElement("body");n.innerHTML=t.replace(/<body/g,"<div").replace(/<\/body>/g,"</div>");const s=n.firstChild.attributes;e.innerHTML=t;for(let t=0;t<s.length;t++)e.setAttribute(s[t].name,s[t].value);return e}{const s=e[i]||e._default;t=s[1]+t+s[2],n.innerHTML=t;let o=s[0]+1;for(;o--;)n=n.lastChild}}else n.innerHTML=t,n=n.lastChild;return n},Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){const e=(this.document||this.ownerDocument).querySelectorAll(t);let s=e.length;for(;--s>=0&&e.item(s)!==this;);return s>-1}),e.addEventListener=function(t,e,s,n,i=!1){t.addEventListener(s,(function(t){const s=t||window.event,i=s.target||t.srcElement;i&&i.matches(e)&&n(i,s)}),i)},e.removeEventListener=function(t,e,s,n=!1){t.removeEventListener(e,s,n)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Base64=e.UrlEncodedData=void 0;e.UrlEncodedData=class{static encode(t,e=""){let s;if("object"!=typeof t)s=t;else{const n=[];let i=0;for(let s in t)if(t.hasOwnProperty(s)){let o=t[s];o instanceof Array||(o=[o]);const r=o.length;for(let t=0;t<r;t++){const r=o[t];"object"==typeof r&&null!=r?n[i++]=arguments.callee(r,e+s+"."):(n[i]=encodeURIComponent(e+s),null!=r&&(n[i]+="="+encodeURIComponent(r)),i++)}}s=n.join("&")}return s}static decode(t){const e={};if(t){const s=t.split("&"),n=s.length;for(let t=0;t<n;t++){const n=s[t].split("="),i=decodeURIComponent(n[0]);if(n.length>1){const t=decodeURIComponent(n[1]),s=i.split("."),o=s.length;let r=e;for(let e=0;e<o;e++){const n=s[e],i=r[n];e===o-1?i?i instanceof Array?r[n].push(t):(r[n]=[i],r[n][1]=t):r[n]=t:(i||(r[n]={}),r=r[n])}}else e[i]=null}}return e}};class n{static encode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=n._utf8_encode(t);l<t.length;)e=t.charCodeAt(l++),s=t.charCodeAt(l++),i=t.charCodeAt(l++),o=e>>2,r=(3&e)<<4|s>>4,a=(15&s)<<2|i>>6,c=63&i,isNaN(s)?a=c=64:isNaN(i)&&(c=64),h=h+n._keyStr.charAt(o)+n._keyStr.charAt(r)+n._keyStr.charAt(a)+n._keyStr.charAt(c);return h}static decode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<t.length;)o=this._keyStr.indexOf(t.charAt(l++)),r=this._keyStr.indexOf(t.charAt(l++)),a=this._keyStr.indexOf(t.charAt(l++)),c=this._keyStr.indexOf(t.charAt(l++)),e=o<<2|r>>4,s=(15&r)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(e),64!==a&&(h+=String.fromCharCode(s)),64!==c&&(h+=String.fromCharCode(i));return h=n._utf8_decode(h),h}static _utf8_encode(t){t=t.replace(/\r\n/g,"\n");let e="";for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}static _utf8_decode(t){let e="",s=0,n=0,i=0,o=0;for(;s<t.length;)n=t.charCodeAt(s),n<128?(e+=String.fromCharCode(n),s++):n>191&&n<224?(i=t.charCodeAt(s+1),e+=String.fromCharCode((31&n)<<6|63&i),s+=2):(i=t.charCodeAt(s+1),o=t.charCodeAt(s+2),e+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),s+=3);return e}}e.Base64=n,n._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Form=e.FileEntry=e.RadioEntry=e.SelectEntry=e.CheckboxEntry=e.NumberInputEntry=e.TextInputEntry=e.TextAreaEntry=void 0;e.TextAreaEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.TextInputEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.NumberInputEntry=class{constructor(t){this._decimals=0,this._dragSensitivity=1,this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this.setDecimals(2)}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return isNaN(+t)||(this._element.value=(+t).toFixed(this._decimals)),this}setStep(t){return isNaN(t)||(this._element.step=""+t),this}setMin(t){return isNaN(t)||(this._element.min=""+t),this}setMax(t){return isNaN(t)||(this._element.max=""+t),this}setDecimals(t){return isNaN(t)||(this._decimals=t),this}setDragSensitivity(t){return isNaN(t)||(this._dragSensitivity=t),this}enableMouseWheel(){const t=()=>{this._onChange&&setTimeout(()=>{this._onChange&&this._onChange(this,!1)},0)};return this._element.addEventListener("focus",()=>{this._element.addEventListener("mousewheel",t)}),this._element.addEventListener("blur",()=>{this._element.removeEventListener("mousewheel",t)}),this}enableMouseDrag(){return this._element.addEventListener("mousedown",t=>{document.body.style.cursor="row-resize",this._element.style.cursor="row-resize";const e=t.pageY,s=Number(this.getValue()),n=""===this._element.min?null:Number(this._element.min),i=""===this._element.max?null:Number(this._element.max),o=""===this._element.step?1:Number(this._element.step),r=isNaN(s)?null===n?0:n:s,a=t=>{const s=(t.pageY-e)*this._dragSensitivity,a=r-s*o;null!==n&&a<n?this.setValue(n.toFixed(this._decimals)):null!==i&&a>i?this.setValue(i.toFixed(this._decimals)):this.setValue(a.toFixed(this._decimals)),this._onChange&&this._onChange(this,!1)},c=()=>{document.body.style.cursor="",this._element.style.cursor="",document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c),this._onChange&&this._onChange(this,!0)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.CheckboxEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return""+this._element.checked}setValue(t){return this._element.checked=!(!t||"false"===t),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.SelectEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}setOptions(t){const e=this._element;for(;e.options.length>0;)e.remove(0);return t.forEach(t=>{const s=document.createElement("option");s.text=t.text,s.value=t.value,e.add(s)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.RadioEntry=class{constructor(t){this._elements=[],t.forEach(t=>{"string"==typeof t?this._elements.push(document.getElementById(t)):this._elements.push(t)}),this._elements.forEach(t=>{t.addEventListener("change",()=>{this._onChange&&t.checked&&this._onChange(this)})})}getName(){return this._elements[0].name}getValue(){for(let t of this._elements)if(t.checked)return t.value}setValue(t){for(let e of this._elements)e.value===t&&(e.checked=!0);return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.FileEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){const t=this._element.files;return t&&t.length?t[0].name+" ("+t[0].type+", "+t[0].size+")":void 0}getFile(){return this._element.files&&this._element.files.length?this._element.files[0]:null}setValue(t){return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.Form=class{constructor(t){this._formEntries=[],this._element="string"==typeof t?document.getElementById(t):t,this._element.onsubmit=t=>(t.preventDefault(),this._onSubmit&&this._onSubmit(this),!1)}addEntry(t){return this._formEntries.push(t),this}setEntries(t){return this._formEntries=t,this}getEntries(){return this._formEntries}getEntry(t){for(let e of this._formEntries)if(e.getName()===t)return e}validate(t){const e={};for(let s of this._formEntries)e[s.getName()]=s.validate(t);return e}isValid(t){t||(t=this.validate());for(let e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}getValues(){const t={};for(let e of this._formEntries)t[e.getName()]=e.getValue();return t}submit(){this._element.submit()}onSubmit(t){return this._onSubmit=t,this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=void 0;e.Hash=class{constructor(t=!0){this._encode=t=>String(t),this._decode=t=>t,this._emitWritten=t}onChange(t){return this._cb=t,this}coders(t,e){return this._encode=t,this._decode=e,this}listen(){if(this._cb&&this._cb(this.read()),"onhashchange"in window)onhashchange=()=>{const t=this._hash===location.hash;this._hash=void 0,!this._emitWritten&&t||this._cb&&this._cb(this.read())};else{console.warn('browser "window.onhashchange" not implemented, running emulation');let t=location.hash;this._iId&&clearInterval(this._iId),this._iId=setInterval(()=>{if(location.hash!==t){t=location.hash;const e=this._hash===location.hash;this._hash=void 0,!this._emitWritten&&e||this._cb&&this._cb(this.read())}},500)}return this}read(){return this._decode(decodeURIComponent(location.hash.slice(1)))}write(t){return location.hash="#"+encodeURIComponent(this._encode(t)),this._hash=location.hash,this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.History=void 0;e.History=class{back(){window.history.back()}forward(){window.history.forward()}go(t){window.history.go(t)}length(){return window.history.length}state(){return window.history.state}pushState(t,e,s){window.history.pushState(t,e,s)}replaceState(t,e,s){window.history.replaceState(t,e,s)}onChange(t){return window.addEventListener("popstate",(function(e){t(e.state)})),this}}},function(t,e,s){"use strict";var n=this&&this.__awaiter||function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.HApp=e.HAppAction=void 0;const i=s(2),o=console.log,r=console.error;var a;!function(t){t._init="_init",t._mount="_mount",t._umount="_umount"}(a=e.HAppAction||(e.HAppAction={}));const c=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},h=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class l{constructor(t,e,s,i=document.body){this.refs={},this.dispatch=(t,e,s)=>n(this,void 0,void 0,(function*(){if(l.debug){o("HApp action:",{type:t,data:e,event:s});const n=performance.now();try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}const i=performance.now();o("HApp dispatch:",i-n+" ms",this.state)}else try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}})),this.render=()=>{if(l.debug){const t=performance.now();let e;try{e=this.view(this.state)}catch(t){r("HApp render:",t)}const s=performance.now();return o("HApp render:",s-t+" ms",e),e||[]}{let t;try{t=this.view(this.state)}catch(t){r("HApp render:",t)}return t||[]}},this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e=t.target;switch(e.nodeName){case"FORM":t.preventDefault();const s=e.elements,n={};for(let t=0;t<s.length;t++){const e=d(s[t]);if("object"==typeof e){const i=Object.keys(e);if(i.length){const o=i[0],r=e[o];void 0===n[o]?n[o]=r:"string"==typeof n[o]||n[o]instanceof String?n[o]=r instanceof Array?[n[o],...r]:[n[o],r]:n[o]instanceof Array?r instanceof Array?n[o]=n[o].concat(r):n[o].push(r):n[o]=r instanceof Array?[n[o],...r]:[n[o],r],n[o]instanceof Array&&(n[o]=n[o].filter(t=>null!==t),"radio"===s[t].type&&(n[o]=n[o].length?n[o][0]:null))}}}return n;default:return d(e)}}(s)),this.dispatch(t,e,s)},this.mount=(t=document.body)=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.app){e.app.umount()}if(!this.dom){this.dom=e,e.app=this;u(e,this.render(),this),this._onUpdate&&this._onUpdate(this),this.dispatch(a._mount,this.dom)}return this},this.umount=()=>{if(this.dom){this.dispatch(a._umount,this.dom),this.dom.hasAttribute("app")&&this.dom.removeAttribute("app");const t=this.dom.querySelectorAll("[app]");for(let e=0;e<t.length;e++){const s=t[e].app;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.app,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=c(()=>{if(this.dom){const t=this.render();u(this.dom,t,this)}this._updateSched=void 0,this._onUpdate&&this._onUpdate(this)})),this),this.onUpdate=t=>(this._onUpdate=t,this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0}];h(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.app=this,this.dispatch(a._mount,this.dom))}),["div",t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.state=t,this.view=e,this.dispatcher=s||(t=>n(this,void 0,void 0,(function*(){return o("HApp action:",t.type,t.data)}))),this.dispatch(a._init).then(()=>this.mount(i))}}function u(t,e,s){if(l.debug){const n=performance.now();i.hsmls2idomPatch(t,e,s);const r=performance.now();o("HApp update:",r-n+" ms",t)}else i.hsmls2idomPatch(t,e,s)}function d(t){let e=null;switch(t.nodeName){case"INPUT":const s=t;switch(s.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":e=s.name?{[s.name]:s.value}:s.value;break;case"radio":e=s.name?{[s.name]:s.checked?s.value:null}:s.checked?s.value:null;break;case"checkbox":e="on"===s.value?s.name?{[s.name]:String(s.checked)}:String(s.checked):s.name?{[s.name]:s.checked?String(s.value):null}:s.checked?String(s.value):null}break;case"SELECT":const n=t;if(n.multiple){const t=Array.from(n.selectedOptions).map(t=>t.value);e=n.name?{[n.name]:t}:t}else e=n.name?{[n.name]:n.value}:n.value;break;case"TEXTAREA":const i=t;e=i.name?{[i.name]:i.value}:i.value;break;case"BUTTON":const o=t;e=o.name?{[o.name]:o.value}:o.value}return e}e.HApp=l,l.debug=!1},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2dom=e.hsml2dom=void 0;const n=s(0);class i{open(t,e,s,n){const i=document.createElement(t);let o=e._id,r=e._classes?e._classes:[],a=e._ref,c=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":o=e[t];break;case"classes":const s=e[t];r=r.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":r=r.concat(e[t].split(" "));break;case"data":const a=e[t];for(const t in a)a.hasOwnProperty(t)&&(a[t].constructor===String?i.dataset[t]=a[t]:i.dataset[t]=JSON.stringify(a[t]));break;case"styles":const c=e[t];for(const t in c)c.hasOwnProperty(t)&&(i.style[t]=c[t]);break;case"on":const h=e[t];"string"==typeof h[0]?"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)}):h.forEach(t=>{"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)})});break;default:"function"==typeof e[t]?i.addEventListener(t,e[t]):"boolean"==typeof e[t]?e[t]&&i.setAttribute(t,""):i.setAttribute(t,e[t])}return o&&i.setAttribute("id",o),r.length&&i.classList.add(...r),this._current?(this._current.appendChild(i),this._current=i):(this.element=i,this._current=i),n&&a&&(n.refs[a]=this._current),c&&c.mount&&c.mount.constructor===Function&&c.mount(i),!!e._skip}close(t,e,s){this._current!==this.element&&this._current&&(this._current=this._current.parentElement||void 0)}text(t,e){this._current&&this._current.appendChild(document.createTextNode(t))}fnc(t,e){this._current&&t(this._current)}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function o(t,e){const s=new i;return n.hsml(t,s,e),s.element}e.hsml2dom=o,e.hsmls2dom=function(t,e){const s=[];for(const n of t)if(null!=n)if(n.constructor===String)s.push(document.createTextNode(n));else if("toHsml"in n){const t=n;t.toHsml&&s.push(o(t.toHsml(),t))}else s.push(o(n,e));return s}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.h=void 0,e.h=function(t,e,s){const n=[t];return e&&("string"==typeof e||"number"==typeof e?n.push([e]):(Array.isArray(e),n.push(e))),s&&("string"==typeof s||"number"==typeof s?n.push([s]):(Array.isArray(s)||"function"==typeof s)&&n.push(s)),n}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HCtrl=void 0;const n=s(2),i=s(1),o=(t,e,s)=>n=>{if(n.ctrl){const i=n.ctrl;if(i.view===t.view)void 0!==e&&(i.state=e),i.update();else{i.umount();const o=new c(t,s);void 0!==e&&(o.state=e),o.mount(n)}}else{const i=new c(t,s);void 0!==e&&(i.state=e),i.mount(n)}return!0},r=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},a=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class c{constructor(t,e){this.type="Ctrl",this.id=this.type+"-"+c._count++,this.refs={},this.appAction=(t,e,s)=>{c.debug&&console.log("appAction",this.type,t,e,s),c.appActions&&c.appActions(this,t,e,s)},this.extAction=(t,e,s)=>{c.debug&&console.log("extAction",this.type,t,e,s),this._extAction&&this._extAction(t,e,s)},this.action=(t,e,s)=>{c.debug&&console.log("action",this.type,t,e,s),this._actions&&this._actions(this,t,e,s)},this.render=()=>this.view(this.state,this.action,o),this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e={},s=t.target;switch(s.nodeName){case"INPUT":const t=s;switch(t.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":case"radio":case"number":e[t.name]=t.value;break;case"checkbox":e[t.name]=""+t.checked}break;case"SELECT":const n=s;e[n.name]=n.value;break;case"TEXTAREA":const i=s;e[i.name]=i.innerText;break;case"BUTTON":const o=s;e[o.name]=o.value}return e}(s)),this.action(t,e,s)},this.mount=t=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.ctrl){const t=e.ctrl;t&&t.umount()}if(!this.dom){c._ctrls[this.id]=this,this.dom=e,e.ctrl=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("ctrl",this.type),this.action("_mount",this.dom)}return this},this.umount=()=>{if(this.dom){delete c._ctrls[this.id],this.action("_umount",this.dom),this.dom.hasAttribute("ctrl")&&this.dom.removeAttribute("ctrl");const t=this.dom.querySelectorAll("[ctrl]");for(let e=0;e<t.length;e++){const s=t[e].ctrl;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.ctrl,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=r(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,ctrl:this.type}];a(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.ctrl=this,c._ctrls[this.id]=this,this.action("_mount",this.dom))}),["div",{_id:this.id,_key:this.id,ctrl:this.type},t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.view=t.view,this.type=t.type,this.state=t.state,this._actions=t.actions,this._extAction=e||this.appAction,this.action("_init")}appActions(t){return c.appActions=t,this}appCtrls(){return Object.values(c._ctrls)}}e.HCtrl=c,c.debug=!1,c._count=0,c._ctrls={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&t.ctrl){const e=t.ctrl;e&&e.umount()}})}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.htmls=e.html=void 0;const n=s(5),i=(t,e,s)=>{},o=(t,e)=>t.view(e||t.state,i,o);e.html=function(t,e,s,r=!1){n.hsmls2html(t.view(e,i,o),s,r)},e.htmls=function(t,e,s=!1){return n.hsmls2htmls(t.view(e,i,o),s).join("")}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HWidget=void 0;const n=s(2),i=s(1),o=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},r=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class a{constructor(t){this.type=this.constructor.name,this.id=this.type+"-"+a._count++,this.refs={},this.toHtml=()=>this.dom?this.dom.outerHTML:"",t&&(this.type=t)}onMount(){console.log("mount")}onUmount(){console.log("umount")}actions(t,e){console.log(t,e)}action(t,e){this.actions(t,e)}actionCb(t,e,s){e=e&&e.constructor===Function?e(s):void 0===e?s:e,this.action(t,e)}mount(t){const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if("widget"in e){const t=e.widget;t&&t.umount()}if(!this.dom){a.mounted[this.id]=this,this.dom=e,e.widget=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("widget",this.type),this.onMount&&this.onMount()}return this}umount(){if(this.dom){delete a.mounted[this.id],this.onUmount&&this.onUmount(),this.dom.hasAttribute("widget")&&this.dom.removeAttribute("widget");const t=this.dom.querySelectorAll("[widget]");for(let e=0;e<t.length;e++){const s=t[e].widget;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.widget,this.dom=void 0}return this}update(){return this.dom&&!this._updateSched&&(this._updateSched=o(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this}toHsml(){if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,widget:this.type}];r(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.widget=this,this.onMount&&this.onMount())}),["div",{_id:this.id,_key:this.id,widget:this.type},t]}}e.HWidget=a,a._count=0,a.mounted={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&"widget"in t){const e=t.widget;e&&e.umount()}})}},function(t,e,s){"use strict";function n(t){return Array.isArray?Array.isArray(t):null!=t&&void 0!==t&&-1==="boolean|number|string|function|xml".indexOf(typeof t)&&("number"==typeof t.length&&!t.propertyIsEnumerable("length"))}function i(t){const e=[];for(const s in t)if(t.hasOwnProperty(s)){const i=t[s];if("object"==typeof i)if(n(i))for(const t of i)e.push([s,"object"==typeof t?JSON.stringify(t):t]);else e.push([s,JSON.stringify(i)]);else e.push([s,i])}for(let t,s=0;t=e[s++];)e[s-1]=`${encodeURIComponent(t[0])}=${encodeURIComponent(t[1])}`;return e.join("&")}Object.defineProperty(e,"__esModule",{value:!0}),e.http=e.onError=e.onResponse=e.onRequest=e.del=e.patch=e.put=e.post=e.get=e.HttpRequest=e.authBasic=e.HttpResponse=e.encodeUrlQuery=e.decodeUrlQuery=e.isArray=void 0,e.isArray=n,e.decodeUrlQuery=function(t){const e={};if(t){const s=t.substr(1).split("&");for(const t of s){const s=t.split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1]||"")}}return e},e.encodeUrlQuery=i;class o{constructor(t){this._xhr=t}getHeaders(){return this._xhr.getAllResponseHeaders()}getHeader(t){return this._xhr.getResponseHeader(t)}getBody(){return this._xhr.response}getType(){return this._xhr.responseType}getContentType(){return this.getHeader("Content-Type")}getText(){return this._xhr.responseText}getJson(){return JSON.parse(this._xhr.responseText)}getXml(){return this._xhr.responseXML}}e.HttpResponse=o,e.authBasic=(t,e)=>s=>{s.headers({Authorization:"Basic "+btoa(t+":"+e)})};class r{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){r.xhrs.forEach(t=>t.abort()),r.xhrs.length=0}get(t,e){return this.method("GET"),this.url(t,e),this}post(t,e){return this.method("POST"),this.url(t,e),this}put(t,e){return this.method("PUT"),this.url(t,e),this}patch(t,e){return this.method("PATCH"),this.url(t,e),this}del(t,e){return this.method("DELETE"),this.url(t,e),this}url(t,e){return this._url=t,this._query=e,this}method(t){return this._method=t,this}headers(t){for(const e in t)t.hasOwnProperty(e)&&(this._headers[e]=t[e]);return this}use(t){return t(this),this}timeout(t){return this._timeout=t,this}responseType(t){return this._responseType=t,this}onProgress(t){return this._onProgress=t,this}onResponse(t){return this._onResponse=t,this}onError(t){return this._onError=t,this}async(t=!0){return this._async=t,this}noCache(t=!0){return this._noCache=t,this}abort(){return this._xhr&&this._xhr.abort(),this}send(t,e){e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)}sendPromise(t,e){return new Promise((s,n)=>{this._onResponse=s,this._onError=n,e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)})}_send(t,e){const s=new XMLHttpRequest;this._xhr=s;let n=this._url||"";if(this._query){const t=i(this._query);n=t?`${n}?${t}`:n}if(this._noCache&&(n+=(/\?/.test(n)?"&":"?")+(new Date).getTime()),this._responseType&&(this._xhr.responseType=this._responseType),"onprogress"in s&&this._onProgress){const t=t=>{this._onProgress({loaded:t.loaded,total:t.lengthComputable?t.total:void 0})};s.upload.onprogress=t,s.onprogress=t}r.xhrs.push(this),s.open(this._method,n,this._async);for(const t in e)e.hasOwnProperty(t)&&s.setRequestHeader(t,e[t]);if(this._timeout&&(s.timeout=this._timeout),"ontimeout"in s&&(this._onError||r.onError)&&(s.ontimeout=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),"onabort"in s&&(this._onError||r.onError)&&(s.onabort=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),(this._onError||r.onError)&&(s.onerror=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),!this._async){if(t){const e="string"==typeof t?t:JSON.stringify(t);s.send(e)}else s.send();return JSON.parse(s.responseText)}"onload"in s?s.onload=t=>{if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}:s.onreadystatechange=t=>{switch(s.readyState){case 4:if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}},void 0!==t?"string"==typeof t||t instanceof FormData||t instanceof Blob?s.send(t):(this._headers["Content-Type"]||s.setRequestHeader("Content-Type","application/json"),s.send(JSON.stringify(t))):s.send()}}function a(t,e){return(new r).method("GET").url(t,e)}function c(t,e){return(new r).method("POST").url(t,e)}function h(t,e){return(new r).method("PUT").url(t,e)}function l(t,e){return(new r).method("DELETE").url(t,e)}function u(t){r.onRequest=t}function d(t){r.onResponse=t}function m(t){r.onError=t}e.HttpRequest=r,r.xhrs=[],e.get=a,e.post=c,e.put=h,e.patch=function(t,e){return(new r).method("PATCH").url(t,e)},e.del=l,e.onRequest=u,e.onResponse=d,e.onError=m,e.http={get:a,post:c,put:h,delete:l,onRequest:u,onResponse:d,onError:m}},function(t,e,s){"use strict";function n(t,e){const s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.src=t,s.readyState?s.onreadystatechange=()=>{const t="loaded"===s.readyState,n="complete"===s.readyState;(t||n)&&(s.onreadystatechange=null,"function"==typeof e&&e())}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.css=e.image=e.scripts=e.script=e.scriptLib=void 0,e.scriptLib=function(t,e,s){n(t,()=>{const t=window[e];window[e]={},delete window[e],s&&s(t)})},e.script=n,e.scripts=function(t,e){t.reverse();let s=e;for(let e=0;e<t.length;e++){s=((t,e)=>()=>n(t,()=>e&&e()))(t[e],s)}s&&s()},e.image=function(t,e){const s=new Image;s.src=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()}},e.css=function(t,e){const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}},function(t,e,s){"use strict";function n(t,e=[],s={}){return Object.keys(t).reduce((s,i)=>{const o=e.concat(i);return"object"==typeof t[i]&&null!==t[i]?n(t[i],o,s):0===s[t[i]]||s[t[i]]?s[t[i]].push(o):s[t[i]]=[o],s},s)}Object.defineProperty(e,"__esModule",{value:!0}),e.objValuePaths=e.objPaths=void 0,e.objPaths=function(t){const e=n(t);return Object.keys(e).map(t=>e[t]).reduce((t,e)=>t.concat(e))},e.objValuePaths=n},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.route=e.Router=e.Route=e.Emitter=void 0;class n{constructor(){this._callbacks={}}on(t,e){return t in this._callbacks||(this._callbacks[t]=[]),this._callbacks[t].push(e),this}emit(t,...e){return t in this._callbacks&&this._callbacks[t].forEach(t=>t.apply(this,e)),this}off(t,e){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;const s=this._callbacks[t];if(!s)return this;if(1===arguments.length)return delete this._callbacks[t],this;for(let t=0;t<s.length;t++){if(s[t]===e){s.splice(t,1);break}}return this}}e.Emitter=n;class i{constructor(t){this._params={},this.keys=[],this.path=t,this._pathParse(t,!1,!1)}match(t,e){const s=this._regex.exec(t);if(!s)return!1;for(let t=1;t<s.length;++t){const n=this.keys[t-1],i="string"==typeof s[t]?decodeURIComponent(s[t]):s[t];n&&(this._params[n.name]=i),e.push(i)}return!0}_pathParse(t,e,s){t instanceof RegExp?this._regex=t:(t instanceof Array&&(t="("+t.join("|")+")"),t=t.concat(s?"":"/?").replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,(t,e,s,n,i,o)=>(this.keys.push({name:n,optional:!!o}),e=e||"",(o?"":e)+"(?:"+(o?e:"")+(s||"")+(i||(s?"([^/.]+?)":"([^/]+?)"))+")"+(o||""))).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),this._regex=new RegExp("^"+t+"$",e?"":"i"))}}e.Route=i;class o extends n{constructor(){super(),this._routes=[],this._onHashChange=()=>{this.handle(this.hash())},window.addEventListener?window.addEventListener("hashchange",this._onHashChange,!1):window.attachEvent("onhashchange",this._onHashChange)}static hash(){return o.default.hash()}static start(){return o.default.start(),o.default}static route(t,e){return o.default.route(t,e),o.default}static navigate(t){return o.default.navigate(t),o.default}route(t,e){const s=new i(t);return this._routes.push(s),this.on(t,(t,s)=>e.apply(s,t)),this}navigate(t){return window.location.hash=t,this}start(){return this._onHashChange(),this}hash(){return window.location.hash.substring(1)}handle(t){for(const e of this._routes){const s=[];if(e.match(t,s)){this.emit(e.path,s,e);break}}return this}}e.Router=o,o.default=new o,e.route=function(t,e){return o.route(t,e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Settings=void 0;const n=s(4);e.Settings=class{constructor(t,e="settings"){this.events=new n.Events,this.props=t,this.name=e}getProps(){return this.props}setProps(t){return Object.keys(t).forEach(e=>this.props[e]=t[e]),this.events.emit("",t),this}getProp(t){return this.props[t]}setProp(t,e){this.props[t]=e;return this.events.emit(t,e),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Signal=void 0;e.Signal=class{constructor(){this._slots=[],this._emit=!0}onConnect(t){this._onConnect=t}onDisconnect(t){this._onDisconnect=t}connNo(){return this._slots.length}connect(t,e){"function"==typeof t&&(e?this._slots.push({callback:t,object:e}):this._slots.push({callback:t}),this._onConnect&&this._onConnect(this._slots.length))}disconnect(t,e){"function"==typeof t&&(this._slots=this._slots.filter(s=>void 0===e?s.callback!==t:s.callback!==t&&s.object!==e),this._onDisconnect&&this._onDisconnect(this._slots.length))}disconnectAll(){this._slots=[],this._onDisconnect&&this._onDisconnect(this._slots.length)}freeze(){this._emit=!1}unfreeze(){this._emit=!0}emit(t){return this._emit&&this._slots.length?this._slots.map(e=>{const s=e.object;return s?e.callback.call(s,t):e.callback(t)}):[]}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.template=e.tmpl=void 0,e.tmpl=function(t,e){const s=/[^a-zA-Z0-9_-]+/.test(t)?t:document.getElementById(t).innerHTML;let n,i,o=JSON.stringify,r=/\$\{([\S\s]*?)\}/g,a=[],c=0;for(;i=r.exec(s);)n=s.slice(c,i.index),a.push(o(n),"("+i[1]+")"),c=r.lastIndex;n=s.slice(c),a.push(o(n));const h=new Function("obj","with(obj)return "+a.join("+"));return e?h(e):h};const n={};e.template=function t(e,s){const i=/[^a-zA-Z0-9_-]+/.test(e)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%\>/g,"',$1,'").split("\t").join("');").split("%>").join("\np.push('").split("\r").join("\\'")+"');}return p.join('');"):n[e]=n[e]||t(document.getElementById(e).innerHTML);return s?i(s):i}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tmpl=e.tmplo=e.tmpla=e.tmpls=void 0,e.tmpls=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)},e.tmpla=function(t,e){return e.reduce((t,e,s)=>t.replace(new RegExp(`\\$\\{${s}\\}`,"g"),e),t)},e.tmplo=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\$\\{${e[0]}\\}`,"g"),e[1]),t)},e.tmpl=function(t){const e=JSON.stringify,s=/\$\{([\S\s]*?)\}/g,n=[];let i,o,r=0;for(;i=s.exec(t);)o=t.slice(r,i.index),n.push(e(o),"("+i[1]+")"),r=s.lastIndex;return o=t.slice(r),n.push(e(o)),new Function("obj","with(obj)return "+n.join("+"))}},,,,function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validators=e.tmpl=e.template=e.signal=e.settings=e.router=e.objpaths=e.load=e.http=e.hsml=e.hsmlwidget=e.hsmlsvac=e.hsmlsvachtml=e.hsmlsvacctrl=e.hsmlidom=e.hsmlhtml=e.hsmlh=e.hsmldom=e.hsmlapp=e.history=e.hash=e.form=e.events=e.encode=e.dom=e.debounce=void 0;const n=s(6);e.debounce=n;const i=s(7);e.dom=i;const o=s(8);e.encode=o;const r=s(4);e.events=r;const a=s(9);e.form=a;const c=s(10);e.hash=c;const h=s(11);e.history=h;const l=s(12);e.hsmlapp=l;const u=s(13);e.hsmldom=u;const d=s(14);e.hsmlh=d;const m=s(5);e.hsmlhtml=m;const p=s(2);e.hsmlidom=p;const f=s(15);e.hsmlsvacctrl=f;const _=s(16);e.hsmlsvachtml=_;const g=s(17);e.hsmlsvac=g;const b=s(18);e.hsmlwidget=b;const y=s(0);e.hsml=y;const v=s(19);e.http=v;const j=s(20);e.load=j;const w=s(21);e.objpaths=w;const E=s(22);e.router=E;const x=s(23);e.settings=x;const C=s(24);e.signal=C;const S=s(25);e.template=S;const k=s(26);e.tmpl=k;const O=s(3);e.validators=O}])}));
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("IncrementalDOM"));else if("function"==typeof define&&define.amd)define(["IncrementalDOM"],e);else{var s="object"==typeof exports?e(require("IncrementalDOM")):e(t.IncrementalDOM);for(var n in s)("object"==typeof exports?exports:t)[n]=s[n]}}(window,(function(t){return function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=30)}([function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hjoin=e.hsml=e.NBSP=void 0,e.NBSP=" ",e.hsml=function t(e,s,n){if(null!=e)switch(e.constructor){case Array:!function(e,s,n){if("string"!=typeof e[0])return void console.error("HSML tag head not string:",e);const i=e[0],o=e[1],r=o&&o.constructor===Object;let a,c,h=[];const l=e[r?2:1];switch(null!=l&&l.constructor){case Array:h=l;break;case Function:a=l;break;case String:case Boolean:case Number:case Date:h=[l];break;default:c=l}const u=i.split("~"),d=u[1],m=u[0].split("."),p=m[0].split("#"),f=p[0]||"div",_=p[1],g=m.slice(1);let b;b=r?o:{};_&&(b._id=_);g.length&&(b._classes=g);d&&(b._ref=d);c&&(b._hObj=c);const y=s.open(f,b,h,n);a&&s.fnc(a,n);y||h.forEach(e=>t(e,s,n));s.close(f,h,n)}(e,s,n);break;case Function:s.fnc(e,n);break;case String:s.text(e,n);break;case Boolean:s.text(""+e,n);break;case Number:const i=e,o=i.toLocaleString?i.toLocaleString():i.toString();s.text(o,n);break;case Date:const r=e,a=r.toLocaleString?r.toLocaleString():r.toString();s.text(a,n);break;default:s.obj(e,n)}},e.hjoin=function(t,e){const s=t.reduce((t,s)=>(t.push(s,e),t),[]);return s.splice(-1),s}},function(e,s){e.exports=t},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2idomPatch=e.hsml2idomPatch=void 0;const n=s(0),i=s(1);class o{open(t,e,s,n){const o=[];let r=e._id,a=e._classes?e._classes:[],c=e._ref,h=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":r=e[t];break;case"classes":const s=e[t];a=a.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":a=a.concat(e[t].split(" "));break;case"data":const i=e[t];for(const t in i)i.hasOwnProperty(t)&&(i[t].constructor===String?o.push("data-"+t,i[t]):o.push("data-"+t,JSON.stringify(i[t])));break;case"styles":o.push("style",e[t]);break;case"on":const c=e[t];"string"==typeof c[0]?"function"==typeof c[1]?o.push("on"+c[0],c[1]):o.push("on"+c[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(c[1],c[2],t)}):c.forEach(t=>{"function"==typeof t[1]?o.push("on"+t[0],t[1]):o.push("on"+t[0],e=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(t[1],t[2],e)})});break;default:switch(typeof e[t]){case"function":o.push("on"+t,e[t]);break;case"object":o.push(t,e[t]);break;case"boolean":e[t]&&o.push(t,t);break;default:o.push(t,e[t])}}return a.length&&o.unshift("class",a.join(" ")),r&&o.unshift("id",r),i.elementOpen(t,e._key,void 0,...o),e._skip&&i.skip(),n&&c&&(n.refs[c]=i.currentElement()),h&&h.mount&&h.mount.constructor===Function&&(h.mount(i.currentElement()),i.skip()),!!e._skip}close(t,e,s){i.elementClose(t)}text(t,e){i.text(t)}fnc(t,e){t(i.currentElement())&&i.skip()}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function r(t,e){n.hsml(t,new o,e)}e.hsml2idomPatch=function(t,e,s){i.patch(t,t=>t&&r(t,s),e)},e.hsmls2idomPatch=function(t,e,s){i.patch(t,t=>t&&function(t,e){for(const s of t)if(null!=s)if(s.constructor===String)i.text(s);else if("toHsml"in s){const t=s;t.toHsml&&r(t.toHsml(),t)}else r(s,e)}(t,s),e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FormValidator=e.BooleanValidator=e.DateValidator=e.NumberValidator=e.StringValidator=e.SelectValidator=e.tpl=e.Validator=e.rodneCisloRgex=e.pscRgex=e.phoneRgex=e.emailRegex=void 0;e.emailRegex=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,e.phoneRgex=/^(((00)([- ]?)|\+)(\d{1,3})([- ]?))?((\d{3})([- ]?))((\d{3})([- ]?))(\d{3})$/,e.pscRgex=/^\d{3} ?\d{2}$/,e.rodneCisloRgex=/^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$/;class n{constructor(t,e){this.str=null,this.err=null,this.obj=null,this.opts=t||{},this.msgs=e||{}}validate(t){if("string"==typeof t||null==t){const e=t;this.str=e;const s=this.strToObj(e);if(this.obj=s.obj,s.err)return this.err=s.err,{str:null==e?"":e,obj:s.obj,err:s.err};const n=this.objCheck(s.obj);return this.err=n,{str:null==e?"":e,obj:s.obj,err:n}}{this.str=null==t?null:""+t;const e=this.objCheck(t);return this.err=e,{str:this.str,obj:t,err:e}}}format(t,e){const s=this.objToStr(t,e);return{str:void 0===s.str||null===s.str?"":s.str,err:s.err}}}function i(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)}e.Validator=n,e.tpl=i;e.SelectValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{options:"options"in e?e.options.join(", "):""})):"required"}:{obj:void 0===t?null:t,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;return"options"in e&&t&&-1===e.options.indexOf(t)?s.invalid_option?i(s.invalid_option,Object.assign(Object.assign({},e.data),{option:null===t?"":t,options:"options"in e?e.options.join(", "):""})):"invalid_option":""}objToStr(t,e){return{str:t||"",err:""}}};e.StringValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):"",regexp:"regexp"in e?""+(e.regexp||""):""})):"required"}:t?"regexp"in e&&!e.regexp.test(t)?{obj:null,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{regexp:"regexp"in e?""+(e.regexp||""):""})):"invalid_format"}:{obj:t,err:""}:{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t.length>e.max&&(n=!0),"min"in e&&t.length<e.min&&(n=!0),"min"in e&&"max"in e&&t.length>e.max&&t.length<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){return{str:t||"",err:""}}};e.NumberValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"required"};if(t){const n=Number(t);let o=!1;if(isNaN(n)&&(o=!0),e.strict&&t!==this.objToStr(n).str&&(o=!0),o){const t=isNaN(n)?1234.45:n;return{obj:isNaN(n)?null:n,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{num:this.objToStr(t).str||""})):"invalid_format"}}return{obj:n,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t>e.max&&(n=!0),"min"in e&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){let s;return s=null==t?"":"decimals"in this.opts?t.toFixed(this.opts.decimals):String(t),{str:s,err:""}}};const o=t=>t.toLocaleString(),r=t=>t.toLocaleDateString(),a=t=>t.toISOString(),c=t=>new Date(t.toDateString()).toISOString();e.DateValidator=class extends n{constructor(t,e){super(t,e),(null==t?void 0:t.iso)?this.dateToStr=(null==t?void 0:t.dateOnly)?c:a:this.dateToStr=(null==t?void 0:t.dateOnly)?r:o,(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.min)&&(t.min=new Date(t.min.getFullYear(),t.min.getMonth(),t.min.getDate())),(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.max)&&(t.max=new Date(t.max.getFullYear(),t.max.getMonth(),t.max.getDate()+1))}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"required"};if(t){const n=Date.parse(t);let o=new Date(n);e.dateOnly&&(o=new Date(o.getFullYear(),o.getMonth(),o.getDate()));let r=!1;if(isNaN(n)&&(r=!0),r){const t=isNaN(n)?new Date:o;return{obj:isNaN(n)?null:o,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{date:this.objToStr(t).str||""})):"invalid_format"}}return{obj:o,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&e.max&&t.getTime()>e.max.getTime()&&(n=!0),"min"in e&&e.min&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"not_in_range":""}objToStr(t,e){return{str:null==t?"":this.dateToStr(t),err:""}}};e.BooleanValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign({},e.data)):"required"};let n;switch(t){case"true":case"1":case"on":case"yes":n=!0;break;default:n=!1}return{obj:n,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"value"in e&&t!==e.value&&(n=!0),n?s.invalid_value?i(s.invalid_value,Object.assign(Object.assign({},e.data),{value:"value"in e?""+(e.value||""):""})):"invalid_value":""}objToStr(t,e){return{str:null==t?"":""+t,err:""}}};e.FormValidator=class{constructor(){this.validators={}}addValidator(t,e){return this.validators[t]=e,this}validate(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].validate(n);return e.str[s]=i.str,e.obj[s]=i.obj,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}format(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].format(n);return e.str[s]=i.str,e.obj[s]=n,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}data(){return{str:this.str,obj:this.obj,err:this.err,valid:this.valid}}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Events=void 0;e.Events=class{constructor(t){this._cb=[],this._cbs={},t&&(this._ctx=t)}emit(t,e){if(t in this._cbs)for(let s=0,n=this._cbs[t].length;s<n;s++)this._cbs[t][s](e,t,this._ctx);for(let s=0,n=this._cb.length;s<n;s++)this._cb[s](e,t,this._ctx);return this}on(t,e){const s=t;return s in this._cbs||(this._cbs[s]=[]),-1===this._cbs[s].indexOf(e)&&this._cbs[s].push(e),this}any(t){return this._cb.push(t),this}once(t,e){const s=t,n=(t,i,o)=>{this.off(s,n),e(t,i,o)};return this.on(t,n),this}off(t,e){return void 0===t&&(e?this._cb=this._cb.filter(t=>t!==e):this._cb.length=0),t&&t in this._cbs&&(e?this._cbs[t].splice(this._cbs[t].indexOf(e),1):(this._cbs[t].length=0,delete this._cbs[t])),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2htmls=e.hsml2htmls=e.hsmls2html=e.hsml2html=void 0;const n=s(0);class i{constructor(t,e=!1,s=" "){this._depth=0,this._onHtml=t,this._pretty=e,this._indent=s}open(t,e,s,o){const r=[];let a=e._id,h=e._classes?e._classes:[],l=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":a=e[t];break;case"classes":const s=e[t];h=h.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":h=h.concat(e[t].split(" "));break;case"data":const n=e[t];for(const t in n)n.hasOwnProperty(t)&&(n[t].constructor===String?r.push(["data-"+t,n[t]]):r.push(["data-"+t,JSON.stringify(n[t])]));break;case"styles":const i=e[t];let o="";for(const t in i)if(i.hasOwnProperty(t)){o+=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()+":"+i[t]+";"}r.push(["style",o]);break;case"styles":case"on":break;default:"function"==typeof e[t]||("boolean"==typeof e[t]?e[t]&&r.push([t,""]):r.push([t,e[t]]))}h.length&&r.unshift(["class",h.join(" ")]),a&&r.unshift(["id",a]),l&&"type"in l&&r.unshift(["hObj",l.type]);const u=r.map(t=>`${t[0]}="${c(t[1])}"`).join(" ");let d="";this._pretty&&(d+=this._mkIndent(this._depth),this._depth++);if(d+="<"+t+(u?" "+u:"")+(s.length||-1!==i._pairTags.indexOf(t)?">":"/>"),this._pretty&&(d+="\n"),this._onHtml(d),l&&"render"in l&&l.render.constructor===Function){const t=l.render();for(const e of t)if(null!=e)if(e.constructor===String)this._onHtml(e+(this._pretty?"\n":""));else if("toHsml"in e){const t=e;t.toHsml&&n.hsml(t.toHsml(),this)}else n.hsml(e,this)}return!1}close(t,e,s){let n="";const o=e.length||-1!==i._pairTags.indexOf(t);this._pretty&&(this._depth--,o&&(n+=this._mkIndent(this._depth))),o&&(n+="</"+t+">",this._pretty&&(n+="\n"),this._onHtml(n))}text(t,e){let s="";this._pretty&&(s+=this._mkIndent(this._depth)),s+=t instanceof String?t:c(t),this._pretty&&(s+="\n"),this._onHtml(s)}fnc(t,e){}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}_mkIndent(t){let e="";for(let s=0;s<t;s++)e+=this._indent;return e}}function o(t,e,s=!1){const o=new i(e,s);n.hsml(t,o)}function r(t,e,s=!1){for(const n of t)if(null!=n)if(n.constructor===String)e(n+(s?"\n":""));else if("toHsml"in n){const t=n;t.toHsml&&o(t.toHsml(),e,s)}else o(n,e,s)}i._pairTags=["script","iframe","html","head","body","title","div","h1","h2","h3","h4","h5","h6","p","a","pre","blockquote","i","b","em","strong","tt","cite","ol","ul","li","dl","dt","dd","table","tr","td","textarea","select","option"],e.hsml2html=o,e.hsmls2html=r,e.hsml2htmls=function(t,e=!1){const s=[];return o(t,t=>s.push(t),e),s},e.hsmls2htmls=function(t,e=!1){const s=[];return r(t,t=>s.push(t),e),s};const a=/["'&<>]/;function c(t){const e=""+t,s=a.exec(e);if(!s)return e;let n,i="",o=0,r=0;for(o=s.index;o<e.length;o++){switch(e.charCodeAt(o)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}r!==o&&(i+=e.substring(r,o)),r=o+1,i+=n}return r!==o?i+e.substring(r,o):i}},function(t,e,s){"use strict";function n(t,e=300){let s;return function(...n){clearTimeout(s),s=setTimeout(()=>{t.apply(this,n)},e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.Debounce=e.debounce=void 0,e.debounce=n,e.Debounce=function(t=300){return function(e,s,i){const o=i.value;return i.value=n(o,t),i}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.addEventListener=e.html=e.empty=e.remove=e.replace=e.append=e.select=e.selectAll=void 0,e.selectAll=function(t,e){const s=(e||document).querySelectorAll(t),n=[];for(let t=0;t<s.length;t++)n.push(s[t]);return n},e.select=function(t,e){return(e||document).querySelector(t)},e.append=function(t,...e){e.forEach(e=>t.appendChild(e))},e.replace=function(t,e){t.parentElement&&t.parentElement.replaceChild(e,t)},e.remove=function(t){t.parentElement&&t.parentElement.removeChild(t)},e.empty=function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},e.html=function(t){t=t.trim();let e={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],body:[0,"",""],_default:[1,"<div>","</div>"]};e.optgroup=e.option,e.tbody=e.tfoot=e.colgroup=e.caption=e.thead,e.th=e.td;const s=/<\s*\w.*?>/g.exec(t);let n=document.createElement("div");if(null!=s){const i=s[0].replace(/</g,"").replace(/>/g,"").split(" ")[0];if("body"===i.toLowerCase()){const e=document.createElement("body");n.innerHTML=t.replace(/<body/g,"<div").replace(/<\/body>/g,"</div>");const s=n.firstChild.attributes;e.innerHTML=t;for(let t=0;t<s.length;t++)e.setAttribute(s[t].name,s[t].value);return e}{const s=e[i]||e._default;t=s[1]+t+s[2],n.innerHTML=t;let o=s[0]+1;for(;o--;)n=n.lastChild}}else n.innerHTML=t,n=n.lastChild;return n},Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){const e=(this.document||this.ownerDocument).querySelectorAll(t);let s=e.length;for(;--s>=0&&e.item(s)!==this;);return s>-1}),e.addEventListener=function(t,e,s,n,i=!1){t.addEventListener(s,(function(t){const s=t||window.event,i=s.target||t.srcElement;i&&i.matches(e)&&n(i,s)}),i)},e.removeEventListener=function(t,e,s,n=!1){t.removeEventListener(e,s,n)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Base64=e.UrlEncodedData=void 0;e.UrlEncodedData=class{static encode(t,e=""){let s;if("object"!=typeof t)s=t;else{const n=[];let i=0;for(let s in t)if(t.hasOwnProperty(s)){let o=t[s];o instanceof Array||(o=[o]);const r=o.length;for(let t=0;t<r;t++){const r=o[t];"object"==typeof r&&null!=r?n[i++]=arguments.callee(r,e+s+"."):(n[i]=encodeURIComponent(e+s),null!=r&&(n[i]+="="+encodeURIComponent(r)),i++)}}s=n.join("&")}return s}static decode(t){const e={};if(t){const s=t.split("&"),n=s.length;for(let t=0;t<n;t++){const n=s[t].split("="),i=decodeURIComponent(n[0]);if(n.length>1){const t=decodeURIComponent(n[1]),s=i.split("."),o=s.length;let r=e;for(let e=0;e<o;e++){const n=s[e],i=r[n];e===o-1?i?i instanceof Array?r[n].push(t):(r[n]=[i],r[n][1]=t):r[n]=t:(i||(r[n]={}),r=r[n])}}else e[i]=null}}return e}};class n{static encode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=n._utf8_encode(t);l<t.length;)e=t.charCodeAt(l++),s=t.charCodeAt(l++),i=t.charCodeAt(l++),o=e>>2,r=(3&e)<<4|s>>4,a=(15&s)<<2|i>>6,c=63&i,isNaN(s)?a=c=64:isNaN(i)&&(c=64),h=h+n._keyStr.charAt(o)+n._keyStr.charAt(r)+n._keyStr.charAt(a)+n._keyStr.charAt(c);return h}static decode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<t.length;)o=this._keyStr.indexOf(t.charAt(l++)),r=this._keyStr.indexOf(t.charAt(l++)),a=this._keyStr.indexOf(t.charAt(l++)),c=this._keyStr.indexOf(t.charAt(l++)),e=o<<2|r>>4,s=(15&r)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(e),64!==a&&(h+=String.fromCharCode(s)),64!==c&&(h+=String.fromCharCode(i));return h=n._utf8_decode(h),h}static _utf8_encode(t){t=t.replace(/\r\n/g,"\n");let e="";for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}static _utf8_decode(t){let e="",s=0,n=0,i=0,o=0;for(;s<t.length;)n=t.charCodeAt(s),n<128?(e+=String.fromCharCode(n),s++):n>191&&n<224?(i=t.charCodeAt(s+1),e+=String.fromCharCode((31&n)<<6|63&i),s+=2):(i=t.charCodeAt(s+1),o=t.charCodeAt(s+2),e+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),s+=3);return e}}e.Base64=n,n._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Form=e.FileEntry=e.RadioEntry=e.SelectEntry=e.CheckboxEntry=e.NumberInputEntry=e.TextInputEntry=e.TextAreaEntry=void 0;e.TextAreaEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.TextInputEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.NumberInputEntry=class{constructor(t){this._decimals=0,this._dragSensitivity=1,this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this.setDecimals(2)}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return isNaN(+t)||(this._element.value=(+t).toFixed(this._decimals)),this}setStep(t){return isNaN(t)||(this._element.step=""+t),this}setMin(t){return isNaN(t)||(this._element.min=""+t),this}setMax(t){return isNaN(t)||(this._element.max=""+t),this}setDecimals(t){return isNaN(t)||(this._decimals=t),this}setDragSensitivity(t){return isNaN(t)||(this._dragSensitivity=t),this}enableMouseWheel(){const t=()=>{this._onChange&&setTimeout(()=>{this._onChange&&this._onChange(this,!1)},0)};return this._element.addEventListener("focus",()=>{this._element.addEventListener("mousewheel",t)}),this._element.addEventListener("blur",()=>{this._element.removeEventListener("mousewheel",t)}),this}enableMouseDrag(){return this._element.addEventListener("mousedown",t=>{document.body.style.cursor="row-resize",this._element.style.cursor="row-resize";const e=t.pageY,s=Number(this.getValue()),n=""===this._element.min?null:Number(this._element.min),i=""===this._element.max?null:Number(this._element.max),o=""===this._element.step?1:Number(this._element.step),r=isNaN(s)?null===n?0:n:s,a=t=>{const s=(t.pageY-e)*this._dragSensitivity,a=r-s*o;null!==n&&a<n?this.setValue(n.toFixed(this._decimals)):null!==i&&a>i?this.setValue(i.toFixed(this._decimals)):this.setValue(a.toFixed(this._decimals)),this._onChange&&this._onChange(this,!1)},c=()=>{document.body.style.cursor="",this._element.style.cursor="",document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c),this._onChange&&this._onChange(this,!0)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.CheckboxEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return""+this._element.checked}setValue(t){return this._element.checked=!(!t||"false"===t),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.SelectEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}setOptions(t){const e=this._element;for(;e.options.length>0;)e.remove(0);return t.forEach(t=>{const s=document.createElement("option");s.text=t.text,s.value=t.value,e.add(s)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.RadioEntry=class{constructor(t){this._elements=[],t.forEach(t=>{"string"==typeof t?this._elements.push(document.getElementById(t)):this._elements.push(t)}),this._elements.forEach(t=>{t.addEventListener("change",()=>{this._onChange&&t.checked&&this._onChange(this)})})}getName(){return this._elements[0].name}getValue(){for(let t of this._elements)if(t.checked)return t.value}setValue(t){for(let e of this._elements)e.value===t&&(e.checked=!0);return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.FileEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){const t=this._element.files;return t&&t.length?t[0].name+" ("+t[0].type+", "+t[0].size+")":void 0}getFile(){return this._element.files&&this._element.files.length?this._element.files[0]:null}setValue(t){return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.Form=class{constructor(t){this._formEntries=[],this._element="string"==typeof t?document.getElementById(t):t,this._element.onsubmit=t=>(t.preventDefault(),this._onSubmit&&this._onSubmit(this),!1)}addEntry(t){return this._formEntries.push(t),this}setEntries(t){return this._formEntries=t,this}getEntries(){return this._formEntries}getEntry(t){for(let e of this._formEntries)if(e.getName()===t)return e}validate(t){const e={};for(let s of this._formEntries)e[s.getName()]=s.validate(t);return e}isValid(t){t||(t=this.validate());for(let e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}getValues(){const t={};for(let e of this._formEntries)t[e.getName()]=e.getValue();return t}submit(){this._element.submit()}onSubmit(t){return this._onSubmit=t,this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=void 0;e.Hash=class{constructor(t=!0){this._encode=t=>String(t),this._decode=t=>t,this._emitWritten=t}onChange(t){return this._cb=t,this}coders(t,e){return this._encode=t,this._decode=e,this}listen(){if(this._cb&&this._cb(this.read()),"onhashchange"in window)onhashchange=()=>{const t=this._hash===location.hash;this._hash=void 0,!this._emitWritten&&t||this._cb&&this._cb(this.read())};else{console.warn('browser "window.onhashchange" not implemented, running emulation');let t=location.hash;this._iId&&clearInterval(this._iId),this._iId=setInterval(()=>{if(location.hash!==t){t=location.hash;const e=this._hash===location.hash;this._hash=void 0,!this._emitWritten&&e||this._cb&&this._cb(this.read())}},500)}return this}read(){return this._decode(decodeURIComponent(location.hash.slice(1)))}write(t){return location.hash="#"+encodeURIComponent(this._encode(t)),this._hash=location.hash,this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.History=void 0;e.History=class{back(){window.history.back()}forward(){window.history.forward()}go(t){window.history.go(t)}length(){return window.history.length}state(){return window.history.state}pushState(t,e,s){window.history.pushState(t,e,s)}replaceState(t,e,s){window.history.replaceState(t,e,s)}onChange(t){return window.addEventListener("popstate",(function(e){t(e.state)})),this}}},function(t,e,s){"use strict";var n=this&&this.__awaiter||function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.HApp=e.HAppAction=void 0;const i=s(2),o=console.log,r=console.error;var a;!function(t){t._init="_init",t._mount="_mount",t._umount="_umount"}(a=e.HAppAction||(e.HAppAction={}));const c=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},h=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class l{constructor(t,e,s,i=document.body){this.refs={},this.dispatch=(t,e,s)=>n(this,void 0,void 0,(function*(){if(l.debug){o("HApp action:",{type:t,data:e,event:s});const n=performance.now();try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}const i=performance.now();o("HApp dispatch:",i-n+" ms",this.state)}else try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}})),this.render=()=>{if(l.debug){const t=performance.now();let e;try{e=this.view(this.state)}catch(t){r("HApp render:",t)}const s=performance.now();return o("HApp render:",s-t+" ms",e),e||[]}{let t;try{t=this.view(this.state)}catch(t){r("HApp render:",t)}return t||[]}},this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e=t.target;switch(e.nodeName){case"FORM":t.preventDefault();const s=e.elements,n={};for(let t=0;t<s.length;t++){const e=d(s[t]);if("object"==typeof e){const i=Object.keys(e);if(i.length){const o=i[0],r=e[o];void 0===n[o]?n[o]=r:"string"==typeof n[o]||n[o]instanceof String?n[o]=r instanceof Array?[n[o],...r]:[n[o],r]:n[o]instanceof Array?r instanceof Array?n[o]=n[o].concat(r):n[o].push(r):n[o]=r instanceof Array?[n[o],...r]:[n[o],r],n[o]instanceof Array&&(n[o]=n[o].filter(t=>null!==t),"radio"===s[t].type&&(n[o]=n[o].length?n[o][0]:null))}}}return n;default:return d(e)}}(s)),this.dispatch(t,e,s)},this.mount=(t=document.body)=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.app){e.app.umount()}if(!this.dom){this.dom=e,e.app=this;u(e,this.render(),this),this._onUpdate&&this._onUpdate(this),this.dispatch(a._mount,this.dom)}return this},this.umount=()=>{if(this.dom){this.dispatch(a._umount,this.dom),this.dom.hasAttribute("app")&&this.dom.removeAttribute("app");const t=this.dom.querySelectorAll("[app]");for(let e=0;e<t.length;e++){const s=t[e].app;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.app,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=c(()=>{if(this.dom){const t=this.render();u(this.dom,t,this)}this._updateSched=void 0,this._onUpdate&&this._onUpdate(this)})),this),this.onUpdate=t=>(this._onUpdate=t,this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0}];h(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.app=this,this.dispatch(a._mount,this.dom))}),["div",t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.state=t,this.view=e,this.dispatcher=s||(t=>n(this,void 0,void 0,(function*(){return o("HApp action:",t.type,t.data)}))),this.dispatch(a._init).then(()=>this.mount(i))}}function u(t,e,s){if(l.debug){const n=performance.now();i.hsmls2idomPatch(t,e,s);const r=performance.now();o("HApp update:",r-n+" ms",t)}else i.hsmls2idomPatch(t,e,s)}function d(t){let e=null;switch(t.nodeName){case"INPUT":const s=t;switch(s.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":e=s.name?{[s.name]:s.value}:s.value;break;case"radio":e=s.name?{[s.name]:s.checked?s.value:null}:s.checked?s.value:null;break;case"checkbox":e="on"===s.value?s.name?{[s.name]:String(s.checked)}:String(s.checked):s.name?{[s.name]:s.checked?String(s.value):null}:s.checked?String(s.value):null}break;case"SELECT":const n=t;if(n.multiple){const t=Array.from(n.selectedOptions).map(t=>t.value);e=n.name?{[n.name]:t}:t}else e=n.name?{[n.name]:n.value}:n.value;break;case"TEXTAREA":const i=t;e=i.name?{[i.name]:i.value}:i.value;break;case"BUTTON":const o=t;e=o.name?{[o.name]:o.value}:o.value}return e}e.HApp=l,l.debug=!1},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2dom=e.hsml2dom=void 0;const n=s(0);class i{open(t,e,s,n){const i=document.createElement(t);let o=e._id,r=e._classes?e._classes:[],a=e._ref,c=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":o=e[t];break;case"classes":const s=e[t];r=r.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":r=r.concat(e[t].split(" "));break;case"data":const a=e[t];for(const t in a)a.hasOwnProperty(t)&&(a[t].constructor===String?i.dataset[t]=a[t]:i.dataset[t]=JSON.stringify(a[t]));break;case"styles":const c=e[t];for(const t in c)c.hasOwnProperty(t)&&(i.style[t]=c[t]);break;case"on":const h=e[t];"string"==typeof h[0]?"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)}):h.forEach(t=>{"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)})});break;default:"function"==typeof e[t]?i.addEventListener(t,e[t]):"boolean"==typeof e[t]?e[t]&&i.setAttribute(t,""):i.setAttribute(t,e[t])}return o&&i.setAttribute("id",o),r.length&&i.classList.add(...r),this._current?(this._current.appendChild(i),this._current=i):(this.element=i,this._current=i),n&&a&&(n.refs[a]=this._current),c&&c.mount&&c.mount.constructor===Function&&c.mount(i),!!e._skip}close(t,e,s){this._current!==this.element&&this._current&&(this._current=this._current.parentElement||void 0)}text(t,e){this._current&&this._current.appendChild(document.createTextNode(t))}fnc(t,e){this._current&&t(this._current)}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function o(t,e){const s=new i;return n.hsml(t,s,e),s.element}e.hsml2dom=o,e.hsmls2dom=function(t,e){const s=[];for(const n of t)if(null!=n)if(n.constructor===String)s.push(document.createTextNode(n));else if("toHsml"in n){const t=n;t.toHsml&&s.push(o(t.toHsml(),t))}else s.push(o(n,e));return s}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.h=void 0,e.h=function(t,e,s){const n=[t];return e&&("string"==typeof e||"number"==typeof e?n.push([e]):(Array.isArray(e),n.push(e))),s&&("string"==typeof s||"number"==typeof s?n.push([s]):(Array.isArray(s)||"function"==typeof s)&&n.push(s)),n}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HCtrl=void 0;const n=s(2),i=s(1),o=(t,e,s)=>n=>{if(n.ctrl){const i=n.ctrl;if(i.view===t.view)void 0!==e&&(i.state=e),i.update();else{i.umount();const o=new c(t,s);void 0!==e&&(o.state=e),o.mount(n)}}else{const i=new c(t,s);void 0!==e&&(i.state=e),i.mount(n)}return!0},r=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},a=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class c{constructor(t,e){this.type="Ctrl",this.id=this.type+"-"+c._count++,this.refs={},this.appAction=(t,e,s)=>{c.debug&&console.log("appAction",this.type,t,e,s),c.appActions&&c.appActions(this,t,e,s)},this.extAction=(t,e,s)=>{c.debug&&console.log("extAction",this.type,t,e,s),this._extAction&&this._extAction(t,e,s)},this.action=(t,e,s)=>{c.debug&&console.log("action",this.type,t,e,s),this._actions&&this._actions(this,t,e,s)},this.render=()=>this.view(this.state,this.action,o),this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e={},s=t.target;switch(s.nodeName){case"INPUT":const t=s;switch(t.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":case"radio":case"number":e[t.name]=t.value;break;case"checkbox":e[t.name]=""+t.checked}break;case"SELECT":const n=s;e[n.name]=n.value;break;case"TEXTAREA":const i=s;e[i.name]=i.innerText;break;case"BUTTON":const o=s;e[o.name]=o.value}return e}(s)),this.action(t,e,s)},this.mount=t=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.ctrl){const t=e.ctrl;t&&t.umount()}if(!this.dom){c._ctrls[this.id]=this,this.dom=e,e.ctrl=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("ctrl",this.type),this.action("_mount",this.dom)}return this},this.umount=()=>{if(this.dom){delete c._ctrls[this.id],this.action("_umount",this.dom),this.dom.hasAttribute("ctrl")&&this.dom.removeAttribute("ctrl");const t=this.dom.querySelectorAll("[ctrl]");for(let e=0;e<t.length;e++){const s=t[e].ctrl;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.ctrl,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=r(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,ctrl:this.type}];a(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.ctrl=this,c._ctrls[this.id]=this,this.action("_mount",this.dom))}),["div",{_id:this.id,_key:this.id,ctrl:this.type},t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.view=t.view,this.type=t.type,this.state=t.state,this._actions=t.actions,this._extAction=e||this.appAction,this.action("_init")}appActions(t){return c.appActions=t,this}appCtrls(){return Object.values(c._ctrls)}}e.HCtrl=c,c.debug=!1,c._count=0,c._ctrls={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&t.ctrl){const e=t.ctrl;e&&e.umount()}})}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.htmls=e.html=void 0;const n=s(5),i=(t,e,s)=>{},o=(t,e)=>t.view(e||t.state,i,o);e.html=function(t,e,s,r=!1){n.hsmls2html(t.view(e,i,o),s,r)},e.htmls=function(t,e,s=!1){return n.hsmls2htmls(t.view(e,i,o),s).join("")}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HWidget=void 0;const n=s(2),i=s(1),o=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},r=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class a{constructor(t){this.type=this.constructor.name,this.id=this.type+"-"+a._count++,this.refs={},this.toHtml=()=>this.dom?this.dom.outerHTML:"",t&&(this.type=t)}onMount(){console.log("mount")}onUmount(){console.log("umount")}actions(t,e){console.log(t,e)}action(t,e){this.actions(t,e)}actionCb(t,e,s){e=e&&e.constructor===Function?e(s):void 0===e?s:e,this.action(t,e)}mount(t){const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if("widget"in e){const t=e.widget;t&&t.umount()}if(!this.dom){a.mounted[this.id]=this,this.dom=e,e.widget=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("widget",this.type),this.onMount&&this.onMount()}return this}umount(){if(this.dom){delete a.mounted[this.id],this.onUmount&&this.onUmount(),this.dom.hasAttribute("widget")&&this.dom.removeAttribute("widget");const t=this.dom.querySelectorAll("[widget]");for(let e=0;e<t.length;e++){const s=t[e].widget;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.widget,this.dom=void 0}return this}update(){return this.dom&&!this._updateSched&&(this._updateSched=o(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this}toHsml(){if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,widget:this.type}];r(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.widget=this,this.onMount&&this.onMount())}),["div",{_id:this.id,_key:this.id,widget:this.type},t]}}e.HWidget=a,a._count=0,a.mounted={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&"widget"in t){const e=t.widget;e&&e.umount()}})}},function(t,e,s){"use strict";function n(t){return Array.isArray?Array.isArray(t):null!=t&&void 0!==t&&-1==="boolean|number|string|function|xml".indexOf(typeof t)&&("number"==typeof t.length&&!t.propertyIsEnumerable("length"))}function i(t){const e=[];for(const s in t)if(t.hasOwnProperty(s)){const i=t[s];if("object"==typeof i)if(n(i))for(const t of i)e.push([s,"object"==typeof t?JSON.stringify(t):t]);else e.push([s,JSON.stringify(i)]);else e.push([s,i])}for(let t,s=0;t=e[s++];)e[s-1]=`${encodeURIComponent(t[0])}=${encodeURIComponent(t[1])}`;return e.join("&")}Object.defineProperty(e,"__esModule",{value:!0}),e.http=e.onError=e.onResponse=e.onRequest=e.del=e.patch=e.put=e.post=e.get=e.HttpRequest=e.authBasic=e.HttpResponse=e.encodeUrlQuery=e.decodeUrlQuery=e.isArray=void 0,e.isArray=n,e.decodeUrlQuery=function(t){const e={};if(t){const s=t.substr(1).split("&");for(const t of s){const s=t.split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1]||"")}}return e},e.encodeUrlQuery=i;class o{constructor(t){this._xhr=t}getHeaders(){return this._xhr.getAllResponseHeaders()}getHeader(t){return this._xhr.getResponseHeader(t)}getBody(){return this._xhr.response}getType(){return this._xhr.responseType}getContentType(){return this.getHeader("Content-Type")}getText(){return this._xhr.responseText}getJson(){return JSON.parse(this._xhr.responseText)}getXml(){return this._xhr.responseXML}}e.HttpResponse=o,e.authBasic=(t,e)=>s=>{s.headers({Authorization:"Basic "+btoa(t+":"+e)})};class r{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){r.xhrs.forEach(t=>t.abort()),r.xhrs.length=0}get(t,e){return this.method("GET"),this.url(t,e),this}post(t,e){return this.method("POST"),this.url(t,e),this}put(t,e){return this.method("PUT"),this.url(t,e),this}patch(t,e){return this.method("PATCH"),this.url(t,e),this}del(t,e){return this.method("DELETE"),this.url(t,e),this}url(t,e){return this._url=t,this._query=e,this}method(t){return this._method=t,this}headers(t){for(const e in t)t.hasOwnProperty(e)&&(this._headers[e]=t[e]);return this}use(t){return t(this),this}timeout(t){return this._timeout=t,this}responseType(t){return this._responseType=t,this}onProgress(t){return this._onProgress=t,this}onResponse(t){return this._onResponse=t,this}onError(t){return this._onError=t,this}async(t=!0){return this._async=t,this}noCache(t=!0){return this._noCache=t,this}abort(){return this._xhr&&this._xhr.abort(),this}send(t,e){e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)}sendPromise(t,e){return new Promise((s,n)=>{this._onResponse=s,this._onError=n,e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)})}_send(t,e){const s=new XMLHttpRequest;this._xhr=s;let n=this._url||"";if(this._query){const t=i(this._query);n=t?`${n}?${t}`:n}if(this._noCache&&(n+=(/\?/.test(n)?"&":"?")+(new Date).getTime()),this._responseType&&(this._xhr.responseType=this._responseType),"onprogress"in s&&this._onProgress){const t=t=>{this._onProgress({loaded:t.loaded,total:t.lengthComputable?t.total:void 0})};s.upload.onprogress=t,s.onprogress=t}r.xhrs.push(this),s.open(this._method,n,this._async);for(const t in e)e.hasOwnProperty(t)&&s.setRequestHeader(t,e[t]);if(this._timeout&&(s.timeout=this._timeout),"ontimeout"in s&&(this._onError||r.onError)&&(s.ontimeout=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),"onabort"in s&&(this._onError||r.onError)&&(s.onabort=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),(this._onError||r.onError)&&(s.onerror=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),!this._async){if(t){const e="string"==typeof t?t:JSON.stringify(t);s.send(e)}else s.send();return JSON.parse(s.responseText)}"onload"in s?s.onload=t=>{if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}:s.onreadystatechange=t=>{switch(s.readyState){case 4:if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}},void 0!==t?"string"==typeof t||t instanceof FormData||t instanceof Blob?s.send(t):(this._headers["Content-Type"]||s.setRequestHeader("Content-Type","application/json"),s.send(JSON.stringify(t))):s.send()}}function a(t,e){return(new r).method("GET").url(t,e)}function c(t,e){return(new r).method("POST").url(t,e)}function h(t,e){return(new r).method("PUT").url(t,e)}function l(t,e){return(new r).method("DELETE").url(t,e)}function u(t){r.onRequest=t}function d(t){r.onResponse=t}function m(t){r.onError=t}e.HttpRequest=r,r.xhrs=[],e.get=a,e.post=c,e.put=h,e.patch=function(t,e){return(new r).method("PATCH").url(t,e)},e.del=l,e.onRequest=u,e.onResponse=d,e.onError=m,e.http={get:a,post:c,put:h,delete:l,onRequest:u,onResponse:d,onError:m}},function(t,e,s){"use strict";function n(t,e){const s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.src=t,s.readyState?s.onreadystatechange=()=>{const t="loaded"===s.readyState,n="complete"===s.readyState;(t||n)&&(s.onreadystatechange=null,"function"==typeof e&&e())}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.css=e.image=e.scripts=e.script=e.scriptLib=void 0,e.scriptLib=function(t,e,s){n(t,()=>{const t=window[e];window[e]={},delete window[e],s&&s(t)})},e.script=n,e.scripts=function(t,e){t.reverse();let s=e;for(let e=0;e<t.length;e++){s=((t,e)=>()=>n(t,()=>e&&e()))(t[e],s)}s&&s()},e.image=function(t,e){const s=new Image;s.src=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()}},e.css=function(t,e){const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}},function(t,e,s){"use strict";function n(t,e=[],s={}){return Object.keys(t).reduce((s,i)=>{const o=e.concat(i);return"object"==typeof t[i]&&null!==t[i]?n(t[i],o,s):0===s[t[i]]||s[t[i]]?s[t[i]].push(o):s[t[i]]=[o],s},s)}Object.defineProperty(e,"__esModule",{value:!0}),e.objValuePaths=e.objPaths=void 0,e.objPaths=function(t){const e=n(t);return Object.keys(e).map(t=>e[t]).reduce((t,e)=>t.concat(e))},e.objValuePaths=n},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.route=e.Router=e.Route=e.Emitter=void 0;class n{constructor(){this._callbacks={}}on(t,e){return t in this._callbacks||(this._callbacks[t]=[]),this._callbacks[t].push(e),this}emit(t,...e){return t in this._callbacks&&this._callbacks[t].forEach(t=>t.apply(this,e)),this}off(t,e){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;const s=this._callbacks[t];if(!s)return this;if(1===arguments.length)return delete this._callbacks[t],this;for(let t=0;t<s.length;t++){if(s[t]===e){s.splice(t,1);break}}return this}}e.Emitter=n;class i{constructor(t){this._params={},this.keys=[],this.path=t,this._pathParse(t,!1,!1)}match(t,e){const s=this._regex.exec(t);if(!s)return!1;for(let t=1;t<s.length;++t){const n=this.keys[t-1],i="string"==typeof s[t]?decodeURIComponent(s[t]):s[t];n&&(this._params[n.name]=i),e.push(i)}return!0}_pathParse(t,e,s){t instanceof RegExp?this._regex=t:(t instanceof Array&&(t="("+t.join("|")+")"),t=t.concat(s?"":"/?").replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,(t,e,s,n,i,o)=>(this.keys.push({name:n,optional:!!o}),e=e||"",(o?"":e)+"(?:"+(o?e:"")+(s||"")+(i||(s?"([^/.]+?)":"([^/]+?)"))+")"+(o||""))).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),this._regex=new RegExp("^"+t+"$",e?"":"i"))}}e.Route=i;class o extends n{constructor(){super(),this._routes=[],this._onHashChange=()=>{this.handle(this.hash())},window.addEventListener?window.addEventListener("hashchange",this._onHashChange,!1):window.attachEvent("onhashchange",this._onHashChange)}static route(t,e){return o.default.route(t,e),o.default}static navigate(t,e=!1){return o.default.navigate(t,e),o.default}static start(){return o.default.start(),o.default}static hash(){return o.default.hash()}static handle(t){return o.default.handle(t)}route(t,e){const s=new i(t);return this._routes.push(s),this.on(t,(t,s)=>e.apply(s,t)),this}navigate(t,e=!1){const s=this.hash();return window.location.hash=t,e&&s===t&&this.handle(t),this}start(){return this._onHashChange(),this}hash(){return window.location.hash.substring(1)}handle(t){for(const e of this._routes){const s=[];if(e.match(t,s)){this.emit(e.path,s,e);break}}return this}}e.Router=o,o.default=new o,e.route=function(t,e){return o.route(t,e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Settings=void 0;const n=s(4);e.Settings=class{constructor(t,e="settings"){this.events=new n.Events,this.props=t,this.name=e}getProps(){return this.props}setProps(t){return Object.keys(t).forEach(e=>this.props[e]=t[e]),this.events.emit("",t),this}getProp(t){return this.props[t]}setProp(t,e){this.props[t]=e;return this.events.emit(t,e),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Signal=void 0;e.Signal=class{constructor(){this._slots=[],this._emit=!0}onConnect(t){this._onConnect=t}onDisconnect(t){this._onDisconnect=t}connNo(){return this._slots.length}connect(t,e){"function"==typeof t&&(e?this._slots.push({callback:t,object:e}):this._slots.push({callback:t}),this._onConnect&&this._onConnect(this._slots.length))}disconnect(t,e){"function"==typeof t&&(this._slots=this._slots.filter(s=>void 0===e?s.callback!==t:s.callback!==t&&s.object!==e),this._onDisconnect&&this._onDisconnect(this._slots.length))}disconnectAll(){this._slots=[],this._onDisconnect&&this._onDisconnect(this._slots.length)}freeze(){this._emit=!1}unfreeze(){this._emit=!0}emit(t){return this._emit&&this._slots.length?this._slots.map(e=>{const s=e.object;return s?e.callback.call(s,t):e.callback(t)}):[]}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.template=e.tmpl=void 0,e.tmpl=function(t,e){const s=/[^a-zA-Z0-9_-]+/.test(t)?t:document.getElementById(t).innerHTML;let n,i,o=JSON.stringify,r=/\$\{([\S\s]*?)\}/g,a=[],c=0;for(;i=r.exec(s);)n=s.slice(c,i.index),a.push(o(n),"("+i[1]+")"),c=r.lastIndex;n=s.slice(c),a.push(o(n));const h=new Function("obj","with(obj)return "+a.join("+"));return e?h(e):h};const n={};e.template=function t(e,s){const i=/[^a-zA-Z0-9_-]+/.test(e)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%\>/g,"',$1,'").split("\t").join("');").split("%>").join("\np.push('").split("\r").join("\\'")+"');}return p.join('');"):n[e]=n[e]||t(document.getElementById(e).innerHTML);return s?i(s):i}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tmpl=e.tmplo=e.tmpla=e.tmpls=void 0,e.tmpls=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)},e.tmpla=function(t,e){return e.reduce((t,e,s)=>t.replace(new RegExp(`\\$\\{${s}\\}`,"g"),e),t)},e.tmplo=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\$\\{${e[0]}\\}`,"g"),e[1]),t)},e.tmpl=function(t){const e=JSON.stringify,s=/\$\{([\S\s]*?)\}/g,n=[];let i,o,r=0;for(;i=s.exec(t);)o=t.slice(r,i.index),n.push(e(o),"("+i[1]+")"),r=s.lastIndex;return o=t.slice(r),n.push(e(o)),new Function("obj","with(obj)return "+n.join("+"))}},,,,function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validators=e.tmpl=e.template=e.signal=e.settings=e.router=e.objpaths=e.load=e.http=e.hsml=e.hsmlwidget=e.hsmlsvac=e.hsmlsvachtml=e.hsmlsvacctrl=e.hsmlidom=e.hsmlhtml=e.hsmlh=e.hsmldom=e.hsmlapp=e.history=e.hash=e.form=e.events=e.encode=e.dom=e.debounce=void 0;const n=s(6);e.debounce=n;const i=s(7);e.dom=i;const o=s(8);e.encode=o;const r=s(4);e.events=r;const a=s(9);e.form=a;const c=s(10);e.hash=c;const h=s(11);e.history=h;const l=s(12);e.hsmlapp=l;const u=s(13);e.hsmldom=u;const d=s(14);e.hsmlh=d;const m=s(5);e.hsmlhtml=m;const p=s(2);e.hsmlidom=p;const f=s(15);e.hsmlsvacctrl=f;const _=s(16);e.hsmlsvachtml=_;const g=s(17);e.hsmlsvac=g;const b=s(18);e.hsmlwidget=b;const y=s(0);e.hsml=y;const v=s(19);e.http=v;const j=s(20);e.load=j;const w=s(21);e.objpaths=w;const E=s(22);e.router=E;const x=s(23);e.settings=x;const C=s(24);e.signal=C;const S=s(25);e.template=S;const k=s(26);e.tmpl=k;const O=s(3);e.validators=O}])}));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|