@cat-of-summer/st-script 1.0.8 → 1.0.10

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.
Files changed (44) hide show
  1. package/README.md +56 -52
  2. package/dist/app/form.esm.min.js +1 -1
  3. package/dist/app/form.esm.min.js.map +3 -3
  4. package/dist/app/form.min.js +1 -2
  5. package/dist/app/form.min.js.map +3 -3
  6. package/dist/app.esm.min.js +1 -1
  7. package/dist/app.esm.min.js.map +3 -3
  8. package/dist/app.min.js +1 -2
  9. package/dist/app.min.js.map +3 -3
  10. package/dist/cookie.esm.min.js +1 -1
  11. package/dist/cookie.esm.min.js.map +2 -2
  12. package/dist/cookie.min.js +1 -2
  13. package/dist/cookie.min.js.map +2 -2
  14. package/dist/core.esm.min.js +1 -1
  15. package/dist/core.esm.min.js.map +3 -3
  16. package/dist/core.min.js +1 -2
  17. package/dist/core.min.js.map +3 -3
  18. package/dist/loader.esm.min.js +1 -1
  19. package/dist/loader.esm.min.js.map +3 -3
  20. package/dist/loader.min.js +1 -2
  21. package/dist/loader.min.js.map +3 -3
  22. package/dist/mask.min.js +0 -1
  23. package/dist/modal.esm.min.js +1 -1
  24. package/dist/modal.esm.min.js.map +3 -3
  25. package/dist/modal.min.js +1 -2
  26. package/dist/modal.min.js.map +3 -3
  27. package/dist/observer.min.js +0 -1
  28. package/dist/route.esm.min.js +1 -1
  29. package/dist/route.esm.min.js.map +3 -3
  30. package/dist/route.min.js +1 -2
  31. package/dist/route.min.js.map +3 -3
  32. package/dist/select.min.js +0 -1
  33. package/dist/st_button_widget.min.js +0 -1
  34. package/dist/st_links_widget.min.js +0 -1
  35. package/dist/toggle.min.js +0 -1
  36. package/dist/typograf.min.js +0 -1
  37. package/dist/uploader.min.js +0 -1
  38. package/dist/validator.min.js +0 -1
  39. package/package.json +1 -1
  40. package/src/app/index.js +246 -146
  41. package/src/cookie/index.js +9 -0
  42. package/src/core/index.js +18 -17
  43. package/src/modal/index.js +46 -7
  44. package/src/route/index.js +86 -3
@@ -1,2 +1,2 @@
1
- var n=class l{#t={};#l={};#s=[];#e=[];#u=!1;params={};query={};#r="";#h="";clone(t){return new l({...this.#t,...this.#l,...t,parent:this})}constructor(t){t={point:"/",name:"",match_all:!0,strict_mode:!0,before_init:()=>{},on_init:()=>{},...t};for(let[e,i]of Object.entries(t))typeof i=="function"?(this[e]=i.bind(this),this.#l[e]=i):this.#t[e]=i;this.before_init(this.#t),this.#e.push({prefix:this.#t.point,middlewares:[]}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.#c()):queueMicrotask(()=>this.#c()),this.on_init(this.#t)}#a(){return this.#e[this.#e.length-1]}prefix(t){let e=this.#a();return this.#e.push({prefix:"/"+this.#i(e.prefix)+"/"+this.#i(t)+"/",middlewares:[...e.middlewares]}),this}group(t){t(),this.#e.length>1&&this.#e.pop()}middleware(t){let e=this.#a();return e.middlewares=e.middlewares.concat(Array.isArray(t)?t:[t]),this}get(t,e,i={}){return this.#d(t,e,i)}#i(t){return String(t).replace(/^\/+|\/+$/g,"")}#d(t,e,i={}){if(typeof e!="function")throw new Error("Route: \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0437\u0430\u043C\u044B\u043A\u0430\u043D\u0438\u0435\u043C");typeof i=="string"&&(i={alias:i});let h=this.#a(),s=i.strict_mode??this.#t.strict_mode,r=s?("/"+this.#i(h.prefix)+"/"+this.#i(t)+"/").replace(/\/{2,}/g,"/"):(this.#i(h.prefix)+"/"+this.#i(t)).replace(/\/{2,}/g,"/");for(let o of this.#s)if(o.pattern===r)throw new Error(`Route: \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${r}`);let{regex:a,names:u}=this.#p(r);return this.#s.push({pattern:r,uri:t,alias:i.alias??null,closure:e,middlewares:h.middlewares,names:u,regex:a,strict_mode:s}),this}#p(t){let e=[],i=r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s="^"+t.replace(/\{(\w+)\}|\*|[^{*]+/g,(r,a)=>a!==void 0?(e.push(a),"([^/]+)"):r==="*"?(e.push("*"),"(.*)"):i(r)).replace(/\/+$/,"")+"/?$";return{regex:new RegExp(s),names:e}}#f(){return this.#t.name?"route:"+this.#t.name:"route"}#o(t){return"route:"+this.#t.name+":"+t}#n(t,e){document.dispatchEvent(new CustomEvent(t,{detail:e}))}#c(){if(!this.#u){this.#u=!0,this.#r=location.pathname,this.#h=location.href,this.query=Object.fromEntries(new URLSearchParams(location.search)),this.#n(this.#f(),{name:this.#t.name,path:this.#r,query:this.query,url:this.#h});for(let t of this.#s){let e=t.regex.exec(this.#r);if(!e)continue;let i=e.slice(1).map(l.#m);if(this.params={},t.names.forEach((s,r)=>{this.params[s]=i[r]}),t.middlewares.some(s=>!s.call(this,...i)))continue;t.closure.call(this,...i);let h={name:this.#t.name,pattern:t.pattern,uri:t.uri,alias:t.alias,params:this.params,values:i,query:this.query,path:this.#r,url:this.#h};if(t.alias&&this.#n(this.#o(t.alias),h),t.uri&&this.#n(this.#o(t.uri),h),!this.#t.match_all)break}}}get routes(){return this.#s}get path(){return this.#r}get url(){return this.#h}static#m(t){if(t==null)return t;try{return decodeURIComponent(t)}catch{return t}}};export{n as default};
1
+ var o=class u{#t={};#c={};#a=[];#r=[];#d=!1;params={};query={};#e="";#s="";clone(t){return new u({...this.#t,...this.#c,...t,parent:this})}constructor(t){t={point:"/",name:"",match_all:!0,strict_mode:!0,mode:"static",intercept_links:!0,before_init:()=>{},on_init:()=>{},not_found:()=>{},...t};for(let[e,r]of Object.entries(t))typeof r=="function"?(this[e]=r.bind(this),this.#c[e]=r):this.#t[e]=r;this.before_init(this.#t),this.#r.push({prefix:this.#t.point,middlewares:[]}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.#h()):queueMicrotask(()=>this.#h()),this.#l()&&(window.addEventListener(this.#t.mode==="hash"?"hashchange":"popstate",()=>this.#h()),this.#t.intercept_links&&document.addEventListener("click",e=>this.#f(e))),this.on_init(this.#t)}#l(){return this.#t.mode==="history"||this.#t.mode==="hash"}navigate(t,{replace:e=!1}={}){if(!this.#l()){location[e?"replace":"assign"](t);return}if(this.#t.mode==="hash"){let r="#"+String(t).replace(/^#/,"");if(r===location.hash)return this.#h();e?history.replaceState(history.state,"",r):history.pushState(history.state,"",r)}else history[e?"replaceState":"pushState"](null,"",t);this.#h()}#f(t){if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let e=t.target.closest?.("a[href]");if(!e||e.target&&e.target!=="_self"||e.hasAttribute("download")||/\bexternal\b/.test(e.rel))return;let r=e.getAttribute("href");if(this.#t.mode==="hash"){if(!r.startsWith("#"))return;t.preventDefault(),this.navigate(r);return}let i=new URL(e.href,location.href);i.origin===location.origin&&i.pathname.startsWith("/"+this.#i(this.#t.point))&&(i.pathname===location.pathname&&i.search===location.search&&i.hash||(t.preventDefault(),this.navigate(i.pathname+i.search+i.hash)))}#p(){if(this.#t.mode!=="hash")return{path:location.pathname,search:location.search};let t=location.hash.slice(1)||"/",e=t.indexOf("?");return e===-1?{path:t,search:""}:{path:t.slice(0,e)||"/",search:t.slice(e)}}#o(){return this.#r[this.#r.length-1]}prefix(t){let e=this.#o();return this.#r.push({prefix:"/"+this.#i(e.prefix)+"/"+this.#i(t)+"/",middlewares:[...e.middlewares]}),this}group(t){t(),this.#r.length>1&&this.#r.pop()}middleware(t){let e=this.#o();return e.middlewares=e.middlewares.concat(Array.isArray(t)?t:[t]),this}get(t,e,r={}){return this.#m(t,e,r)}#i(t){return String(t).replace(/^\/+|\/+$/g,"")}#m(t,e,r={}){if(typeof e!="function")throw new Error("Route: \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0437\u0430\u043C\u044B\u043A\u0430\u043D\u0438\u0435\u043C");typeof r=="string"&&(r={alias:r});let i=this.#o(),h=r.strict_mode??this.#t.strict_mode,s=h?("/"+this.#i(i.prefix)+"/"+this.#i(t)+"/").replace(/\/{2,}/g,"/"):(this.#i(i.prefix)+"/"+this.#i(t)).replace(/\/{2,}/g,"/");for(let l of this.#a)if(l.pattern===s)throw new Error(`Route: \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${s}`);let{regex:a,names:n}=this.#g(s);return this.#a.push({pattern:s,uri:t,alias:r.alias??null,closure:e,middlewares:i.middlewares,names:n,regex:a,strict_mode:h}),this}#g(t){let e=[],r=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h="^"+t.replace(/\{(\w+)\}|\*|[^{*]+/g,(s,a)=>a!==void 0?(e.push(a),"([^/]+)"):s==="*"?(e.push("*"),"(.*)"):r(s)).replace(/\/+$/,"")+"/?$";return{regex:new RegExp(h),names:e}}#y(){return this.#t.name?"route:"+this.#t.name:"route"}#u(t){return"route:"+this.#t.name+":"+t}#n(t,e){document.dispatchEvent(new CustomEvent(t,{detail:e}))}#h(){if(this.#d&&!this.#l())return;this.#d=!0;let{path:t,search:e}=this.#p();this.#e=t,this.#s=location.href,this.query=Object.fromEntries(new URLSearchParams(e)),this.params={};let r=!1;this.#n(this.#y(),{name:this.#t.name,path:this.#e,query:this.query,url:this.#s});for(let i of this.#a){let h=i.regex.exec(this.#e);if(!h)continue;let s=h.slice(1).map(u.#w);if(this.params={},i.names.forEach((n,l)=>{this.params[n]=s[l]}),i.middlewares.some(n=>!n.call(this,...s)))continue;r=!0,i.closure.call(this,...s);let a={name:this.#t.name,pattern:i.pattern,uri:i.uri,alias:i.alias,params:this.params,values:s,query:this.query,path:this.#e,url:this.#s};if(i.alias&&this.#n(this.#u(i.alias),a),i.uri&&this.#n(this.#u(i.uri),a),!this.#t.match_all)break}r||(this.not_found(this.#e),this.#n(this.#u("404"),{name:this.#t.name,path:this.#e,query:this.query,url:this.#s}))}get routes(){return this.#a}get path(){return this.#e}get url(){return this.#s}static#w(t){if(t==null)return t;try{return decodeURIComponent(t)}catch{return t}}};export{o as default};
2
2
  //# sourceMappingURL=route.esm.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/route/index.js"],
4
- "sourcesContent": ["export default class Route {\n\n #params = {};\n #methods = {};\n\n #routes = [];\n #stack = [];\n #dispatched = false;\n\n params = {};\n query = {};\n\n #path = '';\n #url = '';\n\n clone(params) {\n return new Route({\n ...this.#params,\n ...this.#methods,\n ...params,\n parent: this\n });\n }\n\n constructor(params) {\n params = {\n point: '/',\n name: '',\n match_all: true,\n strict_mode: true,\n\n before_init: () => {},\n on_init: () => {},\n\n ...params\n };\n\n for (let [key, value] of Object.entries(params))\n if (typeof value == \"function\") {\n this[key] = value.bind(this);\n\n this.#methods[key] = value;\n } else\n this.#params[key] = value;\n\n this.before_init(this.#params);\n\n this.#stack.push({ prefix: this.#params.point, middlewares: [] });\n\n if (document.readyState === 'loading')\n document.addEventListener('DOMContentLoaded', () => this.#dispatch());\n else\n queueMicrotask(() => this.#dispatch());\n\n this.on_init(this.#params);\n }\n\n #current() {\n return this.#stack[this.#stack.length - 1];\n }\n\n prefix(uri) {\n let parent = this.#current();\n\n this.#stack.push({\n prefix: '/' + this.#trim(parent.prefix) + '/' + this.#trim(uri) + '/',\n middlewares: [...parent.middlewares],\n });\n\n return this;\n }\n\n group(closure) {\n closure();\n\n if (this.#stack.length > 1) this.#stack.pop();\n }\n\n middleware(mids) {\n let parent = this.#current();\n\n parent.middlewares = parent.middlewares.concat(Array.isArray(mids) ? mids : [mids]);\n\n return this;\n }\n\n get(uri, closure, params = {}) {\n return this.#add_route(uri, closure, params);\n }\n\n #trim(uri) {\n return String(uri).replace(/^\\/+|\\/+$/g, '');\n }\n\n #add_route(uri, closure, params = {}) {\n if (typeof closure != 'function')\n throw new Error('Route: \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0437\u0430\u043C\u044B\u043A\u0430\u043D\u0438\u0435\u043C');\n\n if (typeof params == 'string') params = { alias: params };\n\n let base = this.#current();\n let strict = params.strict_mode ?? this.#params.strict_mode;\n\n let full = strict\n ? ('/' + this.#trim(base.prefix) + '/' + this.#trim(uri) + '/').replace(/\\/{2,}/g, '/')\n : (this.#trim(base.prefix) + '/' + this.#trim(uri)).replace(/\\/{2,}/g, '/');\n\n for (let route of this.#routes)\n if (route.pattern === full)\n throw new Error(`Route: \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${full}`);\n\n let { regex, names } = this.#compile(full);\n\n this.#routes.push({\n pattern: full,\n uri,\n alias: params.alias ?? null,\n closure,\n middlewares: base.middlewares,\n names,\n regex,\n strict_mode: strict,\n });\n\n return this;\n }\n\n #compile(pattern) {\n let names = [];\n let escape = s => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n let body = pattern.replace(/\\{(\\w+)\\}|\\*|[^{*]+/g, (token, name) => {\n if (name !== undefined) { names.push(name); return '([^/]+)'; }\n if (token === '*') { names.push('*'); return '(.*)'; }\n return escape(token);\n });\n\n let source = '^' + body.replace(/\\/+$/, '') + '/?$';\n\n return { regex: new RegExp(source), names };\n }\n\n #signal() {\n return this.#params.name ? 'route:' + this.#params.name : 'route';\n }\n\n #matchEvent(tail) {\n return 'route:' + this.#params.name + ':' + tail;\n }\n\n #emit(name, detail) {\n document.dispatchEvent(new CustomEvent(name, { detail }));\n }\n\n #dispatch() {\n if (this.#dispatched) return;\n this.#dispatched = true;\n\n this.#path = location.pathname;\n this.#url = location.href;\n this.query = Object.fromEntries(new URLSearchParams(location.search));\n\n this.#emit(this.#signal(), { name: this.#params.name, path: this.#path, query: this.query, url: this.#url });\n\n for (let route of this.#routes) {\n let m = route.regex.exec(this.#path);\n if (!m) continue;\n\n let values = m.slice(1).map(Route.#decode);\n\n this.params = {};\n route.names.forEach((name, i) => { this.params[name] = values[i]; });\n\n if (route.middlewares.some(mid => !mid.call(this, ...values)))\n continue;\n\n route.closure.call(this, ...values);\n\n let detail = {\n name: this.#params.name,\n pattern: route.pattern,\n uri: route.uri,\n alias: route.alias,\n params: this.params,\n values,\n query: this.query,\n path: this.#path,\n url: this.#url,\n };\n\n if (route.alias) this.#emit(this.#matchEvent(route.alias), detail);\n if (route.uri) this.#emit(this.#matchEvent(route.uri), detail);\n\n if (!this.#params.match_all) break;\n }\n }\n\n get routes() { return this.#routes; }\n\n get path() { return this.#path; }\n\n get url() { return this.#url; }\n\n static #decode(v) {\n if (v == null) return v;\n try { return decodeURIComponent(v); } catch { return v; }\n }\n}\n"],
5
- "mappings": "AAAA,IAAqBA,EAArB,MAAqBC,CAAM,CAEvBC,GAAU,CAAC,EACXC,GAAW,CAAC,EAEZC,GAAU,CAAC,EACXC,GAAS,CAAC,EACVC,GAAc,GAEd,OAAS,CAAC,EACV,MAAQ,CAAC,EAETC,GAAQ,GACRC,GAAO,GAEP,MAAMC,EAAQ,CACV,OAAO,IAAIR,EAAM,CACb,GAAG,KAAKC,GACR,GAAG,KAAKC,GACR,GAAGM,EACH,OAAQ,IACZ,CAAC,CACL,CAEA,YAAYA,EAAQ,CAChBA,EAAS,CACL,MAAO,IACP,KAAM,GACN,UAAW,GACX,YAAa,GAEb,YAAa,IAAM,CAAC,EACpB,QAAa,IAAM,CAAC,EAEpB,GAAGA,CACP,EAEA,OAAS,CAACC,EAAKC,CAAK,IAAK,OAAO,QAAQF,CAAM,EACtC,OAAOE,GAAS,YAChB,KAAKD,CAAG,EAAIC,EAAM,KAAK,IAAI,EAE3B,KAAKR,GAASO,CAAG,EAAIC,GAErB,KAAKT,GAAQQ,CAAG,EAAIC,EAE5B,KAAK,YAAY,KAAKT,EAAO,EAE7B,KAAKG,GAAO,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GAAI,CAAE,OAAO,mBAAmBA,CAAC,CAAG,MAAQ,CAAE,OAAOA,CAAG,CAC5D,CACJ",
6
- "names": ["Route", "_Route", "#params", "#methods", "#routes", "#stack", "#dispatched", "#path", "#url", "params", "key", "value", "#dispatch", "#current", "uri", "parent", "#trim", "closure", "mids", "#add_route", "base", "strict", "full", "route", "regex", "names", "#compile", "pattern", "escape", "s", "source", "token", "name", "#signal", "#matchEvent", "tail", "#emit", "detail", "m", "values", "#decode", "i", "mid", "v"]
4
+ "sourcesContent": ["export default class Route {\n\n #params = {};\n #methods = {};\n\n #routes = [];\n #stack = [];\n #dispatched = false;\n\n params = {};\n query = {};\n\n #path = '';\n #url = '';\n\n clone(params) {\n return new Route({\n ...this.#params,\n ...this.#methods,\n ...params,\n parent: this\n });\n }\n\n constructor(params) {\n params = {\n point: '/',\n name: '',\n match_all: true,\n strict_mode: true,\n\n // static \u2014 \u043E\u0434\u0438\u043D \u0440\u0430\u0437\u0431\u043E\u0440 \u0430\u0434\u0440\u0435\u0441\u0430 \u043F\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0435; history \u0438 hash \u2014 SPA:\n // navigate(), \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u044B \u043D\u0430\u0437\u0430\u0434/\u0432\u043F\u0435\u0440\u0451\u0434, \u043F\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0441\u0441\u044B\u043B\u043E\u043A.\n mode: 'static',\n intercept_links: true,\n\n before_init: () => {},\n on_init: () => {},\n not_found: () => {},\n\n ...params\n };\n\n for (let [key, value] of Object.entries(params))\n if (typeof value == \"function\") {\n this[key] = value.bind(this);\n\n this.#methods[key] = value;\n } else\n this.#params[key] = value;\n\n this.before_init(this.#params);\n\n this.#stack.push({ prefix: this.#params.point, middlewares: [] });\n\n if (document.readyState === 'loading')\n document.addEventListener('DOMContentLoaded', () => this.#dispatch());\n else\n queueMicrotask(() => this.#dispatch());\n\n if (this.#spa()) {\n window.addEventListener(this.#params.mode === 'hash' ? 'hashchange' : 'popstate', () => this.#dispatch());\n\n if (this.#params.intercept_links)\n document.addEventListener('click', e => this.#intercept(e));\n }\n\n this.on_init(this.#params);\n }\n\n #spa() {\n return this.#params.mode === 'history' || this.#params.mode === 'hash';\n }\n\n navigate(url, { replace = false } = {}) {\n if (!this.#spa()) {\n location[replace ? 'replace' : 'assign'](url);\n return;\n }\n\n if (this.#params.mode === 'hash') {\n let hash = '#' + String(url).replace(/^#/, '');\n if (hash === location.hash) return this.#dispatch();\n if (replace)\n history.replaceState(history.state, '', hash);\n else\n history.pushState(history.state, '', hash);\n } else\n history[replace ? 'replaceState' : 'pushState'](null, '', url);\n\n this.#dispatch();\n }\n\n #intercept(e) {\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n\n let link = e.target.closest?.('a[href]');\n if (!link || link.target && link.target !== '_self' || link.hasAttribute('download') || /\\bexternal\\b/.test(link.rel)) return;\n\n let raw = link.getAttribute('href');\n if (this.#params.mode === 'hash') {\n if (!raw.startsWith('#')) return;\n e.preventDefault();\n this.navigate(raw);\n return;\n }\n\n let url = new URL(link.href, location.href);\n if (url.origin !== location.origin) return;\n if (!url.pathname.startsWith('/' + this.#trim(this.#params.point))) return;\n if (url.pathname === location.pathname && url.search === location.search && url.hash) return;\n\n e.preventDefault();\n this.navigate(url.pathname + url.search + url.hash);\n }\n\n // \u0422\u0435\u043A\u0443\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441: \u0432 hash-\u0440\u0435\u0436\u0438\u043C\u0435 \u043F\u0443\u0442\u044C \u0438 query \u0436\u0438\u0432\u0443\u0442 \u043F\u043E\u0441\u043B\u0435 #.\n #read() {\n if (this.#params.mode !== 'hash')\n return { path: location.pathname, search: location.search };\n\n let hash = location.hash.slice(1) || '/';\n let index = hash.indexOf('?');\n\n return index === -1\n ? { path: hash, search: '' }\n : { path: hash.slice(0, index) || '/', search: hash.slice(index) };\n }\n\n #current() {\n return this.#stack[this.#stack.length - 1];\n }\n\n prefix(uri) {\n let parent = this.#current();\n\n this.#stack.push({\n prefix: '/' + this.#trim(parent.prefix) + '/' + this.#trim(uri) + '/',\n middlewares: [...parent.middlewares],\n });\n\n return this;\n }\n\n group(closure) {\n closure();\n\n if (this.#stack.length > 1) this.#stack.pop();\n }\n\n middleware(mids) {\n let parent = this.#current();\n\n parent.middlewares = parent.middlewares.concat(Array.isArray(mids) ? mids : [mids]);\n\n return this;\n }\n\n get(uri, closure, params = {}) {\n return this.#add_route(uri, closure, params);\n }\n\n #trim(uri) {\n return String(uri).replace(/^\\/+|\\/+$/g, '');\n }\n\n #add_route(uri, closure, params = {}) {\n if (typeof closure != 'function')\n throw new Error('Route: \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0437\u0430\u043C\u044B\u043A\u0430\u043D\u0438\u0435\u043C');\n\n if (typeof params == 'string') params = { alias: params };\n\n let base = this.#current();\n let strict = params.strict_mode ?? this.#params.strict_mode;\n\n let full = strict\n ? ('/' + this.#trim(base.prefix) + '/' + this.#trim(uri) + '/').replace(/\\/{2,}/g, '/')\n : (this.#trim(base.prefix) + '/' + this.#trim(uri)).replace(/\\/{2,}/g, '/');\n\n for (let route of this.#routes)\n if (route.pattern === full)\n throw new Error(`Route: \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${full}`);\n\n let { regex, names } = this.#compile(full);\n\n this.#routes.push({\n pattern: full,\n uri,\n alias: params.alias ?? null,\n closure,\n middlewares: base.middlewares,\n names,\n regex,\n strict_mode: strict,\n });\n\n return this;\n }\n\n #compile(pattern) {\n let names = [];\n let escape = s => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n let body = pattern.replace(/\\{(\\w+)\\}|\\*|[^{*]+/g, (token, name) => {\n if (name !== undefined) { names.push(name); return '([^/]+)'; }\n if (token === '*') { names.push('*'); return '(.*)'; }\n return escape(token);\n });\n\n let source = '^' + body.replace(/\\/+$/, '') + '/?$';\n\n return { regex: new RegExp(source), names };\n }\n\n #signal() {\n return this.#params.name ? 'route:' + this.#params.name : 'route';\n }\n\n #matchEvent(tail) {\n return 'route:' + this.#params.name + ':' + tail;\n }\n\n #emit(name, detail) {\n document.dispatchEvent(new CustomEvent(name, { detail }));\n }\n\n #dispatch() {\n if (this.#dispatched && !this.#spa()) return;\n this.#dispatched = true;\n\n let { path, search } = this.#read();\n\n this.#path = path;\n this.#url = location.href;\n this.query = Object.fromEntries(new URLSearchParams(search));\n this.params = {};\n\n let matched = false;\n\n this.#emit(this.#signal(), { name: this.#params.name, path: this.#path, query: this.query, url: this.#url });\n\n for (let route of this.#routes) {\n let m = route.regex.exec(this.#path);\n if (!m) continue;\n\n let values = m.slice(1).map(Route.#decode);\n\n this.params = {};\n route.names.forEach((name, i) => { this.params[name] = values[i]; });\n\n if (route.middlewares.some(mid => !mid.call(this, ...values)))\n continue;\n\n matched = true;\n route.closure.call(this, ...values);\n\n let detail = {\n name: this.#params.name,\n pattern: route.pattern,\n uri: route.uri,\n alias: route.alias,\n params: this.params,\n values,\n query: this.query,\n path: this.#path,\n url: this.#url,\n };\n\n if (route.alias) this.#emit(this.#matchEvent(route.alias), detail);\n if (route.uri) this.#emit(this.#matchEvent(route.uri), detail);\n\n if (!this.#params.match_all) break;\n }\n\n if (!matched) {\n this.not_found(this.#path);\n this.#emit(this.#matchEvent('404'), { name: this.#params.name, path: this.#path, query: this.query, url: this.#url });\n }\n }\n\n get routes() { return this.#routes; }\n\n get path() { return this.#path; }\n\n get url() { return this.#url; }\n\n static #decode(v) {\n if (v == null) return v;\n try { return decodeURIComponent(v); } catch { return v; }\n }\n}\n"],
5
+ "mappings": "AAAA,IAAqBA,EAArB,MAAqBC,CAAM,CAEvBC,GAAU,CAAC,EACXC,GAAW,CAAC,EAEZC,GAAU,CAAC,EACXC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ACjC,CAEK+C,IACD,KAAK,UAAU,KAAK1C,EAAK,EACzB,KAAKsC,GAAM,KAAKF,GAAY,KAAK,EAAG,CAAE,KAAM,KAAKzC,GAAQ,KAAM,KAAM,KAAKK,GAAO,MAAO,KAAK,MAAO,IAAK,KAAKC,EAAK,CAAC,EAE5H,CAEA,IAAI,QAAS,CAAE,OAAO,KAAKJ,EAAS,CAEpC,IAAI,MAAO,CAAE,OAAO,KAAKG,EAAO,CAEhC,IAAI,KAAM,CAAE,OAAO,KAAKC,EAAM,CAE9B,MAAO4C,GAAQG,EAAG,CACd,GAAIA,GAAK,KAAM,OAAOA,EACtB,GAAI,CAAE,OAAO,mBAAmBA,CAAC,CAAG,MAAQ,CAAE,OAAOA,CAAG,CAC5D,CACJ",
6
+ "names": ["Route", "_Route", "#params", "#methods", "#routes", "#stack", "#dispatched", "#path", "#url", "params", "key", "value", "#dispatch", "#spa", "#intercept", "url", "replace", "hash", "e", "link", "raw", "#trim", "#read", "index", "#current", "uri", "parent", "closure", "mids", "#add_route", "base", "strict", "full", "route", "regex", "names", "#compile", "pattern", "escape", "source", "token", "name", "#signal", "#matchEvent", "tail", "#emit", "detail", "path", "search", "matched", "m", "values", "#decode", "i", "mid", "v"]
7
7
  }
package/dist/route.min.js CHANGED
@@ -1,3 +1,2 @@
1
- var Route=(()=>{var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var m=(h,t)=>{for(var e in t)u(h,e,{get:t[e],enumerable:!0})},g=(h,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!f.call(h,r)&&r!==e&&u(h,r,{get:()=>t[r],enumerable:!(i=d(t,r))||i.enumerable});return h};var w=h=>g(u({},"__esModule",{value:!0}),h);var y={};m(y,{default:()=>l});var l=class h{#t={};#l={};#s=[];#e=[];#u=!1;params={};query={};#r="";#h="";clone(t){return new h({...this.#t,...this.#l,...t,parent:this})}constructor(t){t={point:"/",name:"",match_all:!0,strict_mode:!0,before_init:()=>{},on_init:()=>{},...t};for(let[e,i]of Object.entries(t))typeof i=="function"?(this[e]=i.bind(this),this.#l[e]=i):this.#t[e]=i;this.before_init(this.#t),this.#e.push({prefix:this.#t.point,middlewares:[]}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.#c()):queueMicrotask(()=>this.#c()),this.on_init(this.#t)}#a(){return this.#e[this.#e.length-1]}prefix(t){let e=this.#a();return this.#e.push({prefix:"/"+this.#i(e.prefix)+"/"+this.#i(t)+"/",middlewares:[...e.middlewares]}),this}group(t){t(),this.#e.length>1&&this.#e.pop()}middleware(t){let e=this.#a();return e.middlewares=e.middlewares.concat(Array.isArray(t)?t:[t]),this}get(t,e,i={}){return this.#d(t,e,i)}#i(t){return String(t).replace(/^\/+|\/+$/g,"")}#d(t,e,i={}){if(typeof e!="function")throw new Error("Route: \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0437\u0430\u043C\u044B\u043A\u0430\u043D\u0438\u0435\u043C");typeof i=="string"&&(i={alias:i});let r=this.#a(),a=i.strict_mode??this.#t.strict_mode,s=a?("/"+this.#i(r.prefix)+"/"+this.#i(t)+"/").replace(/\/{2,}/g,"/"):(this.#i(r.prefix)+"/"+this.#i(t)).replace(/\/{2,}/g,"/");for(let c of this.#s)if(c.pattern===s)throw new Error(`Route: \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${s}`);let{regex:n,names:o}=this.#p(s);return this.#s.push({pattern:s,uri:t,alias:i.alias??null,closure:e,middlewares:r.middlewares,names:o,regex:n,strict_mode:a}),this}#p(t){let e=[],i=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a="^"+t.replace(/\{(\w+)\}|\*|[^{*]+/g,(s,n)=>n!==void 0?(e.push(n),"([^/]+)"):s==="*"?(e.push("*"),"(.*)"):i(s)).replace(/\/+$/,"")+"/?$";return{regex:new RegExp(a),names:e}}#f(){return this.#t.name?"route:"+this.#t.name:"route"}#o(t){return"route:"+this.#t.name+":"+t}#n(t,e){document.dispatchEvent(new CustomEvent(t,{detail:e}))}#c(){if(!this.#u){this.#u=!0,this.#r=location.pathname,this.#h=location.href,this.query=Object.fromEntries(new URLSearchParams(location.search)),this.#n(this.#f(),{name:this.#t.name,path:this.#r,query:this.query,url:this.#h});for(let t of this.#s){let e=t.regex.exec(this.#r);if(!e)continue;let i=e.slice(1).map(h.#m);if(this.params={},t.names.forEach((a,s)=>{this.params[a]=i[s]}),t.middlewares.some(a=>!a.call(this,...i)))continue;t.closure.call(this,...i);let r={name:this.#t.name,pattern:t.pattern,uri:t.uri,alias:t.alias,params:this.params,values:i,query:this.query,path:this.#r,url:this.#h};if(t.alias&&this.#n(this.#o(t.alias),r),t.uri&&this.#n(this.#o(t.uri),r),!this.#t.match_all)break}}}get routes(){return this.#s}get path(){return this.#r}get url(){return this.#h}static#m(t){if(t==null)return t;try{return decodeURIComponent(t)}catch{return t}}};return w(y);})();
1
+ var Route=(()=>{var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(h,t)=>{for(var e in t)c(h,e,{get:t[e],enumerable:!0})},g=(h,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of f(t))!p.call(h,i)&&i!==e&&c(h,i,{get:()=>t[i],enumerable:!(r=d(t,i))||r.enumerable});return h};var y=h=>g(c({},"__esModule",{value:!0}),h);var w={};m(w,{default:()=>o});var o=class h{#t={};#c={};#a=[];#r=[];#d=!1;params={};query={};#e="";#s="";clone(t){return new h({...this.#t,...this.#c,...t,parent:this})}constructor(t){t={point:"/",name:"",match_all:!0,strict_mode:!0,mode:"static",intercept_links:!0,before_init:()=>{},on_init:()=>{},not_found:()=>{},...t};for(let[e,r]of Object.entries(t))typeof r=="function"?(this[e]=r.bind(this),this.#c[e]=r):this.#t[e]=r;this.before_init(this.#t),this.#r.push({prefix:this.#t.point,middlewares:[]}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.#h()):queueMicrotask(()=>this.#h()),this.#l()&&(window.addEventListener(this.#t.mode==="hash"?"hashchange":"popstate",()=>this.#h()),this.#t.intercept_links&&document.addEventListener("click",e=>this.#f(e))),this.on_init(this.#t)}#l(){return this.#t.mode==="history"||this.#t.mode==="hash"}navigate(t,{replace:e=!1}={}){if(!this.#l()){location[e?"replace":"assign"](t);return}if(this.#t.mode==="hash"){let r="#"+String(t).replace(/^#/,"");if(r===location.hash)return this.#h();e?history.replaceState(history.state,"",r):history.pushState(history.state,"",r)}else history[e?"replaceState":"pushState"](null,"",t);this.#h()}#f(t){if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let e=t.target.closest?.("a[href]");if(!e||e.target&&e.target!=="_self"||e.hasAttribute("download")||/\bexternal\b/.test(e.rel))return;let r=e.getAttribute("href");if(this.#t.mode==="hash"){if(!r.startsWith("#"))return;t.preventDefault(),this.navigate(r);return}let i=new URL(e.href,location.href);i.origin===location.origin&&i.pathname.startsWith("/"+this.#i(this.#t.point))&&(i.pathname===location.pathname&&i.search===location.search&&i.hash||(t.preventDefault(),this.navigate(i.pathname+i.search+i.hash)))}#p(){if(this.#t.mode!=="hash")return{path:location.pathname,search:location.search};let t=location.hash.slice(1)||"/",e=t.indexOf("?");return e===-1?{path:t,search:""}:{path:t.slice(0,e)||"/",search:t.slice(e)}}#o(){return this.#r[this.#r.length-1]}prefix(t){let e=this.#o();return this.#r.push({prefix:"/"+this.#i(e.prefix)+"/"+this.#i(t)+"/",middlewares:[...e.middlewares]}),this}group(t){t(),this.#r.length>1&&this.#r.pop()}middleware(t){let e=this.#o();return e.middlewares=e.middlewares.concat(Array.isArray(t)?t:[t]),this}get(t,e,r={}){return this.#m(t,e,r)}#i(t){return String(t).replace(/^\/+|\/+$/g,"")}#m(t,e,r={}){if(typeof e!="function")throw new Error("Route: \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0437\u0430\u043C\u044B\u043A\u0430\u043D\u0438\u0435\u043C");typeof r=="string"&&(r={alias:r});let i=this.#o(),a=r.strict_mode??this.#t.strict_mode,s=a?("/"+this.#i(i.prefix)+"/"+this.#i(t)+"/").replace(/\/{2,}/g,"/"):(this.#i(i.prefix)+"/"+this.#i(t)).replace(/\/{2,}/g,"/");for(let u of this.#a)if(u.pattern===s)throw new Error(`Route: \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${s}`);let{regex:n,names:l}=this.#g(s);return this.#a.push({pattern:s,uri:t,alias:r.alias??null,closure:e,middlewares:i.middlewares,names:l,regex:n,strict_mode:a}),this}#g(t){let e=[],r=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a="^"+t.replace(/\{(\w+)\}|\*|[^{*]+/g,(s,n)=>n!==void 0?(e.push(n),"([^/]+)"):s==="*"?(e.push("*"),"(.*)"):r(s)).replace(/\/+$/,"")+"/?$";return{regex:new RegExp(a),names:e}}#y(){return this.#t.name?"route:"+this.#t.name:"route"}#u(t){return"route:"+this.#t.name+":"+t}#n(t,e){document.dispatchEvent(new CustomEvent(t,{detail:e}))}#h(){if(this.#d&&!this.#l())return;this.#d=!0;let{path:t,search:e}=this.#p();this.#e=t,this.#s=location.href,this.query=Object.fromEntries(new URLSearchParams(e)),this.params={};let r=!1;this.#n(this.#y(),{name:this.#t.name,path:this.#e,query:this.query,url:this.#s});for(let i of this.#a){let a=i.regex.exec(this.#e);if(!a)continue;let s=a.slice(1).map(h.#w);if(this.params={},i.names.forEach((l,u)=>{this.params[l]=s[u]}),i.middlewares.some(l=>!l.call(this,...s)))continue;r=!0,i.closure.call(this,...s);let n={name:this.#t.name,pattern:i.pattern,uri:i.uri,alias:i.alias,params:this.params,values:s,query:this.query,path:this.#e,url:this.#s};if(i.alias&&this.#n(this.#u(i.alias),n),i.uri&&this.#n(this.#u(i.uri),n),!this.#t.match_all)break}r||(this.not_found(this.#e),this.#n(this.#u("404"),{name:this.#t.name,path:this.#e,query:this.query,url:this.#s}))}get routes(){return this.#a}get path(){return this.#e}get url(){return this.#s}static#w(t){if(t==null)return t;try{return decodeURIComponent(t)}catch{return t}}};return y(w);})();
2
2
  if(typeof Route!=="undefined"&&Route&&Route.default)globalThis.Route=Route.default;
3
- //# sourceMappingURL=route.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/route/index.js"],
4
- "sourcesContent": ["export default class Route {\n\n #params = {};\n #methods = {};\n\n #routes = [];\n #stack = [];\n #dispatched = false;\n\n params = {};\n query = {};\n\n #path = '';\n #url = '';\n\n clone(params) {\n return new Route({\n ...this.#params,\n ...this.#methods,\n ...params,\n parent: this\n });\n }\n\n constructor(params) {\n params = {\n point: '/',\n name: '',\n match_all: true,\n strict_mode: true,\n\n before_init: () => {},\n on_init: () => {},\n\n ...params\n };\n\n for (let [key, value] of Object.entries(params))\n if (typeof value == \"function\") {\n this[key] = value.bind(this);\n\n this.#methods[key] = value;\n } else\n this.#params[key] = value;\n\n this.before_init(this.#params);\n\n this.#stack.push({ prefix: this.#params.point, middlewares: [] });\n\n if (document.readyState === 'loading')\n document.addEventListener('DOMContentLoaded', () => this.#dispatch());\n else\n queueMicrotask(() => this.#dispatch());\n\n this.on_init(this.#params);\n }\n\n #current() {\n return this.#stack[this.#stack.length - 1];\n }\n\n prefix(uri) {\n let parent = this.#current();\n\n this.#stack.push({\n prefix: '/' + this.#trim(parent.prefix) + '/' + this.#trim(uri) + '/',\n middlewares: [...parent.middlewares],\n });\n\n return this;\n }\n\n group(closure) {\n closure();\n\n if (this.#stack.length > 1) this.#stack.pop();\n }\n\n middleware(mids) {\n let parent = this.#current();\n\n parent.middlewares = parent.middlewares.concat(Array.isArray(mids) ? mids : [mids]);\n\n return this;\n }\n\n get(uri, closure, params = {}) {\n return this.#add_route(uri, closure, params);\n }\n\n #trim(uri) {\n return String(uri).replace(/^\\/+|\\/+$/g, '');\n }\n\n #add_route(uri, closure, params = {}) {\n if (typeof closure != 'function')\n throw new Error('Route: \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0437\u0430\u043C\u044B\u043A\u0430\u043D\u0438\u0435\u043C');\n\n if (typeof params == 'string') params = { alias: params };\n\n let base = this.#current();\n let strict = params.strict_mode ?? this.#params.strict_mode;\n\n let full = strict\n ? ('/' + this.#trim(base.prefix) + '/' + this.#trim(uri) + '/').replace(/\\/{2,}/g, '/')\n : (this.#trim(base.prefix) + '/' + this.#trim(uri)).replace(/\\/{2,}/g, '/');\n\n for (let route of this.#routes)\n if (route.pattern === full)\n throw new Error(`Route: \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${full}`);\n\n let { regex, names } = this.#compile(full);\n\n this.#routes.push({\n pattern: full,\n uri,\n alias: params.alias ?? null,\n closure,\n middlewares: base.middlewares,\n names,\n regex,\n strict_mode: strict,\n });\n\n return this;\n }\n\n #compile(pattern) {\n let names = [];\n let escape = s => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n let body = pattern.replace(/\\{(\\w+)\\}|\\*|[^{*]+/g, (token, name) => {\n if (name !== undefined) { names.push(name); return '([^/]+)'; }\n if (token === '*') { names.push('*'); return '(.*)'; }\n return escape(token);\n });\n\n let source = '^' + body.replace(/\\/+$/, '') + '/?$';\n\n return { regex: new RegExp(source), names };\n }\n\n #signal() {\n return this.#params.name ? 'route:' + this.#params.name : 'route';\n }\n\n #matchEvent(tail) {\n return 'route:' + this.#params.name + ':' + tail;\n }\n\n #emit(name, detail) {\n document.dispatchEvent(new CustomEvent(name, { detail }));\n }\n\n #dispatch() {\n if (this.#dispatched) return;\n this.#dispatched = true;\n\n this.#path = location.pathname;\n this.#url = location.href;\n this.query = Object.fromEntries(new URLSearchParams(location.search));\n\n this.#emit(this.#signal(), { name: this.#params.name, path: this.#path, query: this.query, url: this.#url });\n\n for (let route of this.#routes) {\n let m = route.regex.exec(this.#path);\n if (!m) continue;\n\n let values = m.slice(1).map(Route.#decode);\n\n this.params = {};\n route.names.forEach((name, i) => { this.params[name] = values[i]; });\n\n if (route.middlewares.some(mid => !mid.call(this, ...values)))\n continue;\n\n route.closure.call(this, ...values);\n\n let detail = {\n name: this.#params.name,\n pattern: route.pattern,\n uri: route.uri,\n alias: route.alias,\n params: this.params,\n values,\n query: this.query,\n path: this.#path,\n url: this.#url,\n };\n\n if (route.alias) this.#emit(this.#matchEvent(route.alias), detail);\n if (route.uri) this.#emit(this.#matchEvent(route.uri), detail);\n\n if (!this.#params.match_all) break;\n }\n }\n\n get routes() { return this.#routes; }\n\n get path() { return this.#path; }\n\n get url() { return this.#url; }\n\n static #decode(v) {\n if (v == null) return v;\n try { return decodeURIComponent(v); } catch { return v; }\n }\n}\n"],
5
- "mappings": "4aAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,IAAqBA,EAArB,MAAqBC,CAAM,CAEvBC,GAAU,CAAC,EACXC,GAAW,CAAC,EAEZC,GAAU,CAAC,EACXC,GAAS,CAAC,EACVC,GAAc,GAEd,OAAS,CAAC,EACV,MAAQ,CAAC,EAETC,GAAQ,GACRC,GAAO,GAEP,MAAMC,EAAQ,CACV,OAAO,IAAIR,EAAM,CACb,GAAG,KAAKC,GACR,GAAG,KAAKC,GACR,GAAGM,EACH,OAAQ,IACZ,CAAC,CACL,CAEA,YAAYA,EAAQ,CAChBA,EAAS,CACL,MAAO,IACP,KAAM,GACN,UAAW,GACX,YAAa,GAEb,YAAa,IAAM,CAAC,EACpB,QAAa,IAAM,CAA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AAGa,CAAM,EAE3D,CAAC,KAAKlC,GAAQ,UAAW,KACjC,EACJ,CAEA,IAAI,QAAS,CAAE,OAAO,KAAKE,EAAS,CAEpC,IAAI,MAAO,CAAE,OAAO,KAAKG,EAAO,CAEhC,IAAI,KAAM,CAAE,OAAO,KAAKC,EAAM,CAE9B,MAAO+B,GAAQG,EAAG,CACd,GAAIA,GAAK,KAAM,OAAOA,EACtB,GAAI,CAAE,OAAO,mBAAmBA,CAAC,CAAG,MAAQ,CAAE,OAAOA,CAAG,CAC5D,CACJ",
6
- "names": ["index_exports", "__export", "Route", "_Route", "#params", "#methods", "#routes", "#stack", "#dispatched", "#path", "#url", "params", "key", "value", "#dispatch", "#current", "uri", "parent", "#trim", "closure", "mids", "#add_route", "base", "strict", "full", "route", "regex", "names", "#compile", "pattern", "escape", "source", "token", "name", "#signal", "#matchEvent", "tail", "#emit", "detail", "m", "values", "#decode", "i", "mid", "v"]
4
+ "sourcesContent": ["export default class Route {\n\n #params = {};\n #methods = {};\n\n #routes = [];\n #stack = [];\n #dispatched = false;\n\n params = {};\n query = {};\n\n #path = '';\n #url = '';\n\n clone(params) {\n return new Route({\n ...this.#params,\n ...this.#methods,\n ...params,\n parent: this\n });\n }\n\n constructor(params) {\n params = {\n point: '/',\n name: '',\n match_all: true,\n strict_mode: true,\n\n // static \u2014 \u043E\u0434\u0438\u043D \u0440\u0430\u0437\u0431\u043E\u0440 \u0430\u0434\u0440\u0435\u0441\u0430 \u043F\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0435; history \u0438 hash \u2014 SPA:\n // navigate(), \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u044B \u043D\u0430\u0437\u0430\u0434/\u0432\u043F\u0435\u0440\u0451\u0434, \u043F\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0441\u0441\u044B\u043B\u043E\u043A.\n mode: 'static',\n intercept_links: true,\n\n before_init: () => {},\n on_init: () => {},\n not_found: () => {},\n\n ...params\n };\n\n for (let [key, value] of Object.entries(params))\n if (typeof value == \"function\") {\n this[key] = value.bind(this);\n\n this.#methods[key] = value;\n } else\n this.#params[key] = value;\n\n this.before_init(this.#params);\n\n this.#stack.push({ prefix: this.#params.point, middlewares: [] });\n\n if (document.readyState === 'loading')\n document.addEventListener('DOMContentLoaded', () => this.#dispatch());\n else\n queueMicrotask(() => this.#dispatch());\n\n if (this.#spa()) {\n window.addEventListener(this.#params.mode === 'hash' ? 'hashchange' : 'popstate', () => this.#dispatch());\n\n if (this.#params.intercept_links)\n document.addEventListener('click', e => this.#intercept(e));\n }\n\n this.on_init(this.#params);\n }\n\n #spa() {\n return this.#params.mode === 'history' || this.#params.mode === 'hash';\n }\n\n navigate(url, { replace = false } = {}) {\n if (!this.#spa()) {\n location[replace ? 'replace' : 'assign'](url);\n return;\n }\n\n if (this.#params.mode === 'hash') {\n let hash = '#' + String(url).replace(/^#/, '');\n if (hash === location.hash) return this.#dispatch();\n if (replace)\n history.replaceState(history.state, '', hash);\n else\n history.pushState(history.state, '', hash);\n } else\n history[replace ? 'replaceState' : 'pushState'](null, '', url);\n\n this.#dispatch();\n }\n\n #intercept(e) {\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n\n let link = e.target.closest?.('a[href]');\n if (!link || link.target && link.target !== '_self' || link.hasAttribute('download') || /\\bexternal\\b/.test(link.rel)) return;\n\n let raw = link.getAttribute('href');\n if (this.#params.mode === 'hash') {\n if (!raw.startsWith('#')) return;\n e.preventDefault();\n this.navigate(raw);\n return;\n }\n\n let url = new URL(link.href, location.href);\n if (url.origin !== location.origin) return;\n if (!url.pathname.startsWith('/' + this.#trim(this.#params.point))) return;\n if (url.pathname === location.pathname && url.search === location.search && url.hash) return;\n\n e.preventDefault();\n this.navigate(url.pathname + url.search + url.hash);\n }\n\n // \u0422\u0435\u043A\u0443\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441: \u0432 hash-\u0440\u0435\u0436\u0438\u043C\u0435 \u043F\u0443\u0442\u044C \u0438 query \u0436\u0438\u0432\u0443\u0442 \u043F\u043E\u0441\u043B\u0435 #.\n #read() {\n if (this.#params.mode !== 'hash')\n return { path: location.pathname, search: location.search };\n\n let hash = location.hash.slice(1) || '/';\n let index = hash.indexOf('?');\n\n return index === -1\n ? { path: hash, search: '' }\n : { path: hash.slice(0, index) || '/', search: hash.slice(index) };\n }\n\n #current() {\n return this.#stack[this.#stack.length - 1];\n }\n\n prefix(uri) {\n let parent = this.#current();\n\n this.#stack.push({\n prefix: '/' + this.#trim(parent.prefix) + '/' + this.#trim(uri) + '/',\n middlewares: [...parent.middlewares],\n });\n\n return this;\n }\n\n group(closure) {\n closure();\n\n if (this.#stack.length > 1) this.#stack.pop();\n }\n\n middleware(mids) {\n let parent = this.#current();\n\n parent.middlewares = parent.middlewares.concat(Array.isArray(mids) ? mids : [mids]);\n\n return this;\n }\n\n get(uri, closure, params = {}) {\n return this.#add_route(uri, closure, params);\n }\n\n #trim(uri) {\n return String(uri).replace(/^\\/+|\\/+$/g, '');\n }\n\n #add_route(uri, closure, params = {}) {\n if (typeof closure != 'function')\n throw new Error('Route: \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0437\u0430\u043C\u044B\u043A\u0430\u043D\u0438\u0435\u043C');\n\n if (typeof params == 'string') params = { alias: params };\n\n let base = this.#current();\n let strict = params.strict_mode ?? this.#params.strict_mode;\n\n let full = strict\n ? ('/' + this.#trim(base.prefix) + '/' + this.#trim(uri) + '/').replace(/\\/{2,}/g, '/')\n : (this.#trim(base.prefix) + '/' + this.#trim(uri)).replace(/\\/{2,}/g, '/');\n\n for (let route of this.#routes)\n if (route.pattern === full)\n throw new Error(`Route: \u0434\u0443\u0431\u043B\u0438\u043A\u0430\u0442 \u043C\u0430\u0440\u0448\u0440\u0443\u0442\u0430: ${full}`);\n\n let { regex, names } = this.#compile(full);\n\n this.#routes.push({\n pattern: full,\n uri,\n alias: params.alias ?? null,\n closure,\n middlewares: base.middlewares,\n names,\n regex,\n strict_mode: strict,\n });\n\n return this;\n }\n\n #compile(pattern) {\n let names = [];\n let escape = s => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n let body = pattern.replace(/\\{(\\w+)\\}|\\*|[^{*]+/g, (token, name) => {\n if (name !== undefined) { names.push(name); return '([^/]+)'; }\n if (token === '*') { names.push('*'); return '(.*)'; }\n return escape(token);\n });\n\n let source = '^' + body.replace(/\\/+$/, '') + '/?$';\n\n return { regex: new RegExp(source), names };\n }\n\n #signal() {\n return this.#params.name ? 'route:' + this.#params.name : 'route';\n }\n\n #matchEvent(tail) {\n return 'route:' + this.#params.name + ':' + tail;\n }\n\n #emit(name, detail) {\n document.dispatchEvent(new CustomEvent(name, { detail }));\n }\n\n #dispatch() {\n if (this.#dispatched && !this.#spa()) return;\n this.#dispatched = true;\n\n let { path, search } = this.#read();\n\n this.#path = path;\n this.#url = location.href;\n this.query = Object.fromEntries(new URLSearchParams(search));\n this.params = {};\n\n let matched = false;\n\n this.#emit(this.#signal(), { name: this.#params.name, path: this.#path, query: this.query, url: this.#url });\n\n for (let route of this.#routes) {\n let m = route.regex.exec(this.#path);\n if (!m) continue;\n\n let values = m.slice(1).map(Route.#decode);\n\n this.params = {};\n route.names.forEach((name, i) => { this.params[name] = values[i]; });\n\n if (route.middlewares.some(mid => !mid.call(this, ...values)))\n continue;\n\n matched = true;\n route.closure.call(this, ...values);\n\n let detail = {\n name: this.#params.name,\n pattern: route.pattern,\n uri: route.uri,\n alias: route.alias,\n params: this.params,\n values,\n query: this.query,\n path: this.#path,\n url: this.#url,\n };\n\n if (route.alias) this.#emit(this.#matchEvent(route.alias), detail);\n if (route.uri) this.#emit(this.#matchEvent(route.uri), detail);\n\n if (!this.#params.match_all) break;\n }\n\n if (!matched) {\n this.not_found(this.#path);\n this.#emit(this.#matchEvent('404'), { name: this.#params.name, path: this.#path, query: this.query, url: this.#url });\n }\n }\n\n get routes() { return this.#routes; }\n\n get path() { return this.#path; }\n\n get url() { return this.#url; }\n\n static #decode(v) {\n if (v == null) return v;\n try { return decodeURIComponent(v); } catch { return v; }\n }\n}\n"],
5
+ "mappings": "4aAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,IAAqBA,EAArB,MAAqBC,CAAM,CAEvBC,GAAU,CAAC,EACXC,GAAW,CAAC,EAEZC,GAAU,CAAC,EACXC,GAAS,CAAC,EACVC,GAAc,GAEd,OAAS,CAAC,EACV,MAAQ,CAAC,EAETC,GAAQ,GACRC,GAAO,GAEP,MAAMC,EAAQ,CACV,OAAO,IAAIR,EAAM,CACb,GAAG,KAAKC,GACR,GAAG,KAAKC,GACR,GAAGM,EACH,OAAQ,IACZ,CAAC,CACL,CAEA,YAAYA,EAAQ,CAChBA,EAAS,CACL,MAAO,IACP,KAAM,GACN,UAAW,GACX,YAAa,GAIb,KAAM,SACN,gBAAiB,GAEjB,YAAa,IAAM,CAAC,EACpB,QAAa,IAAM,CAAC,EACpB,UAAa,IAAM,CAAC,EAEpB,GAAGA,CACP,EAEA,OAAS,CAACC,EAAKC,CAAK,IAAK,OAAO,QAAQF,CAAM,EACtC,OAAOE,GAAS,YAChB,KAAKD,CAAG,EAAIC,EAAM,KAAK,IAAI,EAE3B,KAAKR,GAASO,CAAG,EAAIC,GAErB,KAAKT,GAAQQ,CAAG,EAAIC,EAE5B,KAAK,YAAY,KAAKT,EAAO,EAE7B,KAAKG,GAAO,KAAK,CAAE,OAAQ,KAAKH,GAAQ,MAAO,YAAa,CAAC,CAAE,CAAC,EAE5D,SAAS,aAAe,UACxB,SAAS,iBAAiB,mBAAoB,IAAM,KAAKU,GAAU,CAAC,EAEpE,eAAe,IAAM,KAAKA,GAAU,CAAC,EAErC,KAAKC,GAAK,IACV,OAAO,iBAAiB,KAAKX,GAAQ,OAAS,OAAS,aAAe,WAAY,IAAM,KAAKU,GAAU,C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f,IAAKA,EAAM,IACX,MAAOA,EAAM,MACb,OAAQ,KAAK,OACb,OAAAkB,EACA,MAAO,KAAK,MACZ,KAAM,KAAK5C,GACX,IAAK,KAAKC,EACd,EAKA,GAHIyB,EAAM,OAAO,KAAKY,GAAM,KAAKF,GAAYV,EAAM,KAAK,EAAGa,CAAM,EAC7Db,EAAM,KAAO,KAAKY,GAAM,KAAKF,GAAYV,EAAM,GAAG,EAAGa,CAAM,EAE3D,CAAC,KAAK5C,GAAQ,UAAW,KACjC,CAEK+C,IACD,KAAK,UAAU,KAAK1C,EAAK,EACzB,KAAKsC,GAAM,KAAKF,GAAY,KAAK,EAAG,CAAE,KAAM,KAAKzC,GAAQ,KAAM,KAAM,KAAKK,GAAO,MAAO,KAAK,MAAO,IAAK,KAAKC,EAAK,CAAC,EAE5H,CAEA,IAAI,QAAS,CAAE,OAAO,KAAKJ,EAAS,CAEpC,IAAI,MAAO,CAAE,OAAO,KAAKG,EAAO,CAEhC,IAAI,KAAM,CAAE,OAAO,KAAKC,EAAM,CAE9B,MAAO4C,GAAQG,EAAG,CACd,GAAIA,GAAK,KAAM,OAAOA,EACtB,GAAI,CAAE,OAAO,mBAAmBA,CAAC,CAAG,MAAQ,CAAE,OAAOA,CAAG,CAC5D,CACJ",
6
+ "names": ["index_exports", "__export", "Route", "_Route", "#params", "#methods", "#routes", "#stack", "#dispatched", "#path", "#url", "params", "key", "value", "#dispatch", "#spa", "#intercept", "url", "replace", "hash", "e", "link", "raw", "#trim", "#read", "index", "#current", "uri", "parent", "closure", "mids", "#add_route", "base", "strict", "full", "route", "regex", "names", "#compile", "pattern", "escape", "source", "token", "name", "#signal", "#matchEvent", "tail", "#emit", "detail", "path", "search", "matched", "m", "values", "#decode", "i", "mid", "v"]
7
7
  }
@@ -1,3 +1,2 @@
1
1
  var Select=(()=>{var u=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var m=(i,t)=>{for(var e in t)u(i,e,{get:t[e],enumerable:!0})},_=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of g(t))!b.call(i,o)&&o!==e&&u(i,o,{get:()=>t[o],enumerable:!(n=p(t,o))||n.enumerable});return i};var y=i=>_(u({},"__esModule",{value:!0}),i);var x={};m(x,{default:()=>a});var h=Symbol(),v=Symbol(),E=i=>{try{return i instanceof Element?i:document.querySelector(i)}catch{return}},l=i=>{if(i==null)return[];if(i instanceof Element)return[i];if(i instanceof NodeList||i instanceof HTMLCollection)return[...i];if(Array.isArray(i))return i.flatMap(l);try{return[...document.querySelectorAll(i)]}catch{return[]}},d=i=>E(i)?.[h],c=(i,t)=>(i&&(i[h]=t),i),f=(i,t)=>{if(!i)return i;let e=i[v]??=new Set;for(let[n,o]of Object.entries(t)){if(n in i&&!e.has(n)){console.warn(`\u0418\u043C\u044F "${n}" \u0443\u0436\u0435 \u0437\u0430\u043D\u044F\u0442\u043E \u043D\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0435 \u2014 \u043C\u0435\u0442\u043E\u0434 \u043D\u0435 \u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D`,i);continue}Object.defineProperty(i,n,{value:o,writable:!0,configurable:!0,enumerable:!1}),e.add(n)}return i};var a=class i{#t={};#n={};#o=new WeakMap;static find=d;get params(){return this.#t}get value(){return l(this.#t.target).map(t=>t.multiple?[...t.selectedOptions].map(e=>e.value):t.value)}clone(t){return new i({...this.#t,...this.#n,...t,parent:this})}constructor(t){t={target:"select",location:"bottom center",action:"click",duration:0,allow_interrupt:!1,close_on_select:!0,close_on_outside:!0,before_open:()=>{},on_open:()=>{},before_close:()=>{},on_close:()=>{},before_change:()=>{},on_change:()=>{},before_init:()=>{},on_init:()=>{},...t};for(let[e,n]of Object.entries(t))typeof n=="function"&&e!="target"?(this[e]=n.bind(this),this.#n[e]=n):this.#t[e]=n;this.before_init(this.#t);for(let e of l(this.#t.target))this.#l(e);this.on_init(this.#t)}#r(t){let e=(this.#t.location||"").toLowerCase().split(/\s+/);Object.assign(t.style,{position:"absolute",top:e.includes("top")?"auto":"100%",bottom:e.includes("top")?"100%":"auto",left:e.includes("right")?"auto":e.includes("center")?"50%":"0",right:e.includes("right")?"0":"auto",transform:e.includes("center")&&!e.includes("right")?"translateX(-50%)":"none"})}#l(t){c(t,this),f(t,{open:()=>this.open(t),close:()=>this.close(t),toggle:()=>this.toggle(t)});let e=document.createElement("select-container");c(e,this),Object.assign(e.style,{position:"relative",display:"inline-block"});let n=document.createElement("select-trigger");c(n,this),Object.assign(n.style,{display:"block",cursor:"pointer"});let o=document.createElement("select-options");c(o,this),Object.assign(o.style,{transition:`all ${this.#t.duration}s`}),this.#r(o),Object.assign(t.style,{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)"}),t.parentNode.insertBefore(e,t),e.append(n,t,o),e.setAttribute("state","closed");for(let s of[...t.options]){let r=document.createElement("select-option");c(r,this),r.textContent=s.textContent,r.style.cursor="pointer",s.disabled&&r.setAttribute("disabled",""),r.toggleAttribute("selected",s.selected),r.addEventListener("click",()=>{s.disabled||this.#c(e,t,s,r)}),o.append(r)}this.#s(t,n),this.#t.action=="hover"?(e.addEventListener("mouseenter",()=>this.open(e)),e.addEventListener("mouseleave",()=>this.close(e))):n.addEventListener(this.#t.action,()=>this.toggle(e)),this.#t.close_on_outside&&document.addEventListener("click",s=>{e.contains(s.target)||this.close(e)})}#c(t,e,n,o){this.before_change(n,e)!==!1&&(e.multiple?(n.selected=!n.selected,o.toggleAttribute("selected",n.selected)):(e.value=n.value,[...t.querySelectorAll("select-option")].forEach(s=>s.toggleAttribute("selected",s===o))),e.dispatchEvent(new Event("change",{bubbles:!0})),this.#s(e,t.querySelector("select-trigger")),this.on_change(n,e),!e.multiple&&this.#t.close_on_select&&this.close(t))}#s(t,e){t.multiple?e.textContent=[...t.selectedOptions].map(n=>n.textContent).join(", "):e.textContent=(t.selectedOptions[0]??t.options[0])?.textContent??""}#a(t,e,n,o,s){o(t),clearTimeout(this.#o.get(t)),requestAnimationFrame(()=>{t.setAttribute("state",e),requestAnimationFrame(()=>{this.#o.set(t,setTimeout(()=>(t.setAttribute("state",n),s(t)),this.#t.duration*1e3))})})}#e(t,e){let n=t.getAttribute("state")??"closed",o=this.#t.allow_interrupt;(e?n=="closed"||o&&n=="closing":n=="open"||o&&n=="opening")&&this.#a(t,e?"opening":"closing",e?"open":"closed",e?this.before_open:this.before_close,e?this.on_open:this.on_close)}open(t){l(t).map(this.#i).forEach(e=>e&&this.#e(e,!0))}close(t){l(t).map(this.#i).forEach(e=>e&&this.#e(e,!1))}toggle(t){l(t).map(this.#i).forEach(e=>{e&&this.#e(e,!["open","opening"].includes(e.getAttribute("state")))})}#i=t=>t?.closest?.("select-container")??(t?.tagName?.toLowerCase()=="select"?t.parentElement:null)};return y(x);})();
2
2
  if(typeof Select!=="undefined"&&Select&&Select.default)globalThis.Select=Select.default;
3
- //# sourceMappingURL=select.min.js.map
@@ -1,3 +1,2 @@
1
1
  var st_button_widget=(()=>{var u=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var H=(o,i)=>{for(var s in i)u(o,s,{get:i[s],enumerable:!0})},M=(o,i,s,c)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of x(i))!A.call(o,d)&&d!==s&&u(o,d,{get:()=>i[d],enumerable:!(c=L(i,d))||c.enumerable});return o};var T=o=>M(u({},"__esModule",{value:!0}),o);var S={};H(S,{default:()=>k});var g=class o{static DEFAULT_ICONS={arrow:'<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"><style type="text/css">.st0{fill:#77B3D4;}.st1{opacity:0.2;}.st2{fill:#231F20;}.st3{fill:#FFFFFF;}</style><g id="Layer_1"><g><circle class="st0" cx="32" cy="32" r="32"/></g><g class="st1"><path class="st2" d="M49.5,33.9L35.3,15.7c-1.8-2.3-4.7-2.3-6.5,0L14.5,33.9c-1.8,2.3-1,4.1,1.7,4.1H24v12c0,2.2,1.8,4,4,4h8c2.2,0,4-1.8,4-4V38h7.8C50.6,38,51.3,36.1,49.5,33.9z"/></g><g><path class="st3" d="M40,48c0,2.2-1.8,4-4,4h-8c-2.2,0-4-1.8-4-4V24c0-2.2,1.8-4,4-4h8c2.2,0,4,1.8,4,4V48z"/></g><g><path class="st3" d="M16.2,36c-2.7,0-3.5-1.9-1.7-4.1l14.3-18.1c1.8-2.3,4.7-2.3,6.5,0l14.3,18.1c1.8,2.3,1,4.1-1.7,4.1H16.2z"/></g></g><g id="Layer_2"></g></svg>'};static#u={settings:{position:"bottom-right"},condition:{name:"scroll",options:{hiding_type:"opacity",transition:"0.3s",attribute:[],margin_top:Math.min(window.innerHeight,document.documentElement.clientHeight),margin_left:void 0,margin_right:void 0,margin_bottom:void 0}},action:{name:"scroll",options:{selector:void 0,hiding_type:"opacity",setAttribute:void 0,removeAttribute:void 0,toggleAttribute:void 0,top:0,left:void 0,behavior:"smooth",hook:function(){}}},widget_container:{id:void 0,class:void 0,style:{}},widget:{id:void 0,class:void 0,style:{}},button_container:{id:void 0,class:void 0,style:{}},button:{src:o.DEFAULT_ICONS.arrow}};static#c={widget_container:{position:"fixed",width:"60px",height:"60px",margin:"30px"},widget:{position:"absolute"},button_container:{display:"flex","justify-content":"center","align-items":"center",overflow:"hidden",width:"60px",height:"60px","border-radius":"50%",cursor:"pointer"},button:{width:"100%",height:"100%","object-fit":"cover"}};static#g(...i){function s(d,t){function n(e,r,a){if(typeof r[e]=="object")for(let h in r[e])a[e]||(a[e]={}),n(h,r[e],a[e]);else a[e]=r[e]}for(let e in d)n(e,d,t)}let c={};for(let d of i)s(d,c);return c}static#f(i){let s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",c="";for(let d=0;d<i;d++)c+=s.charAt(Math.floor(Math.random()*s.length));return c}static#d={opacity:"0",visibility:"hidden",display:"none"};#s="st_"+o.#f(16);#r=this.#s+"_wc";#l=this.#s+"_w";#a=this.#s+"_bc";#h=this.#s+"_b";#i=document.createElement("style");#o=document.createElement("div");#n=document.createElement("div");#t=document.createElement("div");#p(i,s,c){new RegExp(i+"{.*?"+s+":.*?;.*?}").test(this.#i.innerHTML)?this.#i.innerHTML=this.#i.innerHTML.replace(new RegExp("("+i+"{.*?"+s+":).*?(;.*?})"),"$1"+c+"$2"):new RegExp(i+"{.*?}").test(this.#i.innerHTML)?this.#i.innerHTML=this.#i.innerHTML.replace(new RegExp("("+i+"{.*?)(})"),"$1"+s+":"+c+";$2"):this.#i.innerHTML+=i+"{"+s+":"+c+";}"}#e(i,s){for(let c in s)this.#p(i,c,s[c])}constructor(i){function s(n,e,r=!1){return{show:function(){n.style.removeProperty(e)},hide:function(){n.style.setProperty(e,r?"unset":o.#d[e])}}}function c(n){switch(n){case"top-left":return{top:"0",left:"0"};case"top-right":return{top:"0",right:"0"};case"bottom-left":return{bottom:"0",left:"0"};case"bottom-right":default:return{bottom:"0",right:"0"}}}function d(n){return n?typeof n=="object"?[n[0]??"st_active",n[1]??"",n[2]??""]:[n??"st_active","",""]:null}let t=o.#g(o.#u,i);if(this.#e("."+this.#r,o.#c.widget_container),this.#e("."+this.#l,o.#c.widget),this.#e("."+this.#a,o.#c.button_container),this.#e("."+this.#h,o.#c.button),this.#e("."+this.#r,c(t.settings.position)),this.#e("."+this.#l,c(t.settings.position)),this.#o.classList.add(this.#r),this.#e("."+this.#r,t.widget_container.style),t.widget_container.class&&this.#o.classList.add(t.widget_container.class),t.widget_container.id&&(this.#o.id=t.widget_container.id),this.#n.classList.add(this.#l),this.#e("."+this.#l,t.widget.style),t.widget.class&&this.#n.classList.add(t.widget.class),t.widget.id&&(this.#n.id=t.widget.id),this.#t.classList.add(this.#a),this.#e("."+this.#a,t.button_container.style),t.button_container.class&&this.#t.classList.add(t.button_container.class),t.button_container.id&&(this.#t.id=t.button_container.id),t.condition){let n=function(a,h){let l=d(h);return{set:function(){l&&(l[1]?a.setAttribute(l[0],l[1]):a.setAttribute(l[0],""))},remove:function(){l&&(l[1]?l[2]?a.setAttribute(l[0],l[2]):a.setAttribute(l[0],""):a.removeAttribute(l[0]))}}};if(!t.condition.options.hiding_type in o.#d)return;let e=s(this.#n,t.condition.options.hiding_type),r=n(this.#n,t.condition.options.attribute);switch(e.hide(),r.remove(),t.condition.name){case"hover":this.#o.addEventListener("mouseenter",function(){e.show(),r.set()}),this.#o.addEventListener("mouseleave",function(){e.hide(),r.remove()});break;case"scroll":default:let a=Math.min(window.innerHeight,document.documentElement.clientHeight),h=Math.min(window.innerWidth,document.documentElement.clientWidth),l=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),m=Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth),w=t.condition.options.margin_top,_=t.condition.options.margin_bottom,b=t.condition.options.margin_right,y=t.condition.options.margin_left;window.addEventListener("scroll",function(){let f=window.pageYOffset||window.scrollY||document.documentElement.scrollTop,E=f+a,p=window.pageXOffset||window.scrollX||document.documentElement.scrollLeft,v=p+h;f>w||E<l-_||v<m-b||p>y?(e.show(),r.set()):(e.hide(),r.remove())});break}t.condition.options.transition&&this.#n.style.setProperty("transition",t.condition.options.transition)}if(t.action)switch(t.action.name){case"show_popup":if(!t.action.options.selector||!t.action.options.hiding_type in o.#d)return;this.#t.addEventListener("click",function(){for(let n of document.querySelectorAll(t.action.options.selector)){let e=s(n,t.action.options.hiding_type,!0);if(n.style[o.#d[t.action.options.hiding_type]]?e.show():e.hide(),t.action.options.setAttribute){let r=d(t.action.options.setAttribute);n.setAttribute(r[0],r[1])}t.action.options.removeAttribute&&n.removeAttribute(t.action.options.removeAttribute),t.action.options.toggleAttribute&&n.toggleAttribute(t.action.options.toggleAttribute)}});break;case"function":this.#t.addEventListener("click",t.action.options.hook);break;case"scroll":default:this.#t.addEventListener("click",function(){window.scrollTo({top:t.action.options.top,left:t.action.options.left,behavior:t.action.options.behavior})});break}new RegExp("^<svg.*?</svg>$").test(t.button.src)?this.#t.innerHTML=t.button.src:this.#t.innerHTML="<img src="+t.button.src+' alt="icon">',this.#t.childNodes[0].classList.add(this.#h),this.#i.setAttribute("widget",this.#s),document.head.appendChild(this.#i),this.#n.appendChild(this.#t),this.#o.appendChild(this.#n),document.querySelector("body").appendChild(this.#o)}},k=g;return T(S);})();
2
2
  if(typeof st_button_widget!=="undefined"&&st_button_widget&&st_button_widget.default)globalThis.st_button_widget=st_button_widget.default;
3
- //# sourceMappingURL=st_button_widget.min.js.map
@@ -1,3 +1,2 @@
1
1
  var st_links_widget=(()=>{var f=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var b=(o,e)=>{for(var n in e)f(o,n,{get:e[n],enumerable:!0})},k=(o,e,n,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of x(e))!E.call(o,t)&&t!==n&&f(o,t,{get:()=>e[t],enumerable:!(l=v(e,t))||l.enumerable});return o};var M=o=>k(f({},"__esModule",{value:!0}),o);var F={};b(F,{default:()=>H});var u=class o{static DEFAULT_ICONS={link:'<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><g id="chain"><circle cx="16" cy="16" fill="#33d9b2" r="16" style="fill: rgb(119, 179, 212);"></circle><g fill="#fff" fill-rule="evenodd"><path d="m16.75 10h-7.5a.5.5 0 0 0 -.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5v-7.5a.5.5 0 0 0 -1 0v7h-11v-11h7a.5.5 0 0 0 0-1z" fill="#fff" style="fill: rgb(255, 255, 255);"></path><path d="m21.543 9.5-6.643 6.646a.5.5 0 0 0 .708.707l6.646-6.646v1.793a.5.5 0 0 0 1 0v-3a.5.5 0 0 0 -.5-.5h-3a.5.5 0 0 0 0 1z" fill="#fff" style="fill: rgb(255, 255, 255);"></path></g></g></svg>',email:'<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"><style type="text/css">.st0{fill:#77B3D4;}.st1{opacity:0.2;}.st2{fill:#231F20;}.st3{fill:#E0E0D1;}.st4{fill:#FFFFFF;}</style><g id="Layer_1"><g><circle class="st0" cx="32" cy="32" r="32"/></g><g><g class="st1"><path class="st2" d="M52,44c0,2.2-1.8,4-4,4H16c-2.2,0-4-1.8-4-4V24c0-2.2,1.8-4,4-4h32c2.2,0,4,1.8,4,4V44z"/></g><g><path class="st3" d="M52,42c0,2.2-1.8,4-4,4H16c-2.2,0-4-1.8-4-4V22c0-2.2,1.8-4,4-4h32c2.2,0,4,1.8,4,4V42z"/></g><g class="st1"><g><path class="st2" d="M35.5,30.2c-1.9-2.1-5.1-2.1-7,0L13,43.2c-0.2,0.2-0.3,0.4-0.5,0.6c0.7,1.3,2,2.2,3.4,2.2h32c1.5,0,2.7-0.9,3.4-2.2c-0.1-0.2-0.3-0.4-0.5-0.6L35.5,30.2z"/></g></g><g><g><path class="st3" d="M35.5,32c-1.9-1.9-5.1-1.9-7,0L13,43.5c-0.2,0.2-0.3,0.3-0.5,0.5c0.7,1.2,2,1.9,3.4,1.9h32c1.5,0,2.7-0.8,3.4-1.9c-0.1-0.2-0.3-0.3-0.5-0.5L35.5,32z"/></g></g><g class="st1"><g><path class="st2" d="M12.6,20.2c0.7-1.3,2-2.2,3.4-2.2h32c1.5,0,2.7,0.9,3.4,2.2c-0.1,0.2-0.3,0.4-0.5,0.6l-15.4,13c-1.9,2.1-5.1,2.1-7,0L12.6,20.2z"/></g></g><g><g><path class="st4" d="M28.5,32c1.9,1.9,5.1,1.9,7,0L51,20.5c0.2-0.2,0.3-0.3,0.5-0.5c-0.7-1.2-2-1.9-3.4-1.9H16c-1.5,0-2.7,0.8-3.4,1.9c0.1,0.2,0.3,0.3,0.5,0.5L28.5,32z"/></g></g></g></g><g id="Layer_2"></g></svg>',telegram:'<svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"><g><path d="M128,0 C57.307,0 0,57.307 0,128 L0,128 C0,198.693 57.307,256 128,256 L128,256 C198.693,256 256,198.693 256,128 L256,128 C256,57.307 198.693,0 128,0 L128,0 Z" fill="#40B3E0"></path><path d="M190.2826,73.6308 L167.4206,188.8978 C167.4206,188.8978 164.2236,196.8918 155.4306,193.0548 L102.6726,152.6068 L83.4886,143.3348 L51.1946,132.4628 C51.1946,132.4628 46.2386,130.7048 45.7586,126.8678 C45.2796,123.0308 51.3546,120.9528 51.3546,120.9528 L179.7306,70.5928 C179.7306,70.5928 190.2826,65.9568 190.2826,73.6308" fill="#FFFFFF"></path><path d="M98.6178,187.6035 C98.6178,187.6035 97.0778,187.4595 95.1588,181.3835 C93.2408,175.3085 83.4888,143.3345 83.4888,143.3345 L161.0258,94.0945 C161.0258,94.0945 165.5028,91.3765 165.3428,94.0945 C165.3428,94.0945 166.1418,94.5735 163.7438,96.8115 C161.3458,99.0505 102.8328,151.6475 102.8328,151.6475" fill="#D2E5F1"></path><path d="M122.9015,168.1154 L102.0335,187.1414 C102.0335,187.1414 100.4025,188.3794 98.6175,187.6034 L102.6135,152.2624" fill="#B5CFE4"></path></g></svg>',whatsapp:'<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>Whatsapp-color</title><desc>Created with Sketch.</desc><defs></defs><g id="Icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="Color-" transform="translate(-700.000000, -360.000000)" fill="#67C15E"><path d="M723.993033,360 C710.762252,360 700,370.765287 700,383.999801 C700,389.248451 701.692661,394.116025 704.570026,398.066947 L701.579605,406.983798 L710.804449,404.035539 C714.598605,406.546975 719.126434,408 724.006967,408 C737.237748,408 748,397.234315 748,384.000199 C748,370.765685 737.237748,360.000398 724.006967,360.000398 L723.993033,360.000398 L723.993033,360 Z M717.29285,372.190836 C716.827488,371.07628 716.474784,371.034071 715.769774,371.005401 C715.529728,370.991464 715.262214,370.977527 714.96564,370.977527 C714.04845,370.977527 713.089462,371.245514 712.511043,371.838033 C711.806033,372.557577 710.056843,374.23638 710.056843,377.679202 C710.056843,381.122023 712.567571,384.451756 712.905944,384.917648 C713.258648,385.382743 717.800808,392.55031 724.853297,395.471492 C730.368379,397.757149 732.00491,397.545307 733.260074,397.27732 C735.093658,396.882308 737.393002,395.527239 737.971421,393.891043 C738.54984,392.25405 738.54984,390.857171 738.380255,390.560912 C738.211068,390.264652 737.745308,390.095816 737.040298,389.742615 C736.335288,389.389811 732.90737,387.696673 732.25849,387.470894 C731.623543,387.231179 731.017259,387.315995 730.537963,387.99333 C729.860819,388.938653 729.198006,389.89831 728.661785,390.476494 C728.238619,390.928051 727.547144,390.984595 726.969123,390.744481 C726.193254,390.420348 724.021298,389.657798 721.340985,387.273388 C719.267356,385.42535 717.856938,383.125756 717.448104,382.434484 C717.038871,381.729275 717.405907,381.319529 717.729948,380.938852 C718.082653,380.501232 718.421026,380.191036 718.77373,379.781688 C719.126434,379.372738 719.323884,379.160897 719.549599,378.681068 C719.789645,378.215575 719.62006,377.735746 719.450874,377.382942 C719.281687,377.030139 717.871269,373.587317 717.29285,372.190836 Z" id="Whatsapp"></path></g></g></svg>'};static#h={settings:{position:"bottom-right"},condition:{name:"scroll",options:{hiding_type:"opacity",transition:"0.3s",attribute:[],margin_top:Math.min(window.innerHeight,document.documentElement.clientHeight),margin_left:void 0,margin_right:void 0,margin_bottom:void 0}},widget_container:{id:void 0,class:void 0,style:{}},widget:{id:void 0,class:void 0,style:{}},links_container:{id:void 0,class:void 0,style:{}},links:{0:{href:"undefined",src:o.DEFAULT_ICONS.link,id:void 0,class:void 0,style:{}}}};static#o={widget_container:{position:"fixed",width:"60px",height:"60px",margin:"30px"},widget:{position:"absolute",display:"flex","flex-direction":"column",gap:"15px"},links_container:{display:"flex","justify-content":"center","align-items":"center",overflow:"hidden",width:"60px",height:"60px","border-radius":"50%",cursor:"pointer"},link:{width:"100%",height:"100%","object-fit":"cover"}};static#g(...e){function n(t,s){function i(c,r,a){if(typeof r[c]=="object")for(let g in r[c])a[c]||(a[c]={}),i(g,r[c],a[c]);else a[c]=r[c]}for(let c in t)i(c,t,s)}let l={};for(let t of e)n(t,l);return l}static#f(e){let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",l="";for(let t=0;t<e;t++)l+=n.charAt(Math.floor(Math.random()*n.length));return l}static#r={opacity:"0",visibility:"hidden",display:"none"};#s="st_"+o.#f(16);#l=this.#s+"_wc";#c=this.#s+"_w";#d=this.#s+"_ic";#a=this.#s+"_i";#i=document.createElement("style");#e=document.createElement("div");#n=document.createElement("div");#u(e,n,l){new RegExp(e+"{.*?"+n+":.*?;.*?}").test(this.#i.innerHTML)?this.#i.innerHTML=this.#i.innerHTML.replace(new RegExp("("+e+"{.*?"+n+":).*?(;.*?})"),"$1"+l+"$2"):new RegExp(e+"{.*?}").test(this.#i.innerHTML)?this.#i.innerHTML=this.#i.innerHTML.replace(new RegExp("("+e+"{.*?)(})"),"$1"+n+":"+l+";$2"):this.#i.innerHTML+=e+"{"+n+":"+l+";}"}#t(e,n){for(let l in n)this.#u(e,l,n[l])}constructor(e){function n(s,i,c=!1){return{show:function(){s.style.removeProperty(i)},hide:function(){s.style.setProperty(i,c?"unset":o.#r[i])}}}function l(s){switch(s){case"top-left":return{top:"0",left:"0"};case"top-right":return{top:"0",right:"0"};case"bottom-left":return{bottom:"0",left:"0"};case"bottom-right":default:return{bottom:"0",right:"0"}}}let t=o.#g(o.#h,e);if(this.#t("."+this.#l,o.#o.widget_container),this.#t("."+this.#c,o.#o.widget),this.#t("."+this.#d,o.#o.links_container),this.#t("."+this.#a,o.#o.link),this.#t("."+this.#l,l(t.settings.position)),this.#t("."+this.#c,l(t.settings.position)),this.#t("."+this.#d,t.links_container.style),this.#n.classList.add(this.#l),this.#t("."+this.#l,t.widget_container.style),t.widget_container.class&&this.#n.classList.add(t.widget_container.class),t.widget_container.id&&(this.#n.id=t.widget_container.id),this.#e.classList.add(this.#c),this.#t("."+this.#c,t.widget.style),t.widget.class&&this.#e.classList.add(t.widget.class),t.widget.id&&(this.#e.id=t.widget.id),t.condition){let s=function(r,a){function g(h){return h?typeof h=="object"?[h[0]??"st_active",h[1]??"",h[2]??""]:[h??"st_active","",""]:null}let d=g(a);return{set:function(){d&&(d[1]?r.setAttribute(d[0],d[1]):r.setAttribute(d[0],""))},remove:function(){d&&(d[1]?d[2]?r.setAttribute(d[0],d[2]):r.setAttribute(d[0],""):r.removeAttribute(d[0]))}}};if(!t.condition.options.hiding_type in o.#r)return;let i=n(this.#e,t.condition.options.hiding_type),c=s(this.#e,t.condition.options.attribute);switch(i.hide(),c.remove(),t.condition.name){case"hover":this.#n.addEventListener("mouseenter",function(){i.show(),c.set()}),this.#n.addEventListener("mouseleave",function(){i.hide(),c.remove()});break;case"scroll":default:let r=Math.min(window.innerHeight,document.documentElement.clientHeight),a=Math.min(window.innerWidth,document.documentElement.clientWidth),g=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),d=Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth),h=t.condition.options.margin_top,w=t.condition.options.margin_bottom,_=t.condition.options.margin_right,C=t.condition.options.margin_left;window.addEventListener("scroll",function(){let p=window.pageYOffset||window.scrollY||document.documentElement.scrollTop,y=p+r,m=window.pageXOffset||window.scrollX||document.documentElement.scrollLeft,L=m+a;p>h||y<g-w||L<d-_||m>C?(i.show(),c.set()):(i.hide(),c.remove())});break}t.condition.options.transition&&this.#e.style.setProperty("transition",t.condition.options.transition)}for(let s in t.links){let i=document.createElement("a");i.classList.add(this.#d),t.links_container.class&&i.classList.add(t.links_container.class),t.links[s].class&&i.classList.add(t.links[s].class),t.links[s].id&&(i.id=t.links[s].id,this.#t("#"+t.links[s].id,t.links[s].style)),i.setAttribute("href",t.links[s].href),i.setAttribute("target","_blank"),i.setAttribute("rel","nofollow noopener noreferrer"),new RegExp("^<svg.*?</svg>$").test(t.links[s].src)?i.innerHTML=t.links[s].src:i.innerHTML="<img src="+t.links[s].src+' alt="icon">',i.childNodes[0].classList.add(this.#a),this.#e.appendChild(i)}this.#i.setAttribute("widget",this.#s),document.head.appendChild(this.#i),this.#n.appendChild(this.#e),document.querySelector("body").appendChild(this.#n)}},H=u;return M(F);})();
2
2
  if(typeof st_links_widget!=="undefined"&&st_links_widget&&st_links_widget.default)globalThis.st_links_widget=st_links_widget.default;
3
- //# sourceMappingURL=st_links_widget.min.js.map
@@ -1,3 +1,2 @@
1
1
  var Toggle=(()=>{var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var m=(s,t)=>{for(var i in t)d(s,i,{get:t[i],enumerable:!0})},w=(s,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _(t))!E.call(s,a)&&a!==i&&d(s,a,{get:()=>t[a],enumerable:!(e=y(t,a))||e.enumerable});return s};var A=s=>w(d({},"__esModule",{value:!0}),s);var S={};m(S,{default:()=>l});var v=Symbol(),k=Symbol(),x=s=>{try{return s instanceof Element?s:document.querySelector(s)}catch{return}},h=s=>{if(s==null)return[];if(s instanceof Element)return[s];if(s instanceof NodeList||s instanceof HTMLCollection)return[...s];if(Array.isArray(s))return s.flatMap(h);try{return[...document.querySelectorAll(s)]}catch{return[]}},b=s=>x(s)?.[v],p=(s,t)=>(s&&(s[v]=t),s),g=(s,t)=>{if(!s)return s;let i=s[k]??=new Set;for(let[e,a]of Object.entries(t)){if(e in s&&!i.has(e)){console.warn(`\u0418\u043C\u044F "${e}" \u0443\u0436\u0435 \u0437\u0430\u043D\u044F\u0442\u043E \u043D\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0435 \u2014 \u043C\u0435\u0442\u043E\u0434 \u043D\u0435 \u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D`,s);continue}Object.defineProperty(s,e,{value:a,writable:!0,configurable:!0,enumerable:!1}),i.add(e)}return s};var l=class s{#t={};#a={};#n=new WeakMap;#r=new Map;#o=[];#e=null;static find=b;get params(){return this.#t}clone(t){return new s({...this.#t,...this.#a,...t,parent:this})}constructor(t){t={duration:0,trigger:"[trigger]",target:null,allow_interrupt:!1,action:"click",anchor:!1,keep_history:!1,group:!1,before_activate:()=>{},on_activate:()=>{},before_deactivate:()=>{},on_deactivate:()=>{},before_activated:()=>{},on_activated:()=>{},before_deactivated:()=>{},on_deactivated:()=>{},before_init:()=>{},on_init:()=>{},...t},t.keep_history&&(t.anchor=!0);for(let[e,a]of Object.entries(t))typeof a=="function"&&e!="target"?(this[e]=a.bind(this),this.#a[e]=a):this.#t[e]=a;this.before_init(this.#t);let i=e=>e.hasAttribute("state")||e.setAttribute("state","inactive");for(let e of h(this.#t.trigger)){p(e,this),this.#o.push(e),g(e,{toggle:()=>this.toggle(e),activate:()=>this.activate(e),deactivate:()=>this.deactivate(e)}),i(e),this.#s(e).forEach(i);let a=this.#h(e);a&&this.#r.set(a,e),this.#t.action=="hover"?(e.addEventListener("mouseenter",()=>this.activate(e)),e.addEventListener("mouseleave",()=>this.deactivate(e))):e.addEventListener(this.#t.action,()=>this.toggle(e))}this.#t.anchor&&(this.#c(),this.#t.keep_history&&window.addEventListener("hashchange",()=>this.#c())),this.on_init(this.#t)}#s(t){let i=this.#t.target;return typeof i=="function"&&(i=i(t)),i??=t.getAttribute("target"),h(i)}#h(t){if(!this.#t.anchor)return null;if(t.id)return t.id;let i=this.#s(t);return i.length===1&&i[0].id?i[0].id:null}#u(t){let i="#"+t;location.hash!==i&&(this.#t.keep_history?history.pushState(null,"",i):history.replaceState(null,"",i))}#f(){if(!location.hash)return;let t=location.pathname+location.search;this.#t.keep_history?history.pushState(null,"",t):history.replaceState(null,"",t)}#c(){let t=this.#r.get(location.hash.slice(1));t?this.activate(t):this.#t.keep_history&&this.#e&&(this.deactivate(this.#e),this.#e=null)}#l(t,i,e,a,c){t.forEach(r=>(a(r),clearTimeout(this.#n.get(r)))),requestAnimationFrame(()=>{t.forEach(r=>r.setAttribute("state",i)),requestAnimationFrame(()=>{let r=setTimeout(()=>t.forEach(o=>(o.setAttribute("state",e),c(o))),this.#t.duration*1e3);t.forEach(o=>this.#n.set(o,r))})})}#i(t,i){let e=t.getAttribute("state")??"inactive",a=this.#t.allow_interrupt;if(!(i?e=="inactive"||a&&e=="deactivating":e=="active"||a&&e=="activating"))return;let c=i?"activate":"deactivate",r=i?"activating":"deactivating",o=i?"active":"inactive",u=this.#s(t);i&&this.#t.group&&this.#o.filter(n=>n!==t&&["active","activating"].includes(n.getAttribute("state"))).forEach(n=>this.#i(n,!1));let f=this.#h(t);f&&(i?(this.#u(f),this.#e=t):location.hash.slice(1)===f&&(this.#f(),this.#e=null)),this.#l([t],r,o,n=>this[`before_${c}`](n,u),n=>this[`on_${c}`](n,u)),this.#l(u,r,o,n=>this[`before_${c}d`](n,t),n=>this[`on_${c}d`](n,t))}toggle(t){h(t).forEach(i=>{let e=!["active","activating"].includes(i.getAttribute("state"));(e||this.#t.group!="radio")&&this.#i(i,e)})}activate(t){h(t).forEach(i=>this.#i(i,!0))}deactivate(t){h(t).forEach(i=>this.#i(i,!1))}};return A(S);})();
2
2
  if(typeof Toggle!=="undefined"&&Toggle&&Toggle.default)globalThis.Toggle=Toggle.default;
3
- //# sourceMappingURL=toggle.min.js.map
@@ -1,3 +1,2 @@
1
1
  var Typograf=(()=>{var E=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var D=(n,t)=>{for(var e in t)E(n,e,{get:t[e],enumerable:!0})},V=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of C(t))!M.call(n,s)&&s!==e&&E(n,s,{get:()=>t[s],enumerable:!(r=O(t,s))||r.enumerable});return n};var j=n=>V(E({},"__esModule",{value:!0}),n);var F={};D(F,{default:()=>m});var k=Symbol(),Z=Symbol(),w=n=>{try{return n instanceof Element?n:document.querySelector(n)}catch{return}},d=n=>{if(n==null)return[];if(n instanceof Element)return[n];if(n instanceof NodeList||n instanceof HTMLCollection)return[...n];if(Array.isArray(n))return n.flatMap(d);try{return[...document.querySelectorAll(n)]}catch{return[]}},g=n=>w(n)?.[k],N=(n,t)=>(n&&(n[k]=t),n);var B="\xA0",y={words:!0,particles:!0,numbers:!0,dash:!0,abbr:!0,initials:!0,last_word:!0,max_chain:14},I=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u043F\u043E","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u0443","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0437\u0430","\u0438\u0437","\u0438\u0437\u043E","\u0434\u043E","\u043E\u0442","\u043F\u0440\u0438","\u043F\u043E\u0434","\u043F\u043E\u0434\u043E","\u043D\u0430\u0434","\u043D\u0430\u0434\u043E","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u043E","\u0447\u0435\u0440\u0435\u0437","\u0441\u043A\u0432\u043E\u0437\u044C","\u043C\u0435\u0436\u0434\u0443","\u043C\u0435\u0436","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043E\u043A\u043E\u043B\u043E","\u0441\u0440\u0435\u0434\u0438","\u043A\u0440\u043E\u043C\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u0432\u0434\u043E\u043B\u044C","\u043F\u0440\u043E\u0442\u0438\u0432","\u0440\u0430\u0434\u0438","\u0432\u043C\u0435\u0441\u0442\u043E","\u0432\u043D\u0443\u0442\u0440\u0438","\u0441\u0432\u0435\u0440\u0445\u0443","\u0441\u043D\u0438\u0437\u0443","\u0432\u043E\u0437\u043B\u0435","\u043D\u0430\u043F\u0440\u043E\u0442\u0438\u0432","\u0431\u043B\u0430\u0433\u043E\u0434\u0430\u0440\u044F","\u0441\u043E\u0433\u043B\u0430\u0441\u043D\u043E","\u0432\u043E\u043F\u0440\u0435\u043A\u0438","\u0438","\u0430","\u043D\u043E","\u0434\u0430","\u0438\u043B\u0438","\u043B\u0438\u0431\u043E","\u0447\u0442\u043E","\u0447\u0442\u043E\u0431","\u0447\u0442\u043E\u0431\u044B","\u043A\u0430\u043A","\u0435\u0441\u043B\u0438","\u0438\u0431\u043E","\u0445\u043E\u0442\u044F","\u043F\u043E\u043A\u0430","\u043A\u043E\u0433\u0434\u0430","\u043A\u0443\u0434\u0430","\u043E\u0442\u043A\u0443\u0434\u0430","\u0437\u0430\u0447\u0435\u043C","\u043F\u043E\u0447\u0435\u043C\u0443","\u0432\u0435\u0434\u044C","\u043B\u0438\u0448\u044C","\u0443\u0436","\u0430\u0436","\u0442\u043E","\u043D\u0438","\u043D\u0435","\u043D\u0443","\u0432\u043E\u043D","\u0432\u043E\u0442"]),R=new Set(["\u0436\u0435","\u0436","\u043B\u0438","\u043B\u044C","\u0431\u044B","\u0431"]),W=new Set(["\u0442.","\u0442\u044B\u0441.","\u043C\u043B\u043D","\u043C\u043B\u043D.","\u043C\u043B\u0440\u0434","\u043C\u043B\u0440\u0434.","\u0433.","\u0433\u0433.","\u0443\u043B.","\u043F\u0440.","\u043F\u0435\u0440.","\u043A\u0432.","\u0441\u0442\u0440.","\u0440\u0438\u0441.","\u0442\u0430\u0431\u043B.","\u0438\u043C.","\u0441\u043C.","\u043E\u043A.","\u0441\u0432.","\u2116","\xA7"]),$=new Set(["\u2014","\u2013","-"]),L=/^[(«„"'“‘\[]+/,T=/[)»"'”’\].,:;!?…]+$/,P=n=>n.replace(L,"").replace(T,"").toLowerCase(),H=n=>n.replace(L,"").toLowerCase(),x=/^[A-ZА-ЯЁ]\.$/,v=/^[(«„"'“‘\[]*[A-ZА-ЯЁ]/,z=/^[   ]+$/;function U(n,t,e){let r=H(n);return!!(e.words&&!T.test(n)&&I.has(r)||e.particles&&R.has(P(t))||e.numbers&&/\d$/.test(n)||e.dash&&$.has(t)||e.abbr&&W.has(r)||e.initials&&(x.test(n)&&v.test(t)||x.test(t)&&v.test(n)))}function S(n,t=y){t={...y,...t};let e=n.join(""),r=[...e.matchAll(/\s+|\S+/g)],s=e.split(""),o=[];r.forEach((l,i)=>{/^\s/.test(l[0])||o.push(i)});let h=l=>r[o[l]][0],a=o.map((l,i)=>i?z.test(r[o[i]-1][0])?"kept":t.last_word&&i==o.length-1||U(h(i-1),h(i),t):!1);if(t.max_chain>0&&o.length)for(let l=o.length-1,i=h(l).length;l>0;l--){let f=i+1+h(l-1).length;a[l]===!0&&f>t.max_chain&&(a[l]=!1),i=a[l]?f:h(l-1).length}a.forEach((l,i)=>{if(l!==!0)return;let f=r[o[i]-1];s[f.index]=B;for(let b=1;b<f[0].length;b++)s[f.index+b]=""});let u=0;return n.map(l=>s.slice(u,u+=l.length).join(""))}var _=(n,t)=>S([n],t)[0];var X=["before_init","on_init","on_apply"],c=new WeakMap,p=new WeakMap,A=n=>getComputedStyle(n).display,q=n=>n.nodeType==Node.TEXT_NODE||/^(inline|contents)$/.test(A(n)),m=class n{static#p=["target","root"];#t={};#h={};#e=new Map;#o=new WeakSet;#r=null;#n=null;static find=g;static text=(t,e)=>_(t,e);get params(){return this.#t}get elements(){return[...this.#e.keys()]}clone(t={}){return new n({...this.#t,...this.#h,...t,rules:{...this.#t.rules,...t.rules},parent:this})}constructor(t){t={target:"[typograf]",root:null,live:!1,lazy:!0,rules:{},skip:'script, style, noscript, template, code, pre, textarea, kbd, samp, var, svg, math, [contenteditable]:not([contenteditable="false"]), [typograf-skip]',...Object.fromEntries(X.map(r=>[r,()=>{}])),...t};for(let[r,s]of Object.entries(t))typeof s=="function"&&!n.#p.includes(r)?(this[r]=s.bind(this),this.#h[r]=s):this.#t[r]=s;this.#t.rules={...y,...this.#t.rules},this.before_init(this.#t);let e=this.#t.root==null?null:w(this.#t.root)??null;this.#r=new IntersectionObserver(r=>{for(let s of r){let o=this.#e.get(s.target);o&&(o.near=s.isIntersecting,o.near&&o.dirty&&this.#i(s.target))}},{root:e,rootMargin:"100%"}),this.#n=new MutationObserver(r=>this.#b(r)),this.#t.live&&typeof this.#t.target=="string"&&this.#n.observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0});for(let r of d(this.#t.target))this.#l(r);this.on_init(this.#t)}observe(t){for(let e of d(t))this.#o.delete(e),this.#l(e);return this}unobserve(t){for(let e of d(t))this.#o.add(e),this.#a(e);return this}apply(t){for(let e of t==null?this.elements:d(t))this.#e.has(e)&&this.#i(e);return this}refresh(){this.#u();for(let[t,e]of this.#e)e.dirty=!0,(e.near||!this.#t.lazy)&&this.#i(t);return this}#u(){for(let t of this.#e.keys())t.isConnected||this.#a(t);if(typeof this.#t.target=="string")for(let t of d(this.#t.target))this.#o.has(t)||this.#l(t)}destroy(){for(let t of[...this.#e.keys()])this.#a(t);this.#r.disconnect(),this.#n.disconnect()}#l(t){if(this.#e.has(t))return;let e=g(t);if(e instanceof n&&e!==this){console.warn("Typograf: \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0443\u0436\u0435 \u043E\u0431\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0434\u0440\u0443\u0433\u0438\u043C Typograf \u2014 \u043F\u0440\u043E\u043F\u0443\u0449\u0435\u043D",t);return}N(t,this);let r={near:!this.#t.lazy||n.#g(t),dirty:!0};this.#e.set(t,r),this.#t.live||this.#n.observe(t,{childList:!0,subtree:!0,characterData:!0}),this.#r.observe(t),r.near&&this.#i(t)}#a(t){this.#e.has(t)&&(this.#e.delete(t),this.#r.unobserve(t),this.#E(t),g(t)===this&&N(t,void 0))}static#g(t){let e=t.getBoundingClientRect(),r=innerHeight,s=innerWidth;return e.bottom>=-r&&e.top<=2*r&&e.right>=-s&&e.left<=2*s}#s(t){let e=t.nodeType==Node.ELEMENT_NODE?t:t.parentElement;try{return!!e?.closest(this.#t.skip)}catch{return!1}}#y(t){for(let e=t;e;e=e.parentNode)if(this.#e.has(e))return e;return null}#m(t,e){let r=t.nodeType==Node.ELEMENT_NODE?t:t.parentNode;for(;r&&r!==e&&q(r)&&r.parentNode;)r=r.parentNode;return r}#b(t){let e=new Map,r=!1;for(let s of t){s.type=="childList"&&[...s.addedNodes,...s.removedNodes].some(u=>u instanceof Element)&&(r=this.#t.live);let o=this.#y(s.target);if(!o||this.#s(s.target)||s.type=="childList"&&[...s.addedNodes,...s.removedNodes].every(u=>u instanceof Element&&this.#s(u)))continue;if(s.type=="characterData"){let u=s.target;if(u.nodeValue===p.get(u))continue;c.delete(u),p.delete(u)}let h=this.#e.get(o);if(h.dirty=!0,!h.near)continue;let a=e.get(o)??new Set;a.add(this.#m(s.target,o)),e.set(o,a)}for(let[s,o]of e){for(let h of o)h.isConnected&&this.#f(h);this.#e.get(s).dirty=!1,this.#d("on_apply",s)}r&&this.#u()}#i(t){let e=this.#e.get(t);e&&(e.dirty=!1,this.#f(t),this.#d("on_apply",t))}#f(t){if(this.#s(t))return;let e=[],r=[],s=h=>{r.length&&e.push([r,h]),r=[]},o=h=>{for(let a of h.childNodes){if(a.nodeType==Node.TEXT_NODE){r.push(a);continue}if(a.nodeType!=Node.ELEMENT_NODE)continue;if(a.nodeName=="BR"){s(!0);continue}let u=this.#s(a),l=A(a);if(/^(inline|contents)$/.test(l)&&!u){o(a);continue}let i=!l.startsWith("inline");s(i),!u&&!n.#c(a)&&(o(a),s(i))}};if(!n.#c(t)){o(t),s(!0);for(let[h,a]of e){let u=h.map(i=>c.has(i)&&i.nodeValue===p.get(i)?c.get(i):i.nodeValue),l=S(u,{...this.#t.rules,last_word:this.#t.rules.last_word&&a});h.forEach((i,f)=>{(!c.has(i)||i.nodeValue!==p.get(i))&&c.set(i,i.nodeValue),p.set(i,l[f]),i.nodeValue!==l[f]&&(i.nodeValue=l[f])})}}}static#c(t){return/^(pre|break-spaces)/.test(getComputedStyle(t).whiteSpace)}#E(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let r;r=e.nextNode();)c.has(r)&&r.nodeValue===p.get(r)&&(r.nodeValue=c.get(r)),c.delete(r),p.delete(r)}#d(t,...e){try{this[t](...e)}catch(r){console.error(r)}}};return j(F);})();
2
2
  if(typeof Typograf!=="undefined"&&Typograf&&Typograf.default)globalThis.Typograf=Typograf.default;
3
- //# sourceMappingURL=typograf.min.js.map
@@ -1,3 +1,2 @@
1
1
  var Uploader=(()=>{var y=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var F=(r,t)=>{for(var s in t)y(r,s,{get:t[s],enumerable:!0})},O=(r,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of $(t))!D.call(r,c)&&c!==s&&y(r,c,{get:()=>t[c],enumerable:!(n=L(t,c))||n.enumerable});return r};var j=r=>O(y({},"__esModule",{value:!0}),r);var M={};F(M,{default:()=>m});var E=Symbol(),T=Symbol(),k=r=>{try{return r instanceof Element?r:document.querySelector(r)}catch{return}};var b=r=>k(r)?.[E],w=(r,t)=>(r&&(r[E]=t),r);var m=class r{static find=b;static formatSize(t){let s=["\u0411","\u041A\u0411","\u041C\u0411","\u0413\u0411","\u0422\u0411"],n=0;for(;t>=1024&&n<s.length-1;)t/=1024,n++;return t.toFixed(1)+" "+s[n]}constructor(t){t={target:null,input_name:null,entry:"*[file-item]",delete_name:null,before_init:()=>{},on_init:()=>{},before_files_add:()=>{},on_files_add:()=>{},before_file_delete:()=>{},on_file_delete:()=>{},before_drop:()=>{},on_drop:()=>{},handle_exception:null,...t,limits:{files:0,file_size:0,total_size:0,mimes:[],...t.limits??{}}};let s=t.input_name.replace(/\[\]$/,"");t.input_name=s+(t.limits.files!=1?"[]":""),t.delete_name=(t.delete_name?t.delete_name.replace(/\[\]$/,""):s+"_to_delete")+(t.limits.files!=1?"[]":""),document.querySelectorAll(t.target).forEach(n=>{if(b(n))throw new Error("Already inited");w(n,this);for(let[e,i]of Object.entries(t))typeof i=="function"&&(n[e]=i.bind(n));n.before_init(t);let c=(e,i,l=null)=>t.handle_exception?n.handle_exception(Object.assign(new Error(i),{file:e,code:l})):(alert(i),!1),v=()=>Object.assign(document.createElement("input"),{type:"file",name:t.input_name,multiple:t.limits.files!=1,hidden:!0}),S=n.querySelector("*[files-list]"),_=null;n.files=new Map,n.total_size=0;let z=e=>{let i=new DOMParser().parseFromString(_,"text/html").body.firstElementChild;e._id=crypto.randomUUID(),n.files.set(e._id,e),n.total_size+=e.size;let l=i.querySelectorAll("img[preview]"),o=i.querySelectorAll("*[filename]"),f=i.querySelectorAll("*[fileweight]"),a=i.querySelectorAll("*[delete-button]");if(e.type.startsWith("image/")){let d=new FileReader;d.onload=q=>l.forEach(C=>C.src=q.target.result),d.readAsDataURL(e)}else l.forEach(d=>d.remove());o.forEach(d=>d.textContent=e.name),f.forEach(d=>{d.textContent=r.formatSize(e.size),d.setAttribute("size",e.size)}),a.forEach(d=>d.addEventListener("click",()=>{n.before_file_delete(e)!==!1&&(n.total_size=Math.max(0,n.total_size-parseInt(e.size)),n.files.delete(e._id),i.remove(),n.on_file_delete(e))}));let u=v(),h=new DataTransfer;return h.items.add(e),u.files=h.files,i.appendChild(u),i},x=e=>{let i=e.querySelector(`input[name^="${s}"]`)??e.querySelector("input[type='hidden'][value]")??e.querySelector("input[value]"),l=e.querySelectorAll("*[delete-button]");if(i){let o=e.querySelector("img[preview]"),f=e.querySelector("*[filename]"),a=e.querySelector("*[fileweight]"),u={_id:crypto.randomUUID(),preview:o?.src||"",value:i.value,name:f?.textContent||"",size:parseFloat(a?.getAttribute("size")??a?.textContent??0)||0};n.files.set(u._id,u),l.forEach(h=>h.addEventListener("click",()=>{if(n.before_file_delete(u)===!1)return;let d=Object.assign(document.createElement("input"),{type:"hidden",name:t.delete_name,hidden:!0,value:i.value});n.appendChild(d),n.files.delete(u._id),n.on_file_delete(u),e.remove()})),i.remove()}else e.remove();return e},A=e=>{if(t.limits.files>0&&n.files.size>=t.limits.files)return c(e,`\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C \u0444\u0430\u0439\u043B\u043E\u0432: ${t.limits.files}`,0);if(t.limits.file_size>0&&e.size>t.limits.file_size)return c(e,`\u0424\u0430\u0439\u043B "${e.name}" \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0439! \u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C ${r.formatSize(t.limits.file_size)}.`,1);if(t.limits.total_size>0&&n.total_size+e.size>t.limits.total_size)return c(e,`\u041F\u0440\u0435\u0432\u044B\u0448\u0435\u043D \u043E\u0431\u0449\u0438\u0439 \u043B\u0438\u043C\u0438\u0442! \u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0441\u0443\u043C\u043C\u0430 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043B\u043E\u0432 ${r.formatSize(t.limits.total_size)}.`,2);if(t.limits.mimes.length>0){let i=e.type.trim(),l=i.split(";")[0].trim().toLowerCase();for(let o of t.limits.mimes){if(o.endsWith("/*")&&!/[\\^$.*+?()[\]{}|]/.test(o.slice(0,-2))){if(l.startsWith(o.slice(0,-1).toLowerCase()))return!0;continue}if(/[\\^$.*+?()[\]{}|]/.test(o)){try{let f=new RegExp(o,"i");if(f.test(i)||f.test(l))return!0}catch{}continue}if(l===o.toLowerCase())return!0}return c(e,`\u0424\u0430\u0439\u043B "${e.name}" \u0438\u043C\u0435\u0435\u0442 \u043D\u0435\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0439 \u0442\u0438\u043F: ${l}.`,3)}return!0},p=e=>{let i=Array.from(e);if(n.before_files_add(i),i=i.filter(A),i.length>0){let l=document.createDocumentFragment();i.forEach(o=>{l.appendChild(z(o))}),S.appendChild(l)}n.on_files_add(i)};try{let e=n.querySelectorAll(t.entry);e.length>0&&e.forEach(i=>{let l=x(i);_||(_=l.outerHTML)})}catch{_=t.entry}_=_.trim(),n.querySelectorAll("*[drop-zone]").forEach(e=>{let i=!1;["dragenter","dragover"].forEach(l=>e.addEventListener(l,o=>{o.preventDefault(),e.setAttribute("dragover",""),i||(n.before_drop(),i=!0)})),["dragleave","drop"].forEach(l=>e.addEventListener(l,o=>{o.preventDefault(),e.removeAttribute("dragover"),i=!1})),e.addEventListener("drop",l=>{l.preventDefault(),n.on_drop(),p(l.dataTransfer.files)})}),n.querySelectorAll("*[add-button]").forEach(e=>e.addEventListener("click",()=>{let i=v();i.addEventListener("change",()=>{p(i.files)}),document.body.appendChild(i),i.click()})),n.on_init(t)})}};return j(M);})();
2
2
  if(typeof Uploader!=="undefined"&&Uploader&&Uploader.default)globalThis.Uploader=Uploader.default;
3
- //# sourceMappingURL=uploader.min.js.map
@@ -1,3 +1,2 @@
1
1
  var Validator=(()=>{var f=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var i in t)f(e,i,{get:t[i],enumerable:!0})},p=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!y.call(e,n)&&n!==i&&f(e,n,{get:()=>t[n],enumerable:!(s=b(t,n))||s.enumerable});return e};var _=e=>p(f({},"__esModule",{value:!0}),e);var x={};g(x,{default:()=>u});var c=Symbol(),k=Symbol(),w=e=>{try{return e instanceof Element?e:document.querySelector(e)}catch{return}},r=e=>{if(e==null)return[];if(e instanceof Element)return[e];if(e instanceof NodeList||e instanceof HTMLCollection)return[...e];if(Array.isArray(e))return e.flatMap(r);try{return[...document.querySelectorAll(e)]}catch{return[]}},o=e=>w(e)?.[c],l=(e,t)=>(e&&(e[c]=t),e),d=(e,t)=>{if(!e)return e;let i=e[k]??=new Set;for(let[s,n]of Object.entries(t)){if(s in e&&!i.has(s)){console.warn(`\u0418\u043C\u044F "${s}" \u0443\u0436\u0435 \u0437\u0430\u043D\u044F\u0442\u043E \u043D\u0430 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0435 \u2014 \u043C\u0435\u0442\u043E\u0434 \u043D\u0435 \u043E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D`,e);continue}Object.defineProperty(e,s,{value:n,writable:!0,configurable:!0,enumerable:!1}),i.add(s)}return e};var u=class e{static#a=["target","test","message"];#t={};#n={};#e=[];static find=o;get params(){return this.#t}get valid(){return this.#e.map(t=>this.#i(t).valid)}clone(t){return new e({...this.#t,...this.#n,...t,parent:this})}constructor(t){t={target:"[validate]",events:["input","blur"],test:null,property:null,attribute:null,message:"\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435",native:!0,check_on_init:!1,before_init:()=>{},on_init:()=>{},before_check:()=>{},on_valid:()=>{},on_invalid:()=>{},on_check:()=>{},...t};for(let[i,s]of Object.entries(t))typeof s=="function"&&!e.#a.includes(i)?(this[i]=s.bind(this),this.#n[i]=s):this.#t[i]=s;this.before_init(this.#t);for(let i of r(this.#t.target))this.#h(i);this.#t.check_on_init&&this.check(),this.on_init(this.#t)}check(t=this.#e){return this.#r(t).map(i=>this.#s(i)).every(Boolean)}reset(t=this.#e){for(let i of this.#r(t))i.removeAttribute("state"),this.#i(i)}#r(t){return r(t).filter(i=>o(i)===this)}#h(t){if(o(t))throw new Error("\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440 \u0443\u0436\u0435 \u043F\u0440\u0438\u0432\u044F\u0437\u0430\u043D \u043A \u044D\u0442\u043E\u043C\u0443 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0443");l(t,this),this.#e.push(t),d(t,{check:()=>this.check(t),reset:()=>this.reset(t)});for(let i of this.#t.events)t.addEventListener(i,()=>this.#s(t));t.addEventListener("invalid",()=>this.#s(t)),(t.form??t.closest("form"))?.addEventListener("reset",()=>queueMicrotask(()=>this.reset(t))),this.#i(t)}#s(t){if(this.before_check(t)===!1)return t.getAttribute("state")!="invalid";let{valid:i,message:s}=this.#i(t);return t.setAttribute("state",i?"valid":"invalid"),i?this.on_valid(t):this.on_invalid(t,s),this.on_check(t,i,s),i}#i(t){let i=this.#f(t);return this.#o(t)&&t.setCustomValidity(i.valid?"":i.message||" "),i}#o(t){return this.#t.native&&typeof t.setCustomValidity=="function"}#f(t){let{test:i,property:s,attribute:n}=this.#t;if(this.#o(t)&&(t.setCustomValidity(""),!t.validity.valid))return{valid:!1,message:t.validationMessage};if(n&&!t.hasAttribute(n))return this.#u(t);let v=String((s?t[s]:n?t.getAttribute(n):t.value)??"");for(let a of[i??[]].flat()){let h=typeof a=="function"?a.call(this,t):new RegExp(a).test(v);if(typeof h=="string")return{valid:!1,message:h};if(!h)return this.#u(t)}return{valid:!0,message:""}}#u(t){let i=this.#t.message;return{valid:!1,message:typeof i=="function"?i.call(this,t):i}}};return _(x);})();
2
2
  if(typeof Validator!=="undefined"&&Validator&&Validator.default)globalThis.Validator=Validator.default;
3
- //# sourceMappingURL=validator.min.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-of-summer/st-script",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Standalone JS classes/components (Modal, App, Typograf , …), shipped as ESM and IIFE/CDN builds.",
5
5
  "type": "module",
6
6
  "license": "MIT",