peryl 1.4.49 → 1.4.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hash.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface HashUrlData {
2
- path: string[];
3
- query: {
2
+ path?: string[];
3
+ query?: {
4
4
  [key: string]: string | string[];
5
5
  };
6
6
  }
package/dist/hash.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Hash = exports.hashUrlDecoder = exports.hashUrlEncoder = exports.hashJsonDecoder = exports.hashJsonEncoder = void 0;
4
- exports.hashJsonEncoder = (data) => data ? JSON.stringify(data) : "";
5
- exports.hashJsonDecoder = (str) => str ? JSON.parse(str) : undefined;
4
+ exports.hashJsonEncoder = (data) => data ? encodeURIComponent(JSON.stringify(data)) : "";
5
+ exports.hashJsonDecoder = (str) => str ? JSON.parse(decodeURIComponent(str)) : undefined;
6
6
  exports.hashUrlEncoder = (data) => {
7
7
  const d = typeof data === "string"
8
8
  ? exports.hashUrlDecoder(data)
9
9
  : data;
10
10
  const dpath = d.path || [];
11
11
  const dquery = d.query || {};
12
- const path = dpath.join("/");
12
+ const path = dpath.map(p => encodeURIComponent(p)).join("/");
13
13
  const query = Object.entries(dquery)
14
14
  .reduce((p, c) => {
15
15
  if (typeof c[1] === "string") {
@@ -21,12 +21,12 @@ exports.hashUrlEncoder = (data) => {
21
21
  return p;
22
22
  }, new URLSearchParams())
23
23
  .toString();
24
- const str = `${path}?${query}`;
24
+ const str = `${path}${query ? "?" : ""}${query}`;
25
25
  return str;
26
26
  };
27
27
  exports.hashUrlDecoder = (str) => {
28
28
  const [pathStr, queryStr] = str.split("?");
29
- const path = pathStr.split("/");
29
+ const path = pathStr.split("/").map(p => decodeURIComponent(p));
30
30
  const query = {};
31
31
  for (const e of new URLSearchParams(queryStr).entries()) {
32
32
  const [k, v] = e;
@@ -83,10 +83,10 @@ class Hash {
83
83
  return this;
84
84
  }
85
85
  read() {
86
- return this._decode(decodeURIComponent(location.hash.slice(1)));
86
+ return this._decode(location.hash.slice(1));
87
87
  }
88
88
  write(data) {
89
- location.hash = "#" + encodeURI(this._encode(data));
89
+ location.hash = "#" + this._encode(data);
90
90
  if (!this._emitWritten) {
91
91
  this._writtenDataJson = JSON.stringify(data);
92
92
  this._cb && this._cb(data);
package/dist/hash.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hash.js","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":";;;AAQa,QAAA,eAAe,GAAG,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClE,QAAA,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAErE,QAAA,cAAc,GAAG,CAAC,IAAiB,EAAU,EAAE;IAExD,MAAM,CAAC,GAAG,OAAO,IAAI,KAAK,QAAQ;QAC9B,CAAC,CAAC,sBAAc,CAAC,IAAI,CAAC;QACtB,CAAC,CAAC,IAAmB,CAAC;IAC1B,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE7B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SAC/B,MAAM,CACH,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACL,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YAC1B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC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CAAC;gBAEzB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;oBACpB,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;oBAC/D,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;oBAClC,IAAI,CAAC,OAAO,EAAE;wBACV,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;qBAC9B;iBACJ;qBAAM;oBACH,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;iBAC9B;YACL,CAAC,CAAC;SACL;aAAM;YACH,KAAK,CAAC,+CAA+C,CAAC,CAAC;SAe1D;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI;QACA,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,IAAO;QACT,QAAQ,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEzC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACpB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7C,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC9B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ;AA5ED,oBA4EC"}
package/dist/umd/hash.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 n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}({10:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.hashUrlDecoder=t.hashUrlEncoder=t.hashJsonDecoder=t.hashJsonEncoder=void 0,t.hashJsonEncoder=e=>e?JSON.stringify(e):"",t.hashJsonDecoder=e=>e?JSON.parse(e):void 0,t.hashUrlEncoder=e=>{const n="string"==typeof e?t.hashUrlDecoder(e):e,r=n.path||[],o=n.query||{};return`${r.join("/")}?${Object.entries(o).reduce((e,t)=>("string"==typeof t[1]?e.append(t[0],t[1]):t[1].forEach(n=>e.append(t[0],n)),e),new URLSearchParams).toString()}`},t.hashUrlDecoder=e=>{const[t,n]=e.split("?"),r=t.split("/"),o={};for(const e of new URLSearchParams(n).entries()){const[t,n]=e;t in o?"string"==typeof o[t]?o[t]=[o[t],n]:o[t].push(n):o[t]=n}return{path:r,query:o}};t.Hash=class{constructor(e=!0){this._encode=e=>String(e),this._decode=e=>e,this._emitWritten=e}onChange(e){return this._cb=e,this}coders(e,t){return this._encode=e,this._decode=t,this}listen(){return this._cb&&this._cb(this.read()),"onhashchange"in window?onhashchange=()=>{const e=this.read();if(this._emitWritten)this._cb&&this._cb(e);else{const t=this._writtenDataJson===JSON.stringify(e);this._writtenDataJson=void 0,t||this._cb&&this._cb(e)}}:alert('Browser "window.onhashchange" not implemented'),this}read(){return this._decode(decodeURIComponent(location.hash.slice(1)))}write(e){return location.hash="#"+encodeURI(this._encode(e)),this._emitWritten||(this._writtenDataJson=JSON.stringify(e),this._cb&&this._cb(e)),this}}}})}));
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 n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}({10:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.hashUrlDecoder=t.hashUrlEncoder=t.hashJsonDecoder=t.hashJsonEncoder=void 0,t.hashJsonEncoder=e=>e?encodeURIComponent(JSON.stringify(e)):"",t.hashJsonDecoder=e=>e?JSON.parse(decodeURIComponent(e)):void 0,t.hashUrlEncoder=e=>{const n="string"==typeof e?t.hashUrlDecoder(e):e,r=n.path||[],o=n.query||{},i=r.map(e=>encodeURIComponent(e)).join("/"),s=Object.entries(o).reduce((e,t)=>("string"==typeof t[1]?e.append(t[0],t[1]):t[1].forEach(n=>e.append(t[0],n)),e),new URLSearchParams).toString();return`${i}${s?"?":""}${s}`},t.hashUrlDecoder=e=>{const[t,n]=e.split("?"),r=t.split("/").map(e=>decodeURIComponent(e)),o={};for(const e of new URLSearchParams(n).entries()){const[t,n]=e;t in o?"string"==typeof o[t]?o[t]=[o[t],n]:o[t].push(n):o[t]=n}return{path:r,query:o}};t.Hash=class{constructor(e=!0){this._encode=e=>String(e),this._decode=e=>e,this._emitWritten=e}onChange(e){return this._cb=e,this}coders(e,t){return this._encode=e,this._decode=t,this}listen(){return this._cb&&this._cb(this.read()),"onhashchange"in window?onhashchange=()=>{const e=this.read();if(this._emitWritten)this._cb&&this._cb(e);else{const t=this._writtenDataJson===JSON.stringify(e);this._writtenDataJson=void 0,t||this._cb&&this._cb(e)}}:alert('Browser "window.onhashchange" not implemented'),this}read(){return this._decode(location.hash.slice(1))}write(e){return location.hash="#"+this._encode(e),this._emitWritten||(this._writtenDataJson=JSON.stringify(e),this._cb&&this._cb(e)),this}}}})}));
2
2
  //# sourceMappingURL=hash.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/hash.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","hashJsonEncoder","data","JSON","stringify","hashJsonDecoder","str","parse","undefined","hashUrlEncoder","hashUrlDecoder","dpath","path","dquery","query","join","entries","reduce","append","forEach","v","URLSearchParams","toString","pathStr","queryStr","split","e","k","push","emitWritten","_encode","String","_decode","this","_emitWritten","cb","_cb","encode","decode","read","onhashchange","written","_writtenDataJson","alert","decodeURIComponent","location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K,CAACb,EAAMa,GAAIP,GAEtBN,EAAMa,GAAGC,KAAKR,GAGlBN,EAAMa,GAAKP,EAKnB,MAFa,CAAER,OAAME,UAKzB,aAUI,YAAYe,GAAc,GAHlB,KAAAC,QAAW5B,GAAY6B,OAAO7B,GAC9B,KAAA8B,QAAW1B,GAAgBA,EAG/B2B,KAAKC,aAAeL,EAGxB,SAASM,GAEL,OADAF,KAAKG,IAAMD,EACJF,KAGX,OAAOI,EACAC,GAGH,OAFAL,KAAKH,QAAUO,EACfJ,KAAKD,QAAUM,EACRL,KAGX,SAiCI,OAhCAA,KAAKG,KAAOH,KAAKG,IAAIH,KAAKM,QACtB,iBAAkBzE,OAClB0E,aAAe,KACX,MAAMtC,EAAO+B,KAAKM,OAElB,GAAKN,KAAKC,aAOND,KAAKG,KAAOH,KAAKG,IAAIlC,OAPD,CACpB,MAAMuC,EAAUR,KAAKS,mBAAqBvC,KAAKC,UAAUF,GACzD+B,KAAKS,sBAAmBlC,EACnBiC,GACDR,KAAKG,KAAOH,KAAKG,IAAIlC,KAOjCyC,MAAM,iDAgBHV,KAGX,OACI,OAAOA,KAAKD,QAAQY,mBAAmBC,SAASC,KAAKC,MAAM,KAG/D,MAAM7C,GAOF,OANA2C,SAASC,KAAO,IAAME,UAAUf,KAAKH,QAAQ5B,IAExC+B,KAAKC,eACND,KAAKS,iBAAmBvC,KAAKC,UAAUF,GACvC+B,KAAKG,KAAOH,KAAKG,IAAIlC,IAElB+B","file":"hash.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 = 10);\n","\nexport interface HashUrlData {\n path: string[];\n query: {\n [key: string]: string | string[];\n };\n}\n\nexport const hashJsonEncoder = (data: any) => data ? JSON.stringify(data) : \"\";\nexport const hashJsonDecoder = (str: string) => str ? JSON.parse(str) : undefined;\n\nexport const hashUrlEncoder = (data: HashUrlData): string => {\n // console.log(data);\n const d = typeof data === \"string\"\n ? hashUrlDecoder(data)\n : data as HashUrlData;\n const dpath = d.path || [];\n const dquery = d.query || {};\n const path = dpath.join(\"/\");\n // const params = new URLSearchParams();\n const query = Object.entries(dquery)\n .reduce(\n (p, c) => {\n if (typeof c[1] === \"string\") {\n p.append(c[0], c[1]);\n } else {\n c[1].forEach(v => p.append(c[0], v));\n }\n return p;\n },\n new URLSearchParams())\n .toString();\n const str = `${path}?${query}`;\n // console.log(str);\n return str;\n};\nexport const hashUrlDecoder = (str: string): HashUrlData => {\n // console.log(str);\n const [pathStr, queryStr] = str.split(\"?\");\n // const pathStr = str.substring(0, str.indexOf(\"?\"));\n // const queryStr = str.substring(str.indexOf(\"?\") + 1);\n const path = pathStr.split(\"/\");\n const query = {} as any;\n for (const e of new URLSearchParams(queryStr).entries()) {\n const [k, v] = e;\n if (k in query) {\n if (typeof query[k] === \"string\") {\n query[k] = [query[k], v];\n } else {\n query[k].push(v);\n }\n } else {\n query[k] = v;\n }\n }\n const data = { path, query };\n // console.log(data);\n return data;\n};\n\nexport class Hash<T = string> {\n\n private _cb?: (data: T) => void;\n\n private _emitWritten: boolean;\n private _writtenDataJson?: string;\n\n private _encode = (data: T) => String(data);\n private _decode = (str: string) => str as any as T;\n\n constructor(emitWritten = true) {\n this._emitWritten = emitWritten;\n }\n\n onChange(cb: (data: T) => void): this {\n this._cb = cb;\n return this;\n }\n\n coders(encode: (data: T) => string,\n decode: (data: string) => T): this {\n this._encode = encode;\n this._decode = decode;\n return this;\n }\n\n listen(): this {\n this._cb && this._cb(this.read());\n if (\"onhashchange\" in window) {\n onhashchange = () => {\n const data = this.read();\n // console.log(\"onhashchange\", location.hash, data);\n if (!this._emitWritten) {\n const written = this._writtenDataJson === JSON.stringify(data);\n this._writtenDataJson = undefined;\n if (!written) {\n this._cb && this._cb(data);\n }\n } else {\n this._cb && this._cb(data);\n }\n };\n } else {\n alert(`Browser \"window.onhashchange\" not implemented`);\n // let prevHash = location.hash;\n // if (this._iId) {\n // clearInterval(this._iId);\n // }\n // this._iId = setInterval(() => {\n // if (location.hash !== prevHash) {\n // prevHash = location.hash;\n // const written = this._dataJson === location.hash;\n // this._dataJson = undefined;\n // if (this._emitWritten || !written) {\n // this._cb && this._cb(data);\n // }\n // }\n // }, 500);\n }\n return this;\n }\n\n read(): T {\n return this._decode(decodeURIComponent(location.hash.slice(1)));\n }\n\n write(data: T): this {\n location.hash = \"#\" + encodeURI(this._encode(data));\n // location.hash = \"#\" + this._encode(data);\n if (!this._emitWritten) {\n this._writtenDataJson = JSON.stringify(data);\n this._cb && this._cb(data);\n }\n return this;\n }\n\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/hash.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","hashJsonEncoder","data","encodeURIComponent","JSON","stringify","hashJsonDecoder","str","parse","decodeURIComponent","undefined","hashUrlEncoder","hashUrlDecoder","dpath","path","dquery","query","map","join","entries","reduce","append","forEach","v","URLSearchParams","toString","pathStr","queryStr","split","e","k","push","emitWritten","_encode","String","_decode","this","_emitWritten","cb","_cb","encode","decode","read","onhashchange","written","_writtenDataJson","alert","location","hash","slice"],"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,OAAO,KAQvDlB,EAAoBmB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQlB,EAAoBkB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,E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AOmB,EAASC,GAAYpB,EAAIqB,MAAM,KAGhCd,EAAOY,EAAQE,MAAM,KAAKX,IAAIlB,GAAKU,mBAAmBV,IACtDiB,EAAQ,GACd,IAAK,MAAMa,KAAK,IAAIL,gBAAgBG,GAAUR,UAAW,CACrD,MAAOW,EAAGP,GAAKM,EACXC,KAAKd,EACmB,iBAAbA,EAAMc,GACbd,EAAMc,GAAK,CAACd,EAAMc,GAAIP,GAEtBP,EAAMc,GAAGC,KAAKR,GAGlBP,EAAMc,GAAKP,EAKnB,MAFa,CAAET,OAAME,UAKzB,aAUI,YAAYgB,GAAc,GAHlB,KAAAC,QAAW/B,GAAYgC,OAAOhC,GAC9B,KAAAiC,QAAW5B,GAAgBA,EAG/B6B,KAAKC,aAAeL,EAGxB,SAASM,GAEL,OADAF,KAAKG,IAAMD,EACJF,KAGX,OAAOI,EACAC,GAGH,OAFAL,KAAKH,QAAUO,EACfJ,KAAKD,QAAUM,EACRL,KAGX,SAiCI,OAhCAA,KAAKG,KAAOH,KAAKG,IAAIH,KAAKM,QACtB,iBAAkB5E,OAClB6E,aAAe,KACX,MAAMzC,EAAOkC,KAAKM,OAElB,GAAKN,KAAKC,aAOND,KAAKG,KAAOH,KAAKG,IAAIrC,OAPD,CACpB,MAAM0C,EAAUR,KAAKS,mBAAqBzC,KAAKC,UAAUH,GACzDkC,KAAKS,sBAAmBnC,EACnBkC,GACDR,KAAKG,KAAOH,KAAKG,IAAIrC,KAOjC4C,MAAM,iDAgBHV,KAGX,OACI,OAAOA,KAAKD,QAAQY,SAASC,KAAKC,MAAM,IAG5C,MAAM/C,GAOF,OANA6C,SAASC,KAAO,IAAMZ,KAAKH,QAAQ/B,GAE9BkC,KAAKC,eACND,KAAKS,iBAAmBzC,KAAKC,UAAUH,GACvCkC,KAAKG,KAAOH,KAAKG,IAAIrC,IAElBkC","file":"hash.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 = 10);\n","\nexport interface HashUrlData {\n path?: string[];\n query?: {\n [key: string]: string | string[];\n };\n}\n\nexport const hashJsonEncoder = (data: any) => data ? encodeURIComponent(JSON.stringify(data)) : \"\";\nexport const hashJsonDecoder = (str: string) => str ? JSON.parse(decodeURIComponent(str)) : undefined;\n\nexport const hashUrlEncoder = (data: HashUrlData): string => {\n // console.log(data);\n const d = typeof data === \"string\"\n ? hashUrlDecoder(data)\n : data as HashUrlData;\n const dpath = d.path || [];\n const dquery = d.query || {};\n const path = dpath.map(p => encodeURIComponent(p)).join(\"/\");\n // const params = new URLSearchParams();\n const query = Object.entries(dquery)\n .reduce(\n (p, c) => {\n if (typeof c[1] === \"string\") {\n p.append(c[0], c[1]);\n } else {\n c[1].forEach(v => p.append(c[0], v));\n }\n return p;\n },\n new URLSearchParams())\n .toString();\n const str = `${path}${query ? \"?\" : \"\"}${query}`;\n // console.log(str);\n return str;\n};\nexport const hashUrlDecoder = (str: string): HashUrlData => {\n // console.log(str);\n const [pathStr, queryStr] = str.split(\"?\");\n // const pathStr = str.substring(0, str.indexOf(\"?\"));\n // const queryStr = str.substring(str.indexOf(\"?\") + 1);\n const path = pathStr.split(\"/\").map(p => decodeURIComponent(p));\n const query = {} as any;\n for (const e of new URLSearchParams(queryStr).entries()) {\n const [k, v] = e;\n if (k in query) {\n if (typeof query[k] === \"string\") {\n query[k] = [query[k], v];\n } else {\n query[k].push(v);\n }\n } else {\n query[k] = v;\n }\n }\n const data = { path, query };\n // console.log(data);\n return data;\n};\n\nexport class Hash<T = string> {\n\n private _cb?: (data: T) => void;\n\n private _emitWritten: boolean;\n private _writtenDataJson?: string;\n\n private _encode = (data: T) => String(data);\n private _decode = (str: string) => str as any as T;\n\n constructor(emitWritten = true) {\n this._emitWritten = emitWritten;\n }\n\n onChange(cb: (data: T) => void): this {\n this._cb = cb;\n return this;\n }\n\n coders(encode: (data: T) => string,\n decode: (data: string) => T): this {\n this._encode = encode;\n this._decode = decode;\n return this;\n }\n\n listen(): this {\n this._cb && this._cb(this.read());\n if (\"onhashchange\" in window) {\n onhashchange = () => {\n const data = this.read();\n // console.log(\"onhashchange\", location.hash, data);\n if (!this._emitWritten) {\n const written = this._writtenDataJson === JSON.stringify(data);\n this._writtenDataJson = undefined;\n if (!written) {\n this._cb && this._cb(data);\n }\n } else {\n this._cb && this._cb(data);\n }\n };\n } else {\n alert(`Browser \"window.onhashchange\" not implemented`);\n // let prevHash = location.hash;\n // if (this._iId) {\n // clearInterval(this._iId);\n // }\n // this._iId = setInterval(() => {\n // if (location.hash !== prevHash) {\n // prevHash = location.hash;\n // const written = this._dataJson === location.hash;\n // this._dataJson = undefined;\n // if (this._emitWritten || !written) {\n // this._cb && this._cb(data);\n // }\n // }\n // }, 500);\n }\n return this;\n }\n\n read(): T {\n return this._decode(location.hash.slice(1));\n }\n\n write(data: T): this {\n location.hash = \"#\" + this._encode(data);\n // location.hash = \"#\" + this._encode(data);\n if (!this._emitWritten) {\n this._writtenDataJson = JSON.stringify(data);\n this._cb && this._cb(data);\n }\n return this;\n }\n\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.hjoin=e.hsml=e.NBSP=void 0,e.NBSP="  ",e.hsml=function t(e,s,n){if(null!=e)switch(e.constructor){case Array:!function(e,s,n){if("string"!=typeof e[0])return void console.error("HSML tag head not string:",e);const i=e[0],o=e[1],r=o&&o.constructor===Object;let a,c,h=[];const l=e[r?2:1];switch(null!=l&&l.constructor){case Array:h=l;break;case Function:a=l;break;case String:case Boolean:case Number:case Date:h=[l];break;default:c=l}const u=i.split("~"),d=u[1],m=u[0].split("."),p=m[0].split("#"),f=p[0]||"div",_=p[1],g=m.slice(1);let b;b=r?o:{};_&&(b._id=_);g.length&&(b._classes=g);d&&(b._ref=d);c&&(b._hObj=c);const y=s.open(f,b,h,n);a&&s.fnc(a,n);y||h.forEach(e=>t(e,s,n));s.close(f,h,n)}(e,s,n);break;case Function:s.fnc(e,n);break;case String:s.text(e,n);break;case Boolean:s.text(""+e,n);break;case Number:const i=e,o=i.toLocaleString?i.toLocaleString():i.toString();s.text(o,n);break;case Date:const r=e,a=r.toLocaleString?r.toLocaleString():r.toString();s.text(a,n);break;default:s.obj(e,n)}},e.hjoin=function(t,e){const s=t.reduce((t,s)=>(t.push(s,e),t),[]);return s.splice(-1),s}},function(e,s){e.exports=t},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2idomPatch=e.hsml2idomPatch=void 0;const n=s(0),i=s(1);class o{open(t,e,s,n){const o=[];let r=e._id,a=e._classes?e._classes:[],c=e._ref,h=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":r=e[t];break;case"classes":const s=e[t];a=a.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":a=a.concat(e[t].split(" "));break;case"data":const i=e[t];for(const t in i)i.hasOwnProperty(t)&&(i[t].constructor===String?o.push("data-"+t,i[t]):o.push("data-"+t,JSON.stringify(i[t])));break;case"styles":o.push("style",e[t]);break;case"on":const c=e[t];"string"==typeof c[0]?"function"==typeof c[1]?o.push("on"+c[0],c[1]):o.push("on"+c[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(c[1],c[2],t)}):c.forEach(t=>{"function"==typeof t[1]?o.push("on"+t[0],t[1]):o.push("on"+t[0],e=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(t[1],t[2],e)})});break;default:switch(typeof e[t]){case"function":o.push("on"+t,e[t]);break;case"object":o.push(t,e[t]);break;case"boolean":e[t]&&o.push(t,t);break;default:o.push(t,e[t])}}return a.length&&o.unshift("class",a.join(" ")),r&&o.unshift("id",r),i.elementOpen(t,e._key,void 0,...o),e._skip&&i.skip(),n&&c&&(n.refs[c]=i.currentElement()),h&&h.mount&&h.mount.constructor===Function&&(h.mount(i.currentElement()),i.skip()),!!e._skip}close(t,e,s){i.elementClose(t)}text(t,e){i.text(t)}fnc(t,e){t(i.currentElement())&&i.skip()}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function r(t,e){n.hsml(t,new o,e)}e.hsml2idomPatch=function(t,e,s){i.patch(t,t=>t&&r(t,s),e)},e.hsmls2idomPatch=function(t,e,s){i.patch(t,t=>t&&function(t,e){for(const s of t)if(null!=s)if(s.constructor===String)i.text(s);else if("toHsml"in s){const t=s;t.toHsml&&r(t.toHsml(),t)}else r(s,e)}(t,s),e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FormValidator=e.BooleanValidator=e.DateValidator=e.NumberValidator=e.StringValidator=e.SelectValidator=e.tpl=e.Validator=e.rodneCisloRgex=e.pscRgex=e.phoneRgex=e.emailRegex=void 0;e.emailRegex=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,e.phoneRgex=/^(((00)([- ]?)|\+)(\d{1,3})([- ]?))?((\d{3})([- ]?))((\d{3})([- ]?))(\d{3})$/,e.pscRgex=/^\d{3} ?\d{2}$/,e.rodneCisloRgex=/^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$/;class n{constructor(t,e){this.str=null,this.err=null,this.obj=null,this.opts=t||{},this.msgs=e||{}}validate(t){if("string"==typeof t||null==t){const e=t;this.str=e;const s=this.strToObj(e);if(this.obj=s.obj,s.err)return this.err=s.err,{str:null==e?"":e,obj:s.obj,err:s.err};const n=this.objCheck(s.obj);return this.err=n,{str:null==e?"":e,obj:s.obj,err:n}}{this.str=null==t?null:""+t;const e=this.objCheck(t);return this.err=e,{str:this.str,obj:t,err:e}}}format(t,e){const s=this.objToStr(t,e);return{str:void 0===s.str||null===s.str?"":s.str,err:s.err}}}function i(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)}e.Validator=n,e.tpl=i;e.SelectValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{options:"options"in e?e.options.join(", "):""})):"required"}:{obj:void 0===t?null:t,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;return"options"in e&&t&&-1===e.options.indexOf(t)?s.invalid_option?i(s.invalid_option,Object.assign(Object.assign({},e.data),{option:null===t?"":t,options:"options"in e?e.options.join(", "):""})):"invalid_option":""}objToStr(t,e){return{str:t||"",err:""}}};e.StringValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):"",regexp:"regexp"in e?""+(e.regexp||""):""})):"required"}:t?"regexp"in e&&!e.regexp.test(t)?{obj:null,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{regexp:"regexp"in e?""+(e.regexp||""):""})):"invalid_format"}:{obj:t,err:""}:{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t.length>e.max&&(n=!0),"min"in e&&t.length<e.min&&(n=!0),"min"in e&&"max"in e&&t.length>e.max&&t.length<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){return{str:t||"",err:""}}};e.NumberValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"required"};if(t){const n=Number(t);let o=!1;if(isNaN(n)&&(o=!0),e.strict&&t!==this.objToStr(n).str&&(o=!0),o){const t=isNaN(n)?1234.45:n;return{obj:isNaN(n)?null:n,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{num:this.objToStr(t).str||""})):"invalid_format"}}return{obj:n,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t>e.max&&(n=!0),"min"in e&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){let s;return s=null==t?"":"decimals"in this.opts?t.toFixed(this.opts.decimals):String(t),{str:s,err:""}}};const o=t=>t.toLocaleString(),r=t=>t.toLocaleDateString(),a=t=>t.toISOString(),c=t=>new Date(t.toDateString()).toISOString();e.DateValidator=class extends n{constructor(t,e){super(t,e),(null==t?void 0:t.iso)?this.dateToStr=(null==t?void 0:t.dateOnly)?c:a:this.dateToStr=(null==t?void 0:t.dateOnly)?r:o,(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.min)&&(t.min=new Date(t.min.getFullYear(),t.min.getMonth(),t.min.getDate())),(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.max)&&(t.max=new Date(t.max.getFullYear(),t.max.getMonth(),t.max.getDate()+1))}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"required"};if(t){const n=Date.parse(t);let o=new Date(n);e.dateOnly&&(o=new Date(o.getFullYear(),o.getMonth(),o.getDate()));let r=!1;if(isNaN(n)&&(r=!0),r){const t=isNaN(n)?new Date:o;return{obj:isNaN(n)?null:o,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{date:this.objToStr(t).str||""})):"invalid_format"}}return{obj:o,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&e.max&&t.getTime()>e.max.getTime()&&(n=!0),"min"in e&&e.min&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"not_in_range":""}objToStr(t,e){return{str:null==t?"":this.dateToStr(t),err:""}}};e.BooleanValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign({},e.data)):"required"};let n;switch(t){case"true":case"1":case"on":case"yes":n=!0;break;default:n=!1}return{obj:n,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"value"in e&&t!==e.value&&(n=!0),n?s.invalid_value?i(s.invalid_value,Object.assign(Object.assign({},e.data),{value:"value"in e?""+(e.value||""):""})):"invalid_value":""}objToStr(t,e){return{str:null==t?"":""+t,err:""}}};e.FormValidator=class{constructor(){this.validators={}}addValidator(t,e){return this.validators[t]=e,this}validate(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].validate(n);return e.str[s]=i.str,e.obj[s]=i.obj,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}format(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].format(n);return e.str[s]=i.str,e.obj[s]=n,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}data(){return{str:this.str,obj:this.obj,err:this.err,valid:this.valid}}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Events=void 0;e.Events=class{constructor(t){this._cb=[],this._cbs={},t&&(this._ctx=t)}emit(t,e){if(t in this._cbs)for(let s=0,n=this._cbs[t].length;s<n;s++)this._cbs[t][s](e,t,this._ctx);for(let s=0,n=this._cb.length;s<n;s++)this._cb[s](e,t,this._ctx);return this}on(t,e){const s=t;return s in this._cbs||(this._cbs[s]=[]),-1===this._cbs[s].indexOf(e)&&this._cbs[s].push(e),this}any(t){return this._cb.push(t),this}once(t,e){const s=t,n=(t,i,o)=>{this.off(s,n),e(t,i,o)};return this.on(t,n),this}off(t,e){return void 0===t&&(e?this._cb=this._cb.filter(t=>t!==e):this._cb.length=0),t&&t in this._cbs&&(e?this._cbs[t].splice(this._cbs[t].indexOf(e),1):(this._cbs[t].length=0,delete this._cbs[t])),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2htmls=e.hsml2htmls=e.hsmls2html=e.hsml2html=void 0;const n=s(0);class i{constructor(t,e=!1,s=" "){this._depth=0,this._onHtml=t,this._pretty=e,this._indent=s}open(t,e,s,o){const r=[];let a=e._id,h=e._classes?e._classes:[],l=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":a=e[t];break;case"classes":const s=e[t];h=h.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":h=h.concat(e[t].split(" "));break;case"data":const n=e[t];for(const t in n)n.hasOwnProperty(t)&&(n[t].constructor===String?r.push(["data-"+t,n[t]]):r.push(["data-"+t,JSON.stringify(n[t])]));break;case"styles":const i=e[t];let o="";for(const t in i)if(i.hasOwnProperty(t)){o+=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()+":"+i[t]+";"}r.push(["style",o]);break;case"styles":case"on":break;default:"function"==typeof e[t]||("boolean"==typeof e[t]?e[t]&&r.push([t,""]):r.push([t,e[t]]))}h.length&&r.unshift(["class",h.join(" ")]),a&&r.unshift(["id",a]),l&&"type"in l&&r.unshift(["hObj",l.type]);const u=r.map(t=>`${t[0]}="${c(t[1])}"`).join(" ");let d="";this._pretty&&(d+=this._mkIndent(this._depth),this._depth++);if(d+="<"+t+(u?" "+u:"")+(s.length||-1!==i._pairTags.indexOf(t)?">":"/>"),this._pretty&&(d+="\n"),this._onHtml(d),l&&"render"in l&&l.render.constructor===Function){const t=l.render();for(const e of t)if(null!=e)if(e.constructor===String)this._onHtml(e+(this._pretty?"\n":""));else if("toHsml"in e){const t=e;t.toHsml&&n.hsml(t.toHsml(),this)}else n.hsml(e,this)}return!1}close(t,e,s){let n="";const o=e.length||-1!==i._pairTags.indexOf(t);this._pretty&&(this._depth--,o&&(n+=this._mkIndent(this._depth))),o&&(n+="</"+t+">",this._pretty&&(n+="\n"),this._onHtml(n))}text(t,e){let s="";this._pretty&&(s+=this._mkIndent(this._depth)),s+=t instanceof String?t:c(t),this._pretty&&(s+="\n"),this._onHtml(s)}fnc(t,e){}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}_mkIndent(t){let e="";for(let s=0;s<t;s++)e+=this._indent;return e}}function o(t,e,s=!1){const o=new i(e,s);n.hsml(t,o)}function r(t,e,s=!1){for(const n of t)if(null!=n)if(n.constructor===String)e(n+(s?"\n":""));else if("toHsml"in n){const t=n;t.toHsml&&o(t.toHsml(),e,s)}else o(n,e,s)}i._pairTags=["script","iframe","html","head","body","title","div","h1","h2","h3","h4","h5","h6","p","a","pre","blockquote","i","b","em","strong","tt","cite","ol","ul","li","dl","dt","dd","table","tr","td","textarea","select","option"],e.hsml2html=o,e.hsmls2html=r,e.hsml2htmls=function(t,e=!1){const s=[];return o(t,t=>s.push(t),e),s},e.hsmls2htmls=function(t,e=!1){const s=[];return r(t,t=>s.push(t),e),s};const a=/["'&<>]/;function c(t){const e=""+t,s=a.exec(e);if(!s)return e;let n,i="",o=0,r=0;for(o=s.index;o<e.length;o++){switch(e.charCodeAt(o)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 39:n="&#39;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}r!==o&&(i+=e.substring(r,o)),r=o+1,i+=n}return r!==o?i+e.substring(r,o):i}},function(t,e,s){"use strict";function n(t,e=300){let s;return function(...n){clearTimeout(s),s=setTimeout(()=>{t.apply(this,n)},e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.Debounce=e.debounce=void 0,e.debounce=n,e.Debounce=function(t=300){return function(e,s,i){const o=i.value;return i.value=n(o,t),i}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.addEventListener=e.html=e.empty=e.remove=e.replace=e.append=e.select=e.selectAll=void 0,e.selectAll=function(t,e){const s=(e||document).querySelectorAll(t),n=[];for(let t=0;t<s.length;t++)n.push(s[t]);return n},e.select=function(t,e){return(e||document).querySelector(t)},e.append=function(t,...e){e.forEach(e=>t.appendChild(e))},e.replace=function(t,e){t.parentElement&&t.parentElement.replaceChild(e,t)},e.remove=function(t){t.parentElement&&t.parentElement.removeChild(t)},e.empty=function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},e.html=function(t){t=t.trim();let e={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],body:[0,"",""],_default:[1,"<div>","</div>"]};e.optgroup=e.option,e.tbody=e.tfoot=e.colgroup=e.caption=e.thead,e.th=e.td;const s=/<\s*\w.*?>/g.exec(t);let n=document.createElement("div");if(null!=s){const i=s[0].replace(/</g,"").replace(/>/g,"").split(" ")[0];if("body"===i.toLowerCase()){const e=document.createElement("body");n.innerHTML=t.replace(/<body/g,"<div").replace(/<\/body>/g,"</div>");const s=n.firstChild.attributes;e.innerHTML=t;for(let t=0;t<s.length;t++)e.setAttribute(s[t].name,s[t].value);return e}{const s=e[i]||e._default;t=s[1]+t+s[2],n.innerHTML=t;let o=s[0]+1;for(;o--;)n=n.lastChild}}else n.innerHTML=t,n=n.lastChild;return n},Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){const e=(this.document||this.ownerDocument).querySelectorAll(t);let s=e.length;for(;--s>=0&&e.item(s)!==this;);return s>-1}),e.addEventListener=function(t,e,s,n,i=!1){t.addEventListener(s,(function(t){const s=t||window.event,i=s.target||t.srcElement;i&&i.matches(e)&&n(i,s)}),i)},e.removeEventListener=function(t,e,s,n=!1){t.removeEventListener(e,s,n)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Base64=e.UrlEncodedData=void 0;e.UrlEncodedData=class{static encode(t,e=""){let s;if("object"!=typeof t)s=t;else{const n=[];let i=0;for(let s in t)if(t.hasOwnProperty(s)){let o=t[s];o instanceof Array||(o=[o]);const r=o.length;for(let t=0;t<r;t++){const r=o[t];"object"==typeof r&&null!=r?n[i++]=arguments.callee(r,e+s+"."):(n[i]=encodeURIComponent(e+s),null!=r&&(n[i]+="="+encodeURIComponent(r)),i++)}}s=n.join("&")}return s}static decode(t){const e={};if(t){const s=t.split("&"),n=s.length;for(let t=0;t<n;t++){const n=s[t].split("="),i=decodeURIComponent(n[0]);if(n.length>1){const t=decodeURIComponent(n[1]),s=i.split("."),o=s.length;let r=e;for(let e=0;e<o;e++){const n=s[e],i=r[n];e===o-1?i?i instanceof Array?r[n].push(t):(r[n]=[i],r[n][1]=t):r[n]=t:(i||(r[n]={}),r=r[n])}}else e[i]=null}}return e}};class n{static encode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=n._utf8_encode(t);l<t.length;)e=t.charCodeAt(l++),s=t.charCodeAt(l++),i=t.charCodeAt(l++),o=e>>2,r=(3&e)<<4|s>>4,a=(15&s)<<2|i>>6,c=63&i,isNaN(s)?a=c=64:isNaN(i)&&(c=64),h=h+n._keyStr.charAt(o)+n._keyStr.charAt(r)+n._keyStr.charAt(a)+n._keyStr.charAt(c);return h}static decode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<t.length;)o=this._keyStr.indexOf(t.charAt(l++)),r=this._keyStr.indexOf(t.charAt(l++)),a=this._keyStr.indexOf(t.charAt(l++)),c=this._keyStr.indexOf(t.charAt(l++)),e=o<<2|r>>4,s=(15&r)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(e),64!==a&&(h+=String.fromCharCode(s)),64!==c&&(h+=String.fromCharCode(i));return h=n._utf8_decode(h),h}static _utf8_encode(t){t=t.replace(/\r\n/g,"\n");let e="";for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}static _utf8_decode(t){let e="",s=0,n=0,i=0,o=0;for(;s<t.length;)n=t.charCodeAt(s),n<128?(e+=String.fromCharCode(n),s++):n>191&&n<224?(i=t.charCodeAt(s+1),e+=String.fromCharCode((31&n)<<6|63&i),s+=2):(i=t.charCodeAt(s+1),o=t.charCodeAt(s+2),e+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),s+=3);return e}}e.Base64=n,n._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Form=e.FileEntry=e.RadioEntry=e.SelectEntry=e.CheckboxEntry=e.NumberInputEntry=e.TextInputEntry=e.TextAreaEntry=void 0;e.TextAreaEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.TextInputEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.NumberInputEntry=class{constructor(t){this._decimals=0,this._dragSensitivity=1,this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this.setDecimals(2)}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return isNaN(+t)||(this._element.value=(+t).toFixed(this._decimals)),this}setStep(t){return isNaN(t)||(this._element.step=""+t),this}setMin(t){return isNaN(t)||(this._element.min=""+t),this}setMax(t){return isNaN(t)||(this._element.max=""+t),this}setDecimals(t){return isNaN(t)||(this._decimals=t),this}setDragSensitivity(t){return isNaN(t)||(this._dragSensitivity=t),this}enableMouseWheel(){const t=()=>{this._onChange&&setTimeout(()=>{this._onChange&&this._onChange(this,!1)},0)};return this._element.addEventListener("focus",()=>{this._element.addEventListener("mousewheel",t)}),this._element.addEventListener("blur",()=>{this._element.removeEventListener("mousewheel",t)}),this}enableMouseDrag(){return this._element.addEventListener("mousedown",t=>{document.body.style.cursor="row-resize",this._element.style.cursor="row-resize";const e=t.pageY,s=Number(this.getValue()),n=""===this._element.min?null:Number(this._element.min),i=""===this._element.max?null:Number(this._element.max),o=""===this._element.step?1:Number(this._element.step),r=isNaN(s)?null===n?0:n:s,a=t=>{const s=(t.pageY-e)*this._dragSensitivity,a=r-s*o;null!==n&&a<n?this.setValue(n.toFixed(this._decimals)):null!==i&&a>i?this.setValue(i.toFixed(this._decimals)):this.setValue(a.toFixed(this._decimals)),this._onChange&&this._onChange(this,!1)},c=()=>{document.body.style.cursor="",this._element.style.cursor="",document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c),this._onChange&&this._onChange(this,!0)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.CheckboxEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return""+this._element.checked}setValue(t){return this._element.checked=!(!t||"false"===t),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.SelectEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}setOptions(t){const e=this._element;for(;e.options.length>0;)e.remove(0);return t.forEach(t=>{const s=document.createElement("option");s.text=t.text,s.value=t.value,e.add(s)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.RadioEntry=class{constructor(t){this._elements=[],t.forEach(t=>{"string"==typeof t?this._elements.push(document.getElementById(t)):this._elements.push(t)}),this._elements.forEach(t=>{t.addEventListener("change",()=>{this._onChange&&t.checked&&this._onChange(this)})})}getName(){return this._elements[0].name}getValue(){for(let t of this._elements)if(t.checked)return t.value}setValue(t){for(let e of this._elements)e.value===t&&(e.checked=!0);return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.FileEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){const t=this._element.files;return t&&t.length?t[0].name+" ("+t[0].type+", "+t[0].size+")":void 0}getFile(){return this._element.files&&this._element.files.length?this._element.files[0]:null}setValue(t){return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.Form=class{constructor(t){this._formEntries=[],this._element="string"==typeof t?document.getElementById(t):t,this._element.onsubmit=t=>(t.preventDefault(),this._onSubmit&&this._onSubmit(this),!1)}addEntry(t){return this._formEntries.push(t),this}setEntries(t){return this._formEntries=t,this}getEntries(){return this._formEntries}getEntry(t){for(let e of this._formEntries)if(e.getName()===t)return e}validate(t){const e={};for(let s of this._formEntries)e[s.getName()]=s.validate(t);return e}isValid(t){t||(t=this.validate());for(let e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}getValues(){const t={};for(let e of this._formEntries)t[e.getName()]=e.getValue();return t}submit(){this._element.submit()}onSubmit(t){return this._onSubmit=t,this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.hashUrlDecoder=e.hashUrlEncoder=e.hashJsonDecoder=e.hashJsonEncoder=void 0,e.hashJsonEncoder=t=>t?JSON.stringify(t):"",e.hashJsonDecoder=t=>t?JSON.parse(t):void 0,e.hashUrlEncoder=t=>{const s="string"==typeof t?e.hashUrlDecoder(t):t,n=s.path||[],i=s.query||{};return`${n.join("/")}?${Object.entries(i).reduce((t,e)=>("string"==typeof e[1]?t.append(e[0],e[1]):e[1].forEach(s=>t.append(e[0],s)),t),new URLSearchParams).toString()}`},e.hashUrlDecoder=t=>{const[e,s]=t.split("?"),n=e.split("/"),i={};for(const t of new URLSearchParams(s).entries()){const[e,s]=t;e in i?"string"==typeof i[e]?i[e]=[i[e],s]:i[e].push(s):i[e]=s}return{path:n,query:i}};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(){return this._cb&&this._cb(this.read()),"onhashchange"in window?onhashchange=()=>{const t=this.read();if(this._emitWritten)this._cb&&this._cb(t);else{const e=this._writtenDataJson===JSON.stringify(t);this._writtenDataJson=void 0,e||this._cb&&this._cb(t)}}:alert('Browser "window.onhashchange" not implemented'),this}read(){return this._decode(decodeURIComponent(location.hash.slice(1)))}write(t){return location.hash="#"+encodeURI(this._encode(t)),this._emitWritten||(this._writtenDataJson=JSON.stringify(t),this._cb&&this._cb(t)),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.History=void 0;e.History=class{back(){window.history.back()}forward(){window.history.forward()}go(t){window.history.go(t)}length(){return window.history.length}state(){return window.history.state}pushState(t,e,s){window.history.pushState(t,e,s)}replaceState(t,e,s){window.history.replaceState(t,e,s)}onChange(t){return window.addEventListener("popstate",(function(e){t(e.state)})),this}}},function(t,e,s){"use strict";var n=this&&this.__awaiter||function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.HApp=e.HAppAction=void 0;const i=s(2),o=console.log,r=console.error;var a;!function(t){t._init="_init",t._mount="_mount",t._umount="_umount"}(a=e.HAppAction||(e.HAppAction={}));const c=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},h=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class l{constructor(t,e,s,i=document.body){this.refs={},this.dispatch=(t,e,s)=>n(this,void 0,void 0,(function*(){if(l.debug){o("HApp action:",{type:t,data:e,event:s});const n=performance.now();try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}const i=performance.now();o("HApp dispatch:",i-n+" ms",this.state)}else try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}})),this.render=()=>{if(l.debug){const t=performance.now();let e;try{e=this.view(this.state)}catch(t){r("HApp render:",t)}const s=performance.now();return o("HApp render:",s-t+" ms",e),e||[]}{let t;try{t=this.view(this.state)}catch(t){r("HApp render:",t)}return t||[]}},this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e=t.target;switch(e.nodeName){case"FORM":t.preventDefault();const s=e.elements,n={};for(let t=0;t<s.length;t++){const e=d(s[t]);if("object"==typeof e){const i=Object.keys(e);if(i.length){const o=i[0],r=e[o];void 0===n[o]?n[o]=r:"string"==typeof n[o]||n[o]instanceof String?n[o]=r instanceof Array?[n[o],...r]:[n[o],r]:n[o]instanceof Array?r instanceof Array?n[o]=n[o].concat(r):n[o].push(r):n[o]=r instanceof Array?[n[o],...r]:[n[o],r],n[o]instanceof Array&&(n[o]=n[o].filter(t=>null!==t),"radio"===s[t].type&&(n[o]=n[o].length?n[o][0]:null))}}}return n;default:return d(e)}}(s)),this.dispatch(t,e,s)},this.mount=(t=document.body)=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.app){e.app.umount()}if(!this.dom){this.dom=e,e.app=this;u(e,this.render(),this),this._onUpdate&&this._onUpdate(this),this.dispatch(a._mount,this.dom)}return this},this.umount=()=>{if(this.dom){this.dispatch(a._umount,this.dom),this.dom.hasAttribute("app")&&this.dom.removeAttribute("app");const t=this.dom.querySelectorAll("[app]");for(let e=0;e<t.length;e++){const s=t[e].app;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.app,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=c(()=>{if(this.dom){const t=this.render();u(this.dom,t,this)}this._updateSched=void 0,this._onUpdate&&this._onUpdate(this)})),this),this.onUpdate=t=>(this._onUpdate=t,this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0}];h(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.app=this,this.dispatch(a._mount,this.dom))}),["div",t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.state=t,this.view=e,this.dispatcher=s||(t=>n(this,void 0,void 0,(function*(){return o("HApp action:",t.type,t.data)}))),this.dispatch(a._init).then(()=>this.mount(i))}}function u(t,e,s){if(l.debug){const n=performance.now();i.hsmls2idomPatch(t,e,s);const r=performance.now();o("HApp update:",r-n+" ms",t)}else i.hsmls2idomPatch(t,e,s)}function d(t){let e=null;switch(t.nodeName){case"INPUT":const s=t;switch(s.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":e=s.name?{[s.name]:s.value}:s.value;break;case"radio":e=s.name?{[s.name]:s.checked?s.value:null}:s.checked?s.value:null;break;case"checkbox":e="on"===s.value?s.name?{[s.name]:String(s.checked)}:String(s.checked):s.name?{[s.name]:s.checked?String(s.value):null}:s.checked?String(s.value):null}break;case"SELECT":const n=t;if(n.multiple){const t=Array.from(n.selectedOptions).map(t=>t.value);e=n.name?{[n.name]:t}:t}else e=n.name?{[n.name]:n.value}:n.value;break;case"TEXTAREA":const i=t;e=i.name?{[i.name]:i.value}:i.value;break;case"BUTTON":const o=t;e=o.name?{[o.name]:o.value}:o.value}return e}e.HApp=l,l.debug=!1},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2dom=e.hsml2dom=void 0;const n=s(0);class i{open(t,e,s,n){const i=document.createElement(t);let o=e._id,r=e._classes?e._classes:[],a=e._ref,c=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":o=e[t];break;case"classes":const s=e[t];r=r.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":r=r.concat(e[t].split(" "));break;case"data":const a=e[t];for(const t in a)a.hasOwnProperty(t)&&(a[t].constructor===String?i.dataset[t]=a[t]:i.dataset[t]=JSON.stringify(a[t]));break;case"styles":const c=e[t];for(const t in c)c.hasOwnProperty(t)&&(i.style[t]=c[t]);break;case"on":const h=e[t];"string"==typeof h[0]?"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)}):h.forEach(t=>{"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)})});break;default:"function"==typeof e[t]?i.addEventListener(t,e[t]):"boolean"==typeof e[t]?e[t]&&i.setAttribute(t,""):i.setAttribute(t,e[t])}return o&&i.setAttribute("id",o),r.length&&i.classList.add(...r),this._current?(this._current.appendChild(i),this._current=i):(this.element=i,this._current=i),n&&a&&(n.refs[a]=this._current),c&&c.mount&&c.mount.constructor===Function&&c.mount(i),!!e._skip}close(t,e,s){this._current!==this.element&&this._current&&(this._current=this._current.parentElement||void 0)}text(t,e){this._current&&this._current.appendChild(document.createTextNode(t))}fnc(t,e){this._current&&t(this._current)}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function o(t,e){const s=new i;return n.hsml(t,s,e),s.element}e.hsml2dom=o,e.hsmls2dom=function(t,e){const s=[];for(const n of t)if(null!=n)if(n.constructor===String)s.push(document.createTextNode(n));else if("toHsml"in n){const t=n;t.toHsml&&s.push(o(t.toHsml(),t))}else s.push(o(n,e));return s}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.h=void 0,e.h=function(t,e,s){const n=[t];return e&&("string"==typeof e||"number"==typeof e?n.push([e]):(Array.isArray(e),n.push(e))),s&&("string"==typeof s||"number"==typeof s?n.push([s]):(Array.isArray(s)||"function"==typeof s)&&n.push(s)),n}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HCtrl=void 0;const n=s(2),i=s(1),o=(t,e,s)=>n=>{if(n.ctrl){const i=n.ctrl;if(i.view===t.view)void 0!==e&&(i.state=e),i.update();else{i.umount();const o=new c(t,s);void 0!==e&&(o.state=e),o.mount(n)}}else{const i=new c(t,s);void 0!==e&&(i.state=e),i.mount(n)}return!0},r=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},a=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class c{constructor(t,e){this.type="Ctrl",this.id=this.type+"-"+c._count++,this.refs={},this.appAction=(t,e,s)=>{c.debug&&console.log("appAction",this.type,t,e,s),c.appActions&&c.appActions(this,t,e,s)},this.extAction=(t,e,s)=>{c.debug&&console.log("extAction",this.type,t,e,s),this._extAction&&this._extAction(t,e,s)},this.action=(t,e,s)=>{c.debug&&console.log("action",this.type,t,e,s),this._actions&&this._actions(this,t,e,s)},this.render=()=>this.view(this.state,this.action,o),this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e={},s=t.target;switch(s.nodeName){case"INPUT":const t=s;switch(t.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":case"radio":case"number":e[t.name]=t.value;break;case"checkbox":e[t.name]=""+t.checked}break;case"SELECT":const n=s;e[n.name]=n.value;break;case"TEXTAREA":const i=s;e[i.name]=i.innerText;break;case"BUTTON":const o=s;e[o.name]=o.value}return e}(s)),this.action(t,e,s)},this.mount=t=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.ctrl){const t=e.ctrl;t&&t.umount()}if(!this.dom){c._ctrls[this.id]=this,this.dom=e,e.ctrl=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("ctrl",this.type),this.action("_mount",this.dom)}return this},this.umount=()=>{if(this.dom){delete c._ctrls[this.id],this.action("_umount",this.dom),this.dom.hasAttribute("ctrl")&&this.dom.removeAttribute("ctrl");const t=this.dom.querySelectorAll("[ctrl]");for(let e=0;e<t.length;e++){const s=t[e].ctrl;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.ctrl,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=r(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,ctrl:this.type}];a(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.ctrl=this,c._ctrls[this.id]=this,this.action("_mount",this.dom))}),["div",{_id:this.id,_key:this.id,ctrl:this.type},t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.view=t.view,this.type=t.type,this.state=t.state,this._actions=t.actions,this._extAction=e||this.appAction,this.action("_init")}appActions(t){return c.appActions=t,this}appCtrls(){return Object.values(c._ctrls)}}e.HCtrl=c,c.debug=!1,c._count=0,c._ctrls={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&t.ctrl){const e=t.ctrl;e&&e.umount()}})}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.htmls=e.html=void 0;const n=s(5),i=(t,e,s)=>{},o=(t,e)=>t.view(e||t.state,i,o);e.html=function(t,e,s,r=!1){n.hsmls2html(t.view(e,i,o),s,r)},e.htmls=function(t,e,s=!1){return n.hsmls2htmls(t.view(e,i,o),s).join("")}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HWidget=void 0;const n=s(2),i=s(1),o=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},r=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class a{constructor(t){this.type=this.constructor.name,this.id=this.type+"-"+a._count++,this.refs={},this.toHtml=()=>this.dom?this.dom.outerHTML:"",t&&(this.type=t)}onMount(){console.log("mount")}onUmount(){console.log("umount")}actions(t,e){console.log(t,e)}action(t,e){this.actions(t,e)}actionCb(t,e,s){e=e&&e.constructor===Function?e(s):void 0===e?s:e,this.action(t,e)}mount(t){const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if("widget"in e){const t=e.widget;t&&t.umount()}if(!this.dom){a.mounted[this.id]=this,this.dom=e,e.widget=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("widget",this.type),this.onMount&&this.onMount()}return this}umount(){if(this.dom){delete a.mounted[this.id],this.onUmount&&this.onUmount(),this.dom.hasAttribute("widget")&&this.dom.removeAttribute("widget");const t=this.dom.querySelectorAll("[widget]");for(let e=0;e<t.length;e++){const s=t[e].widget;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.widget,this.dom=void 0}return this}update(){return this.dom&&!this._updateSched&&(this._updateSched=o(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this}toHsml(){if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,widget:this.type}];r(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.widget=this,this.onMount&&this.onMount())}),["div",{_id:this.id,_key:this.id,widget:this.type},t]}}e.HWidget=a,a._count=0,a.mounted={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&"widget"in t){const e=t.widget;e&&e.umount()}})}},function(t,e,s){"use strict";function n(t){return Array.isArray?Array.isArray(t):null!=t&&void 0!==t&&-1==="boolean|number|string|function|xml".indexOf(typeof t)&&("number"==typeof t.length&&!t.propertyIsEnumerable("length"))}function i(t){const e=[];for(const s in t)if(t.hasOwnProperty(s)){const i=t[s];if("object"==typeof i)if(n(i))for(const t of i)e.push([s,"object"==typeof t?JSON.stringify(t):t]);else e.push([s,JSON.stringify(i)]);else e.push([s,i])}for(let t,s=0;t=e[s++];)e[s-1]=`${encodeURIComponent(t[0])}=${encodeURIComponent(t[1])}`;return e.join("&")}Object.defineProperty(e,"__esModule",{value:!0}),e.http=e.onError=e.onResponse=e.onRequest=e.del=e.patch=e.put=e.post=e.get=e.HttpRequest=e.authBasic=e.HttpResponse=e.encodeUrlQuery=e.decodeUrlQuery=e.isArray=void 0,e.isArray=n,e.decodeUrlQuery=function(t){const e={};if(t){const s=t.substr(1).split("&");for(const t of s){const s=t.split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1]||"")}}return e},e.encodeUrlQuery=i;class o{constructor(t){this._xhr=t}getHeaders(){return this._xhr.getAllResponseHeaders()}getHeader(t){return this._xhr.getResponseHeader(t)}getBody(){return this._xhr.response}getType(){return this._xhr.responseType}getContentType(){return this.getHeader("Content-Type")}getText(){return this._xhr.responseText}getJson(){return JSON.parse(this._xhr.responseText)}getXml(){return this._xhr.responseXML}}e.HttpResponse=o,e.authBasic=(t,e)=>s=>{s.headers({Authorization:"Basic "+btoa(t+":"+e)})};class r{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){r.xhrs.forEach(t=>t.abort()),r.xhrs.length=0}get(t,e){return this.method("GET"),this.url(t,e),this}post(t,e){return this.method("POST"),this.url(t,e),this}put(t,e){return this.method("PUT"),this.url(t,e),this}patch(t,e){return this.method("PATCH"),this.url(t,e),this}del(t,e){return this.method("DELETE"),this.url(t,e),this}url(t,e){return this._url=t,this._query=e,this}method(t){return this._method=t,this}headers(t){for(const e in t)t.hasOwnProperty(e)&&(this._headers[e]=t[e]);return this}use(t){return t(this),this}timeout(t){return this._timeout=t,this}responseType(t){return this._responseType=t,this}onProgress(t){return this._onProgress=t,this}onResponse(t){return this._onResponse=t,this}onError(t){return this._onError=t,this}async(t=!0){return this._async=t,this}noCache(t=!0){return this._noCache=t,this}abort(){return this._xhr&&this._xhr.abort(),this}send(t,e){e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)}sendPromise(t,e){return new Promise((s,n)=>{this._onResponse=s,this._onError=n,e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)})}_send(t,e){const s=new XMLHttpRequest;this._xhr=s;let n=this._url||"";if(this._query){const t=i(this._query);n=t?`${n}?${t}`:n}if(this._noCache&&(n+=(/\?/.test(n)?"&":"?")+(new Date).getTime()),this._responseType&&(this._xhr.responseType=this._responseType),"onprogress"in s&&this._onProgress){const t=t=>{this._onProgress({loaded:t.loaded,total:t.lengthComputable?t.total:void 0})};s.upload.onprogress=t,s.onprogress=t}r.xhrs.push(this),s.open(this._method,n,this._async);for(const t in e)e.hasOwnProperty(t)&&s.setRequestHeader(t,e[t]);if(this._timeout&&(s.timeout=this._timeout),"ontimeout"in s&&(this._onError||r.onError)&&(s.ontimeout=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),"onabort"in s&&(this._onError||r.onError)&&(s.onabort=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),(this._onError||r.onError)&&(s.onerror=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),!this._async){if(t){const e="string"==typeof t?t:JSON.stringify(t);s.send(e)}else s.send();return JSON.parse(s.responseText)}"onload"in s?s.onload=t=>{if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}:s.onreadystatechange=t=>{switch(s.readyState){case 4:if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}},void 0!==t?"string"==typeof t||t instanceof FormData||t instanceof Blob?s.send(t):(this._headers["Content-Type"]||s.setRequestHeader("Content-Type","application/json"),s.send(JSON.stringify(t))):s.send()}}function a(t,e){return(new r).method("GET").url(t,e)}function c(t,e){return(new r).method("POST").url(t,e)}function h(t,e){return(new r).method("PUT").url(t,e)}function l(t,e){return(new r).method("DELETE").url(t,e)}function u(t){r.onRequest=t}function d(t){r.onResponse=t}function m(t){r.onError=t}e.HttpRequest=r,r.xhrs=[],e.get=a,e.post=c,e.put=h,e.patch=function(t,e){return(new r).method("PATCH").url(t,e)},e.del=l,e.onRequest=u,e.onResponse=d,e.onError=m,e.http={get:a,post:c,put:h,delete:l,onRequest:u,onResponse:d,onError:m}},function(t,e,s){"use strict";function n(t,e){const s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.src=t,s.readyState?s.onreadystatechange=()=>{const t="loaded"===s.readyState,n="complete"===s.readyState;(t||n)&&(s.onreadystatechange=null,"function"==typeof e&&e())}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.css=e.image=e.scripts=e.script=e.scriptLib=void 0,e.scriptLib=function(t,e,s){n(t,()=>{const t=window[e];window[e]={},delete window[e],s&&s(t)})},e.script=n,e.scripts=function(t,e){t.reverse();let s=e;for(let e=0;e<t.length;e++){s=((t,e)=>()=>n(t,()=>e&&e()))(t[e],s)}s&&s()},e.image=function(t,e){const s=new Image;s.src=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()}},e.css=function(t,e){const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}},function(t,e,s){"use strict";function n(t,e=[],s={}){return Object.keys(t).reduce((s,i)=>{const o=e.concat(i);return"object"==typeof t[i]&&null!==t[i]?n(t[i],o,s):0===s[t[i]]||s[t[i]]?s[t[i]].push(o):s[t[i]]=[o],s},s)}Object.defineProperty(e,"__esModule",{value:!0}),e.objValuePaths=e.objPaths=void 0,e.objPaths=function(t){const e=n(t);return Object.keys(e).map(t=>e[t]).reduce((t,e)=>t.concat(e))},e.objValuePaths=n},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.route=e.Router=e.Route=e.Emitter=void 0;class n{constructor(){this._callbacks={}}on(t,e){return t in this._callbacks||(this._callbacks[t]=[]),this._callbacks[t].push(e),this}emit(t,...e){return t in this._callbacks&&this._callbacks[t].forEach(t=>t.apply(this,e)),this}off(t,e){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;const s=this._callbacks[t];if(!s)return this;if(1===arguments.length)return delete this._callbacks[t],this;for(let t=0;t<s.length;t++){if(s[t]===e){s.splice(t,1);break}}return this}}e.Emitter=n;class i{constructor(t){this._params={},this.keys=[],this.path=t,this._pathParse(t,!1,!1)}match(t,e){const s=this._regex.exec(t);if(!s)return!1;for(let t=1;t<s.length;++t){const n=this.keys[t-1],i="string"==typeof s[t]?decodeURIComponent(s[t]):s[t];n&&(this._params[n.name]=i),e.push(i)}return!0}_pathParse(t,e,s){t instanceof RegExp?this._regex=t:(t instanceof Array&&(t="("+t.join("|")+")"),t=t.concat(s?"":"/?").replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,(t,e,s,n,i,o)=>(this.keys.push({name:n,optional:!!o}),e=e||"",(o?"":e)+"(?:"+(o?e:"")+(s||"")+(i||(s?"([^/.]+?)":"([^/]+?)"))+")"+(o||""))).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),this._regex=new RegExp("^"+t+"$",e?"":"i"))}}e.Route=i;class o extends n{constructor(){super(),this._routes=[],this._onHashChange=()=>{this.handle(this.hash())},window.addEventListener?window.addEventListener("hashchange",this._onHashChange,!1):window.attachEvent("onhashchange",this._onHashChange)}static route(t,e){return o.default.route(t,e),o.default}static navigate(t,e=!1){return o.default.navigate(t,e),o.default}static start(){return o.default.start(),o.default}static hash(){return o.default.hash()}static handle(t){return o.default.handle(t)}route(t,e){const s=new i(t);return this._routes.push(s),this.on(t,(t,s)=>e.apply(s,t)),this}navigate(t,e=!1){const s=this.hash();return window.location.hash=t,e&&s===t&&this.handle(t),this}start(){return this._onHashChange(),this}hash(){return window.location.hash.substring(1)}handle(t){for(const e of this._routes){const s=[];if(e.match(t,s)){this.emit(e.path,s,e);break}}return this}}e.Router=o,o.default=new o,e.route=function(t,e){return o.route(t,e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Settings=void 0;const n=s(4);e.Settings=class{constructor(t,e="settings"){this.events=new n.Events,this.props=t,this.name=e}getProps(){return this.props}setProps(t){return Object.keys(t).forEach(e=>this.props[e]=t[e]),this.events.emit("",t),this}getProp(t){return this.props[t]}setProp(t,e){this.props[t]=e;return this.events.emit(t,e),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Signal=void 0;e.Signal=class{constructor(){this._slots=[],this._emit=!0}onConnect(t){this._onConnect=t}onDisconnect(t){this._onDisconnect=t}connNo(){return this._slots.length}connect(t,e){"function"==typeof t&&(e?this._slots.push({callback:t,object:e}):this._slots.push({callback:t}),this._onConnect&&this._onConnect(this._slots.length))}disconnect(t,e){"function"==typeof t&&(this._slots=this._slots.filter(s=>void 0===e?s.callback!==t:s.callback!==t&&s.object!==e),this._onDisconnect&&this._onDisconnect(this._slots.length))}disconnectAll(){this._slots=[],this._onDisconnect&&this._onDisconnect(this._slots.length)}freeze(){this._emit=!1}unfreeze(){this._emit=!0}emit(t){return this._emit&&this._slots.length?this._slots.map(e=>{const s=e.object;return s?e.callback.call(s,t):e.callback(t)}):[]}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.template=e.tmpl=void 0,e.tmpl=function(t,e){const s=/[^a-zA-Z0-9_-]+/.test(t)?t:document.getElementById(t).innerHTML;let n,i,o=JSON.stringify,r=/\$\{([\S\s]*?)\}/g,a=[],c=0;for(;i=r.exec(s);)n=s.slice(c,i.index),a.push(o(n),"("+i[1]+")"),c=r.lastIndex;n=s.slice(c),a.push(o(n));const h=new Function("obj","with(obj)return "+a.join("+"));return e?h(e):h};const n={};e.template=function t(e,s){const i=/[^a-zA-Z0-9_-]+/.test(e)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%\>/g,"',$1,'").split("\t").join("');").split("%>").join("\np.push('").split("\r").join("\\'")+"');}return p.join('');"):n[e]=n[e]||t(document.getElementById(e).innerHTML);return s?i(s):i}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tmpl=e.tmplo=e.tmpla=e.tmpls=void 0,e.tmpls=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)},e.tmpla=function(t,e){return e.reduce((t,e,s)=>t.replace(new RegExp(`\\$\\{${s}\\}`,"g"),e),t)},e.tmplo=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\$\\{${e[0]}\\}`,"g"),e[1]),t)},e.tmpl=function(t){const e=JSON.stringify,s=/\$\{([\S\s]*?)\}/g,n=[];let i,o,r=0;for(;i=s.exec(t);)o=t.slice(r,i.index),n.push(e(o),"("+i[1]+")"),r=s.lastIndex;return o=t.slice(r),n.push(e(o)),new Function("obj","with(obj)return "+n.join("+"))}},,,,function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validators=e.tmpl=e.template=e.signal=e.settings=e.router=e.objpaths=e.load=e.http=e.hsml=e.hsmlwidget=e.hsmlsvac=e.hsmlsvachtml=e.hsmlsvacctrl=e.hsmlidom=e.hsmlhtml=e.hsmlh=e.hsmldom=e.hsmlapp=e.history=e.hash=e.form=e.events=e.encode=e.dom=e.debounce=void 0;const n=s(6);e.debounce=n;const i=s(7);e.dom=i;const o=s(8);e.encode=o;const r=s(4);e.events=r;const a=s(9);e.form=a;const c=s(10);e.hash=c;const h=s(11);e.history=h;const l=s(12);e.hsmlapp=l;const u=s(13);e.hsmldom=u;const d=s(14);e.hsmlh=d;const m=s(5);e.hsmlhtml=m;const p=s(2);e.hsmlidom=p;const f=s(15);e.hsmlsvacctrl=f;const _=s(16);e.hsmlsvachtml=_;const g=s(17);e.hsmlsvac=g;const b=s(18);e.hsmlwidget=b;const y=s(0);e.hsml=y;const v=s(19);e.http=v;const j=s(20);e.load=j;const w=s(21);e.objpaths=w;const E=s(22);e.router=E;const x=s(23);e.settings=x;const C=s(24);e.signal=C;const S=s(25);e.template=S;const O=s(26);e.tmpl=O;const k=s(3);e.validators=k}])}));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("IncrementalDOM"));else if("function"==typeof define&&define.amd)define(["IncrementalDOM"],e);else{var s="object"==typeof exports?e(require("IncrementalDOM")):e(t.IncrementalDOM);for(var n in s)("object"==typeof exports?exports:t)[n]=s[n]}}(window,(function(t){return function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=30)}([function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hjoin=e.hsml=e.NBSP=void 0,e.NBSP="  ",e.hsml=function t(e,s,n){if(null!=e)switch(e.constructor){case Array:!function(e,s,n){if("string"!=typeof e[0])return void console.error("HSML tag head not string:",e);const i=e[0],o=e[1],r=o&&o.constructor===Object;let a,c,h=[];const l=e[r?2:1];switch(null!=l&&l.constructor){case Array:h=l;break;case Function:a=l;break;case String:case Boolean:case Number:case Date:h=[l];break;default:c=l}const u=i.split("~"),d=u[1],m=u[0].split("."),p=m[0].split("#"),f=p[0]||"div",_=p[1],g=m.slice(1);let b;b=r?o:{};_&&(b._id=_);g.length&&(b._classes=g);d&&(b._ref=d);c&&(b._hObj=c);const y=s.open(f,b,h,n);a&&s.fnc(a,n);y||h.forEach(e=>t(e,s,n));s.close(f,h,n)}(e,s,n);break;case Function:s.fnc(e,n);break;case String:s.text(e,n);break;case Boolean:s.text(""+e,n);break;case Number:const i=e,o=i.toLocaleString?i.toLocaleString():i.toString();s.text(o,n);break;case Date:const r=e,a=r.toLocaleString?r.toLocaleString():r.toString();s.text(a,n);break;default:s.obj(e,n)}},e.hjoin=function(t,e){const s=t.reduce((t,s)=>(t.push(s,e),t),[]);return s.splice(-1),s}},function(e,s){e.exports=t},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2idomPatch=e.hsml2idomPatch=void 0;const n=s(0),i=s(1);class o{open(t,e,s,n){const o=[];let r=e._id,a=e._classes?e._classes:[],c=e._ref,h=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":r=e[t];break;case"classes":const s=e[t];a=a.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":a=a.concat(e[t].split(" "));break;case"data":const i=e[t];for(const t in i)i.hasOwnProperty(t)&&(i[t].constructor===String?o.push("data-"+t,i[t]):o.push("data-"+t,JSON.stringify(i[t])));break;case"styles":o.push("style",e[t]);break;case"on":const c=e[t];"string"==typeof c[0]?"function"==typeof c[1]?o.push("on"+c[0],c[1]):o.push("on"+c[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(c[1],c[2],t)}):c.forEach(t=>{"function"==typeof t[1]?o.push("on"+t[0],t[1]):o.push("on"+t[0],e=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(t[1],t[2],e)})});break;default:switch(typeof e[t]){case"function":o.push("on"+t,e[t]);break;case"object":o.push(t,e[t]);break;case"boolean":e[t]&&o.push(t,t);break;default:o.push(t,e[t])}}return a.length&&o.unshift("class",a.join(" ")),r&&o.unshift("id",r),i.elementOpen(t,e._key,void 0,...o),e._skip&&i.skip(),n&&c&&(n.refs[c]=i.currentElement()),h&&h.mount&&h.mount.constructor===Function&&(h.mount(i.currentElement()),i.skip()),!!e._skip}close(t,e,s){i.elementClose(t)}text(t,e){i.text(t)}fnc(t,e){t(i.currentElement())&&i.skip()}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function r(t,e){n.hsml(t,new o,e)}e.hsml2idomPatch=function(t,e,s){i.patch(t,t=>t&&r(t,s),e)},e.hsmls2idomPatch=function(t,e,s){i.patch(t,t=>t&&function(t,e){for(const s of t)if(null!=s)if(s.constructor===String)i.text(s);else if("toHsml"in s){const t=s;t.toHsml&&r(t.toHsml(),t)}else r(s,e)}(t,s),e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FormValidator=e.BooleanValidator=e.DateValidator=e.NumberValidator=e.StringValidator=e.SelectValidator=e.tpl=e.Validator=e.rodneCisloRgex=e.pscRgex=e.phoneRgex=e.emailRegex=void 0;e.emailRegex=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,e.phoneRgex=/^(((00)([- ]?)|\+)(\d{1,3})([- ]?))?((\d{3})([- ]?))((\d{3})([- ]?))(\d{3})$/,e.pscRgex=/^\d{3} ?\d{2}$/,e.rodneCisloRgex=/^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$/;class n{constructor(t,e){this.str=null,this.err=null,this.obj=null,this.opts=t||{},this.msgs=e||{}}validate(t){if("string"==typeof t||null==t){const e=t;this.str=e;const s=this.strToObj(e);if(this.obj=s.obj,s.err)return this.err=s.err,{str:null==e?"":e,obj:s.obj,err:s.err};const n=this.objCheck(s.obj);return this.err=n,{str:null==e?"":e,obj:s.obj,err:n}}{this.str=null==t?null:""+t;const e=this.objCheck(t);return this.err=e,{str:this.str,obj:t,err:e}}}format(t,e){const s=this.objToStr(t,e);return{str:void 0===s.str||null===s.str?"":s.str,err:s.err}}}function i(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)}e.Validator=n,e.tpl=i;e.SelectValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{options:"options"in e?e.options.join(", "):""})):"required"}:{obj:void 0===t?null:t,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;return"options"in e&&t&&-1===e.options.indexOf(t)?s.invalid_option?i(s.invalid_option,Object.assign(Object.assign({},e.data),{option:null===t?"":t,options:"options"in e?e.options.join(", "):""})):"invalid_option":""}objToStr(t,e){return{str:t||"",err:""}}};e.StringValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;return"required"in e&&e.required&&!t?{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):"",regexp:"regexp"in e?""+(e.regexp||""):""})):"required"}:t?"regexp"in e&&!e.regexp.test(t)?{obj:null,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{regexp:"regexp"in e?""+(e.regexp||""):""})):"invalid_format"}:{obj:t,err:""}:{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t.length>e.max&&(n=!0),"min"in e&&t.length<e.min&&(n=!0),"min"in e&&"max"in e&&t.length>e.max&&t.length<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){return{str:t||"",err:""}}};e.NumberValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"required"};if(t){const n=Number(t);let o=!1;if(isNaN(n)&&(o=!0),e.strict&&t!==this.objToStr(n).str&&(o=!0),o){const t=isNaN(n)?1234.45:n;return{obj:isNaN(n)?null:n,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{num:this.objToStr(t).str||""})):"invalid_format"}}return{obj:n,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&t>e.max&&(n=!0),"min"in e&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e?""+(e.min||""):"",max:"max"in e?""+(e.max||""):""})):"not_in_range":""}objToStr(t,e){let s;return s=null==t?"":"decimals"in this.opts?t.toFixed(this.opts.decimals):String(t),{str:s,err:""}}};const o=t=>t.toLocaleString(),r=t=>t.toLocaleDateString(),a=t=>t.toISOString(),c=t=>new Date(t.toDateString()).toISOString();e.DateValidator=class extends n{constructor(t,e){super(t,e),(null==t?void 0:t.iso)?this.dateToStr=(null==t?void 0:t.dateOnly)?c:a:this.dateToStr=(null==t?void 0:t.dateOnly)?r:o,(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.min)&&(t.min=new Date(t.min.getFullYear(),t.min.getMonth(),t.min.getDate())),(null==t?void 0:t.dateOnly)&&(null==t?void 0:t.max)&&(t.max=new Date(t.max.getFullYear(),t.max.getMonth(),t.max.getDate()+1))}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"required"};if(t){const n=Date.parse(t);let o=new Date(n);e.dateOnly&&(o=new Date(o.getFullYear(),o.getMonth(),o.getDate()));let r=!1;if(isNaN(n)&&(r=!0),r){const t=isNaN(n)?new Date:o;return{obj:isNaN(n)?null:o,err:s.invalid_format?i(s.invalid_format,Object.assign(Object.assign({},e.data),{date:this.objToStr(t).str||""})):"invalid_format"}}return{obj:o,err:""}}return{obj:null,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"max"in e&&e.max&&t.getTime()>e.max.getTime()&&(n=!0),"min"in e&&e.min&&t<e.min&&(n=!0),n?s.not_in_range?i(s.not_in_range,Object.assign(Object.assign({},e.data),{min:"min"in e&&e.min?this.dateToStr(e.min):"",max:"max"in e&&e.max?this.dateToStr(e.max):""})):"not_in_range":""}objToStr(t,e){return{str:null==t?"":this.dateToStr(t),err:""}}};e.BooleanValidator=class extends n{constructor(t,e){super(t,e)}strToObj(t){const e=this.opts,s=this.msgs;if("required"in e&&e.required&&!t)return{obj:null,err:s.required?i(s.required,Object.assign({},e.data)):"required"};let n;switch(t){case"true":case"1":case"on":case"yes":n=!0;break;default:n=!1}return{obj:n,err:""}}objCheck(t){if(null==t)return"";const e=this.opts,s=this.msgs;let n=!1;return"value"in e&&t!==e.value&&(n=!0),n?s.invalid_value?i(s.invalid_value,Object.assign(Object.assign({},e.data),{value:"value"in e?""+(e.value||""):""})):"invalid_value":""}objToStr(t,e){return{str:null==t?"":""+t,err:""}}};e.FormValidator=class{constructor(){this.validators={}}addValidator(t,e){return this.validators[t]=e,this}validate(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].validate(n);return e.str[s]=i.str,e.obj[s]=i.obj,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}format(t){const e=Object.keys(this.validators).reduce((e,s)=>{const n=t[s],i=this.validators[s].format(n);return e.str[s]=i.str,e.obj[s]=n,e.err[s]=i.err,i.err&&(e.valid=!1),e},{str:{},obj:{},err:{},valid:!0});return this.str=e.str,this.obj=e.obj,this.err=e.err,this.valid=e.valid,this}data(){return{str:this.str,obj:this.obj,err:this.err,valid:this.valid}}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Events=void 0;e.Events=class{constructor(t){this._cb=[],this._cbs={},t&&(this._ctx=t)}emit(t,e){if(t in this._cbs)for(let s=0,n=this._cbs[t].length;s<n;s++)this._cbs[t][s](e,t,this._ctx);for(let s=0,n=this._cb.length;s<n;s++)this._cb[s](e,t,this._ctx);return this}on(t,e){const s=t;return s in this._cbs||(this._cbs[s]=[]),-1===this._cbs[s].indexOf(e)&&this._cbs[s].push(e),this}any(t){return this._cb.push(t),this}once(t,e){const s=t,n=(t,i,o)=>{this.off(s,n),e(t,i,o)};return this.on(t,n),this}off(t,e){return void 0===t&&(e?this._cb=this._cb.filter(t=>t!==e):this._cb.length=0),t&&t in this._cbs&&(e?this._cbs[t].splice(this._cbs[t].indexOf(e),1):(this._cbs[t].length=0,delete this._cbs[t])),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2htmls=e.hsml2htmls=e.hsmls2html=e.hsml2html=void 0;const n=s(0);class i{constructor(t,e=!1,s=" "){this._depth=0,this._onHtml=t,this._pretty=e,this._indent=s}open(t,e,s,o){const r=[];let a=e._id,h=e._classes?e._classes:[],l=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":a=e[t];break;case"classes":const s=e[t];h=h.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":h=h.concat(e[t].split(" "));break;case"data":const n=e[t];for(const t in n)n.hasOwnProperty(t)&&(n[t].constructor===String?r.push(["data-"+t,n[t]]):r.push(["data-"+t,JSON.stringify(n[t])]));break;case"styles":const i=e[t];let o="";for(const t in i)if(i.hasOwnProperty(t)){o+=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()+":"+i[t]+";"}r.push(["style",o]);break;case"styles":case"on":break;default:"function"==typeof e[t]||("boolean"==typeof e[t]?e[t]&&r.push([t,""]):r.push([t,e[t]]))}h.length&&r.unshift(["class",h.join(" ")]),a&&r.unshift(["id",a]),l&&"type"in l&&r.unshift(["hObj",l.type]);const u=r.map(t=>`${t[0]}="${c(t[1])}"`).join(" ");let d="";this._pretty&&(d+=this._mkIndent(this._depth),this._depth++);if(d+="<"+t+(u?" "+u:"")+(s.length||-1!==i._pairTags.indexOf(t)?">":"/>"),this._pretty&&(d+="\n"),this._onHtml(d),l&&"render"in l&&l.render.constructor===Function){const t=l.render();for(const e of t)if(null!=e)if(e.constructor===String)this._onHtml(e+(this._pretty?"\n":""));else if("toHsml"in e){const t=e;t.toHsml&&n.hsml(t.toHsml(),this)}else n.hsml(e,this)}return!1}close(t,e,s){let n="";const o=e.length||-1!==i._pairTags.indexOf(t);this._pretty&&(this._depth--,o&&(n+=this._mkIndent(this._depth))),o&&(n+="</"+t+">",this._pretty&&(n+="\n"),this._onHtml(n))}text(t,e){let s="";this._pretty&&(s+=this._mkIndent(this._depth)),s+=t instanceof String?t:c(t),this._pretty&&(s+="\n"),this._onHtml(s)}fnc(t,e){}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}_mkIndent(t){let e="";for(let s=0;s<t;s++)e+=this._indent;return e}}function o(t,e,s=!1){const o=new i(e,s);n.hsml(t,o)}function r(t,e,s=!1){for(const n of t)if(null!=n)if(n.constructor===String)e(n+(s?"\n":""));else if("toHsml"in n){const t=n;t.toHsml&&o(t.toHsml(),e,s)}else o(n,e,s)}i._pairTags=["script","iframe","html","head","body","title","div","h1","h2","h3","h4","h5","h6","p","a","pre","blockquote","i","b","em","strong","tt","cite","ol","ul","li","dl","dt","dd","table","tr","td","textarea","select","option"],e.hsml2html=o,e.hsmls2html=r,e.hsml2htmls=function(t,e=!1){const s=[];return o(t,t=>s.push(t),e),s},e.hsmls2htmls=function(t,e=!1){const s=[];return r(t,t=>s.push(t),e),s};const a=/["'&<>]/;function c(t){const e=""+t,s=a.exec(e);if(!s)return e;let n,i="",o=0,r=0;for(o=s.index;o<e.length;o++){switch(e.charCodeAt(o)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 39:n="&#39;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}r!==o&&(i+=e.substring(r,o)),r=o+1,i+=n}return r!==o?i+e.substring(r,o):i}},function(t,e,s){"use strict";function n(t,e=300){let s;return function(...n){clearTimeout(s),s=setTimeout(()=>{t.apply(this,n)},e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.Debounce=e.debounce=void 0,e.debounce=n,e.Debounce=function(t=300){return function(e,s,i){const o=i.value;return i.value=n(o,t),i}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.addEventListener=e.html=e.empty=e.remove=e.replace=e.append=e.select=e.selectAll=void 0,e.selectAll=function(t,e){const s=(e||document).querySelectorAll(t),n=[];for(let t=0;t<s.length;t++)n.push(s[t]);return n},e.select=function(t,e){return(e||document).querySelector(t)},e.append=function(t,...e){e.forEach(e=>t.appendChild(e))},e.replace=function(t,e){t.parentElement&&t.parentElement.replaceChild(e,t)},e.remove=function(t){t.parentElement&&t.parentElement.removeChild(t)},e.empty=function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},e.html=function(t){t=t.trim();let e={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],body:[0,"",""],_default:[1,"<div>","</div>"]};e.optgroup=e.option,e.tbody=e.tfoot=e.colgroup=e.caption=e.thead,e.th=e.td;const s=/<\s*\w.*?>/g.exec(t);let n=document.createElement("div");if(null!=s){const i=s[0].replace(/</g,"").replace(/>/g,"").split(" ")[0];if("body"===i.toLowerCase()){const e=document.createElement("body");n.innerHTML=t.replace(/<body/g,"<div").replace(/<\/body>/g,"</div>");const s=n.firstChild.attributes;e.innerHTML=t;for(let t=0;t<s.length;t++)e.setAttribute(s[t].name,s[t].value);return e}{const s=e[i]||e._default;t=s[1]+t+s[2],n.innerHTML=t;let o=s[0]+1;for(;o--;)n=n.lastChild}}else n.innerHTML=t,n=n.lastChild;return n},Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){const e=(this.document||this.ownerDocument).querySelectorAll(t);let s=e.length;for(;--s>=0&&e.item(s)!==this;);return s>-1}),e.addEventListener=function(t,e,s,n,i=!1){t.addEventListener(s,(function(t){const s=t||window.event,i=s.target||t.srcElement;i&&i.matches(e)&&n(i,s)}),i)},e.removeEventListener=function(t,e,s,n=!1){t.removeEventListener(e,s,n)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Base64=e.UrlEncodedData=void 0;e.UrlEncodedData=class{static encode(t,e=""){let s;if("object"!=typeof t)s=t;else{const n=[];let i=0;for(let s in t)if(t.hasOwnProperty(s)){let o=t[s];o instanceof Array||(o=[o]);const r=o.length;for(let t=0;t<r;t++){const r=o[t];"object"==typeof r&&null!=r?n[i++]=arguments.callee(r,e+s+"."):(n[i]=encodeURIComponent(e+s),null!=r&&(n[i]+="="+encodeURIComponent(r)),i++)}}s=n.join("&")}return s}static decode(t){const e={};if(t){const s=t.split("&"),n=s.length;for(let t=0;t<n;t++){const n=s[t].split("="),i=decodeURIComponent(n[0]);if(n.length>1){const t=decodeURIComponent(n[1]),s=i.split("."),o=s.length;let r=e;for(let e=0;e<o;e++){const n=s[e],i=r[n];e===o-1?i?i instanceof Array?r[n].push(t):(r[n]=[i],r[n][1]=t):r[n]=t:(i||(r[n]={}),r=r[n])}}else e[i]=null}}return e}};class n{static encode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=n._utf8_encode(t);l<t.length;)e=t.charCodeAt(l++),s=t.charCodeAt(l++),i=t.charCodeAt(l++),o=e>>2,r=(3&e)<<4|s>>4,a=(15&s)<<2|i>>6,c=63&i,isNaN(s)?a=c=64:isNaN(i)&&(c=64),h=h+n._keyStr.charAt(o)+n._keyStr.charAt(r)+n._keyStr.charAt(a)+n._keyStr.charAt(c);return h}static decode(t){let e,s,i,o,r,a,c,h="",l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<t.length;)o=this._keyStr.indexOf(t.charAt(l++)),r=this._keyStr.indexOf(t.charAt(l++)),a=this._keyStr.indexOf(t.charAt(l++)),c=this._keyStr.indexOf(t.charAt(l++)),e=o<<2|r>>4,s=(15&r)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(e),64!==a&&(h+=String.fromCharCode(s)),64!==c&&(h+=String.fromCharCode(i));return h=n._utf8_decode(h),h}static _utf8_encode(t){t=t.replace(/\r\n/g,"\n");let e="";for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}static _utf8_decode(t){let e="",s=0,n=0,i=0,o=0;for(;s<t.length;)n=t.charCodeAt(s),n<128?(e+=String.fromCharCode(n),s++):n>191&&n<224?(i=t.charCodeAt(s+1),e+=String.fromCharCode((31&n)<<6|63&i),s+=2):(i=t.charCodeAt(s+1),o=t.charCodeAt(s+2),e+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),s+=3);return e}}e.Base64=n,n._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Form=e.FileEntry=e.RadioEntry=e.SelectEntry=e.CheckboxEntry=e.NumberInputEntry=e.TextInputEntry=e.TextAreaEntry=void 0;e.TextAreaEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.TextInputEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this._element.addEventListener("input",()=>{this._onChange&&this._onChange(this,!1)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.NumberInputEntry=class{constructor(t){this._decimals=0,this._dragSensitivity=1,this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this,!0)}),this.setDecimals(2)}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return isNaN(+t)||(this._element.value=(+t).toFixed(this._decimals)),this}setStep(t){return isNaN(t)||(this._element.step=""+t),this}setMin(t){return isNaN(t)||(this._element.min=""+t),this}setMax(t){return isNaN(t)||(this._element.max=""+t),this}setDecimals(t){return isNaN(t)||(this._decimals=t),this}setDragSensitivity(t){return isNaN(t)||(this._dragSensitivity=t),this}enableMouseWheel(){const t=()=>{this._onChange&&setTimeout(()=>{this._onChange&&this._onChange(this,!1)},0)};return this._element.addEventListener("focus",()=>{this._element.addEventListener("mousewheel",t)}),this._element.addEventListener("blur",()=>{this._element.removeEventListener("mousewheel",t)}),this}enableMouseDrag(){return this._element.addEventListener("mousedown",t=>{document.body.style.cursor="row-resize",this._element.style.cursor="row-resize";const e=t.pageY,s=Number(this.getValue()),n=""===this._element.min?null:Number(this._element.min),i=""===this._element.max?null:Number(this._element.max),o=""===this._element.step?1:Number(this._element.step),r=isNaN(s)?null===n?0:n:s,a=t=>{const s=(t.pageY-e)*this._dragSensitivity,a=r-s*o;null!==n&&a<n?this.setValue(n.toFixed(this._decimals)):null!==i&&a>i?this.setValue(i.toFixed(this._decimals)):this.setValue(a.toFixed(this._decimals)),this._onChange&&this._onChange(this,!1)},c=()=>{document.body.style.cursor="",this._element.style.cursor="",document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c),this._onChange&&this._onChange(this,!0)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.CheckboxEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return""+this._element.checked}setValue(t){return this._element.checked=!(!t||"false"===t),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.SelectEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){return this._element.value}setValue(t){return this._element.value=t,this}setOptions(t){const e=this._element;for(;e.options.length>0;)e.remove(0);return t.forEach(t=>{const s=document.createElement("option");s.text=t.text,s.value=t.value,e.add(s)}),this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.RadioEntry=class{constructor(t){this._elements=[],t.forEach(t=>{"string"==typeof t?this._elements.push(document.getElementById(t)):this._elements.push(t)}),this._elements.forEach(t=>{t.addEventListener("change",()=>{this._onChange&&t.checked&&this._onChange(this)})})}getName(){return this._elements[0].name}getValue(){for(let t of this._elements)if(t.checked)return t.value}setValue(t){for(let e of this._elements)e.value===t&&(e.checked=!0);return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.FileEntry=class{constructor(t){this._element="string"==typeof t?document.getElementById(t):t,this._element.addEventListener("change",()=>{this._onChange&&this._onChange(this)})}getName(){return this._element.name}getValue(){const t=this._element.files;return t&&t.length?t[0].name+" ("+t[0].type+", "+t[0].size+")":void 0}getFile(){return this._element.files&&this._element.files.length?this._element.files[0]:null}setValue(t){return this}validate(t=""){return this._validator?this._validator(this,t):""}setValidator(t){return this._validator=t,this}onChange(t){return this._onChange=t,this}};e.Form=class{constructor(t){this._formEntries=[],this._element="string"==typeof t?document.getElementById(t):t,this._element.onsubmit=t=>(t.preventDefault(),this._onSubmit&&this._onSubmit(this),!1)}addEntry(t){return this._formEntries.push(t),this}setEntries(t){return this._formEntries=t,this}getEntries(){return this._formEntries}getEntry(t){for(let e of this._formEntries)if(e.getName()===t)return e}validate(t){const e={};for(let s of this._formEntries)e[s.getName()]=s.validate(t);return e}isValid(t){t||(t=this.validate());for(let e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}getValues(){const t={};for(let e of this._formEntries)t[e.getName()]=e.getValue();return t}submit(){this._element.submit()}onSubmit(t){return this._onSubmit=t,this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.hashUrlDecoder=e.hashUrlEncoder=e.hashJsonDecoder=e.hashJsonEncoder=void 0,e.hashJsonEncoder=t=>t?encodeURIComponent(JSON.stringify(t)):"",e.hashJsonDecoder=t=>t?JSON.parse(decodeURIComponent(t)):void 0,e.hashUrlEncoder=t=>{const s="string"==typeof t?e.hashUrlDecoder(t):t,n=s.path||[],i=s.query||{},o=n.map(t=>encodeURIComponent(t)).join("/"),r=Object.entries(i).reduce((t,e)=>("string"==typeof e[1]?t.append(e[0],e[1]):e[1].forEach(s=>t.append(e[0],s)),t),new URLSearchParams).toString();return`${o}${r?"?":""}${r}`},e.hashUrlDecoder=t=>{const[e,s]=t.split("?"),n=e.split("/").map(t=>decodeURIComponent(t)),i={};for(const t of new URLSearchParams(s).entries()){const[e,s]=t;e in i?"string"==typeof i[e]?i[e]=[i[e],s]:i[e].push(s):i[e]=s}return{path:n,query:i}};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(){return this._cb&&this._cb(this.read()),"onhashchange"in window?onhashchange=()=>{const t=this.read();if(this._emitWritten)this._cb&&this._cb(t);else{const e=this._writtenDataJson===JSON.stringify(t);this._writtenDataJson=void 0,e||this._cb&&this._cb(t)}}:alert('Browser "window.onhashchange" not implemented'),this}read(){return this._decode(location.hash.slice(1))}write(t){return location.hash="#"+this._encode(t),this._emitWritten||(this._writtenDataJson=JSON.stringify(t),this._cb&&this._cb(t)),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.History=void 0;e.History=class{back(){window.history.back()}forward(){window.history.forward()}go(t){window.history.go(t)}length(){return window.history.length}state(){return window.history.state}pushState(t,e,s){window.history.pushState(t,e,s)}replaceState(t,e,s){window.history.replaceState(t,e,s)}onChange(t){return window.addEventListener("popstate",(function(e){t(e.state)})),this}}},function(t,e,s){"use strict";var n=this&&this.__awaiter||function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.HApp=e.HAppAction=void 0;const i=s(2),o=console.log,r=console.error;var a;!function(t){t._init="_init",t._mount="_mount",t._umount="_umount"}(a=e.HAppAction||(e.HAppAction={}));const c=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},h=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class l{constructor(t,e,s,i=document.body){this.refs={},this.dispatch=(t,e,s)=>n(this,void 0,void 0,(function*(){if(l.debug){o("HApp action:",{type:t,data:e,event:s});const n=performance.now();try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}const i=performance.now();o("HApp dispatch:",i-n+" ms",this.state)}else try{yield this.dispatcher({type:t,data:e,event:s},this.state,this.dispatch),this.update()}catch(t){r("HApp dispatch:",t)}})),this.render=()=>{if(l.debug){const t=performance.now();let e;try{e=this.view(this.state)}catch(t){r("HApp render:",t)}const s=performance.now();return o("HApp render:",s-t+" ms",e),e||[]}{let t;try{t=this.view(this.state)}catch(t){r("HApp render:",t)}return t||[]}},this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e=t.target;switch(e.nodeName){case"FORM":t.preventDefault();const s=e.elements,n={};for(let t=0;t<s.length;t++){const e=d(s[t]);if("object"==typeof e){const i=Object.keys(e);if(i.length){const o=i[0],r=e[o];void 0===n[o]?n[o]=r:"string"==typeof n[o]||n[o]instanceof String?n[o]=r instanceof Array?[n[o],...r]:[n[o],r]:n[o]instanceof Array?r instanceof Array?n[o]=n[o].concat(r):n[o].push(r):n[o]=r instanceof Array?[n[o],...r]:[n[o],r],n[o]instanceof Array&&(n[o]=n[o].filter(t=>null!==t),"radio"===s[t].type&&(n[o]=n[o].length?n[o][0]:null))}}}return n;default:return d(e)}}(s)),this.dispatch(t,e,s)},this.mount=(t=document.body)=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.app){e.app.umount()}if(!this.dom){this.dom=e,e.app=this;u(e,this.render(),this),this._onUpdate&&this._onUpdate(this),this.dispatch(a._mount,this.dom)}return this},this.umount=()=>{if(this.dom){this.dispatch(a._umount,this.dom),this.dom.hasAttribute("app")&&this.dom.removeAttribute("app");const t=this.dom.querySelectorAll("[app]");for(let e=0;e<t.length;e++){const s=t[e].app;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.app,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=c(()=>{if(this.dom){const t=this.render();u(this.dom,t,this)}this._updateSched=void 0,this._onUpdate&&this._onUpdate(this)})),this),this.onUpdate=t=>(this._onUpdate=t,this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0}];h(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.app=this,this.dispatch(a._mount,this.dom))}),["div",t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.state=t,this.view=e,this.dispatcher=s||(t=>n(this,void 0,void 0,(function*(){return o("HApp action:",t.type,t.data)}))),this.dispatch(a._init).then(()=>this.mount(i))}}function u(t,e,s){if(l.debug){const n=performance.now();i.hsmls2idomPatch(t,e,s);const r=performance.now();o("HApp update:",r-n+" ms",t)}else i.hsmls2idomPatch(t,e,s)}function d(t){let e=null;switch(t.nodeName){case"INPUT":const s=t;switch(s.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":e=s.name?{[s.name]:s.value}:s.value;break;case"radio":e=s.name?{[s.name]:s.checked?s.value:null}:s.checked?s.value:null;break;case"checkbox":e="on"===s.value?s.name?{[s.name]:String(s.checked)}:String(s.checked):s.name?{[s.name]:s.checked?String(s.value):null}:s.checked?String(s.value):null}break;case"SELECT":const n=t;if(n.multiple){const t=Array.from(n.selectedOptions).map(t=>t.value);e=n.name?{[n.name]:t}:t}else e=n.name?{[n.name]:n.value}:n.value;break;case"TEXTAREA":const i=t;e=i.name?{[i.name]:i.value}:i.value;break;case"BUTTON":const o=t;e=o.name?{[o.name]:o.value}:o.value}return e}e.HApp=l,l.debug=!1},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hsmls2dom=e.hsml2dom=void 0;const n=s(0);class i{open(t,e,s,n){const i=document.createElement(t);let o=e._id,r=e._classes?e._classes:[],a=e._ref,c=e._hObj;for(const t in e)if(e.hasOwnProperty(t))switch(t){case"_id":case"_classes":case"_ref":case"_key":case"_skip":case"_hObj":break;case"id":o=e[t];break;case"classes":const s=e[t];r=r.concat(s?s.map(t=>t.constructor===String?t:t[1]?t[0]:void 0).filter(t=>void 0!==t):[]);break;case"class":r=r.concat(e[t].split(" "));break;case"data":const a=e[t];for(const t in a)a.hasOwnProperty(t)&&(a[t].constructor===String?i.dataset[t]=a[t]:i.dataset[t]=JSON.stringify(a[t]));break;case"styles":const c=e[t];for(const t in c)c.hasOwnProperty(t)&&(i.style[t]=c[t]);break;case"on":const h=e[t];"string"==typeof h[0]?"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)}):h.forEach(t=>{"function"==typeof h[1]?i.addEventListener(h[0],h[1]):i.addEventListener(h[0],t=>{n&&n.actionCb&&"function"==typeof n.actionCb&&n.actionCb(h[1],h[2],t)})});break;default:"function"==typeof e[t]?i.addEventListener(t,e[t]):"boolean"==typeof e[t]?e[t]&&i.setAttribute(t,""):i.setAttribute(t,e[t])}return o&&i.setAttribute("id",o),r.length&&i.classList.add(...r),this._current?(this._current.appendChild(i),this._current=i):(this.element=i,this._current=i),n&&a&&(n.refs[a]=this._current),c&&c.mount&&c.mount.constructor===Function&&c.mount(i),!!e._skip}close(t,e,s){this._current!==this.element&&this._current&&(this._current=this._current.parentElement||void 0)}text(t,e){this._current&&this._current.appendChild(document.createTextNode(t))}fnc(t,e){this._current&&t(this._current)}obj(t,e){"toHsml"in t?t.toHsml&&n.hsml(t.toHsml(),this,t):this.text(""+t,e)}}function o(t,e){const s=new i;return n.hsml(t,s,e),s.element}e.hsml2dom=o,e.hsmls2dom=function(t,e){const s=[];for(const n of t)if(null!=n)if(n.constructor===String)s.push(document.createTextNode(n));else if("toHsml"in n){const t=n;t.toHsml&&s.push(o(t.toHsml(),t))}else s.push(o(n,e));return s}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.h=void 0,e.h=function(t,e,s){const n=[t];return e&&("string"==typeof e||"number"==typeof e?n.push([e]):(Array.isArray(e),n.push(e))),s&&("string"==typeof s||"number"==typeof s?n.push([s]):(Array.isArray(s)||"function"==typeof s)&&n.push(s)),n}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HCtrl=void 0;const n=s(2),i=s(1),o=(t,e,s)=>n=>{if(n.ctrl){const i=n.ctrl;if(i.view===t.view)void 0!==e&&(i.state=e),i.update();else{i.umount();const o=new c(t,s);void 0!==e&&(o.state=e),o.mount(n)}}else{const i=new c(t,s);void 0!==e&&(i.state=e),i.mount(n)}return!0},r=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},a=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class c{constructor(t,e){this.type="Ctrl",this.id=this.type+"-"+c._count++,this.refs={},this.appAction=(t,e,s)=>{c.debug&&console.log("appAction",this.type,t,e,s),c.appActions&&c.appActions(this,t,e,s)},this.extAction=(t,e,s)=>{c.debug&&console.log("extAction",this.type,t,e,s),this._extAction&&this._extAction(t,e,s)},this.action=(t,e,s)=>{c.debug&&console.log("action",this.type,t,e,s),this._actions&&this._actions(this,t,e,s)},this.render=()=>this.view(this.state,this.action,o),this.actionCb=(t,e,s)=>{void 0===(e=e&&e.constructor===Function?e(s):e)&&s&&(e=function(t){const e={},s=t.target;switch(s.nodeName){case"INPUT":const t=s;switch(t.type){case"text":case"hidden":case"password":case"email":case"number":case"search":case"url":case"tel":case"color":case"date":case"datetime-local":case"month":case"range":case"time":case"week":case"submit":case"button":case"radio":case"number":e[t.name]=t.value;break;case"checkbox":e[t.name]=""+t.checked}break;case"SELECT":const n=s;e[n.name]=n.value;break;case"TEXTAREA":const i=s;e[i.name]=i.innerText;break;case"BUTTON":const o=s;e[o.name]=o.value}return e}(s)),this.action(t,e,s)},this.mount=t=>{const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if(e.ctrl){const t=e.ctrl;t&&t.umount()}if(!this.dom){c._ctrls[this.id]=this,this.dom=e,e.ctrl=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("ctrl",this.type),this.action("_mount",this.dom)}return this},this.umount=()=>{if(this.dom){delete c._ctrls[this.id],this.action("_umount",this.dom),this.dom.hasAttribute("ctrl")&&this.dom.removeAttribute("ctrl");const t=this.dom.querySelectorAll("[ctrl]");for(let e=0;e<t.length;e++){const s=t[e].ctrl;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.ctrl,this.dom=void 0}return this},this.update=()=>(this.dom&&!this._updateSched&&(this._updateSched=r(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this),this.toHsml=()=>{if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,ctrl:this.type}];a(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.ctrl=this,c._ctrls[this.id]=this,this.action("_mount",this.dom))}),["div",{_id:this.id,_key:this.id,ctrl:this.type},t]},this.toHtml=()=>this.dom?this.dom.outerHTML:"",this.view=t.view,this.type=t.type,this.state=t.state,this._actions=t.actions,this._extAction=e||this.appAction,this.action("_init")}appActions(t){return c.appActions=t,this}appCtrls(){return Object.values(c._ctrls)}}e.HCtrl=c,c.debug=!1,c._count=0,c._ctrls={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&t.ctrl){const e=t.ctrl;e&&e.umount()}})}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.htmls=e.html=void 0;const n=s(5),i=(t,e,s)=>{},o=(t,e)=>t.view(e||t.state,i,o);e.html=function(t,e,s,r=!1){n.hsmls2html(t.view(e,i,o),s,r)},e.htmls=function(t,e,s=!1){return n.hsmls2htmls(t.view(e,i,o),s).join("")}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HWidget=void 0;const n=s(2),i=s(1),o=window.requestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},r=window.cancelAnimationFrame||function(t){window.clearTimeout(t)};class a{constructor(t){this.type=this.constructor.name,this.id=this.type+"-"+a._count++,this.refs={},this.toHtml=()=>this.dom?this.dom.outerHTML:"",t&&(this.type=t)}onMount(){console.log("mount")}onUmount(){console.log("umount")}actions(t,e){console.log(t,e)}action(t,e){this.actions(t,e)}actionCb(t,e,s){e=e&&e.constructor===Function?e(s):void 0===e?s:e,this.action(t,e)}mount(t){const e="string"==typeof t?document.getElementById(t)||document.body:t||document.body;if("widget"in e){const t=e.widget;t&&t.umount()}if(!this.dom){a.mounted[this.id]=this,this.dom=e,e.widget=this;const t=this.render();n.hsmls2idomPatch(e,t,this),e.setAttribute("widget",this.type),this.onMount&&this.onMount()}return this}umount(){if(this.dom){delete a.mounted[this.id],this.onUmount&&this.onUmount(),this.dom.hasAttribute("widget")&&this.dom.removeAttribute("widget");const t=this.dom.querySelectorAll("[widget]");for(let e=0;e<t.length;e++){const s=t[e].widget;s&&s.umount()}for(;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);delete this.dom.widget,this.dom=void 0}return this}update(){return this.dom&&!this._updateSched&&(this._updateSched=o(()=>{this.dom&&n.hsmls2idomPatch(this.dom,this.render(),this),this._updateSched=void 0})),this}toHsml(){if(this.dom){if(!this._updateSched)return["div",{_skip:!0,_id:this.id,_key:this.id,widget:this.type}];r(this._updateSched),this._updateSched=void 0}const t=this.render();return t.push(t=>{this.dom||(this.dom=t,t.widget=this,this.onMount&&this.onMount())}),["div",{_id:this.id,_key:this.id,widget:this.type},t]}}e.HWidget=a,a._count=0,a.mounted={},i.notifications.nodesDeleted=t=>{t.forEach(t=>{if(1===t.nodeType&&"widget"in t){const e=t.widget;e&&e.umount()}})}},function(t,e,s){"use strict";function n(t){return Array.isArray?Array.isArray(t):null!=t&&void 0!==t&&-1==="boolean|number|string|function|xml".indexOf(typeof t)&&("number"==typeof t.length&&!t.propertyIsEnumerable("length"))}function i(t){const e=[];for(const s in t)if(t.hasOwnProperty(s)){const i=t[s];if("object"==typeof i)if(n(i))for(const t of i)e.push([s,"object"==typeof t?JSON.stringify(t):t]);else e.push([s,JSON.stringify(i)]);else e.push([s,i])}for(let t,s=0;t=e[s++];)e[s-1]=`${encodeURIComponent(t[0])}=${encodeURIComponent(t[1])}`;return e.join("&")}Object.defineProperty(e,"__esModule",{value:!0}),e.http=e.onError=e.onResponse=e.onRequest=e.del=e.patch=e.put=e.post=e.get=e.HttpRequest=e.authBasic=e.HttpResponse=e.encodeUrlQuery=e.decodeUrlQuery=e.isArray=void 0,e.isArray=n,e.decodeUrlQuery=function(t){const e={};if(t){const s=t.substr(1).split("&");for(const t of s){const s=t.split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1]||"")}}return e},e.encodeUrlQuery=i;class o{constructor(t){this._xhr=t}getHeaders(){return this._xhr.getAllResponseHeaders()}getHeader(t){return this._xhr.getResponseHeader(t)}getBody(){return this._xhr.response}getType(){return this._xhr.responseType}getContentType(){return this.getHeader("Content-Type")}getText(){return this._xhr.responseText}getJson(){return JSON.parse(this._xhr.responseText)}getXml(){return this._xhr.responseXML}}e.HttpResponse=o,e.authBasic=(t,e)=>s=>{s.headers({Authorization:"Basic "+btoa(t+":"+e)})};class r{constructor(){this._method="GET",this._headers={},this._async=!0,this._noCache=!1}static abortAll(){r.xhrs.forEach(t=>t.abort()),r.xhrs.length=0}get(t,e){return this.method("GET"),this.url(t,e),this}post(t,e){return this.method("POST"),this.url(t,e),this}put(t,e){return this.method("PUT"),this.url(t,e),this}patch(t,e){return this.method("PATCH"),this.url(t,e),this}del(t,e){return this.method("DELETE"),this.url(t,e),this}url(t,e){return this._url=t,this._query=e,this}method(t){return this._method=t,this}headers(t){for(const e in t)t.hasOwnProperty(e)&&(this._headers[e]=t[e]);return this}use(t){return t(this),this}timeout(t){return this._timeout=t,this}responseType(t){return this._responseType=t,this}onProgress(t){return this._onProgress=t,this}onResponse(t){return this._onResponse=t,this}onError(t){return this._onError=t,this}async(t=!0){return this._async=t,this}noCache(t=!0){return this._noCache=t,this}abort(){return this._xhr&&this._xhr.abort(),this}send(t,e){e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)}sendPromise(t,e){return new Promise((s,n)=>{this._onResponse=s,this._onError=n,e&&(this._headers["Content-Type"]=e),this._send(t,this._headers)})}_send(t,e){const s=new XMLHttpRequest;this._xhr=s;let n=this._url||"";if(this._query){const t=i(this._query);n=t?`${n}?${t}`:n}if(this._noCache&&(n+=(/\?/.test(n)?"&":"?")+(new Date).getTime()),this._responseType&&(this._xhr.responseType=this._responseType),"onprogress"in s&&this._onProgress){const t=t=>{this._onProgress({loaded:t.loaded,total:t.lengthComputable?t.total:void 0})};s.upload.onprogress=t,s.onprogress=t}r.xhrs.push(this),s.open(this._method,n,this._async);for(const t in e)e.hasOwnProperty(t)&&s.setRequestHeader(t,e[t]);if(this._timeout&&(s.timeout=this._timeout),"ontimeout"in s&&(this._onError||r.onError)&&(s.ontimeout=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),"onabort"in s&&(this._onError||r.onError)&&(s.onabort=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),(this._onError||r.onError)&&(s.onerror=t=>{r.onError&&r.onError(t),this._onError&&this._onError(t)}),!this._async){if(t){const e="string"==typeof t?t:JSON.stringify(t);s.send(e)}else s.send();return JSON.parse(s.responseText)}"onload"in s?s.onload=t=>{if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}:s.onreadystatechange=t=>{switch(s.readyState){case 4:if(r.xhrs=r.xhrs.filter(t=>this!==t),s.status>=200&&s.status<300){const t=new o(s);r.onResponse&&r.onResponse(t),this._onResponse&&this._onResponse(t)}else r.onError&&r.onError(t),this._onError&&this._onError(t)}},void 0!==t?"string"==typeof t||t instanceof FormData||t instanceof Blob?s.send(t):(this._headers["Content-Type"]||s.setRequestHeader("Content-Type","application/json"),s.send(JSON.stringify(t))):s.send()}}function a(t,e){return(new r).method("GET").url(t,e)}function c(t,e){return(new r).method("POST").url(t,e)}function h(t,e){return(new r).method("PUT").url(t,e)}function l(t,e){return(new r).method("DELETE").url(t,e)}function u(t){r.onRequest=t}function d(t){r.onResponse=t}function m(t){r.onError=t}e.HttpRequest=r,r.xhrs=[],e.get=a,e.post=c,e.put=h,e.patch=function(t,e){return(new r).method("PATCH").url(t,e)},e.del=l,e.onRequest=u,e.onResponse=d,e.onError=m,e.http={get:a,post:c,put:h,delete:l,onRequest:u,onResponse:d,onError:m}},function(t,e,s){"use strict";function n(t,e){const s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.src=t,s.readyState?s.onreadystatechange=()=>{const t="loaded"===s.readyState,n="complete"===s.readyState;(t||n)&&(s.onreadystatechange=null,"function"==typeof e&&e())}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.css=e.image=e.scripts=e.script=e.scriptLib=void 0,e.scriptLib=function(t,e,s){n(t,()=>{const t=window[e];window[e]={},delete window[e],s&&s(t)})},e.script=n,e.scripts=function(t,e){t.reverse();let s=e;for(let e=0;e<t.length;e++){s=((t,e)=>()=>n(t,()=>e&&e()))(t[e],s)}s&&s()},e.image=function(t,e){const s=new Image;s.src=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()}},e.css=function(t,e){const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.readyState?s.onreadystatechange=()=>{"function"==typeof e&&e()}:s.onload=()=>{"function"==typeof e&&e()},document.getElementsByTagName("head")[0].appendChild(s)}},function(t,e,s){"use strict";function n(t,e=[],s={}){return Object.keys(t).reduce((s,i)=>{const o=e.concat(i);return"object"==typeof t[i]&&null!==t[i]?n(t[i],o,s):0===s[t[i]]||s[t[i]]?s[t[i]].push(o):s[t[i]]=[o],s},s)}Object.defineProperty(e,"__esModule",{value:!0}),e.objValuePaths=e.objPaths=void 0,e.objPaths=function(t){const e=n(t);return Object.keys(e).map(t=>e[t]).reduce((t,e)=>t.concat(e))},e.objValuePaths=n},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.route=e.Router=e.Route=e.Emitter=void 0;class n{constructor(){this._callbacks={}}on(t,e){return t in this._callbacks||(this._callbacks[t]=[]),this._callbacks[t].push(e),this}emit(t,...e){return t in this._callbacks&&this._callbacks[t].forEach(t=>t.apply(this,e)),this}off(t,e){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;const s=this._callbacks[t];if(!s)return this;if(1===arguments.length)return delete this._callbacks[t],this;for(let t=0;t<s.length;t++){if(s[t]===e){s.splice(t,1);break}}return this}}e.Emitter=n;class i{constructor(t){this._params={},this.keys=[],this.path=t,this._pathParse(t,!1,!1)}match(t,e){const s=this._regex.exec(t);if(!s)return!1;for(let t=1;t<s.length;++t){const n=this.keys[t-1],i="string"==typeof s[t]?decodeURIComponent(s[t]):s[t];n&&(this._params[n.name]=i),e.push(i)}return!0}_pathParse(t,e,s){t instanceof RegExp?this._regex=t:(t instanceof Array&&(t="("+t.join("|")+")"),t=t.concat(s?"":"/?").replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,(t,e,s,n,i,o)=>(this.keys.push({name:n,optional:!!o}),e=e||"",(o?"":e)+"(?:"+(o?e:"")+(s||"")+(i||(s?"([^/.]+?)":"([^/]+?)"))+")"+(o||""))).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),this._regex=new RegExp("^"+t+"$",e?"":"i"))}}e.Route=i;class o extends n{constructor(){super(),this._routes=[],this._onHashChange=()=>{this.handle(this.hash())},window.addEventListener?window.addEventListener("hashchange",this._onHashChange,!1):window.attachEvent("onhashchange",this._onHashChange)}static route(t,e){return o.default.route(t,e),o.default}static navigate(t,e=!1){return o.default.navigate(t,e),o.default}static start(){return o.default.start(),o.default}static hash(){return o.default.hash()}static handle(t){return o.default.handle(t)}route(t,e){const s=new i(t);return this._routes.push(s),this.on(t,(t,s)=>e.apply(s,t)),this}navigate(t,e=!1){const s=this.hash();return window.location.hash=t,e&&s===t&&this.handle(t),this}start(){return this._onHashChange(),this}hash(){return window.location.hash.substring(1)}handle(t){for(const e of this._routes){const s=[];if(e.match(t,s)){this.emit(e.path,s,e);break}}return this}}e.Router=o,o.default=new o,e.route=function(t,e){return o.route(t,e)}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Settings=void 0;const n=s(4);e.Settings=class{constructor(t,e="settings"){this.events=new n.Events,this.props=t,this.name=e}getProps(){return this.props}setProps(t){return Object.keys(t).forEach(e=>this.props[e]=t[e]),this.events.emit("",t),this}getProp(t){return this.props[t]}setProp(t,e){this.props[t]=e;return this.events.emit(t,e),this}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Signal=void 0;e.Signal=class{constructor(){this._slots=[],this._emit=!0}onConnect(t){this._onConnect=t}onDisconnect(t){this._onDisconnect=t}connNo(){return this._slots.length}connect(t,e){"function"==typeof t&&(e?this._slots.push({callback:t,object:e}):this._slots.push({callback:t}),this._onConnect&&this._onConnect(this._slots.length))}disconnect(t,e){"function"==typeof t&&(this._slots=this._slots.filter(s=>void 0===e?s.callback!==t:s.callback!==t&&s.object!==e),this._onDisconnect&&this._onDisconnect(this._slots.length))}disconnectAll(){this._slots=[],this._onDisconnect&&this._onDisconnect(this._slots.length)}freeze(){this._emit=!1}unfreeze(){this._emit=!0}emit(t){return this._emit&&this._slots.length?this._slots.map(e=>{const s=e.object;return s?e.callback.call(s,t):e.callback(t)}):[]}}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.template=e.tmpl=void 0,e.tmpl=function(t,e){const s=/[^a-zA-Z0-9_-]+/.test(t)?t:document.getElementById(t).innerHTML;let n,i,o=JSON.stringify,r=/\$\{([\S\s]*?)\}/g,a=[],c=0;for(;i=r.exec(s);)n=s.slice(c,i.index),a.push(o(n),"("+i[1]+")"),c=r.lastIndex;n=s.slice(c),a.push(o(n));const h=new Function("obj","with(obj)return "+a.join("+"));return e?h(e):h};const n={};e.template=function t(e,s){const i=/[^a-zA-Z0-9_-]+/.test(e)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%\>/g,"',$1,'").split("\t").join("');").split("%>").join("\np.push('").split("\r").join("\\'")+"');}return p.join('');"):n[e]=n[e]||t(document.getElementById(e).innerHTML);return s?i(s):i}},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tmpl=e.tmplo=e.tmpla=e.tmpls=void 0,e.tmpls=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\{\\{${e[0]}\\}\\}`,"g"),String(e[1])),t)},e.tmpla=function(t,e){return e.reduce((t,e,s)=>t.replace(new RegExp(`\\$\\{${s}\\}`,"g"),e),t)},e.tmplo=function(t,e){return Object.keys(e).map(t=>[t,e[t]]).reduce((t,e)=>t.replace(new RegExp(`\\$\\{${e[0]}\\}`,"g"),e[1]),t)},e.tmpl=function(t){const e=JSON.stringify,s=/\$\{([\S\s]*?)\}/g,n=[];let i,o,r=0;for(;i=s.exec(t);)o=t.slice(r,i.index),n.push(e(o),"("+i[1]+")"),r=s.lastIndex;return o=t.slice(r),n.push(e(o)),new Function("obj","with(obj)return "+n.join("+"))}},,,,function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.validators=e.tmpl=e.template=e.signal=e.settings=e.router=e.objpaths=e.load=e.http=e.hsml=e.hsmlwidget=e.hsmlsvac=e.hsmlsvachtml=e.hsmlsvacctrl=e.hsmlidom=e.hsmlhtml=e.hsmlh=e.hsmldom=e.hsmlapp=e.history=e.hash=e.form=e.events=e.encode=e.dom=e.debounce=void 0;const n=s(6);e.debounce=n;const i=s(7);e.dom=i;const o=s(8);e.encode=o;const r=s(4);e.events=r;const a=s(9);e.form=a;const c=s(10);e.hash=c;const h=s(11);e.history=h;const l=s(12);e.hsmlapp=l;const u=s(13);e.hsmldom=u;const d=s(14);e.hsmlh=d;const m=s(5);e.hsmlhtml=m;const p=s(2);e.hsmlidom=p;const f=s(15);e.hsmlsvacctrl=f;const _=s(16);e.hsmlsvachtml=_;const g=s(17);e.hsmlsvac=g;const b=s(18);e.hsmlwidget=b;const y=s(0);e.hsml=y;const v=s(19);e.http=v;const j=s(20);e.load=j;const w=s(21);e.objpaths=w;const E=s(22);e.router=E;const x=s(23);e.settings=x;const C=s(24);e.signal=C;const S=s(25);e.template=S;const O=s(26);e.tmpl=O;const k=s(3);e.validators=k}])}));
2
2
  //# sourceMappingURL=index.js.map