@dinoreic/fez 0.1.1 → 0.2.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/README.md CHANGED
@@ -320,8 +320,17 @@ Fez('foo-bar', class {
320
320
  // this.state has reactiveStore() attached by default. any change will trigger this.render()
321
321
  this.state.foo = 123
322
322
 
323
- // window resize event with cleanup
323
+ // generic window event handler with automatic cleanup
324
+ // eventName: 'resize', 'scroll', 'mousemove', etc.
325
+ // delay: throttle delay in ms (default: 200ms)
326
+ // runs immediately on init and then throttled
327
+ this.on(eventName, func, delay)
328
+
329
+ // window resize event with cleanup (shorthand for this.on('resize', func, delay))
324
330
  this.onResize(func, delay)
331
+
332
+ // window scroll event with cleanup (shorthand for this.on('scroll', func, delay))
333
+ this.onScroll(func, delay)
325
334
 
326
335
  // requestAnimationFrame wrapper with deduplication
327
336
  this.nextTick(func, name)
@@ -443,8 +452,11 @@ All parts are optional
443
452
  {{block image}}
444
453
  <img src={{ props.src}} />
445
454
  {{/block}}
446
- {{block:image}}<!-- Use the header block -->
447
- {{block:image}}<!-- Use the header block -->
455
+ {{block:image}} <!-- Use the header block -->
456
+ {{block:image}} <!-- Use the header block -->
457
+
458
+ {{raw data}} <!-- unescape HTML -->
459
+ {{json data}} <!-- JSON dump in PRE.json tag -->
448
460
 
449
461
  <!-- fez-this will link DOM node to object property (inspired by Svelte) -->
450
462
  <!-- this.listRoot -->
package/bin/fez ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+
5
+ command = ARGV[0]
6
+ args = ARGV[1..-1]
7
+
8
+ if command.nil? || command == '--help' || command == '-h'
9
+ puts "Usage: fez <command> [<args>]"
10
+ puts ""
11
+ puts "Available commands:"
12
+
13
+ bin_dir = Pathname.new(__FILE__).dirname
14
+ commands = Dir[bin_dir.join("fez-*")].map do |path|
15
+ File.basename(path).sub(/^fez-/, '')
16
+ end.sort
17
+
18
+ commands.each do |cmd|
19
+ puts " #{cmd}"
20
+ end
21
+
22
+ exit 0
23
+ end
24
+
25
+ subcommand_path = File.join(File.dirname(__FILE__), "fez-#{command}")
26
+
27
+ if File.exist?(subcommand_path) && File.executable?(subcommand_path)
28
+ exec(subcommand_path, *args)
29
+ else
30
+ puts "fez: '#{command}' is not a fez command. See 'fez --help'."
31
+ exit 1
32
+ end
package/bin/fez-index ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'json'
5
+
6
+ # Check if argument is provided
7
+ if ARGV.empty?
8
+ puts "Usage: #{$0} <directory>"
9
+ exit 1
10
+ end
11
+
12
+ dir = ARGV[0]
13
+
14
+ # If no * in argument, append /*
15
+ pattern = dir.include?('*') ? dir : File.join(dir, '*')
16
+
17
+ # Check if base directory exists (for error message)
18
+ base_dir = dir.split('*').first.chomp('/')
19
+ if !base_dir.empty? && !File.directory?(base_dir)
20
+ puts "Error: Directory '#{base_dir}' does not exist"
21
+ exit 1
22
+ end
23
+
24
+ # Get files using glob
25
+ files = Dir.glob(pattern).select { |f| File.file?(f) }
26
+
27
+ # Create index for each file
28
+ file_index = []
29
+ files.each do |path|
30
+ stat = File.stat(path)
31
+
32
+ file_info = {
33
+ base: File.basename(path, File.extname(path)),
34
+ path: path,
35
+ size: stat.size.to_i,
36
+ modified: stat.mtime.to_i,
37
+ created: stat.birthtime.to_i
38
+ }
39
+
40
+ file_index << {file: file_info}
41
+ end
42
+
43
+ # Output as JSON to screen
44
+ puts JSON.pretty_generate(file_index)
package/dist/fez.js CHANGED
@@ -1,28 +1,28 @@
1
- (()=>{function P(t,e={},r){if(typeof e=="string"&&([e,r]=[r,e],e||={}),e instanceof Node&&(r=e,e={}),Array.isArray(t)&&(r=t,t="div"),(typeof e!="object"||Array.isArray(e))&&(r=e,e={}),t.includes(".")){let n=t.split(".");t=n.shift()||"div";let o=n.join(" ");e.class?e.class+=` ${o}`:e.class=o}let s=document.createElement(t);for(let[n,o]of Object.entries(e))if(typeof o=="function")s[n]=o.bind(this);else{let i=String(o).replaceAll("fez.",this.fezHtmlRoot);s.setAttribute(n,i)}if(r)if(Array.isArray(r))for(let n of r)s.appendChild(n);else r instanceof Node?s.appendChild(r):s.innerHTML=String(r);return s}function me(t,e){if(t=t.replace(/^#?raw/,"@html").replace(/^#?html/,"@html"),t.startsWith("#if")||t.startsWith("if"))return e.push(!1),t=t.replace(/^#?if/,""),`\${ ${t} ? \``;if(t.startsWith("#unless")||t.startsWith("unless"))return e.push(!1),t=t.replace(/^#?unless/,""),`\${ !(${t}) ? \``;if(t=="/block")return"`) && ''}";if(t.startsWith("#for")||t.startsWith("for")){t=t.replace(/^#?for/,"");let r=t.split(" in ",2);return"${"+r[1]+".map(("+r[0]+")=>`"}else if(t.startsWith("#each")||t.startsWith("each")){t=t.replace(/^#?each/,"");let r=t.split(" as ",2);return"${"+r[0]+".map(("+r[1]+")=>`"}else{if(t==":else"||t=="else")return e[e.length-1]=!0,"` : `";if(t=="/if"||t=="/unless")return e.pop()?"`}":"` : ``}";if(t=="/for"||t=="/each")return'`).join("")}';{let r="@html ";return t.startsWith(r)?t=t.replace(r,""):t=`Fez.htmlEscape(${t})`,"${"+t+"}"}}}function j(t,e={}){let r=[];t=t.replaceAll("[[","{{").replaceAll("]]","}}"),t=t.replace(/(\w+)=\{\{\s*(.*?)\s*\}\}([\s>])/g,(o,i,a,u)=>`${i}="{{ ${a} }}"${u}`);let s={};t=t.replace(/\{\{block\s+(\w+)\s*\}\}([^§]+)\{\{\/block\}\}/g,(o,i,a)=>(s[i]=a,"")),t=t.replace(/\{\{block:([\w\-]+)\s*\}\}/g,(o,i)=>s[i]||`block:${i}?`),t=t.replace(/:(\w+)="([\w\.\[\]]+)"/,(o,i,a)=>`:${i}=Fez.store.delete({{ Fez.store.set(${a}) }})`);let n=t.replace(/{{(.*?)}}/g,(o,i)=>(i=i.replaceAll("&#x60;","`"),i=i.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&"),me(i,r)));n="`"+n.trim()+"`";try{let o=`const fez = this;
1
+ (()=>{function P(t,e={},r){if(typeof e=="string"&&([e,r]=[r,e],e||={}),e instanceof Node&&(r=e,e={}),Array.isArray(t)&&(r=t,t="div"),(typeof e!="object"||Array.isArray(e))&&(r=e,e={}),t.includes(".")){let n=t.split(".");t=n.shift()||"div";let i=n.join(" ");e.class?e.class+=` ${i}`:e.class=i}let s=document.createElement(t);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(r)if(Array.isArray(r))for(let n of r)s.appendChild(n);else r instanceof Node?s.appendChild(r):s.innerHTML=String(r);return s}function me(t,e){if(t=t.replace(/^#?raw/,"@html").replace(/^#?html/,"@html"),t.startsWith("#if")||t.startsWith("if"))return e.push(!1),t=t.replace(/^#?if/,""),`\${ ${t} ? \``;if(t.startsWith("#unless")||t.startsWith("unless"))return e.push(!1),t=t.replace(/^#?unless/,""),`\${ !(${t}) ? \``;if(t=="/block")return"`) && ''}";if(t.startsWith("#for")||t.startsWith("for")){t=t.replace(/^#?for/,"");let r=t.split(" in ",2);return"${"+r[1]+".map(("+r[0]+")=>`"}else if(t.startsWith("#each")||t.startsWith("each")){t=t.replace(/^#?each/,"");let r=t.split(" as ",2);return"${"+r[0]+".map(("+r[1]+")=>`"}else{if(t==":else"||t=="else")return e[e.length-1]=!0,"` : `";if(t=="/if"||t=="/unless")return e.pop()?"`}":"` : ``}";if(t=="/for"||t=="/each")return'`).join("")}';{let r="@html ";return t.startsWith("json ")&&(t=t.replace("json ","@html '<pre class=json>'+JSON.stringify("),t+=", null, 2) + '</pre>'"),t.startsWith(r)?t=t.replace(r,""):t=`Fez.htmlEscape(${t})`,"${"+t+"}"}}}function O(t,e={}){let r=[];t=t.replaceAll("[[","{{").replaceAll("]]","}}"),t=t.replace(/(\w+)=\{\{\s*(.*?)\s*\}\}([\s>])/g,(i,o,a,u)=>`${o}="{{ ${a} }}"${u}`);let s={};t=t.replace(/\{\{block\s+(\w+)\s*\}\}([^§]+)\{\{\/block\}\}/g,(i,o,a)=>(s[o]=a,"")),t=t.replace(/\{\{block:([\w\-]+)\s*\}\}/g,(i,o)=>s[o]||`block:${o}?`),t=t.replace(/:(\w+)="([\w\.\[\]]+)"/,(i,o,a)=>`:${o}=Fez.store.delete({{ Fez.store.set(${a}) }})`);let n=t.replace(/{{(.*?)}}/g,(i,o)=>(o=o.replaceAll("&#x60;","`"),o=o.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&"),me(o,r)));n="`"+n.trim()+"`";try{let i=`const fez = this;
2
2
  with (this) {
3
3
  return ${n}
4
4
  }
5
- `,i=new Function(o);return u=>{try{return i.bind(u)()}catch(b){b.message=`FEZ template runtime error: ${b.message}
5
+ `,o=new Function(i);return u=>{try{return o.bind(u)()}catch(b){b.message=`FEZ template runtime error: ${b.message}
6
6
 
7
- Template source: ${n}`,console.error(b)}}}catch(o){return o.message=`FEZ template compile error: ${o.message}Template source:
8
- ${n}`,console.error(o),()=>Fez.error("Template Compile Error",!0)}}var I=class{static getProps(e,r){let s={};if(e.props)return e.props;for(let n of e.attributes)s[n.name]=n.value;for(let[n,o]of Object.entries(s))if([":"].includes(n[0])){delete s[n];try{let i=new Function(`return (${o})`).bind(r)();s[n.replace(/[\:_]/,"")]=i}catch(i){console.error(`Fez: Error evaluating attribute ${n}="${o}" for ${e.tagName}: ${i.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(o){console.error(`Fez: Invalid JSON in data-props for ${e.tagName}: ${o.message}`)}}else if(s["data-json-template"]){let n=r.previousSibling?.textContent;if(n)try{s=JSON.parse(n),r.previousSibling.remove()}catch(o){console.error(`Fez: Invalid JSON in template for ${e.tagName}: ${o.message}`)}}return s}static formData(e){let r=e.closest("form")||e.querySelector("form");if(!r)return Fez.log("No form found for formData()"),{};let s=new FormData(r),n={};return s.forEach((o,i)=>{n[i]=o}),n}static fastBind(){return!1}static nodeName="div";constructor(){}n=P;get fezHtmlRoot(){return`Fez(${this.UID}).`}get isConnected(){return this.root?.isConnected?!0:(this.fezRemoveSelf(),!1)}fezRemoveSelf(){this._setIntervalCache||={},Object.keys(this._setIntervalCache).forEach(e=>{clearInterval(this._setIntervalCache[e])}),this.onDestroy(),this.onDestroy=()=>{},this.root&&(this.root.fez=void 0),this.root=void 0}prop(e){let r=this.oldRoot[e]||this.props[e];return typeof r=="function"&&(r=r.bind(this.root)),r}copy(){for(let e of Array.from(arguments)){let r=this.props[e];if(r!==void 0){if(e=="class"){let s=this.root.getAttribute(e,r);s&&(r=[s,r].join(" "))}(e=="style"||!this.root[e])&&(typeof r=="string"?this.root.setAttribute(e,r):this.root[e]=r)}}}onResize(e,r){let s,n=0;e();let o=()=>{if(!this.isConnected){window.removeEventListener("resize",i);return}e.call(this)},i=()=>{if(!this.isConnected){window.removeEventListener("resize",i);return}if(r){let a=Date.now();a-n>=r&&(o(),n=a)}else clearTimeout(s),s=setTimeout(o,200)};window.addEventListener("resize",i)}slot(e,r){r||=document.createElement("template");let s=r.nodeName=="SLOT";for(;e.firstChild;)s?r.parentNode.insertBefore(e.lastChild,r.nextSibling):r.appendChild(e.firstChild);return s?r.parentNode.removeChild(r):e.innerHTML="",r}setStyle(e,r){this.root.style.setProperty(e,r)}connect(){}onMount(){}beforeRender(){}afterRender(){}onDestroy(){}onStateChange(){}onGlobalStateChange(){}publish=Fez.publish;fezBlocks={};parseHtml(e){let r=this.fezHtmlRoot.replaceAll('"',"&quot;");return e=e.replace(/([^\w\.])fez\./g,`$1${r}`).replace(/>\s+</g,"><"),e.trim()}nextTick(e,r){r?(this._nextTicks||={},this._nextTicks[r]||=window.requestAnimationFrame(()=>{e.bind(this)(),this._nextTicks[r]=null},r)):window.requestAnimationFrame(e.bind(this))}render(e){if(e||=this?.class?.fezHtmlFunc,!e||!this.root)return;this.beforeRender();let r=document.createElement(this.class.nodeName||"div"),s;Array.isArray(e)?e[0]instanceof Node?e.forEach(i=>r.appendChild(i)):s=e.join(""):typeof e=="string"?s=j(e)(this):typeof e=="function"&&(s=e(this)),s&&(s=s.replace(/\s\w+="undefined"/g,""),r.innerHTML=this.parseHtml(s));let n=r.querySelector("slot");n&&(this.slot(this.root,n.parentNode),n.parentNode.removeChild(n));let o=this.find(".fez-slot");if(o){let i=r.querySelector(".fez-slot");i&&i.parentNode.replaceChild(o,i)}Fez.morphdom(this.root,r),this.renderFezPostProcess(),this.afterRender()}renderFezPostProcess(){let e=(r,s)=>{this.root.querySelectorAll(`*[${r}]`).forEach(n=>{let o=n.getAttribute(r);n.removeAttribute(r),o&&s.bind(this)(o,n)})};e("fez-this",(r,s)=>{new Function("n",`this.${r} = n`).bind(this)(s)}),e("fez-use",(r,s)=>{let n=this[r];typeof n=="function"?n(s):console.error(`Fez error: "${r}" is not a function in ${this.fezName}`)}),e("fez-class",(r,s)=>{let n=r.split(/\s+/),o=n.pop();n.forEach(i=>s.classList.add(i)),o&&setTimeout(()=>{s.classList.add(o)},300)}),e("fez-bind",(r,s)=>{if(["INPUT","SELECT","TEXTAREA"].includes(s.nodeName)){let n=new Function(`return this.${r}`).bind(this)(),o=s.type.toLowerCase()=="checkbox",i=["SELECT"].includes(s.nodeName)||o?"onchange":"onkeyup";s.setAttribute(i,`${this.fezHtmlRoot}${r} = this.${o?"checked":"value"}`),this.val(s,n)}else console.error(`Cant fez-bind="${r}" to ${s.nodeName} (needs INPUT, SELECT or TEXTAREA. Want to use fez-this?).`)}),this.root.querySelectorAll("*[disabled]").forEach(r=>{let s=r.getAttribute("disabled");["false"].includes(s)?r.removeAttribute("disabled"):r.setAttribute("disabled","true")})}refresh(e){if(alert("NEEDS FIX and remove htmlTemplate"),e){let r=document.createElement("div");r.innerHTML=this.class.htmlTemplate;let s=r.querySelector(e).innerHTML;this.render(e,s)}else this.render()}setInterval(e,r,s){return typeof e=="number"&&([r,e]=[e,r]),s||=Fez.fnv1(String(e)),this._setIntervalCache||={},clearInterval(this._setIntervalCache[s]),this._setIntervalCache[s]=setInterval(()=>{this.isConnected&&e()},r),this._setIntervalCache[s]}find(e){return typeof e=="string"?this.root.querySelector(e):e}val(e,r){let s=this.find(e);if(s)if(["INPUT","TEXTAREA","SELECT"].includes(s.nodeName))if(typeof r<"u")s.type=="checkbox"?s.checked=!!r:s.value=r;else return s.value;else if(typeof r<"u")s.innerHTML=r;else return s.innerHTML}formData(e){return this.class.formData(e||this.root)}attr(e,r){return typeof r>"u"?this.root.getAttribute(e):(this.root.setAttribute(e,r),r)}childNodes(e){let r=Array.from(this.root.children);if(e){let s=document.createElement("div");s.style.display="none",document.body.appendChild(s),r.forEach(o=>s.appendChild(o));let n=Array.from(s.children).map(e);return document.body.removeChild(s),n}else return r}subscribe(e,r){Fez._subs||={},Fez._subs[e]||=[],Fez._subs[e]=Fez._subs[e].filter(s=>s[0].isConnected),Fez._subs[e].push([this,r])}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(r=>r!=="constructor"&&typeof this[r]=="function").forEach(r=>this[r]=this[r].bind(this))}fezHide(){let e=this.root,r=this.root.parentNode,s=document.createDocumentFragment();for(;e.firstChild;)s.appendChild(e.firstChild);return e.parentNode.replaceChild(s,e),this.root=r,Array.from(this.root.children)}reactiveStore(e,r){e||={},r||=(n,o,i,a)=>{this.onStateChange(o,i,a),this.nextTick(this.render,"render")},r.bind(this);function s(n,o){return typeof n!="object"||n===null?n:new Proxy(n,{set(i,a,u,b){let g=Reflect.get(i,a,b);if(g!==u){typeof u=="object"&&u!==null&&(u=s(u,o));let S=Reflect.set(i,a,u,b);return o(i,a,u,g),S}return!0},get(i,a,u){let b=Reflect.get(i,a,u);return typeof b=="object"&&b!==null?s(b,o):b}})}return s(e,r)}};var be={data:""},J=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||be,ye=t=>{let e=J(t),r=e.data;return e.data="",r},ge=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ze=/\/\*[^]*?\*\/| +/g,U=/\n+/g,F=(t,e)=>{let r="",s="",n="";for(let o in t){let i=t[o];o[0]=="@"?o[1]=="i"?r=o+" "+i+";":s+=o[1]=="f"?F(i,o):o+"{"+F(i,o[1]=="k"?"":e)+"}":typeof i=="object"?s+=F(i,e?e.replace(/([^,])+/g,a=>o.replace(/(^:.*)|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,a):a?a+" "+u:u)):o):i!=null&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),n+=F.p?F.p(o,i):o+":"+i+";")}return r+(e&&n?e+"{"+n+"}":n)+s},C={},K=t=>{if(typeof t=="object"){let e="";for(let r in t)e+=r+K(t[r]);return e}return t},ve=(t,e,r,s,n)=>{let o=K(t),i=C[o]||(C[o]=(u=>{let b=0,g=11;for(;b<u.length;)g=101*g+u.charCodeAt(b++)>>>0;return"go"+g})(o));if(!C[i]){let u=o!==t?t:(b=>{let g,S,A=[{}];for(;g=ge.exec(b.replace(ze,""));)g[4]?A.shift():g[3]?(S=g[3].replace(U," ").trim(),A.unshift(A[0][S]=A[0][S]||{})):A[0][g[1]]=g[2].replace(U," ").trim();return A[0]})(t);C[i]=F(n?{["@keyframes "+i]:u}:u,r?"":"."+i)}let a=r&&C.g?C.g:null;return r&&(C.g=C[i]),((u,b,g,S)=>{S?b.data=b.data.replace(S,u):b.data.indexOf(u)===-1&&(b.data=g?u+b.data:b.data+u)})(C[i],e,s,a),i},Se=(t,e,r)=>t.reduce((s,n,o)=>{let i=e[o];if(i&&i.call){let a=i(r),u=a&&a.props&&a.props.className||/^go/.test(a)&&a;i=u?"."+u:a&&typeof a=="object"?a.props?"":F(a,""):a===!1?"":a}return s+n+(i??"")},"");function H(t){let e=this||{},r=t.call?t(e.p):t;return ve(r.unshift?r.raw?Se(r,[].slice.call(arguments,1),e.p):r.reduce((s,n)=>Object.assign(s,n&&n.call?n(e.p):n),{}):r,J(e.target),e.g,e.o,e.k)}var X,D,B,Ae=H.bind({g:1}),Ee=H.bind({k:1});function $e(t,e,r,s){F.p=e,X=t,D=r,B=s}function we(t,e){let r=this||{};return function(){let s=arguments;function n(o,i){let a=Object.assign({},o),u=a.className||n.className;r.p=Object.assign({theme:D&&D()},a),r.o=/ *go\d+/.test(u),a.className=H.apply(r,s)+(u?" "+u:""),e&&(a.ref=i);let b=t;return t[0]&&(b=a.as||t,delete a.as),B&&b[0]&&B(a),X(b,a)}return e?e(n):n}}var Z={css:H,extractCss:ye,glob:Ae,keyframes:Ee,setup:$e,styled:we};var Y=function(){"use strict";let t=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:E,afterNodeAdded:E,beforeNodeMorphed:E,afterNodeMorphed:E,beforeNodeRemoved:E,afterNodeRemoved:E,beforeAttributeUpdated:E},head:{style:"merge",shouldPreserve:function(l){return l.getAttribute("im-preserve")==="true"},shouldReAppend:function(l){return l.getAttribute("im-re-append")==="true"},shouldRemove:E,afterHeadMorphed:E}};function r(l,c,f={}){l instanceof Document&&(l=l.documentElement),typeof c=="string"&&(c=oe(c));let d=le(c),h=se(l,d,f);return s(l,d,h)}function s(l,c,f){if(f.head.block){let d=l.querySelector("head"),h=c.querySelector("head");if(d&&h){let p=S(h,d,f);Promise.all(p).then(function(){s(l,c,Object.assign(f,{head:{block:!1,ignore:!0}}))});return}}if(f.morphStyle==="innerHTML")return i(c,l,f),l.children;if(f.morphStyle==="outerHTML"||f.morphStyle==null){let d=fe(c,l,f),h=d?.previousSibling,p=d?.nextSibling,y=o(l,d,f);return d?ce(h,y,p):[]}else throw"Do not understand how to morph style "+f.morphStyle}function n(l,c){return c.ignoreActiveValue&&l===document.activeElement&&l!==document.body}function o(l,c,f){if(!(f.ignoreActive&&l===document.activeElement))return c==null?f.callbacks.beforeNodeRemoved(l)===!1?l:(l.remove(),f.callbacks.afterNodeRemoved(l),null):R(l,c)?(f.callbacks.beforeNodeMorphed(l,c)===!1||(l instanceof HTMLHeadElement&&f.head.ignore||(l instanceof HTMLHeadElement&&f.head.style!=="morph"?S(c,l,f):(u(c,l,f),n(l,f)||i(c,l,f))),f.callbacks.afterNodeMorphed(l,c)),l):f.callbacks.beforeNodeRemoved(l)===!1||f.callbacks.beforeNodeAdded(c)===!1?l:(l.parentElement.replaceChild(c,l),f.callbacks.afterNodeAdded(c),f.callbacks.afterNodeRemoved(l),c)}function i(l,c,f){let d=l.firstChild,h=c.firstChild,p;for(;d;){if(p=d,d=p.nextSibling,h==null){if(f.callbacks.beforeNodeAdded(p)===!1)return;c.appendChild(p),f.callbacks.afterNodeAdded(p),M(f,p);continue}if(k(p,h,f)){o(h,p,f),h=h.nextSibling,M(f,p);continue}let y=ne(l,c,p,h,f);if(y){h=q(h,y,f),o(y,p,f),M(f,p);continue}let z=ie(l,c,p,h,f);if(z){h=q(h,z,f),o(z,p,f),M(f,p);continue}if(f.callbacks.beforeNodeAdded(p)===!1)return;c.insertBefore(p,h),f.callbacks.afterNodeAdded(p),M(f,p)}for(;h!==null;){let y=h;h=h.nextSibling,V(y,f)}}function a(l,c,f,d){return l==="value"&&d.ignoreActiveValue&&c===document.activeElement?!0:d.callbacks.beforeAttributeUpdated(l,c,f)===!1}function u(l,c,f){let d=l.nodeType;if(d===1){let h=l.attributes,p=c.attributes;for(let y of h)if(!a(y.name,c,"update",f))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];a(z.name,c,"remove",f)||l.hasAttribute(z.name)||c.removeAttribute(z.name)}}(d===8||d===3)&&c.nodeValue!==l.nodeValue&&(c.nodeValue=l.nodeValue),n(c,f)||g(l,c,f)}function b(l,c,f,d){if(l[f]!==c[f]){let h=a(f,c,"update",d);h||(c[f]=l[f]),l[f]?h||c.setAttribute(f,l[f]):a(f,c,"remove",d)||c.removeAttribute(f)}}function g(l,c,f){if(l instanceof HTMLInputElement&&c instanceof HTMLInputElement&&l.type!=="file"){let d=l.value,h=c.value;b(l,c,"checked",f),b(l,c,"disabled",f),l.hasAttribute("value")?d!==h&&(a("value",c,"update",f)||(c.setAttribute("value",d),c.value=d)):a("value",c,"remove",f)||(c.value="",c.removeAttribute("value"))}else if(l instanceof HTMLOptionElement)b(l,c,"selected",f);else if(l instanceof HTMLTextAreaElement&&c instanceof HTMLTextAreaElement){let d=l.value,h=c.value;if(a("value",c,"update",f))return;d!==h&&(c.value=d),c.firstChild&&c.firstChild.nodeValue!==d&&(c.firstChild.nodeValue=d)}}function S(l,c,f){let d=[],h=[],p=[],y=[],z=f.head.style,L=new Map;for(let v of l.children)L.set(v.outerHTML,v);for(let v of c.children){let w=L.has(v.outerHTML),O=f.head.shouldReAppend(v),_=f.head.shouldPreserve(v);w||_?O?h.push(v):(L.delete(v.outerHTML),p.push(v)):z==="append"?O&&(h.push(v),y.push(v)):f.head.shouldRemove(v)!==!1&&h.push(v)}y.push(...L.values());let G=[];for(let v of y){let w=document.createRange().createContextualFragment(v.outerHTML).firstChild;if(f.callbacks.beforeNodeAdded(w)!==!1){if(w.href||w.src){let O=null,_=new Promise(function(pe){O=pe});w.addEventListener("load",function(){O()}),G.push(_)}c.appendChild(w),f.callbacks.afterNodeAdded(w),d.push(w)}}for(let v of h)f.callbacks.beforeNodeRemoved(v)!==!1&&(c.removeChild(v),f.callbacks.afterNodeRemoved(v));return f.head.afterHeadMorphed(c,{added:d,kept:p,removed:h}),G}function A(){}function E(){}function re(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 se(l,c,f){return f=re(f),{target:l,newContent:c,config:f,morphStyle:f.morphStyle,ignoreActive:f.ignoreActive,ignoreActiveValue:f.ignoreActiveValue,idMap:he(l,c),deadIds:new Set,callbacks:f.callbacks,head:f.head}}function k(l,c,f){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName?l.id!==""&&l.id===c.id?!0:N(f,l,c)>0:!1}function R(l,c){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName}function q(l,c,f){for(;l!==c;){let d=l;l=l.nextSibling,V(d,f)}return M(f,c),c.nextSibling}function ne(l,c,f,d,h){let p=N(h,f,c),y=null;if(p>0){let z=d,L=0;for(;z!=null;){if(k(f,z,h))return z;if(L+=N(h,z,l),L>p)return null;z=z.nextSibling}}return y}function ie(l,c,f,d,h){let p=d,y=f.nextSibling,z=0;for(;p!=null;){if(N(h,p,l)>0)return null;if(R(f,p))return p;if(R(y,p)&&(z++,y=y.nextSibling,z>=2))return null;p=p.nextSibling}return p}function oe(l){let c=new DOMParser,f=l.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(f.match(/<\/html>/)||f.match(/<\/head>/)||f.match(/<\/body>/)){let d=c.parseFromString(l,"text/html");if(f.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 le(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 f of[...l])c.append(f);return c}}function ce(l,c,f){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);f!=null;)d.push(f),h.push(f),f=f.nextSibling;for(;d.length>0;)c.parentElement.insertBefore(d.pop(),c.nextSibling);return h}function fe(l,c,f){let d;d=l.firstChild;let h=d,p=0;for(;d;){let y=ae(d,c,f);y>p&&(h=d,p=y),d=d.nextSibling}return h}function ae(l,c,f){return R(l,c)?.5+N(f,l,c):0}function V(l,c){M(c,l),c.callbacks.beforeNodeRemoved(l)!==!1&&(l.remove(),c.callbacks.afterNodeRemoved(l))}function ue(l,c){return!l.deadIds.has(c)}function de(l,c,f){return(l.idMap.get(f)||t).has(c)}function M(l,c){let f=l.idMap.get(c)||t;for(let d of f)l.deadIds.add(d)}function N(l,c,f){let d=l.idMap.get(c)||t,h=0;for(let p of d)ue(l,p)&&de(l,p,f)&&++h;return h}function W(l,c){let f=l.parentElement,d=l.querySelectorAll("[id]");for(let h of d){let p=h;for(;p!==f&&p!=null;){let y=c.get(p);y==null&&(y=new Set,c.set(p,y)),y.add(h.id),p=p.parentElement}}}function he(l,c){let f=new Map;return W(l,f),W(c,f),f}return{morph:r,defaults:e}}();function x(t,e){let r=globalThis.window?.Fez||globalThis.Fez;if(t.includes("-")||console.error(`Fez: Invalid custom element name "${t}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),!e.fezHtmlRoot){let s=new e,n=class extends I{};if(Object.getOwnPropertyNames(s).concat(Object.getOwnPropertyNames(e.prototype)).filter(a=>!["constructor","prototype"].includes(a)).forEach(a=>n.prototype[a]=s[a]),r.fastBindInfo||={fast:[],slow:[]},s.GLOBAL&&(n.fezGlobal=s.GLOBAL),s.CSS&&(n.css=s.CSS),s.HTML&&(n.html=s.HTML),s.NAME&&(n.nodeName=s.NAME),s.FAST?(n.fastBind=s.FAST,r.fastBindInfo.fast.push(typeof s.FAST=="function"?`${t} (func)`:t)):r.fastBindInfo.slow.push(t),s.GLOBAL){let a=()=>document.body.appendChild(document.createElement(t));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()}e=n;let i=`${t} compiled`;s.FAST&&(i+=" (fast bind)"),r.log(i)}e.html&&(e.html=Ce(e.html),e.html=e.html.replace(/<slot\s*\/>|<slot\s*>\s*<\/slot>/g,()=>{let s=e.slotNodeName||"div";return`<${s} class="fez-slot"></${s}>`}),e.fezHtmlFunc=j(e.html)),e.css&&(e.css=r.globalCss(e.css,{name:t})),r.classes[t]=e,customElements.get(t)||customElements.define(t,class extends HTMLElement{connectedCallback(){Fe(this,e)?Q(t,this):window.requestAnimationFrame(()=>{this.parentNode&&Q(t,this)})}})}function Ce(t){let e=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);return t.replace(/<([a-z-]+)\b([^>]*)\/>/g,(r,s,n)=>e.has(s)?r:`<${s}${n}></${s}>`)}function Fe(t,e){let r=t.getAttribute("fez-fast");var s=typeof e.fastBind=="function"?e.fastBind(t):e.fastBind;return r=="false"?!1:r||s}function Q(t,e){let r=Fez.classes[t],s=e.parentNode;if(e.isConnected){let n=typeof r.nodeName=="function"?r.nodeName(e):r.nodeName,o=document.createElement(n||"div");o.classList.add("fez"),o.classList.add(`fez-${t}`),s.replaceChild(o,e);let i=new r;i.UID=++Fez.instanceCount,Fez.instances.set(i.UID,i),i.oldRoot=e,i.fezName=t,i.root=o,i.props=r.getProps(e,o),i.class=r,i.slot(e,o),o.fez=i,r.fezGlobal&&r.fezGlobal!=!0&&(window[r.fezGlobal]=i),window.$&&(i.$root=$(o)),i.props.id&&o.setAttribute("id",i.props.id),i.fezRegister(),(i.init||i.created||i.connect).bind(i)(i.props);let a=i.root.cloneNode(!0);i.class.fezHtmlFunc&&i.render();let u=i.root.querySelector(".fez-slot");if(u&&(i.props.html?u.innerHTML=i.props.html:i.slot(a,u)),i.onSubmit){let b=i.root.nodeName=="FORM"?i.root:i.find("form");b.onsubmit=g=>{g.preventDefault(),i.onSubmit(i.formData())}}if(i.onMount(i.props),i.onPropsChange){Te.observe(o,{attributes:!0});for(let[b,g]of Object.entries(i.props))i.onPropsChange(b,g)}}}var Te=new MutationObserver((t,e)=>{for(let r of t)if(r.type==="attributes"){let s=r.target.fez,n=r.attributeName,o=r.target.getAttribute(n);s&&(s.props[n]=o,s.onPropsChange(n,o))}});var Me=t=>{let e={script:"",style:"",html:"",head:""},r=t.split(`
9
- `),s=[],n="";for(var o of r)o=o.trim(),o.startsWith("<script")&&!e.script&&n!="head"?n="script":o.startsWith("<head")&&!e.script?n="head":o.startsWith("<style")?n="style":o.endsWith("<\/script>")&&n==="script"&&!e.script?(e.script=s.join(`
10
- `),s=[],n=null):o.endsWith("</style>")&&n==="style"?(e.style=s.join(`
11
- `),s=[],n=null):(o.endsWith("</head>")||o.endsWith("</header>"))&&n==="head"?(e.head=s.join(`
12
- `),s=[],n=null):n?s.push(o):e.html+=o+`
13
- `;if(e.head){let a=document.createElement("div");a.innerHTML=e.head,Array.from(a.children).forEach(u=>{if(u.tagName==="SCRIPT"){let b=document.createElement("script");Array.from(u.attributes).forEach(g=>{b.setAttribute(g.name,g.value)}),b.type||="text/javascript",u.src?document.head.appendChild(b):(b.type.includes("javascript")||b.type=="module")&&(b.textContent=u.textContent,document.head.appendChild(b))}else document.head.appendChild(u.cloneNode(!0))})}let i=e.script;return/class\s+\{/.test(i)||(i=`class {
14
- ${i}
7
+ Template source: ${n}`,console.error(b)}}}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 L=class{static getProps(e,r){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(r)();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=r.previousSibling?.textContent;if(n)try{s=JSON.parse(n),r.previousSibling.remove()}catch(i){console.error(`Fez: Invalid JSON in template for ${e.tagName}: ${i.message}`)}}return s}static formData(e){let r=e.closest("form")||e.querySelector("form");if(!r)return Fez.log("No form found for formData()"),{};let s=new FormData(r),n={};return s.forEach((i,o)=>{n[o]=i}),n}static fastBind(){return!1}static nodeName="div";constructor(){}n=P;get fezHtmlRoot(){return`Fez(${this.UID}).`}get isConnected(){return this.root?.isConnected?!0:(this.fezRemoveSelf(),!1)}fezRemoveSelf(){this._setIntervalCache||={},Object.keys(this._setIntervalCache).forEach(e=>{clearInterval(this._setIntervalCache[e])}),this._eventHandlers&&(Object.entries(this._eventHandlers).forEach(([e,r])=>{window.removeEventListener(e,r)}),this._eventHandlers={}),this._timeouts&&(Object.values(this._timeouts).forEach(e=>{clearTimeout(e)}),this._timeouts={}),this.onDestroy(),this.onDestroy=()=>{},this.root&&(this.root.fez=void 0),this.root=void 0}prop(e){let r=this.oldRoot[e]||this.props[e];return typeof r=="function"&&(r=r.bind(this.root)),r}copy(){for(let e of Array.from(arguments)){let r=this.props[e];if(r!==void 0){if(e=="class"){let s=this.root.getAttribute(e,r);s&&(r=[s,r].join(" "))}(e=="style"||!this.root[e])&&(typeof r=="string"?this.root.setAttribute(e,r):this.root[e]=r)}}}on(e,r,s=200){this._eventHandlers=this._eventHandlers||{},this._timeouts=this._timeouts||{},this._eventHandlers[e]&&window.removeEventListener(e,this._eventHandlers[e]),this._timeouts[e]&&clearTimeout(this._timeouts[e]);let n=0,i=()=>this.isConnected?(r.call(this),!0):(this._eventHandlers[e]&&(window.removeEventListener(e,this._eventHandlers[e]),delete this._eventHandlers[e]),this._timeouts[e]&&(clearTimeout(this._timeouts[e]),delete this._timeouts[e]),!1),o=()=>{let a=Date.now();if(a-n>=s)if(i())n=a;else return;this._timeouts[e]&&clearTimeout(this._timeouts[e]),this._timeouts[e]=setTimeout(()=>{a>n&&i()&&(n=Date.now()),delete this._timeouts[e]},s)};this._eventHandlers[e]=o,window.addEventListener(e,o)}onResize(e,r){this.on("resize",e,r),e()}onScroll(e,r){this.on("scroll",e,r),e()}slot(e,r){r||=document.createElement("template");let s=r.nodeName=="SLOT";for(;e.firstChild;)s?r.parentNode.insertBefore(e.lastChild,r.nextSibling):r.appendChild(e.firstChild);return s?r.parentNode.removeChild(r):e.innerHTML="",r}setStyle(e,r){this.root.style.setProperty(e,r)}connect(){}onMount(){}beforeRender(){}afterRender(){}onDestroy(){}onStateChange(){}onGlobalStateChange(){}publish=Fez.publish;fezBlocks={};parseHtml(e){let r=this.fezHtmlRoot.replaceAll('"',"&quot;");return e=e.replace(/(['"\s;])fez\./g,`$1${r}`).replace(/>\s+</g,"><"),e.trim()}nextTick(e,r){r?(this._nextTicks||={},this._nextTicks[r]||=window.requestAnimationFrame(()=>{e.bind(this)(),this._nextTicks[r]=null},r)):window.requestAnimationFrame(e.bind(this))}render(e){if(e||=this?.class?.fezHtmlFunc,!e||!this.root)return;this.beforeRender();let r=document.createElement(this.class.nodeName||"div"),s;Array.isArray(e)?e[0]instanceof Node?e.forEach(o=>r.appendChild(o)):s=e.join(""):typeof e=="string"?s=O(e)(this):typeof e=="function"&&(s=e(this)),s&&(s=s.replace(/\s\w+="undefined"/g,""),r.innerHTML=this.parseHtml(s));let n=r.querySelector("slot");n&&(this.slot(this.root,n.parentNode),n.parentNode.removeChild(n));let i=r.querySelector(".fez-slot");if(i){let o=this.find(".fez-slot");o?i.parentNode.replaceChild(o,i):this.slot(this.root,i)}Fez.morphdom(this.root,r),this.renderFezPostProcess(),this.afterRender()}renderFezPostProcess(){let e=(r,s)=>{this.root.querySelectorAll(`*[${r}]`).forEach(n=>{let i=n.getAttribute(r);n.removeAttribute(r),i&&s.bind(this)(i,n)})};e("fez-this",(r,s)=>{new Function("n",`this.${r} = n`).bind(this)(s)}),e("fez-use",(r,s)=>{let n=this[r];typeof n=="function"?n(s):console.error(`Fez error: "${r}" is not a function in ${this.fezName}`)}),e("fez-class",(r,s)=>{let n=r.split(/\s+/),i=n.pop();n.forEach(o=>s.classList.add(o)),i&&setTimeout(()=>{s.classList.add(i)},300)}),e("fez-bind",(r,s)=>{if(["INPUT","SELECT","TEXTAREA"].includes(s.nodeName)){let n=new Function(`return this.${r}`).bind(this)(),i=s.type.toLowerCase()=="checkbox",o=["SELECT"].includes(s.nodeName)||i?"onchange":"onkeyup";s.setAttribute(o,`${this.fezHtmlRoot}${r} = this.${i?"checked":"value"}`),this.val(s,n)}else console.error(`Cant fez-bind="${r}" to ${s.nodeName} (needs INPUT, SELECT or TEXTAREA. Want to use fez-this?).`)}),this.root.querySelectorAll("*[disabled]").forEach(r=>{let s=r.getAttribute("disabled");["false"].includes(s)?r.removeAttribute("disabled"):r.setAttribute("disabled","true")})}refresh(e){if(alert("NEEDS FIX and remove htmlTemplate"),e){let r=document.createElement("div");r.innerHTML=this.class.htmlTemplate;let s=r.querySelector(e).innerHTML;this.render(e,s)}else this.render()}setInterval(e,r,s){return typeof e=="number"&&([r,e]=[e,r]),s||=Fez.fnv1(String(e)),this._setIntervalCache||={},clearInterval(this._setIntervalCache[s]),this._setIntervalCache[s]=setInterval(()=>{this.isConnected&&e()},r),this._setIntervalCache[s]}find(e){return typeof e=="string"?this.root.querySelector(e):e}val(e,r){let s=this.find(e);if(s)if(["INPUT","TEXTAREA","SELECT"].includes(s.nodeName))if(typeof r<"u")s.type=="checkbox"?s.checked=!!r:s.value=r;else return s.value;else if(typeof r<"u")s.innerHTML=r;else return s.innerHTML}formData(e){return this.class.formData(e||this.root)}attr(e,r){return typeof r>"u"?this.root.getAttribute(e):(this.root.setAttribute(e,r),r)}childNodes(e){let r=Array.from(this.root.children);if(e){let s=document.createElement("div");s.style.display="none",document.body.appendChild(s),r.forEach(i=>s.appendChild(i));let n=Array.from(s.children).map(e);return document.body.removeChild(s),n}else return r}subscribe(e,r){Fez._subs||={},Fez._subs[e]||=[],Fez._subs[e]=Fez._subs[e].filter(s=>s[0].isConnected),Fez._subs[e].push([this,r])}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(r=>r!=="constructor"&&typeof this[r]=="function").forEach(r=>this[r]=this[r].bind(this))}fezHide(){let e=this.root,r=this.root.parentNode,s=document.createDocumentFragment();for(;e.firstChild;)s.appendChild(e.firstChild);return e.parentNode.replaceChild(s,e),this.root=r,Array.from(this.root.children)}reactiveStore(e,r){e||={},r||=(n,i,o,a)=>{this.onStateChange(i,o,a),this.nextTick(this.render,"render")},r.bind(this);function s(n,i){return typeof n!="object"||n===null?n:new Proxy(n,{set(o,a,u,b){let g=Reflect.get(o,a,b);if(g!==u){typeof u=="object"&&u!==null&&(u=s(u,i));let S=Reflect.set(o,a,u,b);return i(o,a,u,g),S}return!0},get(o,a,u){let b=Reflect.get(o,a,u);return typeof b=="object"&&b!==null?s(b,i):b}})}return s(e,r)}};var be={data:""},J=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||be,ye=t=>{let e=J(t),r=e.data;return e.data="",r},ge=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ze=/\/\*[^]*?\*\/| +/g,U=/\n+/g,F=(t,e)=>{let r="",s="",n="";for(let i in t){let o=t[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":s+=i[1]=="f"?F(o,i):i+"{"+F(o,i[1]=="k"?"":e)+"}":typeof o=="object"?s+=F(o,e?e.replace(/([^,])+/g,a=>i.replace(/(^:.*)|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,a):a?a+" "+u:u)):i):o!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),n+=F.p?F.p(i,o):i+":"+o+";")}return r+(e&&n?e+"{"+n+"}":n)+s},C={},K=t=>{if(typeof t=="object"){let e="";for(let r in t)e+=r+K(t[r]);return e}return t},ve=(t,e,r,s,n)=>{let i=K(t),o=C[i]||(C[i]=(u=>{let b=0,g=11;for(;b<u.length;)g=101*g+u.charCodeAt(b++)>>>0;return"go"+g})(i));if(!C[o]){let u=i!==t?t:(b=>{let g,S,E=[{}];for(;g=ge.exec(b.replace(ze,""));)g[4]?E.shift():g[3]?(S=g[3].replace(U," ").trim(),E.unshift(E[0][S]=E[0][S]||{})):E[0][g[1]]=g[2].replace(U," ").trim();return E[0]})(t);C[o]=F(n?{["@keyframes "+o]:u}:u,r?"":"."+o)}let a=r&&C.g?C.g:null;return r&&(C.g=C[o]),((u,b,g,S)=>{S?b.data=b.data.replace(S,u):b.data.indexOf(u)===-1&&(b.data=g?u+b.data:b.data+u)})(C[o],e,s,a),o},Se=(t,e,r)=>t.reduce((s,n,i)=>{let o=e[i];if(o&&o.call){let a=o(r),u=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=u?"."+u:a&&typeof a=="object"?a.props?"":F(a,""):a===!1?"":a}return s+n+(o??"")},"");function R(t){let e=this||{},r=t.call?t(e.p):t;return ve(r.unshift?r.raw?Se(r,[].slice.call(arguments,1),e.p):r.reduce((s,n)=>Object.assign(s,n&&n.call?n(e.p):n),{}):r,J(e.target),e.g,e.o,e.k)}var X,D,B,Ee=R.bind({g:1}),Ae=R.bind({k:1});function Te(t,e,r,s){F.p=e,X=t,D=r,B=s}function $e(t,e){let r=this||{};return function(){let s=arguments;function n(i,o){let a=Object.assign({},i),u=a.className||n.className;r.p=Object.assign({theme:D&&D()},a),r.o=/ *go\d+/.test(u),a.className=R.apply(r,s)+(u?" "+u:""),e&&(a.ref=o);let b=t;return t[0]&&(b=a.as||t,delete a.as),B&&b[0]&&B(a),X(b,a)}return e?e(n):n}}var Z={css:R,extractCss:ye,glob:Ee,keyframes:Ae,setup:Te,styled:$e};var Y=function(){"use strict";let t=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:T,afterNodeAdded:T,beforeNodeMorphed:T,afterNodeMorphed:T,beforeNodeRemoved:T,afterNodeRemoved:T,beforeAttributeUpdated:T},head:{style:"merge",shouldPreserve:function(l){return l.getAttribute("im-preserve")==="true"},shouldReAppend:function(l){return l.getAttribute("im-re-append")==="true"},shouldRemove:T,afterHeadMorphed:T}};function r(l,c,f={}){l instanceof Document&&(l=l.documentElement),typeof c=="string"&&(c=oe(c));let d=le(c),h=se(l,d,f);return s(l,d,h)}function s(l,c,f){if(f.head.block){let d=l.querySelector("head"),h=c.querySelector("head");if(d&&h){let p=S(h,d,f);Promise.all(p).then(function(){s(l,c,Object.assign(f,{head:{block:!1,ignore:!0}}))});return}}if(f.morphStyle==="innerHTML")return o(c,l,f),l.children;if(f.morphStyle==="outerHTML"||f.morphStyle==null){let d=fe(c,l,f),h=d?.previousSibling,p=d?.nextSibling,y=i(l,d,f);return d?ce(h,y,p):[]}else throw"Do not understand how to morph style "+f.morphStyle}function n(l,c){return c.ignoreActiveValue&&l===document.activeElement&&l!==document.body}function i(l,c,f){if(!(f.ignoreActive&&l===document.activeElement))return c==null?f.callbacks.beforeNodeRemoved(l)===!1?l:(l.remove(),f.callbacks.afterNodeRemoved(l),null):j(l,c)?(f.callbacks.beforeNodeMorphed(l,c)===!1||(l instanceof HTMLHeadElement&&f.head.ignore||(l instanceof HTMLHeadElement&&f.head.style!=="morph"?S(c,l,f):(u(c,l,f),n(l,f)||o(c,l,f))),f.callbacks.afterNodeMorphed(l,c)),l):f.callbacks.beforeNodeRemoved(l)===!1||f.callbacks.beforeNodeAdded(c)===!1?l:(l.parentElement.replaceChild(c,l),f.callbacks.afterNodeAdded(c),f.callbacks.afterNodeRemoved(l),c)}function o(l,c,f){let d=l.firstChild,h=c.firstChild,p;for(;d;){if(p=d,d=p.nextSibling,h==null){if(f.callbacks.beforeNodeAdded(p)===!1)return;c.appendChild(p),f.callbacks.afterNodeAdded(p),M(f,p);continue}if(q(p,h,f)){i(h,p,f),h=h.nextSibling,M(f,p);continue}let y=ne(l,c,p,h,f);if(y){h=k(h,y,f),i(y,p,f),M(f,p);continue}let z=ie(l,c,p,h,f);if(z){h=k(h,z,f),i(z,p,f),M(f,p);continue}if(f.callbacks.beforeNodeAdded(p)===!1)return;c.insertBefore(p,h),f.callbacks.afterNodeAdded(p),M(f,p)}for(;h!==null;){let y=h;h=h.nextSibling,W(y,f)}}function a(l,c,f,d){return l==="value"&&d.ignoreActiveValue&&c===document.activeElement?!0:d.callbacks.beforeAttributeUpdated(l,c,f)===!1}function u(l,c,f){let d=l.nodeType;if(d===1){let h=l.attributes,p=c.attributes;for(let y of h)if(!a(y.name,c,"update",f))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];a(z.name,c,"remove",f)||l.hasAttribute(z.name)||c.removeAttribute(z.name)}}(d===8||d===3)&&c.nodeValue!==l.nodeValue&&(c.nodeValue=l.nodeValue),n(c,f)||g(l,c,f)}function b(l,c,f,d){if(l[f]!==c[f]){let h=a(f,c,"update",d);h||(c[f]=l[f]),l[f]?h||c.setAttribute(f,l[f]):a(f,c,"remove",d)||c.removeAttribute(f)}}function g(l,c,f){if(l instanceof HTMLInputElement&&c instanceof HTMLInputElement&&l.type!=="file"){let d=l.value,h=c.value;b(l,c,"checked",f),b(l,c,"disabled",f),l.hasAttribute("value")?d!==h&&(a("value",c,"update",f)||(c.setAttribute("value",d),c.value=d)):a("value",c,"remove",f)||(c.value="",c.removeAttribute("value"))}else if(l instanceof HTMLOptionElement)b(l,c,"selected",f);else if(l instanceof HTMLTextAreaElement&&c instanceof HTMLTextAreaElement){let d=l.value,h=c.value;if(a("value",c,"update",f))return;d!==h&&(c.value=d),c.firstChild&&c.firstChild.nodeValue!==d&&(c.firstChild.nodeValue=d)}}function S(l,c,f){let d=[],h=[],p=[],y=[],z=f.head.style,_=new Map;for(let v of l.children)_.set(v.outerHTML,v);for(let v of c.children){let w=_.has(v.outerHTML),I=f.head.shouldReAppend(v),N=f.head.shouldPreserve(v);w||N?I?h.push(v):(_.delete(v.outerHTML),p.push(v)):z==="append"?I&&(h.push(v),y.push(v)):f.head.shouldRemove(v)!==!1&&h.push(v)}y.push(..._.values());let G=[];for(let v of y){let w=document.createRange().createContextualFragment(v.outerHTML).firstChild;if(f.callbacks.beforeNodeAdded(w)!==!1){if(w.href||w.src){let I=null,N=new Promise(function(pe){I=pe});w.addEventListener("load",function(){I()}),G.push(N)}c.appendChild(w),f.callbacks.afterNodeAdded(w),d.push(w)}}for(let v of h)f.callbacks.beforeNodeRemoved(v)!==!1&&(c.removeChild(v),f.callbacks.afterNodeRemoved(v));return f.head.afterHeadMorphed(c,{added:d,kept:p,removed:h}),G}function E(){}function T(){}function re(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 se(l,c,f){return f=re(f),{target:l,newContent:c,config:f,morphStyle:f.morphStyle,ignoreActive:f.ignoreActive,ignoreActiveValue:f.ignoreActiveValue,idMap:he(l,c),deadIds:new Set,callbacks:f.callbacks,head:f.head}}function q(l,c,f){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName?l.id!==""&&l.id===c.id?!0:H(f,l,c)>0:!1}function j(l,c){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName}function k(l,c,f){for(;l!==c;){let d=l;l=l.nextSibling,W(d,f)}return M(f,c),c.nextSibling}function ne(l,c,f,d,h){let p=H(h,f,c),y=null;if(p>0){let z=d,_=0;for(;z!=null;){if(q(f,z,h))return z;if(_+=H(h,z,l),_>p)return null;z=z.nextSibling}}return y}function ie(l,c,f,d,h){let p=d,y=f.nextSibling,z=0;for(;p!=null;){if(H(h,p,l)>0)return null;if(j(f,p))return p;if(j(y,p)&&(z++,y=y.nextSibling,z>=2))return null;p=p.nextSibling}return p}function oe(l){let c=new DOMParser,f=l.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(f.match(/<\/html>/)||f.match(/<\/head>/)||f.match(/<\/body>/)){let d=c.parseFromString(l,"text/html");if(f.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 le(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 f of[...l])c.append(f);return c}}function ce(l,c,f){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);f!=null;)d.push(f),h.push(f),f=f.nextSibling;for(;d.length>0;)c.parentElement.insertBefore(d.pop(),c.nextSibling);return h}function fe(l,c,f){let d;d=l.firstChild;let h=d,p=0;for(;d;){let y=ae(d,c,f);y>p&&(h=d,p=y),d=d.nextSibling}return h}function ae(l,c,f){return j(l,c)?.5+H(f,l,c):0}function W(l,c){M(c,l),c.callbacks.beforeNodeRemoved(l)!==!1&&(l.remove(),c.callbacks.afterNodeRemoved(l))}function ue(l,c){return!l.deadIds.has(c)}function de(l,c,f){return(l.idMap.get(f)||t).has(c)}function M(l,c){let f=l.idMap.get(c)||t;for(let d of f)l.deadIds.add(d)}function H(l,c,f){let d=l.idMap.get(c)||t,h=0;for(let p of d)ue(l,p)&&de(l,p,f)&&++h;return h}function V(l,c){let f=l.parentElement,d=l.querySelectorAll("[id]");for(let h of d){let p=h;for(;p!==f&&p!=null;){let y=c.get(p);y==null&&(y=new Set,c.set(p,y)),y.add(h.id),p=p.parentElement}}}function he(l,c){let f=new Map;return V(l,f),V(c,f),f}return{morph:r,defaults:e}}();function x(t,e){let r=globalThis.window?.Fez||globalThis.Fez;if(t.includes("-")||console.error(`Fez: Invalid custom element name "${t}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),!e.fezHtmlRoot){let s=new e,n=class extends L{};if(Object.getOwnPropertyNames(s).concat(Object.getOwnPropertyNames(e.prototype)).filter(a=>!["constructor","prototype"].includes(a)).forEach(a=>n.prototype[a]=s[a]),r.fastBindInfo||={fast:[],slow:[]},s.GLOBAL&&(n.fezGlobal=s.GLOBAL),s.CSS&&(n.css=s.CSS),s.HTML&&(n.html=s.HTML),s.NAME&&(n.nodeName=s.NAME),s.FAST?(n.fastBind=s.FAST,r.fastBindInfo.fast.push(typeof s.FAST=="function"?`${t} (func)`:t)):r.fastBindInfo.slow.push(t),s.GLOBAL){let a=()=>document.body.appendChild(document.createElement(t));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()}e=n;let o=`${t} compiled`;s.FAST&&(o+=" (fast bind)"),r.log(o)}e.html&&(e.html=we(e.html),e.html=e.html.replace(/<slot\s*\/>|<slot\s*>\s*<\/slot>/g,()=>{let s=e.slotNodeName||"div";return`<${s} class="fez-slot"></${s}>`}),e.fezHtmlFunc=O(e.html)),e.css&&(e.css=r.globalCss(e.css,{name:t})),r.classes[t]=e,customElements.get(t)||customElements.define(t,class extends HTMLElement{connectedCallback(){Ce(this,e)?Q(t,this):window.requestAnimationFrame(()=>{this.parentNode&&Q(t,this)})}})}function we(t){let e=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);return t.replace(/<([a-z-]+)\b([^>]*)\/>/g,(r,s,n)=>e.has(s)?r:`<${s}${n}></${s}>`)}function Ce(t,e){let r=t.getAttribute("fez-fast");var s=typeof e.fastBind=="function"?e.fastBind(t):e.fastBind;return r=="false"?!1:r||s}function Q(t,e){let r=Fez.classes[t],s=e.parentNode;if(e.isConnected){let n=typeof r.nodeName=="function"?r.nodeName(e):r.nodeName,i=document.createElement(n||"div");i.classList.add("fez"),i.classList.add(`fez-${t}`),s.replaceChild(i,e);let o=new r;if(o.UID=++Fez.instanceCount,Fez.instances.set(o.UID,o),o.oldRoot=e,o.fezName=t,o.root=i,o.props=r.getProps(e,i),o.class=r,o.slot(e,i),i.fez=o,r.fezGlobal&&r.fezGlobal!=!0&&(window[r.fezGlobal]=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.onSubmit){let a=o.root.nodeName=="FORM"?o.root:o.find("form");a.onsubmit=u=>{u.preventDefault(),o.onSubmit(o.formData())}}if(o.onMount(o.props),o.onPropsChange){Fe.observe(i,{attributes:!0});for(let[a,u]of Object.entries(o.props))o.onPropsChange(a,u)}}}var Fe=new MutationObserver((t,e)=>{for(let r of t)if(r.type==="attributes"){let s=r.target.fez,n=r.attributeName,i=r.target.getAttribute(n);s&&(s.props[n]=i,s.onPropsChange(n,i))}});var Me=t=>{let e={script:"",style:"",html:"",head:""},r=t.split(`
9
+ `),s=[],n="";for(var i of r)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(`
10
+ `),s=[],n=null):i.endsWith("</style>")&&n==="style"?(e.style=s.join(`
11
+ `),s=[],n=null):(i.endsWith("</head>")||i.endsWith("</header>"))&&n==="head"?(e.head=s.join(`
12
+ `),s=[],n=null):n?s.push(i):e.html+=i+`
13
+ `;if(e.head){let a=document.createElement("div");a.innerHTML=e.head,Array.from(a.children).forEach(u=>{if(u.tagName==="SCRIPT"){let b=document.createElement("script");Array.from(u.attributes).forEach(g=>{b.setAttribute(g.name,g.value)}),b.type||="text/javascript",u.src?document.head.appendChild(b):(b.type.includes("javascript")||b.type=="module")&&(b.textContent=u.textContent,document.head.appendChild(b))}else document.head.appendChild(u.cloneNode(!0))})}let o=e.script;return/class\s+\{/.test(o)||(o=`class {
14
+ ${o}
15
15
  }`),String(e.style).includes(":")&&(Object.entries(Fez._styleMacros).forEach(([a,u])=>{e.style=e.style.replaceAll(`:${a} `,`${u} `)}),e.style=e.style.includes(":fez")||/(?:^|\s)body\s*\{/.test(e.style)?e.style:`:fez {
16
16
  ${e.style}
17
- }`,i=i.replace(/\}\s*$/,`
17
+ }`,o=o.replace(/\}\s*$/,`
18
18
  CSS = \`${e.style}\`
19
- }`)),/\w/.test(String(e.html))&&(e.html=e.html.replaceAll("`","&#x60;"),e.html=e.html.replaceAll("$","\\$"),i=i.replace(/\}\s*$/,`
19
+ }`)),/\w/.test(String(e.html))&&(e.html=e.html.replaceAll("`","&#x60;"),e.html=e.html.replaceAll("$","\\$"),o=o.replace(/\}\s*$/,`
20
20
  HTML = \`${e.html}\`
21
- }`)),i};function ee(t,e){if(t instanceof Node){let n=t;n.remove();let o=n.getAttribute("fez");if(o&&(o.includes(".")||o.includes("/"))){let i=o;Fez.log(`Loading from ${i}`),fetch(i).then(a=>{if(!a.ok)throw new Error(`Failed to load ${i}: ${a.status}`);return a.text()}).then(a=>{let g=new DOMParser().parseFromString(a,"text/html").querySelectorAll("template[fez], xmp[fez]");if(g.length>0)g.forEach(S=>{let A=S.getAttribute("fez");A&&!A.includes("-")&&!A.includes(".")&&!A.includes("/")&&console.error(`Fez: Invalid custom element name "${A}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let E=S.innerHTML;Fez.compile(A,E)});else{let S=i.split("/").pop().split(".")[0];Fez.compile(S,a)}}).catch(a=>{console.error(`FEZ template load error for "${o}": ${a.message}`)});return}else o&&!o.includes("-")&&console.error(`Fez: Invalid custom element name "${o}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),e=n.innerHTML,t=o}else if(typeof e!="string"){document.body.querySelectorAll("template[fez], xmp[fez]").forEach(n=>Fez.compile(n));return}t&&!t.includes("-")&&!t.includes(".")&&!t.includes("/")&&console.error(`Fez: Invalid custom element name "${t}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let r=Me(e),s=r.split(/class\s+\{/,2);if(r=`${s[0]};
21
+ }`)),o};function ee(t,e){if(t instanceof Node){let n=t;n.remove();let i=n.getAttribute("fez");if(i&&(i.includes(".")||i.includes("/"))){let o=i;Fez.log(`Loading from ${o}`),Fez.fetch(o).then(a=>{let g=new DOMParser().parseFromString(a,"text/html").querySelectorAll("template[fez], xmp[fez]");if(g.length>0)g.forEach(S=>{let E=S.getAttribute("fez");E&&!E.includes("-")&&!E.includes(".")&&!E.includes("/")&&console.error(`Fez: Invalid custom element name "${E}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let T=S.innerHTML;Fez.compile(E,T)});else{let S=o.split("/").pop().split(".")[0];Fez.compile(S,a)}}).catch(a=>{console.error(`FEZ template load error for "${i}": ${a.message}`)});return}else i&&!i.includes("-")&&console.error(`Fez: Invalid custom element name "${i}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),e=n.innerHTML,t=i}else if(typeof e!="string"){document.body.querySelectorAll("template[fez], xmp[fez]").forEach(n=>Fez.compile(n));return}t&&!t.includes("-")&&!t.includes(".")&&!t.includes("/")&&console.error(`Fez: Invalid custom element name "${t}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let r=Me(e),s=r.split(/class\s+\{/,2);if(r=`${s[0]};
22
22
 
23
23
  window.Fez('${t}', class {
24
24
  ${s[1]})`,t){let n=document.getElementById("fez-hidden-styles");n||(n=document.createElement("style"),n.id="fez-hidden-styles",document.head.appendChild(n)),n.textContent+=`${t} { display: none; }
25
- `}if(r.includes("import "))Fez.head({script:r}),setTimeout(()=>{Fez.classes[t]||Fez.error(`Template "${t}" possible compile error. (can be a false positive, it imports are not loaded)`)},2e3);else try{new Function(r)()}catch(n){Fez.error(`Template "${t}" compile error: ${n.message}`),console.log(r)}}var Le={data:{},listeners:new Map,subscribers:new Map,globalSubscribers:new Set,notify(t,e,r){Fez.log(`Global state change for ${t}: ${e} (from ${r})`);let s=this.listeners.get(t);s&&s.forEach(o=>{o.isConnected?(o.onGlobalStateChange(t,e,r),o.render()):s.delete(o)});let n=this.subscribers.get(t);n&&n.forEach(o=>{try{o(e,r,t)}catch(i){console.error(`Error in subscriber for key ${t}:`,i)}}),this.globalSubscribers.forEach(o=>{try{o(t,e,r)}catch(i){console.error("Error in global subscriber:",i)}})},createProxy(t){return new Proxy({},{get:(e,r)=>(t._globalStateKeys||=new Set,t._globalStateKeys.has(r)||(t._globalStateKeys.add(r),this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(t)),this.data[r]),set:(e,r,s)=>{let n=this.data[r];return n!==s&&(this.data[r]=s,this.notify(r,s,n)),!0}})},set(t,e){let r=this.data[t];r!==e&&(this.data[t]=e,this.notify(t,e,r))},get(t){return this.data[t]},forEach(t,e){let r=this.listeners.get(t);r&&r.forEach(s=>{s.isConnected?e(s):r.delete(s)})},subscribe(t,e){if(typeof t=="function")return this.globalSubscribers.add(t),()=>this.globalSubscribers.delete(t);{let r=t;return this.subscribers.has(r)||this.subscribers.set(r,new Set),this.subscribers.get(r).add(e),()=>{let s=this.subscribers.get(r);s&&(s.delete(e),s.size===0&&this.subscribers.delete(r))}}}},te=Le;var m=(t,e)=>{if(typeof t=="number"){let r=m.instances.get(t);if(r)return r;m.error(`Instance with UID "${t}" not found.`)}else if(t)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-${t}`)).filter(n=>n.fez);return s.forEach(n=>e(n.fez)),s}else return typeof e!="function"?m.find(t,e):x(t,e);else{let r=t.nodeName?t.closest(".fez"):document.querySelector(t.includes("#")?t:`.fez.fez-${t}`);if(r){if(r.fez)return r.fez;m.error(`node "${t}" has no Fez attached.`)}else m.error(`node "${t}" not found.`)}else m.error("Fez() ?")};m.classes={};m.instanceCount=0;m.instances=new Map;m.find=(t,e)=>{let r=t;typeof r=="string"&&(r=document.body.querySelector(r)),typeof r.val=="function"&&(r=r[0]);let s=e?`.fez.fez-${e}`:".fez",n=r.closest(s);if(n&&n.fez)return n.fez;console.error("Fez node connector not found",t,r)};m.cssClass=t=>Z.css(t);m.globalCss=(t,e={})=>{if(typeof t=="function"&&(t=t()),t.includes(":")){let r=t.split(`
25
+ `}if(r.includes("import "))Fez.head({script:r}),setTimeout(()=>{Fez.classes[t]||Fez.error(`Template "${t}" possible compile error. (can be a false positive, it imports are not loaded)`)},2e3);else try{new Function(r)()}catch(n){Fez.error(`Template "${t}" compile error: ${n.message}`),console.log(r)}}var _e={data:{},listeners:new Map,subscribers:new Map,globalSubscribers:new Set,notify(t,e,r){Fez.log(`Global state change for ${t}: ${e} (from ${r})`);let s=this.listeners.get(t);s&&s.forEach(i=>{i.isConnected?(i.onGlobalStateChange(t,e,r),i.render()):s.delete(i)});let n=this.subscribers.get(t);n&&n.forEach(i=>{try{i(e,r,t)}catch(o){console.error(`Error in subscriber for key ${t}:`,o)}}),this.globalSubscribers.forEach(i=>{try{i(t,e,r)}catch(o){console.error("Error in global subscriber:",o)}})},createProxy(t){return new Proxy({},{get:(e,r)=>(t._globalStateKeys||=new Set,t._globalStateKeys.has(r)||(t._globalStateKeys.add(r),this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(t)),this.data[r]),set:(e,r,s)=>{let n=this.data[r];return n!==s&&(this.data[r]=s,this.notify(r,s,n)),!0}})},set(t,e){let r=this.data[t];r!==e&&(this.data[t]=e,this.notify(t,e,r))},get(t){return this.data[t]},forEach(t,e){let r=this.listeners.get(t);r&&r.forEach(s=>{s.isConnected?e(s):r.delete(s)})},subscribe(t,e){if(typeof t=="function")return this.globalSubscribers.add(t),()=>this.globalSubscribers.delete(t);{let r=t;return this.subscribers.has(r)||this.subscribers.set(r,new Set),this.subscribers.get(r).add(e),()=>{let s=this.subscribers.get(r);s&&(s.delete(e),s.size===0&&this.subscribers.delete(r))}}}},te=_e;var m=(t,e)=>{if(typeof t=="number"){let r=m.instances.get(t);if(r)return r;m.error(`Instance with UID "${t}" not found.`)}else if(t)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-${t}`)).filter(n=>n.fez);return s.forEach(n=>e(n.fez)),s}else return typeof e!="function"?m.find(t,e):x(t,e);else{let r=t.nodeName?t.closest(".fez"):document.querySelector(t.includes("#")?t:`.fez.fez-${t}`);if(r){if(r.fez)return r.fez;m.error(`node "${t}" has no Fez attached.`)}else m.error(`node "${t}" not found.`)}else m.error("Fez() ?")};m.classes={};m.instanceCount=0;m.instances=new Map;m.find=(t,e)=>{let r=t;typeof r=="string"&&(r=document.body.querySelector(r)),typeof r.val=="function"&&(r=r[0]);let s=e?`.fez.fez-${e}`:".fez",n=r.closest(s);if(n&&n.fez)return n.fez;console.error("Fez node connector not found",t,r)};m.cssClass=t=>Z.css(t);m.globalCss=(t,e={})=>{if(typeof t=="function"&&(t=t()),t.includes(":")){let r=t.split(`
26
26
  `).filter(s=>!/^\s*\/\//.test(s)).join(`
27
- `);e.wrap&&(r=`:fez { ${r} }`),r=r.replace(/\:fez|\:host/,`.fez.fez-${e.name}`),t=m.cssClass(r)}return document.body?document.body.parentElement.classList.add(t):document.addEventListener("DOMContentLoaded",()=>{document.body.parentElement.classList.add(t)}),t};m.info=()=>{console.log(JSON.stringify(m.fastBindInfo,null,2))};m.morphdom=(t,e,r={})=>{Array.from(t.attributes).forEach(n=>{e.setAttribute(n.name,n.value)}),Y.morph(t,e,{morphStyle:"outerHTML"});let s=t.nextSibling;s?.nodeType===Node.TEXT_NODE&&s.textContent.trim()===""&&s.remove()};m.htmlEscape=t=>typeof t=="string"?(t=t.replace(/font-family\s*:\s*(?:&[^;]+;|[^;])*?;/gi,"").replaceAll("'","&apos;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;"),t):t===void 0?"":t;m.publish=(t,...e)=>{m._subs||={},m._subs[t]||=[],m._subs[t].forEach(r=>{r[1].bind(r[0])(...e)})};m.fnv1=t=>{var e,r,s,n,o,i;for(e=2166136261,r=16777619,s=e,n=o=0,i=t.length-1;0<=i?o<=i:o>=i;n=0<=i?++o:--o)s^=t.charCodeAt(n),s*=r;return s.toString(36).replaceAll("-","")};m.tag=(t,e={},r="")=>{let s=encodeURIComponent(JSON.stringify(e));return`<${t} data-props="${s}">${r}</${t}>`};m.error=(t,e)=>{if(t=`Fez: ${t}`,console.error(t),e)return`<span style="border: 1px solid red; font-size: 14px; padding: 3px 7px; background: #fee; border-radius: 4px;">${t}</span>`};m.log=t=>{m.LOG===!0&&console.log(`Fez: ${t}`)};document.addEventListener("DOMContentLoaded",()=>{m.log("Fez.LOG === true, logging enabled.")});m.untilTrue=(t,e)=>{e||=200,t()||setTimeout(()=>{m.untilTrue(t,e)},e)};m.head=(t,e)=>{if(typeof t!="object"||t===null)throw new Error("head requires an object parameter");let r,s={},n;if(t.script){if(t.script.includes("import ")){e&&m.error("Fez.head callback is not supported when script with import is passed (module context).");let a=document.createElement("script");a.type="module",a.textContent=t.script,document.head.appendChild(a),setTimeout(()=>a.remove(),100)}else try{new Function(t.script)(),e&&e()}catch(a){m.error("Error executing script:",a),console.log(t.script)}return}else if(t.js){r=t.js,n="script";for(let[a,u]of Object.entries(t))a!=="js"&&a!=="module"&&(s[a]=u);t.module&&(s.type="module")}else if(t.css){r=t.css,n="link",s.rel="stylesheet";for(let[a,u]of Object.entries(t))a!=="css"&&(s[a]=u)}else throw new Error('head requires either "script", "js" or "css" property');let o=document.querySelector(`${n}[src="${r}"], ${n}[href="${r}"]`);if(o)return e&&e(),o;let i=document.createElement(n);n==="link"?i.href=r:i.src=r;for(let[a,u]of Object.entries(s))i.setAttribute(a,u);return(e||t.module)&&(i.onload=()=>{t.module&&n==="script"&&import(r).then(a=>{window[t.module]=a.default||a[t.module]||a}).catch(a=>{console.error(`Error importing module ${t.module}:`,a)}),e&&e()}),document.head.appendChild(i),i};m.fetch=function(...t){m._fetchCache||={};let e="GET",r,s;typeof t[0]=="string"&&/^[A-Z]+$/.test(t[0])&&(e=t.shift()),r=t.shift();let n={},o=null;if(typeof t[0]=="object"&&(o=t.shift()),typeof t[0]=="function"&&(s=t.shift()),o){if(e==="GET"){let u=new URLSearchParams(o);r+=(r.includes("?")?"&":"?")+u.toString()}else if(e==="POST"){let u=new FormData;for(let[b,g]of Object.entries(o))u.append(b,g);n.body=u}}n.method=e;let i=`${e}:${r}:${JSON.stringify(n)}`;if(m._fetchCache[i]){let u=m._fetchCache[i];if(m.log(`fetch cache hit: ${e} ${r}`),s){s(u);return}return Promise.resolve(u)}m.log(`fetch live: ${e} ${r}`);let a=u=>u.headers.get("content-type")?.includes("application/json")?u.json():u.text();if(s){fetch(r,n).then(a).then(u=>{m._fetchCache[i]=u,s(u)}).catch(u=>m.onError("fetch",u));return}return fetch(r,n).then(a).then(u=>(m._fetchCache[i]=u,u))};m.onError=(t,e)=>{if(typeof t!="string")throw new Error("Fez.onError: kind must be a string");console.error(`${t}: ${e.toString()}`)};m._styleMacros={};m.styleMacro=(t,e)=>{m._styleMacros[t]=e};m.store={store:new Map,counter:0,set(t){let e=this.counter++;return this.store.set(e,t),e},get(t){return this.store.get(t)},delete(t){let e=this.store.get(t);return this.store.delete(t),e}};m.compile=ee;m.state=te;var T=m;typeof window<"u"&&(window.FezBase=I);typeof window<"u"&&(window.Fez=T);setInterval(()=>{for(let[t,e]of T.instances)e?.isConnected||(e.fez?.fezRemoveSelf(),T.instances.delete(t))},5e3);var Ie=new MutationObserver(t=>{for(let{addedNodes:e,removedNodes:r}of t)e.forEach(s=>{s.nodeType===1&&s.matches("template[fez], xmp[fez], script[fez]")&&window.requestAnimationFrame(()=>{T.compile(s),s.remove()})}),r.forEach(s=>{s.nodeType===1&&s.querySelectorAll&&s.querySelectorAll(".fez, :scope.fez").forEach(o=>{o.fez&&o.root&&(T.instances.delete(o.fez.UID),o.fez.fezRemoveSelf())})})});Ie.observe(document.documentElement,{childList:!0,subtree:!0});T("fez-component",class{init(t){let e=document.createElement(t.name);for(e.props=t.props||t["data-props"]||t;this.root.firstChild;)this.root.parentNode.insertBefore(this.root.lastChild,e.nextSibling);this.root.innerHTML="",this.root.appendChild(e)}});var et=T;})();
27
+ `);e.wrap&&(r=`:fez { ${r} }`),r=r.replace(/\:fez|\:host/,`.fez.fez-${e.name}`),t=m.cssClass(r)}return document.body?document.body.parentElement.classList.add(t):document.addEventListener("DOMContentLoaded",()=>{document.body.parentElement.classList.add(t)}),t};m.info=()=>{console.log(JSON.stringify(m.fastBindInfo,null,2))};m.morphdom=(t,e,r={})=>{Array.from(t.attributes).forEach(n=>{e.setAttribute(n.name,n.value)}),Y.morph(t,e,{morphStyle:"outerHTML"});let s=t.nextSibling;s?.nodeType===Node.TEXT_NODE&&s.textContent.trim()===""&&s.remove()};m.htmlEscape=t=>typeof t=="string"?(t=t.replace(/font-family\s*:\s*(?:&[^;]+;|[^;])*?;/gi,"").replaceAll("&","&amp;").replaceAll("'","&apos;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;"),t):t===void 0?"":t;m.publish=(t,...e)=>{m._subs||={},m._subs[t]||=[],m._subs[t].forEach(r=>{r[1].bind(r[0])(...e)})};m.fnv1=t=>{var e,r,s,n,i,o;for(e=2166136261,r=16777619,s=e,n=i=0,o=t.length-1;0<=o?i<=o:i>=o;n=0<=o?++i:--i)s^=t.charCodeAt(n),s*=r;return s.toString(36).replaceAll("-","")};m.tag=(t,e={},r="")=>{let s=encodeURIComponent(JSON.stringify(e));return`<${t} data-props="${s}">${r}</${t}>`};m.error=(t,e)=>{if(t=`Fez: ${t}`,console.error(t),e)return`<span style="border: 1px solid red; font-size: 14px; padding: 3px 7px; background: #fee; border-radius: 4px;">${t}</span>`};m.log=t=>{m.LOG===!0&&(t=String(t).substring(0,180),console.log(`Fez: ${t}`))};document.addEventListener("DOMContentLoaded",()=>{m.log("Fez.LOG === true, logging enabled.")});m.untilTrue=(t,e)=>{e||=200,t()||setTimeout(()=>{m.untilTrue(t,e)},e)};m.head=(t,e)=>{if(t.nodeName){t.nodeName=="SCRIPT"?(m.head({script:t.innerText}),t.remove()):(t.querySelectorAll("script").forEach(a=>m.head(a)),t.querySelectorAll("template[fez], xmp[fez], script[fez]").forEach(a=>m.compile(a)));return}if(typeof t!="object"||t===null)throw new Error("head requires an object parameter");let r,s={},n;if(t.script){if(t.script.includes("import ")){e&&m.error("Fez.head callback is not supported when script with import is passed (module context).");let a=document.createElement("script");a.type="module",a.textContent=t.script,document.head.appendChild(a),setTimeout(()=>a.remove(),100)}else try{new Function(t.script)(),e&&e()}catch(a){m.error("Error executing script:",a),console.log(t.script)}return}else if(t.js){r=t.js,n="script";for(let[a,u]of Object.entries(t))a!=="js"&&a!=="module"&&(s[a]=u);t.module&&(s.type="module")}else if(t.css){r=t.css,n="link",s.rel="stylesheet";for(let[a,u]of Object.entries(t))a!=="css"&&(s[a]=u)}else throw new Error('head requires either "script", "js" or "css" property');let i=document.querySelector(`${n}[src="${r}"], ${n}[href="${r}"]`);if(i)return e&&e(),i;let o=document.createElement(n);n==="link"?o.href=r:o.src=r;for(let[a,u]of Object.entries(s))o.setAttribute(a,u);return(e||t.module)&&(o.onload=()=>{t.module&&n==="script"&&import(r).then(a=>{window[t.module]=a.default||a[t.module]||a}).catch(a=>{console.error(`Error importing module ${t.module}:`,a)}),e&&e()}),document.head.appendChild(o),o};m.fetch=function(...t){m._fetchCache||={};let e="GET",r,s;typeof t[0]=="string"&&/^[A-Z]+$/.test(t[0])&&(e=t.shift()),r=t.shift();let n={},i=null;if(typeof t[0]=="object"&&(i=t.shift()),typeof t[0]=="function"&&(s=t.shift()),i){if(e==="GET"){let u=new URLSearchParams(i);r+=(r.includes("?")?"&":"?")+u.toString()}else if(e==="POST"){let u=new FormData;for(let[b,g]of Object.entries(i))u.append(b,g);n.body=u}}n.method=e;let o=`${e}:${r}:${JSON.stringify(n)}`;if(m._fetchCache[o]){let u=m._fetchCache[o];if(m.log(`fetch cache hit: ${e} ${r}`),s){s(u);return}return Promise.resolve(u)}m.log(`fetch live: ${e} ${r}`);let a=u=>u.headers.get("content-type")?.includes("application/json")?u.json():u.text();if(s){fetch(r,n).then(a).then(u=>{m._fetchCache[o]=u,s(u)}).catch(u=>m.onError("fetch",u));return}return fetch(r,n).then(a).then(u=>(m._fetchCache[o]=u,u))};m.onError=(t,e)=>{if(typeof t!="string")throw new Error("Fez.onError: kind must be a string");console.error(`${t}: ${e.toString()}`)};m._styleMacros={};m.styleMacro=(t,e)=>{m._styleMacros[t]=e};m.store={store:new Map,counter:0,set(t){let e=this.counter++;return this.store.set(e,t),e},get(t){return this.store.get(t)},delete(t){let e=this.store.get(t);return this.store.delete(t),e}};m.compile=ee;m.state=te;var A=m;typeof window<"u"&&(window.FezBase=L);typeof window<"u"&&(window.Fez=A);setInterval(()=>{for(let[t,e]of A.instances)e?.isConnected||(e.fez?.fezRemoveSelf(),A.instances.delete(t))},5e3);var Le=new MutationObserver(t=>{for(let{addedNodes:e,removedNodes:r}of t)e.forEach(s=>{s.nodeType===1&&(s.matches("template[fez], xmp[fez], script[fez]")&&(A.compile(s),s.remove()),s.querySelectorAll&&s.querySelectorAll("template[fez], xmp[fez], script[fez]").forEach(i=>{A.compile(i),i.remove()}))}),r.forEach(s=>{s.nodeType===1&&s.querySelectorAll&&s.querySelectorAll(".fez, :scope.fez").forEach(i=>{i.fez&&i.root&&(A.instances.delete(i.fez.UID),i.fez.fezRemoveSelf())})})});Le.observe(document.documentElement,{childList:!0,subtree:!0});A("fez-component",class{FAST=!0;init(t){let e=document.createElement(t.name);for(e.props=t.props||t["data-props"]||t;this.root.firstChild;)this.root.parentNode.insertBefore(this.root.lastChild,e.nextSibling);this.root.innerHTML="",this.root.appendChild(e)}});A("fez-include",class{FAST=!0;init(t){A.fetch(t.src,e=>{let r=document.createElement("div");r.innerHTML=e,A.head(r),this.root.innerHTML=r.innerHTML})}});var et=A;})();
28
28
  //# sourceMappingURL=fez.js.map