@erickxavier/no-js 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/no.js +5 -5
- package/dist/cjs/no.js.map +4 -4
- package/dist/esm/no.js +5 -5
- package/dist/esm/no.js.map +4 -4
- package/dist/iife/no.js +6 -6
- package/dist/iife/no.js.map +4 -4
- package/package.json +1 -1
- package/src/context.js +28 -2
- package/src/devtools.js +264 -0
- package/src/directives/http.js +3 -0
- package/src/directives/state.js +5 -0
- package/src/index.js +3 -13
- package/src/registry.js +18 -0
- package/src/router.js +8 -0
package/dist/cjs/no.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* No.JS v1.
|
|
2
|
+
* No.JS v1.6.0 — The HTML-First Reactive Framework
|
|
3
3
|
* No more JavaScript. Just HTML attributes with superpowers.
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @see https://github.com/ErickXavier/no-js
|
|
6
6
|
*/
|
|
7
|
-
var Pt=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var Gt=(t,e)=>()=>(t&&(e=t(t=0)),e);var Qt=(t,e)=>{for(var r in e)Pt(t,r,{get:e[r],enumerable:!0})},Ee=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _e(e))!ve.call(t,o)&&o!==r&&Pt(t,o,{get:()=>e[o],enumerable:!(n=ye(e,o))||n.enumerable});return t};var xe=t=>Ee(Pt({},"__esModule",{value:!0}),t);function Ft(t){ct=t}function Zt(t){et=t}function z(...t){h.debug&&console.log("[No.JS]",...t)}function st(...t){console.warn("[No.JS]",...t)}function wt(){for(let t of Ct){if(t._el&&!t._el.isConnected){Ct.delete(t);continue}t()}}function q(t,e,r){e.$watch(r),typeof t=="string"&&t.includes("$store")&&Ct.add(r)}function Q(t){ct&&(ct.__disposers=ct.__disposers||[],ct.__disposers.push(t))}function Dt(t,e){(yt[t]||[]).forEach(r=>r(e))}var h,At,yt,V,Ct,k,_t,Rt,ft,et,ct,X=Gt(()=>{h={baseApiUrl:"",headers:{},timeout:1e4,retries:0,retryDelay:1e3,credentials:"same-origin",csrf:null,cache:{strategy:"none",ttl:3e5},templates:{cache:!0},router:{mode:"history",base:"/",scrollBehavior:"top",templates:"pages",ext:".tpl"},i18n:{defaultLocale:"en",fallbackLocale:"en",detectBrowser:!1,loadPath:null,ns:[],cache:!0,persist:!1},debug:!1,devtools:!1,csp:null,sanitize:!0},At={request:[],response:[]},yt={},V={},Ct=new Set,k={},_t={},Rt=new Map,ft={},et=null,ct=null});var te={};Qt(te,{_deepMerge:()=>qt,_i18n:()=>W,_i18nCache:()=>Ut,_i18nListeners:()=>vt,_loadI18nForLocale:()=>zt,_loadI18nNamespace:()=>Kt,_loadLocale:()=>St,_loadedNs:()=>Wt,_notifyI18n:()=>Tt,_watchI18n:()=>$t});function $t(t){return vt.add(t),()=>vt.delete(t)}function Tt(){for(let t of vt){if(t._el&&!t._el.isConnected){vt.delete(t);continue}t()}}function qt(t,e){let r={...t};for(let n of Object.keys(e))e[n]&&typeof e[n]=="object"&&!Array.isArray(e[n])&&t[n]&&typeof t[n]=="object"&&!Array.isArray(t[n])?r[n]=qt(t[n],e[n]):r[n]=e[n];return r}async function St(t,e){let r=e?`${t}:${e}`:t;if(h.i18n.cache&&Ut.has(r))return;let n=h.i18n.loadPath.replace("{locale}",t);if(e)n=n.replace("{ns}",e);else if(n.includes("{ns}"))return;try{let o=await fetch(n);if(!o.ok){st(`i18n: failed to load ${n} (${o.status})`);return}let i=await o.json();W.locales[t]=qt(W.locales[t]||{},i),h.i18n.cache&&Ut.set(r,i)}catch(o){st(`i18n: error loading ${n}`,o)}}async function zt(t){if(!h.i18n.loadPath)return;let e=h.i18n.ns;!e.length||!h.i18n.loadPath.includes("{ns}")?await St(t,null):await Promise.all(e.map(r=>St(t,r)))}async function Kt(t){if(!h.i18n.loadPath)return;Wt.add(t);let e=new Set([W.locale,h.i18n.fallbackLocale]);await Promise.all([...e].map(r=>St(r,t)))}var vt,Ut,Wt,W,pt=Gt(()=>{X();vt=new Set;Ut=new Map,Wt=new Set;W={_locale:"en",locales:{},get locale(){return this._locale},set locale(t){if(this._locale!==t){if(this._locale=t,h.i18n.persist&&typeof localStorage<"u")try{localStorage.setItem("nojs-locale",t)}catch{}if(h.i18n.loadPath){let e=new Set([...h.i18n.ns,...Wt]);Promise.all([...e].map(r=>St(t,r))).then(()=>Tt())}else Tt()}},t(t,e={}){let r=W.locales[W.locale]||W.locales[h.i18n.fallbackLocale]||{},n=t.split(".").reduce((o,i)=>o?.[i],r);if(n==null)return t;if(typeof n=="string"&&n.includes("|")&&e.count!=null){let o=n.split("|").map(i=>i.trim());n=Number(e.count)===1?o[0]:o[1]||o[0]}return typeof n=="string"&&(n=n.replace(/\{(\w+)\}/g,(o,i)=>e[i]!=null?e[i]:"")),n}}});var ke={};Qt(ke,{default:()=>Ne});module.exports=xe(ke);X();pt();X();pt();var Ae=0,we=new Set;function P(t={},e=null){let r=new Set,n={};Object.assign(n,t);let o=!1;function i(){if(!o){o=!0;try{if(Ae>0)for(let c of r){if(c._el&&!c._el.isConnected){r.delete(c);continue}we.add(c)}else for(let c of r){if(c._el&&!c._el.isConnected){r.delete(c);continue}c()}}finally{o=!1}}}let s={get(c,l){if(l==="__isProxy")return!0;if(l==="__raw")return c;if(l==="__listeners")return r;if(l==="$watch")return d=>(ct&&(d._el=ct),r.add(d),()=>r.delete(d));if(l==="$notify")return i;if(l==="$set")return(d,f)=>{let p=d.split(".");if(p.length===1)a[d]=f;else{let u=a;for(let x=0;x<p.length-1;x++)if(u=u[p[x]],u==null)return;let m=p[p.length-1],b=u[m];u[m]=f,b!==f&&i()}};if(l==="$parent")return e;if(l==="$refs")return ft;if(l==="$store")return V;if(l==="$route")return et?et.current:{};if(l==="$router")return et;if(l==="$i18n")return W;if(l==="$form")return c.$form||null;if(l in c)return c[l];if(e&&e.__isProxy)return e[l]},set(c,l,d){let f=c[l];return c[l]=d,f!==d&&i(),!0},has(c,l){return l in c?!0:e&&e.__isProxy?l in e:!1}},a=new Proxy(n,s);return a}function Jt(t){let e=new Set,r={},n=t;for(;n&&n.__isProxy;){let o=n.__raw;for(let i of Object.keys(o))e.has(i)||(e.add(i),r[i]=o[i]);n=n.$parent}return{keys:[...e],vals:r}}X();pt();var ee=new Map;function mt(t,e,r){let n={};for(let l=0;l<e.length;l++)n[e[l]]=r[l];function o(l,d){return l.split(".").reduce((f,p)=>f?.[p],d)}function i(l){let d=l.trim();if(d==="true")return!0;if(d==="false")return!1;if(d==="null")return null;if(d!=="undefined")return/^-?\d+(\.\d+)?$/.test(d)?Number(d):/^(['"`]).*\1$/.test(d)?d.slice(1,-1):o(d,n)}let s=t.trim(),a=s.match(/^(.+?)\s*\?\s*(.+?)\s*:\s*(.+)$/);if(a){let l=mt(a[1].trim(),e,r);return mt(l?a[2].trim():a[3].trim(),e,r)}if(s.includes("||")){let l=s.split("||");for(let d of l){let f=mt(d.trim(),e,r);if(f)return f}return mt(l[l.length-1].trim(),e,r)}if(s.includes("&&")){let l=s.split("&&"),d;for(let f of l)if(d=mt(f.trim(),e,r),!d)return d;return d}let c=s.match(/^(.+?)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/);if(c){let l=i(c[1]),d=i(c[3]);switch(c[2]){case"===":return l===d;case"!==":return l!==d;case"==":return l==d;case"!=":return l!=d;case">=":return l>=d;case"<=":return l<=d;case">":return l>d;case"<":return l<d}}return s.startsWith("!")?!mt(s.slice(1).trim(),e,r):i(s)}function Le(t){let e=[],r="",n=0,o=!1,i="";for(let s=0;s<t.length;s++){let a=t[s];if(o){r+=a,a===i&&t[s-1]!=="\\"&&(o=!1);continue}if(a==="'"||a==='"'||a==="`"){o=!0,i=a,r+=a;continue}if(a==="("||a==="["||a==="{"){n++,r+=a;continue}if(a===")"||a==="]"||a==="}"){n--,r+=a;continue}if(a==="|"&&n===0&&t[s+1]!=="|"&&t[s-1]!=="|"){e.push(r.trim()),r="";continue}r+=a}return e.push(r.trim()),e}function Ce(t,e){let r=e.indexOf(":"),n,o;r===-1?(n=e.trim(),o=null):(n=e.substring(0,r).trim(),o=e.substring(r+1).trim());let i=k[n];if(!i)return st(`Unknown filter: ${n}`),t;let s=o?Te(o):[];return i(t,...s)}function Te(t){let e=[],r="",n=!1,o="";for(let i of t){if(n){if(i===o){n=!1;continue}r+=i;continue}if(i==="'"||i==='"'){n=!0,o=i;continue}if(i===","){e.push(r.trim()),r="";continue}r+=i}return r.trim()&&e.push(r.trim()),e.map(i=>{let s=Number(i);return isNaN(s)?i:s})}function L(t,e){if(!(t==null||t===""))try{let r=Le(t),n=r[0],{keys:o,vals:i}=Jt(e),s=["$store","$route","$router","$i18n","$refs","$form"];for(let d of s)o.includes(d)||(o.push(d),i[d]=e[d]);let a=o,c=a.map(d=>i[d]),l;if(h.csp==="strict")l=mt(n,a,c);else{let d=n+"|"+a.join(","),f=ee.get(d);f||(f=new Function(...a,`return (${n})`),ee.set(d,f)),l=f(...c)}for(let d=1;d<r.length;d++)l=Ce(l,r[d]);return l}catch{return}}function Z(t,e,r={}){try{let{keys:n,vals:o}=Jt(e),i={$store:V,$route:et?.current,$router:et,$i18n:W,$refs:e.$refs};Object.assign(i,r);for(let[u,m]of Object.entries(i))n.includes(u)||(n.push(u),o[u]=m);let s=[...n],a=s.map(u=>o[u]),c=new Set,l=e;for(;l&&l.__isProxy;){for(let u of Object.keys(l.__raw))c.add(u);l=l.$parent}let d={};for(let u of c)!u.startsWith("$")&&u in o&&(d[u]=o[u]);let f=[...c].filter(u=>!u.startsWith("$")).map(u=>`{let _c=__ctx;while(_c&&_c.__isProxy){if('${u}'in _c.__raw){if(typeof ${u}!=='undefined'){if(${u}!==__orig['${u}'])_c.$set('${u}',${u});else if(typeof ${u}==='object'&&${u}!==null)_c.$notify();}break;}_c=_c.$parent;}}`).join(`
|
|
7
|
+
var Ft=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var je=Object.prototype.hasOwnProperty;var re=(t,e)=>()=>(t&&(e=t(t=0)),e);var ne=(t,e)=>{for(var r in e)Ft(t,r,{get:e[r],enumerable:!0})},Be=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of De(e))!je.call(t,o)&&o!==r&&Ft(t,o,{get:()=>e[o],enumerable:!(n=ke(e,o))||n.enumerable});return t};var Oe=t=>Be(Ft({},"__esModule",{value:!0}),t);function zt(t){ct=t}function oe(t){G=t}function Y(...t){g.debug&&console.log("[No.JS]",...t)}function it(...t){console.warn("[No.JS]",...t)}function Tt(){for(let t of It){if(t._el&&!t._el.isConnected){It.delete(t);continue}t()}}function z(t,e,r){e.$watch(r),typeof t=="string"&&t.includes("$store")&&It.add(r)}function Z(t){ct&&(ct.__disposers=ct.__disposers||[],ct.__disposers.push(t))}function jt(t,e){(_t[t]||[]).forEach(r=>r(e))}var g,Lt,_t,W,It,j,Ct,Ut,ut,G,ct,K=re(()=>{g={baseApiUrl:"",headers:{},timeout:1e4,retries:0,retryDelay:1e3,credentials:"same-origin",csrf:null,cache:{strategy:"none",ttl:3e5},templates:{cache:!0},router:{mode:"history",base:"/",scrollBehavior:"top",templates:"pages",ext:".tpl"},i18n:{defaultLocale:"en",fallbackLocale:"en",detectBrowser:!1,loadPath:null,ns:[],cache:!0,persist:!1},debug:!1,devtools:!1,csp:null,sanitize:!0},Lt={request:[],response:[]},_t={},W={},It=new Set,j={},Ct={},Ut=new Map,ut={},G=null,ct=null});var se={};ne(se,{_deepMerge:()=>Kt,_i18n:()=>U,_i18nCache:()=>Wt,_i18nListeners:()=>vt,_loadI18nForLocale:()=>Xt,_loadI18nNamespace:()=>Yt,_loadLocale:()=>Nt,_loadedNs:()=>Jt,_notifyI18n:()=>$t,_watchI18n:()=>kt});function kt(t){return vt.add(t),()=>vt.delete(t)}function $t(){for(let t of vt){if(t._el&&!t._el.isConnected){vt.delete(t);continue}t()}}function Kt(t,e){let r={...t};for(let n of Object.keys(e))e[n]&&typeof e[n]=="object"&&!Array.isArray(e[n])&&t[n]&&typeof t[n]=="object"&&!Array.isArray(t[n])?r[n]=Kt(t[n],e[n]):r[n]=e[n];return r}async function Nt(t,e){let r=e?`${t}:${e}`:t;if(g.i18n.cache&&Wt.has(r))return;let n=g.i18n.loadPath.replace("{locale}",t);if(e)n=n.replace("{ns}",e);else if(n.includes("{ns}"))return;try{let o=await fetch(n);if(!o.ok){it(`i18n: failed to load ${n} (${o.status})`);return}let i=await o.json();U.locales[t]=Kt(U.locales[t]||{},i),g.i18n.cache&&Wt.set(r,i)}catch(o){it(`i18n: error loading ${n}`,o)}}async function Xt(t){if(!g.i18n.loadPath)return;let e=g.i18n.ns;!e.length||!g.i18n.loadPath.includes("{ns}")?await Nt(t,null):await Promise.all(e.map(r=>Nt(t,r)))}async function Yt(t){if(!g.i18n.loadPath)return;Jt.add(t);let e=new Set([U.locale,g.i18n.fallbackLocale]);await Promise.all([...e].map(r=>Nt(r,t)))}var vt,Wt,Jt,U,ft=re(()=>{K();vt=new Set;Wt=new Map,Jt=new Set;U={_locale:"en",locales:{},get locale(){return this._locale},set locale(t){if(this._locale!==t){if(this._locale=t,g.i18n.persist&&typeof localStorage<"u")try{localStorage.setItem("nojs-locale",t)}catch{}if(g.i18n.loadPath){let e=new Set([...g.i18n.ns,...Jt]);Promise.all([...e].map(r=>Nt(t,r))).then(()=>$t())}else $t()}},t(t,e={}){let r=U.locales[U.locale]||U.locales[g.i18n.fallbackLocale]||{},n=t.split(".").reduce((o,i)=>o?.[i],r);if(n==null)return t;if(typeof n=="string"&&n.includes("|")&&e.count!=null){let o=n.split("|").map(i=>i.trim());n=Number(e.count)===1?o[0]:o[1]||o[0]}return typeof n=="string"&&(n=n.replace(/\{(\w+)\}/g,(o,i)=>e[i]!=null?e[i]:"")),n}}});var Ye={};ne(Ye,{default:()=>Xe});module.exports=Oe(Ye);K();ft();K();ft();K();ft();var xt=new Map;function at(t,e){!g.devtools||typeof window>"u"||window.dispatchEvent(new CustomEvent("nojs:devtools",{detail:{type:t,data:e,timestamp:Date.now()}}))}function Vt(t){if(!t||!t.__isProxy)return null;let e=t.__raw,r={};for(let n of Object.keys(e)){if(n.startsWith("__"))continue;let o=e[n];if(o&&typeof o=="object"&&o.__isProxy)r[n]=Vt(o);else try{JSON.stringify(o),r[n]=o}catch{r[n]=String(o)}}return r}function ie(t){if(!t||!t.tagName)return null;let e=t.tagName.toLowerCase(),r=t.id?`#${t.id}`:"",n=t.className&&typeof t.className=="string"?"."+t.className.trim().split(/\s+/).join("."):"";return e+r+n}function ae(t){let e=document.querySelector(t);if(!e)return{error:"Element not found",selector:t};let r=e.__ctx;return{selector:t,tag:ie(e),hasContext:!!r,contextId:r?.__raw?.__devtoolsId??null,data:r?Vt(r):null,directives:[...e.attributes].filter(n=>!["class","id","style"].includes(n.name)).map(n=>({name:n.name,value:n.value}))}}function ce(t){let e=W[t];return e?{name:t,contextId:e.__raw?.__devtoolsId??null,data:Vt(e)}:{error:"Store not found",name:t}}function le(t){let e=t?document.querySelector(t):document.body;if(!e)return{error:"Root not found",selector:t};function r(n){let o=n.__ctx,i={tag:ie(n),contextId:o?.__raw?.__devtoolsId??null,children:[]};for(let s of n.children)s.tagName==="TEMPLATE"||s.tagName==="SCRIPT"||(s.__ctx||s.__declared)&&i.children.push(r(s));return i}return r(e)}function de(t,e,r){let n=xt.get(t);return n?(n[e]=r,{ok:!0,id:t,key:e}):{error:"Context not found",id:t}}function ue(t,e,r){let n=W[t];return n?(n[e]=r,{ok:!0,name:t,key:e}):{error:"Store not found",name:t}}function fe(){let t=0;for(let[,e]of xt)e.__listeners&&(t+=e.__listeners.size);return{contexts:xt.size,stores:Object.keys(W).length,listeners:t,refs:Object.keys(ut).length,hasRouter:!!G,locale:U.locale}}var Et=null;function pe(t){Gt();let e=document.querySelector(t);if(!e)return;let r=e.getBoundingClientRect();Et=document.createElement("div"),Et.id="__nojs_devtools_highlight__",Object.assign(Et.style,{position:"fixed",top:r.top+"px",left:r.left+"px",width:r.width+"px",height:r.height+"px",background:"rgba(66, 133, 244, 0.25)",border:"2px solid rgba(66, 133, 244, 0.8)",pointerEvents:"none",zIndex:"2147483647",borderRadius:"3px"}),document.body.appendChild(Et)}function Gt(){Et&&(Et.remove(),Et=null)}function Me(t){let{command:e,args:r={}}=t.detail||{},n;switch(e){case"inspect:element":n=ae(r.selector);break;case"inspect:store":n=ce(r.name);break;case"inspect:tree":n=le(r.selector);break;case"mutate:context":n=de(r.id,r.key,r.value);break;case"mutate:store":n=ue(r.name,r.key,r.value);break;case"get:config":n={...g};break;case"get:routes":n=G?G.routes||[]:[];break;case"get:stats":n=fe();break;case"highlight:element":pe(r.selector),n={ok:!0};break;case"unhighlight":Gt(),n={ok:!0};break;default:n={error:"Unknown command",command:e}}window.dispatchEvent(new CustomEvent("nojs:devtools:response",{detail:{command:e,result:n,timestamp:Date.now()}}))}function me(t){!g.devtools||typeof window>"u"||(window.addEventListener("nojs:devtools:cmd",Me),window.__NOJS_DEVTOOLS__={stores:W,config:g,refs:ut,router:G,version:t.version,inspect:e=>ae(e),inspectStore:e=>ce(e),inspectTree:e=>le(e),stats:()=>fe(),mutate:(e,r,n)=>de(e,r,n),mutateStore:(e,r,n)=>ue(e,r,n),highlight:e=>pe(e),unhighlight:()=>Gt(),on:(e,r)=>{let n=o=>{(!e||o.detail.type===e)&&r(o.detail)};return window.addEventListener("nojs:devtools",n),()=>window.removeEventListener("nojs:devtools",n)}},console.log("[No.JS DevTools] enabled \u2014 access via window.__NOJS_DEVTOOLS__"))}var He=0,Re=new Set,Pe=0;function P(t={},e=null){let r=new Set,n={};Object.assign(n,t),g.devtools&&(n.__devtoolsId=++Pe);let o=!1;function i(){if(!o){o=!0;try{if(He>0)for(let c of r){if(c._el&&!c._el.isConnected){r.delete(c);continue}Re.add(c)}else for(let c of r){if(c._el&&!c._el.isConnected){r.delete(c);continue}c()}}finally{o=!1}}}let s={get(c,l){if(l==="__isProxy")return!0;if(l==="__raw")return c;if(l==="__listeners")return r;if(l==="$watch")return d=>(ct&&(d._el=ct),r.add(d),()=>r.delete(d));if(l==="$notify")return i;if(l==="$set")return(d,f)=>{let p=d.split(".");if(p.length===1)a[d]=f;else{let u=a;for(let x=0;x<p.length-1;x++)if(u=u[p[x]],u==null)return;let m=p[p.length-1],b=u[m];u[m]=f,b!==f&&i()}};if(l==="$parent")return e;if(l==="$refs")return ut;if(l==="$store")return W;if(l==="$route")return G?G.current:{};if(l==="$router")return G;if(l==="$i18n")return U;if(l==="$form")return c.$form||null;if(l in c)return c[l];if(e&&e.__isProxy)return e[l]},set(c,l,d){let f=c[l];return c[l]=d,f!==d&&(i(),at("ctx:updated",{id:c.__devtoolsId,key:l,oldValue:f,newValue:d})),!0},has(c,l){return l in c?!0:e&&e.__isProxy?l in e:!1}},a=new Proxy(n,s);return g.devtools&&n.__devtoolsId&&(xt.set(n.__devtoolsId,a),at("ctx:created",{id:n.__devtoolsId,parentId:e?.__raw?.__devtoolsId??null,keys:Object.keys(t),elementTag:ct?.tagName?.toLowerCase()??null})),a}function Qt(t){let e=new Set,r={},n=t;for(;n&&n.__isProxy;){let o=n.__raw;for(let i of Object.keys(o))e.has(i)||(e.add(i),r[i]=o[i]);n=n.$parent}return{keys:[...e],vals:r}}K();ft();var ge=new Map;function gt(t,e,r){let n={};for(let l=0;l<e.length;l++)n[e[l]]=r[l];function o(l,d){return l.split(".").reduce((f,p)=>f?.[p],d)}function i(l){let d=l.trim();if(d==="true")return!0;if(d==="false")return!1;if(d==="null")return null;if(d!=="undefined")return/^-?\d+(\.\d+)?$/.test(d)?Number(d):/^(['"`]).*\1$/.test(d)?d.slice(1,-1):o(d,n)}let s=t.trim(),a=s.match(/^(.+?)\s*\?\s*(.+?)\s*:\s*(.+)$/);if(a){let l=gt(a[1].trim(),e,r);return gt(l?a[2].trim():a[3].trim(),e,r)}if(s.includes("||")){let l=s.split("||");for(let d of l){let f=gt(d.trim(),e,r);if(f)return f}return gt(l[l.length-1].trim(),e,r)}if(s.includes("&&")){let l=s.split("&&"),d;for(let f of l)if(d=gt(f.trim(),e,r),!d)return d;return d}let c=s.match(/^(.+?)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/);if(c){let l=i(c[1]),d=i(c[3]);switch(c[2]){case"===":return l===d;case"!==":return l!==d;case"==":return l==d;case"!=":return l!=d;case">=":return l>=d;case"<=":return l<=d;case">":return l>d;case"<":return l<d}}return s.startsWith("!")?!gt(s.slice(1).trim(),e,r):i(s)}function qe(t){let e=[],r="",n=0,o=!1,i="";for(let s=0;s<t.length;s++){let a=t[s];if(o){r+=a,a===i&&t[s-1]!=="\\"&&(o=!1);continue}if(a==="'"||a==='"'||a==="`"){o=!0,i=a,r+=a;continue}if(a==="("||a==="["||a==="{"){n++,r+=a;continue}if(a===")"||a==="]"||a==="}"){n--,r+=a;continue}if(a==="|"&&n===0&&t[s+1]!=="|"&&t[s-1]!=="|"){e.push(r.trim()),r="";continue}r+=a}return e.push(r.trim()),e}function Fe(t,e){let r=e.indexOf(":"),n,o;r===-1?(n=e.trim(),o=null):(n=e.substring(0,r).trim(),o=e.substring(r+1).trim());let i=j[n];if(!i)return it(`Unknown filter: ${n}`),t;let s=o?Ue(o):[];return i(t,...s)}function Ue(t){let e=[],r="",n=!1,o="";for(let i of t){if(n){if(i===o){n=!1;continue}r+=i;continue}if(i==="'"||i==='"'){n=!0,o=i;continue}if(i===","){e.push(r.trim()),r="";continue}r+=i}return r.trim()&&e.push(r.trim()),e.map(i=>{let s=Number(i);return isNaN(s)?i:s})}function L(t,e){if(!(t==null||t===""))try{let r=qe(t),n=r[0],{keys:o,vals:i}=Qt(e),s=["$store","$route","$router","$i18n","$refs","$form"];for(let d of s)o.includes(d)||(o.push(d),i[d]=e[d]);let a=o,c=a.map(d=>i[d]),l;if(g.csp==="strict")l=gt(n,a,c);else{let d=n+"|"+a.join(","),f=ge.get(d);f||(f=new Function(...a,`return (${n})`),ge.set(d,f)),l=f(...c)}for(let d=1;d<r.length;d++)l=Fe(l,r[d]);return l}catch{return}}function tt(t,e,r={}){try{let{keys:n,vals:o}=Qt(e),i={$store:W,$route:G?.current,$router:G,$i18n:U,$refs:e.$refs};Object.assign(i,r);for(let[u,m]of Object.entries(i))n.includes(u)||(n.push(u),o[u]=m);let s=[...n],a=s.map(u=>o[u]),c=new Set,l=e;for(;l&&l.__isProxy;){for(let u of Object.keys(l.__raw))c.add(u);l=l.$parent}let d={};for(let u of c)!u.startsWith("$")&&u in o&&(d[u]=o[u]);let f=[...c].filter(u=>!u.startsWith("$")).map(u=>`{let _c=__ctx;while(_c&&_c.__isProxy){if('${u}'in _c.__raw){if(typeof ${u}!=='undefined'){if(${u}!==__orig['${u}'])_c.$set('${u}',${u});else if(typeof ${u}==='object'&&${u}!==null)_c.$notify();}break;}_c=_c.$parent;}}`).join(`
|
|
8
8
|
`);new Function("__ctx","__orig",...s,`${t};
|
|
9
|
-
${f}`)(e,d,...a),typeof t=="string"&&t.includes("$store")&&
|
|
9
|
+
${f}`)(e,d,...a),typeof t=="string"&&t.includes("$store")&&Tt()}catch(n){it("Expression error:",t,n.message),r.$el&&r.$el.dispatchEvent(new CustomEvent("nojs:error",{bubbles:!0,detail:{message:n.message,error:n}}))}}function nt(t,e){return t.split(".").reduce((r,n)=>r?.[n],e)}function ht(t,e){return t.replace(/\{([^}]+)\}/g,(r,n)=>{let o=L(n.trim(),e);return o??""})}K();K();function Zt(t,e){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"))return t;let r=e;for(;r;){let n=r.getAttribute?.("base");if(n)return n.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"");r=r.parentElement}return g.baseApiUrl?g.baseApiUrl.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):t}async function Bt(t,e="GET",r=null,n={},o=null,i=null){let s=Zt(t,o),a={method:e.toUpperCase(),headers:{...g.headers||{},...n},credentials:g.credentials};if(r&&e!=="GET")if(typeof r=="string")try{JSON.parse(r),a.headers["Content-Type"]="application/json",a.body=r}catch{a.body=r}else r instanceof FormData?a.body=r:(a.headers["Content-Type"]="application/json",a.body=JSON.stringify(r));g.csrf&&e!=="GET"&&(a.headers[g.csrf.header||"X-CSRF-Token"]=g.csrf.token||"");for(let d of Lt.request)a=d(s,a)||a;let c=g.retries||0,l;for(let d=0;d<=c;d++)try{let f=new AbortController,p=setTimeout(()=>f.abort(),g.timeout||1e4);if(i){if(i.aborted)throw clearTimeout(p),new DOMException("Aborted","AbortError");i.addEventListener("abort",()=>f.abort(),{once:!0})}a.signal=f.signal;let u=await fetch(s,a);clearTimeout(p);for(let b of Lt.response)u=b(u,s)||u;if(!u.ok){let b=await u.json().catch(()=>({})),x=new Error(b.message||`HTTP ${u.status}`);throw x.status=u.status,x.body=b,x}let m=await u.text();try{return JSON.parse(m)}catch{return m}}catch(f){if(f.name==="AbortError")throw f;l=f,d<c&&await new Promise(p=>setTimeout(p,g.retryDelay||1e3))}throw l}function he(t,e){if(e==="none")return null;if(e==="memory"){let n=Ut.get(t);return n&&Date.now()-n.time<(g.cache.ttl||3e5)?n.data:null}let r=e==="local"?localStorage:e==="session"?sessionStorage:null;if(!r)return null;try{let n=r.getItem("nojs_cache_"+t);if(!n)return null;let o=JSON.parse(n);if(Date.now()-o.time<(g.cache.ttl||3e5))return o.data;r.removeItem("nojs_cache_"+t)}catch{}return null}function be(t,e,r){if(r==="none")return;let n={data:e,time:Date.now()};if(r==="memory"){Ut.set(t,n);return}let o=r==="local"?localStorage:r==="session"?sessionStorage:null;if(o)try{o.setItem("nojs_cache_"+t,JSON.stringify(n))}catch{}}var bt=new Map;function $(t){let e=t;for(;e;){if(e.__ctx)return e.__ctx;e=e.parentElement}return P()}function pt(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();)e.currentNode.__declared=!1}function J(t){if(!t)return null;let e=t.startsWith("#")?t.slice(1):t,r=document.getElementById(e);return r&&r.content?r.content.cloneNode(!0):null}function ye(t){return g.sanitize?t.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/on\w+\s*=/gi,"data-blocked=").replace(/javascript:/gi,""):t}function te(t,e){if(t.startsWith("./")){let r=e.parentNode;for(;r;){if(r.__srcBase)return r.__srcBase+t.slice(2);r=r.parentNode}return t.slice(2)}return Zt(t,e)}async function _e(t){let e=t||document,r=e.querySelectorAll("template[src]");if(Y("[LRT] called on",e===document?"document":e.nodeName||"fragment","\u2014 found",r.length,"template[src]",[...r].map(o=>o.getAttribute("src"))),!r.length)return;let n=[...r].map(async o=>{if(o.__srcLoaded){Y("[LRT] SKIP (already loaded):",o.getAttribute("src"));return}o.__srcLoaded=!0;let i=o.getAttribute("src"),s=te(i,o),a=s.substring(0,s.lastIndexOf("/")+1);try{let c=g.templates.cache!==!1,l;if(c&&bt.has(s)?(l=bt.get(s),Y("[LRT] CACHE HIT:",s)):(l=await(await fetch(s)).text(),c&&bt.set(s,l)),o.innerHTML=l,o.content&&(o.content.__srcBase=a),Y("Loaded remote template:",i,"\u2192",s),await _e(o.content||o),!o.hasAttribute("route")&&o.parentNode){let f=[...o.content.childNodes],p=o.parentNode,u=o.nextSibling;p.removeChild(o);for(let m of f)m.nodeType===1&&(m.__srcBase=m.__srcBase||a),p.insertBefore(m,u)}}catch(c){it("Failed to load template:",i,c.message)}});await Promise.all(n)}async function yt(t){let e=t.getAttribute("src");if(t.__srcLoaded){Y("[LTE] SKIP (already loaded):",e);return}Y("[LTE] START fetch:",e,"| route:",t.hasAttribute("route"),"| inDOM:",document.contains(t),"| loading:",t.getAttribute("loading")),t.__srcLoaded=!0;let r=te(e,t),n=r.substring(0,r.lastIndexOf("/")+1),o=null,i=t.getAttribute("loading");if(i&&t.parentNode){let s=i.startsWith("#")?i.slice(1):i,a=document.getElementById(s);a&&a.content&&(o=document.createElement("span"),o.style.cssText="display:contents",o.appendChild(a.content.cloneNode(!0)),t.parentNode.insertBefore(o,t))}try{let s=g.templates.cache!==!1,a;if(s&&bt.has(r)?(a=bt.get(r),Y("[LTE] CACHE HIT:",r)):(a=await(await fetch(r)).text(),s&&bt.set(r,a)),t.innerHTML=a,t.content&&(t.content.__srcBase=n),Y("Loaded remote template:",e,"\u2192",r),!t.hasAttribute("route"))await _e(t.content||t);else if(s&&t.content){let l=[...t.content.querySelectorAll("template[src]")].map(d=>{let f=d.getAttribute("src"),p=te(f,d);if(!bt.has(p))return fetch(p).then(u=>u.text()).then(u=>{bt.set(p,u)}).catch(()=>{})});Promise.all(l)}if(o&&o.remove(),!t.hasAttribute("route")&&t.parentNode){let l=[...t.content.childNodes],d=t.parentNode,f=t.nextSibling;d.removeChild(t);for(let p of l)p.nodeType===1&&(p.__srcBase=p.__srcBase||n),d.insertBefore(p,f)}}catch(s){o&&o.remove(),it("Failed to load template:",e,s.message)}}function Ot(t){(t||document).querySelectorAll("template[include]").forEach(r=>{let n=r.getAttribute("include"),o=document.getElementById(n.startsWith("#")?n.slice(1):n);!o||!o.content||r.replaceWith(o.content.cloneNode(!0))})}async function ve(t){let e=[...document.querySelectorAll("template[src]")],r=e.filter(o=>!o.__srcLoaded&&o.getAttribute("lazy")==="priority");await Promise.all(r.map(yt));let n=e.filter(o=>{if(o.__srcLoaded)return!1;let i=o.getAttribute("lazy");return i==="ondemand"||i==="priority"?!1:o.hasAttribute("route")?t!=null&&o.getAttribute("route")===t:!0});await Promise.all(n.map(yt))}function Ee(){let e=[...document.querySelectorAll("template[src]")].filter(r=>r.__srcLoaded||r.getAttribute("lazy")==="ondemand"?!1:r.hasAttribute("route"));return Promise.all(e.map(yt))}K();ft();var Dt=new Map;function I(t,e){Dt.set(t,{priority:e.priority??50,init:e.init})}function ze(t){if(Dt.has(t))return{directive:Dt.get(t),match:t};let e=["class-*","on:*","style-*","bind-*"];for(let r of e){let n=r.replace("*","");if(t.startsWith(n)&&Dt.has(r))return{directive:Dt.get(r),match:r}}return null}function xe(t){if(t.__declared)return;t.__declared=!0;let e=[];for(let n of[...t.attributes]){let o=ze(n.name);o&&e.push({name:n.name,value:n.value,priority:o.directive.priority,init:o.directive.init})}e.sort((n,o)=>n.priority-o.priority);let r=ct;for(let n of e)zt(t),n.init(t,n.name,n.value);zt(r),e.length>0&&at("directive:init",{element:t.tagName?.toLowerCase(),directives:e.map(n=>({name:n.name,value:n.value}))})}function O(t){if(!t)return;t.nodeType===1&&!t.__declared&&xe(t);let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let r=e.currentNode;r.tagName==="TEMPLATE"||r.tagName==="SCRIPT"||r.__declared||xe(r)}}function we(t){let e=t.__ctx?.__raw?.__devtoolsId;if(t.__ctx&&t.__ctx.__listeners){for(let r of t.__ctx.__listeners)It.delete(r),vt.delete(r);t.__ctx.__listeners.clear()}t.__disposers&&(t.__disposers.forEach(r=>r()),t.__disposers=null),t.__declared=!1,e!=null&&(xt.delete(e),at("ctx:disposed",{id:e,elementTag:t.tagName?.toLowerCase()}))}function Ae(t){if(!t)return;we(t);let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();)we(e.currentNode)}K();var Le=!1;function Ce(){if(Le||typeof document>"u")return;Le=!0;let t=`
|
|
10
10
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
11
11
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
|
|
12
12
|
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
|
|
@@ -21,7 +21,7 @@ ${f}`)(e,d,...a),typeof t=="string"&&t.includes("$store")&&wt()}catch(n){st("Exp
|
|
|
21
21
|
@keyframes zoomOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.5); } }
|
|
22
22
|
@keyframes bounceIn { 0% { opacity: 0; transform: scale(0.3); } 50% { opacity: 1; transform: scale(1.05); } 70% { transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } }
|
|
23
23
|
@keyframes bounceOut { 0% { opacity: 1; transform: scale(1); } 20% { transform: scale(0.9); } 50%,55% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(0.3); } }
|
|
24
|
-
`.trim(),e=document.createElement("style");e.setAttribute("data-nojs-animations",""),e.textContent=t,document.head.appendChild(e)}function Lt(t,e,r,n){fe();let o=n||1e3;if(e){let i=t.firstElementChild||t;i.classList.add(e),n&&(i.style.animationDuration=n+"ms"),i.addEventListener("animationend",()=>i.classList.remove(e),{once:!0})}if(r){let i=t.firstElementChild||t;i.classList.add(r+"-enter",r+"-enter-active"),requestAnimationFrame(()=>{i.classList.remove(r+"-enter"),i.classList.add(r+"-enter-to");let s=()=>{i.classList.remove(r+"-enter-active",r+"-enter-to")};i.addEventListener("transitionend",s,{once:!0}),setTimeout(s,o)})}}function Bt(t,e,r,n,o){fe();let i=o||2e3;if(!t.firstElementChild&&!t.childNodes.length){n();return}if(e){let s=t.firstElementChild||t;s.classList.add(e),o&&(s.style.animationDuration=o+"ms");let a=!1,c=()=>{a||(a=!0,s.classList.remove(e),n())};s.addEventListener("animationend",c,{once:!0}),setTimeout(c,i);return}if(r){let s=t.firstElementChild||t;s.classList.add(r+"-leave",r+"-leave-active"),requestAnimationFrame(()=>{s.classList.remove(r+"-leave"),s.classList.add(r+"-leave-to");let a=!1,c=()=>{a||(a=!0,s.classList.remove(r+"-leave-active",r+"-leave-to"),n())};s.addEventListener("transitionend",c,{once:!0}),setTimeout(c,i)});return}n()}function pe(){let t=[],e={path:"",params:{},query:{},hash:""},r=new Set,n=new Map;function o(p){let u=t.find(m=>m.path===p);return u||(u={path:p,outlets:{}},t.push(u)),u}function i(p){let u={};return new URLSearchParams(p).forEach((m,b)=>{u[b]=m}),u}function s(p){for(let u of t){let m=[],b=u.path.replace(/:(\w+)/g,(y,E)=>(m.push(E),"([^/]+)")),x=new RegExp("^"+b+"$"),w=p.match(x);if(w){let y={};return m.forEach((E,_)=>{y[E]=w[_+1]}),{route:u,params:y}}}return null}async function a(p,u=!1){let m=p.indexOf("#"),b=m>=0?p.slice(m+1):"",x=m>=0?p.slice(0,m):p,[w,y=""]=x.split("?");e={path:w,params:{},query:i(y),hash:b?"#"+b:""};let E=s(w);if(E){e.params=E.params;let _=E.route.outlets?.default,C=_?.getAttribute("guard"),A=_?.getAttribute("redirect");if(C){let v=P({},null);if(v.__raw.$store=V,v.__raw.$route=e,!L(C,v)&&A){await a(A,!0);return}}}if(h.router.mode==="hash"){let _="#"+p;u?window.location.replace(_):window.location.hash=p}else{let _=h.router.base.replace(/\/$/,"")+p;u?window.history.replaceState({},"",_):window.history.pushState({},"",_)}if(await c(E),r.forEach(_=>_(e)),e.hash){let _=e.hash.slice(1);requestAnimationFrame(()=>{let C=document.getElementById(_);C&&C.scrollIntoView({behavior:"smooth"})})}}async function c(p){let u=document.querySelectorAll("[route-view]");for(let b of u){let x=b.getAttribute("route-view"),w=x&&x.trim()!==""?x.trim():"default",y=p?.route?.outlets?.[w],E=h.router.templates||"";if(!y&&(b.hasAttribute("src")||E)){let C=(b.getAttribute("src")||E).replace(/\/?$/,"/"),A=b.getAttribute("ext")||h.router.ext||".html",v=b.getAttribute("route-index")||"index",j=e.path==="/"?v:e.path.replace(/^\//,""),S=C+j+A,D=w+":"+S;n.has(D)?y=n.get(D):(y=document.createElement("template"),y.setAttribute("src",S),y.setAttribute("route",e.path),document.body.appendChild(y),n.set(D,y),z("[ROUTER] File-based route:",e.path,"\u2192",S)),b.hasAttribute("i18n-ns")&&!y.getAttribute("i18n-ns")&&y.setAttribute("i18n-ns",j)}if(de(b),b.innerHTML="",y){y.getAttribute("src")&&!y.__srcLoaded&&(z("Loading route template on demand:",y.getAttribute("src")),await bt(y));let _=y.getAttribute("i18n-ns");if(_){let{_loadI18nNamespace:D}=await Promise.resolve().then(()=>(pt(),te));await D(_)}let C=y.content.cloneNode(!0),A=P({$route:e},I(b)),v=document.createElement("div");v.style.display="contents",v.__ctx=A,y.content.__srcBase&&(v.__srcBase=y.content.__srcBase),v.appendChild(C),b.appendChild(v),kt(v);let j=[...v.querySelectorAll("template[src]")];z("[ROUTER] nested templates found in wrapper:",j.length,j.map(D=>D.getAttribute("src")+(D.__srcLoaded?"[LOADED]":"[NEW]"))),await Promise.all(j.map(bt)),z("[ROUTER] all nested loads done for route:",e.path);let S=b.getAttribute("transition");S&&Lt(v,null,S),dt(v),M(v)}}document.querySelectorAll("[route]").forEach(b=>{let x=b.getAttribute("route"),w=b.getAttribute("route-active")||"active",y=b.getAttribute("route-active-exact");if(y)b.classList.toggle(y,e.path===x);else if(w&&!b.hasAttribute("route-active-exact")){let E=x==="/"?e.path==="/":e.path.startsWith(x);b.classList.toggle(w,E)}});let m=h.router.scrollBehavior;m==="top"?window.scrollTo(0,0):m==="smooth"&&window.scrollTo({top:0,behavior:"smooth"})}function l(p,u){u.scrollIntoView({behavior:"smooth"});let m='a[href="#'+p+'"]';document.querySelectorAll('a[href^="#"]').forEach(b=>{b.hasAttribute("route")||b.classList.toggle("active",b.matches(m))})}function d(){let p=document.querySelectorAll("[route-view]");for(let u of p){let m=u.getAttribute("src")||h.router.templates||"";if(!m)continue;let b=m.replace(/\/?$/,"/"),x=u.getAttribute("ext")||h.router.ext||".html",w=u.getAttribute("route-index")||"index",y=(u.getAttribute("route-view")||"").trim()||"default",E=new Map;document.querySelectorAll("[route]:not([route-view])").forEach(A=>{let v=A.getAttribute("route");if(!v)return;let j=v.split("?")[0].split("#")[0],S=A.getAttribute("lazy"),D=E.get(j);(!E.has(j)||S==="priority"||D==="ondemand"&&S!=="ondemand")&&E.set(j,S)});let _=[],C=[];for(let[A,v]of E){if(v==="ondemand"||A===e.path)continue;let j=A==="/"?w:A.replace(/^\//,""),S=b+j+x,D=y+":"+S;if(n.has(D))continue;let J=document.createElement("template");J.setAttribute("src",S),J.setAttribute("route",A),document.body.appendChild(J),n.set(D,J),z("[ROUTER] Prefetch:",A,"\u2192",S,v==="priority"?"(priority)":"(background)"),u.hasAttribute("i18n-ns")&&J.setAttribute("i18n-ns",j),v==="priority"?_.push(J):C.push(J)}(_.length||C.length)&&Promise.all(_.map(bt)).then(()=>{C.forEach(bt)})}}return{get current(){return e},push(p){return a(p)},replace(p){return a(p,!0)},back(){window.history.back()},forward(){window.history.forward()},on(p){return r.add(p),()=>r.delete(p)},register(p,u,m="default"){let b=o(p);b.outlets[m]=u},async init(){if(document.querySelectorAll("template[route]").forEach(p=>{let u=p.getAttribute("route"),m=p.getAttribute("outlet")||"default",b=o(u);b.outlets[m]=p}),document.addEventListener("click",p=>{let u=p.target.closest("[route]");if(u&&!u.hasAttribute("route-view")){p.preventDefault();let m=u.getAttribute("route");a(m);return}if(h.router.mode==="hash"){let m=p.target.closest('a[href^="#"]');if(m&&!m.hasAttribute("route")){let x=m.getAttribute("href").slice(1);if(x&&!x.startsWith("/")){let w=document.getElementById(x);w&&(p.preventDefault(),l(x,w))}}}}),h.router.mode==="hash"){window.addEventListener("hashchange",()=>{let u=window.location.hash.slice(1)||"/";if(!u.startsWith("/")){let b=document.getElementById(u);b&&(l(u,b),window.history.replaceState(null,"","#"+e.path));return}let[m]=u.split("?");m!==e.path&&a(u,!0)});let p=window.location.hash.slice(1)||"/";await a(p,!0)}else{window.addEventListener("popstate",()=>{let u=window.location.pathname.replace(h.router.base,"")||"/";a(u,!0)});let p=window.location.pathname.replace(h.router.base,"")||"/";await a(p,!0)}d()}}}X();k.uppercase=t=>String(t??"").toUpperCase();k.lowercase=t=>String(t??"").toLowerCase();k.capitalize=t=>String(t??"").replace(/\b\w/g,e=>e.toUpperCase());k.truncate=(t,e=100)=>{let r=String(t??"");return r.length>e?r.slice(0,e)+"...":r};k.trim=t=>String(t??"").trim();k.stripHtml=t=>String(t??"").replace(/<[^>]*>/g,"");k.slugify=t=>String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");k.nl2br=t=>String(t??"").replace(/\n/g,"<br>");k.encodeUri=t=>encodeURIComponent(String(t??""));k.number=(t,e=0)=>{let r=Number(t);return isNaN(r)?t:r.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})};k.currency=(t,e="USD")=>{let r=Number(t);if(isNaN(r))return t;try{return r.toLocaleString(void 0,{style:"currency",currency:e})}catch{return`${e} ${r.toFixed(2)}`}};k.percent=(t,e=0)=>{let r=Number(t);return isNaN(r)?t:(r*100).toFixed(e)+"%"};k.filesize=t=>{let e=Number(t);if(isNaN(e))return t;let r=["B","KB","MB","GB","TB"],n=0,o=e;for(;o>=1024&&n<r.length-1;)o/=1024,n++;return o.toFixed(n>0?1:0)+" "+r[n]};k.ordinal=t=>{let e=Number(t);if(isNaN(e))return t;let r=["th","st","nd","rd"],n=e%100;return e+(r[(n-20)%10]||r[n]||r[0])};k.count=t=>Array.isArray(t)?t.length:0;k.first=t=>Array.isArray(t)?t[0]:t;k.last=t=>Array.isArray(t)?t[t.length-1]:t;k.join=(t,e=", ")=>Array.isArray(t)?t.join(e):t;k.reverse=t=>Array.isArray(t)?[...t].reverse():t;k.unique=t=>Array.isArray(t)?[...new Set(t)]:t;k.pluck=(t,e)=>Array.isArray(t)?t.map(r=>r?.[e]):t;k.sortBy=(t,e)=>{if(!Array.isArray(t))return t;let r=e?.startsWith("-"),n=r?e.slice(1):e;return[...t].sort((o,i)=>{let s=o?.[n],a=i?.[n],c=s<a?-1:s>a?1:0;return r?-c:c})};k.where=(t,e,r)=>Array.isArray(t)?t.filter(n=>n?.[e]===r):t;k.date=(t,e="short")=>{let r=new Date(t);if(isNaN(r))return t;let n=e==="long"?{dateStyle:"long"}:e==="full"?{dateStyle:"full"}:{dateStyle:"short"};return r.toLocaleDateString(void 0,n)};k.datetime=t=>{let e=new Date(t);return isNaN(e)?t:e.toLocaleString()};k.relative=t=>{let e=new Date(t);if(isNaN(e))return t;let r=(Date.now()-e.getTime())/1e3;return r<60?"just now":r<3600?Math.floor(r/60)+"m ago":r<86400?Math.floor(r/3600)+"h ago":r<2592e3?Math.floor(r/86400)+"d ago":e.toLocaleDateString()};k.fromNow=t=>{let e=new Date(t);if(isNaN(e))return t;let r=(e.getTime()-Date.now())/1e3;return r<0?k.relative(t):r<60?"in a moment":r<3600?"in "+Math.floor(r/60)+"m":r<86400?"in "+Math.floor(r/3600)+"h":"in "+Math.floor(r/86400)+"d"};k.default=(t,e="")=>t==null||t===""?e:t;k.json=(t,e=2)=>JSON.stringify(t,null,e);k.debug=t=>(console.log("[No.JS debug]",t),t);k.keys=t=>t&&typeof t=="object"?Object.keys(t):[];k.values=t=>t&&typeof t=="object"?Object.values(t):[];X();$("state",{priority:0,init(t,e,r){let n=L(r,P())||{},o=t.parentElement?I(t.parentElement):null,i=P(n,o);t.__ctx=i;let s=t.getAttribute("persist"),a=t.getAttribute("persist-key");if(s&&a){let c=s==="localStorage"?localStorage:s==="sessionStorage"?sessionStorage:null;if(c){try{let l=c.getItem("nojs_state_"+a);if(l){let d=JSON.parse(l);for(let[f,p]of Object.entries(d))i.$set(f,p)}}catch{}i.$watch(()=>{try{c.setItem("nojs_state_"+a,JSON.stringify(i.__raw))}catch{}})}}z("state",n)}});$("store",{priority:0,init(t,e,r){let n=t.getAttribute("value");if(r){if(!V[r]){let o=n?L(n,P())||{}:{};V[r]=P(o)}z("store",r)}}});$("computed",{priority:2,init(t,e,r){let n=t.getAttribute("expr");if(!r||!n)return;let o=I(t);function i(){let s=L(n,o);o.$set(r,s)}q(n,o,i),i()}});$("watch",{priority:2,init(t,e,r){let n=I(t),o=t.getAttribute("on:change"),i=L(r,n);q(r,n,()=>{let s=L(r,n);if(s!==i){let a=i;i=s,o&&Z(o,n,{$old:a,$new:s})}})}});X();var $e=["get","post","put","patch","delete"];for(let t of $e)$(t,{priority:1,init(e,r,n){let o=e.getAttribute("as")||"data",i=e.getAttribute("loading"),s=e.getAttribute("error"),a=e.getAttribute("empty"),c=e.getAttribute("success"),l=e.getAttribute("then"),d=e.getAttribute("redirect"),f=e.getAttribute("confirm"),p=parseInt(e.getAttribute("refresh"))||0,u=e.getAttribute("cached"),m=e.hasAttribute("cached")?u||"memory":"none",b=e.getAttribute("body"),x=e.getAttribute("headers"),w=e.getAttribute("var"),y=e.getAttribute("into"),E=parseInt(e.getAttribute("retry"))||h.retries,_=parseInt(e.getAttribute("retry-delay"))||h.retryDelay||1e3,C=e.getAttribute("params"),A=e.parentElement?I(e.parentElement):P(),v=e.__ctx||P({},A);e.__ctx=v;let j=[...e.childNodes].map(R=>R.cloneNode(!0)),S=null;async function D(){if(S&&S.abort(),S=new AbortController,f&&!window.confirm(f))return;let R=gt(n,v);if(C){let U=L(C,v);if(U&&typeof U=="object"){let B=R.includes("?")?"&":"?",O=new URLSearchParams(U).toString();O&&(R+=B+O)}}let lt=t+":"+R;if(t==="get"){let U=re(lt,m);if(U!=null){v.$set(o,U),dt(e),M(e);return}}if(i){let U=K(i);U&&(e.innerHTML="",e.appendChild(U),M(e))}try{let U=null;if(b){let T=gt(b,v);try{U=JSON.parse(T)}catch{U=T}}if(e.tagName==="FORM"){let T=new FormData(e);U=Object.fromEntries(T.entries())}let B=x?JSON.parse(x):{},O=h.retries,F=h.retryDelay;h.retries=E,h.retryDelay=_;let N;try{N=await Nt(R,t,U,B,e,S.signal)}finally{h.retries=O,h.retryDelay=F}if(t==="get"&&ne(lt,N,m),a&&(N==null||Array.isArray(N)&&N.length===0)){let T=K(a);T&&(e.innerHTML="",e.appendChild(T),M(e));return}if(v.$set(o,N),y&&(V[y]||(V[y]=P({})),V[y].$set(o,N),wt()),c){let T=K(c);if(T){e.innerHTML="";let ut=document.getElementById(c.replace("#",""))?.getAttribute("var")||w||"result",ot=P({[ut]:N},v),G=document.createElement("div");G.style.display="contents",G.__ctx=ot,G.appendChild(T),e.appendChild(G),M(G)}}else{e.innerHTML="";for(let T of j)e.appendChild(T.cloneNode(!0));dt(e),M(e)}l&&Z(l,v,{result:N}),d&&et&&et.push(d),Dt("fetch:success",{url:R,data:N})}catch(U){if(U.name==="AbortError")return;if(st(`${t.toUpperCase()} ${R} failed:`,U.message),Dt("fetch:error",{url:R,error:U}),Dt("error",{url:R,error:U}),s){let B=K(s);if(B){e.innerHTML="";let F=document.getElementById(s.replace("#",""))?.getAttribute("var")||"err",N=P({[F]:{message:U.message,status:U.status,body:U.body}},v),T=document.createElement("div");T.style.display="contents",T.__ctx=N,T.appendChild(B),e.appendChild(T),M(T)}}}}if(e.tagName==="FORM"&&t!=="get"?e.addEventListener("submit",R=>{R.preventDefault(),D()}):t==="get"?D():e.addEventListener("click",R=>{R.preventDefault(),D()}),/\{[^}]+\}/.test(n)){let B=function(){let F=gt(n,v);F!==lt&&(lt=F,U&&clearTimeout(U),R>0?U=setTimeout(D,R):D())},R=parseInt(e.getAttribute("debounce"))||0,lt=gt(n,v),U=null,O=A;for(;O&&O.__isProxy;)O.$watch(B),O=O.$parent}if(p>0){let R=setInterval(D,p);Q(()=>clearInterval(R))}}});X();$("bind",{priority:20,init(t,e,r){let n=I(t);function o(){let i=L(r,n);t.textContent=i!=null?String(i):""}q(r,n,o),o()}});$("bind-html",{priority:20,init(t,e,r){let n=I(t);function o(){let i=L(r,n);i!=null&&(t.innerHTML=oe(String(i)))}q(r,n,o),o()}});$("bind-*",{priority:20,init(t,e,r){let n=e.replace("bind-",""),o=I(t);n==="value"&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&t.addEventListener("input",()=>{let s=t.type==="number"?Number(t.value):t.value;Z(`${r} = ${JSON.stringify(s)}`,o)});function i(){let s=L(r,o);if(["disabled","readonly","checked","selected","hidden","required"].includes(n)){s?t.setAttribute(n,""):t.removeAttribute(n),n in t&&(t[n]=!!s);return}s!=null?t.setAttribute(n,String(s)):t.removeAttribute(n)}q(r,o,i),i()}});$("model",{priority:20,init(t,e,r){let n=I(t),o=t.tagName,i=t.type;function s(){let c=L(r,n);o==="INPUT"&&i==="checkbox"?t.checked=!!c:o==="INPUT"&&i==="radio"?t.checked=t.value===String(c):t.value=c!=null?String(c):""}let a=o==="SELECT"||i==="checkbox"||i==="radio"?"change":"input";t.addEventListener(a,()=>{let c;i==="checkbox"?c=t.checked:i==="number"||i==="range"?c=Number(t.value):c=t.value,Z(`${r} = __val`,n,{__val:c})}),q(r,n,s),s()}});X();$("if",{priority:10,init(t,e,r){let n=I(t),o=t.getAttribute("then"),i=t.getAttribute("else"),s=t.getAttribute("animate-enter")||t.getAttribute("animate"),a=t.getAttribute("animate-leave"),c=t.getAttribute("transition"),l=parseInt(t.getAttribute("animate-duration"))||0,d=[...t.childNodes].map(m=>m.cloneNode(!0)),f;function p(){let m=!!L(r,n);m!==f&&(f=m,a||c?Bt(t,a,c,()=>u(m),l):u(m))}function u(m){if(m)if(o){let b=K(o);b&&(t.innerHTML="",t.appendChild(b))}else{t.innerHTML="";for(let b of d)t.appendChild(b.cloneNode(!0))}else if(i){let b=K(i);b&&(t.innerHTML="",t.appendChild(b))}else t.innerHTML="";dt(t),M(t),(s||c)&&Lt(t,s,c,l)}q(r,n,p),p()}});$("else-if",{priority:10,init(t,e,r){let n=I(t),o=t.getAttribute("then"),i=[...t.childNodes].map(a=>a.cloneNode(!0));function s(){let a=t.previousElementSibling;for(;a;){let l=a.getAttribute("if")||a.getAttribute("else-if");if(l){if(L(l,n)){t.innerHTML="",t.style.display="none";return}}else break;a=a.previousElementSibling}let c=!!L(r,n);if(t.style.display="",c){if(o){let l=K(o);l&&(t.innerHTML="",t.appendChild(l))}else{t.innerHTML="";for(let l of i)t.appendChild(l.cloneNode(!0))}dt(t),M(t)}else t.innerHTML=""}q(r,n,s),s()}});$("else",{priority:10,init(t){if(t.hasAttribute("if"))return;let e=I(t),r=t.getAttribute("then"),n=[...t.childNodes].map(i=>i.cloneNode(!0));function o(){let i=t.previousElementSibling;for(;i;){let s=i.getAttribute("if")||i.getAttribute("else-if");if(s){if(L(s,e)){t.innerHTML="",t.style.display="none";return}}else break;i=i.previousElementSibling}if(t.style.display="",r){let s=K(r);s&&(t.innerHTML="",t.appendChild(s))}else{t.innerHTML="";for(let s of n)t.appendChild(s.cloneNode(!0))}dt(t),M(t)}q("",e,o),o()}});$("show",{priority:20,init(t,e,r){let n=I(t),o=t.getAttribute("animate-enter")||t.getAttribute("animate"),i=t.getAttribute("animate-leave"),s=t.getAttribute("transition"),a=parseInt(t.getAttribute("animate-duration"))||0,c;function l(){let d=!!L(r,n);d!==c&&(c=d,d?(t.style.display="",(o||s)&&Lt(t,o,s,a)):i||s?Bt(t,i,s,()=>{t.style.display="none"},a):t.style.display="none")}q(r,n,l),l()}});$("hide",{priority:20,init(t,e,r){let n=I(t),o=t.getAttribute("animate-enter")||t.getAttribute("animate"),i=t.getAttribute("animate-leave"),s=t.getAttribute("transition"),a=parseInt(t.getAttribute("animate-duration"))||0,c;function l(){let d=!L(r,n);d!==c&&(c=d,d?(t.style.display="",(o||s)&&Lt(t,o,s,a)):i||s?Bt(t,i,s,()=>{t.style.display="none"},a):t.style.display="none")}q(r,n,l),l()}});$("switch",{priority:10,init(t,e,r){let n=I(t);function o(){let i=L(r,n),s=!1;for(let a of[...t.children]){let c=a.getAttribute("case"),l=a.hasAttribute("default"),d=a.getAttribute("then");if(c){let f=c.split(",").map(p=>L(p.trim(),n));if(!s&&f.includes(i)){if(s=!0,a.style.display="",d){let p=K(d);p&&(a.innerHTML="",a.appendChild(p)),a.__declared=!1,M(a)}}else a.style.display="none"}else if(l&&(a.style.display=s?"none":"",!s&&d)){let f=K(d);f&&(a.innerHTML="",a.appendChild(f)),a.__declared=!1,M(a)}}}q(r,n,o),o()}});X();$("each",{priority:10,init(t,e,r){let n=I(t),o=r.match(/^(\w+)\s+in\s+(\S+)$/);if(!o)return;let[,i,s]=o,a=t.getAttribute("template"),c=t.getAttribute("else"),l=t.getAttribute("key"),d=t.getAttribute("animate-enter")||t.getAttribute("animate"),f=t.getAttribute("animate-leave"),p=parseInt(t.getAttribute("animate-stagger"))||0,u=parseInt(t.getAttribute("animate-duration"))||0,m=null;function b(){let w=/[\[\]()\s+\-*\/!?:&|]/.test(s)?L(s,n):nt(s,n);if(!Array.isArray(w))return;if(w===m&&w.length>0&&t.children.length>0){for(let E of t.children)E.__ctx&&E.__ctx.$notify&&E.__ctx.$notify();return}if(m=w,w.length===0&&c){let E=K(c);E&&(t.innerHTML="",t.appendChild(E),M(t));return}let y=a?document.getElementById(a):null;if(y)if(f&&t.children.length>0){let E=[...t.children],_=E.length;E.forEach(C=>{let A=C.firstElementChild||C;A.classList.add(f);let v=()=>{A.classList.remove(f),_--,_<=0&&x(y,w)};A.addEventListener("animationend",v,{once:!0}),setTimeout(v,u||2e3)})}else x(y,w)}function x(w,y){let E=y.length;t.innerHTML="",y.forEach((_,C)=>{let A={[i]:_,$index:C,$count:E,$first:C===0,$last:C===E-1,$even:C%2===0,$odd:C%2!==0},v=P(A,n),j=w.content.cloneNode(!0),S=document.createElement("div");if(S.style.display="contents",S.__ctx=v,S.appendChild(j),t.appendChild(S),M(S),d){let D=S.firstElementChild;D&&(D.classList.add(d),D.addEventListener("animationend",()=>D.classList.remove(d),{once:!0}),p&&(D.style.animationDelay=C*p+"ms"))}})}q(r,n,b),b()}});$("foreach",{priority:10,init(t,e,r){let n=I(t),o=t.getAttribute("from"),i=t.getAttribute("index")||"$index",s=t.getAttribute("else"),a=t.getAttribute("filter"),c=t.getAttribute("sort"),l=parseInt(t.getAttribute("limit"))||1/0,d=parseInt(t.getAttribute("offset"))||0,f=t.getAttribute("template"),p=t.getAttribute("animate-enter")||t.getAttribute("animate"),u=t.getAttribute("animate-leave"),m=parseInt(t.getAttribute("animate-stagger"))||0,b=parseInt(t.getAttribute("animate-duration"))||0;if(!o||!r)return;let x=f?null:t.cloneNode(!0);function w(){let y=nt(o,n);if(!Array.isArray(y))return;if(a&&(y=y.filter((A,v)=>{let j=P({[r]:A,[i]:v},n);return!!L(a,j)})),c){let A=c.startsWith("-"),v=A?c.slice(1):c;y=[...y].sort((j,S)=>{let D=nt(v,j)??j?.[v],J=nt(v,S)??S?.[v],R=D<J?-1:D>J?1:0;return A?-R:R})}if(y=y.slice(d,d+l),y.length===0&&s){let A=K(s);A&&(t.innerHTML="",t.appendChild(A),M(t));return}let E=f?document.getElementById(f):null,_=y.length;function C(){t.innerHTML="",y.forEach((A,v)=>{let j={[r]:A,[i]:v,$index:v,$count:_,$first:v===0,$last:v===_-1,$even:v%2===0,$odd:v%2!==0},S=P(j,n),D;E?D=E.content.cloneNode(!0):D=x.cloneNode(!0);let J=document.createElement("div");if(J.style.display="contents",J.__ctx=S,J.appendChild(D),t.appendChild(J),M(J),p){let R=J.firstElementChild;R&&(R.classList.add(p),R.addEventListener("animationend",()=>R.classList.remove(p),{once:!0}),m&&(R.style.animationDelay=v*m+"ms"))}})}if(u&&t.children.length>0){let A=[...t.children],v=A.length;A.forEach(j=>{let S=j.firstElementChild||j;S.classList.add(u);let D=()=>{S.classList.remove(u),v--,v<=0&&C()};S.addEventListener("animationend",D,{once:!0}),setTimeout(D,b||2e3)})}else C()}q(o,n,w),w()}});X();pt();$("class-*",{priority:20,init(t,e,r){let n=e.replace("class-",""),o=I(t);if(n==="map"){let s=function(){let a=L(r,o);if(a&&typeof a=="object")for(let[c,l]of Object.entries(a))c.split(/\s+/).filter(Boolean).forEach(f=>t.classList.toggle(f,!!l))};q(r,o,s),s();return}if(n==="list"){let a=function(){let c=L(r,o);if(Array.isArray(c)){s.forEach(d=>{d&&t.classList.remove(d)});let l=c.filter(Boolean);l.forEach(d=>t.classList.add(d)),s=l}},s=[];q(r,o,a),a();return}function i(){t.classList.toggle(n,!!L(r,o))}q(r,o,i),(r.includes("$i18n")||r.includes("NoJS.locale"))&&$t(i),i()}});$("style-*",{priority:20,init(t,e,r){let n=e.replace("style-",""),o=I(t);if(n==="map"){let a=function(){let c=L(r,o);if(c&&typeof c=="object")for(let[l,d]of Object.entries(c))t.style[l]=d??""};q(r,o,a),a();return}let i=n.replace(/-([a-z])/g,(a,c)=>c.toUpperCase());function s(){let a=L(r,o);t.style[i]=a!=null?String(a):""}q(r,o,s),s()}});X();$("on:*",{priority:20,init(t,e,r){let n=I(t),o=e.replace("on:","").split("."),i=o[0],s=new Set(o.slice(1));if(i==="mounted"){requestAnimationFrame(()=>Z(r,n,{$el:t}));return}if(i==="init"){Z(r,n,{$el:t});return}if(i==="updated"){let f=new MutationObserver(()=>{Z(r,n,{$el:t})});f.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),Q(()=>f.disconnect());return}if(i==="error"){let f=p=>{(t.contains(p.target)||p.target===t)&&Z(r,n,{$el:t,$error:p.error||p.message})};window.addEventListener("error",f),Q(()=>window.removeEventListener("error",f));return}if(i==="unmounted"){let f=new MutationObserver(p=>{for(let u of p)for(let m of u.removedNodes)if(m===t||m.contains?.(t)){Z(r,n,{$el:t}),f.disconnect();return}});t.parentElement&&f.observe(t.parentElement,{childList:!0,subtree:!0}),Q(()=>f.disconnect());return}let a=0,c=0;for(let f of s)/^\d+$/.test(f)&&(s.has("debounce")?a=parseInt(f):s.has("throttle")&&(c=parseInt(f)));let l=f=>{if(i==="keydown"||i==="keyup"||i==="keypress"){let p=["enter","escape","tab","space","delete","backspace","up","down","left","right","ctrl","alt","shift","meta"];for(let u of s)if(p.includes(u)&&(u==="enter"&&f.key!=="Enter"||u==="escape"&&f.key!=="Escape"||u==="tab"&&f.key!=="Tab"||u==="space"&&f.key!==" "||u==="delete"&&f.key!=="Delete"&&f.key!=="Backspace"||u==="up"&&f.key!=="ArrowUp"||u==="down"&&f.key!=="ArrowDown"||u==="left"&&f.key!=="ArrowLeft"||u==="right"&&f.key!=="ArrowRight"||u==="ctrl"&&!f.ctrlKey||u==="alt"&&!f.altKey||u==="shift"&&!f.shiftKey||u==="meta"&&!f.metaKey))return}s.has("prevent")&&f.preventDefault(),s.has("stop")&&f.stopPropagation(),!(s.has("self")&&f.target!==t)&&Z(r,n,{$event:f,$el:t})};if(a>0){let f=l,p;l=u=>{clearTimeout(p),p=setTimeout(()=>f(u),a)}}if(c>0){let f=l,p=0;l=u=>{let m=Date.now();m-p>=c&&(p=m,f(u))}}let d={};s.has("once")&&(d.once=!0),t.addEventListener(i,l,d)}});$("trigger",{priority:20,init(t,e,r){let n=I(t),o=t.getAttribute("trigger-data");t.addEventListener("click",()=>{let i=o?L(o,n):null;t.dispatchEvent(new CustomEvent(r,{detail:i,bubbles:!0}))})}});X();$("ref",{priority:5,init(t,e,r){ft[r]=t,Q(()=>{ft[r]===t&&delete ft[r]})}});$("use",{priority:10,init(t,e,r){let n=I(t),o=K(r);if(!o)return;let i={};for(let d of[...t.attributes])if(d.name.startsWith("var-")){let f=d.name.replace("var-","");i[f]=L(d.value,n)}let s=P(i,n),a={};for(let d of[...t.children]){let f=d.getAttribute("slot")||"default";a[f]||(a[f]=document.createDocumentFragment()),a[f].appendChild(d.cloneNode(!0))}let c=o.querySelectorAll("slot");for(let d of c){let f=d.getAttribute("name")||"default";a[f]&&d.replaceWith(a[f])}t.innerHTML="";let l=document.createElement("div");l.style.display="contents",l.__ctx=s,l.appendChild(o),t.appendChild(l),M(l)}});$("call",{priority:20,init(t,e,r){let n=I(t),o=t.getAttribute("method")||"get",i=t.getAttribute("as"),s=t.getAttribute("into"),a=t.getAttribute("success"),c=t.getAttribute("error"),l=t.getAttribute("then"),d=t.getAttribute("confirm"),f=t.getAttribute("body");t.addEventListener("click",async p=>{if(p.preventDefault(),d&&!window.confirm(d))return;let u=gt(r,n);try{let m=null;if(f){let x=gt(f,n);try{m=JSON.parse(x)}catch{m=x}}let b=await Nt(u,o,m,{},t);if(i&&n.$set(i,b),i&&s&&(V[s]||(V[s]=P({})),V[s].$set(i,b),wt()),l&&Z(l,n,{result:b}),a){let x=K(a);if(x){let y=document.getElementById(a.replace("#",""))?.getAttribute("var")||"result",E=P({[y]:b},n),_=t.closest("[route-view]")||t.parentElement,C=document.createElement("div");C.style.display="contents",C.__ctx=E,C.appendChild(x),_.appendChild(C),M(C)}}}catch(m){if(c){let b=K(c);if(b){let w=document.getElementById(c.replace("#",""))?.getAttribute("var")||"err",y=P({[w]:{message:m.message,status:m.status}},n),E=t.parentElement,_=document.createElement("div");_.style.display="contents",_.__ctx=y,_.appendChild(b),E.appendChild(_),M(_)}}}})}});X();function me(t,e,r){let n=e.split("|").map(o=>o.trim());for(let o of n){let[i,...s]=o.split(":"),a=_t[i];if(a){let c=a(t,...s,r);if(c!==!0&&c)return c}else switch(i){case"required":if(t==null||String(t).trim()==="")return"Required";break;case"email":if(t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return"Invalid email";break;case"url":try{new URL(t)}catch{return"Invalid URL"}break;case"min":if(Number(t)<Number(s[0]))return`Minimum value is ${s[0]}`;break;case"max":if(Number(t)>Number(s[0]))return`Maximum value is ${s[0]}`;break;case"between":{let c=Number(t);if(c<Number(s[0])||c>Number(s[1]))return`Must be between ${s[0]} and ${s[1]}`;break}case"match":if(t!==r[s[0]])return`Must match ${s[0]}`;break;case"phone":if(!/^[\d\s\-+()]{7,15}$/.test(t))return"Invalid phone number";break;case"cpf":if(!/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/.test(t))return"Invalid CPF";break;case"cnpj":if(!/^\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2}$/.test(t))return"Invalid CNPJ";break;case"creditcard":if(!/^\d{13,19}$/.test(t.replace(/\s|-/g,"")))return"Invalid card number";break;case"custom":if(s[0]&&_t[s[0]]){let c=_t[s[0]](t,r);if(c!==!0&&c)return c}break}}return null}$("validate",{priority:30,init(t,e,r){let n=I(t);if(t.tagName==="FORM"){let i=function(){let s={},a={},c=!0;for(let l of t.querySelectorAll("input, textarea, select")){if(!l.name)continue;a[l.name]=l.value;let d=l.getAttribute("validate");if(d){let f=me(l.value,d,a);f&&(s[l.name]=f,c=!1)}l.checkValidity()||(s[l.name]=s[l.name]||l.validationMessage,c=!1)}o.valid=c,o.errors=s,o.values=a,n.$set("$form",{...o})},o={valid:!1,dirty:!1,touched:!1,submitting:!1,errors:{},values:{},reset:()=>{o.dirty=!1,o.touched=!1,t.reset(),i()}};n.$set("$form",o),t.addEventListener("input",()=>{o.dirty=!0,i()}),t.addEventListener("focusout",()=>{o.touched=!0,i()}),t.addEventListener("submit",()=>{o.submitting=!0,n.$set("$form",{...o}),requestAnimationFrame(()=>{o.submitting=!1,n.$set("$form",{...o})})}),requestAnimationFrame(i);return}if(r&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")){let o=t.getAttribute("error");t.addEventListener("input",()=>{let i=me(t.value,r,{});if(i&&o){let s=t.nextElementSibling?.__validationError?t.nextElementSibling:null;s||(s=document.createElement("div"),s.__validationError=!0,s.style.display="contents",t.parentNode.insertBefore(s,t.nextSibling));let a=K(o);if(a){let c=P({err:{message:i}},n);s.innerHTML="",s.__ctx=c,s.appendChild(a),M(s)}}else{let s=t.nextElementSibling?.__validationError?t.nextElementSibling:null;s&&(s.innerHTML="")}})}}});$("error-boundary",{priority:1,init(t,e,r){let n=I(t);function o(s){let a=K(r);if(a){let c=P({err:{message:s}},n);t.innerHTML="";let l=document.createElement("div");l.style.display="contents",l.__ctx=c,l.appendChild(a),t.appendChild(l),M(l)}}t.addEventListener("nojs:error",s=>{o(s.detail?.message||"An error occurred")});let i=s=>{(t.contains(s.target)||t===s.target)&&o(s.message||"An error occurred")};window.addEventListener("error",i),Q(()=>window.removeEventListener("error",i))}});pt();X();$("t",{priority:20,init(t,e,r){let n=I(t),o=t.hasAttribute("t-html");function i(){let s={};for(let c of[...t.attributes])if(c.name.startsWith("t-")&&c.name!=="t"&&c.name!=="t-html"){let l=c.name.replace("t-","");s[l]=L(c.value,n)??c.value}let a=W.t(r,s);o?t.innerHTML=a:t.textContent=a}q(r,n,i),$t(i),i()}});$("i18n-ns",{priority:1,init(t,e,r){if(!r)return;let n=document.createDocumentFragment();for(;t.firstChild;)n.appendChild(t.firstChild);Kt(r).then(()=>{t.appendChild(n),M(t),Tt()})}});X();var g={dragging:null,selected:new Map,placeholder:null};function jt(t){let e=0;for(let r of t.children){if(r.classList.contains("nojs-drop-placeholder"))continue;(r.style||{}).display==="contents"?e+=jt(r):e++}return e}function Vt(){if(typeof document>"u"||document.querySelector("style[data-nojs-dnd]"))return;let t=`
|
|
24
|
+
`.trim(),e=document.createElement("style");e.setAttribute("data-nojs-animations",""),e.textContent=t,document.head.appendChild(e)}function St(t,e,r,n){Ce();let o=n||1e3;if(e){let i=t.firstElementChild||t;i.classList.add(e),n&&(i.style.animationDuration=n+"ms"),i.addEventListener("animationend",()=>i.classList.remove(e),{once:!0})}if(r){let i=t.firstElementChild||t;i.classList.add(r+"-enter",r+"-enter-active"),requestAnimationFrame(()=>{i.classList.remove(r+"-enter"),i.classList.add(r+"-enter-to");let s=()=>{i.classList.remove(r+"-enter-active",r+"-enter-to")};i.addEventListener("transitionend",s,{once:!0}),setTimeout(s,o)})}}function Mt(t,e,r,n,o){Ce();let i=o||2e3;if(!t.firstElementChild&&!t.childNodes.length){n();return}if(e){let s=t.firstElementChild||t;s.classList.add(e),o&&(s.style.animationDuration=o+"ms");let a=!1,c=()=>{a||(a=!0,s.classList.remove(e),n())};s.addEventListener("animationend",c,{once:!0}),setTimeout(c,i);return}if(r){let s=t.firstElementChild||t;s.classList.add(r+"-leave",r+"-leave-active"),requestAnimationFrame(()=>{s.classList.remove(r+"-leave"),s.classList.add(r+"-leave-to");let a=!1,c=()=>{a||(a=!0,s.classList.remove(r+"-leave-active",r+"-leave-to"),n())};s.addEventListener("transitionend",c,{once:!0}),setTimeout(c,i)});return}n()}function Te(){let t=[],e={path:"",params:{},query:{},hash:""},r=new Set,n=new Map;function o(p){let u=t.find(m=>m.path===p);return u||(u={path:p,outlets:{}},t.push(u)),u}function i(p){let u={};return new URLSearchParams(p).forEach((m,b)=>{u[b]=m}),u}function s(p){for(let u of t){let m=[],b=u.path.replace(/:(\w+)/g,(y,E)=>(m.push(E),"([^/]+)")),x=new RegExp("^"+b+"$"),A=p.match(x);if(A){let y={};return m.forEach((E,_)=>{y[E]=A[_+1]}),{route:u,params:y}}}return null}async function a(p,u=!1){let m=p.indexOf("#"),b=m>=0?p.slice(m+1):"",x=m>=0?p.slice(0,m):p,[A,y=""]=x.split("?");e={path:A,params:{},query:i(y),hash:b?"#"+b:""};let E=s(A);if(E){e.params=E.params;let _=E.route.outlets?.default,C=_?.getAttribute("guard"),w=_?.getAttribute("redirect");if(C){let v=P({},null);if(v.__raw.$store=W,v.__raw.$route=e,!L(C,v)&&w){await a(w,!0);return}}}if(g.router.mode==="hash"){let _="#"+p;u?window.location.replace(_):window.location.hash=p}else{let _=g.router.base.replace(/\/$/,"")+p;u?window.history.replaceState({},"",_):window.history.pushState({},"",_)}if(await c(E),r.forEach(_=>_(e)),at("route:navigate",{path:e.path,params:e.params,query:e.query,hash:e.hash}),e.hash){let _=e.hash.slice(1);requestAnimationFrame(()=>{let C=document.getElementById(_);C&&C.scrollIntoView({behavior:"smooth"})})}}async function c(p){let u=document.querySelectorAll("[route-view]");for(let b of u){let x=b.getAttribute("route-view"),A=x&&x.trim()!==""?x.trim():"default",y=p?.route?.outlets?.[A],E=g.router.templates||"";if(!y&&(b.hasAttribute("src")||E)){let C=(b.getAttribute("src")||E).replace(/\/?$/,"/"),w=b.getAttribute("ext")||g.router.ext||".html",v=b.getAttribute("route-index")||"index",B=e.path==="/"?v:e.path.replace(/^\//,""),S=C+B+w,N=A+":"+S;n.has(N)?y=n.get(N):(y=document.createElement("template"),y.setAttribute("src",S),y.setAttribute("route",e.path),document.body.appendChild(y),n.set(N,y),Y("[ROUTER] File-based route:",e.path,"\u2192",S)),b.hasAttribute("i18n-ns")&&!y.getAttribute("i18n-ns")&&y.setAttribute("i18n-ns",B)}if(Ae(b),b.innerHTML="",y){y.getAttribute("src")&&!y.__srcLoaded&&(Y("Loading route template on demand:",y.getAttribute("src")),await yt(y));let _=y.getAttribute("i18n-ns");if(_){let{_loadI18nNamespace:N}=await Promise.resolve().then(()=>(ft(),se));await N(_)}let C=y.content.cloneNode(!0),w=P({$route:e},$(b)),v=document.createElement("div");v.style.display="contents",v.__ctx=w,y.content.__srcBase&&(v.__srcBase=y.content.__srcBase),v.appendChild(C),b.appendChild(v),Ot(v);let B=[...v.querySelectorAll("template[src]")];Y("[ROUTER] nested templates found in wrapper:",B.length,B.map(N=>N.getAttribute("src")+(N.__srcLoaded?"[LOADED]":"[NEW]"))),await Promise.all(B.map(yt)),Y("[ROUTER] all nested loads done for route:",e.path);let S=b.getAttribute("transition");S&&St(v,null,S),pt(v),O(v)}}document.querySelectorAll("[route]").forEach(b=>{let x=b.getAttribute("route"),A=b.getAttribute("route-active")||"active",y=b.getAttribute("route-active-exact");if(y)b.classList.toggle(y,e.path===x);else if(A&&!b.hasAttribute("route-active-exact")){let E=x==="/"?e.path==="/":e.path.startsWith(x);b.classList.toggle(A,E)}});let m=g.router.scrollBehavior;m==="top"?window.scrollTo(0,0):m==="smooth"&&window.scrollTo({top:0,behavior:"smooth"})}function l(p,u){u.scrollIntoView({behavior:"smooth"});let m='a[href="#'+p+'"]';document.querySelectorAll('a[href^="#"]').forEach(b=>{b.hasAttribute("route")||b.classList.toggle("active",b.matches(m))})}function d(){let p=document.querySelectorAll("[route-view]");for(let u of p){let m=u.getAttribute("src")||g.router.templates||"";if(!m)continue;let b=m.replace(/\/?$/,"/"),x=u.getAttribute("ext")||g.router.ext||".html",A=u.getAttribute("route-index")||"index",y=(u.getAttribute("route-view")||"").trim()||"default",E=new Map;document.querySelectorAll("[route]:not([route-view])").forEach(w=>{let v=w.getAttribute("route");if(!v)return;let B=v.split("?")[0].split("#")[0],S=w.getAttribute("lazy"),N=E.get(B);(!E.has(B)||S==="priority"||N==="ondemand"&&S!=="ondemand")&&E.set(B,S)});let _=[],C=[];for(let[w,v]of E){if(v==="ondemand"||w===e.path)continue;let B=w==="/"?A:w.replace(/^\//,""),S=b+B+x,N=y+":"+S;if(n.has(N))continue;let X=document.createElement("template");X.setAttribute("src",S),X.setAttribute("route",w),document.body.appendChild(X),n.set(N,X),Y("[ROUTER] Prefetch:",w,"\u2192",S,v==="priority"?"(priority)":"(background)"),u.hasAttribute("i18n-ns")&&X.setAttribute("i18n-ns",B),v==="priority"?_.push(X):C.push(X)}(_.length||C.length)&&Promise.all(_.map(yt)).then(()=>{C.forEach(yt)})}}return{get current(){return e},push(p){return a(p)},replace(p){return a(p,!0)},back(){window.history.back()},forward(){window.history.forward()},on(p){return r.add(p),()=>r.delete(p)},register(p,u,m="default"){let b=o(p);b.outlets[m]=u},async init(){if(document.querySelectorAll("template[route]").forEach(p=>{let u=p.getAttribute("route"),m=p.getAttribute("outlet")||"default",b=o(u);b.outlets[m]=p}),document.addEventListener("click",p=>{let u=p.target.closest("[route]");if(u&&!u.hasAttribute("route-view")){p.preventDefault();let m=u.getAttribute("route");a(m);return}if(g.router.mode==="hash"){let m=p.target.closest('a[href^="#"]');if(m&&!m.hasAttribute("route")){let x=m.getAttribute("href").slice(1);if(x&&!x.startsWith("/")){let A=document.getElementById(x);A&&(p.preventDefault(),l(x,A))}}}}),g.router.mode==="hash"){window.addEventListener("hashchange",()=>{let u=window.location.hash.slice(1)||"/";if(!u.startsWith("/")){let b=document.getElementById(u);b&&(l(u,b),window.history.replaceState(null,"","#"+e.path));return}let[m]=u.split("?");m!==e.path&&a(u,!0)});let p=window.location.hash.slice(1)||"/";await a(p,!0)}else{window.addEventListener("popstate",()=>{let u=window.location.pathname.replace(g.router.base,"")||"/";a(u,!0)});let p=window.location.pathname.replace(g.router.base,"")||"/";await a(p,!0)}d()}}}K();j.uppercase=t=>String(t??"").toUpperCase();j.lowercase=t=>String(t??"").toLowerCase();j.capitalize=t=>String(t??"").replace(/\b\w/g,e=>e.toUpperCase());j.truncate=(t,e=100)=>{let r=String(t??"");return r.length>e?r.slice(0,e)+"...":r};j.trim=t=>String(t??"").trim();j.stripHtml=t=>String(t??"").replace(/<[^>]*>/g,"");j.slugify=t=>String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");j.nl2br=t=>String(t??"").replace(/\n/g,"<br>");j.encodeUri=t=>encodeURIComponent(String(t??""));j.number=(t,e=0)=>{let r=Number(t);return isNaN(r)?t:r.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})};j.currency=(t,e="USD")=>{let r=Number(t);if(isNaN(r))return t;try{return r.toLocaleString(void 0,{style:"currency",currency:e})}catch{return`${e} ${r.toFixed(2)}`}};j.percent=(t,e=0)=>{let r=Number(t);return isNaN(r)?t:(r*100).toFixed(e)+"%"};j.filesize=t=>{let e=Number(t);if(isNaN(e))return t;let r=["B","KB","MB","GB","TB"],n=0,o=e;for(;o>=1024&&n<r.length-1;)o/=1024,n++;return o.toFixed(n>0?1:0)+" "+r[n]};j.ordinal=t=>{let e=Number(t);if(isNaN(e))return t;let r=["th","st","nd","rd"],n=e%100;return e+(r[(n-20)%10]||r[n]||r[0])};j.count=t=>Array.isArray(t)?t.length:0;j.first=t=>Array.isArray(t)?t[0]:t;j.last=t=>Array.isArray(t)?t[t.length-1]:t;j.join=(t,e=", ")=>Array.isArray(t)?t.join(e):t;j.reverse=t=>Array.isArray(t)?[...t].reverse():t;j.unique=t=>Array.isArray(t)?[...new Set(t)]:t;j.pluck=(t,e)=>Array.isArray(t)?t.map(r=>r?.[e]):t;j.sortBy=(t,e)=>{if(!Array.isArray(t))return t;let r=e?.startsWith("-"),n=r?e.slice(1):e;return[...t].sort((o,i)=>{let s=o?.[n],a=i?.[n],c=s<a?-1:s>a?1:0;return r?-c:c})};j.where=(t,e,r)=>Array.isArray(t)?t.filter(n=>n?.[e]===r):t;j.date=(t,e="short")=>{let r=new Date(t);if(isNaN(r))return t;let n=e==="long"?{dateStyle:"long"}:e==="full"?{dateStyle:"full"}:{dateStyle:"short"};return r.toLocaleDateString(void 0,n)};j.datetime=t=>{let e=new Date(t);return isNaN(e)?t:e.toLocaleString()};j.relative=t=>{let e=new Date(t);if(isNaN(e))return t;let r=(Date.now()-e.getTime())/1e3;return r<60?"just now":r<3600?Math.floor(r/60)+"m ago":r<86400?Math.floor(r/3600)+"h ago":r<2592e3?Math.floor(r/86400)+"d ago":e.toLocaleDateString()};j.fromNow=t=>{let e=new Date(t);if(isNaN(e))return t;let r=(e.getTime()-Date.now())/1e3;return r<0?j.relative(t):r<60?"in a moment":r<3600?"in "+Math.floor(r/60)+"m":r<86400?"in "+Math.floor(r/3600)+"h":"in "+Math.floor(r/86400)+"d"};j.default=(t,e="")=>t==null||t===""?e:t;j.json=(t,e=2)=>JSON.stringify(t,null,e);j.debug=t=>(console.log("[No.JS debug]",t),t);j.keys=t=>t&&typeof t=="object"?Object.keys(t):[];j.values=t=>t&&typeof t=="object"?Object.values(t):[];K();I("state",{priority:0,init(t,e,r){let n=L(r,P())||{},o=t.parentElement?$(t.parentElement):null,i=P(n,o);t.__ctx=i;let s=t.getAttribute("persist"),a=t.getAttribute("persist-key");if(s&&a){let c=s==="localStorage"?localStorage:s==="sessionStorage"?sessionStorage:null;if(c){try{let l=c.getItem("nojs_state_"+a);if(l){let d=JSON.parse(l);for(let[f,p]of Object.entries(d))i.$set(f,p)}}catch{}i.$watch(()=>{try{c.setItem("nojs_state_"+a,JSON.stringify(i.__raw))}catch{}})}}Y("state",n)}});I("store",{priority:0,init(t,e,r){let n=t.getAttribute("value");if(r){if(!W[r]){let o=n?L(n,P())||{}:{};W[r]=P(o),at("store:created",{name:r,keys:Object.keys(o)})}Y("store",r)}}});I("computed",{priority:2,init(t,e,r){let n=t.getAttribute("expr");if(!r||!n)return;let o=$(t);function i(){let s=L(n,o);o.$set(r,s)}z(n,o,i),i()}});I("watch",{priority:2,init(t,e,r){let n=$(t),o=t.getAttribute("on:change"),i=L(r,n);z(r,n,()=>{let s=L(r,n);if(s!==i){let a=i;i=s,o&&tt(o,n,{$old:a,$new:s})}})}});K();var We=["get","post","put","patch","delete"];for(let t of We)I(t,{priority:1,init(e,r,n){let o=e.getAttribute("as")||"data",i=e.getAttribute("loading"),s=e.getAttribute("error"),a=e.getAttribute("empty"),c=e.getAttribute("success"),l=e.getAttribute("then"),d=e.getAttribute("redirect"),f=e.getAttribute("confirm"),p=parseInt(e.getAttribute("refresh"))||0,u=e.getAttribute("cached"),m=e.hasAttribute("cached")?u||"memory":"none",b=e.getAttribute("body"),x=e.getAttribute("headers"),A=e.getAttribute("var"),y=e.getAttribute("into"),E=parseInt(e.getAttribute("retry"))||g.retries,_=parseInt(e.getAttribute("retry-delay"))||g.retryDelay||1e3,C=e.getAttribute("params"),w=e.parentElement?$(e.parentElement):P(),v=e.__ctx||P({},w);e.__ctx=v;let B=[...e.childNodes].map(M=>M.cloneNode(!0)),S=null;async function N(){if(S&&S.abort(),S=new AbortController,f&&!window.confirm(f))return;let M=ht(n,v);if(C){let q=L(C,v);if(q&&typeof q=="object"){let D=M.includes("?")?"&":"?",H=new URLSearchParams(q).toString();H&&(M+=D+H)}}let dt=t+":"+M;if(t==="get"){let q=he(dt,m);if(q!=null){v.$set(o,q),pt(e),O(e);return}}if(i){let q=J(i);q&&(e.innerHTML="",e.appendChild(q),O(e))}try{let q=null;if(b){let T=ht(b,v);try{q=JSON.parse(T)}catch{q=T}}if(e.tagName==="FORM"){let T=new FormData(e);q=Object.fromEntries(T.entries())}let D=x?JSON.parse(x):{},H=g.retries,F=g.retryDelay;g.retries=E,g.retryDelay=_;let k;try{k=await Bt(M,t,q,D,e,S.signal)}finally{g.retries=H,g.retryDelay=F}if(t==="get"&&be(dt,k,m),a&&(k==null||Array.isArray(k)&&k.length===0)){let T=J(a);T&&(e.innerHTML="",e.appendChild(T),O(e));return}if(v.$set(o,k),y&&(W[y]||(W[y]=P({})),W[y].$set(o,k),Tt()),c){let T=J(c);if(T){e.innerHTML="";let mt=document.getElementById(c.replace("#",""))?.getAttribute("var")||A||"result",ot=P({[mt]:k},v),Q=document.createElement("div");Q.style.display="contents",Q.__ctx=ot,Q.appendChild(T),e.appendChild(Q),O(Q)}}else{e.innerHTML="";for(let T of B)e.appendChild(T.cloneNode(!0));pt(e),O(e)}l&&tt(l,v,{result:k}),d&&G&&G.push(d),jt("fetch:success",{url:M,data:k}),at("fetch:success",{method:t,url:M})}catch(q){if(q.name==="AbortError")return;if(it(`${t.toUpperCase()} ${M} failed:`,q.message),jt("fetch:error",{url:M,error:q}),jt("error",{url:M,error:q}),at("fetch:error",{method:t,url:M,error:q.message}),s){let D=J(s);if(D){e.innerHTML="";let F=document.getElementById(s.replace("#",""))?.getAttribute("var")||"err",k=P({[F]:{message:q.message,status:q.status,body:q.body}},v),T=document.createElement("div");T.style.display="contents",T.__ctx=k,T.appendChild(D),e.appendChild(T),O(T)}}}}if(e.tagName==="FORM"&&t!=="get"?e.addEventListener("submit",M=>{M.preventDefault(),N()}):t==="get"?N():e.addEventListener("click",M=>{M.preventDefault(),N()}),/\{[^}]+\}/.test(n)){let D=function(){let F=ht(n,v);F!==dt&&(dt=F,q&&clearTimeout(q),M>0?q=setTimeout(N,M):N())},M=parseInt(e.getAttribute("debounce"))||0,dt=ht(n,v),q=null,H=w;for(;H&&H.__isProxy;)H.$watch(D),H=H.$parent}if(p>0){let M=setInterval(N,p);Z(()=>clearInterval(M))}}});K();I("bind",{priority:20,init(t,e,r){let n=$(t);function o(){let i=L(r,n);t.textContent=i!=null?String(i):""}z(r,n,o),o()}});I("bind-html",{priority:20,init(t,e,r){let n=$(t);function o(){let i=L(r,n);i!=null&&(t.innerHTML=ye(String(i)))}z(r,n,o),o()}});I("bind-*",{priority:20,init(t,e,r){let n=e.replace("bind-",""),o=$(t);n==="value"&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&t.addEventListener("input",()=>{let s=t.type==="number"?Number(t.value):t.value;tt(`${r} = ${JSON.stringify(s)}`,o)});function i(){let s=L(r,o);if(["disabled","readonly","checked","selected","hidden","required"].includes(n)){s?t.setAttribute(n,""):t.removeAttribute(n),n in t&&(t[n]=!!s);return}s!=null?t.setAttribute(n,String(s)):t.removeAttribute(n)}z(r,o,i),i()}});I("model",{priority:20,init(t,e,r){let n=$(t),o=t.tagName,i=t.type;function s(){let c=L(r,n);o==="INPUT"&&i==="checkbox"?t.checked=!!c:o==="INPUT"&&i==="radio"?t.checked=t.value===String(c):t.value=c!=null?String(c):""}let a=o==="SELECT"||i==="checkbox"||i==="radio"?"change":"input";t.addEventListener(a,()=>{let c;i==="checkbox"?c=t.checked:i==="number"||i==="range"?c=Number(t.value):c=t.value,tt(`${r} = __val`,n,{__val:c})}),z(r,n,s),s()}});K();I("if",{priority:10,init(t,e,r){let n=$(t),o=t.getAttribute("then"),i=t.getAttribute("else"),s=t.getAttribute("animate-enter")||t.getAttribute("animate"),a=t.getAttribute("animate-leave"),c=t.getAttribute("transition"),l=parseInt(t.getAttribute("animate-duration"))||0,d=[...t.childNodes].map(m=>m.cloneNode(!0)),f;function p(){let m=!!L(r,n);m!==f&&(f=m,a||c?Mt(t,a,c,()=>u(m),l):u(m))}function u(m){if(m)if(o){let b=J(o);b&&(t.innerHTML="",t.appendChild(b))}else{t.innerHTML="";for(let b of d)t.appendChild(b.cloneNode(!0))}else if(i){let b=J(i);b&&(t.innerHTML="",t.appendChild(b))}else t.innerHTML="";pt(t),O(t),(s||c)&&St(t,s,c,l)}z(r,n,p),p()}});I("else-if",{priority:10,init(t,e,r){let n=$(t),o=t.getAttribute("then"),i=[...t.childNodes].map(a=>a.cloneNode(!0));function s(){let a=t.previousElementSibling;for(;a;){let l=a.getAttribute("if")||a.getAttribute("else-if");if(l){if(L(l,n)){t.innerHTML="",t.style.display="none";return}}else break;a=a.previousElementSibling}let c=!!L(r,n);if(t.style.display="",c){if(o){let l=J(o);l&&(t.innerHTML="",t.appendChild(l))}else{t.innerHTML="";for(let l of i)t.appendChild(l.cloneNode(!0))}pt(t),O(t)}else t.innerHTML=""}z(r,n,s),s()}});I("else",{priority:10,init(t){if(t.hasAttribute("if"))return;let e=$(t),r=t.getAttribute("then"),n=[...t.childNodes].map(i=>i.cloneNode(!0));function o(){let i=t.previousElementSibling;for(;i;){let s=i.getAttribute("if")||i.getAttribute("else-if");if(s){if(L(s,e)){t.innerHTML="",t.style.display="none";return}}else break;i=i.previousElementSibling}if(t.style.display="",r){let s=J(r);s&&(t.innerHTML="",t.appendChild(s))}else{t.innerHTML="";for(let s of n)t.appendChild(s.cloneNode(!0))}pt(t),O(t)}z("",e,o),o()}});I("show",{priority:20,init(t,e,r){let n=$(t),o=t.getAttribute("animate-enter")||t.getAttribute("animate"),i=t.getAttribute("animate-leave"),s=t.getAttribute("transition"),a=parseInt(t.getAttribute("animate-duration"))||0,c;function l(){let d=!!L(r,n);d!==c&&(c=d,d?(t.style.display="",(o||s)&&St(t,o,s,a)):i||s?Mt(t,i,s,()=>{t.style.display="none"},a):t.style.display="none")}z(r,n,l),l()}});I("hide",{priority:20,init(t,e,r){let n=$(t),o=t.getAttribute("animate-enter")||t.getAttribute("animate"),i=t.getAttribute("animate-leave"),s=t.getAttribute("transition"),a=parseInt(t.getAttribute("animate-duration"))||0,c;function l(){let d=!L(r,n);d!==c&&(c=d,d?(t.style.display="",(o||s)&&St(t,o,s,a)):i||s?Mt(t,i,s,()=>{t.style.display="none"},a):t.style.display="none")}z(r,n,l),l()}});I("switch",{priority:10,init(t,e,r){let n=$(t);function o(){let i=L(r,n),s=!1;for(let a of[...t.children]){let c=a.getAttribute("case"),l=a.hasAttribute("default"),d=a.getAttribute("then");if(c){let f=c.split(",").map(p=>L(p.trim(),n));if(!s&&f.includes(i)){if(s=!0,a.style.display="",d){let p=J(d);p&&(a.innerHTML="",a.appendChild(p)),a.__declared=!1,O(a)}}else a.style.display="none"}else if(l&&(a.style.display=s?"none":"",!s&&d)){let f=J(d);f&&(a.innerHTML="",a.appendChild(f)),a.__declared=!1,O(a)}}}z(r,n,o),o()}});K();I("each",{priority:10,init(t,e,r){let n=$(t),o=r.match(/^(\w+)\s+in\s+(\S+)$/);if(!o)return;let[,i,s]=o,a=t.getAttribute("template"),c=t.getAttribute("else"),l=t.getAttribute("key"),d=t.getAttribute("animate-enter")||t.getAttribute("animate"),f=t.getAttribute("animate-leave"),p=parseInt(t.getAttribute("animate-stagger"))||0,u=parseInt(t.getAttribute("animate-duration"))||0,m=null;function b(){let A=/[\[\]()\s+\-*\/!?:&|]/.test(s)?L(s,n):nt(s,n);if(!Array.isArray(A))return;if(A===m&&A.length>0&&t.children.length>0){for(let E of t.children)E.__ctx&&E.__ctx.$notify&&E.__ctx.$notify();return}if(m=A,A.length===0&&c){let E=J(c);E&&(t.innerHTML="",t.appendChild(E),O(t));return}let y=a?document.getElementById(a):null;if(y)if(f&&t.children.length>0){let E=[...t.children],_=E.length;E.forEach(C=>{let w=C.firstElementChild||C;w.classList.add(f);let v=()=>{w.classList.remove(f),_--,_<=0&&x(y,A)};w.addEventListener("animationend",v,{once:!0}),setTimeout(v,u||2e3)})}else x(y,A)}function x(A,y){let E=y.length;t.innerHTML="",y.forEach((_,C)=>{let w={[i]:_,$index:C,$count:E,$first:C===0,$last:C===E-1,$even:C%2===0,$odd:C%2!==0},v=P(w,n),B=A.content.cloneNode(!0),S=document.createElement("div");if(S.style.display="contents",S.__ctx=v,S.appendChild(B),t.appendChild(S),O(S),d){let N=S.firstElementChild;N&&(N.classList.add(d),N.addEventListener("animationend",()=>N.classList.remove(d),{once:!0}),p&&(N.style.animationDelay=C*p+"ms"))}})}z(r,n,b),b()}});I("foreach",{priority:10,init(t,e,r){let n=$(t),o=t.getAttribute("from"),i=t.getAttribute("index")||"$index",s=t.getAttribute("else"),a=t.getAttribute("filter"),c=t.getAttribute("sort"),l=parseInt(t.getAttribute("limit"))||1/0,d=parseInt(t.getAttribute("offset"))||0,f=t.getAttribute("template"),p=t.getAttribute("animate-enter")||t.getAttribute("animate"),u=t.getAttribute("animate-leave"),m=parseInt(t.getAttribute("animate-stagger"))||0,b=parseInt(t.getAttribute("animate-duration"))||0;if(!o||!r)return;let x=f?null:t.cloneNode(!0);function A(){let y=nt(o,n);if(!Array.isArray(y))return;if(a&&(y=y.filter((w,v)=>{let B=P({[r]:w,[i]:v},n);return!!L(a,B)})),c){let w=c.startsWith("-"),v=w?c.slice(1):c;y=[...y].sort((B,S)=>{let N=nt(v,B)??B?.[v],X=nt(v,S)??S?.[v],M=N<X?-1:N>X?1:0;return w?-M:M})}if(y=y.slice(d,d+l),y.length===0&&s){let w=J(s);w&&(t.innerHTML="",t.appendChild(w),O(t));return}let E=f?document.getElementById(f):null,_=y.length;function C(){t.innerHTML="",y.forEach((w,v)=>{let B={[r]:w,[i]:v,$index:v,$count:_,$first:v===0,$last:v===_-1,$even:v%2===0,$odd:v%2!==0},S=P(B,n),N;E?N=E.content.cloneNode(!0):N=x.cloneNode(!0);let X=document.createElement("div");if(X.style.display="contents",X.__ctx=S,X.appendChild(N),t.appendChild(X),O(X),p){let M=X.firstElementChild;M&&(M.classList.add(p),M.addEventListener("animationend",()=>M.classList.remove(p),{once:!0}),m&&(M.style.animationDelay=v*m+"ms"))}})}if(u&&t.children.length>0){let w=[...t.children],v=w.length;w.forEach(B=>{let S=B.firstElementChild||B;S.classList.add(u);let N=()=>{S.classList.remove(u),v--,v<=0&&C()};S.addEventListener("animationend",N,{once:!0}),setTimeout(N,b||2e3)})}else C()}z(o,n,A),A()}});K();ft();I("class-*",{priority:20,init(t,e,r){let n=e.replace("class-",""),o=$(t);if(n==="map"){let s=function(){let a=L(r,o);if(a&&typeof a=="object")for(let[c,l]of Object.entries(a))c.split(/\s+/).filter(Boolean).forEach(f=>t.classList.toggle(f,!!l))};z(r,o,s),s();return}if(n==="list"){let a=function(){let c=L(r,o);if(Array.isArray(c)){s.forEach(d=>{d&&t.classList.remove(d)});let l=c.filter(Boolean);l.forEach(d=>t.classList.add(d)),s=l}},s=[];z(r,o,a),a();return}function i(){t.classList.toggle(n,!!L(r,o))}z(r,o,i),(r.includes("$i18n")||r.includes("NoJS.locale"))&&kt(i),i()}});I("style-*",{priority:20,init(t,e,r){let n=e.replace("style-",""),o=$(t);if(n==="map"){let a=function(){let c=L(r,o);if(c&&typeof c=="object")for(let[l,d]of Object.entries(c))t.style[l]=d??""};z(r,o,a),a();return}let i=n.replace(/-([a-z])/g,(a,c)=>c.toUpperCase());function s(){let a=L(r,o);t.style[i]=a!=null?String(a):""}z(r,o,s),s()}});K();I("on:*",{priority:20,init(t,e,r){let n=$(t),o=e.replace("on:","").split("."),i=o[0],s=new Set(o.slice(1));if(i==="mounted"){requestAnimationFrame(()=>tt(r,n,{$el:t}));return}if(i==="init"){tt(r,n,{$el:t});return}if(i==="updated"){let f=new MutationObserver(()=>{tt(r,n,{$el:t})});f.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),Z(()=>f.disconnect());return}if(i==="error"){let f=p=>{(t.contains(p.target)||p.target===t)&&tt(r,n,{$el:t,$error:p.error||p.message})};window.addEventListener("error",f),Z(()=>window.removeEventListener("error",f));return}if(i==="unmounted"){let f=new MutationObserver(p=>{for(let u of p)for(let m of u.removedNodes)if(m===t||m.contains?.(t)){tt(r,n,{$el:t}),f.disconnect();return}});t.parentElement&&f.observe(t.parentElement,{childList:!0,subtree:!0}),Z(()=>f.disconnect());return}let a=0,c=0;for(let f of s)/^\d+$/.test(f)&&(s.has("debounce")?a=parseInt(f):s.has("throttle")&&(c=parseInt(f)));let l=f=>{if(i==="keydown"||i==="keyup"||i==="keypress"){let p=["enter","escape","tab","space","delete","backspace","up","down","left","right","ctrl","alt","shift","meta"];for(let u of s)if(p.includes(u)&&(u==="enter"&&f.key!=="Enter"||u==="escape"&&f.key!=="Escape"||u==="tab"&&f.key!=="Tab"||u==="space"&&f.key!==" "||u==="delete"&&f.key!=="Delete"&&f.key!=="Backspace"||u==="up"&&f.key!=="ArrowUp"||u==="down"&&f.key!=="ArrowDown"||u==="left"&&f.key!=="ArrowLeft"||u==="right"&&f.key!=="ArrowRight"||u==="ctrl"&&!f.ctrlKey||u==="alt"&&!f.altKey||u==="shift"&&!f.shiftKey||u==="meta"&&!f.metaKey))return}s.has("prevent")&&f.preventDefault(),s.has("stop")&&f.stopPropagation(),!(s.has("self")&&f.target!==t)&&tt(r,n,{$event:f,$el:t})};if(a>0){let f=l,p;l=u=>{clearTimeout(p),p=setTimeout(()=>f(u),a)}}if(c>0){let f=l,p=0;l=u=>{let m=Date.now();m-p>=c&&(p=m,f(u))}}let d={};s.has("once")&&(d.once=!0),t.addEventListener(i,l,d)}});I("trigger",{priority:20,init(t,e,r){let n=$(t),o=t.getAttribute("trigger-data");t.addEventListener("click",()=>{let i=o?L(o,n):null;t.dispatchEvent(new CustomEvent(r,{detail:i,bubbles:!0}))})}});K();I("ref",{priority:5,init(t,e,r){ut[r]=t,Z(()=>{ut[r]===t&&delete ut[r]})}});I("use",{priority:10,init(t,e,r){let n=$(t),o=J(r);if(!o)return;let i={};for(let d of[...t.attributes])if(d.name.startsWith("var-")){let f=d.name.replace("var-","");i[f]=L(d.value,n)}let s=P(i,n),a={};for(let d of[...t.children]){let f=d.getAttribute("slot")||"default";a[f]||(a[f]=document.createDocumentFragment()),a[f].appendChild(d.cloneNode(!0))}let c=o.querySelectorAll("slot");for(let d of c){let f=d.getAttribute("name")||"default";a[f]&&d.replaceWith(a[f])}t.innerHTML="";let l=document.createElement("div");l.style.display="contents",l.__ctx=s,l.appendChild(o),t.appendChild(l),O(l)}});I("call",{priority:20,init(t,e,r){let n=$(t),o=t.getAttribute("method")||"get",i=t.getAttribute("as"),s=t.getAttribute("into"),a=t.getAttribute("success"),c=t.getAttribute("error"),l=t.getAttribute("then"),d=t.getAttribute("confirm"),f=t.getAttribute("body");t.addEventListener("click",async p=>{if(p.preventDefault(),d&&!window.confirm(d))return;let u=ht(r,n);try{let m=null;if(f){let x=ht(f,n);try{m=JSON.parse(x)}catch{m=x}}let b=await Bt(u,o,m,{},t);if(i&&n.$set(i,b),i&&s&&(W[s]||(W[s]=P({})),W[s].$set(i,b),Tt()),l&&tt(l,n,{result:b}),a){let x=J(a);if(x){let y=document.getElementById(a.replace("#",""))?.getAttribute("var")||"result",E=P({[y]:b},n),_=t.closest("[route-view]")||t.parentElement,C=document.createElement("div");C.style.display="contents",C.__ctx=E,C.appendChild(x),_.appendChild(C),O(C)}}}catch(m){if(c){let b=J(c);if(b){let A=document.getElementById(c.replace("#",""))?.getAttribute("var")||"err",y=P({[A]:{message:m.message,status:m.status}},n),E=t.parentElement,_=document.createElement("div");_.style.display="contents",_.__ctx=y,_.appendChild(b),E.appendChild(_),O(_)}}}})}});K();function Se(t,e,r){let n=e.split("|").map(o=>o.trim());for(let o of n){let[i,...s]=o.split(":"),a=Ct[i];if(a){let c=a(t,...s,r);if(c!==!0&&c)return c}else switch(i){case"required":if(t==null||String(t).trim()==="")return"Required";break;case"email":if(t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return"Invalid email";break;case"url":try{new URL(t)}catch{return"Invalid URL"}break;case"min":if(Number(t)<Number(s[0]))return`Minimum value is ${s[0]}`;break;case"max":if(Number(t)>Number(s[0]))return`Maximum value is ${s[0]}`;break;case"between":{let c=Number(t);if(c<Number(s[0])||c>Number(s[1]))return`Must be between ${s[0]} and ${s[1]}`;break}case"match":if(t!==r[s[0]])return`Must match ${s[0]}`;break;case"phone":if(!/^[\d\s\-+()]{7,15}$/.test(t))return"Invalid phone number";break;case"cpf":if(!/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/.test(t))return"Invalid CPF";break;case"cnpj":if(!/^\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2}$/.test(t))return"Invalid CNPJ";break;case"creditcard":if(!/^\d{13,19}$/.test(t.replace(/\s|-/g,"")))return"Invalid card number";break;case"custom":if(s[0]&&Ct[s[0]]){let c=Ct[s[0]](t,r);if(c!==!0&&c)return c}break}}return null}I("validate",{priority:30,init(t,e,r){let n=$(t);if(t.tagName==="FORM"){let i=function(){let s={},a={},c=!0;for(let l of t.querySelectorAll("input, textarea, select")){if(!l.name)continue;a[l.name]=l.value;let d=l.getAttribute("validate");if(d){let f=Se(l.value,d,a);f&&(s[l.name]=f,c=!1)}l.checkValidity()||(s[l.name]=s[l.name]||l.validationMessage,c=!1)}o.valid=c,o.errors=s,o.values=a,n.$set("$form",{...o})},o={valid:!1,dirty:!1,touched:!1,submitting:!1,errors:{},values:{},reset:()=>{o.dirty=!1,o.touched=!1,t.reset(),i()}};n.$set("$form",o),t.addEventListener("input",()=>{o.dirty=!0,i()}),t.addEventListener("focusout",()=>{o.touched=!0,i()}),t.addEventListener("submit",()=>{o.submitting=!0,n.$set("$form",{...o}),requestAnimationFrame(()=>{o.submitting=!1,n.$set("$form",{...o})})}),requestAnimationFrame(i);return}if(r&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")){let o=t.getAttribute("error");t.addEventListener("input",()=>{let i=Se(t.value,r,{});if(i&&o){let s=t.nextElementSibling?.__validationError?t.nextElementSibling:null;s||(s=document.createElement("div"),s.__validationError=!0,s.style.display="contents",t.parentNode.insertBefore(s,t.nextSibling));let a=J(o);if(a){let c=P({err:{message:i}},n);s.innerHTML="",s.__ctx=c,s.appendChild(a),O(s)}}else{let s=t.nextElementSibling?.__validationError?t.nextElementSibling:null;s&&(s.innerHTML="")}})}}});I("error-boundary",{priority:1,init(t,e,r){let n=$(t);function o(s){let a=J(r);if(a){let c=P({err:{message:s}},n);t.innerHTML="";let l=document.createElement("div");l.style.display="contents",l.__ctx=c,l.appendChild(a),t.appendChild(l),O(l)}}t.addEventListener("nojs:error",s=>{o(s.detail?.message||"An error occurred")});let i=s=>{(t.contains(s.target)||t===s.target)&&o(s.message||"An error occurred")};window.addEventListener("error",i),Z(()=>window.removeEventListener("error",i))}});ft();K();I("t",{priority:20,init(t,e,r){let n=$(t),o=t.hasAttribute("t-html");function i(){let s={};for(let c of[...t.attributes])if(c.name.startsWith("t-")&&c.name!=="t"&&c.name!=="t-html"){let l=c.name.replace("t-","");s[l]=L(c.value,n)??c.value}let a=U.t(r,s);o?t.innerHTML=a:t.textContent=a}z(r,n,i),kt(i),i()}});I("i18n-ns",{priority:1,init(t,e,r){if(!r)return;let n=document.createDocumentFragment();for(;t.firstChild;)n.appendChild(t.firstChild);Yt(r).then(()=>{t.appendChild(n),O(t),$t()})}});K();var h={dragging:null,selected:new Map,placeholder:null};function Ht(t){let e=0;for(let r of t.children){if(r.classList.contains("nojs-drop-placeholder"))continue;(r.style||{}).display==="contents"?e+=Ht(r):e++}return e}function ee(){if(typeof document>"u"||document.querySelector("style[data-nojs-dnd]"))return;let t=`
|
|
25
25
|
.nojs-dragging {
|
|
26
26
|
opacity: 0.5;
|
|
27
27
|
cursor: grabbing !important;
|
|
@@ -60,5 +60,5 @@ ${f}`)(e,d,...a),typeof t=="string"&&t.includes("$store")&&wt()}catch(n){st("Exp
|
|
|
60
60
|
.nojs-drag-list-empty {
|
|
61
61
|
min-height: 3rem;
|
|
62
62
|
}
|
|
63
|
-
`.trim(),e=document.createElement("style");e.setAttribute("data-nojs-dnd",""),e.textContent=t,document.head.appendChild(e)}function Mt(t,e,r,n){let o=[...t.children].filter(i=>!i.classList.contains("nojs-drop-placeholder"));if(o.length===0)return 0;for(let i=0;i<o.length;i++){let a=(o[i].style&&o[i].style.display==="contents"&&o[i].firstElementChild||o[i]).getBoundingClientRect();if(n==="horizontal"){let c=a.left+a.width/2;if(e<c)return i}else if(n==="grid"){let c=a.left+a.width/2,l=a.top+a.height/2;if(r<l&&e<c||r<a.top+a.height&&e<c)return i}else{let c=a.top+a.height/2;if(r<c)return i}}return o.length}function he(t,e,r,n){at();let o;if(r==="auto"){if(o=document.createElement("div"),o.className=n||"nojs-drop-placeholder",g.dragging&&g.dragging.sourceEl){let a=(g.dragging.sourceEl.firstElementChild||g.dragging.sourceEl).getBoundingClientRect();a.height>0&&(o.style.height=a.height+"px"),a.width>0&&(o.style.width=a.width+"px")}}else{let s=document.getElementById(r.startsWith("#")?r.slice(1):r);s&&s.content?(o=document.createElement("div"),o.style.display="contents",o.className=n||"nojs-drop-placeholder",o.appendChild(s.content.cloneNode(!0))):(o=document.createElement("div"),o.className=n||"nojs-drop-placeholder")}o.classList.add("nojs-drop-placeholder");let i=[...t.children].filter(s=>!s.classList.contains("nojs-drop-placeholder"));e>=i.length?t.appendChild(o):t.insertBefore(o,i[e]),g.placeholder=o}function at(){g.placeholder&&(g.placeholder.remove(),g.placeholder=null)}function Et(t,e){return!e||e==="*"?!0:e.split(",").map(n=>n.trim()).includes(t)}function Ie(t,e){let r=document.createElement("div");r.style.cssText="position:fixed;top:-9999px;left:-9999px;pointer-events:none;z-index:99999;";let n=t.style&&t.style.display==="contents"&&t.firstElementChild||t,o=n.getBoundingClientRect(),i=o.width,s=o.height,a=getComputedStyle(n),c=Math.min(e,3);for(let d=c-1;d>=0;d--){let f=document.createElement("div"),p=d*4;f.style.cssText="position:absolute;top:"+p+"px;left:"+p+"px;width:"+i+"px;height:"+s+"px;border-radius:"+a.borderRadius+";box-shadow:0 1px 4px rgba(0,0,0,0.12);overflow:hidden;box-sizing:border-box;",d===0?(f.innerHTML=n.innerHTML,f.style.background=a.backgroundColor||"#fff",f.style.border=a.border,f.style.padding=a.padding,f.style.fontSize=a.fontSize,f.style.color=a.color,f.style.fontFamily=a.fontFamily):(f.style.background=a.backgroundColor||"#fff",f.style.border=a.border||"1px solid #ddd"),r.appendChild(f)}let l=document.createElement("div");return l.textContent=e,l.style.cssText="position:absolute;top:-6px;right:-6px;min-width:22px;height:22px;padding:0 5px;background:#3b82f6;color:#fff;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,0.2);",r.appendChild(l),r.style.width=i+(c-1)*4+"px",r.style.height=s+(c-1)*4+"px",r}$("drag",{priority:15,init(t,e,r){Vt();let n=I(t),o=t.getAttribute("drag-type")||"default",i=t.getAttribute("drag-effect")||"move",s=t.getAttribute("drag-handle"),a=t.getAttribute("drag-image"),c=t.getAttribute("drag-image-offset")||"0,0",l=t.getAttribute("drag-disabled"),d=t.getAttribute("drag-class")||"nojs-dragging",f=t.getAttribute("drag-ghost-class");t.draggable=!0,t.setAttribute("aria-grabbed","false"),t.getAttribute("tabindex")||t.setAttribute("tabindex","0");let p=!0;if(s){let x=w=>{p=!!w.target.closest(s)};t.addEventListener("mousedown",x),Q(()=>t.removeEventListener("mousedown",x))}let u=x=>{if(s&&!p){x.preventDefault();return}if(l&&L(l,n)){x.preventDefault();return}let w=L(r,n),y=t.getAttribute("drag-group"),E=w;if(y&&g.selected.has(y)){let _=g.selected.get(y);_.size>0&&[..._].some(A=>A.el===t)&&(E=[..._].map(A=>A.item))}if(g.dragging={item:E,type:o,effect:i,sourceEl:t,sourceCtx:n,sourceList:null,sourceIndex:null,listDirective:null},x.dataTransfer){if(x.dataTransfer.effectAllowed=i,x.dataTransfer.setData("text/plain",""),Array.isArray(E)&&E.length>1&&x.dataTransfer.setDragImage){let _=Ie(t,E.length);document.body.appendChild(_);let C=t.getBoundingClientRect();x.dataTransfer.setDragImage(_,C.width/2,C.height/2),requestAnimationFrame(()=>_.remove())}else if(a&&x.dataTransfer.setDragImage)if(a==="none"){let _=document.createElement("div");_.style.cssText="width:1px;height:1px;opacity:0;position:fixed;top:-999px",document.body.appendChild(_);let[C,A]=c.split(",").map(Number);x.dataTransfer.setDragImage(_,C||0,A||0),requestAnimationFrame(()=>_.remove())}else{let _=t.querySelector(a);if(_){let[C,A]=c.split(",").map(Number);f&&_.classList.add(f),x.dataTransfer.setDragImage(_,C||0,A||0)}}}if(d.split(/\s+/).filter(Boolean).forEach(_=>t.classList.add(_)),Array.isArray(E)&&y&&g.selected.has(y))for(let _ of g.selected.get(y))_.el!==t&&d.split(/\s+/).filter(Boolean).forEach(C=>_.el.classList.add(C));t.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:E,index:g.dragging.sourceIndex,el:t}}))},m=()=>{d.split(/\s+/).filter(Boolean).forEach(w=>t.classList.remove(w));let x=t.getAttribute("drag-group");if(x&&g.selected.has(x))for(let w of g.selected.get(x))d.split(/\s+/).filter(Boolean).forEach(y=>w.el.classList.remove(y));if(t.setAttribute("aria-grabbed","false"),f&&a&&a!=="none"){let w=t.querySelector(a);w&&w.classList.remove(f)}t.dispatchEvent(new CustomEvent("drag-end",{bubbles:!0,detail:{item:g.dragging?.item,index:g.dragging?.sourceIndex,dropped:g.dragging===null}})),g.dragging=null,at()};if(t.addEventListener("dragstart",u),t.addEventListener("dragend",m),Q(()=>{t.removeEventListener("dragstart",u),t.removeEventListener("dragend",m)}),l){let x=function(){let w=!!L(l,n);t.draggable=!w,w?t.removeAttribute("aria-grabbed"):t.setAttribute("aria-grabbed","false")};n.$watch(x)}let b=x=>{if(g.dragging&&!g.dragging.sourceEl.isConnected&&(g.dragging=null),x.key===" "&&!g.dragging){x.preventDefault();let w=L(r,n);g.dragging={item:w,type:o,effect:i,sourceEl:t,sourceCtx:n,sourceList:null,sourceIndex:null,listDirective:null},d.split(/\s+/).filter(Boolean).forEach(y=>t.classList.add(y)),t.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:w,index:null,el:t}}))}else x.key==="Escape"&&g.dragging&&g.dragging.sourceEl===t&&(x.preventDefault(),d.split(/\s+/).filter(Boolean).forEach(w=>t.classList.remove(w)),t.setAttribute("aria-grabbed","false"),g.dragging=null,at())};t.addEventListener("keydown",b),Q(()=>t.removeEventListener("keydown",b))}});$("drop",{priority:15,init(t,e,r){Vt();let n=I(t),o=t.getAttribute("drop-accept")||"default",i=t.getAttribute("drop-effect")||"move",s=t.getAttribute("drop-class")||"nojs-drag-over",a=t.getAttribute("drop-reject-class")||"nojs-drop-reject",c=t.getAttribute("drop-disabled"),l=t.getAttribute("drop-max"),d=t.getAttribute("drop-sort"),f=t.getAttribute("drop-placeholder"),p=t.getAttribute("drop-placeholder-class");t.setAttribute("aria-dropeffect",i);let u=0,m=E=>{if(!g.dragging||c&&L(c,n))return;let _=Et(g.dragging.type,o),C=!0;if(l){let A=L(l,n),v=jt(t);typeof A=="number"&&v>=A&&(C=!1)}if(!_||!C){a.split(/\s+/).filter(Boolean).forEach(A=>t.classList.add(A)),s.split(/\s+/).filter(Boolean).forEach(A=>t.classList.remove(A)),at();return}if(a.split(/\s+/).filter(Boolean).forEach(A=>t.classList.remove(A)),E.preventDefault(),E.dataTransfer&&(E.dataTransfer.dropEffect=i),d){let A=Mt(t,E.clientX,E.clientY,d);f&&he(t,A,f,p),t.dispatchEvent(new CustomEvent("drag-over",{bubbles:!1,detail:{item:g.dragging.item,index:A}}))}},b=E=>{if(g.dragging&&!(c&&L(c,n))&&(u++,u===1)){let _=Et(g.dragging.type,o),C=!0;if(l){let A=L(l,n),v=jt(t);typeof A=="number"&&v>=A&&(C=!1)}_&&C?(s.split(/\s+/).filter(Boolean).forEach(A=>t.classList.add(A)),t.dispatchEvent(new CustomEvent("drag-enter",{bubbles:!1,detail:{item:g.dragging.item,type:g.dragging.type}}))):a.split(/\s+/).filter(Boolean).forEach(A=>t.classList.add(A))}},x=E=>{g.dragging&&(u--,u<=0&&(u=0,s.split(/\s+/).filter(Boolean).forEach(_=>t.classList.remove(_)),a.split(/\s+/).filter(Boolean).forEach(_=>t.classList.remove(_)),at(),t.dispatchEvent(new CustomEvent("drag-leave",{bubbles:!1,detail:{item:g.dragging.item}}))))},w=E=>{if(E.preventDefault(),E.stopPropagation(),u=0,!g.dragging||c&&L(c,n)||!Et(g.dragging.type,o))return;if(l){let S=L(l,n),D=jt(t);if(typeof S=="number"&&D>=S)return}let _=g.dragging.item,C=g.dragging.type,A=g.dragging.effect,v=0;d&&(v=Mt(t,E.clientX,E.clientY,d)),s.split(/\s+/).filter(Boolean).forEach(S=>t.classList.remove(S)),a.split(/\s+/).filter(Boolean).forEach(S=>t.classList.remove(S)),at();let j={$drag:_,$dragType:C,$dragEffect:A,$dropIndex:v,$source:{list:g.dragging.sourceList,index:g.dragging.sourceIndex,el:g.dragging.sourceEl},$target:{list:null,index:v,el:t},$el:t};Z(r,n,j),g.dragging=null,t.dispatchEvent(new CustomEvent("drop",{bubbles:!1,detail:{item:_,index:v,source:j.$source,target:j.$target,effect:A}}))},y=E=>{g.dragging&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),w(E))};t.addEventListener("dragover",m),t.addEventListener("dragenter",b),t.addEventListener("dragleave",x),t.addEventListener("drop",w),t.addEventListener("keydown",y),Q(()=>{t.removeEventListener("dragover",m),t.removeEventListener("dragenter",b),t.removeEventListener("dragleave",x),t.removeEventListener("drop",w),t.removeEventListener("keydown",y)})}});var ge=new Map;$("drag-list",{priority:10,init(t,e,r){Vt();let n=I(t),o=t.getAttribute("template"),i=t.getAttribute("drag-list-key"),s=t.getAttribute("drag-list-item")||"item",a=t.getAttribute("drop-sort")||"vertical",c=t.getAttribute("drag-type")||"__draglist_"+r,l=t.getAttribute("drop-accept")||c,d=t.hasAttribute("drag-list-copy"),f=t.hasAttribute("drag-list-remove"),p=t.getAttribute("drag-disabled"),u=t.getAttribute("drop-disabled"),m=t.getAttribute("drop-max"),b=t.getAttribute("drop-placeholder"),x=t.getAttribute("drop-placeholder-class"),w=t.getAttribute("drag-class")||"nojs-dragging",y=t.getAttribute("drop-class")||"nojs-drag-over",E=t.getAttribute("drop-reject-class")||"nojs-drop-reject",_=t.getAttribute("drop-settle-class")||"nojs-drop-settle",C=t.getAttribute("drop-empty-class")||"nojs-drag-list-empty";t.setAttribute("role","listbox"),t.setAttribute("aria-dropeffect",d?"copy":"move");let A={listPath:r,ctx:n,el:t};ge.set(t,A),Q(()=>ge.delete(t));let v=0,j=null;function S(){let B=nt(r,n);if(!Array.isArray(B))return;if(B===j&&B.length>0&&t.children.length>0){for(let T of t.children)T.__ctx&&T.__ctx.$notify&&T.__ctx.$notify();return}j=B;let O=o?document.getElementById(o):null;if(!O)return;t.innerHTML="";let F=B.length;B.forEach((T,rt)=>{let ut={[s]:T,$index:rt,$count:F,$first:rt===0,$last:rt===F-1,$even:rt%2===0,$odd:rt%2!==0},ot=P(ut,n),G=O.content.cloneNode(!0),H=document.createElement("div");H.style.display="contents",H.__ctx=ot,H.setAttribute("role","option"),H.appendChild(G),t.appendChild(H);let Y=H.firstElementChild||H;Y.draggable=!0,Y.setAttribute("aria-grabbed","false"),Y.getAttribute("tabindex")||Y.setAttribute("tabindex","0");let xt=tt=>{if(p&&L(p,n)){tt.preventDefault();return}g.dragging={item:T,type:c,effect:d?"copy":"move",sourceEl:H,sourceCtx:ot,sourceList:B,sourceIndex:rt,listDirective:{el:t,listPath:r,ctx:n,keyProp:i,copyMode:d,removeMode:f}},tt.dataTransfer&&(tt.dataTransfer.effectAllowed=d?"copy":"move",tt.dataTransfer.setData("text/plain","")),w.split(/\s+/).filter(Boolean).forEach(it=>Y.classList.add(it)),Y.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:T,index:rt,el:Y}}))},Ht=()=>{w.split(/\s+/).filter(Boolean).forEach(tt=>Y.classList.remove(tt)),Y.setAttribute("aria-grabbed","false"),g.dragging&&g.dragging.sourceEl===H&&(g.dragging=null),at()};H.addEventListener("dragstart",xt),H.addEventListener("dragend",Ht),H.addEventListener("keydown",tt=>{if(tt.key===" "&&!g.dragging)tt.preventDefault(),g.dragging={item:T,type:c,effect:d?"copy":"move",sourceEl:H,sourceCtx:ot,sourceList:B,sourceIndex:rt,listDirective:{el:t,listPath:r,ctx:n,keyProp:i,copyMode:d,removeMode:f}},w.split(/\s+/).filter(Boolean).forEach(it=>Y.classList.add(it)),Y.setAttribute("aria-grabbed","true");else if(tt.key==="Escape"&&g.dragging&&g.dragging.sourceEl===H)tt.preventDefault(),w.split(/\s+/).filter(Boolean).forEach(it=>Y.classList.remove(it)),Y.setAttribute("aria-grabbed","false"),g.dragging=null,at();else if((tt.key==="ArrowDown"||tt.key==="ArrowRight")&&g.dragging&&g.dragging.sourceEl===H){tt.preventDefault();let it=H.nextElementSibling;it&&(it.firstElementChild||it).focus()}else if((tt.key==="ArrowUp"||tt.key==="ArrowLeft")&&g.dragging&&g.dragging.sourceEl===H){tt.preventDefault();let it=H.previousElementSibling;it&&(it.firstElementChild||it).focus()}}),M(H)});let N=B.length===0;C.split(/\s+/).filter(Boolean).forEach(T=>t.classList.toggle(T,N))}let D=B=>{if(!g.dragging||u&&L(u,n))return;let O=Et(g.dragging.type,l),F=!0;if(m){let T=L(m,n),rt=nt(r,n);typeof T=="number"&&Array.isArray(rt)&&rt.length>=T&&(F=!1)}if(!O||!F){E.split(/\s+/).filter(Boolean).forEach(T=>t.classList.add(T)),y.split(/\s+/).filter(Boolean).forEach(T=>t.classList.remove(T)),at();return}E.split(/\s+/).filter(Boolean).forEach(T=>t.classList.remove(T)),B.preventDefault(),B.dataTransfer&&(B.dataTransfer.dropEffect=d?"copy":"move");let N=Mt(t,B.clientX,B.clientY,a);b&&he(t,N,b,x)},J=B=>{if(g.dragging&&!(u&&L(u,n))&&(v++,v===1)){let O=Et(g.dragging.type,l),F=!0;if(m){let N=L(m,n),T=nt(r,n);typeof N=="number"&&Array.isArray(T)&&T.length>=N&&(F=!1)}O&&F?(y.split(/\s+/).filter(Boolean).forEach(N=>t.classList.add(N)),t.dispatchEvent(new CustomEvent("drag-enter",{bubbles:!1,detail:{item:g.dragging.item,type:g.dragging.type}}))):E.split(/\s+/).filter(Boolean).forEach(N=>t.classList.add(N))}},R=()=>{g.dragging&&(v--,v<=0&&(v=0,y.split(/\s+/).filter(Boolean).forEach(B=>t.classList.remove(B)),E.split(/\s+/).filter(Boolean).forEach(B=>t.classList.remove(B)),at(),t.dispatchEvent(new CustomEvent("drag-leave",{bubbles:!1,detail:{item:g.dragging?.item}}))))},lt=B=>{if(B.preventDefault(),B.stopPropagation(),v=0,!g.dragging||u&&L(u,n)||!Et(g.dragging.type,l))return;if(m){let G=L(m,n),H=nt(r,n);if(typeof G=="number"&&Array.isArray(H)&&H.length>=G)return}let O=g.dragging.item,F=g.dragging.listDirective,N=g.dragging.sourceIndex,T=Mt(t,B.clientX,B.clientY,a);y.split(/\s+/).filter(Boolean).forEach(G=>t.classList.remove(G)),E.split(/\s+/).filter(Boolean).forEach(G=>t.classList.remove(G)),at();let rt=nt(r,n);if(!Array.isArray(rt))return;let ut=F&&F.el===t;if(ut&&N===T){g.dragging=null;return}if(ut&&N+1===T){g.dragging=null;return}let ot=[...rt];if(ut){let[G]=ot.splice(N,1),H=N<T?T-1:T;ot.splice(H,0,G),n.$set(r,ot),t.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{list:ot,item:O,from:N,to:H}}))}else{let G=d&&typeof O=="object"?{...O}:O;if(ot.splice(T,0,G),n.$set(r,ot),F&&!F.copyMode&&(f||F.removeMode)){let H=nt(F.listPath,F.ctx);if(Array.isArray(H)&&N!=null){let Y=H.filter((xt,Ht)=>Ht!==N);F.ctx.$set(F.listPath,Y),F.el.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{list:Y,item:O,index:N}}))}}t.dispatchEvent(new CustomEvent("receive",{bubbles:!0,detail:{list:ot,item:O,from:N,fromList:F?nt(F.listPath,F.ctx):null}}))}requestAnimationFrame(()=>{let H=[...t.children][ut&&N<T?T-1:T];if(H){let Y=H.firstElementChild||H;_.split(/\s+/).filter(Boolean).forEach(xt=>Y.classList.add(xt)),Y.addEventListener("animationend",()=>{_.split(/\s+/).filter(Boolean).forEach(xt=>Y.classList.remove(xt))},{once:!0})}}),g.dragging=null},U=B=>{if(g.dragging&&Et(g.dragging.type,l)&&(B.key==="Enter"||B.key===" ")){B.preventDefault();let O=t.querySelector(":focus");if(O){let N=(O.style?.display==="contents"&&O.firstElementChild||O).getBoundingClientRect(),T={preventDefault(){},stopPropagation(){},clientX:N.left+N.width/2,clientY:N.top+N.height+1,dataTransfer:null};lt(T)}}};t.addEventListener("dragover",D),t.addEventListener("dragenter",J),t.addEventListener("dragleave",R),t.addEventListener("drop",lt),t.addEventListener("keydown",U),Q(()=>{t.removeEventListener("dragover",D),t.removeEventListener("dragenter",J),t.removeEventListener("dragleave",R),t.removeEventListener("drop",lt),t.removeEventListener("keydown",U)}),n.$watch(S),S()}});$("drag-multiple",{priority:16,init(t,e){let r=I(t),n=t.getAttribute("drag-group"),o=t.getAttribute("drag-multiple-class")||"nojs-selected";if(!n){st("drag-multiple requires drag-group attribute");return}g.selected.has(n)||g.selected.set(n,new Set);let i=g.selected.get(n),s=c=>{let l=t.getAttribute("drag"),f={item:l?L(l,r):null,el:t,ctx:r};if(c.ctrlKey||c.metaKey){let p=[...i].find(u=>u.el===t);p?(i.delete(p),o.split(/\s+/).filter(Boolean).forEach(u=>t.classList.remove(u))):(i.add(f),o.split(/\s+/).filter(Boolean).forEach(u=>t.classList.add(u)))}else{for(let p of i)o.split(/\s+/).filter(Boolean).forEach(u=>p.el.classList.remove(u));i.clear(),i.add(f),o.split(/\s+/).filter(Boolean).forEach(p=>t.classList.add(p))}};t.addEventListener("click",s),Q(()=>{t.removeEventListener("click",s);let c=[...i].find(l=>l.el===t);c&&i.delete(c)});let a=c=>{if(c.key==="Escape"){for(let l of i)o.split(/\s+/).filter(Boolean).forEach(d=>l.el.classList.remove(d));i.clear()}};window.addEventListener("keydown",a),Q(()=>window.removeEventListener("keydown",a))}});function De(){if(typeof window>"u")return null;let t=h.router||{};if(t.mode==="hash")return window.location.hash.slice(1)||"/";let e=(t.base||"/").replace(/\/$/,"");return window.location.pathname.replace(e,"")||"/"}var Ot={get baseApiUrl(){return h.baseApiUrl},set baseApiUrl(t){h.baseApiUrl=t},get locale(){return W.locale},set locale(t){W.locale=t},config(t={}){let e={...h.headers},r={...h.cache},n={...h.templates},o={...h.router},i={...h.i18n};Object.assign(h,t),t.headers&&(h.headers={...e,...t.headers}),t.csrf&&(h.csrf=t.csrf),t.cache&&(h.cache={...r,...t.cache}),t.templates&&(h.templates={...n,...t.templates}),t.router&&(h.router={...o,...t.router}),t.i18n&&(h.i18n={...i,...t.i18n},W.locale=t.i18n.defaultLocale||W.locale)},async init(t){if(typeof document>"u"||Ot._initialized)return;if(Ot._initialized=!0,t=t||document.body,z("Initializing..."),h.i18n.loadPath){let r=new Set([W.locale,h.i18n.fallbackLocale]);await Promise.all([...r].map(n=>zt(n)))}kt(t);let e=De();await se(e),document.querySelector("[route-view]")&&Zt(pe()),M(t),et&&await et.init(),z("Initialized."),ae(),h.devtools&&typeof window<"u"&&(window.__NOJS_DEVTOOLS__={stores:V,config:h,refs:ft,router:et,filters:Object.keys(k),validators:Object.keys(_t),version:Ot.version},z("DevTools enabled \u2014 access via window.__NOJS_DEVTOOLS__"))},directive(t,e){$(t,e)},filter(t,e){k[t]=e},validator(t,e){_t[t]=e},i18n(t){if(t.loadPath!=null&&(h.i18n.loadPath=t.loadPath),t.ns&&(h.i18n.ns=t.ns),t.cache!=null&&(h.i18n.cache=t.cache),t.persist!=null&&(h.i18n.persist=t.persist),t.locales&&(W.locales=t.locales),t.fallbackLocale&&(h.i18n.fallbackLocale=t.fallbackLocale),t.defaultLocale&&(W._locale=t.defaultLocale),h.i18n.persist&&typeof localStorage<"u")try{let e=localStorage.getItem("nojs-locale");if(e){W._locale=e;return}}catch{}if(t.detectBrowser){let e=typeof navigator<"u"?navigator.language:"en",r=e.split("-")[0];W.locales[e]?W._locale=e:W.locales[r]&&(W._locale=r)}},on(t,e){return yt[t]||(yt[t]=[]),yt[t].push(e),()=>{yt[t]=yt[t].filter(r=>r!==e)}},interceptor(t,e){At[t]&&At[t].push(e)},get store(){return V},get router(){return et},createContext:P,evaluate:L,findContext:I,processTree:M,resolve:nt,version:"1.5.1"},Ne=Ot;
|
|
63
|
+
`.trim(),e=document.createElement("style");e.setAttribute("data-nojs-dnd",""),e.textContent=t,document.head.appendChild(e)}function Rt(t,e,r,n){let o=[...t.children].filter(i=>!i.classList.contains("nojs-drop-placeholder"));if(o.length===0)return 0;for(let i=0;i<o.length;i++){let a=(o[i].style&&o[i].style.display==="contents"&&o[i].firstElementChild||o[i]).getBoundingClientRect();if(n==="horizontal"){let c=a.left+a.width/2;if(e<c)return i}else if(n==="grid"){let c=a.left+a.width/2,l=a.top+a.height/2;if(r<l&&e<c||r<a.top+a.height&&e<c)return i}else{let c=a.top+a.height/2;if(r<c)return i}}return o.length}function $e(t,e,r,n){lt();let o;if(r==="auto"){if(o=document.createElement("div"),o.className=n||"nojs-drop-placeholder",h.dragging&&h.dragging.sourceEl){let a=(h.dragging.sourceEl.firstElementChild||h.dragging.sourceEl).getBoundingClientRect();a.height>0&&(o.style.height=a.height+"px"),a.width>0&&(o.style.width=a.width+"px")}}else{let s=document.getElementById(r.startsWith("#")?r.slice(1):r);s&&s.content?(o=document.createElement("div"),o.style.display="contents",o.className=n||"nojs-drop-placeholder",o.appendChild(s.content.cloneNode(!0))):(o=document.createElement("div"),o.className=n||"nojs-drop-placeholder")}o.classList.add("nojs-drop-placeholder");let i=[...t.children].filter(s=>!s.classList.contains("nojs-drop-placeholder"));e>=i.length?t.appendChild(o):t.insertBefore(o,i[e]),h.placeholder=o}function lt(){h.placeholder&&(h.placeholder.remove(),h.placeholder=null)}function wt(t,e){return!e||e==="*"?!0:e.split(",").map(n=>n.trim()).includes(t)}function Ke(t,e){let r=document.createElement("div");r.style.cssText="position:fixed;top:-9999px;left:-9999px;pointer-events:none;z-index:99999;";let n=t.style&&t.style.display==="contents"&&t.firstElementChild||t,o=n.getBoundingClientRect(),i=o.width,s=o.height,a=getComputedStyle(n),c=Math.min(e,3);for(let d=c-1;d>=0;d--){let f=document.createElement("div"),p=d*4;f.style.cssText="position:absolute;top:"+p+"px;left:"+p+"px;width:"+i+"px;height:"+s+"px;border-radius:"+a.borderRadius+";box-shadow:0 1px 4px rgba(0,0,0,0.12);overflow:hidden;box-sizing:border-box;",d===0?(f.innerHTML=n.innerHTML,f.style.background=a.backgroundColor||"#fff",f.style.border=a.border,f.style.padding=a.padding,f.style.fontSize=a.fontSize,f.style.color=a.color,f.style.fontFamily=a.fontFamily):(f.style.background=a.backgroundColor||"#fff",f.style.border=a.border||"1px solid #ddd"),r.appendChild(f)}let l=document.createElement("div");return l.textContent=e,l.style.cssText="position:absolute;top:-6px;right:-6px;min-width:22px;height:22px;padding:0 5px;background:#3b82f6;color:#fff;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,0.2);",r.appendChild(l),r.style.width=i+(c-1)*4+"px",r.style.height=s+(c-1)*4+"px",r}I("drag",{priority:15,init(t,e,r){ee();let n=$(t),o=t.getAttribute("drag-type")||"default",i=t.getAttribute("drag-effect")||"move",s=t.getAttribute("drag-handle"),a=t.getAttribute("drag-image"),c=t.getAttribute("drag-image-offset")||"0,0",l=t.getAttribute("drag-disabled"),d=t.getAttribute("drag-class")||"nojs-dragging",f=t.getAttribute("drag-ghost-class");t.draggable=!0,t.setAttribute("aria-grabbed","false"),t.getAttribute("tabindex")||t.setAttribute("tabindex","0");let p=!0;if(s){let x=A=>{p=!!A.target.closest(s)};t.addEventListener("mousedown",x),Z(()=>t.removeEventListener("mousedown",x))}let u=x=>{if(s&&!p){x.preventDefault();return}if(l&&L(l,n)){x.preventDefault();return}let A=L(r,n),y=t.getAttribute("drag-group"),E=A;if(y&&h.selected.has(y)){let _=h.selected.get(y);_.size>0&&[..._].some(w=>w.el===t)&&(E=[..._].map(w=>w.item))}if(h.dragging={item:E,type:o,effect:i,sourceEl:t,sourceCtx:n,sourceList:null,sourceIndex:null,listDirective:null},x.dataTransfer){if(x.dataTransfer.effectAllowed=i,x.dataTransfer.setData("text/plain",""),Array.isArray(E)&&E.length>1&&x.dataTransfer.setDragImage){let _=Ke(t,E.length);document.body.appendChild(_);let C=t.getBoundingClientRect();x.dataTransfer.setDragImage(_,C.width/2,C.height/2),requestAnimationFrame(()=>_.remove())}else if(a&&x.dataTransfer.setDragImage)if(a==="none"){let _=document.createElement("div");_.style.cssText="width:1px;height:1px;opacity:0;position:fixed;top:-999px",document.body.appendChild(_);let[C,w]=c.split(",").map(Number);x.dataTransfer.setDragImage(_,C||0,w||0),requestAnimationFrame(()=>_.remove())}else{let _=t.querySelector(a);if(_){let[C,w]=c.split(",").map(Number);f&&_.classList.add(f),x.dataTransfer.setDragImage(_,C||0,w||0)}}}if(d.split(/\s+/).filter(Boolean).forEach(_=>t.classList.add(_)),Array.isArray(E)&&y&&h.selected.has(y))for(let _ of h.selected.get(y))_.el!==t&&d.split(/\s+/).filter(Boolean).forEach(C=>_.el.classList.add(C));t.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:E,index:h.dragging.sourceIndex,el:t}}))},m=()=>{d.split(/\s+/).filter(Boolean).forEach(A=>t.classList.remove(A));let x=t.getAttribute("drag-group");if(x&&h.selected.has(x))for(let A of h.selected.get(x))d.split(/\s+/).filter(Boolean).forEach(y=>A.el.classList.remove(y));if(t.setAttribute("aria-grabbed","false"),f&&a&&a!=="none"){let A=t.querySelector(a);A&&A.classList.remove(f)}t.dispatchEvent(new CustomEvent("drag-end",{bubbles:!0,detail:{item:h.dragging?.item,index:h.dragging?.sourceIndex,dropped:h.dragging===null}})),h.dragging=null,lt()};if(t.addEventListener("dragstart",u),t.addEventListener("dragend",m),Z(()=>{t.removeEventListener("dragstart",u),t.removeEventListener("dragend",m)}),l){let x=function(){let A=!!L(l,n);t.draggable=!A,A?t.removeAttribute("aria-grabbed"):t.setAttribute("aria-grabbed","false")};n.$watch(x)}let b=x=>{if(h.dragging&&!h.dragging.sourceEl.isConnected&&(h.dragging=null),x.key===" "&&!h.dragging){x.preventDefault();let A=L(r,n);h.dragging={item:A,type:o,effect:i,sourceEl:t,sourceCtx:n,sourceList:null,sourceIndex:null,listDirective:null},d.split(/\s+/).filter(Boolean).forEach(y=>t.classList.add(y)),t.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:A,index:null,el:t}}))}else x.key==="Escape"&&h.dragging&&h.dragging.sourceEl===t&&(x.preventDefault(),d.split(/\s+/).filter(Boolean).forEach(A=>t.classList.remove(A)),t.setAttribute("aria-grabbed","false"),h.dragging=null,lt())};t.addEventListener("keydown",b),Z(()=>t.removeEventListener("keydown",b))}});I("drop",{priority:15,init(t,e,r){ee();let n=$(t),o=t.getAttribute("drop-accept")||"default",i=t.getAttribute("drop-effect")||"move",s=t.getAttribute("drop-class")||"nojs-drag-over",a=t.getAttribute("drop-reject-class")||"nojs-drop-reject",c=t.getAttribute("drop-disabled"),l=t.getAttribute("drop-max"),d=t.getAttribute("drop-sort"),f=t.getAttribute("drop-placeholder"),p=t.getAttribute("drop-placeholder-class");t.setAttribute("aria-dropeffect",i);let u=0,m=E=>{if(!h.dragging||c&&L(c,n))return;let _=wt(h.dragging.type,o),C=!0;if(l){let w=L(l,n),v=Ht(t);typeof w=="number"&&v>=w&&(C=!1)}if(!_||!C){a.split(/\s+/).filter(Boolean).forEach(w=>t.classList.add(w)),s.split(/\s+/).filter(Boolean).forEach(w=>t.classList.remove(w)),lt();return}if(a.split(/\s+/).filter(Boolean).forEach(w=>t.classList.remove(w)),E.preventDefault(),E.dataTransfer&&(E.dataTransfer.dropEffect=i),d){let w=Rt(t,E.clientX,E.clientY,d);f&&$e(t,w,f,p),t.dispatchEvent(new CustomEvent("drag-over",{bubbles:!1,detail:{item:h.dragging.item,index:w}}))}},b=E=>{if(h.dragging&&!(c&&L(c,n))&&(u++,u===1)){let _=wt(h.dragging.type,o),C=!0;if(l){let w=L(l,n),v=Ht(t);typeof w=="number"&&v>=w&&(C=!1)}_&&C?(s.split(/\s+/).filter(Boolean).forEach(w=>t.classList.add(w)),t.dispatchEvent(new CustomEvent("drag-enter",{bubbles:!1,detail:{item:h.dragging.item,type:h.dragging.type}}))):a.split(/\s+/).filter(Boolean).forEach(w=>t.classList.add(w))}},x=E=>{h.dragging&&(u--,u<=0&&(u=0,s.split(/\s+/).filter(Boolean).forEach(_=>t.classList.remove(_)),a.split(/\s+/).filter(Boolean).forEach(_=>t.classList.remove(_)),lt(),t.dispatchEvent(new CustomEvent("drag-leave",{bubbles:!1,detail:{item:h.dragging.item}}))))},A=E=>{if(E.preventDefault(),E.stopPropagation(),u=0,!h.dragging||c&&L(c,n)||!wt(h.dragging.type,o))return;if(l){let S=L(l,n),N=Ht(t);if(typeof S=="number"&&N>=S)return}let _=h.dragging.item,C=h.dragging.type,w=h.dragging.effect,v=0;d&&(v=Rt(t,E.clientX,E.clientY,d)),s.split(/\s+/).filter(Boolean).forEach(S=>t.classList.remove(S)),a.split(/\s+/).filter(Boolean).forEach(S=>t.classList.remove(S)),lt();let B={$drag:_,$dragType:C,$dragEffect:w,$dropIndex:v,$source:{list:h.dragging.sourceList,index:h.dragging.sourceIndex,el:h.dragging.sourceEl},$target:{list:null,index:v,el:t},$el:t};tt(r,n,B),h.dragging=null,t.dispatchEvent(new CustomEvent("drop",{bubbles:!1,detail:{item:_,index:v,source:B.$source,target:B.$target,effect:w}}))},y=E=>{h.dragging&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),A(E))};t.addEventListener("dragover",m),t.addEventListener("dragenter",b),t.addEventListener("dragleave",x),t.addEventListener("drop",A),t.addEventListener("keydown",y),Z(()=>{t.removeEventListener("dragover",m),t.removeEventListener("dragenter",b),t.removeEventListener("dragleave",x),t.removeEventListener("drop",A),t.removeEventListener("keydown",y)})}});var Ie=new Map;I("drag-list",{priority:10,init(t,e,r){ee();let n=$(t),o=t.getAttribute("template"),i=t.getAttribute("drag-list-key"),s=t.getAttribute("drag-list-item")||"item",a=t.getAttribute("drop-sort")||"vertical",c=t.getAttribute("drag-type")||"__draglist_"+r,l=t.getAttribute("drop-accept")||c,d=t.hasAttribute("drag-list-copy"),f=t.hasAttribute("drag-list-remove"),p=t.getAttribute("drag-disabled"),u=t.getAttribute("drop-disabled"),m=t.getAttribute("drop-max"),b=t.getAttribute("drop-placeholder"),x=t.getAttribute("drop-placeholder-class"),A=t.getAttribute("drag-class")||"nojs-dragging",y=t.getAttribute("drop-class")||"nojs-drag-over",E=t.getAttribute("drop-reject-class")||"nojs-drop-reject",_=t.getAttribute("drop-settle-class")||"nojs-drop-settle",C=t.getAttribute("drop-empty-class")||"nojs-drag-list-empty";t.setAttribute("role","listbox"),t.setAttribute("aria-dropeffect",d?"copy":"move");let w={listPath:r,ctx:n,el:t};Ie.set(t,w),Z(()=>Ie.delete(t));let v=0,B=null;function S(){let D=nt(r,n);if(!Array.isArray(D))return;if(D===B&&D.length>0&&t.children.length>0){for(let T of t.children)T.__ctx&&T.__ctx.$notify&&T.__ctx.$notify();return}B=D;let H=o?document.getElementById(o):null;if(!H)return;t.innerHTML="";let F=D.length;D.forEach((T,rt)=>{let mt={[s]:T,$index:rt,$count:F,$first:rt===0,$last:rt===F-1,$even:rt%2===0,$odd:rt%2!==0},ot=P(mt,n),Q=H.content.cloneNode(!0),R=document.createElement("div");R.style.display="contents",R.__ctx=ot,R.setAttribute("role","option"),R.appendChild(Q),t.appendChild(R);let V=R.firstElementChild||R;V.draggable=!0,V.setAttribute("aria-grabbed","false"),V.getAttribute("tabindex")||V.setAttribute("tabindex","0");let At=et=>{if(p&&L(p,n)){et.preventDefault();return}h.dragging={item:T,type:c,effect:d?"copy":"move",sourceEl:R,sourceCtx:ot,sourceList:D,sourceIndex:rt,listDirective:{el:t,listPath:r,ctx:n,keyProp:i,copyMode:d,removeMode:f}},et.dataTransfer&&(et.dataTransfer.effectAllowed=d?"copy":"move",et.dataTransfer.setData("text/plain","")),A.split(/\s+/).filter(Boolean).forEach(st=>V.classList.add(st)),V.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:T,index:rt,el:V}}))},qt=()=>{A.split(/\s+/).filter(Boolean).forEach(et=>V.classList.remove(et)),V.setAttribute("aria-grabbed","false"),h.dragging&&h.dragging.sourceEl===R&&(h.dragging=null),lt()};R.addEventListener("dragstart",At),R.addEventListener("dragend",qt),R.addEventListener("keydown",et=>{if(et.key===" "&&!h.dragging)et.preventDefault(),h.dragging={item:T,type:c,effect:d?"copy":"move",sourceEl:R,sourceCtx:ot,sourceList:D,sourceIndex:rt,listDirective:{el:t,listPath:r,ctx:n,keyProp:i,copyMode:d,removeMode:f}},A.split(/\s+/).filter(Boolean).forEach(st=>V.classList.add(st)),V.setAttribute("aria-grabbed","true");else if(et.key==="Escape"&&h.dragging&&h.dragging.sourceEl===R)et.preventDefault(),A.split(/\s+/).filter(Boolean).forEach(st=>V.classList.remove(st)),V.setAttribute("aria-grabbed","false"),h.dragging=null,lt();else if((et.key==="ArrowDown"||et.key==="ArrowRight")&&h.dragging&&h.dragging.sourceEl===R){et.preventDefault();let st=R.nextElementSibling;st&&(st.firstElementChild||st).focus()}else if((et.key==="ArrowUp"||et.key==="ArrowLeft")&&h.dragging&&h.dragging.sourceEl===R){et.preventDefault();let st=R.previousElementSibling;st&&(st.firstElementChild||st).focus()}}),O(R)});let k=D.length===0;C.split(/\s+/).filter(Boolean).forEach(T=>t.classList.toggle(T,k))}let N=D=>{if(!h.dragging||u&&L(u,n))return;let H=wt(h.dragging.type,l),F=!0;if(m){let T=L(m,n),rt=nt(r,n);typeof T=="number"&&Array.isArray(rt)&&rt.length>=T&&(F=!1)}if(!H||!F){E.split(/\s+/).filter(Boolean).forEach(T=>t.classList.add(T)),y.split(/\s+/).filter(Boolean).forEach(T=>t.classList.remove(T)),lt();return}E.split(/\s+/).filter(Boolean).forEach(T=>t.classList.remove(T)),D.preventDefault(),D.dataTransfer&&(D.dataTransfer.dropEffect=d?"copy":"move");let k=Rt(t,D.clientX,D.clientY,a);b&&$e(t,k,b,x)},X=D=>{if(h.dragging&&!(u&&L(u,n))&&(v++,v===1)){let H=wt(h.dragging.type,l),F=!0;if(m){let k=L(m,n),T=nt(r,n);typeof k=="number"&&Array.isArray(T)&&T.length>=k&&(F=!1)}H&&F?(y.split(/\s+/).filter(Boolean).forEach(k=>t.classList.add(k)),t.dispatchEvent(new CustomEvent("drag-enter",{bubbles:!1,detail:{item:h.dragging.item,type:h.dragging.type}}))):E.split(/\s+/).filter(Boolean).forEach(k=>t.classList.add(k))}},M=()=>{h.dragging&&(v--,v<=0&&(v=0,y.split(/\s+/).filter(Boolean).forEach(D=>t.classList.remove(D)),E.split(/\s+/).filter(Boolean).forEach(D=>t.classList.remove(D)),lt(),t.dispatchEvent(new CustomEvent("drag-leave",{bubbles:!1,detail:{item:h.dragging?.item}}))))},dt=D=>{if(D.preventDefault(),D.stopPropagation(),v=0,!h.dragging||u&&L(u,n)||!wt(h.dragging.type,l))return;if(m){let Q=L(m,n),R=nt(r,n);if(typeof Q=="number"&&Array.isArray(R)&&R.length>=Q)return}let H=h.dragging.item,F=h.dragging.listDirective,k=h.dragging.sourceIndex,T=Rt(t,D.clientX,D.clientY,a);y.split(/\s+/).filter(Boolean).forEach(Q=>t.classList.remove(Q)),E.split(/\s+/).filter(Boolean).forEach(Q=>t.classList.remove(Q)),lt();let rt=nt(r,n);if(!Array.isArray(rt))return;let mt=F&&F.el===t;if(mt&&k===T){h.dragging=null;return}if(mt&&k+1===T){h.dragging=null;return}let ot=[...rt];if(mt){let[Q]=ot.splice(k,1),R=k<T?T-1:T;ot.splice(R,0,Q),n.$set(r,ot),t.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{list:ot,item:H,from:k,to:R}}))}else{let Q=d&&typeof H=="object"?{...H}:H;if(ot.splice(T,0,Q),n.$set(r,ot),F&&!F.copyMode&&(f||F.removeMode)){let R=nt(F.listPath,F.ctx);if(Array.isArray(R)&&k!=null){let V=R.filter((At,qt)=>qt!==k);F.ctx.$set(F.listPath,V),F.el.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{list:V,item:H,index:k}}))}}t.dispatchEvent(new CustomEvent("receive",{bubbles:!0,detail:{list:ot,item:H,from:k,fromList:F?nt(F.listPath,F.ctx):null}}))}requestAnimationFrame(()=>{let R=[...t.children][mt&&k<T?T-1:T];if(R){let V=R.firstElementChild||R;_.split(/\s+/).filter(Boolean).forEach(At=>V.classList.add(At)),V.addEventListener("animationend",()=>{_.split(/\s+/).filter(Boolean).forEach(At=>V.classList.remove(At))},{once:!0})}}),h.dragging=null},q=D=>{if(h.dragging&&wt(h.dragging.type,l)&&(D.key==="Enter"||D.key===" ")){D.preventDefault();let H=t.querySelector(":focus");if(H){let k=(H.style?.display==="contents"&&H.firstElementChild||H).getBoundingClientRect(),T={preventDefault(){},stopPropagation(){},clientX:k.left+k.width/2,clientY:k.top+k.height+1,dataTransfer:null};dt(T)}}};t.addEventListener("dragover",N),t.addEventListener("dragenter",X),t.addEventListener("dragleave",M),t.addEventListener("drop",dt),t.addEventListener("keydown",q),Z(()=>{t.removeEventListener("dragover",N),t.removeEventListener("dragenter",X),t.removeEventListener("dragleave",M),t.removeEventListener("drop",dt),t.removeEventListener("keydown",q)}),n.$watch(S),S()}});I("drag-multiple",{priority:16,init(t,e){let r=$(t),n=t.getAttribute("drag-group"),o=t.getAttribute("drag-multiple-class")||"nojs-selected";if(!n){it("drag-multiple requires drag-group attribute");return}h.selected.has(n)||h.selected.set(n,new Set);let i=h.selected.get(n),s=c=>{let l=t.getAttribute("drag"),f={item:l?L(l,r):null,el:t,ctx:r};if(c.ctrlKey||c.metaKey){let p=[...i].find(u=>u.el===t);p?(i.delete(p),o.split(/\s+/).filter(Boolean).forEach(u=>t.classList.remove(u))):(i.add(f),o.split(/\s+/).filter(Boolean).forEach(u=>t.classList.add(u)))}else{for(let p of i)o.split(/\s+/).filter(Boolean).forEach(u=>p.el.classList.remove(u));i.clear(),i.add(f),o.split(/\s+/).filter(Boolean).forEach(p=>t.classList.add(p))}};t.addEventListener("click",s),Z(()=>{t.removeEventListener("click",s);let c=[...i].find(l=>l.el===t);c&&i.delete(c)});let a=c=>{if(c.key==="Escape"){for(let l of i)o.split(/\s+/).filter(Boolean).forEach(d=>l.el.classList.remove(d));i.clear()}};window.addEventListener("keydown",a),Z(()=>window.removeEventListener("keydown",a))}});function Je(){if(typeof window>"u")return null;let t=g.router||{};if(t.mode==="hash")return window.location.hash.slice(1)||"/";let e=(t.base||"/").replace(/\/$/,"");return window.location.pathname.replace(e,"")||"/"}var Pt={get baseApiUrl(){return g.baseApiUrl},set baseApiUrl(t){g.baseApiUrl=t},get locale(){return U.locale},set locale(t){U.locale=t},config(t={}){let e={...g.headers},r={...g.cache},n={...g.templates},o={...g.router},i={...g.i18n};Object.assign(g,t),t.headers&&(g.headers={...e,...t.headers}),t.csrf&&(g.csrf=t.csrf),t.cache&&(g.cache={...r,...t.cache}),t.templates&&(g.templates={...n,...t.templates}),t.router&&(g.router={...o,...t.router}),t.i18n&&(g.i18n={...i,...t.i18n},U.locale=t.i18n.defaultLocale||U.locale)},async init(t){if(typeof document>"u"||Pt._initialized)return;if(Pt._initialized=!0,t=t||document.body,Y("Initializing..."),g.i18n.loadPath){let r=new Set([U.locale,g.i18n.fallbackLocale]);await Promise.all([...r].map(n=>Xt(n)))}Ot(t);let e=Je();await ve(e),document.querySelector("[route-view]")&&oe(Te()),O(t),G&&await G.init(),Y("Initialized."),Ee(),me(Pt)},directive(t,e){I(t,e)},filter(t,e){j[t]=e},validator(t,e){Ct[t]=e},i18n(t){if(t.loadPath!=null&&(g.i18n.loadPath=t.loadPath),t.ns&&(g.i18n.ns=t.ns),t.cache!=null&&(g.i18n.cache=t.cache),t.persist!=null&&(g.i18n.persist=t.persist),t.locales&&(U.locales=t.locales),t.fallbackLocale&&(g.i18n.fallbackLocale=t.fallbackLocale),t.defaultLocale&&(U._locale=t.defaultLocale),g.i18n.persist&&typeof localStorage<"u")try{let e=localStorage.getItem("nojs-locale");if(e){U._locale=e;return}}catch{}if(t.detectBrowser){let e=typeof navigator<"u"?navigator.language:"en",r=e.split("-")[0];U.locales[e]?U._locale=e:U.locales[r]&&(U._locale=r)}},on(t,e){return _t[t]||(_t[t]=[]),_t[t].push(e),()=>{_t[t]=_t[t].filter(r=>r!==e)}},interceptor(t,e){Lt[t]&&Lt[t].push(e)},get store(){return W},get router(){return G},createContext:P,evaluate:L,findContext:$,processTree:O,resolve:nt,version:"1.6.0"},Xe=Pt;
|
|
64
64
|
//# sourceMappingURL=no.js.map
|