peryl 1.4.39 → 1.4.42
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/README.md +8 -7
- package/dist/cache.js +1 -0
- package/dist/cache.js.map +1 -1
- package/dist/debounce.js +1 -0
- package/dist/debounce.js.map +1 -1
- package/dist/dom.js +1 -0
- package/dist/dom.js.map +1 -1
- package/dist/encode.js +1 -0
- package/dist/encode.js.map +1 -1
- package/dist/events.js +1 -0
- package/dist/events.js.map +1 -1
- package/dist/form.js +1 -0
- package/dist/form.js.map +1 -1
- package/dist/google-analytics.js +1 -0
- package/dist/google-analytics.js.map +1 -1
- package/dist/hash.d.ts +3 -0
- package/dist/hash.js +16 -3
- package/dist/hash.js.map +1 -1
- package/dist/history.js +1 -0
- package/dist/history.js.map +1 -1
- package/dist/hsml-app.d.ts +2 -3
- package/dist/hsml-app.js +6 -6
- package/dist/hsml-app.js.map +1 -1
- package/dist/hsml-convert.js +1 -0
- package/dist/hsml-convert.js.map +1 -1
- package/dist/hsml-dom.js +1 -0
- package/dist/hsml-dom.js.map +1 -1
- package/dist/hsml-h.js +1 -0
- package/dist/hsml-h.js.map +1 -1
- package/dist/hsml-html.js +1 -0
- package/dist/hsml-html.js.map +1 -1
- package/dist/hsml-idom.js +2 -1
- package/dist/hsml-idom.js.map +1 -1
- package/dist/hsml-svac-ctrl.js +1 -0
- package/dist/hsml-svac-ctrl.js.map +1 -1
- package/dist/hsml-svac-html.js +1 -0
- package/dist/hsml-svac-html.js.map +1 -1
- package/dist/hsml-widget.js +1 -0
- package/dist/hsml-widget.js.map +1 -1
- package/dist/hsml.js +1 -0
- package/dist/hsml.js.map +1 -1
- package/dist/http.js +1 -0
- package/dist/http.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/load.js +1 -0
- package/dist/load.js.map +1 -1
- package/dist/objpaths.js +1 -0
- package/dist/objpaths.js.map +1 -1
- package/dist/router.js +1 -0
- package/dist/router.js.map +1 -1
- package/dist/settings.js +1 -0
- package/dist/settings.js.map +1 -1
- package/dist/signal.js +1 -0
- package/dist/signal.js.map +1 -1
- package/dist/template.js +1 -0
- package/dist/template.js.map +1 -1
- package/dist/tmpl.js +1 -0
- package/dist/tmpl.js.map +1 -1
- package/dist/umd/cache.js +1 -1
- package/dist/umd/cache.js.map +1 -1
- package/dist/umd/debounce.js +1 -1
- package/dist/umd/debounce.js.map +1 -1
- package/dist/umd/dom.js +1 -1
- package/dist/umd/dom.js.map +1 -1
- package/dist/umd/encode.js +1 -1
- package/dist/umd/encode.js.map +1 -1
- package/dist/umd/events.js +1 -1
- package/dist/umd/events.js.map +1 -1
- package/dist/umd/form.js +1 -1
- package/dist/umd/form.js.map +1 -1
- package/dist/umd/google-analytics.js +1 -1
- package/dist/umd/google-analytics.js.map +1 -1
- package/dist/umd/hash.js +1 -1
- package/dist/umd/hash.js.map +1 -1
- package/dist/umd/history.js +1 -1
- package/dist/umd/history.js.map +1 -1
- package/dist/umd/hsml-app.js +1 -1
- package/dist/umd/hsml-app.js.map +1 -1
- package/dist/umd/hsml-convert.js +1 -1
- package/dist/umd/hsml-convert.js.map +1 -1
- package/dist/umd/hsml-dom.js +1 -1
- package/dist/umd/hsml-dom.js.map +1 -1
- package/dist/umd/hsml-h.js +1 -1
- package/dist/umd/hsml-h.js.map +1 -1
- package/dist/umd/hsml-html.js +1 -1
- package/dist/umd/hsml-html.js.map +1 -1
- package/dist/umd/hsml-idom.js +1 -1
- package/dist/umd/hsml-idom.js.map +1 -1
- package/dist/umd/hsml-svac-ctrl.js +1 -1
- package/dist/umd/hsml-svac-ctrl.js.map +1 -1
- package/dist/umd/hsml-svac-html.js +1 -1
- package/dist/umd/hsml-svac-html.js.map +1 -1
- package/dist/umd/hsml-widget.js +1 -1
- package/dist/umd/hsml-widget.js.map +1 -1
- package/dist/umd/hsml.js +1 -1
- package/dist/umd/hsml.js.map +1 -1
- package/dist/umd/http.js +1 -1
- package/dist/umd/http.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/load.js +1 -1
- package/dist/umd/load.js.map +1 -1
- package/dist/umd/objpaths.js +1 -1
- package/dist/umd/objpaths.js.map +1 -1
- package/dist/umd/router.js +1 -1
- package/dist/umd/router.js.map +1 -1
- package/dist/umd/settings.js +1 -1
- package/dist/umd/settings.js.map +1 -1
- package/dist/umd/signal.js +1 -1
- package/dist/umd/signal.js.map +1 -1
- package/dist/umd/template.js +1 -1
- package/dist/umd/template.js.map +1 -1
- package/dist/umd/tmpl.js +1 -1
- package/dist/umd/tmpl.js.map +1 -1
- package/dist/umd/validators-moment.js +1 -1
- package/dist/umd/validators-moment.js.map +1 -1
- package/dist/umd/validators-numeral.js +1 -1
- package/dist/umd/validators-numeral.js.map +1 -1
- package/dist/umd/validators-object.js +1 -1
- package/dist/umd/validators-object.js.map +1 -1
- package/dist/umd/validators.js +1 -1
- package/dist/umd/validators.js.map +1 -1
- package/dist/validators-moment.js +1 -0
- package/dist/validators-moment.js.map +1 -1
- package/dist/validators-numeral.js +1 -0
- package/dist/validators-numeral.js.map +1 -1
- package/dist/validators-object.js +1 -0
- package/dist/validators-object.js.map +1 -1
- package/dist/validators.js +1 -4
- package/dist/validators.js.map +1 -1
- package/package.json +1 -1
- package/src/hash.ts +20 -2
- package/src/hsml-app.ts +6 -8
- package/src/hsml-idom.ts +2 -2
- package/src/validators.ts +4 -4
package/dist/umd/http.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(window,(function(){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=19)}({19:function(e,t,r){"use strict";function o(e){return Array.isArray?Array.isArray(e):null!=e&&void 0!==e&&-1==="boolean|number|string|function|xml".indexOf(typeof e)&&("number"==typeof e.length&&!e.propertyIsEnumerable("length"))}function n(e){const t=[];for(const r in e)if(e.hasOwnProperty(r)){const n=e[r];if("object"==typeof n)if(o(n))for(const e of n)t.push([r,"object"==typeof e?JSON.stringify(e):e]);else t.push([r,JSON.stringify(n)]);else t.push([r,n])}for(let e,r=0;e=t[r++];)t[r-1]=`${encodeURIComponent(e[0])}=${encodeURIComponent(e[1])}`;return t.join("&")}Object.defineProperty(t,"__esModule",{value:!0}),t.isArray=o,t.decodeUrlQuery=function(e){const t={};if(e){const r=e.substr(1).split("&");for(const e of r){const r=e.split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1]||"")}}return t},t.encodeUrlQuery=n;class s{constructor(e){this._xhr=e}getHeaders(){return this._xhr.getAllResponseHeaders()}getHeader(e){return this._xhr.getResponseHeader(e)}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}}t.HttpResponse=s,t.authBasic=(e,t)=>r=>{r.headers({Authorization:"Basic "+btoa(e+":"+t)})};class i{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){i.xhrs.forEach(e=>e.abort()),i.xhrs.length=0}get(e,t){return this.method("GET"),this.url(e,t),this}post(e,t){return this.method("POST"),this.url(e,t),this}put(e,t){return this.method("PUT"),this.url(e,t),this}patch(e,t){return this.method("PATCH"),this.url(e,t),this}del(e,t){return this.method("DELETE"),this.url(e,t),this}url(e,t){return this._url=e,this._query=t,this}method(e){return this._method=e,this}headers(e){for(const t in e)e.hasOwnProperty(t)&&(this._headers[t]=e[t]);return this}use(e){return e(this),this}timeout(e){return this._timeout=e,this}responseType(e){return this._responseType=e,this}onProgress(e){return this._onProgress=e,this}onResponse(e){return this._onResponse=e,this}onError(e){return this._onError=e,this}async(e=!0){return this._async=e,this}noCache(e=!0){return this._noCache=e,this}abort(){return this._xhr&&this._xhr.abort(),this}send(e,t){t&&(this._headers["Content-Type"]=t),this._send(e,this._headers)}sendPromise(e,t){return new Promise((r,o)=>{this._onResponse=r,this._onError=o,t&&(this._headers["Content-Type"]=t),this._send(e,this._headers)})}_send(e,t){const r=new XMLHttpRequest;this._xhr=r;let o=this._url||"";if(this._query){const e=n(this._query);o=e?`${o}?${e}`:o}if(this._noCache&&(o+=(/\?/.test(o)?"&":"?")+(new Date).getTime()),this._responseType&&(this._xhr.responseType=this._responseType),"onprogress"in r&&this._onProgress){const e=e=>{this._onProgress({loaded:e.loaded,total:e.lengthComputable?e.total:void 0})};r.upload.onprogress=e,r.onprogress=e}i.xhrs.push(this),r.open(this._method,o,this._async);for(const e in t)t.hasOwnProperty(e)&&r.setRequestHeader(e,t[e]);if(this._timeout&&(r.timeout=this._timeout),"ontimeout"in r&&(this._onError||i.onError)&&(r.ontimeout=e=>{i.onError&&i.onError(e),this._onError&&this._onError(e)}),"onabort"in r&&(this._onError||i.onError)&&(r.onabort=e=>{i.onError&&i.onError(e),this._onError&&this._onError(e)}),(this._onError||i.onError)&&(r.onerror=e=>{i.onError&&i.onError(e),this._onError&&this._onError(e)}),!this._async){if(e){const t="string"==typeof e?e:JSON.stringify(e);r.send(t)}else r.send();return JSON.parse(r.responseText)}"onload"in r?r.onload=e=>{if(i.xhrs=i.xhrs.filter(e=>this!==e),r.status>=200&&r.status<300){const e=new s(r);i.onResponse&&i.onResponse(e),this._onResponse&&this._onResponse(e)}else i.onError&&i.onError(e),this._onError&&this._onError(e)}:r.onreadystatechange=e=>{switch(r.readyState){case 4:if(i.xhrs=i.xhrs.filter(e=>this!==e),r.status>=200&&r.status<300){const e=new s(r);i.onResponse&&i.onResponse(e),this._onResponse&&this._onResponse(e)}else i.onError&&i.onError(e),this._onError&&this._onError(e)}},void 0!==e?"string"==typeof e||e instanceof FormData||e instanceof Blob?r.send(e):(this._headers["Content-Type"]||r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(e))):r.send()}}function h(e,t){return(new i).method("GET").url(e,t)}function u(e,t){return(new i).method("POST").url(e,t)}function p(e,t){return(new i).method("PUT").url(e,t)}function a(e,t){return(new i).method("DELETE").url(e,t)}function c(e){i.onRequest=e}function d(e){i.onResponse=e}function
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(window,(function(){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=19)}({19:function(e,t,r){"use strict";function o(e){return Array.isArray?Array.isArray(e):null!=e&&void 0!==e&&-1==="boolean|number|string|function|xml".indexOf(typeof e)&&("number"==typeof e.length&&!e.propertyIsEnumerable("length"))}function n(e){const t=[];for(const r in e)if(e.hasOwnProperty(r)){const n=e[r];if("object"==typeof n)if(o(n))for(const e of n)t.push([r,"object"==typeof e?JSON.stringify(e):e]);else t.push([r,JSON.stringify(n)]);else t.push([r,n])}for(let e,r=0;e=t[r++];)t[r-1]=`${encodeURIComponent(e[0])}=${encodeURIComponent(e[1])}`;return t.join("&")}Object.defineProperty(t,"__esModule",{value:!0}),t.http=t.onError=t.onResponse=t.onRequest=t.del=t.patch=t.put=t.post=t.get=t.HttpRequest=t.authBasic=t.HttpResponse=t.encodeUrlQuery=t.decodeUrlQuery=t.isArray=void 0,t.isArray=o,t.decodeUrlQuery=function(e){const t={};if(e){const r=e.substr(1).split("&");for(const e of r){const r=e.split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1]||"")}}return t},t.encodeUrlQuery=n;class s{constructor(e){this._xhr=e}getHeaders(){return this._xhr.getAllResponseHeaders()}getHeader(e){return this._xhr.getResponseHeader(e)}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}}t.HttpResponse=s,t.authBasic=(e,t)=>r=>{r.headers({Authorization:"Basic "+btoa(e+":"+t)})};class i{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){i.xhrs.forEach(e=>e.abort()),i.xhrs.length=0}get(e,t){return this.method("GET"),this.url(e,t),this}post(e,t){return this.method("POST"),this.url(e,t),this}put(e,t){return this.method("PUT"),this.url(e,t),this}patch(e,t){return this.method("PATCH"),this.url(e,t),this}del(e,t){return this.method("DELETE"),this.url(e,t),this}url(e,t){return this._url=e,this._query=t,this}method(e){return this._method=e,this}headers(e){for(const t in e)e.hasOwnProperty(t)&&(this._headers[t]=e[t]);return this}use(e){return e(this),this}timeout(e){return this._timeout=e,this}responseType(e){return this._responseType=e,this}onProgress(e){return this._onProgress=e,this}onResponse(e){return this._onResponse=e,this}onError(e){return this._onError=e,this}async(e=!0){return this._async=e,this}noCache(e=!0){return this._noCache=e,this}abort(){return this._xhr&&this._xhr.abort(),this}send(e,t){t&&(this._headers["Content-Type"]=t),this._send(e,this._headers)}sendPromise(e,t){return new Promise((r,o)=>{this._onResponse=r,this._onError=o,t&&(this._headers["Content-Type"]=t),this._send(e,this._headers)})}_send(e,t){const r=new XMLHttpRequest;this._xhr=r;let o=this._url||"";if(this._query){const e=n(this._query);o=e?`${o}?${e}`:o}if(this._noCache&&(o+=(/\?/.test(o)?"&":"?")+(new Date).getTime()),this._responseType&&(this._xhr.responseType=this._responseType),"onprogress"in r&&this._onProgress){const e=e=>{this._onProgress({loaded:e.loaded,total:e.lengthComputable?e.total:void 0})};r.upload.onprogress=e,r.onprogress=e}i.xhrs.push(this),r.open(this._method,o,this._async);for(const e in t)t.hasOwnProperty(e)&&r.setRequestHeader(e,t[e]);if(this._timeout&&(r.timeout=this._timeout),"ontimeout"in r&&(this._onError||i.onError)&&(r.ontimeout=e=>{i.onError&&i.onError(e),this._onError&&this._onError(e)}),"onabort"in r&&(this._onError||i.onError)&&(r.onabort=e=>{i.onError&&i.onError(e),this._onError&&this._onError(e)}),(this._onError||i.onError)&&(r.onerror=e=>{i.onError&&i.onError(e),this._onError&&this._onError(e)}),!this._async){if(e){const t="string"==typeof e?e:JSON.stringify(e);r.send(t)}else r.send();return JSON.parse(r.responseText)}"onload"in r?r.onload=e=>{if(i.xhrs=i.xhrs.filter(e=>this!==e),r.status>=200&&r.status<300){const e=new s(r);i.onResponse&&i.onResponse(e),this._onResponse&&this._onResponse(e)}else i.onError&&i.onError(e),this._onError&&this._onError(e)}:r.onreadystatechange=e=>{switch(r.readyState){case 4:if(i.xhrs=i.xhrs.filter(e=>this!==e),r.status>=200&&r.status<300){const e=new s(r);i.onResponse&&i.onResponse(e),this._onResponse&&this._onResponse(e)}else i.onError&&i.onError(e),this._onError&&this._onError(e)}},void 0!==e?"string"==typeof e||e instanceof FormData||e instanceof Blob?r.send(e):(this._headers["Content-Type"]||r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(e))):r.send()}}function h(e,t){return(new i).method("GET").url(e,t)}function u(e,t){return(new i).method("POST").url(e,t)}function p(e,t){return(new i).method("PUT").url(e,t)}function a(e,t){return(new i).method("DELETE").url(e,t)}function c(e){i.onRequest=e}function d(e){i.onResponse=e}function l(e){i.onError=e}t.HttpRequest=i,i.xhrs=[],t.get=h,t.post=u,t.put=p,t.patch=function(e,t){return(new i).method("PATCH").url(e,t)},t.del=a,t.onRequest=c,t.onResponse=d,t.onError=l,t.http={get:h,post:u,put:p,delete:a,onRequest:c,onResponse:d,onError:l}}})}));
|
|
2
2
|
//# sourceMappingURL=http.js.map
|
package/dist/umd/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/http.ts"],"names":["root","factory","exports","module","define","amd","a","i","window","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","isArray","obj","Array","undefined","indexOf","length","propertyIsEnumerable","encodeUrlQuery","query","key_value_pairs","item","push","JSON","stringify","pair","j","encodeURIComponent","join","queryStr","substr","split","b","decodeURIComponent","HttpResponse","xhr","this","_xhr","getAllResponseHeaders","header","getResponseHeader","response","responseType","getHeader","responseText","parse","responseXML","authBasic","login","password","req","headers","btoa","HttpRequest","_method","_headers","_async","_noCache","xhrs","forEach","x","abort","url","method","_url","_query","middleware","timeout","_timeout","type","_responseType","onProgress","_onProgress","onResponse","_onResponse","onError","_onError","async","noCache","data","contentType","_send","Promise","res","rej","XMLHttpRequest","test","Date","getTime","onprogress","e","loaded","total","lengthComputable","upload","open","setRequestHeader","ontimeout","onabort","onerror","payload","send","onload","filter","status","respone","onreadystatechange","readyState","FormData","Blob","post","put","del","onRequest","http","delete"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,IAPxE,CASGC,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUT,QAGnC,IAAIC,EAASM,EAAiBE,GAAY,CACzCJ,EAAGI,EACHC,GAAG,EACHV,QAAS,IAUV,OANAW,EAAQF,GAAUG,KAAKX,EAAOD,QAASC,EAAQA,EAAOD,QAASQ,GAG/DP,EAAOS,GAAI,EAGJT,EAAOD,QA0Df,OArDAQ,EAAoBK,EAAIF,EAGxBH,EAAoBM,EAAIP,EAGxBC,EAAoBO,EAAI,SAASf,EAASgB,EAAMC,GAC3CT,EAAoBU,EAAElB,EAASgB,IAClCG,OAAOC,eAAepB,EAASgB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhET,EAAoBe,EAAI,SAASvB,GACX,oBAAXwB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAepB,EAASwB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAepB,EAAS,aAAc,CAAE0B,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IkE,KAAKtB,IAEJ3C,KAAKmB,SAAS,iBACfpB,EAAI6D,iBAAiB,eAAgB,oBAEzC7D,EAAIkE,KAAK9E,KAAKC,UAAUuD,KAG5B5C,EAAIkE,QAgBpB,SAAgB7G,EAAIsE,EAAa3C,GAC7B,OAAO,IAAIkC,GAAcU,OAAO,OAAOD,IAAIA,EAAK3C,GAGpD,SAAgB2F,EAAKhD,EAAa3C,GAC9B,OAAO,IAAIkC,GAAcU,OAAO,QAAQD,IAAIA,EAAK3C,GAGrD,SAAgB4F,EAAIjD,EAAa3C,GAC7B,OAAO,IAAIkC,GAAcU,OAAO,OAAOD,IAAIA,EAAK3C,GAOpD,SAAgB6F,EAAIlD,EAAa3C,GAC7B,OAAO,IAAIkC,GAAcU,OAAO,UAAUD,IAAIA,EAAK3C,GAGvD,SAAgB8F,EAAUA,GACtB5D,EAAY4D,UAAYA,EAG5B,SAAgBxC,EAAWA,GACvBpB,EAAYoB,WAAaA,EAG7B,SAAgBE,EAAQA,GACpBtB,EAAYsB,QAAUA,EAjV1B,gBAEoB,EAAAjB,KAAsB,GAkT1C,QAIA,SAIA,QAIA,iBAAsBI,EAAa3C,GAC/B,OAAO,IAAIkC,GAAcU,OAAO,SAASD,IAAIA,EAAK3C,IAGtD,QAIA,cAIA,eAIA,YAIa,EAAA+F,KAAO,CAChB1H,MACAsH,OACAC,MACAI,OAAQH,EACRC,YACAxC,aACAE","file":"http.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 19);\n","\nexport function isArray(obj: any) {\n return Array.isArray ?\n Array.isArray(obj) :\n (obj == null || obj === undefined || \"boolean|number|string|function|xml\".indexOf(typeof obj) !== -1) ?\n false :\n (typeof obj.length === \"number\" && !(obj.propertyIsEnumerable(\"length\")));\n}\n\nexport function decodeUrlQuery(queryStr: string): { [key: string]: string } {\n const query: { [key: string]: string } = {};\n if (queryStr) {\n const a = queryStr.substr(1).split(\"&\");\n for (const item of a) {\n const b = item.split(\"=\");\n query[decodeURIComponent(b[0])] = decodeURIComponent(b[1] || \"\");\n }\n }\n return query;\n}\n\nexport function encodeUrlQuery(query: any): string {\n const key_value_pairs: any[] = [];\n for (const key in query) {\n if (query.hasOwnProperty(key)) {\n const value = query[key];\n if (typeof value === \"object\") {\n if (isArray(value)) {\n for (const item of value) {\n key_value_pairs.push(\n [key, typeof item === \"object\" ?\n JSON.stringify(item) : item]);\n }\n } else {\n key_value_pairs.push([key, JSON.stringify(value)]);\n }\n } else {\n key_value_pairs.push([key, value]);\n }\n }\n }\n for (let j = 0, pair: any; pair = key_value_pairs[j++];) {\n key_value_pairs[j - 1] = `${encodeURIComponent(pair[0])}=${encodeURIComponent(pair[1])}`;\n }\n return key_value_pairs.join(\"&\");\n}\n\n\nexport class HttpResponse {\n\n private _xhr: XMLHttpRequest;\n\n constructor(xhr: XMLHttpRequest) {\n this._xhr = xhr;\n }\n\n getHeaders(): string {\n return this._xhr.getAllResponseHeaders();\n }\n\n getHeader(header: string): string | null {\n return this._xhr.getResponseHeader(header);\n }\n\n getBody(): any {\n return this._xhr.response;\n }\n\n getType(): string {\n return this._xhr.responseType;\n }\n\n getContentType(): string | null {\n return this.getHeader(\"Content-Type\");\n }\n\n getText(): string {\n return this._xhr.responseText;\n }\n\n getJson(): any {\n return JSON.parse(this._xhr.responseText);\n }\n\n getXml(): Document | null {\n return this._xhr.responseXML;\n }\n\n}\n\n\nexport interface HttpProgress {\n loaded: number;\n total?: number;\n}\n\nexport type HttpMethod =\n | \"GET\"\n | \"POST\"\n | \"PUT\"\n | \"DELETE\"\n | \"PATCH\"\n | \"HEAD\"\n | \"CONNECT\"\n | \"OPTIONS\"\n | \"TRACE\";\n\nexport type HttpResponseType =\n | \"arraybuffer\"\n | \"blob\"\n | \"document\"\n | \"json\"\n | \"text\";\n\nexport const authBasic = (login: string, password: string) => (req: HttpRequest) => {\n req.headers({ \"Authorization\": \"Basic \" + btoa(login + \":\" + password) });\n};\n\nexport class HttpRequest {\n\n static readonly xhrs: HttpRequest[] = [];\n\n static onRequest?: (request: HttpRequest) => void;\n static onResponse?: (response: HttpResponse) => void;\n static onError?: (e: Event) => void;\n\n static abortAll() {\n HttpRequest.xhrs.forEach(x => x.abort());\n HttpRequest.xhrs.length = 0;\n }\n\n private _url?: string;\n private _query?: Object;\n private _method: HttpMethod = \"GET\";\n private _headers: { [key: string]: string } = {};\n private _timeout?: number;\n private _responseType?: HttpResponseType;\n\n private _onProgress?: (progress: HttpProgress) => void;\n private _onResponse?: (response: HttpResponse) => void;\n private _onError?: (e?: Event) => void;\n\n private _xhr?: XMLHttpRequest;\n private _async: boolean = true;\n private _noCache: boolean = false;\n\n get(url: string, query?: Object): this {\n this.method(\"GET\");\n this.url(url, query);\n return this;\n }\n\n post(url: string, query?: Object): this {\n this.method(\"POST\");\n this.url(url, query);\n return this;\n }\n\n put(url: string, query?: Object): this {\n this.method(\"PUT\");\n this.url(url, query);\n return this;\n }\n\n patch(url: string, query?: Object): this {\n this.method(\"PATCH\");\n this.url(url, query);\n return this;\n }\n\n del(url: string, query?: Object): this {\n this.method(\"DELETE\");\n this.url(url, query);\n return this;\n }\n\n url(url: string, query?: Object): this {\n this._url = url;\n this._query = query;\n return this;\n }\n\n method(method: HttpMethod): this {\n this._method = method;\n return this;\n }\n\n headers(headers: { [key: string]: string }): this {\n for (const key in headers) {\n if (headers.hasOwnProperty(key)) {\n this._headers[key] = headers[key];\n }\n }\n return this;\n }\n\n use(middleware: (req: HttpRequest) => void): this {\n middleware(this);\n return this;\n }\n\n timeout(timeout: number): this {\n this._timeout = timeout;\n return this;\n }\n\n responseType(type: HttpResponseType): this {\n this._responseType = type;\n return this;\n }\n\n onProgress(onProgress: (progress: HttpProgress) => void): this {\n this._onProgress = onProgress;\n return this;\n }\n\n onResponse(onResponse: (response: HttpResponse) => void): this {\n this._onResponse = onResponse;\n return this;\n }\n\n onError(onError: (e?: Event) => void): this {\n this._onError = onError;\n return this;\n }\n\n async(async: boolean = true): this {\n this._async = async;\n return this;\n }\n\n noCache(noCache: boolean = true): this {\n this._noCache = noCache;\n return this;\n }\n\n abort(): this {\n if (this._xhr) {\n this._xhr.abort();\n }\n return this;\n }\n\n send(data?: any, contentType?: string): void {\n if (contentType) {\n this._headers[\"Content-Type\"] = contentType;\n }\n // this._headers[\"X-Requested-With\"] = \"XMLHttpRequest\";\n this._send(data, this._headers);\n }\n\n sendPromise(data?: any, contentType?: string): Promise<HttpResponse> {\n return new Promise<HttpResponse>((res, rej) => {\n this._onResponse = res;\n this._onError = rej;\n if (contentType) {\n this._headers[\"Content-Type\"] = contentType;\n }\n this._send(data, this._headers);\n });\n }\n\n private _send(data?: any, headers?: { [key: string]: string }): void {\n const xhr = new XMLHttpRequest();\n this._xhr = xhr;\n\n let url = this._url || \"\";\n if (this._query) {\n const query = encodeUrlQuery(this._query);\n url = query ? `${url}?${query}` : url;\n }\n if (this._noCache) {\n url += (/\\?/.test(url) ? \"&\" : \"?\") + new Date().getTime();\n }\n // console.debug(\"HttpRequest: \" + this._method + \" \" + url, data);\n\n if (this._responseType) {\n this._xhr.responseType = this._responseType;\n }\n\n if (\"onprogress\" in xhr) {\n if (this._onProgress) {\n const onprogress = (e: ProgressEvent) => {\n this._onProgress!({\n loaded: e.loaded,\n total: e.lengthComputable ? e.total : undefined\n });\n };\n xhr.upload.onprogress = onprogress;\n xhr.onprogress = onprogress;\n }\n }\n\n HttpRequest.xhrs.push(this);\n\n xhr.open(this._method, url, this._async);\n\n for (const header in headers) {\n if (headers.hasOwnProperty(header)) {\n xhr.setRequestHeader(header, headers[header]);\n }\n }\n\n if (this._timeout) {\n xhr.timeout = this._timeout;\n }\n\n if (\"ontimeout\" in xhr) {\n if (this._onError || HttpRequest.onError) {\n xhr.ontimeout = (e: ProgressEvent) => {\n HttpRequest.onError && HttpRequest.onError(e);\n this._onError && this._onError(e);\n };\n }\n }\n\n if (\"onabort\" in xhr) {\n if (this._onError || HttpRequest.onError) {\n xhr.onabort = (e: ProgressEvent) => {\n HttpRequest.onError && HttpRequest.onError(e);\n this._onError && this._onError(e);\n };\n }\n }\n\n if (this._onError || HttpRequest.onError) {\n xhr.onerror = (e: ProgressEvent) => {\n HttpRequest.onError && HttpRequest.onError(e);\n this._onError && this._onError(e);\n };\n }\n\n if (this._async) {\n if (\"onload\" in xhr) {\n xhr.onload = (e: ProgressEvent) => {\n (HttpRequest as any).xhrs = HttpRequest.xhrs.filter(x => this !== x);\n if (xhr.status >= 200 && xhr.status < 300) {\n const respone = new HttpResponse(xhr);\n if (HttpRequest.onResponse) {\n HttpRequest.onResponse(respone);\n }\n if (this._onResponse) {\n this._onResponse(respone);\n }\n } else {\n if (HttpRequest.onError) {\n HttpRequest.onError(e);\n }\n if (this._onError) {\n this._onError(e);\n }\n }\n };\n } else {\n // legacy\n (xhr as any).onreadystatechange = (e: Event) => {\n switch ((xhr as any).readyState) {\n // 0 UNSENT Client has been created. open() not called yet.\n // 1 OPENED open() has been called.\n // 2 HEADERS_RECEIVED send() has been called, and headers and status are available.\n // 3 LOADING Downloading; responseText holds partial data.\n // 4 DONE The operation is complete.\n // case 3: // loading\n // if (this._onProgress) {\n // this._onProgress(new HttpResponse(httpRequest));\n // }\n // break;\n case 4: // done\n (HttpRequest as any).xhrs = HttpRequest.xhrs.filter(x => this !== x);\n // const httpStatusOk = xhr.status >= 200 && xhr.status < 300;\n // schemes other than http/https (file, ftp)\n // const fileFtpStatusOk = xhr.status === 0 && !this._url.match(/^https?:\\/\\//);\n // const fileFtpStatusOk = xhr.status === 0 && !xhr.responseURL.match(/^https?:\\/\\//);\n // if (httpStatusOk || fileFtpStatusOk) {\n if ((xhr as any).status >= 200 && (xhr as any).status < 300) {\n const respone = new HttpResponse(xhr);\n if (HttpRequest.onResponse) {\n HttpRequest.onResponse(respone);\n }\n if (this._onResponse) {\n this._onResponse(respone);\n }\n } else {\n if (HttpRequest.onError) {\n HttpRequest.onError(e);\n }\n if (this._onError) {\n this._onError(e);\n }\n }\n break;\n default:\n }\n };\n }\n\n if (data !== undefined) {\n if (\n typeof data === \"string\" ||\n data instanceof FormData ||\n data instanceof Blob\n ) {\n xhr.send(data);\n } else {\n if (!this._headers[\"Content-Type\"]) {\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n }\n xhr.send(JSON.stringify(data));\n }\n } else {\n xhr.send();\n }\n } else {\n if (data) {\n const payload = (typeof data === \"string\") ? data : JSON.stringify(data);\n xhr.send(payload);\n } else {\n xhr.send();\n }\n return JSON.parse(xhr.responseText);\n }\n }\n\n}\n\n\nexport function get(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"GET\").url(url, query);\n}\n\nexport function post(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"POST\").url(url, query);\n}\n\nexport function put(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"PUT\").url(url, query);\n}\n\nexport function patch(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"PATCH\").url(url, query);\n}\n\nexport function del(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"DELETE\").url(url, query);\n}\n\nexport function onRequest(onRequest: (req: HttpRequest) => void): void {\n HttpRequest.onRequest = onRequest;\n}\n\nexport function onResponse(onResponse: (req: HttpResponse) => void): void {\n HttpRequest.onResponse = onResponse;\n}\n\nexport function onError(onError: (req: Event) => void): void {\n HttpRequest.onError = onError;\n}\n\nexport const http = {\n get,\n post,\n put,\n delete: del,\n onRequest,\n onResponse,\n onError\n};\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/http.ts"],"names":["root","factory","exports","module","define","amd","a","i","window","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","isArray","obj","Array","undefined","indexOf","length","propertyIsEnumerable","encodeUrlQuery","query","key_value_pairs","item","push","JSON","stringify","pair","j","encodeURIComponent","join","queryStr","substr","split","b","decodeURIComponent","HttpResponse","xhr","this","_xhr","getAllResponseHeaders","header","getResponseHeader","response","responseType","getHeader","responseText","parse","responseXML","authBasic","login","password","req","headers","btoa","HttpRequest","_method","_headers","_async","_noCache","xhrs","forEach","x","abort","url","method","_url","_query","middleware","timeout","_timeout","type","_responseType","onProgress","_onProgress","onResponse","_onResponse","onError","_onError","async","noCache","data","contentType","_send","Promise","res","rej","XMLHttpRequest","test","Date","getTime","onprogress","e","loaded","total","lengthComputable","upload","open","setRequestHeader","ontimeout","onabort","onerror","payload","send","onload","filter","status","respone","onreadystatechange","readyState","FormData","Blob","post","put","del","onRequest","http","delete"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,IAPxE,CASGC,QAAQ,WACX,O,YCTE,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QA,GACpBtB,EAAYsB,QAAUA,EAjV1B,gBAEoB,EAAAjB,KAAsB,GAkT1C,QAIA,SAIA,QAIA,iBAAsBI,EAAa3C,GAC/B,OAAO,IAAIkC,GAAcU,OAAO,SAASD,IAAIA,EAAK3C,IAGtD,QAIA,cAIA,eAIA,YAIa,EAAA+F,KAAO,CAChB1H,MACAsH,OACAC,MACAI,OAAQH,EACRC,YACAxC,aACAE","file":"http.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 19);\n","\nexport function isArray(obj: any) {\n return Array.isArray ?\n Array.isArray(obj) :\n (obj == null || obj === undefined || \"boolean|number|string|function|xml\".indexOf(typeof obj) !== -1) ?\n false :\n (typeof obj.length === \"number\" && !(obj.propertyIsEnumerable(\"length\")));\n}\n\nexport function decodeUrlQuery(queryStr: string): { [key: string]: string } {\n const query: { [key: string]: string } = {};\n if (queryStr) {\n const a = queryStr.substr(1).split(\"&\");\n for (const item of a) {\n const b = item.split(\"=\");\n query[decodeURIComponent(b[0])] = decodeURIComponent(b[1] || \"\");\n }\n }\n return query;\n}\n\nexport function encodeUrlQuery(query: any): string {\n const key_value_pairs: any[] = [];\n for (const key in query) {\n if (query.hasOwnProperty(key)) {\n const value = query[key];\n if (typeof value === \"object\") {\n if (isArray(value)) {\n for (const item of value) {\n key_value_pairs.push(\n [key, typeof item === \"object\" ?\n JSON.stringify(item) : item]);\n }\n } else {\n key_value_pairs.push([key, JSON.stringify(value)]);\n }\n } else {\n key_value_pairs.push([key, value]);\n }\n }\n }\n for (let j = 0, pair: any; pair = key_value_pairs[j++];) {\n key_value_pairs[j - 1] = `${encodeURIComponent(pair[0])}=${encodeURIComponent(pair[1])}`;\n }\n return key_value_pairs.join(\"&\");\n}\n\n\nexport class HttpResponse {\n\n private _xhr: XMLHttpRequest;\n\n constructor(xhr: XMLHttpRequest) {\n this._xhr = xhr;\n }\n\n getHeaders(): string {\n return this._xhr.getAllResponseHeaders();\n }\n\n getHeader(header: string): string | null {\n return this._xhr.getResponseHeader(header);\n }\n\n getBody(): any {\n return this._xhr.response;\n }\n\n getType(): string {\n return this._xhr.responseType;\n }\n\n getContentType(): string | null {\n return this.getHeader(\"Content-Type\");\n }\n\n getText(): string {\n return this._xhr.responseText;\n }\n\n getJson(): any {\n return JSON.parse(this._xhr.responseText);\n }\n\n getXml(): Document | null {\n return this._xhr.responseXML;\n }\n\n}\n\n\nexport interface HttpProgress {\n loaded: number;\n total?: number;\n}\n\nexport type HttpMethod =\n | \"GET\"\n | \"POST\"\n | \"PUT\"\n | \"DELETE\"\n | \"PATCH\"\n | \"HEAD\"\n | \"CONNECT\"\n | \"OPTIONS\"\n | \"TRACE\";\n\nexport type HttpResponseType =\n | \"arraybuffer\"\n | \"blob\"\n | \"document\"\n | \"json\"\n | \"text\";\n\nexport const authBasic = (login: string, password: string) => (req: HttpRequest) => {\n req.headers({ \"Authorization\": \"Basic \" + btoa(login + \":\" + password) });\n};\n\nexport class HttpRequest {\n\n static readonly xhrs: HttpRequest[] = [];\n\n static onRequest?: (request: HttpRequest) => void;\n static onResponse?: (response: HttpResponse) => void;\n static onError?: (e: Event) => void;\n\n static abortAll() {\n HttpRequest.xhrs.forEach(x => x.abort());\n HttpRequest.xhrs.length = 0;\n }\n\n private _url?: string;\n private _query?: Object;\n private _method: HttpMethod = \"GET\";\n private _headers: { [key: string]: string } = {};\n private _timeout?: number;\n private _responseType?: HttpResponseType;\n\n private _onProgress?: (progress: HttpProgress) => void;\n private _onResponse?: (response: HttpResponse) => void;\n private _onError?: (e?: Event) => void;\n\n private _xhr?: XMLHttpRequest;\n private _async: boolean = true;\n private _noCache: boolean = false;\n\n get(url: string, query?: Object): this {\n this.method(\"GET\");\n this.url(url, query);\n return this;\n }\n\n post(url: string, query?: Object): this {\n this.method(\"POST\");\n this.url(url, query);\n return this;\n }\n\n put(url: string, query?: Object): this {\n this.method(\"PUT\");\n this.url(url, query);\n return this;\n }\n\n patch(url: string, query?: Object): this {\n this.method(\"PATCH\");\n this.url(url, query);\n return this;\n }\n\n del(url: string, query?: Object): this {\n this.method(\"DELETE\");\n this.url(url, query);\n return this;\n }\n\n url(url: string, query?: Object): this {\n this._url = url;\n this._query = query;\n return this;\n }\n\n method(method: HttpMethod): this {\n this._method = method;\n return this;\n }\n\n headers(headers: { [key: string]: string }): this {\n for (const key in headers) {\n if (headers.hasOwnProperty(key)) {\n this._headers[key] = headers[key];\n }\n }\n return this;\n }\n\n use(middleware: (req: HttpRequest) => void): this {\n middleware(this);\n return this;\n }\n\n timeout(timeout: number): this {\n this._timeout = timeout;\n return this;\n }\n\n responseType(type: HttpResponseType): this {\n this._responseType = type;\n return this;\n }\n\n onProgress(onProgress: (progress: HttpProgress) => void): this {\n this._onProgress = onProgress;\n return this;\n }\n\n onResponse(onResponse: (response: HttpResponse) => void): this {\n this._onResponse = onResponse;\n return this;\n }\n\n onError(onError: (e?: Event) => void): this {\n this._onError = onError;\n return this;\n }\n\n async(async: boolean = true): this {\n this._async = async;\n return this;\n }\n\n noCache(noCache: boolean = true): this {\n this._noCache = noCache;\n return this;\n }\n\n abort(): this {\n if (this._xhr) {\n this._xhr.abort();\n }\n return this;\n }\n\n send(data?: any, contentType?: string): void {\n if (contentType) {\n this._headers[\"Content-Type\"] = contentType;\n }\n // this._headers[\"X-Requested-With\"] = \"XMLHttpRequest\";\n this._send(data, this._headers);\n }\n\n sendPromise(data?: any, contentType?: string): Promise<HttpResponse> {\n return new Promise<HttpResponse>((res, rej) => {\n this._onResponse = res;\n this._onError = rej;\n if (contentType) {\n this._headers[\"Content-Type\"] = contentType;\n }\n this._send(data, this._headers);\n });\n }\n\n private _send(data?: any, headers?: { [key: string]: string }): void {\n const xhr = new XMLHttpRequest();\n this._xhr = xhr;\n\n let url = this._url || \"\";\n if (this._query) {\n const query = encodeUrlQuery(this._query);\n url = query ? `${url}?${query}` : url;\n }\n if (this._noCache) {\n url += (/\\?/.test(url) ? \"&\" : \"?\") + new Date().getTime();\n }\n // console.debug(\"HttpRequest: \" + this._method + \" \" + url, data);\n\n if (this._responseType) {\n this._xhr.responseType = this._responseType;\n }\n\n if (\"onprogress\" in xhr) {\n if (this._onProgress) {\n const onprogress = (e: ProgressEvent) => {\n this._onProgress!({\n loaded: e.loaded,\n total: e.lengthComputable ? e.total : undefined\n });\n };\n xhr.upload.onprogress = onprogress;\n xhr.onprogress = onprogress;\n }\n }\n\n HttpRequest.xhrs.push(this);\n\n xhr.open(this._method, url, this._async);\n\n for (const header in headers) {\n if (headers.hasOwnProperty(header)) {\n xhr.setRequestHeader(header, headers[header]);\n }\n }\n\n if (this._timeout) {\n xhr.timeout = this._timeout;\n }\n\n if (\"ontimeout\" in xhr) {\n if (this._onError || HttpRequest.onError) {\n xhr.ontimeout = (e: ProgressEvent) => {\n HttpRequest.onError && HttpRequest.onError(e);\n this._onError && this._onError(e);\n };\n }\n }\n\n if (\"onabort\" in xhr) {\n if (this._onError || HttpRequest.onError) {\n xhr.onabort = (e: ProgressEvent) => {\n HttpRequest.onError && HttpRequest.onError(e);\n this._onError && this._onError(e);\n };\n }\n }\n\n if (this._onError || HttpRequest.onError) {\n xhr.onerror = (e: ProgressEvent) => {\n HttpRequest.onError && HttpRequest.onError(e);\n this._onError && this._onError(e);\n };\n }\n\n if (this._async) {\n if (\"onload\" in xhr) {\n xhr.onload = (e: ProgressEvent) => {\n (HttpRequest as any).xhrs = HttpRequest.xhrs.filter(x => this !== x);\n if (xhr.status >= 200 && xhr.status < 300) {\n const respone = new HttpResponse(xhr);\n if (HttpRequest.onResponse) {\n HttpRequest.onResponse(respone);\n }\n if (this._onResponse) {\n this._onResponse(respone);\n }\n } else {\n if (HttpRequest.onError) {\n HttpRequest.onError(e);\n }\n if (this._onError) {\n this._onError(e);\n }\n }\n };\n } else {\n // legacy\n (xhr as any).onreadystatechange = (e: Event) => {\n switch ((xhr as any).readyState) {\n // 0 UNSENT Client has been created. open() not called yet.\n // 1 OPENED open() has been called.\n // 2 HEADERS_RECEIVED send() has been called, and headers and status are available.\n // 3 LOADING Downloading; responseText holds partial data.\n // 4 DONE The operation is complete.\n // case 3: // loading\n // if (this._onProgress) {\n // this._onProgress(new HttpResponse(httpRequest));\n // }\n // break;\n case 4: // done\n (HttpRequest as any).xhrs = HttpRequest.xhrs.filter(x => this !== x);\n // const httpStatusOk = xhr.status >= 200 && xhr.status < 300;\n // schemes other than http/https (file, ftp)\n // const fileFtpStatusOk = xhr.status === 0 && !this._url.match(/^https?:\\/\\//);\n // const fileFtpStatusOk = xhr.status === 0 && !xhr.responseURL.match(/^https?:\\/\\//);\n // if (httpStatusOk || fileFtpStatusOk) {\n if ((xhr as any).status >= 200 && (xhr as any).status < 300) {\n const respone = new HttpResponse(xhr);\n if (HttpRequest.onResponse) {\n HttpRequest.onResponse(respone);\n }\n if (this._onResponse) {\n this._onResponse(respone);\n }\n } else {\n if (HttpRequest.onError) {\n HttpRequest.onError(e);\n }\n if (this._onError) {\n this._onError(e);\n }\n }\n break;\n default:\n }\n };\n }\n\n if (data !== undefined) {\n if (\n typeof data === \"string\" ||\n data instanceof FormData ||\n data instanceof Blob\n ) {\n xhr.send(data);\n } else {\n if (!this._headers[\"Content-Type\"]) {\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n }\n xhr.send(JSON.stringify(data));\n }\n } else {\n xhr.send();\n }\n } else {\n if (data) {\n const payload = (typeof data === \"string\") ? data : JSON.stringify(data);\n xhr.send(payload);\n } else {\n xhr.send();\n }\n return JSON.parse(xhr.responseText);\n }\n }\n\n}\n\n\nexport function get(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"GET\").url(url, query);\n}\n\nexport function post(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"POST\").url(url, query);\n}\n\nexport function put(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"PUT\").url(url, query);\n}\n\nexport function patch(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"PATCH\").url(url, query);\n}\n\nexport function del(url: string, query?: Object): HttpRequest {\n return new HttpRequest().method(\"DELETE\").url(url, query);\n}\n\nexport function onRequest(onRequest: (req: HttpRequest) => void): void {\n HttpRequest.onRequest = onRequest;\n}\n\nexport function onResponse(onResponse: (req: HttpResponse) => void): void {\n HttpRequest.onResponse = onResponse;\n}\n\nexport function onError(onError: (req: Event) => void): void {\n HttpRequest.onError = onError;\n}\n\nexport const http = {\n get,\n post,\n put,\n delete: del,\n onRequest,\n onResponse,\n onError\n};\n"],"sourceRoot":""}
|
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.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],r=e[1],o=r&&r.constructor===Object;let a,c,h=[];const l=e[o?2:1];switch(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=o?r:{};_&&(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,r=i.toLocaleString?i.toLocaleString():i.toString();s.text(r,n);break;case Date:const o=e,a=o.toLocaleString?o.toLocaleString():o.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});const n=s(0),i=s(1);class r{open(t,e,s,n){const r=[];let o=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":o=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?r.push("data-"+t,i[t]):r.push("data-"+t,JSON.stringify(i[t])));break;case"styles":r.push("style",e[t]);break;case"on":const c=e[t];"string"==typeof c[0]?"function"==typeof c[1]?r.push("on"+c[0],c[1]):r.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]?r.push("on"+t[0],t[1]):r.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":r.push("on"+t,e[t]);break;case"object":r.push(t,e[t]);break;case"boolean":e[t]&&r.push(t,"");break;default:r.push(t,e[t])}}return a.length&&r.unshift("class",a.join(" ")),o&&r.unshift("id",o),i.elementOpen(t,e._key,void 0,...r),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 o(t,e){n.hsml(t,new r,e)}e.hsml2idomPatch=function(t,e,s){i.patch(t,t=>t&&o(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&&o(t.toHsml(),t)}else o(s,e)}(t,s),e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!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:""}}};class r 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.StringValidator=r;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 r=!1;if(isNaN(n)&&(r=!0),e.strict&&t!==this.objToStr(n).str&&(r=!0),r){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(),a=t=>t.toLocaleDateString();e.DateValidator=class extends n{constructor(t,e){super(t,e),this.dateToStr=(null==t?void 0:t.dateOnly)?a: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 r=new Date(n);e.dateOnly&&(r=new Date(r.getFullYear(),r.getMonth(),r.getDate()));let o=!1;if(isNaN(n)&&(o=!0),o){const t=isNaN(n)?new Date:r;return{obj:isNaN(n)?null:r,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{date:this.objToStr(t).str||""})):"invalid_format"}}return{obj:r,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}}};const c=new r({required:!0,min:8}),h=c.format("");console.log(h,c)},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!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,r)=>{this.off(s,n),e(t,i,r)};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});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,r){const o=[];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?o.push(["data-"+t,n[t]]):o.push(["data-"+t,JSON.stringify(n[t])]));break;case"styles":const i=e[t];let r="";for(const t in i)if(i.hasOwnProperty(t)){r+=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()+":"+i[t]+";"}o.push(["style",r]);break;case"styles":case"on":break;default:"function"==typeof e[t]||("boolean"==typeof e[t]?e[t]&&o.push([t,""]):o.push([t,e[t]]))}h.length&&o.unshift(["class",h.join(" ")]),a&&o.unshift(["id",a]),l&&"type"in l&&o.unshift(["hObj",l.type]);const u=o.map(t=>`${t[0]}="${c(t[1])}"`).join(" ");let d="";if(this._pretty&&(d+=this._mkIndent(this._depth),this._depth++),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 r=e.length||-1!==i._pairTags.indexOf(t);this._pretty&&(this._depth--,r&&(n+=this._mkIndent(this._depth))),r&&(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 r(t,e,s=!1){const r=new i(e,s);n.hsml(t,r)}function o(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&&r(t.toHsml(),e,s)}else r(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=r,e.hsmls2html=o,e.hsml2htmls=function(t,e=!1){const s=[];return r(t,t=>s.push(t),e),s},e.hsmls2htmls=function(t,e=!1){const s=[];return o(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="",r=0,o=0;for(r=s.index;r<e.length;r++){switch(e.charCodeAt(r)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}o!==r&&(i+=e.substring(o,r)),o=r+1,i+=n}return o!==r?i+e.substring(o,r):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=n,e.Debounce=function(t=300){return function(e,s,i){const r=i.value;return i.value=n(r,t),i}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!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 r=s[0]+1;for(;r--;)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.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 r=t[s];r instanceof Array||(r=[r]);const o=r.length;for(let t=0;t<o;t++){const o=r[t];"object"==typeof o&&null!=o?n[i++]=arguments.callee(o,e+s+"."):(n[i]=encodeURIComponent(e+s),null!=o&&(n[i]+="="+encodeURIComponent(o)),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("."),r=s.length;let o=e;for(let e=0;e<r;e++){const n=s[e],i=o[n];e===r-1?i?i instanceof Array?o[n].push(t):(o[n]=[i],o[n][1]=t):o[n]=t:(i||(o[n]={}),o=o[n])}}else e[i]=null}}return e}};class n{static encode(t){let e,s,i,r,o,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++),r=e>>2,o=(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(r)+n._keyStr.charAt(o)+n._keyStr.charAt(a)+n._keyStr.charAt(c);return h}static decode(t){let e,s,i,r,o,a,c,h="",l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<t.length;)r=this._keyStr.indexOf(t.charAt(l++)),o=this._keyStr.indexOf(t.charAt(l++)),a=this._keyStr.indexOf(t.charAt(l++)),c=this._keyStr.indexOf(t.charAt(l++)),e=r<<2|o>>4,s=(15&o)<<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,r=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),r=t.charCodeAt(s+2),e+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&r),s+=3);return e}}e.Base64=n,n._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!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),r=""===this._element.step?1:Number(this._element.step),o=isNaN(s)?null===n?0:n:s,a=t=>{const s=(t.pageY-e)*this._dragSensitivity,a=o-s*r;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=class{constructor(){this._encode=t=>String(t),this._decode=t=>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=()=>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(()=>{location.hash!==t&&(t=location.hash,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}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!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";Object.defineProperty(e,"__esModule",{value:!0});const n=s(2),i=console.log,r=console.error;var o;e.happ=function(t,e,s,n=document.body){return new h(t,e,s).mount(n)},function(t){t._init="_init",t._mount="_mount",t._umount="_umount"}(o=e.HAppAction||(e.HAppAction={}));const a=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},c=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class h{constructor(t,e,s){this.refs={},this.dispatch=(t,e,s)=>{if(h.debug){i("HApp action:",{type:t,data:e,event:s});const n=performance.now();try{this.dispatcher(this,{type:t,data:e,event:s})}catch(t){r("HApp dispatch:",t)}const o=performance.now();i("HApp dispatch:",`${o-n} ms`,this.state)}else try{this.dispatcher(this,{type:t,data:e,event:s})}catch(t){r("HApp dispatch:",t)}},this.callDispatcher=(t,e,s)=>{t(Object.assign(Object.assign({},this),{state:e}),s)},this.render=()=>{if(h.debug){const t=performance.now();let e;try{e=this.view(this.state)}catch(t){r("HApp render:",t)}const s=performance.now();return i("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=u(s[t]);if("object"==typeof e){const i=Object.keys(e);if(i.length){const r=i[0],o=e[r];void 0===n[r]?n[r]=o:"string"==typeof n[r]||n[r]instanceof String?n[r]=o instanceof Array?[n[r],...o]:[n[r],o]:n[r]instanceof Array?o instanceof Array?n[r]=n[r].concat(o):n[r].push(o):n[r]=o instanceof Array?[n[r],...o]:[n[r],o],n[r]instanceof Array&&(n[r]=n[r].filter(t=>null!==t),"radio"===s[t].type&&(n[r]=n[r].length?n[r][0]:null))}}}return n;default:return u(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,l(e,this.render(),this),this._onUpdate&&this._onUpdate(this),this.dispatch(o._mount,this.dom)}return this},this.umount=()=>{if(this.dom){this.dispatch(o._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=a(()=>{if(this.dom){const t=this.render();l(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}];c(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.app=this,this.dispatch(o._mount,this.dom))}),["div",t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.state=t,this.view=e,this.dispatcher=s||((t,e)=>i("HApp action:",e.type,e.data)),this.dispatch(o._init)}}function l(t,e,s){if(h.debug){const r=performance.now();n.hsmls2idomPatch(t,e,s);const o=performance.now();i("HApp update:",`${o-r} ms`,t)}else n.hsmls2idomPatch(t,e,s)}function u(t){let e=null;switch(t.nodeName){case"INPUT":const s=t;switch(s.type){case"text":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 r=t;e=r.name?{[r.name]:r.value}:r.value}return e}e.HApp=h,h.debug=!1},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=s(0);class i{open(t,e,s,n){const i=document.createElement(t);let r=e._id,o=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":r=e[t];break;case"classes":const s=e[t];o=o.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":o=o.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 r&&i.setAttribute("id",r),o.length&&i.classList.add(...o),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 r(t,e){const s=new i;return n.hsml(t,s,e),s.element}e.hsml2dom=r,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(r(t.toHsml(),t))}else s.push(r(n,e));return s}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!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});const n=s(2),i=s(1),r=(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 r=new c(t,s);void 0!==e&&(r.state=e),r.mount(n)}}else{const i=new c(t,s);void 0!==e&&(i.state=e),i.mount(n)}return!0},o=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,r),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"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 r=s;e[r.name]=r.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=o(()=>{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});const n=s(5),i=(t,e,s)=>{},r=(t,e)=>t.view(e||t.state,i,r);e.html=function(t,e,s,o=!1){n.hsmls2html(t.view(e,i,r),s,o)},e.htmls=function(t,e,s=!1){return n.hsmls2htmls(t.view(e,i,r),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});const n=s(2),i=s(1),r=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},o=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=r(()=>{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}];o(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.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 r{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=r,e.authBasic=(t,e)=>s=>{s.headers({Authorization:"Basic "+btoa(t+":"+e)})};class o{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){o.xhrs.forEach(t=>t.abort()),o.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}o.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||o.onError)&&(s.ontimeout=t=>{o.onError&&o.onError(t),this._onError&&this._onError(t)}),"onabort"in s&&(this._onError||o.onError)&&(s.onabort=t=>{o.onError&&o.onError(t),this._onError&&this._onError(t)}),(this._onError||o.onError)&&(s.onerror=t=>{o.onError&&o.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(o.xhrs=o.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new r(s);o.onResponse&&o.onResponse(t),this._onResponse&&this._onResponse(t)}else o.onError&&o.onError(t),this._onError&&this._onError(t)}:s.onreadystatechange=t=>{switch(s.readyState){case 4:if(o.xhrs=o.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new r(s);o.onResponse&&o.onResponse(t),this._onResponse&&this._onResponse(t)}else o.onError&&o.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 o).method("GET").url(t,e)}function c(t,e){return(new o).method("POST").url(t,e)}function h(t,e){return(new o).method("PUT").url(t,e)}function l(t,e){return(new o).method("DELETE").url(t,e)}function u(t){o.onRequest=t}function d(t){o.onResponse=t}function m(t){o.onError=t}e.HttpRequest=o,o.xhrs=[],e.get=a,e.post=c,e.put=h,e.patch=function(t,e){return(new o).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.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 r=e.concat(i);return"object"==typeof t[i]&&null!==t[i]?n(t[i],r,s):0===s[t[i]]||s[t[i]]?s[t[i]].push(r):s[t[i]]=[r],s},s)}Object.defineProperty(e,"__esModule",{value:!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});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,r)=>(this.keys.push({name:n,optional:!!r}),e=e||"",(r?"":e)+"(?:"+(r?e:"")+(s||"")+(i||(s?"([^/.]+?)":"([^/]+?)"))+")"+(r||""))).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),this._regex=new RegExp("^"+t+"$",e?"":"i"))}}e.Route=i;class r 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 r.default.hash()}static start(){return r.default.start(),r.default}static route(t,e){return r.default.route(t,e),r.default}static navigate(t){return r.default.navigate(t),r.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=r,r.default=new r,e.route=function(t,e){return r.route(t,e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!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=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.tmpl=function(t,e){const s=/[^a-zA-Z0-9_-]+/.test(t)?t:document.getElementById(t).innerHTML;let n,i,r=JSON.stringify,o=/\$\{([\S\s]*?)\}/g,a=[],c=0;for(;i=o.exec(s);)n=s.slice(c,i.index),a.push(r(n),"("+i[1]+")"),c=o.lastIndex;n=s.slice(c),a.push(r(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.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,r,o=0;for(;i=s.exec(t);)r=t.slice(o,i.index),n.push(e(r),"("+i[1]+")"),o=s.lastIndex;return r=t.slice(o),n.push(e(r)),new Function("obj","with(obj)return "+n.join("+"))}},,,,function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=s(6);e.debounce=n;const i=s(7);e.dom=i;const r=s(8);e.encode=r;const o=s(4);e.events=o;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 x=s(22);e.router=x;const C=s(23);e.settings=C;const E=s(24);e.signal=E;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=void 0,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,h,c=[];const l=e[r?2:1];switch(l&&l.constructor){case Array:c=l;break;case Function:a=l;break;case String:case Boolean:case Number:case Date:c=[l];break;default:h=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);h&&(b._hObj=h);const y=s.open(f,b,c,n);a&&s.fnc(a,n);y||c.forEach(e=>t(e,s,n));s.close(f,c,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:[],h=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":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 h=e[t];"string"==typeof h[0]?"function"==typeof h[1]?o.push("on"+h[0],h[1]):o.push("on"+h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)}):h.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&&h&&(n.refs[h]=i.currentElement()),c&&c.mount&&c.mount.constructor===Function&&(c.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();e.DateValidator=class extends n{constructor(t,e){super(t,e),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,c=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];c=c.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":c=c.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]]))}c.length&&r.unshift(["class",c.join(" ")]),a&&r.unshift(["id",a]),l&&"type"in l&&r.unshift(["hObj",l.type]);const u=r.map(t=>`${t[0]}="${h(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:h(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 h(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,h,c="",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,h=63&i,isNaN(s)?a=h=64:isNaN(i)&&(h=64),c=c+n._keyStr.charAt(o)+n._keyStr.charAt(r)+n._keyStr.charAt(a)+n._keyStr.charAt(h);return c}static decode(t){let e,s,i,o,r,a,h,c="",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++)),h=this._keyStr.indexOf(t.charAt(l++)),e=o<<2|r>>4,s=(15&r)<<4|a>>2,i=(3&a)<<6|h,c+=String.fromCharCode(e),64!==a&&(c+=String.fromCharCode(s)),64!==h&&(c+=String.fromCharCode(i));return c=n._utf8_decode(c),c}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)},h=()=>{document.body.style.cursor="",this._element.style.cursor="",document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",h),this._onChange&&this._onChange(this,!0)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",h)}),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";Object.defineProperty(e,"__esModule",{value:!0}),e.HApp=e.HAppAction=e.happ=void 0;const n=s(2),i=console.log,o=console.error;var r;e.happ=function(t,e,s,n=document.body){return new c(t,e,s).mount(n)},function(t){t._init="_init",t._mount="_mount",t._umount="_umount"}(r=e.HAppAction||(e.HAppAction={}));const a=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},h=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class c{constructor(t,e,s){this.refs={},this.dispatch=(t,e,s)=>{if(c.debug){i("HApp action:",{type:t,data:e,event:s});const n=performance.now();try{this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){o("HApp dispatch:",t)}const r=performance.now();i("HApp dispatch:",r-n+" ms",this.state)}else try{this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){o("HApp dispatch:",t)}},this.render=()=>{if(c.debug){const t=performance.now();let e;try{e=this.view(this.state)}catch(t){o("HApp render:",t)}const s=performance.now();return i("HApp render:",s-t+" ms",e),e||[]}{let t;try{t=this.view(this.state)}catch(t){o("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=u(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 u(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;l(e,this.render(),this),this._onUpdate&&this._onUpdate(this),this.dispatch(r._mount,this.dom)}return this},this.umount=()=>{if(this.dom){this.dispatch(r._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=a(()=>{if(this.dom){const t=this.render();l(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(r._mount,this.dom))}),["div",t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.state=t,this.view=e,this.dispatcher=s||(t=>i("HApp action:",t.type,t.data)),this.dispatch(r._init)}}function l(t,e,s){if(c.debug){const o=performance.now();n.hsmls2idomPatch(t,e,s);const r=performance.now();i("HApp update:",r-o+" ms",t)}else n.hsmls2idomPatch(t,e,s)}function u(t){let e=null;switch(t.nodeName){case"INPUT":const s=t;switch(s.type){case"text":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=c,c.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,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":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 h=e[t];for(const t in h)h.hasOwnProperty(t)&&(i.style[t]=h[t]);break;case"on":const c=e[t];"string"==typeof c[0]?"function"==typeof c[1]?i.addEventListener(c[0],c[1]):i.addEventListener(c[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(c[1],c[2],t)}):c.forEach(t=>{"function"==typeof c[1]?i.addEventListener(c[0],c[1]):i.addEventListener(c[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(c[1],c[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),h&&h.mount&&h.mount.constructor===Function&&h.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 h(t,s);void 0!==e&&(o.state=e),o.mount(n)}}else{const i=new h(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 h{constructor(t,e){this.type="Ctrl",this.id=this.type+"-"+h._count++,this.refs={},this.appAction=(t,e,s)=>{h.debug&&console.log("appAction",this.type,t,e,s),h.appActions&&h.appActions(this,t,e,s)},this.extAction=(t,e,s)=>{h.debug&&console.log("extAction",this.type,t,e,s),this._extAction&&this._extAction(t,e,s)},this.action=(t,e,s)=>{h.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"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){h._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 h._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,h._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 h.appActions=t,this}appCtrls(){return Object.values(h._ctrls)}}e.HCtrl=h,h.debug=!1,h._count=0,h._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 h(t,e){return(new r).method("POST").url(t,e)}function c(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=h,e.put=c,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:h,put:c,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=[],h=0;for(;i=r.exec(s);)n=s.slice(h,i.index),a.push(o(n),"("+i[1]+")"),h=r.lastIndex;n=s.slice(h),a.push(o(n));const c=new Function("obj","with(obj)return "+a.join("+"));return e?c(e):c};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 h=s(10);e.hash=h;const c=s(11);e.history=c;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
|