jaxs 0.7.0 → 0.7.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/dist/jaxs.js CHANGED
@@ -1,634 +1,805 @@
1
- const Z = (e, t) => t.createElement(e), tt = (e, t) => {
2
- for (const s in t) {
3
- if (s === "__self") continue;
4
- const r = t[s].toString();
5
- if (s === "value") {
6
- const n = e;
7
- n.value !== r && (n.value = r);
8
- } else
9
- e.setAttribute(s, r);
10
- }
11
- }, et = (e, t, s) => {
12
- const r = {};
13
- for (const n in t) {
14
- const o = t[n], a = (l) => s(o, l);
15
- e.addEventListener(n, a), r[n] = {
16
- domEvent: n,
17
- busEvent: o,
18
- listener: a
19
- };
20
- }
21
- e.eventMaps = r;
22
- }, st = (e, t, s, r) => {
23
- const n = Z(e, r.document);
24
- return tt(n, t), et(n, s, r.publish), n;
25
- }, y = "http://www.w3.org/2000/svg", rt = {
26
- animate: !0,
27
- animateMotion: !0,
28
- animateTransform: !0,
29
- circle: !0,
30
- clipPath: !0,
31
- defs: !0,
32
- desc: !0,
33
- ellipse: !0,
34
- feBlend: !0,
35
- feColorMatrix: !0,
36
- feComponentTransfer: !0,
37
- feComposite: !0,
38
- feConvolveMatrix: !0,
39
- feDiffuseLighting: !0,
40
- feDisplacementMap: !0,
41
- feDistantLight: !0,
42
- feDropShadow: !0,
43
- feFlood: !0,
44
- feFuncA: !0,
45
- feFuncB: !0,
46
- feFuncG: !0,
47
- feFuncR: !0,
48
- feGaussianBlur: !0,
49
- feImage: !0,
50
- feMerge: !0,
51
- feMergeNode: !0,
52
- feMorphology: !0,
53
- feOffset: !0,
54
- fePointLight: !0,
55
- feSpecularLighting: !0,
56
- feSpotLight: !0,
57
- feTile: !0,
58
- feTurbulence: !0,
59
- filter: !0,
60
- foreignObject: !0,
61
- g: !0,
62
- image: !0,
63
- line: !0,
64
- linearGradient: !0,
65
- marker: !0,
66
- mask: !0,
67
- metadata: !0,
68
- mpath: !0,
69
- path: !0,
70
- pattern: !0,
71
- polygon: !0,
72
- polyline: !0,
73
- radialGradient: !0,
74
- rect: !0,
75
- script: !0,
76
- set: !0,
77
- stop: !0,
78
- style: !0,
79
- svg: !0,
80
- switch: !0,
81
- symbol: !0,
82
- text: !0,
83
- textPath: !0,
84
- title: !0,
85
- tspan: !0,
86
- use: !0,
87
- view: !0
88
- }, nt = (e, t) => !!(rt[e] || e === "a" && t === y), ot = (e, t, s) => {
89
- const r = s.createElementNS(y, e);
90
- for (const n in t)
91
- n === "__self" || n === "xmlns" || r.setAttributeNS(null, n, t[n].toString());
92
- return r;
93
- }, it = (e) => e.namespaceURI === y, ut = (e, t) => t.createTextNode(e);
1
+ const Z = (e, t) => t.createElement(e),
2
+ tt = (e, t) => {
3
+ for (const s in t) {
4
+ if (s === '__self') continue
5
+ const r = t[s].toString()
6
+ if (s === 'value') {
7
+ const n = e
8
+ n.value !== r && (n.value = r)
9
+ } else e.setAttribute(s, r)
10
+ }
11
+ },
12
+ et = (e, t, s) => {
13
+ const r = {}
14
+ for (const n in t) {
15
+ const i = t[n],
16
+ a = (l) => s(i, l)
17
+ e.addEventListener(n, a),
18
+ (r[n] = {
19
+ domEvent: n,
20
+ busEvent: i,
21
+ listener: a,
22
+ })
23
+ }
24
+ e.eventMaps = r
25
+ },
26
+ st = (e, t, s, r) => {
27
+ const n = Z(e, r.document)
28
+ return tt(n, t), et(n, s, r.publish), n
29
+ },
30
+ y = 'http://www.w3.org/2000/svg',
31
+ rt = {
32
+ animate: !0,
33
+ animateMotion: !0,
34
+ animateTransform: !0,
35
+ circle: !0,
36
+ clipPath: !0,
37
+ defs: !0,
38
+ desc: !0,
39
+ ellipse: !0,
40
+ feBlend: !0,
41
+ feColorMatrix: !0,
42
+ feComponentTransfer: !0,
43
+ feComposite: !0,
44
+ feConvolveMatrix: !0,
45
+ feDiffuseLighting: !0,
46
+ feDisplacementMap: !0,
47
+ feDistantLight: !0,
48
+ feDropShadow: !0,
49
+ feFlood: !0,
50
+ feFuncA: !0,
51
+ feFuncB: !0,
52
+ feFuncG: !0,
53
+ feFuncR: !0,
54
+ feGaussianBlur: !0,
55
+ feImage: !0,
56
+ feMerge: !0,
57
+ feMergeNode: !0,
58
+ feMorphology: !0,
59
+ feOffset: !0,
60
+ fePointLight: !0,
61
+ feSpecularLighting: !0,
62
+ feSpotLight: !0,
63
+ feTile: !0,
64
+ feTurbulence: !0,
65
+ filter: !0,
66
+ foreignObject: !0,
67
+ g: !0,
68
+ image: !0,
69
+ line: !0,
70
+ linearGradient: !0,
71
+ marker: !0,
72
+ mask: !0,
73
+ metadata: !0,
74
+ mpath: !0,
75
+ path: !0,
76
+ pattern: !0,
77
+ polygon: !0,
78
+ polyline: !0,
79
+ radialGradient: !0,
80
+ rect: !0,
81
+ script: !0,
82
+ set: !0,
83
+ stop: !0,
84
+ style: !0,
85
+ svg: !0,
86
+ switch: !0,
87
+ symbol: !0,
88
+ text: !0,
89
+ textPath: !0,
90
+ title: !0,
91
+ tspan: !0,
92
+ use: !0,
93
+ view: !0,
94
+ },
95
+ nt = (e, t) => !!(rt[e] || (e === 'a' && t === y)),
96
+ it = (e, t, s) => {
97
+ const r = s.createElementNS(y, e)
98
+ for (const n in t)
99
+ n === '__self' ||
100
+ n === 'xmlns' ||
101
+ r.setAttributeNS(null, n, t[n].toString())
102
+ return r
103
+ },
104
+ ot = (e) => e.namespaceURI === y,
105
+ ut = (e, t) => t.createTextNode(e)
94
106
  class at {
95
107
  constructor(t) {
96
- this.value = t.toString();
108
+ this.value = t.toString()
97
109
  }
98
110
  render(t) {
99
- const s = ut(this.value, t.document);
100
- return s.__jsx = "TextNode", [s];
111
+ const s = ut(this.value, t.document)
112
+ return (s.__jsx = 'TextNode'), [s]
101
113
  }
102
114
  }
103
- const ct = (e) => typeof e == "string" || typeof e == "number", lt = (e) => new at(e), ht = (e) => ct(e) ? lt(e) : e, dt = (e) => pt(e).map(ht).flat(), pt = (e) => Array.isArray(e) ? e.flat() : e ? [e] : [], T = (e, t = {}) => e || t.children || [], mt = (e, t = "") => {
104
- const s = {}, r = {};
105
- for (const n in e) {
106
- const o = e[n];
107
- if (n.match(/^on.+/i)) {
108
- const a = n.slice(2).toLowerCase();
109
- r[a] = o ? o.toString() : "";
110
- } else {
111
- if (o === !1) continue;
112
- n === "__source" ? s.__source = e.__source : s[n] = ft(n, o, t);
115
+ const ct = (e) => typeof e == 'string' || typeof e == 'number',
116
+ lt = (e) => new at(e),
117
+ ht = (e) => (ct(e) ? lt(e) : e),
118
+ dt = (e) => pt(e).map(ht).flat(),
119
+ pt = (e) => (Array.isArray(e) ? e.flat() : e ? [e] : []),
120
+ T = (e, t = {}) => e || t.children || [],
121
+ mt = (e, t = '') => {
122
+ const s = {},
123
+ r = {}
124
+ for (const n in e) {
125
+ const i = e[n]
126
+ if (n.match(/^on.+/i)) {
127
+ const a = n.slice(2).toLowerCase()
128
+ r[a] = i ? i.toString() : ''
129
+ } else {
130
+ if (i === !1) continue
131
+ n === '__source' ? (s.__source = e.__source) : (s[n] = ft(n, i, t))
132
+ }
113
133
  }
114
- }
115
- return {
116
- attributes: s,
117
- events: r
118
- };
119
- }, ft = (e, t, s = "") => t == null ? s : t.toString(), bt = (e, t) => {
120
- const s = e || {}, r = T(t, s);
121
- return s.children = s.children || r, s;
122
- }, j = (e, t, s, r = []) => e.reduce(vt(t, s), r).flat(), vt = (e, t) => (s, r) => r ? Array.isArray(r) ? j(
123
- r,
124
- e,
125
- t,
126
- s
127
- ) : (r.render(e, t).forEach((n) => s.push(n)), s) : s;
134
+ return {
135
+ attributes: s,
136
+ events: r,
137
+ }
138
+ },
139
+ ft = (e, t, s = '') => (t == null ? s : t.toString()),
140
+ bt = (e, t) => {
141
+ const s = e || {},
142
+ r = T(t, s)
143
+ return (s.children = s.children || r), s
144
+ },
145
+ j = (e, t, s, r = []) => e.reduce(vt(t, s), r).flat(),
146
+ vt = (e, t) => (s, r) =>
147
+ r
148
+ ? Array.isArray(r)
149
+ ? j(r, e, t, s)
150
+ : (r.render(e, t).forEach((n) => s.push(n)), s)
151
+ : s
128
152
  class O {
129
153
  constructor(t) {
130
- this.collection = dt(t);
154
+ this.collection = dt(t)
131
155
  }
132
156
  render(t, s) {
133
- this.parentElement = s;
134
- const r = this.generateDom(t);
135
- return this.attachToParent(r), r;
157
+ this.parentElement = s
158
+ const r = this.generateDom(t)
159
+ return this.attachToParent(r), r
136
160
  }
137
161
  generateDom(t) {
138
- return j(this.collection, t, this.parentElement);
162
+ return j(this.collection, t, this.parentElement)
139
163
  }
140
164
  attachToParent(t) {
141
- if (this.parentElement === void 0) return;
142
- const s = this.parentElement;
143
- t.forEach((r) => s.appendChild(r));
165
+ if (this.parentElement === void 0) return
166
+ const s = this.parentElement
167
+ t.forEach((r) => s.appendChild(r))
144
168
  }
145
169
  }
146
170
  class gt {
147
171
  constructor(t, s) {
148
- this.type = t, this.attributes = s;
172
+ ;(this.type = t), (this.attributes = s)
149
173
  }
150
174
  generate() {
151
- return this.attributes.key || this.sourceKey() || this.createKeyFromAttributes();
175
+ return (
176
+ this.attributes.key || this.sourceKey() || this.createKeyFromAttributes()
177
+ )
152
178
  }
153
179
  sourceKey() {
154
180
  if (this.attributes.__source) {
155
- const { fileName: t, lineNumber: s, columnNumber: r } = this.attributes.__source;
156
- return `${t}:${s}:${r}`;
181
+ const {
182
+ fileName: t,
183
+ lineNumber: s,
184
+ columnNumber: r,
185
+ } = this.attributes.__source
186
+ return `${t}:${s}:${r}`
157
187
  }
158
188
  }
159
189
  createKeyFromAttributes() {
160
- const t = this.attributes.id ? `#${this.attributes.id}` : "", s = this.attributes.type ? `[type=${this.attributes.type}]` : "", r = this.attributes.name ? `[name=${this.attributes.name}]` : "";
161
- return `${this.type}${t}${s}${r}`;
190
+ const t = this.attributes.id ? `#${this.attributes.id}` : '',
191
+ s = this.attributes.type ? `[type=${this.attributes.type}]` : '',
192
+ r = this.attributes.name ? `[name=${this.attributes.name}]` : ''
193
+ return `${this.type}${t}${s}${r}`
162
194
  }
163
195
  }
164
196
  class yt {
165
197
  constructor(t, s, r = []) {
166
- this.type = t;
167
- const { events: n, attributes: o } = mt(s);
168
- this.events = n, this.attributes = o, this.isSvg = nt(this.type, this.attributes.xmlns), this.children = new O(r);
198
+ this.type = t
199
+ const { events: n, attributes: i } = mt(s)
200
+ ;(this.events = n),
201
+ (this.attributes = i),
202
+ (this.isSvg = nt(this.type, this.attributes.xmlns)),
203
+ (this.children = new O(r))
169
204
  }
170
205
  render(t) {
171
- const s = this.generateDom(t);
172
- return s ? (this.children.render(t, s), [s]) : [];
206
+ const s = this.generateDom(t)
207
+ return s ? (this.children.render(t, s), [s]) : []
173
208
  }
174
209
  generateDom(t) {
175
- return this.isSvg ? this.generateSvgDom(t) : this.generateHtmlDom(t);
210
+ return this.isSvg ? this.generateSvgDom(t) : this.generateHtmlDom(t)
176
211
  }
177
212
  generateHtmlDom(t) {
178
- const s = st(
179
- this.type,
180
- this.attributes,
181
- this.events,
182
- t
183
- );
184
- return s.__jsx = this.jsxKey(), s;
213
+ const s = st(this.type, this.attributes, this.events, t)
214
+ return (s.__jsx = this.jsxKey()), s
185
215
  }
186
216
  generateSvgDom(t) {
187
- const s = ot(this.type, this.attributes, t.document);
188
- return s.__jsx = this.jsxKey(), s;
217
+ const s = it(this.type, this.attributes, t.document)
218
+ return (s.__jsx = this.jsxKey()), s
189
219
  }
190
220
  jsxKey() {
191
- return new gt(this.type, this.attributes).generate();
221
+ return new gt(this.type, this.attributes).generate()
192
222
  }
193
223
  }
194
- const Et = (e, t, ...s) => typeof e == "string" ? new yt(e, t, s) : e(bt(t, s));
224
+ const Et = (e, t, ...s) =>
225
+ typeof e == 'string' ? new yt(e, t, s) : e(bt(t, s))
195
226
  Et.fragment = (e, t) => {
196
- const s = T(t, e);
197
- return new O(s);
198
- };
227
+ const s = T(t, e)
228
+ return new O(s)
229
+ }
199
230
  class xt {
200
231
  constructor(t, s, r) {
201
- this.template = t, this.selector = s, this.renderKit = r, this.dom = [];
232
+ ;(this.template = t),
233
+ (this.selector = s),
234
+ (this.renderKit = r),
235
+ (this.dom = [])
202
236
  }
203
237
  renderAndAttach(t) {
204
- this.parentElement = this.getParentElement(), this.dom = this.render({ ...t, parent: this.parentElement }), this.parentElement && this.attach();
238
+ ;(this.parentElement = this.getParentElement()),
239
+ (this.dom = this.render({ ...t, parent: this.parentElement })),
240
+ this.parentElement && this.attach()
205
241
  }
206
242
  render(t) {
207
- return this.template.render(t);
243
+ return this.template.render(t)
208
244
  }
209
245
  attach() {
210
- this.parentElement && (this.parentElement.innerHTML = ""), this.dom.forEach((t) => {
211
- this.parentElement && this.parentElement.appendChild(t);
212
- });
246
+ this.parentElement && (this.parentElement.innerHTML = ''),
247
+ this.dom.forEach((t) => {
248
+ this.parentElement && this.parentElement.appendChild(t)
249
+ })
213
250
  }
214
251
  getParentElement() {
215
- return this.renderKit.document.querySelector(this.selector);
252
+ return this.renderKit.document.querySelector(this.selector)
216
253
  }
217
254
  }
218
255
  const At = (e, t, s) => {
219
- const r = new xt(e, t, s);
220
- return r.renderAndAttach(s), r;
221
- }, M = "go-to-href", k = "go-to", m = "navigation:location-change", $ = "navigation:route-change", wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
222
- __proto__: null,
223
- linkNavigationEvent: M,
224
- locationChangeEvent: m,
225
- navigationEvent: k,
226
- routeChangeEvent: $
227
- }, Symbol.toStringTag, { value: "Module" })), D = (e) => {
228
- e.create("route", {
229
- host: "",
230
- path: "",
231
- query: {}
232
- });
233
- }, P = (e) => {
234
- const t = e.closest("[href]");
235
- return t && t.getAttribute("href") || "";
236
- }, E = (e, { publish: t, window: s }) => {
237
- s.history.pushState(null, "", e), t(m, null);
238
- }, F = (e, t) => {
239
- if (!e || !e.target) return;
240
- e.preventDefault();
241
- const s = P(e.target);
242
- E(s, t);
243
- }, L = (e) => e.replace(/^\?/, "").split("&").reduce((t, s) => {
244
- if (!s) return t;
245
- const r = s.split("=");
246
- return t[r[0]] = r[1], t;
247
- }, {}), z = (e, t) => {
248
- const { state: s, publish: r, window: n } = t, { host: o, pathname: a, search: l } = n.location, u = a, d = L(l), c = {
249
- host: o,
250
- path: u,
251
- query: d
252
- };
253
- s.store("route").update(c), r($, c);
254
- }, B = (e) => {
255
- const { subscribe: t } = e;
256
- t(M, F), t(k, (s, r) => {
257
- E(s, r);
258
- });
259
- }, V = (e) => {
260
- const { publish: t, subscribe: s, state: r, window: n } = e;
261
- D(r), n.addEventListener("popstate", () => t(m, null)), s(m, z);
262
- }, K = (e) => {
263
- setTimeout(() => e.publish(m, null), 0);
264
- }, R = (e) => {
265
- V(e), B(e), K(e);
266
- }, Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
267
- __proto__: null,
268
- publishLocation: K,
269
- startNavigation: R,
270
- subscribeToHistoryChange: V,
271
- subscribeToNavigation: B
272
- }, Symbol.toStringTag, { value: "Module" }));
256
+ const r = new xt(e, t, s)
257
+ return r.renderAndAttach(s), r
258
+ },
259
+ M = 'go-to-href',
260
+ k = 'go-to',
261
+ m = 'navigation:location-change',
262
+ $ = 'navigation:route-change',
263
+ wt = /* @__PURE__ */ Object.freeze(
264
+ /* @__PURE__ */ Object.defineProperty(
265
+ {
266
+ __proto__: null,
267
+ linkNavigationEvent: M,
268
+ locationChangeEvent: m,
269
+ navigationEvent: k,
270
+ routeChangeEvent: $,
271
+ },
272
+ Symbol.toStringTag,
273
+ { value: 'Module' },
274
+ ),
275
+ ),
276
+ D = (e) => {
277
+ e.create('route', {
278
+ host: '',
279
+ path: '',
280
+ query: {},
281
+ })
282
+ },
283
+ P = (e) => {
284
+ const t = e.closest('[href]')
285
+ return (t && t.getAttribute('href')) || ''
286
+ },
287
+ E = (e, { publish: t, window: s }) => {
288
+ s.history.pushState(null, '', e), t(m, null)
289
+ },
290
+ V = (e, t) => {
291
+ if (!e || !e.target) return
292
+ e.preventDefault()
293
+ const s = P(e.target)
294
+ E(s, t)
295
+ },
296
+ F = (e) =>
297
+ e
298
+ .replace(/^\?/, '')
299
+ .split('&')
300
+ .reduce((t, s) => {
301
+ if (!s) return t
302
+ const r = s.split('=')
303
+ return (t[r[0]] = r[1]), t
304
+ }, {}),
305
+ L = (e, t) => {
306
+ const { state: s, publish: r, window: n } = t,
307
+ { host: i, pathname: a, search: l } = n.location,
308
+ u = a,
309
+ d = F(l),
310
+ c = {
311
+ host: i,
312
+ path: u,
313
+ query: d,
314
+ }
315
+ s.store('route').update(c), r($, c)
316
+ },
317
+ z = (e) => {
318
+ const { subscribe: t } = e
319
+ t(M, V),
320
+ t(k, (s, r) => {
321
+ E(s, r)
322
+ })
323
+ },
324
+ B = (e) => {
325
+ const { publish: t, subscribe: s, state: r, window: n } = e
326
+ D(r), n.addEventListener('popstate', () => t(m, null)), s(m, L)
327
+ },
328
+ K = (e) => {
329
+ setTimeout(() => e.publish(m, null), 0)
330
+ },
331
+ R = (e) => {
332
+ B(e), z(e), K(e)
333
+ },
334
+ Nt = /* @__PURE__ */ Object.freeze(
335
+ /* @__PURE__ */ Object.defineProperty(
336
+ {
337
+ __proto__: null,
338
+ publishLocation: K,
339
+ startNavigation: R,
340
+ subscribeToHistoryChange: B,
341
+ subscribeToNavigation: z,
342
+ },
343
+ Symbol.toStringTag,
344
+ { value: 'Module' },
345
+ ),
346
+ )
273
347
  class U {
274
- constructor({ window: t, document: s, publish: r, subscribe: n, bus: o, state: a, renderKit: l }) {
275
- this.window = t, this.document = s, this.publish = r, this.subscribe = n, this.bus = o, this.state = a, this.renderKit = l, this.roots = [];
348
+ constructor({
349
+ window: t,
350
+ document: s,
351
+ publish: r,
352
+ subscribe: n,
353
+ bus: i,
354
+ state: a,
355
+ renderKit: l,
356
+ }) {
357
+ ;(this.window = t),
358
+ (this.document = s),
359
+ (this.publish = r),
360
+ (this.subscribe = n),
361
+ (this.bus = i),
362
+ (this.state = a),
363
+ (this.renderKit = l),
364
+ (this.roots = [])
276
365
  }
277
366
  render(t, s) {
278
- const r = At(t, s, this.renderKit);
279
- return this.roots.push(r), r;
367
+ const r = At(t, s, this.renderKit)
368
+ return this.roots.push(r), r
280
369
  }
281
370
  startNavigation() {
282
- R(this);
371
+ R(this)
283
372
  }
284
373
  }
285
- const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
286
- __proto__: null,
287
- App: U
288
- }, Symbol.toStringTag, { value: "Module" }));
374
+ const $e = /* @__PURE__ */ Object.freeze(
375
+ /* @__PURE__ */ Object.defineProperty(
376
+ {
377
+ __proto__: null,
378
+ App: U,
379
+ },
380
+ Symbol.toStringTag,
381
+ { value: 'Module' },
382
+ ),
383
+ )
289
384
  class C {
290
385
  constructor() {
291
- this.lookup = {};
386
+ this.lookup = {}
292
387
  }
293
388
  add(t, s, r) {
294
- this.ensureArrayFor(t);
389
+ this.ensureArrayFor(t)
295
390
  const n = {
296
391
  listener: s,
297
392
  index: r,
298
- matcher: t
299
- };
300
- return this.lookup[t].push(n), () => this.remove(n);
393
+ matcher: t,
394
+ }
395
+ return this.lookup[t].push(n), () => this.remove(n)
301
396
  }
302
397
  remove(t) {
303
- this.lookup[t.matcher] && (this.lookup[t.matcher] = this.lookup[t.matcher].reduce((s, r) => (r !== t && s.push(r), s), []));
398
+ this.lookup[t.matcher] &&
399
+ (this.lookup[t.matcher] = this.lookup[t.matcher].reduce(
400
+ (s, r) => (r !== t && s.push(r), s),
401
+ [],
402
+ ))
304
403
  }
305
404
  matches(t) {
306
- return this.lookup[t] || [];
405
+ return this.lookup[t] || []
307
406
  }
308
407
  ensureArrayFor(t) {
309
- this.lookup[t] || (this.lookup[t] = []);
408
+ this.lookup[t] || (this.lookup[t] = [])
310
409
  }
311
410
  }
312
411
  class I {
313
412
  constructor() {
314
- this.lookup = [];
413
+ this.lookup = []
315
414
  }
316
415
  add(t, s, r) {
317
416
  const n = {
318
417
  listener: s,
319
418
  index: r,
320
- matcher: t
321
- };
322
- return this.lookup.push(n), () => this.remove(n);
419
+ matcher: t,
420
+ }
421
+ return this.lookup.push(n), () => this.remove(n)
323
422
  }
324
423
  remove(t) {
325
- this.lookup = this.lookup.reduce((s, r) => (r !== t && s.push(r), s), []);
424
+ this.lookup = this.lookup.reduce((s, r) => (r !== t && s.push(r), s), [])
326
425
  }
327
426
  matches(t) {
328
- return this.lookup.filter(
329
- (s) => s.matcher.test(t)
330
- );
427
+ return this.lookup.filter((s) => s.matcher.test(t))
331
428
  }
332
429
  }
333
430
  class _t {
334
- constructor({
335
- publish: t,
336
- event: s,
337
- payload: r,
338
- timer: n
339
- }) {
340
- this.setNewTimeout = () => {
341
- this.stopped || setTimeout(() => {
342
- this.publishEvent(), this.setNewTimeout();
343
- }, this.calculateNextTime());
344
- }, this.calculateNextTime = () => this.timer({
345
- timeDiff: this.diff(),
346
- callCount: this.callCount,
347
- stop: this.stop
348
- }), this.publish = t, this.event = s, this.payload = r || null, this.stop = this.stopTimeout.bind(this), this.stopped = !1, this.timer = n, this.startedAt = (/* @__PURE__ */ new Date()).getTime(), this.callCount = 0;
431
+ constructor({ publish: t, event: s, payload: r, timer: n }) {
432
+ ;(this.setNewTimeout = () => {
433
+ this.stopped ||
434
+ setTimeout(() => {
435
+ this.publishEvent(), this.setNewTimeout()
436
+ }, this.calculateNextTime())
437
+ }),
438
+ (this.calculateNextTime = () =>
439
+ this.timer({
440
+ timeDiff: this.diff(),
441
+ callCount: this.callCount,
442
+ stop: this.stop,
443
+ })),
444
+ (this.publish = t),
445
+ (this.event = s),
446
+ (this.payload = r || null),
447
+ (this.stop = this.stopTimeout.bind(this)),
448
+ (this.stopped = !1),
449
+ (this.timer = n),
450
+ (this.startedAt = /* @__PURE__ */ new Date().getTime()),
451
+ (this.callCount = 0)
349
452
  }
350
453
  start() {
351
- this.setNewTimeout();
454
+ this.setNewTimeout()
352
455
  }
353
456
  diff() {
354
- return (/* @__PURE__ */ new Date()).getTime() - this.startedAt;
457
+ return /* @__PURE__ */ new Date().getTime() - this.startedAt
355
458
  }
356
459
  stopTimeout() {
357
- this.stopped = !0, this.timeoutId && clearTimeout(this.timeoutId);
460
+ ;(this.stopped = !0), this.timeoutId && clearTimeout(this.timeoutId)
358
461
  }
359
462
  publishEvent() {
360
- this.stopped || (this.callCount += 1, this.publish(this.event, this.payload));
463
+ this.stopped ||
464
+ ((this.callCount += 1), this.publish(this.event, this.payload))
361
465
  }
362
466
  }
363
467
  const St = (e) => {
364
- const { offset: t, period: s } = e, r = ({ callCount: n }) => t && n == 0 ? t : s;
365
- return {
366
- event: e.event,
367
- publish: e.publish,
368
- payload: e.payload,
369
- timer: r
370
- };
371
- }, Tt = (e) => {
372
- let t;
373
- "timer" in e ? t = e : t = St(
374
- e
375
- );
376
- const s = new _t(t);
377
- return s.start(), s.stop;
378
- };
468
+ const { offset: t, period: s } = e,
469
+ r = ({ callCount: n }) => (t && n == 0 ? t : s)
470
+ return {
471
+ event: e.event,
472
+ publish: e.publish,
473
+ payload: e.payload,
474
+ timer: r,
475
+ }
476
+ },
477
+ Tt = (e) => {
478
+ let t
479
+ 'timer' in e ? (t = e) : (t = St(e))
480
+ const s = new _t(t)
481
+ return s.start(), s.stop
482
+ }
379
483
  class q {
380
484
  constructor() {
381
- this.exactSubscriptions = new C(), this.fuzzySubscriptions = new I(), this.currentIndex = 0;
485
+ ;(this.exactSubscriptions = new C()),
486
+ (this.fuzzySubscriptions = new I()),
487
+ (this.currentIndex = 0)
382
488
  }
383
489
  subscribe(t, s) {
384
- let r;
385
- return typeof t == "string" ? r = this.exactSubscriptions.add(
386
- t,
387
- s,
388
- this.currentIndex
389
- ) : r = this.fuzzySubscriptions.add(
390
- t,
391
- s,
392
- this.currentIndex
393
- ), this.currentIndex += 1, r;
490
+ let r
491
+ return (
492
+ typeof t == 'string'
493
+ ? (r = this.exactSubscriptions.add(t, s, this.currentIndex))
494
+ : (r = this.fuzzySubscriptions.add(t, s, this.currentIndex)),
495
+ (this.currentIndex += 1),
496
+ r
497
+ )
394
498
  }
395
499
  publish(t, s) {
396
- [
500
+ ;[
397
501
  ...this.exactSubscriptions.matches(t),
398
- ...this.fuzzySubscriptions.matches(t)
399
- ].sort((n, o) => n.index - o.index).forEach((n) => {
400
- n.listener(s, this.listenerOptions(t));
401
- });
502
+ ...this.fuzzySubscriptions.matches(t),
503
+ ]
504
+ .sort((n, i) => n.index - i.index)
505
+ .forEach((n) => {
506
+ n.listener(s, this.listenerOptions(t))
507
+ })
402
508
  }
403
509
  addListenerOptions(t) {
404
- this.options = t;
510
+ this.options = t
405
511
  }
406
512
  listenerOptions(t) {
407
513
  return {
408
514
  eventName: t,
409
515
  ...this.options,
410
- publish: this.publish.bind(this)
411
- };
516
+ publish: this.publish.bind(this),
517
+ }
412
518
  }
413
519
  }
414
520
  const J = () => {
415
- const e = new q();
416
- return {
417
- bus: e,
418
- publish: (r, n) => e.publish(r, n),
419
- subscribe: (r, n) => e.subscribe(r, n)
420
- };
421
- }, De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
422
- __proto__: null,
423
- ExactSubscriptions: C,
424
- FuzzySubscriptions: I,
425
- JaxsBus: q,
426
- createBus: J,
427
- publishPeriodically: Tt
428
- }, Symbol.toStringTag, { value: "Module" })), f = (e) => Array.isArray(e), v = (e) => e !== null && !f(e) && typeof e == "object", jt = (e, t) => e === t, Ot = (e, t) => Object.keys(e).length === Object.keys(t).length, Mt = (e, t) => !(v(e) && v(t)) || !Ot(e, t) ? !1 : Object.keys(e).every((s) => {
429
- const r = e[s], n = t[s];
430
- return x(r, n);
431
- }), kt = (e, t) => !(f(e) && f(t)) || e.length !== t.length ? !1 : e.every((s, r) => {
432
- const n = t[r];
433
- return x(s, n);
434
- }), x = (e, t) => v(e) ? Mt(e, t) : f(e) ? kt(e, t) : jt(e, t);
521
+ const e = new q()
522
+ return {
523
+ bus: e,
524
+ publish: (r, n) => e.publish(r, n),
525
+ subscribe: (r, n) => e.subscribe(r, n),
526
+ }
527
+ },
528
+ De = /* @__PURE__ */ Object.freeze(
529
+ /* @__PURE__ */ Object.defineProperty(
530
+ {
531
+ __proto__: null,
532
+ ExactSubscriptions: C,
533
+ FuzzySubscriptions: I,
534
+ JaxsBus: q,
535
+ createBus: J,
536
+ publishPeriodically: Tt,
537
+ },
538
+ Symbol.toStringTag,
539
+ { value: 'Module' },
540
+ ),
541
+ ),
542
+ f = (e) => Array.isArray(e),
543
+ v = (e) => e !== null && !f(e) && typeof e == 'object',
544
+ jt = (e, t) => e === t,
545
+ Ot = (e, t) => Object.keys(e).length === Object.keys(t).length,
546
+ Mt = (e, t) =>
547
+ !(v(e) && v(t)) || !Ot(e, t)
548
+ ? !1
549
+ : Object.keys(e).every((s) => {
550
+ const r = e[s],
551
+ n = t[s]
552
+ return x(r, n)
553
+ }),
554
+ kt = (e, t) =>
555
+ !(f(e) && f(t)) || e.length !== t.length
556
+ ? !1
557
+ : e.every((s, r) => {
558
+ const n = t[r]
559
+ return x(s, n)
560
+ }),
561
+ x = (e, t) => (v(e) ? Mt(e, t) : f(e) ? kt(e, t) : jt(e, t))
435
562
  class g {
436
563
  constructor(t) {
437
- this.name = t.name, this.parent = t.parent, this._value = t.value, this.initialValue = structuredClone(t.value);
564
+ ;(this.name = t.name),
565
+ (this.parent = t.parent),
566
+ (this._value = structuredClone(t.value)),
567
+ (this.initialValue = structuredClone(t.value))
438
568
  }
439
569
  get value() {
440
- return this._value;
570
+ return this._value
441
571
  }
442
572
  set value(t) {
443
- throw new Error("Cannot set value directly. Use an updater!");
573
+ throw new Error('Cannot set value directly. Use an updater!')
444
574
  }
445
575
  reset() {
446
- this._value = this.initialValue;
576
+ this._value = structuredClone(this.initialValue)
447
577
  }
448
578
  update(t) {
449
- if (typeof t == "function") {
450
- const s = this.getUpdatedValue(t);
451
- this.updateValue(s);
452
- } else
453
- this.updateValue(t);
579
+ if (typeof t == 'function') {
580
+ const s = this.getUpdatedValue(t)
581
+ this.updateValue(s)
582
+ } else this.updateValue(t)
454
583
  }
455
584
  updateValue(t) {
456
- x(this._value, t) || (this._value = t, this.parent.notify(this.name));
585
+ x(this._value, t) || ((this._value = t), this.parent.notify(this.name))
457
586
  }
458
587
  getUpdatedValue(t) {
459
- return t(this.value);
588
+ return t(structuredClone(this.value))
460
589
  }
461
590
  }
462
591
  class A {
463
592
  constructor(t) {
464
- this.store = t;
593
+ this.store = t
465
594
  }
466
595
  update(t) {
467
- this.store.update(t);
596
+ this.store.update(t)
468
597
  }
469
598
  reset() {
470
- this.store.update(this.store.initialValue);
599
+ this.store.update(this.store.initialValue)
471
600
  }
472
601
  get value() {
473
- return this.store.value;
602
+ return this.store.value
474
603
  }
475
604
  }
476
605
  class $t extends A {
477
606
  updateAttribute(t, s) {
478
- const r = { ...this.value };
479
- r[t] = s, this.update(r);
607
+ const r = { ...this.value }
608
+ ;(r[t] = s), this.update(r)
609
+ }
610
+ updateDynamicAttribute(t, s) {
611
+ this.isKey(t) && this.isValueType(t, s) && this.updateAttribute(t, s)
612
+ }
613
+ isKey(t) {
614
+ return t in this.store.initialValue
615
+ }
616
+ isValueType(t, s) {
617
+ return typeof this.store.initialValue[t] == typeof s
480
618
  }
481
619
  resetAttribute(t) {
482
- const s = { ...this.value }, r = this.store.initialValue[t];
483
- s[t] = r, this.update(s);
620
+ const s = { ...this.value },
621
+ r = this.store.initialValue[t]
622
+ ;(s[t] = r), this.update(s)
484
623
  }
485
624
  }
486
- const Dt = (e) => new $t(e);
625
+ const Dt = (e) => new $t(e)
487
626
  class Pt extends A {
488
627
  push(t) {
489
- const s = [...this.value, t];
490
- this.update(s);
628
+ const s = [...this.value, t]
629
+ this.update(s)
491
630
  }
492
631
  pop() {
493
- const t = [...this.value], s = t.pop();
494
- return this.update(t), s;
632
+ const t = [...this.value],
633
+ s = t.pop()
634
+ return this.update(t), s
495
635
  }
496
636
  unshift(t) {
497
- const s = [t, ...this.value];
498
- this.update(s);
637
+ const s = [t, ...this.value]
638
+ this.update(s)
499
639
  }
500
640
  shift() {
501
- const t = [...this.value], s = t.shift();
502
- return this.update(t), s;
641
+ const t = [...this.value],
642
+ s = t.shift()
643
+ return this.update(t), s
503
644
  }
504
645
  addSorter(t, s) {
505
646
  this[t] = () => {
506
- this.sortBy(s);
507
- };
647
+ this.sortBy(s)
648
+ }
508
649
  }
509
650
  sortBy(t) {
510
- const s = [...this.value];
511
- s.sort(t), this.update(s);
651
+ const s = [...this.value]
652
+ s.sort(t), this.update(s)
512
653
  }
513
654
  insertAt(t, s) {
514
- const r = [...this.value];
515
- r.splice(t, 0, s), this.update(r);
655
+ const r = [...this.value]
656
+ r.splice(t, 0, s), this.update(r)
516
657
  }
517
658
  remove(t) {
518
- const s = this.value.reduce((r, n) => (n !== t && r.push(n), r), []);
519
- this.update(s);
659
+ const s = this.value.reduce((r, n) => (n !== t && r.push(n), r), [])
660
+ this.update(s)
520
661
  }
521
662
  removeBy(t) {
522
- const s = this.value.reduce((r, n) => (t(n) || r.push(n), r), []);
523
- this.update(s);
663
+ const s = this.value.reduce((r, n) => (t(n) || r.push(n), r), [])
664
+ this.update(s)
524
665
  }
525
666
  }
526
- const Ft = (e) => new Pt(e);
527
- class Lt extends A {
667
+ const Vt = (e) => new Pt(e)
668
+ class Ft extends A {
528
669
  toggle() {
529
- const t = !this.value;
530
- this.update(t);
670
+ const t = !this.value
671
+ this.update(t)
531
672
  }
532
673
  setTrue() {
533
- this.update(!0);
674
+ this.update(!0)
534
675
  }
535
676
  setFalse() {
536
- this.update(!1);
677
+ this.update(!1)
537
678
  }
538
679
  }
539
- const zt = (e) => new Lt(e), Bt = {
540
- object: Dt,
541
- list: Ft,
542
- boolean: zt
543
- }, w = "state";
680
+ const Lt = (e) => new Ft(e),
681
+ zt = {
682
+ object: Dt,
683
+ list: Vt,
684
+ boolean: Lt,
685
+ },
686
+ w = 'state'
544
687
  class G {
545
688
  constructor(t) {
546
- this.publisher = t, this.stores = {}, this.eventNamePrefix = w, this.notifications = /* @__PURE__ */ new Set(), this.inTransaction = !1;
689
+ ;(this.publisher = t),
690
+ (this.stores = {}),
691
+ (this.eventNamePrefix = w),
692
+ (this.notifications = /* @__PURE__ */ new Set()),
693
+ (this.inTransaction = !1)
547
694
  }
548
695
  create(t, s) {
549
696
  const r = new g({
550
697
  name: t,
551
698
  parent: this,
552
- value: s
553
- });
554
- return this.stores[t] = r, r;
699
+ value: s,
700
+ })
701
+ return (this.stores[t] = r), r
555
702
  }
556
703
  store(t) {
557
- return this.stores[t] || new g({
558
- name: t,
559
- parent: this,
560
- value: void 0
561
- });
704
+ return (
705
+ this.stores[t] ||
706
+ new g({
707
+ name: t,
708
+ parent: this,
709
+ value: void 0,
710
+ })
711
+ )
562
712
  }
563
713
  get(t) {
564
- return this.store(t).value;
714
+ return this.store(t).value
565
715
  }
566
716
  getAll(t) {
567
- return t.reduce((s, r) => (s[r] = this.get(r), s), {});
717
+ return t.reduce((s, r) => ((s[r] = this.get(r)), s), {})
568
718
  }
569
719
  notify(t) {
570
- this.inTransaction ? this.notifications.add(t) : this.publish(t);
720
+ this.inTransaction ? this.notifications.add(t) : this.publish(t)
571
721
  }
572
722
  update(t, s) {
573
- this.store(t).update(s);
723
+ this.store(t).update(s)
574
724
  }
575
725
  transaction(t) {
576
- this.inTransaction = !0, t(this.stores), this.inTransaction = !1, this.publishAll();
726
+ ;(this.inTransaction = !0),
727
+ t(this.stores),
728
+ (this.inTransaction = !1),
729
+ this.publishAll()
577
730
  }
578
731
  publishAll() {
579
732
  this.notifications.forEach((t) => {
580
- this.publish(t);
581
- }), this.notifications.clear();
733
+ this.publish(t)
734
+ }),
735
+ this.notifications.clear()
582
736
  }
583
737
  publish(t) {
584
738
  this.publisher(this.event(t), {
585
739
  state: this,
586
- store: this.store(t)
587
- });
740
+ store: this.store(t),
741
+ })
588
742
  }
589
743
  event(t) {
590
- return `${this.eventNamePrefix}:${t}`;
744
+ return `${this.eventNamePrefix}:${t}`
591
745
  }
592
746
  }
593
- const H = (e) => new G(e), Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
594
- __proto__: null,
595
- State: G,
596
- Store: g,
597
- createState: H,
598
- eventName: w,
599
- updaters: Bt
600
- }, Symbol.toStringTag, { value: "Module" }));
601
- class Vt {
747
+ const H = (e) => new G(e),
748
+ Pe = /* @__PURE__ */ Object.freeze(
749
+ /* @__PURE__ */ Object.defineProperty(
750
+ {
751
+ __proto__: null,
752
+ State: G,
753
+ Store: g,
754
+ createState: H,
755
+ eventName: w,
756
+ updaters: zt,
757
+ },
758
+ Symbol.toStringTag,
759
+ { value: 'Module' },
760
+ ),
761
+ )
762
+ class Bt {
602
763
  constructor(t) {
603
- this.setupDomEnvironment(t);
764
+ this.setupDomEnvironment(t)
604
765
  }
605
766
  setup() {
606
- return this.setupBus(), this.setupState(), this.addBusOptions(), this.setRenderKit(), new U({
607
- window: this.window,
608
- document: this.document,
609
- publish: this.publish,
610
- subscribe: this.subscribe,
611
- bus: this.bus,
612
- state: this.state,
613
- renderKit: this.renderKit
614
- });
767
+ return (
768
+ this.setupBus(),
769
+ this.setupState(),
770
+ this.addBusOptions(),
771
+ this.setRenderKit(),
772
+ new U({
773
+ window: this.window,
774
+ document: this.document,
775
+ publish: this.publish,
776
+ subscribe: this.subscribe,
777
+ bus: this.bus,
778
+ state: this.state,
779
+ renderKit: this.renderKit,
780
+ })
781
+ )
615
782
  }
616
783
  setupDomEnvironment(t) {
617
- t.window ? (this.window = t.window, this.document = this.window.document) : t.document ? (this.window = t.document.defaultView, this.document = t.document) : (this.window = window, this.document = document);
784
+ t.window
785
+ ? ((this.window = t.window), (this.document = this.window.document))
786
+ : t.document
787
+ ? ((this.window = t.document.defaultView), (this.document = t.document))
788
+ : ((this.window = window), (this.document = document))
618
789
  }
619
790
  setupBus() {
620
- const { publish: t, subscribe: s, bus: r } = J();
621
- this.publish = t, this.subscribe = s, this.bus = r;
791
+ const { publish: t, subscribe: s, bus: r } = J()
792
+ ;(this.publish = t), (this.subscribe = s), (this.bus = r)
622
793
  }
623
794
  setupState() {
624
- this.state = H(this.publish);
795
+ this.state = H(this.publish)
625
796
  }
626
797
  addBusOptions() {
627
798
  this.bus.addListenerOptions({
628
799
  state: this.state,
629
800
  document: this.document,
630
- window: this.window
631
- });
801
+ window: this.window,
802
+ })
632
803
  }
633
804
  setRenderKit() {
634
805
  this.renderKit = {
@@ -636,397 +807,543 @@ class Vt {
636
807
  subscribe: this.subscribe,
637
808
  state: this.state,
638
809
  document: this.document,
639
- window: this.window
640
- };
810
+ window: this.window,
811
+ }
641
812
  }
642
813
  }
643
- const Fe = (e = {}) => {
644
- const s = new Vt(e).setup();
645
- return s.startNavigation(), s;
646
- };
647
- var i = /* @__PURE__ */ ((e) => (e[e.removeNode = 0] = "removeNode", e[e.insertNode = 1] = "insertNode", e[e.replaceNode = 2] = "replaceNode", e[e.removeAttribute = 3] = "removeAttribute", e[e.addAttribute = 4] = "addAttribute", e[e.updateAttribute = 5] = "updateAttribute", e[e.removeEvent = 6] = "removeEvent", e[e.addEvent = 7] = "addEvent", e[e.updateEvent = 8] = "updateEvent", e[e.changeValue = 9] = "changeValue", e[e.changeText = 10] = "changeText", e))(i || {});
648
- const Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
649
- __proto__: null,
650
- ChangeInstructionTypes: i
651
- }, Symbol.toStringTag, { value: "Module" })), Kt = (e, t) => ({
652
- source: e,
653
- target: t,
654
- type: i.changeText,
655
- data: {}
656
- }), Rt = (e, t) => ({
657
- source: e,
658
- target: t,
659
- type: i.replaceNode,
660
- data: {}
661
- }), Ut = (e, t, s) => ({
662
- source: e,
663
- target: t,
664
- data: s,
665
- type: i.removeAttribute
666
- }), Ct = (e, t, s) => ({
667
- source: e,
668
- target: t,
669
- data: s,
670
- type: i.addAttribute
671
- }), It = (e, t, s) => ({
672
- source: e,
673
- target: t,
674
- data: s,
675
- type: i.updateAttribute
676
- }), qt = (e, t, s) => ({
677
- source: e,
678
- target: t,
679
- data: s,
680
- type: i.removeEvent
681
- }), Jt = (e, t, s) => ({
682
- source: e,
683
- target: t,
684
- data: s,
685
- type: i.addEvent
686
- }), Gt = (e, t, s) => ({
687
- source: e,
688
- target: t,
689
- data: s,
690
- type: i.updateEvent
691
- }), N = (e) => ({
692
- source: e,
693
- target: e,
694
- // for type crap only
695
- type: i.removeNode,
696
- data: {}
697
- }), b = (e, t) => ({
698
- target: e,
699
- source: e,
700
- // for type crap only
701
- type: i.insertNode,
702
- data: t
703
- }), Ht = (e, t, s) => ({
704
- source: e,
705
- target: t,
706
- type: i.changeValue,
707
- data: s
708
- }), Qt = (e, t) => e.type > t.type ? 1 : e.type < t.type ? -1 : 0, _ = { index: -1 };
814
+ const Ve = (e = {}) => {
815
+ const s = new Bt(e).setup()
816
+ return s.startNavigation(), s
817
+ }
818
+ var o = /* @__PURE__ */ ((e) => (
819
+ (e[(e.removeNode = 0)] = 'removeNode'),
820
+ (e[(e.insertNode = 1)] = 'insertNode'),
821
+ (e[(e.replaceNode = 2)] = 'replaceNode'),
822
+ (e[(e.removeAttribute = 3)] = 'removeAttribute'),
823
+ (e[(e.addAttribute = 4)] = 'addAttribute'),
824
+ (e[(e.updateAttribute = 5)] = 'updateAttribute'),
825
+ (e[(e.removeEvent = 6)] = 'removeEvent'),
826
+ (e[(e.addEvent = 7)] = 'addEvent'),
827
+ (e[(e.updateEvent = 8)] = 'updateEvent'),
828
+ (e[(e.changeValue = 9)] = 'changeValue'),
829
+ (e[(e.changeText = 10)] = 'changeText'),
830
+ e
831
+ ))(o || {})
832
+ const Fe = /* @__PURE__ */ Object.freeze(
833
+ /* @__PURE__ */ Object.defineProperty(
834
+ {
835
+ __proto__: null,
836
+ ChangeInstructionTypes: o,
837
+ },
838
+ Symbol.toStringTag,
839
+ { value: 'Module' },
840
+ ),
841
+ ),
842
+ Kt = (e, t) => ({
843
+ source: e,
844
+ target: t,
845
+ type: o.changeText,
846
+ data: {},
847
+ }),
848
+ Rt = (e, t) => ({
849
+ source: e,
850
+ target: t,
851
+ type: o.replaceNode,
852
+ data: {},
853
+ }),
854
+ Ut = (e, t, s) => ({
855
+ source: e,
856
+ target: t,
857
+ data: s,
858
+ type: o.removeAttribute,
859
+ }),
860
+ Ct = (e, t, s) => ({
861
+ source: e,
862
+ target: t,
863
+ data: s,
864
+ type: o.addAttribute,
865
+ }),
866
+ It = (e, t, s) => ({
867
+ source: e,
868
+ target: t,
869
+ data: s,
870
+ type: o.updateAttribute,
871
+ }),
872
+ qt = (e, t, s) => ({
873
+ source: e,
874
+ target: t,
875
+ data: s,
876
+ type: o.removeEvent,
877
+ }),
878
+ Jt = (e, t, s) => ({
879
+ source: e,
880
+ target: t,
881
+ data: s,
882
+ type: o.addEvent,
883
+ }),
884
+ Gt = (e, t, s) => ({
885
+ source: e,
886
+ target: t,
887
+ data: s,
888
+ type: o.updateEvent,
889
+ }),
890
+ N = (e) => ({
891
+ source: e,
892
+ target: e,
893
+ // for type crap only
894
+ type: o.removeNode,
895
+ data: {},
896
+ }),
897
+ b = (e, t) => ({
898
+ target: e,
899
+ source: e,
900
+ // for type crap only
901
+ type: o.insertNode,
902
+ data: t,
903
+ }),
904
+ Ht = (e, t, s) => ({
905
+ source: e,
906
+ target: t,
907
+ type: o.changeValue,
908
+ data: s,
909
+ }),
910
+ Qt = (e, t) => (e.type > t.type ? 1 : e.type < t.type ? -1 : 0),
911
+ _ = { index: -1 }
709
912
  class Wt {
710
913
  constructor() {
711
- this.map = {};
914
+ this.map = {}
712
915
  }
713
916
  populate(t) {
714
917
  t.forEach((s, r) => {
715
- const n = s.__jsx;
716
- n && (this.map[n] = this.map[n] || [], this.map[n].push({
717
- element: s,
718
- index: r
719
- }));
720
- });
918
+ const n = s.__jsx
919
+ n &&
920
+ ((this.map[n] = this.map[n] || []),
921
+ this.map[n].push({
922
+ element: s,
923
+ index: r,
924
+ }))
925
+ })
721
926
  }
722
927
  pullMatch(t) {
723
- const s = t && t.__jsx;
724
- return !s || !(this.map[s] && this.map[s].length) ? _ : this.map[s].shift();
928
+ const s = t && t.__jsx
929
+ return !s || !(this.map[s] && this.map[s].length) ? _ : this.map[s].shift()
725
930
  }
726
931
  clear(t) {
727
- const s = t && t.__jsx;
728
- if (!(s && this.map[s] && this.map[s].length)) return;
729
- const r = this.map[s];
730
- this.map[s] = r.reduce((n, o) => (o.element !== t && n.push(o), n), []);
932
+ const s = t && t.__jsx
933
+ if (!(s && this.map[s] && this.map[s].length)) return
934
+ const r = this.map[s]
935
+ this.map[s] = r.reduce((n, i) => (i.element !== t && n.push(i), n), [])
731
936
  }
732
937
  check(t) {
733
- const s = t && t.__jsx;
734
- return s && this.map[s] ? this.map[s].length > 0 : !1;
938
+ const s = t && t.__jsx
939
+ return s && this.map[s] ? this.map[s].length > 0 : !1
735
940
  }
736
941
  remaining() {
737
- return Object.values(this.map).flat();
942
+ return Object.values(this.map).flat()
738
943
  }
739
944
  }
740
945
  const S = (e) => {
741
- const t = new Wt();
742
- return t.populate(e), t;
743
- }, Q = (e, t, s = !1) => {
744
- const r = [], n = e.attributes, o = n.length, a = t.attributes, l = a.length;
745
- let u, d, c;
746
- for (u = 0; u < o; u++) {
747
- c = null;
748
- const h = n.item(u);
749
- if (h) {
750
- for (d = 0; d < l; d++) {
751
- const p = a.item(d);
752
- if (p && h.name == p.name) {
753
- c = p;
754
- break;
946
+ const t = new Wt()
947
+ return t.populate(e), t
948
+ },
949
+ Q = (e, t, s = !1) => {
950
+ const r = [],
951
+ n = e.attributes,
952
+ i = n.length,
953
+ a = t.attributes,
954
+ l = a.length
955
+ let u, d, c
956
+ for (u = 0; u < i; u++) {
957
+ c = null
958
+ const h = n.item(u)
959
+ if (h) {
960
+ for (d = 0; d < l; d++) {
961
+ const p = a.item(d)
962
+ if (p && h.name == p.name) {
963
+ c = p
964
+ break
965
+ }
755
966
  }
967
+ c
968
+ ? h.value !== c.value &&
969
+ r.push(
970
+ It(e, t, {
971
+ name: h.name,
972
+ value: c.value,
973
+ isSvg: s,
974
+ }),
975
+ )
976
+ : r.push(Ut(e, t, { name: h.name, isSvg: s }))
756
977
  }
757
- c ? h.value !== c.value && r.push(
758
- It(e, t, {
759
- name: h.name,
760
- value: c.value,
761
- isSvg: s
762
- })
763
- ) : r.push(
764
- Ut(e, t, { name: h.name, isSvg: s })
765
- );
766
978
  }
767
- }
768
- for (u = 0; u < l; u++) {
769
- c = null;
770
- const h = a.item(u);
771
- if (h) {
772
- for (d = 0; d < o; d++) {
773
- const p = n.item(d);
774
- if (p && p.name == h.name) {
775
- c = p;
776
- break;
979
+ for (u = 0; u < l; u++) {
980
+ c = null
981
+ const h = a.item(u)
982
+ if (h) {
983
+ for (d = 0; d < i; d++) {
984
+ const p = n.item(d)
985
+ if (p && p.name == h.name) {
986
+ c = p
987
+ break
988
+ }
777
989
  }
990
+ c ||
991
+ r.push(
992
+ Ct(e, t, {
993
+ name: h.name,
994
+ value: h.value,
995
+ isSvg: s,
996
+ }),
997
+ )
778
998
  }
779
- c || r.push(
780
- Ct(e, t, {
781
- name: h.name,
782
- value: h.value,
783
- isSvg: s
784
- })
785
- );
786
999
  }
1000
+ return r
1001
+ },
1002
+ Xt = (e, t) => {
1003
+ const s = [],
1004
+ r = e.eventMaps,
1005
+ n = t.eventMaps,
1006
+ i = Object.keys(r),
1007
+ a = Object.keys(n)
1008
+ return (
1009
+ i.forEach((l) => {
1010
+ const u = r[l],
1011
+ d = n[l]
1012
+ d
1013
+ ? d.busEvent !== u.busEvent &&
1014
+ s.push(
1015
+ Gt(e, t, {
1016
+ name: l,
1017
+ targetValue: d.listener,
1018
+ sourceValue: u.listener,
1019
+ }),
1020
+ )
1021
+ : s.push(
1022
+ qt(e, t, {
1023
+ name: u.domEvent,
1024
+ value: u.listener,
1025
+ }),
1026
+ )
1027
+ }),
1028
+ a.forEach((l) => {
1029
+ const u = r[l],
1030
+ d = n[l]
1031
+ u ||
1032
+ s.push(
1033
+ Jt(e, t, {
1034
+ name: d.domEvent,
1035
+ value: d.listener,
1036
+ }),
1037
+ )
1038
+ }),
1039
+ s
1040
+ )
1041
+ },
1042
+ Yt = (e) => e.tagName !== 'INPUT',
1043
+ Zt = (e, t) => e.value === t.value,
1044
+ te = (e, t) => {
1045
+ if (Yt(e) || Zt(e, t)) return []
1046
+ const s = e,
1047
+ r = t
1048
+ return [Ht(s, r, { name: 'value', value: r.value })]
1049
+ },
1050
+ ee = (e, t) => {
1051
+ const s = Q(e, t),
1052
+ r = Xt(e, t),
1053
+ n = te(e, t)
1054
+ return s.concat(r).concat(n)
1055
+ },
1056
+ se = (e, t) => Q(e, t, !0),
1057
+ re = (e, t) => (e.textContent !== t.textContent ? [Kt(e, t)] : []),
1058
+ ne = (e, t, s) => {
1059
+ let r = []
1060
+ if (e.nodeType === 1 && ot(e)) {
1061
+ const n = e,
1062
+ i = t,
1063
+ a = se(n, i),
1064
+ l = s(n.childNodes, i.childNodes, n)
1065
+ r = a.concat(l)
1066
+ } else if (e.nodeType === 1) {
1067
+ const n = e,
1068
+ i = t,
1069
+ a = ee(n, i),
1070
+ l = s(n.childNodes, i.childNodes, n)
1071
+ r = a.concat(l)
1072
+ } else e.nodeType === 3 && (r = re(e, t))
1073
+ return r
1074
+ },
1075
+ W = (e, t, s) => {
1076
+ const r = [],
1077
+ n = ie(e, t),
1078
+ i = S(e),
1079
+ a = S(t),
1080
+ l = []
1081
+ let u = 0
1082
+ for (; u < n; u++) {
1083
+ const c = e[u],
1084
+ h = t[u]
1085
+ if (h && a.check(h)) {
1086
+ const p = i.pullMatch(h)
1087
+ a.clear(h),
1088
+ p.element
1089
+ ? (p.index !== u &&
1090
+ r.push(
1091
+ b(p.element, {
1092
+ parent: s,
1093
+ index: u,
1094
+ }),
1095
+ ),
1096
+ l.push({
1097
+ source: p.element,
1098
+ target: h,
1099
+ }))
1100
+ : c
1101
+ ? a.check(c)
1102
+ ? r.push(b(h, { parent: s, index: u }))
1103
+ : (i.clear(c), r.push(Rt(c, h)))
1104
+ : r.push(b(h, { parent: s, index: u }))
1105
+ } else c && i.pullMatch(c).element && r.push(N(c))
1106
+ }
1107
+ i.remaining().forEach(({ element: c }) => {
1108
+ r.push(N(c))
1109
+ })
1110
+ const d = l.reduce(
1111
+ (c, { source: h, target: p }) => c.concat(ne(h, p, W)),
1112
+ [],
1113
+ )
1114
+ return r.concat(d).sort(Qt)
1115
+ },
1116
+ ie = (e, t) => {
1117
+ const s = e.length,
1118
+ r = t.length
1119
+ return s > r ? s : r
1120
+ },
1121
+ oe = (e, t, s) => {
1122
+ const r = W(e, t, s)
1123
+ return (
1124
+ r.forEach((n) => {
1125
+ ue(n)
1126
+ }),
1127
+ r
1128
+ )
1129
+ },
1130
+ ue = (e) => {
1131
+ ;(ye[e.type] || ae)(e)
1132
+ },
1133
+ ae = (e) => {},
1134
+ ce = (e) => {
1135
+ const { source: t, target: s } = e
1136
+ t.nodeValue = s.textContent
1137
+ },
1138
+ le = (e) => {
1139
+ const { source: t } = e
1140
+ t.remove()
1141
+ },
1142
+ he = (e) => {
1143
+ const { target: t, data: s } = e,
1144
+ { parent: r, index: n } = s,
1145
+ i = r.childNodes[n]
1146
+ i ? i && i !== t && r.insertBefore(t, i) : r.appendChild(t)
1147
+ },
1148
+ de = (e) => {
1149
+ const { source: t, target: s } = e
1150
+ t.replaceWith(s)
1151
+ },
1152
+ pe = (e) => {
1153
+ const { source: t, data: s } = e,
1154
+ { name: r, isSvg: n } = s
1155
+ n ? t.removeAttributeNS(null, r) : t.removeAttribute(r)
1156
+ },
1157
+ X = (e) => {
1158
+ const { source: t, data: s } = e,
1159
+ { name: r, value: n, isSvg: i } = s
1160
+ i ? t.setAttributeNS(null, r, n) : t.setAttribute(r, n)
1161
+ },
1162
+ me = (e) => {
1163
+ X(e)
1164
+ },
1165
+ fe = (e) => {
1166
+ const t = e.data,
1167
+ s = e.source,
1168
+ { name: r, value: n } = t
1169
+ s.removeEventListener(r, n)
1170
+ },
1171
+ be = (e) => {
1172
+ const t = e.data,
1173
+ s = e.source,
1174
+ { name: r, value: n } = t
1175
+ s.addEventListener(r, n)
1176
+ },
1177
+ ve = (e) => {
1178
+ const t = e.data,
1179
+ s = e.source,
1180
+ { name: r, sourceValue: n, targetValue: i } = t
1181
+ s.removeEventListener(r, n), s.addEventListener(r, i)
1182
+ },
1183
+ ge = (e) => {
1184
+ const t = e.data,
1185
+ s = e.source,
1186
+ { value: r } = t
1187
+ s.value = r
1188
+ },
1189
+ ye = {
1190
+ [o.changeText]: ce,
1191
+ [o.removeNode]: le,
1192
+ [o.insertNode]: he,
1193
+ [o.replaceNode]: de,
1194
+ [o.removeAttribute]: pe,
1195
+ [o.addAttribute]: X,
1196
+ [o.updateAttribute]: me,
1197
+ [o.removeEvent]: fe,
1198
+ [o.addEvent]: be,
1199
+ [o.updateEvent]: ve,
1200
+ [o.changeValue]: ge,
1201
+ },
1202
+ Ee = (e, t, s) => {
1203
+ const r = [...t]
1204
+ return (
1205
+ e.forEach((n) => {
1206
+ xe(n, r, s)
1207
+ }),
1208
+ r
1209
+ )
1210
+ },
1211
+ xe = (e, t, s) => {
1212
+ const r = _e[e.type]
1213
+ r && r(e, t, s)
1214
+ },
1215
+ Ae = (e, t) => {
1216
+ const { source: s } = e,
1217
+ r = t.indexOf(s)
1218
+ r >= 0 && t.splice(r, 1)
1219
+ },
1220
+ we = (e, t, s) => {
1221
+ const { target: r } = e,
1222
+ n = e.data,
1223
+ { index: i, parent: a } = n
1224
+ s === a && t.splice(i, 0, r)
1225
+ },
1226
+ Ne = (e, t) => {
1227
+ const { target: s, source: r } = e,
1228
+ n = t.indexOf(r)
1229
+ n >= 0 && (t[n] = s)
1230
+ },
1231
+ _e = {
1232
+ [o.removeNode]: Ae,
1233
+ [o.insertNode]: we,
1234
+ [o.replaceNode]: Ne,
787
1235
  }
788
- return r;
789
- }, Xt = (e, t) => {
790
- const s = [], r = e.eventMaps, n = t.eventMaps, o = Object.keys(r), a = Object.keys(n);
791
- return o.forEach((l) => {
792
- const u = r[l], d = n[l];
793
- d ? d.busEvent !== u.busEvent && s.push(
794
- Gt(e, t, {
795
- name: l,
796
- targetValue: d.listener,
797
- sourceValue: u.listener
798
- })
799
- ) : s.push(
800
- qt(e, t, {
801
- name: u.domEvent,
802
- value: u.listener
803
- })
804
- );
805
- }), a.forEach((l) => {
806
- const u = r[l], d = n[l];
807
- u || s.push(
808
- Jt(e, t, {
809
- name: d.domEvent,
810
- value: d.listener
811
- })
812
- );
813
- }), s;
814
- }, Yt = (e) => e.tagName !== "INPUT", Zt = (e, t) => e.value === t.value, te = (e, t) => {
815
- if (Yt(e) || Zt(e, t))
816
- return [];
817
- const s = e, r = t;
818
- return [Ht(s, r, { name: "value", value: r.value })];
819
- }, ee = (e, t) => {
820
- const s = Q(e, t), r = Xt(e, t), n = te(e, t);
821
- return s.concat(r).concat(n);
822
- }, se = (e, t) => Q(e, t, !0), re = (e, t) => e.textContent !== t.textContent ? [Kt(e, t)] : [], ne = (e, t, s) => {
823
- let r = [];
824
- if (e.nodeType === 1 && it(e)) {
825
- const n = e, o = t, a = se(n, o), l = s(
826
- n.childNodes,
827
- o.childNodes,
828
- n
829
- );
830
- r = a.concat(l);
831
- } else if (e.nodeType === 1) {
832
- const n = e, o = t, a = ee(n, o), l = s(
833
- n.childNodes,
834
- o.childNodes,
835
- n
836
- );
837
- r = a.concat(l);
838
- } else e.nodeType === 3 && (r = re(e, t));
839
- return r;
840
- }, W = (e, t, s) => {
841
- const r = [], n = oe(e, t), o = S(e), a = S(t), l = [];
842
- let u = 0;
843
- for (; u < n; u++) {
844
- const c = e[u], h = t[u];
845
- if (h && a.check(h)) {
846
- const p = o.pullMatch(h);
847
- a.clear(h), p.element ? (p.index !== u && r.push(
848
- b(p.element, {
849
- parent: s,
850
- index: u
851
- })
852
- ), l.push({
853
- source: p.element,
854
- target: h
855
- })) : c ? a.check(c) ? r.push(
856
- b(h, { parent: s, index: u })
857
- ) : (o.clear(c), r.push(
858
- Rt(c, h)
859
- )) : r.push(
860
- b(h, { parent: s, index: u })
861
- );
862
- } else c && o.pullMatch(c).element && r.push(N(c));
863
- }
864
- o.remaining().forEach(({ element: c }) => {
865
- r.push(N(c));
866
- });
867
- const d = l.reduce(
868
- (c, { source: h, target: p }) => c.concat(
869
- ne(h, p, W)
870
- ),
871
- []
872
- );
873
- return r.concat(d).sort(Qt);
874
- }, oe = (e, t) => {
875
- const s = e.length, r = t.length;
876
- return s > r ? s : r;
877
- }, ie = (e, t, s) => {
878
- const r = W(e, t, s);
879
- return r.forEach((n) => {
880
- ue(n);
881
- }), r;
882
- }, ue = (e) => {
883
- (ye[e.type] || ae)(e);
884
- }, ae = (e) => {
885
- }, ce = (e) => {
886
- const { source: t, target: s } = e;
887
- t.nodeValue = s.textContent;
888
- }, le = (e) => {
889
- const { source: t } = e;
890
- t.remove();
891
- }, he = (e) => {
892
- const { target: t, data: s } = e, { parent: r, index: n } = s, o = r.childNodes[n];
893
- o ? o && o !== t && r.insertBefore(t, o) : r.appendChild(t);
894
- }, de = (e) => {
895
- const { source: t, target: s } = e;
896
- t.replaceWith(s);
897
- }, pe = (e) => {
898
- const { source: t, data: s } = e, { name: r, isSvg: n } = s;
899
- n ? t.removeAttributeNS(null, r) : t.removeAttribute(r);
900
- }, X = (e) => {
901
- const { source: t, data: s } = e, { name: r, value: n, isSvg: o } = s;
902
- o ? t.setAttributeNS(null, r, n) : t.setAttribute(r, n);
903
- }, me = (e) => {
904
- X(e);
905
- }, fe = (e) => {
906
- const t = e.data, s = e.source, { name: r, value: n } = t;
907
- s.removeEventListener(r, n);
908
- }, be = (e) => {
909
- const t = e.data, s = e.source, { name: r, value: n } = t;
910
- s.addEventListener(r, n);
911
- }, ve = (e) => {
912
- const t = e.data, s = e.source, { name: r, sourceValue: n, targetValue: o } = t;
913
- s.removeEventListener(r, n), s.addEventListener(r, o);
914
- }, ge = (e) => {
915
- const t = e.data, s = e.source, { value: r } = t;
916
- s.value = r;
917
- }, ye = {
918
- [i.changeText]: ce,
919
- [i.removeNode]: le,
920
- [i.insertNode]: he,
921
- [i.replaceNode]: de,
922
- [i.removeAttribute]: pe,
923
- [i.addAttribute]: X,
924
- [i.updateAttribute]: me,
925
- [i.removeEvent]: fe,
926
- [i.addEvent]: be,
927
- [i.updateEvent]: ve,
928
- [i.changeValue]: ge
929
- }, Ee = (e, t, s) => {
930
- const r = [...t];
931
- return e.forEach((n) => {
932
- xe(n, r, s);
933
- }), r;
934
- }, xe = (e, t, s) => {
935
- const r = _e[e.type];
936
- r && r(e, t, s);
937
- }, Ae = (e, t) => {
938
- const { source: s } = e, r = t.indexOf(s);
939
- r >= 0 && t.splice(r, 1);
940
- }, we = (e, t, s) => {
941
- const { target: r } = e, n = e.data, { index: o, parent: a } = n;
942
- s === a && t.splice(o, 0, r);
943
- }, Ne = (e, t) => {
944
- const { target: s, source: r } = e, n = t.indexOf(r);
945
- n >= 0 && (t[n] = s);
946
- }, _e = {
947
- [i.removeNode]: Ae,
948
- [i.insertNode]: we,
949
- [i.replaceNode]: Ne
950
- };
951
1236
  class Se {
952
1237
  constructor({ Template: t, subscriptions: s, attributes: r, viewModel: n }) {
953
- this.Template = t, this.viewModel = n, this.attributes = r, this.subscriptions = s, this.dom = [], this.parentElement = null;
1238
+ ;(this.Template = t),
1239
+ (this.viewModel = n),
1240
+ (this.attributes = r),
1241
+ (this.subscriptions = s),
1242
+ (this.dom = []),
1243
+ (this.parentElement = null)
954
1244
  }
955
1245
  render(t) {
956
- return this.parentElement = t.parent, this.renderKit = t, this.subscribeForRerender(), this.dom = this.generateDom(t), this.dom;
1246
+ return (
1247
+ (this.parentElement = t.parent),
1248
+ (this.renderKit = t),
1249
+ this.subscribeForRerender(),
1250
+ (this.dom = this.generateDom(t)),
1251
+ this.dom
1252
+ )
957
1253
  }
958
1254
  generateDom(t) {
959
1255
  const s = {
960
- ...this.attributes,
961
- ...this.viewModel(
962
- t.state.getAll(this.subscriptions)
963
- )
964
- }, r = this.Template(s);
965
- return r ? r.render(t) : [];
1256
+ ...this.attributes,
1257
+ ...this.viewModel(t.state.getAll(this.subscriptions)),
1258
+ },
1259
+ r = this.Template(s)
1260
+ return r ? r.render(t) : []
966
1261
  }
967
1262
  rerender() {
968
1263
  if (!this.parentElement && this.dom[0]) {
969
- const r = this.dom[0].parentElement;
970
- this.parentElement = r;
1264
+ const r = this.dom[0].parentElement
1265
+ this.parentElement = r
971
1266
  }
972
- const t = this.generateDom(this.renderKit), s = ie(
973
- this.dom,
974
- t,
975
- this.parentElement
976
- );
977
- this.dom = Ee(
978
- s,
979
- this.dom,
980
- this.parentElement
981
- );
1267
+ const t = this.generateDom(this.renderKit),
1268
+ s = oe(this.dom, t, this.parentElement)
1269
+ this.dom = Ee(s, this.dom, this.parentElement)
982
1270
  }
983
1271
  subscribeForRerender() {
984
- const { subscribe: t } = this.renderKit;
1272
+ const { subscribe: t } = this.renderKit
985
1273
  this.subscriptions.forEach((s) => {
986
- t(this.eventName(s), () => this.rerender());
987
- });
1274
+ t(this.eventName(s), () => this.rerender())
1275
+ })
988
1276
  }
989
1277
  eventName(t) {
990
- return `${w}:${t}`;
1278
+ return `${w}:${t}`
991
1279
  }
992
1280
  }
993
- const Te = (e) => e, je = ({
994
- Template: e,
995
- viewModel: t,
996
- subscriptions: s
997
- }) => (s = s || [], t = t || Te, (r) => new Se({ Template: e, viewModel: t, subscriptions: s, attributes: r })), ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
998
- __proto__: null,
999
- createRouteState: D,
1000
- events: wt,
1001
- extractQueryParams: L,
1002
- findHref: P,
1003
- navigate: E,
1004
- onLinkClick: F,
1005
- onLocationChange: z,
1006
- start: Nt
1007
- }, Symbol.toStringTag, { value: "Module" })), Oe = (e) => ({ path: t }) => t === e, Me = () => !0, Y = (e) => ({ route: t }) => {
1008
- const s = e.find((r) => r.match(t));
1009
- return s && s.Partial;
1010
- }, Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1011
- __proto__: null,
1012
- buildRouter: Y,
1013
- catchAll: Me,
1014
- exactPathMatch: Oe
1015
- }, Symbol.toStringTag, { value: "Module" })), ke = () => ({
1016
- render: (e, t) => []
1017
- }), Ve = (e) => {
1018
- const t = Y(e);
1019
- return je({ Template: ({ route: r }) => (t({ route: r }) || ke)(), subscriptions: ["route"] });
1020
- };
1281
+ const Te = (e) => e,
1282
+ je = ({ Template: e, viewModel: t, subscriptions: s }) => (
1283
+ (s = s || []),
1284
+ (t = t || Te),
1285
+ (r) =>
1286
+ new Se({ Template: e, viewModel: t, subscriptions: s, attributes: r })
1287
+ ),
1288
+ Le = /* @__PURE__ */ Object.freeze(
1289
+ /* @__PURE__ */ Object.defineProperty(
1290
+ {
1291
+ __proto__: null,
1292
+ createRouteState: D,
1293
+ events: wt,
1294
+ extractQueryParams: F,
1295
+ findHref: P,
1296
+ navigate: E,
1297
+ onLinkClick: V,
1298
+ onLocationChange: L,
1299
+ start: Nt,
1300
+ },
1301
+ Symbol.toStringTag,
1302
+ { value: 'Module' },
1303
+ ),
1304
+ ),
1305
+ Oe =
1306
+ (e) =>
1307
+ ({ path: t }) =>
1308
+ t === e,
1309
+ Me = () => !0,
1310
+ Y =
1311
+ (e) =>
1312
+ ({ route: t }) => {
1313
+ const s = e.find((r) => r.match(t))
1314
+ return s && s.Partial
1315
+ },
1316
+ ze = /* @__PURE__ */ Object.freeze(
1317
+ /* @__PURE__ */ Object.defineProperty(
1318
+ {
1319
+ __proto__: null,
1320
+ buildRouter: Y,
1321
+ catchAll: Me,
1322
+ exactPathMatch: Oe,
1323
+ },
1324
+ Symbol.toStringTag,
1325
+ { value: 'Module' },
1326
+ ),
1327
+ ),
1328
+ ke = () => ({
1329
+ render: (e, t) => [],
1330
+ }),
1331
+ Be = (e) => {
1332
+ const t = Y(e)
1333
+ return je({
1334
+ Template: ({ route: r }) => (t({ route: r }) || ke)(),
1335
+ subscriptions: ['route'],
1336
+ })
1337
+ }
1021
1338
  export {
1022
- Le as JaxsTypes,
1339
+ Fe as JaxsTypes,
1023
1340
  $e as appBuilding,
1024
1341
  je as bind,
1025
- Fe as createApp,
1342
+ Ve as createApp,
1026
1343
  Et as jsx,
1027
1344
  De as messageBus,
1028
- ze as navigation,
1029
- Ve as routedView,
1030
- Be as routing,
1031
- Pe as state
1032
- };
1345
+ Le as navigation,
1346
+ Be as routedView,
1347
+ ze as routing,
1348
+ Pe as state,
1349
+ }