@dinoreic/fez 0.2.0 → 0.2.2

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
@@ -29,9 +29,7 @@ It replaces modern JS frameworks by using native Autonomous Custom Elements to c
29
29
 
30
30
  This article, [Web Components Will Replace Your Frontend Framework](https://www.dannymoerkerke.com/blog/web-components-will-replace-your-frontend-framework/), is from 2019. Join the future, ditch React, Angular and other never defined, always "evolving" monstrosities. Vanilla is the way :)
31
31
 
32
- There is no some "internal state" that is by some magic reflected to DOM. No! All methods Fez use to manipulate DOM are just helpers around native DOM interface. Work on DOM raw, use jQuery, use built in [node builder](https://github.com/dux/fez/blob/main/src/lib/n.js) or full template mapping with [morphing](https://github.com/bigskysoftware/idiomorph).
33
-
34
- It great in combination with another widely used JS libs, as jQuery, Zepto, underscore of loDash.
32
+ There is no some "internal state" that is by some magic reflected to DOM. No! All methods Fez use to manipulate DOM are just helpers around native DOM interface. Work on DOM raw, use built in [node builder](https://github.com/dux/fez/blob/main/src/lib/n.js) or full template mapping with [morphing](https://github.com/bigskysoftware/idiomorph).
35
33
 
36
34
  ## How it works
37
35
 
@@ -49,25 +47,17 @@ Here's a simple counter component that demonstrates Fez's core features:
49
47
  ```html
50
48
  <!-- Define a counter component in ex-counter.fez.html -->
51
49
  <script>
50
+ // called when Fez node is connected to DOM
52
51
  init() {
53
- // called when Fez node is connected to DOM
54
52
  this.MAX = 6
55
53
  this.state.count = 0
56
54
  }
57
55
 
58
- onStateChange(key, value, oldValue) {
59
- // called whenever this.state changes
60
- console.log(`State ${key} changed from ${oldValue} to ${value}`)
61
- if (key === 'count' && value >= this.MAX) {
62
- console.log('Counter reached maximum!')
63
- }
64
- }
65
-
66
56
  isMax() {
67
- // is state is changed, template is re-rendered
68
57
  return this.state.count >= this.MAX
69
58
  }
70
59
 
60
+ // is state is changed, template is re-rendered
71
61
  more() {
72
62
  this.state.count += this.isMax() ? 0 : 1
73
63
  }
@@ -153,6 +143,7 @@ This example showcases:
153
143
  * **Powerful Template Engine** - Multiple syntaxes (`{{ }}` and `[[ ]]`), control flow (`#if`, `#unless`, `#for`, `#each`), and block templates
154
144
  * **Reactive State Management** - Built-in reactive `state` object automatically triggers re-renders on property changes
155
145
  * **DOM Morphing** - Uses [Idiomorph](https://github.com/bigskysoftware/idiomorph) for intelligent DOM updates that preserve element state and animations
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)
156
147
  * **Style Macros** - Define custom CSS shortcuts like `Fez.styleMacro('mobile', '@media (max-width: 768px)')` and use as `:mobile { ... }`
157
148
  * **Scoped & Global Styles** - Components can define both scoped CSS (`:fez { ... }`) and global styles in the same component
158
149
 
@@ -189,57 +180,9 @@ This example showcases:
189
180
  ### Fez Static Methods
190
181
 
191
182
  ```js
192
- Fez('#foo') // find fez node with id="foo"
193
- Fez('ui-tabs', this) // find first parent node ui-tabs
194
-
195
- // add global scss
196
- Fez.globalCss(`
197
- .some-class {
198
- color: red;
199
- &.foo { ... }
200
- .foo { ... }
201
- }
202
- ...
203
- `)
204
-
205
- // internal, get unique ID for a string, poor mans MD5 / SHA1
206
- Fez.fnv1('some string')
207
-
208
- // get generated css class name, from scss source string
209
- Fez.css(text)
210
-
211
- // get generated css class name without global attachment
212
- Fez.cssClass(text)
213
-
214
- // display information about fast/slow bind components in console
215
- Fez.info()
216
-
217
- // low-level DOM morphing function
218
- Fez.morphdom(target, newNode, opts)
219
-
220
- // HTML escaping utility
221
- Fez.htmlEscape(text)
222
-
223
- // create HTML tags with encoded props
224
- Fez.tag(tag, opts, html)
225
-
226
- // execute function until it returns true
227
- Fez.untilTrue(func, pingRate)
228
-
229
- // add scripts/styles to document head
230
- // Load JavaScript from URL: Fez.head({ js: 'path/to/script.js' })
231
- // Load JavaScript with attributes: Fez.head({ js: 'path/to/script.js', type: 'module', async: true })
232
- // Load JavaScript with callback: Fez.head({ js: 'path/to/script.js' }, () => console.log('loaded'))
233
- // Load JavaScript module and auto-import to window: Fez.head({ js: 'path/to/module.js', module: 'MyModule' })
234
- // Load CSS: Fez.head({ css: 'path/to/styles.css' })
235
- // Load CSS with attributes: Fez.head({ css: 'path/to/styles.css', media: 'print' })
236
- // Execute inline script: Fez.head({ script: 'console.log("Hello world")' })
237
- Fez.head(config, callback)
238
-
239
- // define custom style macro
240
- // Fez.styleMacro('mobile', '@media (max-width: 768px)')
241
- // :mobile { ... } -> @media (max-width: 768px) { ... }
242
- Fez.styleMacro(name, value)
183
+ Fez('#foo') // find fez node with id="foo"
184
+ Fez('ui-tabs', this) // find first parent node ui-tabs
185
+ Fez('ui-tabs', (fez)=> ... ) // loop over all ui-tabs nodes
243
186
 
244
187
  // define custom DOM node name -> <foo-bar>...
245
188
  Fez('foo-bar', class {
@@ -269,112 +212,169 @@ Fez('foo-bar', class {
269
212
  GLOBAL = 'Dialog'
270
213
  GLOBAL = true // just append node to document, do not create window reference
271
214
 
272
- // use connect or created
273
- init(props) {
274
- // copy original attributes from attr hash to root node
275
- this.copy('href', 'onclick', 'style')
215
+ // called when fez element is connected to dom, before first render
216
+ // here you still have your slot available in this.root
217
+ init(props) { ... }
276
218
 
277
- // set style property to root node. look at a clock example
278
- // shortcut to this.root.style.setProperty(key, value)
279
- this.setStyle('--color', 'red')
219
+ // execute after init and first render
220
+ onMount() { ... }
280
221
 
281
- // clasic interval, that runs only while node is attached
282
- this.setInterval(func, tick) { ... }
222
+ // execute before or after every render
223
+ beforeRender() { ... }
224
+ afterRender() { ... }
283
225
 
284
- // get closest form data, as object
285
- this.formData()
226
+ // if you want to monitor new or changed node attributes
227
+ // monitors all original node attributes
228
+ // <ui-icon name="home" color="red" />
229
+ onPropsChange(attrName, attrValue) { ... }
286
230
 
287
- // mounted DOM node root
288
- this.root
231
+ // called when local component state changes
232
+ onStateChange(key, value, oldValue) { ... }
289
233
 
290
- // mounted DOM node root wrapped in $, only if jQuery is available
291
- this.$root
234
+ // called when global state changes (only if component uses key in question that key)
235
+ onGlobalStateChange(key, value) { ... }
292
236
 
293
- // node attributes, converted to properties
294
- this.props
237
+ // called when component is destroyed
238
+ onDestroy() { ... }
295
239
 
296
- // gets single node attribute or property
297
- this.prop('onclick')
240
+ /* used inside lifecycle methods (init(), onMount(), ... */
298
241
 
299
- // shortcut for this.root.querySelector(selector)
300
- this.find(selector)
242
+ // copy original attributes from attr hash to root node
243
+ this.copy('href', 'onclick', 'style')
301
244
 
302
- // gets value for FORM fields or node innerHTML
303
- this.val(selector)
304
- // set value to a node, uses value or innerHTML
305
- this.val(selector, value)
245
+ // set style property to root node. look at a clock example
246
+ // shortcut to this.root.style.setProperty(key, value)
247
+ this.setStyle('--color', 'red')
306
248
 
307
- // you can publish globally, and subscribe locally
308
- Fez.publish('channel', foo)
309
- this.subscribe('channel', (foo) => { ... })
249
+ // clasic interval, that runs only while node is attached
250
+ this.setInterval(func, tick) { ... }
310
251
 
311
- // gets root childNodes
312
- this.childNodes()
313
- this.childNodes(func) // pass function to loop forEach on selection, removed nodes from DOM
252
+ // get closest form data, as object. Searches for first parent or child FORM element
253
+ this.formData()
314
254
 
315
- // check if the this.root node is attached to dom
316
- this.isConnected()
255
+ // mounted DOM node root. Only in init() point to original <slot /> data, in onMount() to rendered data.
256
+ this.root
317
257
 
318
- // on every "this.state" props change, auto update view.
319
- this.state = this.reactiveStore()
320
- // this.state has reactiveStore() attached by default. any change will trigger this.render()
321
- this.state.foo = 123
258
+ // mounted DOM node root wrapped in $, only if jQuery is available
259
+ this.$root
322
260
 
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)
261
+ // node attributes, converted to properties
262
+ this.props
328
263
 
329
- // window resize event with cleanup (shorthand for this.on('resize', func, delay))
330
- this.onResize(func, delay)
331
-
332
- // window scroll event with cleanup (shorthand for this.on('scroll', func, delay))
333
- this.onScroll(func, delay)
264
+ // gets single node attribute or property
265
+ this.prop('onclick')
334
266
 
335
- // requestAnimationFrame wrapper with deduplication
336
- this.nextTick(func, name)
267
+ // shortcut for this.root.querySelector(selector)
268
+ this.find(selector)
337
269
 
338
- // get/set unique ID for root node
339
- this.rootId()
270
+ // gets value for FORM fields or node innerHTML
271
+ this.val(selector)
272
+ // set value to a node, uses value or innerHTML
273
+ this.val(selector, value)
340
274
 
341
- // get/set attributes on root node
342
- this.attr(name, value)
275
+ // you can publish globally, and subscribe locally
276
+ Fez.publish('channel', foo)
277
+ this.subscribe('channel', (foo) => { ... })
343
278
 
344
- // hide the custom element wrapper and move children to parent
345
- this.fezHide()
279
+ // gets root childNodes
280
+ this.childNodes()
281
+ this.childNodes(func) // pass function to loop forEach on selection, mask nodes out of position
346
282
 
347
- // execute after connect and initial component render
348
- this.onMount() { ... } // or this.connected() { ... }
283
+ // check if the this.root node is attached to dom
284
+ this.isConnected
349
285
 
350
- // execute before or after every render
351
- this.beforeRender() { ... }
352
- this.afterRender() { ... }
286
+ // this.state has reactiveStore() attached by default. any change will trigger this.render()
287
+ this.state.foo = 123
353
288
 
354
- // if you want to monitor new or changed node attributes
355
- // monitors all original node attributes
356
- // <ui-icon name="home" color="red" />
357
- this.onPropsChange(attrName, attrValue) { ... }
289
+ // generic window event handler with automatic cleanup
290
+ // eventName: 'resize', 'scroll', 'mousemove', etc.
291
+ // delay: throttle delay in ms (default: 200ms)
292
+ this.on(eventName, func, delay)
358
293
 
359
- // called when local component state changes
360
- this.onStateChange(key, value, oldValue) { ... }
294
+ // window resize event with cleanup (shorthand for this.on('resize', func, delay))
295
+ // runs immediately on init and then throttled
296
+ this.onResize(func, delay)
361
297
 
362
- // called when global state changes (if component reads that key)
363
- this.onGlobalStateChange(key, value) { ... }
298
+ // window scroll event with cleanup (shorthand for this.on('scroll', func, delay))
299
+ // runs immediately on init and then throttled
300
+ this.onScroll(func, delay)
364
301
 
365
- // called when component is destroyed
366
- this.onDestroy() { ... }
302
+ // requestAnimationFrame wrapper with deduplication
303
+ this.nextTick(func, name)
367
304
 
368
- // automatic form submission handling if defined
369
- this.onSubmit(formData) { ... }
305
+ // get unique ID for root node, set one if needed
306
+ this.rootId()
370
307
 
371
- // render template and attach result dom to root. uses Idiomorph for DOM morph
372
- this.render()
308
+ // get/set attributes on root node
309
+ this.attr(name, value)
373
310
 
374
- // you can render to another root too
375
- this.render(this.find('.body'), someHtmlTemplate)
376
- }
311
+ // hide the custom element wrapper and move children to parent
312
+ this.fezHide()
313
+
314
+ // automatic form submission handling if there is FORM as parent or child node
315
+ this.onSubmit(formData) { ... }
316
+
317
+ // render template and attach result dom to root. uses Idiomorph for DOM morph
318
+ this.render()
319
+ this.render(this.find('.body'), someHtmlTemplate) // you can render to another root too
377
320
  })
321
+
322
+ /* Utility methods */
323
+
324
+ // define custom style macro
325
+ // Fez.styleMacro('mobile', '@media (max-width: 768px)')
326
+ // :mobile { ... } -> @media (max-width: 768px) { ... }
327
+ Fez.styleMacro(name, value)
328
+
329
+ // add global scss
330
+ Fez.globalCss(`
331
+ .some-class {
332
+ color: red;
333
+ &.foo { ... }
334
+ .foo { ... }
335
+ }
336
+ ...
337
+ `)
338
+
339
+ // internal, get unique ID for a string, poor mans MD5 / SHA1
340
+ Fez.fnv1('some string')
341
+
342
+ // get dom node containing passed html
343
+ Fez.domRoot(htmlData || htmlNode)
344
+
345
+ // activates node by adding class to node, and removing it from siblings
346
+ Fez.activateNode(node, className = 'active')
347
+
348
+ // get generated css class name, from scss source string
349
+ Fez.css(text)
350
+
351
+ // get generated css class name without global attachment
352
+ Fez.cssClass(text)
353
+
354
+ // display information about fast/slow bind components in console
355
+ Fez.info()
356
+
357
+ // low-level DOM morphing function
358
+ Fez.morphdom(target, newNode, opts)
359
+
360
+ // HTML escaping utility
361
+ Fez.htmlEscape(text)
362
+
363
+ // create HTML tags with encoded props
364
+ Fez.tag(tag, opts, html)
365
+
366
+ // execute function until it returns true
367
+ Fez.untilTrue(func, pingRate)
368
+
369
+ // add scripts/styles to document head
370
+ // Load JavaScript from URL: Fez.head({ js: 'path/to/script.js' })
371
+ // Load JavaScript with attributes: Fez.head({ js: 'path/to/script.js', type: 'module', async: true })
372
+ // Load JavaScript with callback: Fez.head({ js: 'path/to/script.js' }, () => console.log('loaded'))
373
+ // Load JavaScript module and auto-import to window: Fez.head({ js: 'path/to/module.js', module: 'MyModule' })
374
+ // Load CSS: Fez.head({ css: 'path/to/styles.css' })
375
+ // Load CSS with attributes: Fez.head({ css: 'path/to/styles.css', media: 'print' })
376
+ // Execute inline script: Fez.head({ script: 'console.log("Hello world")' })
377
+ Fez.head(config, callback)
378
378
  ```
379
379
 
380
380
  ## Fez script loading and definition
@@ -459,7 +459,7 @@ All parts are optional
459
459
  {{json data}} <!-- JSON dump in PRE.json tag -->
460
460
 
461
461
  <!-- fez-this will link DOM node to object property (inspired by Svelte) -->
462
- <!-- this.listRoot -->
462
+ <!-- linkes to -> this.listRoot -->
463
463
  <ul fez-this="listRoot">
464
464
 
465
465
  <!-- when node is added to dom fez-use will call object function by name, and pass current node -->
@@ -468,7 +468,6 @@ All parts are optional
468
468
 
469
469
  <!-- fez-bind for two-way data binding on form elements -->
470
470
  <input type="text" fez-bind="state.username" />
471
- <input onkeyup="fez.list[{{ index }}].name = fez.value" value="{{ name }}" />
472
471
 
473
472
  <!--
474
473
  fez-class for adding classes with optional delay.
@@ -476,6 +475,9 @@ All parts are optional
476
475
  -->
477
476
  <span fez-class="active:100">Delayed class</span>
478
477
 
478
+ <!-- preserve state by key, not affected by state changes-->>
479
+ <p fez-keep="key">...</p>
480
+
479
481
  <!-- :attribute for evaluated attributes (converts to JSON) -->
480
482
  <div :data-config="state.config"></div>
481
483
  </div>
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 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;
1
+ (()=>{var ve=Object.defineProperty;var Se=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ee=(t,e)=>{for(var r in e)ve(t,r,{get:e[r],enumerable:!0})};var ie={};Ee(ie,{loadDefaults:()=>ne});var ne,oe=Se(()=>{ne=()=>{Fez("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)}}),Fez("fez-include",class{FAST=!0;init(t){Fez.fetch(t.src,e=>{let r=Fez.domRoot(e);Fez.head(r),this.root.innerHTML=r.innerHTML})}}),Fez("fez-inline",class{init(t){let e=this.root.innerHTML;if(this.root.innerHTML.includes("<")){let s=`inline-${Fez.fnv1(this.root.outerHTML)}`;Fez(s,class{FAST=!0;HTML=e;init(){Object.assign(this.state,t.state||{})}});let n=document.createElement(s);this.root.after(this.root.lastChild,n),this.root.remove()}}})};typeof Fez<"u"&&Fez&&ne()});function D(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 Ae(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 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;","&"),Ae(i,r)));n=n.replace(/<!\-\-.*?\-\->/g,"").replace(/>\s+</g,"><"),n="`"+n.trim()+"`";try{let o=`const fez = this;
2
2
  with (this) {
3
3
  return ${n}
4
4
  }
5
- `,o=new Function(i);return u=>{try{return o.bind(u)()}catch(b){b.message=`FEZ template runtime error: ${b.message}
5
+ `,i=new Function(o);return u=>{try{return i.bind(u)()}catch(b){b.message=`FEZ template runtime error: ${b.message}
6
6
 
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}
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 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,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=D;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,o=()=>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),i=()=>{let a=Date.now();if(a-n>=s)if(o())n=a;else return;this._timeouts[e]&&clearTimeout(this._timeouts[e]),this._timeouts[e]=setTimeout(()=>{a>n&&o()&&(n=Date.now()),delete this._timeouts[e]},s)};this._eventHandlers[e]=i,window.addEventListener(e,i)}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(e,...r){let s=o=>{if(Fez._subs&&Fez._subs[e]){let i=Fez._subs[e].find(([a])=>a===o);if(i)return i[1].bind(o)(...r),!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 r=this.fezHtmlRoot.replaceAll('"',"&quot;");return e=e.replace(/([!'"\s;])fez\.(\w)/g,`$1${r}$2`).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(n=>r.appendChild(n)):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)),r.querySelectorAll("[fez-keep]").forEach(n=>{let o=n.getAttribute("fez-keep"),i=this.root.querySelector(`[fez-keep="${o}"]`);i?n.parentNode.replaceChild(i,n):o==="default-slot"&&Array.from(this.root.childNodes).forEach(a=>n.appendChild(a))}),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 s=Fez.domRoot(this.class.htmlTemplate).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(n=>s.appendChild(n)),r=Array.from(s.children).map(e),document.body.removeChild(s)}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.childNodes(),s=this.root.parentNode;return r.reverse().forEach(n=>s.insertBefore(n,e.nextSibling)),this.root.remove(),this.root=s,r}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 Te={data:""},X=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||Te,Fe=t=>{let e=X(t),r=e.data;return e.data="",r},$e=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,we=/\/\*[^]*?\*\/| +/g,K=/\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},T={},Z=t=>{if(typeof t=="object"){let e="";for(let r in t)e+=r+Z(t[r]);return e}return t},Ce=(t,e,r,s,n)=>{let o=Z(t),i=T[o]||(T[o]=(u=>{let b=0,g=11;for(;b<u.length;)g=101*g+u.charCodeAt(b++)>>>0;return"go"+g})(o));if(!T[i]){let u=o!==t?t:(b=>{let g,S,C=[{}];for(;g=$e.exec(b.replace(we,""));)g[4]?C.shift():g[3]?(S=g[3].replace(K," ").trim(),C.unshift(C[0][S]=C[0][S]||{})):C[0][g[1]]=g[2].replace(K," ").trim();return C[0]})(t);T[i]=F(n?{["@keyframes "+i]:u}:u,r?"":"."+i)}let a=r&&T.g?T.g:null;return r&&(T.g=T[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)})(T[i],e,s,a),i},Me=(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 R(t){let e=this||{},r=t.call?t(e.p):t;return Ce(r.unshift?r.raw?Me(r,[].slice.call(arguments,1),e.p):r.reduce((s,n)=>Object.assign(s,n&&n.call?n(e.p):n),{}):r,X(e.target),e.g,e.o,e.k)}var Y,B,k,_e=R.bind({g:1}),Le=R.bind({k:1});function He(t,e,r,s){F.p=e,Y=t,B=r,k=s}function Oe(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:B&&B()},a),r.o=/ *go\d+/.test(u),a.className=R.apply(r,s)+(u?" "+u:""),e&&(a.ref=i);let b=t;return t[0]&&(b=a.as||t,delete a.as),k&&b[0]&&k(a),Y(b,a)}return e?e(n):n}}var Q={css:R,extractCss:Fe,glob:_e,keyframes:Le,setup:He,styled:Oe};var x=function(){"use strict";let t=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 r(l,c,f={}){l instanceof Document&&(l=l.documentElement),typeof c=="string"&&(c=ue(c));let d=de(c),h=ce(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=pe(c,l,f),h=d?.previousSibling,p=d?.nextSibling,y=o(l,d,f);return d?he(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):I(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(W(p,h,f)){o(h,p,f),h=h.nextSibling,M(f,p);continue}let y=fe(l,c,p,h,f);if(y){h=V(h,y,f),o(y,p,f),M(f,p);continue}let z=ae(l,c,p,h,f);if(z){h=V(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,G(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 E=_.has(v.outerHTML),O=f.head.shouldReAppend(v),P=f.head.shouldPreserve(v);E||P?O?h.push(v):(_.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(..._.values());let J=[];for(let v of y){let E=document.createRange().createContextualFragment(v.outerHTML).firstChild;if(f.callbacks.beforeNodeAdded(E)!==!1){if(E.href||E.src){let O=null,P=new Promise(function(ze){O=ze});E.addEventListener("load",function(){O()}),J.push(P)}c.appendChild(E),f.callbacks.afterNodeAdded(E),d.push(E)}}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}),J}function C(){}function A(){}function le(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 ce(l,c,f){return f=le(f),{target:l,newContent:c,config:f,morphStyle:f.morphStyle,ignoreActive:f.ignoreActive,ignoreActiveValue:f.ignoreActiveValue,idMap:ge(l,c),deadIds:new Set,callbacks:f.callbacks,head:f.head}}function W(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 I(l,c){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName}function V(l,c,f){for(;l!==c;){let d=l;l=l.nextSibling,G(d,f)}return M(f,c),c.nextSibling}function fe(l,c,f,d,h){let p=H(h,f,c),y=null;if(p>0){let z=d,_=0;for(;z!=null;){if(W(f,z,h))return z;if(_+=H(h,z,l),_>p)return null;z=z.nextSibling}}return y}function ae(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(I(f,p))return p;if(I(y,p)&&(z++,y=y.nextSibling,z>=2))return null;p=p.nextSibling}return p}function ue(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 de(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 he(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 pe(l,c,f){let d;d=l.firstChild;let h=d,p=0;for(;d;){let y=me(d,c,f);y>p&&(h=d,p=y),d=d.nextSibling}return h}function me(l,c,f){return I(l,c)?.5+H(f,l,c):0}function G(l,c){M(c,l),c.callbacks.beforeNodeRemoved(l)!==!1&&(l.remove(),c.callbacks.afterNodeRemoved(l))}function be(l,c){return!l.deadIds.has(c)}function ye(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)be(l,p)&&ye(l,p,f)&&++h;return h}function U(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 ge(l,c){let f=new Map;return U(l,f),U(c,f),f}return{morph:r,defaults:e}}();function te(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 i=`${t} compiled`;s.FAST&&(i+=" (fast bind)"),r.log(i)}e.html&&(e.html=je(e.html),e.html=e.html.replace(/<slot\s*\/>|<slot\s*>\s*<\/slot>/g,()=>{let s=e.SLOT||"div";return`<${s} class="fez-slot" fez-keep="default-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(){Ie(this,e)?ee(t,this):window.requestAnimationFrame(()=>{this.parentNode&&ee(t,this)})}})}function je(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 Ie(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 ee(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;if(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),i.render(),i.firstRender=!0,i.onMount(i.props),i.onSubmit){let a=i.root.nodeName=="FORM"?i.root:i.find("form");a.onsubmit=u=>{u.preventDefault(),i.onSubmit(i.formData())}}if(i.onPropsChange){Re.observe(o,{attributes:!0});for(let[a,u]of Object.entries(i.props))i.onPropsChange(a,u)}}}var Re=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 Ne=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=Fez.domRoot(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}
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
- }`,o=o.replace(/\}\s*$/,`
17
+ }`,i=i.replace(/\}\s*$/,`
18
18
  CSS = \`${e.style}\`
19
- }`)),/\w/.test(String(e.html))&&(e.html=e.html.replaceAll("`","&#x60;"),e.html=e.html.replaceAll("$","\\$"),o=o.replace(/\}\s*$/,`
19
+ }`)),/\w/.test(String(e.html))&&(e.html=e.html.replaceAll("`","&#x60;"),e.html=e.html.replaceAll("$","\\$"),i=i.replace(/\}\s*$/,`
20
20
  HTML = \`${e.html}\`
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]};
21
+ }`)),i};function q(t){if(t instanceof Node){let e=t;e.remove();let r=e.getAttribute("fez");if(r&&(r.includes(".")||r.includes("/"))){Pe(r);return}else return r&&!r.includes("-")&&console.error(`Fez: Invalid custom element name "${r}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),N(r,e.innerHTML)}else{(t?Fez.domRoot(t):document.body).querySelectorAll("template[fez], xmp[fez]").forEach(r=>{q(r)});return}}function Pe(t){Fez.log(`Loading from ${t}`),Fez.fetch(t).then(e=>{let n=new DOMParser().parseFromString(e,"text/html").querySelectorAll("template[fez], xmp[fez]");if(n.length>0)n.forEach(o=>{let i=o.getAttribute("fez");i&&!i.includes("-")&&!i.includes(".")&&!i.includes("/")&&console.error(`Fez: Invalid custom element name "${i}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let a=o.innerHTML;N(i,a)});else{let o=t.split("/").pop().split(".")[0];N(o,e)}}).catch(e=>{console.error(`FEZ template load error for "${t}": ${e.message}`)})}function N(t,e){if(arguments.length===1)return q(t);if(e&&e.includes("</xmp>"))return q(e);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=Ne(e),s=r.split(/class\s+\{/,2);if(r=`${s[0]};
22
22
 
23
23
  window.Fez('${t}', class {
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 _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(`
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));let o=[...Object.keys(Fez.classes),t].sort().join(", ");n.textContent=`${o} { 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 re=N;var De={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))}}}},se=De;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):te(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=>Q.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("&","&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;})();
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)}),x.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,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&&(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 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.domRoot=(t,e="div")=>{if(t instanceof Node)return t;{let r=document.createElement(e);return r.innerHTML=t,r}};m.activateNode=(t,e="active")=>{Array.from(t.parentElement.children).forEach(r=>{r.classList.remove(e)}),t.classList.add(e)};m.compile=re;m.state=se;var w=m;typeof window<"u"&&(window.FezBase=L);typeof window<"u"&&(window.Fez=w);Promise.resolve().then(()=>oe());setInterval(()=>{for(let[t,e]of w.instances)e?.isConnected||(e.fez?.fezRemoveSelf(),w.instances.delete(t))},5e3);var Be=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]")&&(w.compile(s),s.remove()),s.querySelectorAll&&s.querySelectorAll("template[fez], xmp[fez], script[fez]").forEach(o=>{w.compile(o),o.remove()}))}),r.forEach(s=>{s.nodeType===1&&s.querySelectorAll&&s.querySelectorAll(".fez, :scope.fez").forEach(o=>{o.fez&&o.root&&(w.instances.delete(o.fez.UID),o.fez.fezRemoveSelf())})})});Be.observe(document.documentElement,{childList:!0,subtree:!0});var pt=w;})();
28
28
  //# sourceMappingURL=fez.js.map