@dinoreic/fez 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -8
- package/dist/fez.js +44 -21
- package/dist/fez.js.map +4 -4
- package/package.json +2 -2
- package/src/fez/compile.js +4 -7
- package/src/fez/connect.js +54 -77
- package/src/fez/defaults.js +11 -0
- package/src/fez/instance.js +68 -19
- package/src/fez/root.js +57 -170
- package/src/fez/utility.js +198 -2
- package/src/fez/utils/css_mixin.js +25 -0
- package/src/fez/utils/dump.js +44 -15
- package/src/fez/utils/highlight_all.js +98 -0
- package/src/rollup.js +1 -1
- package/src/svelte-cde-adapter.coffee +123 -0
package/README.md
CHANGED
|
@@ -145,7 +145,7 @@ This example showcases:
|
|
|
145
145
|
* **DOM Morphing** - Uses [Idiomorph](https://github.com/bigskysoftware/idiomorph) for intelligent DOM updates that preserve element state and animations
|
|
146
146
|
* **Preserve DOM Elements** - Use `fez-keep="unique-key"` attribute to preserve DOM elements across re-renders (useful for animations, form inputs, or stateful elements)
|
|
147
147
|
* **DOM Memoization** - Use `fez-memoize="key"` attribute to memoize and restore DOM content by key (component-scoped) or `<fez-memoize key="unique-key">` component for global memoization
|
|
148
|
-
* **Style Macros** - Define custom CSS shortcuts like `Fez.
|
|
148
|
+
* **Style Macros** - Define custom CSS shortcuts like `Fez.cssMixin('mobile', '@media (max-width: 768px)')` and use as `:mobile { ... }`
|
|
149
149
|
* **Scoped & Global Styles** - Components can define both scoped CSS (`:fez { ... }`) and global styles in the same component
|
|
150
150
|
|
|
151
151
|
### Developer Experience
|
|
@@ -200,6 +200,13 @@ Fez('foo-bar', class {
|
|
|
200
200
|
// if you pair it with `reactiveStore()`, to auto update on props change, you will have Svelte or Vue style reactive behaviour.
|
|
201
201
|
HTML = `...`
|
|
202
202
|
|
|
203
|
+
// Control rendering timing to prevent flicker (property or method)
|
|
204
|
+
// If true: renders immediately in main loop (no flicker)
|
|
205
|
+
// If false/undefined: renders in next animation frame (may flicker with nested non-fast elements)
|
|
206
|
+
// Components that don't accept slots or work without slots should set FAST = true
|
|
207
|
+
FAST = true
|
|
208
|
+
FAST = (node) => node.hasAttribute('title') // Function: e.g., ui-btn renders fast if has title attribute
|
|
209
|
+
|
|
203
210
|
// Make it globally accessible as `window.Dialog`
|
|
204
211
|
// The component is automatically appended to the document body as a singleton. See `demo/fez/ui-dialog.fez` for a complete example.
|
|
205
212
|
GLOBAL = 'Dialog'
|
|
@@ -265,9 +272,23 @@ Fez('foo-bar', class {
|
|
|
265
272
|
// set value to a node, uses value or innerHTML
|
|
266
273
|
this.val(selector, value)
|
|
267
274
|
|
|
268
|
-
//
|
|
269
|
-
|
|
270
|
-
this.
|
|
275
|
+
// Publish/Subscribe system
|
|
276
|
+
// Component-level: publishes bubble up to parent components until a subscriber is found
|
|
277
|
+
this.publish('channel', data) // publish from component, bubbles up to parents
|
|
278
|
+
this.subscribe('channel', (data) => {}) // subscribe in component
|
|
279
|
+
|
|
280
|
+
// Global-level: publish to all subscribers (components and global listeners)
|
|
281
|
+
Fez.publish('channel', data) // publish globally
|
|
282
|
+
|
|
283
|
+
// Global subscribe: runs only if node is connected to DOM
|
|
284
|
+
// Automatically removes subscription when node is disconnected
|
|
285
|
+
Fez.subscribe(node, 'channel', callback) // subscribe specific node
|
|
286
|
+
Fez.subscribe('#myId', 'channel', callback) // subscribe by selector
|
|
287
|
+
Fez.subscribe('channel', callback) // subscribe to document.body
|
|
288
|
+
|
|
289
|
+
// Manual unsubscribe (automatic cleanup happens when node disconnects)
|
|
290
|
+
const unsub = Fez.subscribe('channel', callback)
|
|
291
|
+
unsub() // manually remove subscription
|
|
271
292
|
|
|
272
293
|
// gets root childNodes
|
|
273
294
|
this.childNodes()
|
|
@@ -301,8 +322,8 @@ Fez('foo-bar', class {
|
|
|
301
322
|
// get/set attributes on root node
|
|
302
323
|
this.attr(name, value)
|
|
303
324
|
|
|
304
|
-
//
|
|
305
|
-
this.
|
|
325
|
+
// dissolves child nodes or given node into parent
|
|
326
|
+
this.dissolve()
|
|
306
327
|
|
|
307
328
|
// automatic form submission handling if there is FORM as parent or child node
|
|
308
329
|
this.onSubmit(formData) { ... }
|
|
@@ -315,9 +336,9 @@ Fez('foo-bar', class {
|
|
|
315
336
|
/* Utility methods */
|
|
316
337
|
|
|
317
338
|
// define custom style macro
|
|
318
|
-
// Fez.
|
|
339
|
+
// Fez.cssMixin('mobile', '@media (max-width: 768px)')
|
|
319
340
|
// :mobile { ... } -> @media (max-width: 768px) { ... }
|
|
320
|
-
Fez.
|
|
341
|
+
Fez.cssMixin(name, value)
|
|
321
342
|
|
|
322
343
|
// add global scss
|
|
323
344
|
Fez.globalCss(`
|
|
@@ -347,6 +368,12 @@ Fez.cssClass(text)
|
|
|
347
368
|
// display information about registered components in console
|
|
348
369
|
Fez.info()
|
|
349
370
|
|
|
371
|
+
// inspect Fez or Svelte element, dumps props/state/template info to console
|
|
372
|
+
Fez.dump(nodeOrSelector)
|
|
373
|
+
|
|
374
|
+
// Dev helper: press Cmd/Ctrl + E to toggle overlays highlighting each component on the page.
|
|
375
|
+
// Click a label to call Fez.dump for that element automatically.
|
|
376
|
+
|
|
350
377
|
// low-level DOM morphing function
|
|
351
378
|
Fez.morphdom(target, newNode, opts)
|
|
352
379
|
|
package/dist/fez.js
CHANGED
|
@@ -1,31 +1,54 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var Me=Object.defineProperty;var Fe=(r,e)=>()=>(r&&(e=r(r=0)),e);var Le=(r,e)=>{for(var t in e)Me(r,t,{get:e[t],enumerable:!0})};var pe={};Le(pe,{loadDefaults:()=>de});var de,he=Fe(()=>{de=()=>{Fez("fez-component",class{init(e){let t=document.createElement(e.name);for(t.props=e.props||e["data-props"]||e;this.root.firstChild;)this.root.parentNode.insertBefore(this.root.lastChild,t.nextSibling);this.root.innerHTML="",this.root.appendChild(t)}}),Fez("fez-include",class{init(e){Fez.fetch(e.src,t=>{let s=Fez.domRoot(t);Fez.head(s),this.root.innerHTML=s.innerHTML})}}),Fez("fez-inline",class{init(e){let t=this.root.innerHTML;if(this.root.innerHTML.includes("<")){let n=`inline-${Fez.fnv1(this.root.outerHTML)}`;Fez(n,class{HTML=t;init(){Object.assign(this.state,e.state||{})}});let i=document.createElement(n);this.root.after(this.root.lastChild,i),this.root.remove()}}}),Fez("fez-if",class{init(e){new Function(`return (${e.if||e.test})`)()||this.root.remove()}});let r=new Map;Fez("fez-memoize",class{init(e){if(!e.key){Fez.error("fez-memoize: key prop is required");return}if(r.has(e.key)){let t=r.get(e.key);Fez.log(`Memoize - key: "${e.key}" - restore`),this.root.innerHTML="",this.root.appendChild(t.cloneNode(!0))}}onMount(e){r.has(e.key)||requestAnimationFrame(()=>{let t=document.createElement("div");t.innerHTML=this.root.innerHTML,Fez.log(`Memoize - key: "${e.key}" - set`),r.set(e.key,t)})}})};typeof Fez<"u"&&Fez&&de()});function D(r,e={},t){if(typeof e=="string"&&([e,t]=[t,e],e||={}),e instanceof Node&&(t=e,e={}),Array.isArray(r)&&(t=r,r="div"),(typeof e!="object"||Array.isArray(e))&&(t=e,e={}),r.includes(".")){let n=r.split(".");r=n.shift()||"div";let i=n.join(" ");e.class?e.class+=` ${i}`:e.class=i}let s=document.createElement(r);for(let[n,i]of Object.entries(e))if(typeof i=="function")s[n]=i.bind(this);else{let o=String(i).replaceAll("fez.",this.fezHtmlRoot);s.setAttribute(n,o)}if(t)if(Array.isArray(t))for(let n of t)s.appendChild(n);else t instanceof Node?s.appendChild(t):s.innerHTML=String(t);return s}function xe(r,e){if(r=r.replace(/^#?raw/,"@html").replace(/^#?html/,"@html"),r.startsWith("#if")||r.startsWith("if"))return e.push(!1),r=r.replace(/^#?if/,""),`\${ ${r} ? \``;if(r.startsWith("#unless")||r.startsWith("unless"))return e.push(!1),r=r.replace(/^#?unless/,""),`\${ !(${r}) ? \``;if(r=="/block")return"`) && ''}";if(r.startsWith("#for")||r.startsWith("for")){r=r.replace(/^#?for/,"");let t=r.split(" in ",2);return"${"+t[1]+".map(("+t[0]+")=>`"}else if(r.startsWith("#each")||r.startsWith("each")){r=r.replace(/^#?each/,"");let t=r.split(" as ",2);return"${"+t[0]+".map(("+t[1]+")=>`"}else{if(r==":else"||r=="else")return e[e.length-1]=!0,"` : `";if(r=="/if"||r=="/unless")return e.pop()?"`}":"` : ``}";if(r=="/for"||r=="/each")return'`).join("")}';{let t="@html ";return r.startsWith("json ")&&(r=r.replace("json ","@html '<pre class=json>'+JSON.stringify("),r+=", null, 2) + '</pre>'"),r.startsWith(t)?r=r.replace(t,""):r=`Fez.htmlEscape(${r})`,"${"+r+"}"}}}function _(r,e={}){let t=[];r=r.replaceAll("[[","{{").replaceAll("]]","}}"),r=r.replace(/(\w+)=\{\{\s*(.*?)\s*\}\}([\s>])/g,(i,o,f,u)=>`${o}="{{ ${f} }}"${u}`);let s={};r=r.replace(/\{\{block\s+(\w+)\s*\}\}([^§]+)\{\{\/block\}\}/g,(i,o,f)=>(s[o]=f,"")),r=r.replace(/\{\{block:([\w\-]+)\s*\}\}/g,(i,o)=>s[o]||`block:${o}?`),r=r.replace(/:(\w+)="([\w\.\[\]]+)"/,(i,o,f)=>`:${o}=Fez.store.delete({{ Fez.store.set(${f}) }})`);let n=r.replace(/{{(.*?)}}/g,(i,o)=>(o=o.replaceAll("`","`"),o=o.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),xe(o,t)));n=n.replace(/<!\-\-.*?\-\->/g,"").replace(/>\s+</g,"><"),n="`"+n.trim()+"`";try{let i=`const fez = this;
|
|
2
2
|
with (this) {
|
|
3
|
-
return ${
|
|
3
|
+
return ${n}
|
|
4
4
|
}
|
|
5
|
-
`,
|
|
5
|
+
`,o=new Function(i);return u=>{try{return o.bind(u)()}catch(d){d.message=`FEZ template runtime error: ${d.message}
|
|
6
6
|
|
|
7
|
-
Template source: ${
|
|
8
|
-
${o}`,console.error(s),()=>Fez.error("Template Compile Error",!0)}}var _=class{static getProps(e,t){let n={};if(e.props)return e.props;for(let o of e.attributes)n[o.name]=o.value;for(let[o,s]of Object.entries(n))if([":"].includes(o[0])){delete n[o];try{let i=new Function(`return (${s})`).bind(t)();n[o.replace(/[\:_]/,"")]=i}catch(i){console.error(`Fez: Error evaluating attribute ${o}="${s}" for ${e.tagName}: ${i.message}`)}}if(n["data-props"]){let o=n["data-props"];if(typeof o=="object")return o;o[0]!="{"&&(o=decodeURIComponent(o));try{n=JSON.parse(o)}catch(s){console.error(`Fez: Invalid JSON in data-props for ${e.tagName}: ${s.message}`)}}else if(n["data-json-template"]){let o=t.previousSibling?.textContent;if(o)try{n=JSON.parse(o),t.previousSibling.remove()}catch(s){console.error(`Fez: Invalid JSON in template for ${e.tagName}: ${s.message}`)}}return n}static formData(e){let t=e.closest("form")||e.querySelector("form");if(!t)return Fez.log("No form found for formData()"),{};let n=new FormData(t),o={};return n.forEach((s,i)=>{o[i]=s}),o}static nodeName="div";constructor(){}n=D;get fezHtmlRoot(){return`Fez(${this.UID}).`}get isConnected(){return this.root?.isConnected?!0:(this.fezOnDestroy(),!1)}prop(e){let t=this.oldRoot[e]||this.props[e];return typeof t=="function"&&(t=t.bind(this.root)),t}copy(){for(let e of Array.from(arguments)){let t=this.props[e];if(t!==void 0){if(e=="class"){let n=this.root.getAttribute(e,t);n&&(t=[n,t].join(" "))}(e=="style"||!this.root[e])&&(typeof t=="string"?this.root.setAttribute(e,t):this.root[e]=t)}}}fezOnDestroy(){this._onDestroyCallbacks&&(this._onDestroyCallbacks.forEach(e=>{try{e()}catch(t){console.error("Fez: Error in cleanup callback:",t)}}),this._onDestroyCallbacks=[]),this.onDestroy(),this.onDestroy=()=>{},this.root&&(this.root.fez=void 0),this.root=void 0}addOnDestroy(e){this._onDestroyCallbacks=this._onDestroyCallbacks||[],this._onDestroyCallbacks.push(e)}on(e,t,n=200){this._eventHandlers=this._eventHandlers||{},this._eventHandlers[e]&&window.removeEventListener(e,this._eventHandlers[e]);let o=Fez.throttle(()=>{this.isConnected&&t.call(this)},n);this._eventHandlers[e]=o,window.addEventListener(e,o),this.addOnDestroy(()=>{window.removeEventListener(e,o),delete this._eventHandlers[e]})}onWindowResize(e,t){this.on("resize",e,t),e()}onWindowScroll(e,t){this.on("scroll",e,t),e()}onElementResize(e,t,n=200){let o=Fez.throttle(()=>{this.isConnected&&t.call(this,e.getBoundingClientRect(),e)},n),s=new ResizeObserver(o);s.observe(e),t.call(this,e.getBoundingClientRect(),e),this.addOnDestroy(()=>{s.disconnect()})}slot(e,t){t||=document.createElement("template");let n=t.nodeName=="SLOT";for(;e.firstChild;)n?t.parentNode.insertBefore(e.lastChild,t.nextSibling):t.appendChild(e.firstChild);return n?t.parentNode.removeChild(t):e.innerHTML="",t}setStyle(e,t){this.root.style.setProperty(e,t)}connect(){}onMount(){}beforeRender(){}afterRender(){}onDestroy(){}onStateChange(){}onGlobalStateChange(){}publish(e,...t){let n=s=>{if(Fez._subs&&Fez._subs[e]){let i=Fez._subs[e].find(([u])=>u===s);if(i)return i[1].bind(s)(...t),!0}return!1};if(n(this))return!0;let o=this.root.parentElement;for(;o;){if(o.fez&&n(o.fez))return!0;o=o.parentElement}return!1}fezBlocks={};parseHtml(e){let t=this.fezHtmlRoot.replaceAll('"',""");return e=e.replace(/([!'"\s;])fez\.(\w)/g,`$1${t}$2`).replace(/>\s+</g,"><"),e.trim()}nextTick(e,t){t?(this._nextTicks||={},this._nextTicks[t]||=window.requestAnimationFrame(()=>{e.bind(this)(),this._nextTicks[t]=null},t)):window.requestAnimationFrame(e.bind(this))}render(e){if(e||=this?.class?.fezHtmlFunc,!e||!this.root)return;this.beforeRender();let t=typeof this.class.nodeName=="function"?this.class.nodeName(this.root):this.class.nodeName,n=document.createElement(t||"div"),o;Array.isArray(e)?e[0]instanceof Node?e.forEach(s=>n.appendChild(s)):o=e.join(""):typeof e=="string"?o=N(e)(this):typeof e=="function"&&(o=e(this)),o&&(o=o.replace(/\s\w+="undefined"/g,""),n.innerHTML=this.parseHtml(o)),this.fezKeepNode(n),this.fezMemoization(n),Fez.morphdom(this.root,n),this.fezRenderPostProcess(),this.afterRender()}fezRenderPostProcess(){let e=(t,n)=>{this.root.querySelectorAll(`*[${t}]`).forEach(o=>{let s=o.getAttribute(t);o.removeAttribute(t),s&&n.bind(this)(s,o)})};e("fez-this",(t,n)=>{new Function("n",`this.${t} = n`).bind(this)(n)}),e("fez-use",(t,n)=>{let o=this[t];typeof o=="function"?o(n):console.error(`Fez error: "${t}" is not a function in ${this.fezName}`)}),e("fez-class",(t,n)=>{let o=t.split(/\s+/),s=o.pop();o.forEach(i=>n.classList.add(i)),s&&setTimeout(()=>{n.classList.add(s)},300)}),e("fez-bind",(t,n)=>{if(["INPUT","SELECT","TEXTAREA"].includes(n.nodeName)){let o=new Function(`return this.${t}`).bind(this)(),s=n.type.toLowerCase()=="checkbox",i=["SELECT"].includes(n.nodeName)||s?"onchange":"onkeyup";n.setAttribute(i,`${this.fezHtmlRoot}${t} = this.${s?"checked":"value"}`),this.val(n,o)}else console.error(`Cant fez-bind="${t}" to ${n.nodeName} (needs INPUT, SELECT or TEXTAREA. Want to use fez-this?).`)}),this.root.querySelectorAll("*[disabled]").forEach(t=>{let n=t.getAttribute("disabled");["false"].includes(n)?t.removeAttribute("disabled"):t.setAttribute("disabled","true")})}fezKeepNode(e){e.querySelectorAll("[fez-keep]").forEach(t=>{let n=t.getAttribute("fez-keep"),o=this.root.querySelector(`[fez-keep="${n}"]`);o?t.parentNode.replaceChild(o,t):n==="default-slot"&&Array.from(this.root.childNodes).forEach(s=>t.appendChild(s))})}fezMemoization(e){let t=e.querySelector("[fez-memoize]:not(.fez)");if(!t)return;this.fezMemoStore||=new Map;let n=t.getAttribute("fez-memoize"),o=this.fezMemoStore.get(n);if(o)Fez.log(`Memoize restore ${this.fezName}: ${n}`),t.parentNode.replaceChild(o.cloneNode(!0),t);else{let s=this.root.querySelector("[fez-memoize]:not(.fez)");if(s){let i=s.getAttribute("fez-memoize");this.fezMemoStore.set(i,s.cloneNode(!0))}}}refresh(e){if(alert("NEEDS FIX and remove htmlTemplate"),e){let n=Fez.domRoot(this.class.htmlTemplate).querySelector(e).innerHTML;this.render(e,n)}else this.render()}setInterval(e,t,n){typeof e=="number"&&([t,e]=[e,t]),n||=Fez.fnv1(String(e)),this._setIntervalCache||={},clearInterval(this._setIntervalCache[n]);let o=setInterval(()=>{this.isConnected&&e()},t);return this._setIntervalCache[n]=o,this.addOnDestroy(()=>{clearInterval(o),delete this._setIntervalCache[n]}),o}find(e){return typeof e=="string"?this.root.querySelector(e):e}val(e,t){let n=this.find(e);if(n)if(["INPUT","TEXTAREA","SELECT"].includes(n.nodeName))if(typeof t<"u")n.type=="checkbox"?n.checked=!!t:n.value=t;else return n.value;else if(typeof t<"u")n.innerHTML=t;else return n.innerHTML}formData(e){return this.class.formData(e||this.root)}attr(e,t){return typeof t>"u"?this.root.getAttribute(e):(this.root.setAttribute(e,t),t)}childNodes(e){let t=Array.from(this.root.children);if(e){let n=document.createElement("div");n.style.display="none",document.body.appendChild(n),t.forEach(o=>n.appendChild(o)),t=Array.from(n.children).map(e),document.body.removeChild(n)}return t}subscribe(e,t){Fez._subs||={},Fez._subs[e]||=[],Fez._subs[e]=Fez._subs[e].filter(n=>n[0].isConnected),Fez._subs[e].push([this,t])}rootId(){return this.root.id||=`fez_${this.UID}`,this.root.id}fezRegister(){this.css&&(this.css=Fez.globalCss(this.css,{name:this.fezName,wrap:!0})),this.class.css&&(this.class.css=Fez.globalCss(this.class.css,{name:this.fezName})),this.state||=this.reactiveStore(),this.globalState=Fez.state.createProxy(this),this.fezRegisterBindMethods()}fezRegisterBindMethods(){Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(t=>t!=="constructor"&&typeof this[t]=="function").forEach(t=>this[t]=this[t].bind(this))}fezHide(){let e=this.root,t=this.childNodes(),n=this.root.parentNode;return t.reverse().forEach(o=>n.insertBefore(o,e.nextSibling)),this.root.remove(),this.root=n,t}reactiveStore(e,t){e||={},t||=(o,s,i,u)=>{this.onStateChange(s,i,u),this.nextTick(this.render,"render")},t.bind(this);function n(o,s){return typeof o!="object"||o===null?o:new Proxy(o,{set(i,u,f,m){let g=Reflect.get(i,u,m);if(g!==f){typeof f=="object"&&f!==null&&(f=n(f,s));let S=Reflect.set(i,u,f,m);return s(i,u,f,g),S}return!0},get(i,u,f){let m=Reflect.get(i,u,f);return typeof m=="object"&&m!==null?n(m,s):m}})}return n(e,t)}};var $e={data:""},Z=r=>typeof window=="object"?((r?r.querySelector("#_goober"):window._goober)||Object.assign((r||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:r||$e,Me=r=>{let e=Z(r),t=e.data;return e.data="",t},Fe=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Le=/\/\*[^]*?\*\/| +/g,X=/\n+/g,w=(r,e)=>{let t="",n="",o="";for(let s in r){let i=r[s];s[0]=="@"?s[1]=="i"?t=s+" "+i+";":n+=s[1]=="f"?w(i,s):s+"{"+w(i,s[1]=="k"?"":e)+"}":typeof i=="object"?n+=w(i,e?e.replace(/([^,])+/g,u=>s.replace(/(^:.*)|([^,])+/g,f=>/&/.test(f)?f.replace(/&/g,u):u?u+" "+f:f)):s):i!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=w.p?w.p(s,i):s+":"+i+";")}return t+(e&&o?e+"{"+o+"}":o)+n},C={},Y=r=>{if(typeof r=="object"){let e="";for(let t in r)e+=t+Y(r[t]);return e}return r},_e=(r,e,t,n,o)=>{let s=Y(r),i=C[s]||(C[s]=(f=>{let m=0,g=11;for(;m<f.length;)g=101*g+f.charCodeAt(m++)>>>0;return"go"+g})(s));if(!C[i]){let f=s!==r?r:(m=>{let g,S,M=[{}];for(;g=Fe.exec(m.replace(Le,""));)g[4]?M.shift():g[3]?(S=g[3].replace(X," ").trim(),M.unshift(M[0][S]=M[0][S]||{})):M[0][g[1]]=g[2].replace(X," ").trim();return M[0]})(r);C[i]=w(o?{["@keyframes "+i]:f}:f,t?"":"."+i)}let u=t&&C.g?C.g:null;return t&&(C.g=C[i]),((f,m,g,S)=>{S?m.data=m.data.replace(S,f):m.data.indexOf(f)===-1&&(m.data=g?f+m.data:m.data+f)})(C[i],e,n,u),i},Oe=(r,e,t)=>r.reduce((n,o,s)=>{let i=e[s];if(i&&i.call){let u=i(t),f=u&&u.props&&u.props.className||/^go/.test(u)&&u;i=f?"."+f:u&&typeof u=="object"?u.props?"":w(u,""):u===!1?"":u}return n+o+(i??"")},"");function j(r){let e=this||{},t=r.call?r(e.p):r;return _e(t.unshift?t.raw?Oe(t,[].slice.call(arguments,1),e.p):t.reduce((n,o)=>Object.assign(n,o&&o.call?o(e.p):o),{}):t,Z(e.target),e.g,e.o,e.k)}var Q,R,P,Ie=j.bind({g:1}),Ne=j.bind({k:1});function ke(r,e,t,n){w.p=e,Q=r,R=t,P=n}function je(r,e){let t=this||{};return function(){let n=arguments;function o(s,i){let u=Object.assign({},s),f=u.className||o.className;t.p=Object.assign({theme:R&&R()},u),t.o=/ *go\d+/.test(f),u.className=j.apply(t,n)+(f?" "+f:""),e&&(u.ref=i);let m=r;return r[0]&&(m=u.as||r,delete u.as),P&&m[0]&&P(u),Q(m,u)}return e?e(o):o}}var ee={css:j,extractCss:Me,glob:Ie,keyframes:Ne,setup:ke,styled:je};var te=function(){"use strict";let r=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:A,afterNodeAdded:A,beforeNodeMorphed:A,afterNodeMorphed:A,beforeNodeRemoved:A,afterNodeRemoved:A,beforeAttributeUpdated:A},head:{style:"merge",shouldPreserve:function(l){return l.getAttribute("im-preserve")==="true"},shouldReAppend:function(l){return l.getAttribute("im-re-append")==="true"},shouldRemove:A,afterHeadMorphed:A}};function t(l,c,a={}){l instanceof Document&&(l=l.documentElement),typeof c=="string"&&(c=pe(c));let d=me(c),h=ue(l,d,a);return n(l,d,h)}function n(l,c,a){if(a.head.block){let d=l.querySelector("head"),h=c.querySelector("head");if(d&&h){let p=S(h,d,a);Promise.all(p).then(function(){n(l,c,Object.assign(a,{head:{block:!1,ignore:!0}}))});return}}if(a.morphStyle==="innerHTML")return i(c,l,a),l.children;if(a.morphStyle==="outerHTML"||a.morphStyle==null){let d=ye(c,l,a),h=d?.previousSibling,p=d?.nextSibling,y=s(l,d,a);return d?be(h,y,p):[]}else throw"Do not understand how to morph style "+a.morphStyle}function o(l,c){return c.ignoreActiveValue&&l===document.activeElement&&l!==document.body}function s(l,c,a){if(!(a.ignoreActive&&l===document.activeElement))return c==null?a.callbacks.beforeNodeRemoved(l)===!1?l:(l.remove(),a.callbacks.afterNodeRemoved(l),null):k(l,c)?(a.callbacks.beforeNodeMorphed(l,c)===!1||(l instanceof HTMLHeadElement&&a.head.ignore||(l instanceof HTMLHeadElement&&a.head.style!=="morph"?S(c,l,a):(f(c,l,a),o(l,a)||i(c,l,a))),a.callbacks.afterNodeMorphed(l,c)),l):a.callbacks.beforeNodeRemoved(l)===!1||a.callbacks.beforeNodeAdded(c)===!1?l:(l.parentElement.replaceChild(c,l),a.callbacks.afterNodeAdded(c),a.callbacks.afterNodeRemoved(l),c)}function i(l,c,a){let d=l.firstChild,h=c.firstChild,p;for(;d;){if(p=d,d=p.nextSibling,h==null){if(a.callbacks.beforeNodeAdded(p)===!1)return;c.appendChild(p),a.callbacks.afterNodeAdded(p),F(a,p);continue}if(W(p,h,a)){s(h,p,a),h=h.nextSibling,F(a,p);continue}let y=de(l,c,p,h,a);if(y){h=V(h,y,a),s(y,p,a),F(a,p);continue}let z=he(l,c,p,h,a);if(z){h=V(h,z,a),s(z,p,a),F(a,p);continue}if(a.callbacks.beforeNodeAdded(p)===!1)return;c.insertBefore(p,h),a.callbacks.afterNodeAdded(p),F(a,p)}for(;h!==null;){let y=h;h=h.nextSibling,U(y,a)}}function u(l,c,a,d){return l==="value"&&d.ignoreActiveValue&&c===document.activeElement?!0:d.callbacks.beforeAttributeUpdated(l,c,a)===!1}function f(l,c,a){let d=l.nodeType;if(d===1){let h=l.attributes,p=c.attributes;for(let y of h)if(!u(y.name,c,"update",a))try{c.getAttribute(y.name)!==y.value&&c.setAttribute(y.name,y.value)}catch(z){console.error("Error setting attribute:",{badNode:c,badAttribute:y,error:z.message})}for(let y=p.length-1;0<=y;y--){let z=p[y];u(z.name,c,"remove",a)||l.hasAttribute(z.name)||c.removeAttribute(z.name)}}(d===8||d===3)&&c.nodeValue!==l.nodeValue&&(c.nodeValue=l.nodeValue),o(c,a)||g(l,c,a)}function m(l,c,a,d){if(l[a]!==c[a]){let h=u(a,c,"update",d);h||(c[a]=l[a]),l[a]?h||c.setAttribute(a,l[a]):u(a,c,"remove",d)||c.removeAttribute(a)}}function g(l,c,a){if(l instanceof HTMLInputElement&&c instanceof HTMLInputElement&&l.type!=="file"){let d=l.value,h=c.value;m(l,c,"checked",a),m(l,c,"disabled",a),l.hasAttribute("value")?d!==h&&(u("value",c,"update",a)||(c.setAttribute("value",d),c.value=d)):u("value",c,"remove",a)||(c.value="",c.removeAttribute("value"))}else if(l instanceof HTMLOptionElement)m(l,c,"selected",a);else if(l instanceof HTMLTextAreaElement&&c instanceof HTMLTextAreaElement){let d=l.value,h=c.value;if(u("value",c,"update",a))return;d!==h&&(c.value=d),c.firstChild&&c.firstChild.nodeValue!==d&&(c.firstChild.nodeValue=d)}}function S(l,c,a){let d=[],h=[],p=[],y=[],z=a.head.style,L=new Map;for(let v of l.children)L.set(v.outerHTML,v);for(let v of c.children){let E=L.has(v.outerHTML),I=a.head.shouldReAppend(v),H=a.head.shouldPreserve(v);E||H?I?h.push(v):(L.delete(v.outerHTML),p.push(v)):z==="append"?I&&(h.push(v),y.push(v)):a.head.shouldRemove(v)!==!1&&h.push(v)}y.push(...L.values());let J=[];for(let v of y){let E=document.createRange().createContextualFragment(v.outerHTML).firstChild;if(a.callbacks.beforeNodeAdded(E)!==!1){if(E.href||E.src){let I=null,H=new Promise(function(Ee){I=Ee});E.addEventListener("load",function(){I()}),J.push(H)}c.appendChild(E),a.callbacks.afterNodeAdded(E),d.push(E)}}for(let v of h)a.callbacks.beforeNodeRemoved(v)!==!1&&(c.removeChild(v),a.callbacks.afterNodeRemoved(v));return a.head.afterHeadMorphed(c,{added:d,kept:p,removed:h}),J}function M(){}function A(){}function fe(l){let c={};return Object.assign(c,e),Object.assign(c,l),c.callbacks={},Object.assign(c.callbacks,e.callbacks),Object.assign(c.callbacks,l.callbacks),c.head={},Object.assign(c.head,e.head),Object.assign(c.head,l.head),c}function ue(l,c,a){return a=fe(a),{target:l,newContent:c,config:a,morphStyle:a.morphStyle,ignoreActive:a.ignoreActive,ignoreActiveValue:a.ignoreActiveValue,idMap:Se(l,c),deadIds:new Set,callbacks:a.callbacks,head:a.head}}function W(l,c,a){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName?l.id!==""&&l.id===c.id?!0:O(a,l,c)>0:!1}function k(l,c){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName}function V(l,c,a){for(;l!==c;){let d=l;l=l.nextSibling,U(d,a)}return F(a,c),c.nextSibling}function de(l,c,a,d,h){let p=O(h,a,c),y=null;if(p>0){let z=d,L=0;for(;z!=null;){if(W(a,z,h))return z;if(L+=O(h,z,l),L>p)return null;z=z.nextSibling}}return y}function he(l,c,a,d,h){let p=d,y=a.nextSibling,z=0;for(;p!=null;){if(O(h,p,l)>0)return null;if(k(a,p))return p;if(k(y,p)&&(z++,y=y.nextSibling,z>=2))return null;p=p.nextSibling}return p}function pe(l){let c=new DOMParser,a=l.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(a.match(/<\/html>/)||a.match(/<\/head>/)||a.match(/<\/body>/)){let d=c.parseFromString(l,"text/html");if(a.match(/<\/html>/))return d.generatedByIdiomorph=!0,d;{let h=d.firstChild;return h?(h.generatedByIdiomorph=!0,h):null}}else{let h=c.parseFromString("<body><template>"+l+"</template></body>","text/html").body.querySelector("template").content;return h.generatedByIdiomorph=!0,h}}function me(l){if(l==null)return document.createElement("div");if(l.generatedByIdiomorph)return l;if(l instanceof Node){let c=document.createElement("div");return c.append(l),c}else{let c=document.createElement("div");for(let a of[...l])c.append(a);return c}}function be(l,c,a){let d=[],h=[];for(;l!=null;)d.push(l),l=l.previousSibling;for(;d.length>0;){let p=d.pop();h.push(p),c.parentElement.insertBefore(p,c)}for(h.push(c);a!=null;)d.push(a),h.push(a),a=a.nextSibling;for(;d.length>0;)c.parentElement.insertBefore(d.pop(),c.nextSibling);return h}function ye(l,c,a){let d;d=l.firstChild;let h=d,p=0;for(;d;){let y=ge(d,c,a);y>p&&(h=d,p=y),d=d.nextSibling}return h}function ge(l,c,a){return k(l,c)?.5+O(a,l,c):0}function U(l,c){F(c,l),c.callbacks.beforeNodeRemoved(l)!==!1&&(l.remove(),c.callbacks.afterNodeRemoved(l))}function ze(l,c){return!l.deadIds.has(c)}function ve(l,c,a){return(l.idMap.get(a)||r).has(c)}function F(l,c){let a=l.idMap.get(c)||r;for(let d of a)l.deadIds.add(d)}function O(l,c,a){let d=l.idMap.get(c)||r,h=0;for(let p of d)ze(l,p)&&ve(l,p,a)&&++h;return h}function K(l,c){let a=l.parentElement,d=l.querySelectorAll("[id]");for(let h of d){let p=h;for(;p!==a&&p!=null;){let y=c.get(p);y==null&&(y=new Set,c.set(p,y)),y.add(h.id),p=p.parentElement}}}function Se(l,c){let a=new Map;return K(l,a),K(c,a),a}return{morph:t,defaults:e}}();var xe=r=>{let e=r.split(/(<\/?[^>]+>)/g).map(o=>o.trim()).filter(o=>o),t=0,n=[];for(let o=0;o<e.length;o++){let s=e[o],i=e[o+1],u=e[o+2];if(s.startsWith("<"))if(!s.startsWith("</")&&!s.endsWith("/>")&&i&&!i.startsWith("<")&&u&&u.startsWith("</")){let f=Math.max(0,t);n.push(" ".repeat(f)+s+i+u),o+=2}else if(s.startsWith("</")){t--;let f=Math.max(0,t);n.push(" ".repeat(f)+s)}else if(s.endsWith("/>")||s.includes(" />")){let f=Math.max(0,t);n.push(" ".repeat(f)+s)}else{let f=Math.max(0,t);n.push(" ".repeat(f)+s),t++}else if(s){let f=Math.max(0,t);n.push(" ".repeat(f)+s)}}return n.join(`
|
|
9
|
-
`)},
|
|
7
|
+
Template source: ${n}`,console.error(d)}}}catch(i){return i.message=`FEZ template compile error: ${i.message}Template source:
|
|
8
|
+
${n}`,console.error(i),()=>Fez.error("Template Compile Error",!0)}}var x=class{static getProps(e,t){let s={};if(e.props)return e.props;for(let n of e.attributes)s[n.name]=n.value;for(let[n,i]of Object.entries(s))if([":"].includes(n[0])){delete s[n];try{let o=new Function(`return (${i})`).bind(t)();s[n.replace(/[\:_]/,"")]=o}catch(o){console.error(`Fez: Error evaluating attribute ${n}="${i}" for ${e.tagName}: ${o.message}`)}}if(s["data-props"]){let n=s["data-props"];if(typeof n=="object")return n;n[0]!="{"&&(n=decodeURIComponent(n));try{s=JSON.parse(n)}catch(i){console.error(`Fez: Invalid JSON in data-props for ${e.tagName}: ${i.message}`)}}else if(s["data-json-template"]){let n=t.previousSibling?.textContent;if(n)try{s=JSON.parse(n),t.previousSibling.remove()}catch(i){console.error(`Fez: Invalid JSON in template for ${e.tagName}: ${i.message}`)}}return s}static formData(e){let t=e.closest("form")||e.querySelector("form");if(!t)return Fez.log("No form found for formData()"),{};let s=new FormData(t),n={};return s.forEach((i,o)=>{n[o]=i}),n}static nodeName="div";constructor(){}n=D;get fezHtmlRoot(){return`Fez(${this.UID}).`}get isConnected(){return this.root?.isConnected?!0:(this.fezOnDestroy(),!1)}prop(e){let t=this.oldRoot[e]||this.props[e];return typeof t=="function"&&(t=t.bind(this.root)),t}copy(){for(let e of Array.from(arguments)){let t=this.props[e];if(t!==void 0){if(e=="class"){let s=this.root.getAttribute(e,t);s&&(t=[s,t].join(" "))}typeof t=="string"?this.root.setAttribute(e,t):this.root[e]=t}}}fezOnDestroy(){this._onDestroyCallbacks&&(this._onDestroyCallbacks.forEach(e=>{try{e()}catch(t){console.error("Fez: Error in cleanup callback:",t)}}),this._onDestroyCallbacks=[]),this.onDestroy(),this.onDestroy=()=>{},this.root&&(this.root.fez=void 0),this.root=void 0}addOnDestroy(e){this._onDestroyCallbacks=this._onDestroyCallbacks||[],this._onDestroyCallbacks.push(e)}on(e,t,s=200){this._eventHandlers=this._eventHandlers||{},this._eventHandlers[e]&&window.removeEventListener(e,this._eventHandlers[e]);let n=Fez.throttle(()=>{this.isConnected&&t.call(this)},s);this._eventHandlers[e]=n,window.addEventListener(e,n),this.addOnDestroy(()=>{window.removeEventListener(e,n),delete this._eventHandlers[e]})}onWindowResize(e,t){this.on("resize",e,t),e()}onWindowScroll(e,t){this.on("scroll",e,t),e()}onElementResize(e,t,s=200){let n=Fez.throttle(()=>{this.isConnected&&t.call(this,e.getBoundingClientRect(),e)},s),i=new ResizeObserver(n);i.observe(e),t.call(this,e.getBoundingClientRect(),e),this.addOnDestroy(()=>{i.disconnect()})}slot(e,t){t||=document.createElement("template");let s=t.nodeName=="SLOT";for(;e.firstChild;)s?t.parentNode.insertBefore(e.lastChild,t.nextSibling):t.appendChild(e.firstChild);return s?t.parentNode.removeChild(t):e.innerHTML="",t}setStyle(e,t){this.root.style.setProperty(e,t)}connect(){}onMount(){}beforeRender(){}afterRender(){}onDestroy(){}onStateChange(){}onGlobalStateChange(){}publish(e,...t){let s=i=>{if(Fez._subs&&Fez._subs[e]){let o=Fez._subs[e].find(([f])=>f===i);if(o)return o[1].bind(i)(...t),!0}return!1};if(s(this))return!0;let n=this.root.parentElement;for(;n;){if(n.fez&&s(n.fez))return!0;n=n.parentElement}return!1}fezBlocks={};parseHtml(e){let t=this.fezHtmlRoot.replaceAll('"',""");return e=e.replace(/([!'"\s;])fez\.(\w)/g,`$1${t}$2`).replace(/>\s+</g,"><"),e.trim()}nextTick(e,t){t?(this._nextTicks||={},this._nextTicks[t]||=window.requestAnimationFrame(()=>{e.bind(this)(),this._nextTicks[t]=null},t)):window.requestAnimationFrame(e.bind(this))}render(e){if(e||=this?.class?.fezHtmlFunc,!e||!this.root)return;this.beforeRender();let t=typeof this.class.nodeName=="function"?this.class.nodeName(this.root):this.class.nodeName,s=document.createElement(t||"div"),n;Array.isArray(e)?e[0]instanceof Node?e.forEach(i=>s.appendChild(i)):n=e.join(""):typeof e=="string"?n=_(e)(this):typeof e=="function"&&(n=e(this)),n&&(n=n.replace(/\s\w+="undefined"/g,""),s.innerHTML=this.parseHtml(n)),this.fezKeepNode(s),this.fezMemoization(s),Fez.morphdom(this.root,s),this.fezRenderPostProcess(),this.afterRender()}fezRenderPostProcess(){let e=(t,s)=>{this.root.querySelectorAll(`*[${t}]`).forEach(n=>{let i=n.getAttribute(t);n.removeAttribute(t),i&&s.bind(this)(i,n)})};e("fez-this",(t,s)=>{new Function("n",`this.${t} = n`).bind(this)(s)}),e("fez-use",(t,s)=>{if(t.includes("=>"))Fez.getFunction(t)(s);else if(t.includes("."))Fez.getFunction(t).bind(s)();else{let n=this[t];typeof n=="function"?n(s):console.error(`Fez error: "${t}" is not a function in ${this.fezName}`)}}),e("fez-class",(t,s)=>{let n=t.split(/\s+/),i=n.pop();n.forEach(o=>s.classList.add(o)),i&&setTimeout(()=>{s.classList.add(i)},1)}),e("fez-bind",(t,s)=>{if(["INPUT","SELECT","TEXTAREA"].includes(s.nodeName)){let n=new Function(`return this.${t}`).bind(this)(),i=s.type.toLowerCase()=="checkbox",o=["SELECT"].includes(s.nodeName)||i?"onchange":"onkeyup";s.setAttribute(o,`${this.fezHtmlRoot}${t} = this.${i?"checked":"value"}`),this.val(s,n)}else console.error(`Cant fez-bind="${t}" to ${s.nodeName} (needs INPUT, SELECT or TEXTAREA. Want to use fez-this?).`)}),this.root.querySelectorAll("*[disabled]").forEach(t=>{let s=t.getAttribute("disabled");["false"].includes(s)?t.removeAttribute("disabled"):t.setAttribute("disabled","true")})}fezKeepNode(e){e.querySelectorAll("[fez-keep]").forEach(t=>{let s=t.getAttribute("fez-keep"),n=this.root.querySelector(`[fez-keep="${s}"]`);if(n)t.parentNode.replaceChild(n,t);else if(s==="default-slot")if(t.getAttribute("hide")){this.state=null;let i=t.parentNode;Array.from(this.root.childNodes).forEach(o=>{i.insertBefore(o,t)}),t.remove()}else Array.from(this.root.childNodes).forEach(i=>{t.appendChild(i)})})}fezMemoization(e){let t=e.querySelector("[fez-memoize]:not(.fez)");if(!t)return;this.fezMemoStore||=new Map;let s=t.getAttribute("fez-memoize"),n=this.fezMemoStore.get(s);if(n)Fez.log(`Memoize restore ${this.fezName}: ${s}`),t.parentNode.replaceChild(n.cloneNode(!0),t);else{let i=this.root.querySelector("[fez-memoize]:not(.fez)");if(i){let o=i.getAttribute("fez-memoize");this.fezMemoStore.set(o,i.cloneNode(!0))}}}refresh(e){if(alert("NEEDS FIX and remove htmlTemplate"),e){let s=Fez.domRoot(this.class.htmlTemplate).querySelector(e).innerHTML;this.render(e,s)}else this.render()}setInterval(e,t,s){typeof e=="number"&&([t,e]=[e,t]),s||=Fez.fnv1(String(e)),this._setIntervalCache||={},clearInterval(this._setIntervalCache[s]);let n=setInterval(()=>{this.isConnected&&e()},t);return this._setIntervalCache[s]=n,this.addOnDestroy(()=>{clearInterval(n),delete this._setIntervalCache[s]}),n}find(e){return typeof e=="string"?this.root.querySelector(e):e}val(e,t){let s=this.find(e);if(s)if(["INPUT","TEXTAREA","SELECT"].includes(s.nodeName))if(typeof t<"u")s.type=="checkbox"?s.checked=!!t:s.value=t;else return s.value;else if(typeof t<"u")s.innerHTML=t;else return s.innerHTML}formData(e){return this.class.formData(e||this.root)}attr(e,t){return typeof t>"u"?this.root.getAttribute(e):(this.root.setAttribute(e,t),t)}childNodes(e){let t=Array.from(this.root.children);if(e){let s=document.createElement("div");s.style.display="none",document.body.appendChild(s),t.forEach(n=>s.appendChild(n)),t=Array.from(s.children).map(e),document.body.removeChild(s)}return t}subscribe(e,t){Fez._subs||={},Fez._subs[e]||=[],Fez._subs[e]=Fez._subs[e].filter(s=>s[0].isConnected),Fez._subs[e].push([this,t])}rootId(){return this.root.id||=`fez_${this.UID}`,this.root.id}fezRegister(){this.css&&(this.css=Fez.globalCss(this.css,{name:this.fezName,wrap:!0})),this.class.css&&(this.class.css=Fez.globalCss(this.class.css,{name:this.fezName})),this.state||=this.reactiveStore(),this.globalState=Fez.state.createProxy(this),this.fezRegisterBindMethods()}fezRegisterBindMethods(){Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(t=>t!=="constructor"&&typeof this[t]=="function").forEach(t=>this[t]=this[t].bind(this))}dissolve(e){e&&(e.classList.add("fez"),e.classList.add(`fez-${this.fezName}`),e.fez=this,this.attr("id")&&e.setAttribute("id",this.attr("id")),this.root.innerHTML="",this.root.appendChild(e));let t=this.root,s=this.childNodes(),n=this.root.parentNode;return s.reverse().forEach(i=>n.insertBefore(i,t.nextSibling)),this.root.remove(),this.root=void 0,e&&(this.root=e),s}reactiveStore(e,t){e||={},t||=(n,i,o,f)=>{o!=f&&(this.onStateChange(i,o,f),this.nextTick(this.render,"render"))},t.bind(this);function s(n,i){return typeof n!="object"||n===null?n:new Proxy(n,{set(o,f,u,d){let y=Reflect.get(o,f,d);if(y!==u){typeof u=="object"&&u!==null&&(u=s(u,i));let S=Reflect.set(o,f,u,d);return i(o,f,u,y),S}return!0},get(o,f,u){let d=Reflect.get(o,f,u);return typeof d=="object"&&d!==null?s(d,i):d}})}return s(e,t)}};var Oe={data:""},Z=r=>typeof window=="object"?((r?r.querySelector("#_goober"):window._goober)||Object.assign((r||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:r||Oe,Ie=r=>{let e=Z(r),t=e.data;return e.data="",t},_e=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ke=/\/\*[^]*?\*\/| +/g,J=/\n+/g,T=(r,e)=>{let t="",s="",n="";for(let i in r){let o=r[i];i[0]=="@"?i[1]=="i"?t=i+" "+o+";":s+=i[1]=="f"?T(o,i):i+"{"+T(o,i[1]=="k"?"":e)+"}":typeof o=="object"?s+=T(o,e?e.replace(/([^,])+/g,f=>i.replace(/(^:.*)|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,f):f?f+" "+u:u)):i):o!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),n+=T.p?T.p(i,o):i+":"+o+";")}return t+(e&&n?e+"{"+n+"}":n)+s},w={},Y=r=>{if(typeof r=="object"){let e="";for(let t in r)e+=t+Y(r[t]);return e}return r},Ne=(r,e,t,s,n)=>{let i=Y(r),o=w[i]||(w[i]=(u=>{let d=0,y=11;for(;d<u.length;)y=101*y+u.charCodeAt(d++)>>>0;return"go"+y})(i));if(!w[o]){let u=i!==r?r:(d=>{let y,S,M=[{}];for(;y=_e.exec(d.replace(ke,""));)y[4]?M.shift():y[3]?(S=y[3].replace(J," ").trim(),M.unshift(M[0][S]=M[0][S]||{})):M[0][y[1]]=y[2].replace(J," ").trim();return M[0]})(r);w[o]=T(n?{["@keyframes "+o]:u}:u,t?"":"."+o)}let f=t&&w.g?w.g:null;return t&&(w.g=w[o]),((u,d,y,S)=>{S?d.data=d.data.replace(S,u):d.data.indexOf(u)===-1&&(d.data=y?u+d.data:d.data+u)})(w[o],e,s,f),o},Re=(r,e,t)=>r.reduce((s,n,i)=>{let o=e[i];if(o&&o.call){let f=o(t),u=f&&f.props&&f.props.className||/^go/.test(f)&&f;o=u?"."+u:f&&typeof f=="object"?f.props?"":T(f,""):f===!1?"":f}return s+n+(o??"")},"");function N(r){let e=this||{},t=r.call?r(e.p):r;return Ne(t.unshift?t.raw?Re(t,[].slice.call(arguments,1),e.p):t.reduce((s,n)=>Object.assign(s,n&&n.call?n(e.p):n),{}):t,Z(e.target),e.g,e.o,e.k)}var Q,H,B,je=N.bind({g:1}),De=N.bind({k:1});function He(r,e,t,s){T.p=e,Q=r,H=t,B=s}function Be(r,e){let t=this||{};return function(){let s=arguments;function n(i,o){let f=Object.assign({},i),u=f.className||n.className;t.p=Object.assign({theme:H&&H()},f),t.o=/ *go\d+/.test(u),f.className=N.apply(t,s)+(u?" "+u:""),e&&(f.ref=o);let d=r;return r[0]&&(d=f.as||r,delete f.as),B&&d[0]&&B(f),Q(d,f)}return e?e(n):n}}var ee={css:N,extractCss:Ie,glob:je,keyframes:De,setup:He,styled:Be};var te=function(){"use strict";let r=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:A,afterNodeAdded:A,beforeNodeMorphed:A,afterNodeMorphed:A,beforeNodeRemoved:A,afterNodeRemoved:A,beforeAttributeUpdated:A},head:{style:"merge",shouldPreserve:function(l){return l.getAttribute("im-preserve")==="true"},shouldReAppend:function(l){return l.getAttribute("im-re-append")==="true"},shouldRemove:A,afterHeadMorphed:A}};function t(l,c,a={}){l instanceof Document&&(l=l.documentElement),typeof c=="string"&&(c=ze(c));let p=ve(c),h=be(l,p,a);return s(l,p,h)}function s(l,c,a){if(a.head.block){let p=l.querySelector("head"),h=c.querySelector("head");if(p&&h){let m=S(h,p,a);Promise.all(m).then(function(){s(l,c,Object.assign(a,{head:{block:!1,ignore:!0}}))});return}}if(a.morphStyle==="innerHTML")return o(c,l,a),l.children;if(a.morphStyle==="outerHTML"||a.morphStyle==null){let p=Ee(c,l,a),h=p?.previousSibling,m=p?.nextSibling,g=i(l,p,a);return p?Se(h,g,m):[]}else throw"Do not understand how to morph style "+a.morphStyle}function n(l,c){return c.ignoreActiveValue&&l===document.activeElement&&l!==document.body}function i(l,c,a){if(!(a.ignoreActive&&l===document.activeElement))return c==null?a.callbacks.beforeNodeRemoved(l)===!1?l:(l.remove(),a.callbacks.afterNodeRemoved(l),null):k(l,c)?(a.callbacks.beforeNodeMorphed(l,c)===!1||(l instanceof HTMLHeadElement&&a.head.ignore||(l instanceof HTMLHeadElement&&a.head.style!=="morph"?S(c,l,a):(u(c,l,a),n(l,a)||o(c,l,a))),a.callbacks.afterNodeMorphed(l,c)),l):a.callbacks.beforeNodeRemoved(l)===!1||a.callbacks.beforeNodeAdded(c)===!1?l:(l.parentElement.replaceChild(c,l),a.callbacks.afterNodeAdded(c),a.callbacks.afterNodeRemoved(l),c)}function o(l,c,a){let p=l.firstChild,h=c.firstChild,m;for(;p;){if(m=p,p=m.nextSibling,h==null){if(a.callbacks.beforeNodeAdded(m)===!1)return;c.appendChild(m),a.callbacks.afterNodeAdded(m),F(a,m);continue}if(W(m,h,a)){i(h,m,a),h=h.nextSibling,F(a,m);continue}let g=ye(l,c,m,h,a);if(g){h=V(h,g,a),i(g,m,a),F(a,m);continue}let z=ge(l,c,m,h,a);if(z){h=V(h,z,a),i(z,m,a),F(a,m);continue}if(a.callbacks.beforeNodeAdded(m)===!1)return;c.insertBefore(m,h),a.callbacks.afterNodeAdded(m),F(a,m)}for(;h!==null;){let g=h;h=h.nextSibling,U(g,a)}}function f(l,c,a,p){return l==="value"&&p.ignoreActiveValue&&c===document.activeElement?!0:p.callbacks.beforeAttributeUpdated(l,c,a)===!1}function u(l,c,a){let p=l.nodeType;if(p===1){let h=l.attributes,m=c.attributes;for(let g of h)if(!f(g.name,c,"update",a))try{c.getAttribute(g.name)!==g.value&&c.setAttribute(g.name,g.value)}catch(z){console.error("Error setting attribute:",{badNode:c,badAttribute:g,error:z.message})}for(let g=m.length-1;0<=g;g--){let z=m[g];f(z.name,c,"remove",a)||l.hasAttribute(z.name)||c.removeAttribute(z.name)}}(p===8||p===3)&&c.nodeValue!==l.nodeValue&&(c.nodeValue=l.nodeValue),n(c,a)||y(l,c,a)}function d(l,c,a,p){if(l[a]!==c[a]){let h=f(a,c,"update",p);h||(c[a]=l[a]),l[a]?h||c.setAttribute(a,l[a]):f(a,c,"remove",p)||c.removeAttribute(a)}}function y(l,c,a){if(l instanceof HTMLInputElement&&c instanceof HTMLInputElement&&l.type!=="file"){let p=l.value,h=c.value;d(l,c,"checked",a),d(l,c,"disabled",a),l.hasAttribute("value")?p!==h&&(f("value",c,"update",a)||(c.setAttribute("value",p),c.value=p)):f("value",c,"remove",a)||(c.value="",c.removeAttribute("value"))}else if(l instanceof HTMLOptionElement)d(l,c,"selected",a);else if(l instanceof HTMLTextAreaElement&&c instanceof HTMLTextAreaElement){let p=l.value,h=c.value;if(f("value",c,"update",a))return;p!==h&&(c.value=p),c.firstChild&&c.firstChild.nodeValue!==p&&(c.firstChild.nodeValue=p)}}function S(l,c,a){let p=[],h=[],m=[],g=[],z=a.head.style,L=new Map;for(let v of l.children)L.set(v.outerHTML,v);for(let v of c.children){let E=L.has(v.outerHTML),I=a.head.shouldReAppend(v),j=a.head.shouldPreserve(v);E||j?I?h.push(v):(L.delete(v.outerHTML),m.push(v)):z==="append"?I&&(h.push(v),g.push(v)):a.head.shouldRemove(v)!==!1&&h.push(v)}g.push(...L.values());let K=[];for(let v of g){let E=document.createRange().createContextualFragment(v.outerHTML).firstChild;if(a.callbacks.beforeNodeAdded(E)!==!1){if(E.href||E.src){let I=null,j=new Promise(function(Ce){I=Ce});E.addEventListener("load",function(){I()}),K.push(j)}c.appendChild(E),a.callbacks.afterNodeAdded(E),p.push(E)}}for(let v of h)a.callbacks.beforeNodeRemoved(v)!==!1&&(c.removeChild(v),a.callbacks.afterNodeRemoved(v));return a.head.afterHeadMorphed(c,{added:p,kept:m,removed:h}),K}function M(){}function A(){}function me(l){let c={};return Object.assign(c,e),Object.assign(c,l),c.callbacks={},Object.assign(c.callbacks,e.callbacks),Object.assign(c.callbacks,l.callbacks),c.head={},Object.assign(c.head,e.head),Object.assign(c.head,l.head),c}function be(l,c,a){return a=me(a),{target:l,newContent:c,config:a,morphStyle:a.morphStyle,ignoreActive:a.ignoreActive,ignoreActiveValue:a.ignoreActiveValue,idMap:$e(l,c),deadIds:new Set,callbacks:a.callbacks,head:a.head}}function W(l,c,a){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName?l.id!==""&&l.id===c.id?!0:O(a,l,c)>0:!1}function k(l,c){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName}function V(l,c,a){for(;l!==c;){let p=l;l=l.nextSibling,U(p,a)}return F(a,c),c.nextSibling}function ye(l,c,a,p,h){let m=O(h,a,c),g=null;if(m>0){let z=p,L=0;for(;z!=null;){if(W(a,z,h))return z;if(L+=O(h,z,l),L>m)return null;z=z.nextSibling}}return g}function ge(l,c,a,p,h){let m=p,g=a.nextSibling,z=0;for(;m!=null;){if(O(h,m,l)>0)return null;if(k(a,m))return m;if(k(g,m)&&(z++,g=g.nextSibling,z>=2))return null;m=m.nextSibling}return m}function ze(l){let c=new DOMParser,a=l.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(a.match(/<\/html>/)||a.match(/<\/head>/)||a.match(/<\/body>/)){let p=c.parseFromString(l,"text/html");if(a.match(/<\/html>/))return p.generatedByIdiomorph=!0,p;{let h=p.firstChild;return h?(h.generatedByIdiomorph=!0,h):null}}else{let h=c.parseFromString("<body><template>"+l+"</template></body>","text/html").body.querySelector("template").content;return h.generatedByIdiomorph=!0,h}}function ve(l){if(l==null)return document.createElement("div");if(l.generatedByIdiomorph)return l;if(l instanceof Node){let c=document.createElement("div");return c.append(l),c}else{let c=document.createElement("div");for(let a of[...l])c.append(a);return c}}function Se(l,c,a){let p=[],h=[];for(;l!=null;)p.push(l),l=l.previousSibling;for(;p.length>0;){let m=p.pop();h.push(m),c.parentElement.insertBefore(m,c)}for(h.push(c);a!=null;)p.push(a),h.push(a),a=a.nextSibling;for(;p.length>0;)c.parentElement.insertBefore(p.pop(),c.nextSibling);return h}function Ee(l,c,a){let p;p=l.firstChild;let h=p,m=0;for(;p;){let g=Ae(p,c,a);g>m&&(h=p,m=g),p=p.nextSibling}return h}function Ae(l,c,a){return k(l,c)?.5+O(a,l,c):0}function U(l,c){F(c,l),c.callbacks.beforeNodeRemoved(l)!==!1&&(l.remove(),c.callbacks.afterNodeRemoved(l))}function we(l,c){return!l.deadIds.has(c)}function Te(l,c,a){return(l.idMap.get(a)||r).has(c)}function F(l,c){let a=l.idMap.get(c)||r;for(let p of a)l.deadIds.add(p)}function O(l,c,a){let p=l.idMap.get(c)||r,h=0;for(let m of p)we(l,m)&&Te(l,m,a)&&++h;return h}function X(l,c){let a=l.parentElement,p=l.querySelectorAll("[id]");for(let h of p){let m=h;for(;m!==a&&m!=null;){let g=c.get(m);g==null&&(g=new Set,c.set(m,g)),g.add(h.id),m=m.parentElement}}}function $e(l,c){let a=new Map;return X(l,a),X(c,a),a}return{morph:t,defaults:e}}();var Pe=r=>{let e=r.split(/(<\/?[^>]+>)/g).map(n=>n.trim()).filter(n=>n),t=0,s=[];for(let n=0;n<e.length;n++){let i=e[n],o=e[n+1],f=e[n+2];if(i.startsWith("<"))if(!i.startsWith("</")&&!i.endsWith("/>")&&o&&!o.startsWith("<")&&f&&f.startsWith("</")){let u=Math.max(0,t);s.push(" ".repeat(u)+i+o+f),n+=2}else if(i.startsWith("</")){t--;let u=Math.max(0,t);s.push(" ".repeat(u)+i)}else if(i.endsWith("/>")||i.includes(" />")){let u=Math.max(0,t);s.push(" ".repeat(u)+i)}else{let u=Math.max(0,t);s.push(" ".repeat(u)+i),t++}else if(i){let u=Math.max(0,t);s.push(" ".repeat(u)+i)}}return s.join(`
|
|
9
|
+
`)},P=(()=>{let r=[],e=[],t=0,s=null;document.addEventListener("keydown",o=>{if(o.key==="Escape"){o.preventDefault();let f=document.getElementById("dump-dialog"),u=document.getElementById("log-reopen-button");f?(f.remove(),n()):u&&(u.remove(),i())}else(o.key==="ArrowLeft"||o.key==="ArrowRight"||o.key==="ArrowUp"||o.key==="ArrowDown")&&document.getElementById("dump-dialog")&&r.length>0&&(o.preventDefault(),o.key==="ArrowLeft"&&t>0?(t--,localStorage.setItem("_LOG_INDEX",t),s()):o.key==="ArrowRight"&&t<r.length-1?(t++,localStorage.setItem("_LOG_INDEX",t),s()):o.key==="ArrowUp"&&t>0?(t=Math.max(0,t-5),localStorage.setItem("_LOG_INDEX",t),s()):o.key==="ArrowDown"&&t<r.length-1&&(t=Math.min(r.length-1,t+5),localStorage.setItem("_LOG_INDEX",t),s()))});let n=()=>{let o=document.getElementById("log-reopen-button");o||(o=document.body.appendChild(document.createElement("button")),o.id="log-reopen-button",o.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;margin-right:4px"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>LOG',o.style.cssText="position:fixed; top: 10px; right: 10px;padding:10px 20px;background:#ff3333;color:#fff;border:none;cursor:pointer;font:14px/1.4 monospace;z-index:2147483647;border-radius:8px;display:flex;align-items:center;opacity:1;visibility:visible;box-shadow:0 4px 12px rgba(255,51,51,0.3)",o.onclick=()=>{o.remove(),i()})},i=()=>{let o=document.getElementById("dump-dialog");if(!o){o=document.body.appendChild(document.createElement("div")),o.id="dump-dialog";let u=window.pageYOffset||document.documentElement.scrollTop;o.style.cssText="position:absolute; top:"+(u+20)+"px; left: 20px; right:20px;background:#fff; border:1px solid #333; box-shadow:0 0 10px rgba(0,0,0,0.5);padding:20px; overflow:auto; z-index:2147483646; font:13px/1.4 monospace;white-space:pre; display:block; opacity:1; visibility:visible"}let f=parseInt(localStorage.getItem("_LOG_INDEX"));!isNaN(f)&&f>=0&&f<r.length?t=f:t=r.length-1,s=()=>{let u=r.map((d,y)=>{let S="#f0f0f0";return y!==t&&(e[y]==="object"?S="#d6e3ef":e[y]==="array"&&(S="#d8d5ef")),`<button style="font-size: 14px; font-weight: 400; padding:2px 6px; margin: 0 2px 2px 0;cursor:pointer;background:${y===t?"#333":S};color:${y===t?"#fff":"#000"}" data-index="${y}">${y+1}</button>`}).join("");o.innerHTML='<div style="display:flex;flex-direction:column;height:100%"><div style="display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:10px"><div style="display:flex;flex-wrap:wrap;gap:4px;flex:1;margin-right:10px">'+u+'</div><button style="padding:4px 8px;cursor:pointer;flex-shrink:0">×</button></div><xmp style="font-family:monospace;flex:1;overflow:auto;margin:0;padding:0;color:#000;background:#fff;font-size:14px;line-height:22px">'+r[t]+"</xmp></div>",o.querySelector('button[style*="flex-shrink:0"]').onclick=()=>{o.remove(),n()},o.querySelectorAll("button[data-index]").forEach(d=>{d.onclick=()=>{t=parseInt(d.dataset.index),localStorage.setItem("_LOG_INDEX",t),s()}})},s()};return o=>{if(!document.body){window.requestAnimationFrame(()=>P(o));return}let f=typeof o;o instanceof Node&&(o.nodeType===Node.TEXT_NODE?o=o.textContent||String(o):o=Pe(o.outerHTML)),o===void 0&&(o="undefined"),o===null&&(o="null"),Array.isArray(o)?f="array":typeof o=="object"&&o!==null&&(f="object"),typeof o!="string"&&(o=JSON.stringify(o,(d,y)=>typeof y=="function"?String(y):y,2).replaceAll("<","<")),o=o.trim(),r.push(o+`
|
|
10
10
|
|
|
11
|
-
type: ${
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
${i}
|
|
18
|
-
|
|
11
|
+
type: ${f}`),e.push(f),!!document.getElementById("dump-dialog")?(t=r.length-1,localStorage.setItem("_LOG_INDEX",t),s&&s()):i()}})();typeof window<"u"&&!window.LOG&&(window.LOG=P);var re=P;var se=()=>{let r=parseInt(window.location.port)||80;if(!(Fez.DEV===!0||r>2999&&Fez.DEV!==!1))return;let e=document.querySelectorAll(".fez-highlight-overlay");if(e.length>0){e.forEach(s=>s.remove());return}document.querySelectorAll(".fez, .svelte").forEach(s=>{let n=null,i=null;if(s.classList.contains("fez")&&s.fez&&s.fez.fezName?(n=s.fez.fezName,i="fez"):s.classList.contains("svelte")&&s.svelte&&s.svelte.svelteName&&(n=s.svelte.svelteName,i="svelte"),n){let o=document.createElement("div");o.className="fez-highlight-overlay";let f=s.getBoundingClientRect(),u=window.pageYOffset||document.documentElement.scrollTop,d=window.pageXOffset||document.documentElement.scrollLeft;o.style.cssText=`
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: ${f.top+u}px;
|
|
14
|
+
left: ${f.left+d}px;
|
|
15
|
+
width: ${f.width}px;
|
|
16
|
+
height: ${f.height}px;
|
|
17
|
+
border: 1px solid ${i==="svelte"?"blue":"red"};
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
z-index: 9999;
|
|
20
|
+
`;let y=document.createElement("div");y.textContent=n,y.style.cssText=`
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: -20px;
|
|
23
|
+
left: 0;
|
|
24
|
+
background: ${i==="svelte"?"blue":"red"};
|
|
25
|
+
color: white;
|
|
26
|
+
padding: 4px 6px 2px 6px;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
font-family: monospace;
|
|
29
|
+
line-height: 1;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
pointer-events: auto;
|
|
33
|
+
text-transform: uppercase;
|
|
34
|
+
`,y.addEventListener("click",S=>{S.stopPropagation(),Fez.dump(s)}),o.appendChild(y),document.body.appendChild(o)}})};document.addEventListener("keydown",r=>{(r.ctrlKey||r.metaKey)&&r.key==="e"&&(r.target.closest("form")||(r.preventDefault(),se()))});var ne=se;var qe=new MutationObserver((r,e)=>{for(let t of r)if(t.type==="attributes"){let s=t.target.fez,n=t.attributeName,i=t.target.getAttribute(n);s&&(s.props[n]=i,s.onPropsChange(n,i))}});function q(r,e){let t=globalThis.window?.Fez||globalThis.Fez;if(r.includes("-")||console.error(`Fez: Invalid custom element name "${r}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),e.fezHtmlRoot)e.html&&(e.html=oe(e.html));else{let s=new e,n=class extends x{};Object.getOwnPropertyNames(s).concat(Object.getOwnPropertyNames(e.prototype)).filter(o=>!["constructor","prototype"].includes(o)).forEach(o=>n.prototype[o]=s[o]),s.FAST&&(n.FAST=s.FAST),s.GLOBAL&&(n.GLOBAL=s.GLOBAL),s.CSS&&(n.css=s.CSS),s.HTML&&(n.html=oe(s.HTML)),s.NAME&&(n.nodeName=s.NAME),s.GLOBAL&&document.body.appendChild(document.createElement(r)),e=n,t.log(`${r} compiled`)}if(e.html){let s=e.SLOT||"div";e.html=e.html.replace("<slot",`<${s} class="fez-slot" fez-keep="default-slot"`).replace("</slot>",`</${s}>`),e.fezHtmlFunc=_(e.html)}e.css&&(e.css=t.globalCss(e.css,{name:r})),t.classes[r]=e,customElements.get(r)||customElements.define(r,class extends HTMLElement{connectedCallback(){Ge(this,e)?ie(r,this):requestAnimationFrame(()=>{ie(r,this)})}})}function Ge(r,e){let t=r.getAttribute("fez-fast");var s=typeof e.FAST=="function"?e.FAST(r):e.FAST;return t||s||r.childNodes[0]||r.nextSibling?!0:(t=="false",!1)}function oe(r){let e=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);return r.replace(/<([a-z-]+)\b([^>]*)\/>/g,(t,s,n)=>e.has(s)?t:`<${s}${n}></${s}>`)}function ie(r,e){let t=Fez.classes[r],s=e.parentNode;if(e.isConnected){let n=typeof t.nodeName=="function"?t.nodeName(e):t.nodeName,i=document.createElement(n||"div");i.classList.add("fez"),i.classList.add(`fez-${r}`),s.replaceChild(i,e);let o=new t;if(o.UID=++Fez.instanceCount,Fez.instances.set(o.UID,o),o.oldRoot=e,o.fezName=r,o.root=i,o.props=t.getProps(e,i),o.class=t,o.slot(e,i),i.fez=o,t.GLOBAL&&t.GLOBAL!=!0&&(window[t.GLOBAL]=o),window.$&&(o.$root=$(i)),o.props.id&&i.setAttribute("id",o.props.id),o.fezRegister(),(o.init||o.created||o.connect).bind(o)(o.props),o.render(),o.firstRender=!0,o.onMount(o.props),o.onSubmit){let f=o.root.nodeName=="FORM"?o.root:o.find("form");f.onsubmit=u=>{u.preventDefault(),o.onSubmit(o.formData())}}if(o.onPropsChange){qe.observe(i,{attributes:!0});for(let[f,u]of Object.entries(o.props))o.onPropsChange(f,u)}}}var We=r=>{let e={script:"",style:"",html:"",head:""},t=r.split(`
|
|
35
|
+
`),s=[],n="";for(var i of t)i=i.trim(),i.startsWith("<script")&&!e.script&&n!="head"?n="script":i.startsWith("<head")&&!e.script?n="head":i.startsWith("<style")?n="style":i.endsWith("<\/script>")&&n==="script"&&!e.script?(e.script=s.join(`
|
|
36
|
+
`),s=[],n=null):i.endsWith("</style>")&&n==="style"?(e.style=s.join(`
|
|
37
|
+
`),s=[],n=null):(i.endsWith("</head>")||i.endsWith("</header>"))&&n==="head"?(e.head=s.join(`
|
|
38
|
+
`),s=[],n=null):n?s.push(i):e.html+=i+`
|
|
39
|
+
`;if(e.head){let f=Fez.domRoot(e.head);Array.from(f.children).forEach(u=>{if(u.tagName==="SCRIPT"){let d=document.createElement("script");Array.from(u.attributes).forEach(y=>{d.setAttribute(y.name,y.value)}),d.type||="text/javascript",u.src?document.head.appendChild(d):(d.type.includes("javascript")||d.type=="module")&&(d.textContent=u.textContent,document.head.appendChild(d))}else document.head.appendChild(u.cloneNode(!0))})}let o=e.script;return/class\s+\{/.test(o)||(o=`class {
|
|
40
|
+
${o}
|
|
41
|
+
}`),String(e.style).includes(":")&&(e.style=Fez.cssMixin(e.style),e.style=e.style.includes(":fez")||/(?:^|\s)body\s*\{/.test(e.style)?e.style:`:fez {
|
|
19
42
|
${e.style}
|
|
20
|
-
}`,
|
|
43
|
+
}`,o=o.replace(/\}\s*$/,`
|
|
21
44
|
CSS = \`${e.style}\`
|
|
22
|
-
}`)),/\w/.test(String(e.html))&&(e.html=e.html.replaceAll("`","`"),e.html=e.html.replaceAll("$","\\$"),
|
|
45
|
+
}`)),/\w/.test(String(e.html))&&(e.html=e.html.replaceAll("`","`"),e.html=e.html.replaceAll("$","\\$"),o=o.replace(/\}\s*$/,`
|
|
23
46
|
HTML = \`${e.html}\`
|
|
24
|
-
}`)),
|
|
47
|
+
}`)),o};function G(r){if(r instanceof Node){let e=r;e.remove();let t=e.getAttribute("fez");if(t&&(t.includes(".")||t.includes("/"))){Ve(t);return}else{t&&!t.includes("-")&&console.error(`Fez: Invalid custom element name "${t}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),R(t,e.innerHTML);return}}else{(r?Fez.domRoot(r):document.body).querySelectorAll("template[fez], xmp[fez]").forEach(t=>{G(t)});return}}function Ve(r){Fez.log(`Loading from ${r}`),Fez.fetch(r).then(e=>{let n=new DOMParser().parseFromString(e,"text/html").querySelectorAll("template[fez], xmp[fez]");if(n.length>0)n.forEach(i=>{let o=i.getAttribute("fez");o&&!o.includes("-")&&!o.includes(".")&&!o.includes("/")&&console.error(`Fez: Invalid custom element name "${o}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let f=i.innerHTML;R(o,f)});else{let i=r.split("/").pop().split(".")[0];R(i,e)}}).catch(e=>{console.error(`FEZ template load error for "${r}": ${e.message}`)})}function R(r,e){if(arguments.length===1)return G(r);if(e&&e.includes("</xmp>"))return G(e);r&&!r.includes("-")&&!r.includes(".")&&!r.includes("/")&&console.error(`Fez: Invalid custom element name "${r}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let t=We(e),s=t.split(/class\s+\{/,2);if(t=`${s[0]};
|
|
25
48
|
|
|
26
49
|
window.Fez('${r}', class {
|
|
27
|
-
${
|
|
28
|
-
`}if(t.includes("import "))Fez.head({script:t}),setTimeout(()=>{Fez.classes[r]||Fez.error(`Template "${r}" possible compile error. (can be a false positive, it imports are not loaded)`)},2e3);else try{new Function(t)()}catch(
|
|
29
|
-
`).filter(
|
|
30
|
-
`);e.wrap&&(t=`:fez { ${t} }`),t=t.replace(/\:fez|\:host/,`.fez.fez-${e.name}`),r=b.cssClass(t)}return
|
|
50
|
+
${s[1]})`,r){let n=document.getElementById("fez-hidden-styles");n||(n=document.createElement("style"),n.id="fez-hidden-styles",document.head.appendChild(n));let i=[...Object.keys(Fez.classes),r].sort().join(", ");n.textContent=`${i} { display: none; }
|
|
51
|
+
`}if(t.includes("import "))Fez.head({script:t}),setTimeout(()=>{Fez.classes[r]||Fez.error(`Template "${r}" possible compile error. (can be a false positive, it imports are not loaded)`)},2e3);else try{new Function(t)()}catch(n){Fez.error(`Template "${r}" compile error: ${n.message}`),console.log(t)}}var le=R;var Ue={data:{},listeners:new Map,subscribers:new Map,globalSubscribers:new Set,notify(r,e,t){Fez.log(`Global state change for ${r}: ${e} (from ${t})`);let s=this.listeners.get(r);s&&s.forEach(i=>{i.isConnected?(i.onGlobalStateChange(r,e,t),i.render()):s.delete(i)});let n=this.subscribers.get(r);n&&n.forEach(i=>{try{i(e,t,r)}catch(o){console.error(`Error in subscriber for key ${r}:`,o)}}),this.globalSubscribers.forEach(i=>{try{i(r,e,t)}catch(o){console.error("Error in global subscriber:",o)}})},createProxy(r){return new Proxy({},{get:(e,t)=>(r._globalStateKeys||=new Set,r._globalStateKeys.has(t)||(r._globalStateKeys.add(t),this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r)),this.data[t]),set:(e,t,s)=>{let n=this.data[t];return n!==s&&(this.data[t]=s,this.notify(t,s,n)),!0}})},set(r,e){let t=this.data[r];t!==e&&(this.data[r]=e,this.notify(r,e,t))},get(r){return this.data[r]},forEach(r,e){let t=this.listeners.get(r);t&&t.forEach(s=>{s.isConnected?e(s):t.delete(s)})},subscribe(r,e){if(typeof r=="function")return this.globalSubscribers.add(r),()=>this.globalSubscribers.delete(r);{let t=r;return this.subscribers.has(t)||this.subscribers.set(t,new Set),this.subscribers.get(t).add(e),()=>{let s=this.subscribers.get(t);s&&(s.delete(e),s.size===0&&this.subscribers.delete(t))}}}},ce=Ue;var ae=r=>{r.head=(e,t)=>{if(e.nodeName){e.nodeName=="SCRIPT"?(r.head({script:e.innerText}),e.remove()):(e.querySelectorAll("script").forEach(u=>r.head(u)),e.querySelectorAll("template[fez], xmp[fez], script[fez]").forEach(u=>r.compile(u)));return}if(typeof e!="object"||e===null)throw new Error("head requires an object parameter");let s,n={},i;if(e.script){if(e.script.includes("import ")){t&&r.error("Fez.head callback is not supported when script with import is passed (module context).");let u=document.createElement("script");u.type="module",u.textContent=e.script,document.head.appendChild(u),requestAnimationFrame(()=>u.remove())}else try{new Function(e.script)(),t&&t()}catch(u){r.error("Error executing script:",u),console.log(e.script)}return}else if(e.js){s=e.js,i="script";for(let[u,d]of Object.entries(e))u!=="js"&&u!=="module"&&(n[u]=d);e.module&&(n.type="module")}else if(e.css){s=e.css,i="link",n.rel="stylesheet";for(let[u,d]of Object.entries(e))u!=="css"&&(n[u]=d)}else throw new Error('head requires either "script", "js" or "css" property');let o=document.querySelector(`${i}[src="${s}"], ${i}[href="${s}"]`);if(o)return t&&t(),o;let f=document.createElement(i);i==="link"?f.href=s:f.src=s;for(let[u,d]of Object.entries(n))f.setAttribute(u,d);return(t||e.module)&&(f.onload=()=>{e.module&&i==="script"&&import(s).then(u=>{window[e.module]=u.default||u[e.module]||u}).catch(u=>{console.error(`Error importing module ${e.module}:`,u)}),t&&t()}),document.head.appendChild(f),f},r.fetch=function(...e){r._fetchCache||={};let t="GET",s,n;typeof e[0]=="string"&&/^[A-Z]+$/.test(e[0])&&(t=e.shift()),s=e.shift();let i={},o=null;if(typeof e[0]=="object"&&(o=e.shift()),typeof e[0]=="function"&&(n=e.shift()),o){if(t==="GET"){let d=new URLSearchParams(o);s+=(s.includes("?")?"&":"?")+d.toString()}else if(t==="POST"){let d=new FormData;for(let[y,S]of Object.entries(o))d.append(y,S);i.body=d}}i.method=t;let f=`${t}:${s}:${JSON.stringify(i)}`;if(r._fetchCache[f]){let d=r._fetchCache[f];if(r.log(`fetch cache hit: ${t} ${s}`),n){n(d);return}return Promise.resolve(d)}r.log(`fetch live: ${t} ${s}`);let u=d=>d.headers.get("content-type")?.includes("application/json")?d.json():d.text();if(n){fetch(s,i).then(u).then(d=>{r._fetchCache[f]=d,n(d)}).catch(d=>r.onError("fetch",d));return}return fetch(s,i).then(u).then(d=>(r._fetchCache[f]=d,d))},r.darkenColor=(e,t=20)=>{let s=parseInt(e.replace("#",""),16),n=Math.round(2.55*t),i=(s>>16)-n,o=(s>>8&255)-n,f=(s&255)-n;return"#"+(16777216+(i<255?i<1?0:i:255)*65536+(o<255?o<1?0:o:255)*256+(f<255?f<1?0:f:255)).toString(16).slice(1)},r.lightenColor=(e,t=20)=>{let s=parseInt(e.replace("#",""),16),n=Math.round(2.55*t),i=(s>>16)+n,o=(s>>8&255)+n,f=(s&255)+n;return"#"+(16777216+(i<255?i<1?0:i:255)*65536+(o<255?o<1?0:o:255)*256+(f<255?f<1?0:f:255)).toString(16).slice(1)},r.htmlEscape=e=>typeof e=="string"?(e=e.replace(/font-family\s*:\s*(?:&[^;]+;|[^;])*?;/gi,"").replaceAll("&","&").replaceAll("'","'").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">"),e):e===void 0?"":e,r.domRoot=(e,t="div")=>{if(e instanceof Node)return e;{let s=document.createElement(t);return s.innerHTML=e,s}},r.activateNode=(e,t="active")=>{Array.from(e.parentElement.children).forEach(s=>{s.classList.remove(t)}),e.classList.add(t)},r.isTrue=e=>["1","true","on"].includes(String(e).toLowerCase()),r.getFunction=e=>{if(e){if(typeof e=="function")return e;if(typeof e=="string"){let t=/^\s*\(?\s*\w+(\s*,\s*\w+)*\s*\)?\s*=>/,s=/^\s*function\s*\(/;return t.test(e)||s.test(e)?new Function("return "+e)():e.includes(".")&&!e.includes("(")?new Function(`return function() { return ${e}(); }`):new Function(e)}}else return()=>{}},r.onReady=e=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{e()},{once:!0}):e()},r.fnv1=e=>{var t,s,n,i,o,f;for(t=2166136261,s=16777619,n=t,i=o=0,f=e.length-1;0<=f?o<=f:o>=f;i=0<=f?++o:--o)n^=e.charCodeAt(i),n*=s;return n.toString(36).replaceAll("-","")},r.tag=(e,t={},s="")=>{let n=encodeURIComponent(JSON.stringify(t));return`<${e} data-props="${n}">${s}</${e}>`},r.untilTrue=(e,t)=>{t||=200,e()||setTimeout(()=>{r.untilTrue(e,t)},t)},r.throttle=(e,t=200)=>{let s=0,n;return function(...i){let o=Date.now();o-s>=t?(e.apply(this,i),s=o):(clearTimeout(n),n=setTimeout(()=>{e.apply(this,i),s=Date.now()},t-(o-s)))}}};var fe={},ue=r=>{r.cssMixin=(e,t)=>{if(t)fe[e]=t;else return Object.entries(fe).forEach(([s,n])=>{e=e.replaceAll(`:${s} `,`${n} `),e=e.replaceAll(`@include ${s} `,`${n} `)}),e},r.cssMixin("mobile","@media (max-width: 767px)"),r.cssMixin("tablet","@media (min-width: 768px) and (max-width: 1023px)"),r.cssMixin("desktop","@media (min-width: 1200px)")};var b=(r,e)=>{if(typeof r=="number"){let t=b.instances.get(r);if(t)return t;b.error(`Instance with UID "${r}" not found.`)}else if(r)if(e)if(typeof e=="function"&&!/^\s*class/.test(e.toString())&&!/\b(this|new)\b/.test(e.toString())){let s=Array.from(document.querySelectorAll(`.fez.fez-${r}`)).filter(n=>n.fez);return s.forEach(n=>e(n.fez)),s}else return typeof e!="function"?b.find(r,e):q(r,e);else{let t=r.nodeName?r.closest(".fez"):document.querySelector(r.includes("#")?r:`.fez.fez-${r}`);if(t){if(t.fez)return t.fez;b.error(`node "${r}" has no Fez attached.`)}else b.error(`node "${r}" not found.`)}else b.error("Fez() ?")};b.classes={};b.instanceCount=0;b.instances=new Map;b.find=(r,e)=>{let t=r;typeof t=="string"&&(t=document.body.querySelector(t)),typeof t.val=="function"&&(t=t[0]);let s=e?`.fez.fez-${e}`:".fez",n=t.closest(s);if(n&&n.fez)return n.fez;console.error("Fez node connector not found",r,t)};b.cssClass=r=>ee.css(r);b.globalCss=(r,e={})=>{if(typeof r=="function"&&(r=r()),r.includes(":")){let t=r.split(`
|
|
52
|
+
`).filter(s=>!/^\s*\/\//.test(s)).join(`
|
|
53
|
+
`);e.wrap&&(t=`:fez { ${t} }`),t=t.replace(/\:fez|\:host/,`.fez.fez-${e.name}`),r=b.cssClass(t)}return b.onReady(()=>{document.body.parentElement.classList.add(r)}),r};b.info=()=>{console.log("Fez components:",Object.keys(b.classes||{}))};b.morphdom=(r,e,t={})=>{Array.from(r.attributes).forEach(n=>{e.setAttribute(n.name,n.value)}),te.morph(r,e,{morphStyle:"outerHTML"});let s=r.nextSibling;s?.nodeType===Node.TEXT_NODE&&s.textContent.trim()===""&&s.remove()};b._globalSubs||=new Map;b.publish=(r,...e)=>{b._subs||={},b._subs[r]||=[],b._subs[r].forEach(s=>{s[1].bind(s[0])(...e)});let t=b._globalSubs.get(r);t&&t.forEach(s=>{s.node.isConnected?s.callback.call(s.node,...e):t.delete(s)})};b.subscribe=(r,e,t)=>{typeof e=="function"&&(t=e,e=r,r=document.body),typeof r=="string"&&(r=document.querySelector(r)),b._globalSubs.has(e)||b._globalSubs.set(e,new Set);let s=b._globalSubs.get(e);s.forEach(i=>{i.node===r&&i.callback===t&&s.delete(i)});let n={node:r,callback:t};return s.add(n),()=>{s.delete(n)}};b.error=(r,e)=>{if(r=`Fez: ${r}`,console.error(r),e)return`<span style="border: 1px solid red; font-size: 14px; padding: 3px 7px; background: #fee; border-radius: 4px;">${r}</span>`};b.log=r=>{b.LOG===!0&&(r=String(r).substring(0,180),console.log(`Fez: ${r}`))};b.onError=(r,e)=>{if(typeof r!="string")throw new Error("Fez.onError: kind must be a string");console.error(`${r}: ${e.toString()}`)};b.store={store:new Map,counter:0,set(r){let e=this.counter++;return this.store.set(e,r),e},get(r){return this.store.get(r)},delete(r){let e=this.store.get(r);return this.store.delete(r),e}};ae(b);ue(b);b.compile=le;b.state=ce;b.dump=re;b.highlightAll=ne;b.onReady(()=>{b.log("Fez.LOG === true, logging enabled.")});var C=b;typeof window<"u"&&(window.FezBase=x);typeof window<"u"&&(window.Fez=C);Promise.resolve().then(()=>he());setInterval(()=>{for(let[r,e]of C.instances)e?.isConnected||(e.fez?.fezOnDestroy(),C.instances.delete(r))},5e3);var Xe=new MutationObserver(r=>{for(let{addedNodes:e,removedNodes:t}of r)e.forEach(s=>{s.nodeType===1&&(s.matches("template[fez], xmp[fez], script[fez]")&&(C.compile(s),s.remove()),s.querySelectorAll&&s.querySelectorAll("template[fez], xmp[fez], script[fez]").forEach(i=>{C.compile(i),i.remove()}))}),t.forEach(s=>{s.nodeType===1&&s.querySelectorAll&&s.querySelectorAll(".fez, :scope.fez").forEach(i=>{i.fez&&i.root&&(C.instances.delete(i.fez.UID),i.fez.fezOnDestroy())})})});Xe.observe(document.documentElement,{childList:!0,subtree:!0});var Ot=C;})();
|
|
31
54
|
//# sourceMappingURL=fez.js.map
|