apprun 3.38.0 → 6.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/README.md +18 -10
  3. package/apprun.d.ts +67 -23
  4. package/dist/apprun-code.js +1 -1
  5. package/dist/apprun-code.js.map +1 -1
  6. package/dist/apprun-dev-tools.js +1 -1
  7. package/dist/apprun-dev-tools.js.map +1 -1
  8. package/dist/apprun-html.esm.js +7 -7
  9. package/dist/apprun-html.esm.js.map +1 -1
  10. package/dist/apprun-html.js +1 -1
  11. package/dist/apprun-html.js.map +1 -1
  12. package/dist/apprun-play.js +1 -1
  13. package/dist/apprun-play.js.map +1 -1
  14. package/dist/apprun.esm.js +1 -1
  15. package/dist/apprun.esm.js.map +1 -1
  16. package/dist/apprun.js +1 -1
  17. package/dist/apprun.js.map +1 -1
  18. package/esm/add-components.js +7 -7
  19. package/esm/add-components.js.map +1 -1
  20. package/esm/app.js +81 -32
  21. package/esm/app.js.map +1 -1
  22. package/esm/apprun-code.js +8 -2
  23. package/esm/apprun-code.js.map +1 -1
  24. package/esm/apprun-html.js +14 -9
  25. package/esm/apprun-html.js.map +1 -1
  26. package/esm/apprun-play.js +7 -1
  27. package/esm/apprun-play.js.map +1 -1
  28. package/esm/apprun.js +38 -19
  29. package/esm/apprun.js.map +1 -1
  30. package/esm/component.js +90 -37
  31. package/esm/component.js.map +1 -1
  32. package/esm/directive.js +1 -1
  33. package/esm/directive.js.map +1 -1
  34. package/esm/router.js +73 -19
  35. package/esm/router.js.map +1 -1
  36. package/esm/types.js +2 -1
  37. package/esm/types.js.map +1 -1
  38. package/esm/vdom-my.js +52 -52
  39. package/esm/vdom-my.js.map +1 -1
  40. package/esm/vdom-to-html.js +8 -1
  41. package/esm/vdom-to-html.js.map +1 -1
  42. package/esm/vdom.js +3 -3
  43. package/esm/vdom.js.map +1 -1
  44. package/esm/version.js +1 -1
  45. package/esm/version.js.map +1 -1
  46. package/esm/web-component.js +23 -6
  47. package/esm/web-component.js.map +1 -1
  48. package/jsx-runtime.js +1 -1
  49. package/jsx-runtime.js.map +1 -1
  50. package/package.json +62 -2
  51. package/.clinerules +0 -1
  52. package/.travis.yml +0 -10
  53. package/BACKERS.md +0 -8
  54. package/CNAME +0 -1
  55. package/WHATSNEW.md +0 -367
  56. package/ai/apprun-html.prompt.md +0 -290
  57. package/ai/apprun.prompt.md +0 -602
  58. package/apprun-book.jpg +0 -0
  59. package/dist/apprun-dev-tools-tests.js +0 -1
  60. package/dist/apprun-dev-tools.js.LICENSE.txt +0 -1
  61. package/dist/apprun-play-html.esm.js +0 -34
  62. package/dist/apprun-play-html.esm.js.map +0 -1
  63. package/error.log +0 -0
  64. package/esm/apprun-play-html.js +0 -210
  65. package/esm/apprun-play-html.js.map +0 -1
  66. package/esm/shadow.js +0 -8
  67. package/esm/shadow.js.map +0 -1
  68. package/esm/vdom-html.js +0 -22
  69. package/esm/vdom-html.js.map +0 -1
  70. package/esm/vdom-my-new.js +0 -327
  71. package/esm/vdom-my-new.js.map +0 -1
  72. package/esm/vdom-patch.js +0 -103
  73. package/esm/vdom-patch.js.map +0 -1
  74. package/index.html +0 -87
  75. package/jest.config.js +0 -57
  76. package/jest.setup.js +0 -73
  77. package/logo.png +0 -0
  78. package/react.js +0 -13
  79. package/rollup.config.js +0 -62
  80. package/src/add-components.ts +0 -103
  81. package/src/app.ts +0 -173
  82. package/src/apprun-code.tsx +0 -177
  83. package/src/apprun-dev-tools-tests.tsx +0 -101
  84. package/src/apprun-dev-tools.tsx +0 -307
  85. package/src/apprun-html.ts +0 -25
  86. package/src/apprun-play.tsx +0 -249
  87. package/src/apprun.ts +0 -238
  88. package/src/component.ts +0 -388
  89. package/src/createState.ts +0 -11
  90. package/src/decorator.ts +0 -98
  91. package/src/directive.ts +0 -303
  92. package/src/global.d.ts +0 -22
  93. package/src/router.ts +0 -311
  94. package/src/shadow.tsx +0 -8
  95. package/src/tsconfig.json +0 -16
  96. package/src/type-utils.ts +0 -130
  97. package/src/types.ts +0 -151
  98. package/src/vdom-html.ts_ +0 -20
  99. package/src/vdom-lit-html.ts +0 -67
  100. package/src/vdom-my-new.ts +0 -311
  101. package/src/vdom-my-prop-attr.ts +0 -241
  102. package/src/vdom-my.ts +0 -286
  103. package/src/vdom-patch.ts +0 -108
  104. package/src/vdom-to-html.tsx +0 -49
  105. package/src/vdom.ts +0 -28
  106. package/src/version.ts +0 -16
  107. package/src/web-component.ts +0 -154
  108. package/tsconfig.jest.json +0 -49
  109. package/tsconfig.json +0 -16
  110. package/tslint.json +0 -114
  111. package/typescriptreact.json +0 -87
  112. package/viewEngine.js +0 -54
  113. package/webpack.config.cjs +0 -41
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ## V6.0.0
4
+
5
+ * Kept AppRun script-tag globals; removed legacy `React` and `_React` browser aliases
6
+ * Removed `_html:` string-prefix rendering; use `trustedHTML()` for caller-owned trusted markup
7
+ * Deprecated misleading `safeHTML()` naming in favor of `trustedHTML()`
8
+ * Removed `query()` in favor of `runAsync()`
9
+ * Added router support for `:param` and `*` patterns
10
+ * Hardened package exports, package contents, side-effect metadata, and generated artifact hygiene
11
+ * Made `immer` an optional peer dependency for `createState`
12
+ * Added CI checks for lint and package dry-run validation
13
+
3
14
  ## V3.38.0
4
15
 
5
16
  * Support for binding to nested objects and arrays with `$bind`
@@ -340,4 +351,4 @@
340
351
  * Event pubsub
341
352
  * Used virtual-dom, virtual-dom-html
342
353
  * Three versions: zero, jsx and html
343
- * Demo apps
354
+ * Demo apps
package/README.md CHANGED
@@ -5,11 +5,17 @@
5
5
  [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][downloads-url] [![License][license-image]][license-url] [![twitter][twitter-badge]][twitter] [![Discord Chat][discord-image]][discord-invite]
6
6
 
7
7
 
8
- 🕵️ We now have rule / prompt files that you can use with your AI Coding Agent:
9
- - [For Components using JSX](ai/apprun.prompt.md)
10
- - [For Components using HTML](ai/apprun-html.prompt.md)
8
+ NEW Agent Skills for AppRun: We have developed a set of AI Agent Skills to assist with AppRun development. These skills cover various aspects of building applications with AppRun, including component design, state management, routing, and testing.
11
9
 
12
- 🚀 July 2025, We have started to improve the codebase using AI. See [whats new](#new) for details.
10
+
11
+ You can install the AppRun Skills for your AI agents with the following command:
12
+
13
+ ```bash
14
+ npx skills add yysun/apprun
15
+ ```
16
+
17
+
18
+ 🚀 July 2025, We have started to improve the codebase using AI - the spec-driven flow. The requirements, implementation plan and final results are stored in the `docs` folder.
13
19
 
14
20
  ## Introduction
15
21
 
@@ -153,15 +159,15 @@ Finally, you can use AppRun with [React](https://reactjs.org/). The `app.use_rea
153
159
  ```js
154
160
  import React from 'react'
155
161
  import ReactDOM from 'react-dom/client'
156
- import app from 'apprun';
157
- use_react(React, ReactDOM);
162
+ import { app } from 'apprun';
163
+ app.use_react(React, ReactDOM);
158
164
  ```
159
165
 
160
166
  The `app.use_render` function allows you to use a other render library for rendering the view. Enjoy the rich ecosystem of React.
161
167
 
162
168
  ```js
163
169
  import { render } from 'preact'
164
- import app from 'apprun';
170
+ import { app } from 'apprun';
165
171
  app.use_render(render);
166
172
  ```
167
173
 
@@ -176,7 +182,7 @@ AppRun is distributed on npm. To get it, run:
176
182
  npm install apprun
177
183
  ```
178
184
 
179
- When you want to do a rapid prototyping or demo, you can use AppRun directly in the browser without JSX or any build step. The `app`, `html` and `run` functions are available globally. The `html` is a HTML template from lit-html. The `run` function is a equivalent to the `$on` directive, which can be used to invoke state update functions.
185
+ When you want to do a rapid prototyping or demo, you can use AppRun directly in the browser without JSX or any build step. The `app`, `Component`, `on`, `customElement`, `trustedHTML`, `safeHTML`, `html`, `run`, and `svg` APIs are available globally in the script-tag build. The `html` and `svg` functions are lit templates. The `run` function is equivalent to the `$on` directive and invokes state update functions.
180
186
 
181
187
  ```js
182
188
  <html>
@@ -243,11 +249,13 @@ npm test
243
249
  ```
244
250
  Unit tests can serve as functional specifications.
245
251
 
246
- Finally, to build optimized js files to the dist folder, just run:
252
+ Finally, to build the generated package artifacts, run:
247
253
  ```sh
248
254
  npm run build
249
255
  ```
250
256
 
257
+ The build writes `dist`, `esm`, `jsx-runtime.js`, and the demo bundle. They are generated artifacts and are intentionally ignored in source commits. `npm pack --dry-run` runs the same build through `prepack` and verifies the files that will be published.
258
+
251
259
  Have fun and send pull requests.
252
260
 
253
261
  ## Contributors
@@ -286,4 +294,4 @@ Copyright (c) 2015-2025 Yiyi Sun
286
294
  [twitter-badge]: https://img.shields.io/twitter/url/https/github.com/yysun/apprun.svg?style=social
287
295
 
288
296
  [discord-image]: https://img.shields.io/discord/476903999023480842.svg
289
- [discord-invite]: https://discord.gg/CETyUdx
297
+ [discord-invite]: https://discord.gg/CETyUdx
package/apprun.d.ts CHANGED
@@ -29,48 +29,85 @@
29
29
  * - Added routing system types with ComponentRoute
30
30
  * - Better integration with external libraries
31
31
  * - Comprehensive options typing matching implementation
32
- * - Added proper deprecation warnings
32
+ * - Added trustedHTML and smaller script-tag browser global declarations
33
33
  * - Enhanced error handling and validation
34
34
  * - Added support for async generator and generator functions in Action types
35
+ * - Phase 3 removed public option `any` escape hatches and typed history options
35
36
  */
36
37
 
37
38
  import { TemplateResult } from 'lit-html';
38
39
 
40
+ type LitTemplateFunction = (strings: TemplateStringsArray, ...values: any[]) => TemplateResult;
41
+ type AppRunRunDirective = (...args: any[]) => any;
42
+
43
+ declare global {
44
+ var app: import('apprun').IApp;
45
+ var _AppRunVersions: string;
46
+ var Component: typeof import('apprun').Component;
47
+ var on: typeof import('apprun').on;
48
+ var customElement: typeof import('apprun').customElement;
49
+ var trustedHTML: typeof import('apprun').trustedHTML;
50
+ /** @deprecated Use trustedHTML() for caller-owned trusted markup. */
51
+ var safeHTML: typeof import('apprun').safeHTML;
52
+ var html: LitTemplateFunction;
53
+ var svg: LitTemplateFunction;
54
+ var run: AppRunRunDirective;
55
+
56
+ interface Window {
57
+ app: import('apprun').IApp;
58
+ _AppRunVersions: string;
59
+ Component: typeof import('apprun').Component;
60
+ on: typeof import('apprun').on;
61
+ customElement: typeof import('apprun').customElement;
62
+ trustedHTML: typeof import('apprun').trustedHTML;
63
+ /** @deprecated Use trustedHTML() for caller-owned trusted markup. */
64
+ safeHTML: typeof import('apprun').safeHTML;
65
+ html: LitTemplateFunction;
66
+ svg: LitTemplateFunction;
67
+ run: AppRunRunDirective;
68
+ }
69
+ }
70
+
39
71
  declare module 'apprun' {
40
72
 
41
73
  export type Element = HTMLElement | string;
74
+ export type HistoryOptions = boolean | { prev?: string; next?: string };
42
75
 
43
76
  export type State<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
44
77
 
45
78
  export type VNode = {
46
- tag: string | Function,
47
- props: {},
48
- children: Array<VNode | string>
79
+ tag: string | Function;
80
+ props: Record<string, any>;
81
+ children: Array<VNode | string>;
49
82
  };
50
83
 
51
84
  export type VDOM = false | string | VNode | Array<VNode | string> | TemplateResult;
52
85
  export type View<T> = (state: T) => VDOM | void;
53
86
  export type Action<T> = (state: T, ...p: any[]) => T | Promise<T> | void | AsyncGenerator<T> | Generator<T>;
54
- export type ActionDef<T, E> = (readonly [E, Action<T>, {}?]);
55
- export type Update<T, E = unknown> = ActionDef<T, E>[] | { [name: string]: Action<T> | {}[] } | (E | Action<T> | {})[];
87
+ export type ActionDef<T, E> = (readonly [E, Action<T>, EventOptions?]);
88
+ export type ActionUpdate<T> = Action<T> | [Action<T>, EventOptions?] | (Action<T> | EventOptions)[];
89
+ export type Update<T, E = unknown> = ActionDef<T, E>[] | { [name: string]: ActionUpdate<T> } | (E | Action<T> | EventOptions)[];
56
90
  export type Router = (url: string, ...args: any[]) => any;
57
91
 
58
92
  export type EventOptions = {
59
93
  once?: boolean;
60
94
  transition?: boolean;
61
95
  delay?: number;
62
- } | any;
96
+ global?: boolean;
97
+ event?: string;
98
+ [name: string]: any;
99
+ };
63
100
 
64
101
  export type ActionOptions = {
65
102
  render?: boolean;
66
- history?;
103
+ history?: HistoryOptions;
67
104
  global?: boolean;
68
105
  callback?: (state: any) => void;
69
106
  };
70
107
 
71
108
  export type MountOptions = {
72
109
  render?: boolean;
73
- history?;
110
+ history?: HistoryOptions;
74
111
  global_event?: boolean;
75
112
  route?: string;
76
113
  transition?: boolean;
@@ -78,11 +115,11 @@ declare module 'apprun' {
78
115
 
79
116
  export type AppStartOptions<T> = {
80
117
  render?: boolean;
81
- history?;
118
+ history?: HistoryOptions;
82
119
  transition?: boolean;
83
120
  route?: string;
84
121
  rendered?: (state: T) => void;
85
- mounted?: (props: any, children: any, state: T) => T;
122
+ mounted?: (props: any, children: any, state: T) => T | Promise<T> | void;
86
123
  };
87
124
 
88
125
  export type CustomElementOptions = {
@@ -106,9 +143,6 @@ declare module 'apprun' {
106
143
  run(name: string, ...args: any[]): number;
107
144
  runAsync(name: string, ...args: any[]): Promise<any[]>;
108
145
 
109
- /** @deprecated Use runAsync() instead. query() will be removed in a future version. */
110
- query(name: string, ...args: any[]): Promise<any[]>;
111
-
112
146
  start<T, E = unknown>(element?: Element | string, state?: State<T>, view?: View<T>, update?: Update<T, E>,
113
147
  options?: AppStartOptions<T>): Component<T, E>;
114
148
 
@@ -122,22 +156,24 @@ declare module 'apprun' {
122
156
  addComponents: (element: Element | string, components: ComponentRoute) => void;
123
157
 
124
158
  webComponent(name: string, componentClass: any, options?: CustomElementOptions): void;
159
+ trustedHTML(html: string): any[];
160
+ /** @deprecated Use trustedHTML() for caller-owned trusted markup. */
125
161
  safeHTML(html: string): any[];
126
162
  use_render(render: any, mode?: 0 | 1): void;
127
163
  use_react(React: any, ReactDOM: any): void;
128
164
  version: string;
129
165
  }
130
166
 
131
- export class Component<T = unknown, E = unknown> {
132
- constructor(state?: State<T>, view?: View<T>, update?: Update<T, E>, options?: any);
133
- readonly element: Element;
134
- protected state: State<T>;
167
+ export class Component<T = any, E = any> {
168
+ constructor(state?: State<T>, view?: View<T>, update?: Update<T, E>, options?: MountOptions);
169
+ readonly element: Element | null | undefined;
170
+ state: State<T>;
135
171
  view?: View<T>;
136
172
  update?: Update<T, E>;
137
173
 
138
174
  // Lifecycle hooks
139
175
  rendered?: (state: T) => void;
140
- mounted?: (props: any, children: any[], state: T) => T | void;
176
+ mounted?: (props: any, children: any[], state: T) => T | Promise<T> | void;
141
177
  unload?: (state: T) => void;
142
178
 
143
179
  // Component lifecycle methods
@@ -153,9 +189,6 @@ declare module 'apprun' {
153
189
  run(event: E, ...args: any[]): any;
154
190
  runAsync(event: E, ...args: any[]): Promise<any[]>;
155
191
 
156
- /** @deprecated Use runAsync() instead. query() will be removed in a future version. */
157
- query(event: E, ...args: any[]): Promise<any[]>;
158
-
159
192
  // Action management
160
193
  add_action(name: string, action: Action<T>, options?: ActionOptions): void;
161
194
  is_global_event(name: string): boolean;
@@ -177,10 +210,21 @@ declare module 'apprun' {
177
210
 
178
211
  export const ROUTER_EVENT: string;
179
212
  export const ROUTER_404_EVENT: string;
213
+ export const trustedHTML: (html: string) => any[];
214
+ /** @deprecated Use trustedHTML() for caller-owned trusted markup. */
180
215
  export const safeHTML: (html: string) => any[];
181
216
  export function Fragment(props: any, ...children: any[]): any[];
182
217
  }
183
218
 
219
+ declare module 'apprun/apprun-html' {
220
+ export * from 'apprun';
221
+ export { default } from 'apprun';
222
+ export const html: LitTemplateFunction;
223
+ export const svg: LitTemplateFunction;
224
+ export const run: AppRunRunDirective;
225
+ export const render: (element: Element | ShadowRoot, node: import('apprun').VDOM, component?: {}) => void;
226
+ }
227
+
184
228
  declare namespace app {
185
229
  namespace JSX {
186
230
  interface ElementAttributesProperty { props: {} }
@@ -210,4 +254,4 @@ declare module 'apprun/createState' {
210
254
  state: T,
211
255
  updater: (draft: Draft<T>) => void
212
256
  ): Promise<T> | T;
213
- }
257
+ }
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.apprun=n():e.apprun=n()}(this,(()=>(()=>{"use strict";var e={320:(e,n,t)=>{t.d(n,{Fragment:()=>o.FK,createElement:()=>o.n,render:()=>o.cJ,safeHTML:()=>o.t_});var o=t(593)},593:(e,n,t)=>{t.d(n,{FK:()=>V,n:()=>Y,t_:()=>Q,cJ:()=>J});var o={};t.r(o),t.d(o,{boolean:()=>a,booleanish:()=>s,commaOrSpaceSeparated:()=>h,commaSeparated:()=>d,number:()=>c,overloadedBoolean:()=>u,spaceSeparated:()=>p});var l=t(741);class r{constructor(e,n){this.attribute=n,this.property=e}}r.prototype.attribute="",r.prototype.booleanish=!1,r.prototype.boolean=!1,r.prototype.commaOrSpaceSeparated=!1,r.prototype.commaSeparated=!1,r.prototype.defined=!1,r.prototype.mustUseProperty=!1,r.prototype.number=!1,r.prototype.overloadedBoolean=!1,r.prototype.property="",r.prototype.spaceSeparated=!1,r.prototype.space=void 0;let i=0;const a=f(),s=f(),u=f(),c=f(),p=f(),d=f(),h=f();function f(){return 2**++i}const m=Object.keys(o);class g extends r{constructor(e,n,t,l){let r=-1;if(super(e,n),y(this,"space",l),"number"==typeof t)for(;++r<m.length;){const e=m[r];y(this,m[r],(t&o[e])===o[e])}}}function y(e,n,t){t&&(e[n]=t)}function v(e){return e.toLowerCase()}g.prototype.defined=!0;const b=/[A-Z]/g,w=/-[a-z]/g,k=/^data[-\w.:]+$/i;function _(e){return"-"+e.toLowerCase()}function S(e){return e.charAt(1).toUpperCase()}class C{constructor(e,n,t){this.normal=n,this.property=e,t&&(this.space=t)}}function A(e,n){const t={},o={};for(const n of e)Object.assign(t,n.property),Object.assign(o,n.normal);return new C(t,o,n)}function x(e){const n={},t={};for(const[o,l]of Object.entries(e.properties)){const r=new g(o,e.transform(e.attributes||{},o),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(o)&&(r.mustUseProperty=!0),n[o]=r,t[v(o)]=o,t[v(r.attribute)]=o}return new C(n,t,e.space)}C.prototype.normal={},C.prototype.property={},C.prototype.space=void 0;const E=x({properties:{ariaActiveDescendant:null,ariaAtomic:s,ariaAutoComplete:null,ariaBusy:s,ariaChecked:s,ariaColCount:c,ariaColIndex:c,ariaColSpan:c,ariaControls:p,ariaCurrent:null,ariaDescribedBy:p,ariaDetails:null,ariaDisabled:s,ariaDropEffect:p,ariaErrorMessage:null,ariaExpanded:s,ariaFlowTo:p,ariaGrabbed:s,ariaHasPopup:null,ariaHidden:s,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:p,ariaLevel:c,ariaLive:null,ariaModal:s,ariaMultiLine:s,ariaMultiSelectable:s,ariaOrientation:null,ariaOwns:p,ariaPlaceholder:null,ariaPosInSet:c,ariaPressed:s,ariaReadOnly:s,ariaRelevant:null,ariaRequired:s,ariaRoleDescription:p,ariaRowCount:c,ariaRowIndex:c,ariaRowSpan:c,ariaSelected:s,ariaSetSize:c,ariaSort:null,ariaValueMax:c,ariaValueMin:c,ariaValueNow:c,ariaValueText:null,role:null},transform:(e,n)=>"role"===n?n:"aria-"+n.slice(4).toLowerCase()});function P(e,n){return n in e?e[n]:n}function O(e,n){return P(e,n.toLowerCase())}const M=x({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:d,acceptCharset:p,accessKey:p,action:null,allow:null,allowFullScreen:a,allowPaymentRequest:a,allowUserMedia:a,alt:null,as:null,async:a,autoCapitalize:null,autoComplete:p,autoFocus:a,autoPlay:a,blocking:p,capture:null,charSet:null,checked:a,cite:null,className:p,cols:c,colSpan:null,content:null,contentEditable:s,controls:a,controlsList:p,coords:c|d,crossOrigin:null,data:null,dateTime:null,decoding:null,default:a,defer:a,dir:null,dirName:null,disabled:a,download:u,draggable:s,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:a,formTarget:null,headers:p,height:c,hidden:u,high:c,href:null,hrefLang:null,htmlFor:p,httpEquiv:p,id:null,imageSizes:null,imageSrcSet:null,inert:a,inputMode:null,integrity:null,is:null,isMap:a,itemId:null,itemProp:p,itemRef:p,itemScope:a,itemType:p,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:a,low:c,manifest:null,max:null,maxLength:c,media:null,method:null,min:null,minLength:c,multiple:a,muted:a,name:null,nonce:null,noModule:a,noValidate:a,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:a,optimum:c,pattern:null,ping:p,placeholder:null,playsInline:a,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:a,referrerPolicy:null,rel:p,required:a,reversed:a,rows:c,rowSpan:c,sandbox:p,scope:null,scoped:a,seamless:a,selected:a,shadowRootClonable:a,shadowRootDelegatesFocus:a,shadowRootMode:null,shape:null,size:c,sizes:null,slot:null,span:c,spellCheck:s,src:null,srcDoc:null,srcLang:null,srcSet:null,start:c,step:null,style:null,tabIndex:c,target:null,title:null,translate:null,type:null,typeMustMatch:a,useMap:null,value:s,width:c,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:p,axis:null,background:null,bgColor:null,border:c,borderColor:null,bottomMargin:c,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:a,declare:a,event:null,face:null,frame:null,frameBorder:null,hSpace:c,leftMargin:c,link:null,longDesc:null,lowSrc:null,marginHeight:c,marginWidth:c,noResize:a,noHref:a,noShade:a,noWrap:a,object:null,profile:null,prompt:null,rev:null,rightMargin:c,rules:null,scheme:null,scrolling:s,standby:null,summary:null,text:null,topMargin:c,valueType:null,version:null,vAlign:null,vLink:null,vSpace:c,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:a,disableRemotePlayback:a,prefix:null,property:null,results:c,security:null,unselectable:null},space:"html",transform:O}),L=x({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:h,accentHeight:c,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:c,amplitude:c,arabicForm:null,ascent:c,attributeName:null,attributeType:null,azimuth:c,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:c,by:null,calcMode:null,capHeight:c,className:p,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:c,diffuseConstant:c,direction:null,display:null,dur:null,divisor:c,dominantBaseline:null,download:a,dx:null,dy:null,edgeMode:null,editable:null,elevation:c,enableBackground:null,end:null,event:null,exponent:c,externalResourcesRequired:null,fill:null,fillOpacity:c,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:d,g2:d,glyphName:d,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:c,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:c,horizOriginX:c,horizOriginY:c,id:null,ideographic:c,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:c,k:c,k1:c,k2:c,k3:c,k4:c,kernelMatrix:h,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:c,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:c,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:c,overlineThickness:c,paintOrder:null,panose1:null,path:null,pathLength:c,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:p,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:c,pointsAtY:c,pointsAtZ:c,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:h,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:h,rev:h,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:h,requiredFeatures:h,requiredFonts:h,requiredFormats:h,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:c,specularExponent:c,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:c,strikethroughThickness:c,string:null,stroke:null,strokeDashArray:h,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:c,strokeOpacity:c,strokeWidth:null,style:null,surfaceScale:c,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:h,tabIndex:c,tableValues:null,target:null,targetX:c,targetY:c,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:h,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:c,underlineThickness:c,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:c,values:null,vAlphabetic:c,vMathematical:c,vectorEffect:null,vHanging:c,vIdeographic:c,version:null,vertAdvY:c,vertOriginX:c,vertOriginY:c,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:c,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:P}),T=x({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,n)=>"xlink:"+n.slice(5).toLowerCase()}),R=x({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:O}),D=x({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,n)=>"xml:"+n.slice(3).toLowerCase()}),j=A([E,M,T,R,D],"html"),U=A([E,L,T,R,D],"svg"),B="_props",N=new Map;function F(e,n,t){!function(e){return null!=e&&!1!==e&&""!==e&&(!0===e||("string"==typeof e?"false"!==e.toLowerCase()&&"0"!==e:Boolean(e)))}(t)?e.removeAttribute(n):e.setAttribute(n,n)}function I(e,n,t){try{e[n]=t}catch(o){W(e,n,t,!1)}}function W(e,n,t,o){if(null==t)return void e.removeAttribute(n);const l=String(t);if(o&&n.includes(":")){const[t]=n.split(":");"xlink"===t?e.setAttributeNS("http://www.w3.org/1999/xlink",n,l):e.setAttribute(n,l)}else e.setAttribute(n,l)}function H(e,n,t,o){if(l=e,i=n,document.activeElement===l?["selectionStart","selectionEnd","selectionDirection"].includes(i):"scrollTop"===i||"scrollLeft"===i||l instanceof HTMLMediaElement&&["currentTime","paused","playbackRate","volume"].includes(i))return;var l,i;if("style"===n){if(e.style.cssText&&(e.style.cssText=""),"string"==typeof t)e.style.cssText=t;else if(t&&"object"==typeof t)for(const n in t)e.style[n]!==t[n]&&(e.style[n]=t[n]);return}if("key"===n)return void(null!=t&&(e.key=t));if(n.startsWith("data-"))return void function(e,n,t){const o=(l=n.slice(5)).length<=1?l.toLowerCase():l.split("-").map(((e,n)=>0===n?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join("");var l;null==t?delete e.dataset[o]:e.dataset[o]=String(t)}(e,n,t);if(n.startsWith("on"))return void function(e,n,t){n.startsWith("on")&&(t&&"function"!=typeof t?"string"==typeof t&&(t?e.setAttribute(n,t):e.removeAttribute(n)):e[n]=t)}(e,n,t);if(!("INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&"SELECT"!==e.tagName||"value"!==n&&"selected"!==n&&"selectedIndex"!==n))return void I(e,n,t);if("INPUT"===e.tagName&&"checked"===n)return I(e,n,t),void F(e,n,t);const a=function(e,n){const t=`${e}:${n}`;let o=N.get(t);return void 0===o&&(o=function(e,n){const t=v(n);let o=n,l=r;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&"data"===t.slice(0,4)&&k.test(n)){if("-"===n.charAt(4)){const e=n.slice(5).replace(w,S);o="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=n.slice(4);if(!w.test(e)){let t=e.replace(b,_);"-"!==t.charAt(0)&&(t="-"+t),n="data"+t}}l=g}return new l(o,n)}(n?U:j,e)||null,N.set(t,o)),o}(n,o);a?a.boolean||a.overloadedBoolean?F(e,a.attribute,t):a.mustUseProperty&&!o?I(e,a.property,t):W(e,a.attribute,t,o):n.startsWith("aria-")||"role"===n?W(e,n,t,o):n in e||void 0!==e[n]?I(e,n,t):W(e,n,t,o)}function $(e){return/^[a-zA-Z_:][\w\-:.]*$/.test(e)&&!e.includes("<")&&!e.includes(">")&&!e.includes('"')&&!e.includes("'")}function z(e,n,t){const o=function(e,n){if(n&&(n.class=n.class||n.className,delete n.className),!e||0===Object.keys(e).length)return n||{};if(!n||0===Object.keys(n).length){const n={};return Object.keys(e).forEach((e=>n[e]=null)),n}const t={};return Object.keys(e).forEach((e=>{e in n||(t[e]=null)})),Object.keys(n).forEach((e=>t[e]=n[e])),t}(e[B]||{},n);e[B]=n||{},function(e,n,t,o){for(const t in n)$(t)&&H(e,t,n[t],o);n&&"function"==typeof n.ref&&window.requestAnimationFrame((()=>n.ref(e)))}(e,o,0,t)}function V(e,...n){return q(n)}function q(e){const n=[],t=e=>{null!=e&&""!==e&&!1!==e&&n.push("function"==typeof e||"object"==typeof e?e:`${e}`)};return e&&e.forEach((e=>{Array.isArray(e)?e.forEach((e=>t(e))):t(e)})),n}const K={};let X=0;function Y(e,n,...t){const o=q(t);if("string"==typeof e)return{tag:e,props:n,children:o};if(Array.isArray(e))return e;if(void 0===e&&t)return o;if(Object.getPrototypeOf(e).__isAppRunComponent)return{tag:e,props:n,children:o};if("function"==typeof e)return e(n,o);throw new Error(`Unknown tag in vdom ${e}`)}const J=(e,n,t={})=>{null!=n&&!1!==n&&function(e,n,t={}){if(null==n||!1===n)return;if(n=te(n,t),!e)return;const o="SVG"===e.nodeName;Array.isArray(n)?G(e,n,o):G(e,[n],o)}("string"==typeof e&&e?document.getElementById(e)||document.querySelector(e):e,n=(0,l.A)(n,t),t)};function Z(e,n,t){t=t||"svg"===n.tag,function(e,n){const t=e.nodeName,o=`${n.tag||""}`;return t.toUpperCase()===o.toUpperCase()}(e,n)?(G(e,n.children,t),z(e,n.props,t)):e.parentNode.replaceChild(ne(n,t),e)}function G(e,n,t){const o=e.childNodes?.length||0,l=n?.length||0,r=Math.min(o,l);for(let o=0;o<r;o++){const l=n[o],r=e.childNodes[o];if("string"==typeof l)r.textContent!==l&&(3===r.nodeType?r.nodeValue=l:e.replaceChild(ee(l),r));else if(l instanceof HTMLElement||l instanceof SVGElement)e.insertBefore(l,r);else{const n=l.props&&l.props.key;if(n)if(r.key===n)Z(e.childNodes[o],l,t);else{const i=K[n];i?(e.insertBefore(i,r),Z(e.childNodes[o],l,t)):e.replaceChild(ne(l,t),r)}else Z(e.childNodes[o],l,t)}}let i=e.childNodes?.length||0;for(;i>r;)e.removeChild(e.lastChild),i--;if(l>r){const o=document.createDocumentFragment();for(let e=r;e<n.length;e++)o.appendChild(ne(n[e],t));e.appendChild(o)}}const Q=e=>{const n=document.createElement("section");return n.insertAdjacentHTML("afterbegin",e),Array.from(n.children)};function ee(e){if(0===e?.indexOf("_html:")){const n=document.createElement("div");return n.insertAdjacentHTML("afterbegin",e.substring(6)),n}return document.createTextNode(e??"")}function ne(e,n){if(e instanceof HTMLElement||e instanceof SVGElement)return e;if("string"==typeof e)return ee(e);if(!e.tag||"function"==typeof e.tag)return ee(JSON.stringify(e));const t=(n=n||"svg"===e.tag)?document.createElementNS("http://www.w3.org/2000/svg",e.tag):document.createElement(e.tag);return z(t,e.props,n),e.children&&e.children.forEach((e=>t.appendChild(ne(e,n)))),e.props&&void 0!==e.props.key&&(t.key=e.props.key,K[e.props.key]=t,++X>=500&&(function(){if(!(Object.keys(K).length<=1e3))for(const[e,n]of Object.entries(K))n.isConnected||delete K[e]}(),X=0)),t}function te(e,n,t=0){if("string"==typeof e)return e;if(Array.isArray(e))return e.map((e=>te(e,n,t++)));let o=e;if(e&&"function"==typeof e.tag&&Object.getPrototypeOf(e.tag).__isAppRunComponent&&(o=function(e,n,t){const{tag:o,props:l,children:r}=e;let i=`_${t}`,a=l&&l.id;a?i=a:a=`_${t}${Date.now()}`;let s="section";l&&l.as&&(s=l.as,delete l.as),n.__componentCache||(n.__componentCache={});let u=n.__componentCache[i];if(u&&u instanceof o&&u.element)u.renderState(u.state);else{const e=document.createElement(s);u=n.__componentCache[i]=new o({...l,children:r}).mount(e,{render:!0})}if(u.mounted){const e=u.mounted(l,r,u.state);void 0!==e&&u.setState(e)}return z(u.element,l,!1),u.element}(e,n,t)),o&&Array.isArray(o.children)){const e=o.props?._component;if(e){let n=0;o.children=o.children.map((t=>te(t,e,n++)))}else o.children=o.children.map((e=>te(e,n,t++)))}return o}},634:(e,n,t)=>{function o(e){return e?.target instanceof HTMLElement?e.target:null}function l(e,n=document){try{return n.querySelector(e)}catch(n){return console.warn(`Invalid selector: ${e}`,n),null}}function r(e){try{return document.getElementById(e)}catch(n){return console.warn(`Error getting element by id: ${e}`,n),null}}t.d(n,{PB:()=>o,bV:()=>l,oP:()=>r})},672:(e,n,t)=>{t.d(n,{C:()=>l,a:()=>o});const o="3.38.0",l=`AppRun-${o}`},741:(e,n,t)=>{t.d(n,{A:()=>u});var o=t(859),l=t(634);const r=e=>{if(!e)return[];const n=[];let t="",o=!1,l="";for(let r=0;r<e.length;r++){const i=e[r];"["!==i||o?"]"===i&&o?(l?t=t.slice(1,-1):/^\d+$/.test(t)&&(t=parseInt(t,10)),n.push(t),t="",o=!1,l=""):'"'!==i&&"'"!==i||!o?"."!==i||o?t+=i:t&&(n.push(t),t=""):(l?i===l&&(l=""):l=i,t+=i):(t&&(n.push(t),t=""),o=!0)}return t&&n.push(t),n},i=(e,n)=>{if(!n)return e.state||"";const t=r(n),o=((e,n)=>{let t=e;for(const e of n){if(null==t)return;t=t[e]}return t})(e.state,t);return void 0!==o?o:""},a=(e,n,t)=>{if(!n)return void e.setState(t);const o=r(n),l=((e,n,t)=>{if(0===n.length)return t;const o={...e};let l=o;for(let e=0;e<n.length-1;e++){const t=n[e],o=n[e+1];null==l[t]?l[t]="number"==typeof o?[]:{}:Array.isArray(l[t])?l[t]=[...l[t]]:"object"==typeof l[t]&&(l[t]={...l[t]}),l=l[t]}return l[n[n.length-1]]=t,o})(e.state||{},o,t);e.setState(l)},s=(e,n)=>{if(Array.isArray(e))return e.map((e=>s(e,n)));{let{type:t,tag:r,props:u,children:c}=e;return r=r||t,c=c||u?.children,u&&Object.keys(u).forEach((e=>{e.startsWith("$")&&(((e,n,t,r)=>{if(e.startsWith("$on")){const t=n[e];if(e=e.substring(1),"boolean"==typeof t)n[e]=n=>r.run?r.run(e,n):o.A.run(e,n);else if("string"==typeof t)n[e]=e=>r.run?r.run(t,e):o.A.run(t,e);else if("function"==typeof t)n[e]=e=>r.setState(t(r.state,e));else if(Array.isArray(t)){const[l,...i]=t;"string"==typeof l?n[e]=e=>r.run?r.run(l,...i,e):o.A.run(l,...i,e):"function"==typeof l&&(n[e]=e=>r.setState(l(r.state,...i,e)))}}else if("$bind"===e){const o=n.type||"text",s="string"==typeof n[e]?n[e]:n.name;if("input"===t)switch(o){case"checkbox":n.checked=i(r,s),n.onclick=e=>{const n=(0,l.PB)(e);n&&a(r,s||n.name,n.checked)};break;case"radio":n.checked=i(r,s)===n.value,n.onclick=e=>{const n=(0,l.PB)(e);n&&a(r,s||n.name,n.value)};break;case"number":case"range":n.value=i(r,s),n.oninput=e=>{const n=(0,l.PB)(e);n&&a(r,s||n.name,Number(n.value))};break;default:n.value=i(r,s),n.oninput=e=>{const n=(0,l.PB)(e);n&&a(r,s||n.name,n.value)}}else"select"===t?(n.value=i(r,s),n.onchange=e=>{const n=(0,l.PB)(e);n&&!n.multiple&&a(r,s||n.name,n.value)}):"option"===t?(n.selected=i(r,s),n.onclick=e=>{const n=(0,l.PB)(e);n&&a(r,s||n.name,n.selected)}):"textarea"===t&&(n.innerHTML=i(r,s),n.oninput=e=>{const n=(0,l.PB)(e);n&&a(r,s||n.name,n.value)})}else o.A.run("$",{key:e,tag:t,props:n,component:r})})(e,u,r,n),delete u[e])})),c&&s(c,n),e}},u=s},859:(e,n,t)=>{t.d(n,{A:()=>s,q:()=>l});var o=t(672);class l{constructor(){this._events={}}on(e,n,t={}){this._events[e]=this._events[e]||[],this._events[e].push({fn:n,options:t})}off(e,n){const t=this._events[e]||[];this._events[e]=t.filter((e=>e.fn!==n))}find(e){return this._events[e]}run(e,...n){const t=this.getSubscribers(e,this._events);return console.assert(t&&t.length>0,"No subscriber for event: "+e),t.forEach((t=>{const{fn:o,options:l}=t;if(!o||"function"!=typeof o)return console.error(`AppRun event handler for '${e}' is not a function:`,o),!1;if(l.delay)this.delay(e,o,n,l);else try{Object.keys(l).length>0?o.apply(this,[...n,l]):o.apply(this,n)}catch(n){console.error(`Error in event handler for '${e}':`,n)}return!t.options.once})),t.length}once(e,n,t={}){this.on(e,n,{...t,once:!0})}delay(e,n,t,o){o._t&&clearTimeout(o._t),o._t=setTimeout((()=>{clearTimeout(o._t);try{Object.keys(o).length>0?n.apply(this,[...t,o]):n.apply(this,t)}catch(n){console.error(`Error in delayed event handler for '${e}':`,n)}}),o.delay)}runAsync(e,...n){const t=this.getSubscribers(e,this._events);console.assert(t&&t.length>0,"No subscriber for event: "+e);const o=t.map((t=>{const{fn:o,options:l}=t;if(!o||"function"!=typeof o)return console.error(`AppRun async event handler for '${e}' is not a function:`,o),Promise.resolve(null);try{return Object.keys(l).length>0?o.apply(this,[...n,l]):o.apply(this,n)}catch(n){return console.error(`Error in async event handler for '${e}':`,n),Promise.reject(n)}}));return Promise.all(o)}query(e,...n){return console.warn("app.query() is deprecated. Use app.runAsync() instead."),this.runAsync(e,...n)}getSubscribers(e,n){const t=n[e]||[];return n[e]=t.filter((e=>!e.options.once)),Object.keys(n).filter((n=>n.endsWith("*")&&e.startsWith(n.replace("*","")))).sort(((e,n)=>n.length-e.length)).forEach((o=>t.push(...n[o].map((n=>({...n,options:{...n.options,event:e}})))))),t}}const r=o.C;let i;const a="undefined"!=typeof window?window:void 0!==t.g?t.g:"undefined"!=typeof self?self:{};a.app&&a._AppRunVersions?i=a.app:(i=new l,a.app=i,a._AppRunVersions=r);const s=i},971:(e,n,t)=>{t.d(n,{Component:()=>d,app:()=>C});var o=t(859),l=t(320);const r=(e,n={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(n.observedAttributes||[]).map((e=>e.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const t=n||{};this._shadowRoot=t.shadow?this.attachShadow({mode:"open"}):this;const o=t.observedAttributes||[],l=o.reduce(((e,n)=>{const t=n.toLowerCase();return t!==n&&(e[t]=n),e}),{});this._attrMap=e=>l[e]||e;const r={};Array.from(this.attributes).forEach((e=>r[this._attrMap(e.name)]=e.value)),o.forEach((e=>{void 0!==this[e]&&(r[e]=this[e]),Object.defineProperty(this,e,{get:()=>r[e],set(n){this.attributeChangedCallback(e,r[e],n)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const n=this.children?Array.from(this.children):[];if(this._component=new e({...r,children:n}).mount(this._shadowRoot,t),this._component._props=r,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const e=this._component.mounted(r,n,this._component.state);void 0!==e&&(this._component.state=e)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==t.render&&this._component.run(".")}))}}disconnectedCallback(){this._component?.unload?.(),this._component?.unmount?.(),this._component=null}attributeChangedCallback(e,t,o){if(this._component){const l=this._attrMap(e);this._component._props[l]=o,this._component.run("attributeChanged",l,t,o),o!==t&&!1!==n.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}},i=(e,n,t)=>{"undefined"!=typeof customElements&&customElements.define(e,r(n,t))},a={meta:new WeakMap,defineMetadata(e,n,t){this.meta.has(t)||this.meta.set(t,{}),this.meta.get(t)[e]=n},getMetadataKeys(e){return e=Object.getPrototypeOf(e),this.meta.get(e)?Object.keys(this.meta.get(e)):[]},getMetadata(e,n){return n=Object.getPrototypeOf(n),this.meta.get(n)?this.meta.get(n)[e]:null}};var s=t(741),u=t(634);const c=e=>e,p=o.A;class d{renderState(e,n=null){if(!this.view)return;let t=n||this.view(e);if(p.debug&&p.run("debug",{component:this,_:t?".":"-",state:e,vdom:t,el:this.element}),"object"!=typeof document)return;const o="string"==typeof this.element&&this.element?(0,u.oP)(this.element)||(0,u.bV)(this.element):this.element;if(!o)return void console.warn(`Component element not found: ${this.element}`);const l="_c";this.unload?o._component===this&&o.getAttribute(l)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),o.setAttribute(l,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((e=>{e[0].oldValue!==this.tracking_id&&document.body.contains(o)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[l]}))):o.removeAttribute&&o.removeAttribute(l),o._component=this,!n&&t&&(t=(0,s.A)(t,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>p.render(o,t,this))):p.render(o,t,this)),this.rendered&&this.rendered(this.state)}setState(e,n={render:!0,history:!1}){const t=e;if(t?.[Symbol.asyncIterator])this.setState((async e=>{try{for(;;){const{value:t,done:o}=await e.next();if(o)break;this.setState(t,n)}}catch(e){console.error("Error in async iterator:",e)}})(t[Symbol.asyncIterator]()),n);else if(t?.[Symbol.iterator]&&"function"==typeof t.next)for(const e of t)this.setState(e,n);else if(e&&e instanceof Promise)Promise.resolve(e).then((t=>{this.setState(t,n),this._state=e}));else{if(this._state=e,null==e)return;this.state=e,!1!==n.render&&(n.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(e))):this.renderState(e)),!1!==n.history&&this.enable_history&&(this._history=[...this._history,e],this._history_idx=this._history.length-1),"function"==typeof n.callback&&n.callback(this.state)}}constructor(e,n,t,l){this.state=e,this.view=n,this.update=t,this.options=l,this._app=new o.q,this._actions=[],this._global_events=[],this._history=[],this._history_idx=-1,this._history_prev=()=>{this._history_idx--,this._history_idx>=0?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=0},this._history_next=()=>{this._history_idx++,this._history_idx<this._history.length?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=this._history.length-1},this.start=(e=null,n)=>{if(this.mount(e,{render:!0,...n}),this.mounted&&"function"==typeof this.mounted){const e=this.mounted({},[],this.state);void 0!==e&&this.setState(e)}return this}}mount(e=null,n){return console.assert(!this.element,"Component already mounted."),this.options=n={...this.options,...n},this.element=e,this.global_event=n.global_event,this.enable_history=!!n.history,this.enable_history&&(this.on(n.history.prev||"history-prev",this._history_prev),this.on(n.history.next||"history-next",this._history_next)),n.route&&(this.update=this.update||{},this.update[n.route]||(this.update[n.route]=c)),this.add_actions(),this.state=this.state??this.model??{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!n.render,history:!0}),p.debug&&p.find("debug-create-component")?.length&&p.run("debug-create-component",this),this}is_global_event(e){return e&&(this.global_event||this._global_events.indexOf(e)>=0||e.startsWith("#")||e.startsWith("/")||e.startsWith("@"))}add_action(e,n,t={}){n&&"function"==typeof n?(t.global&&this._global_events.push(e),this.on(e,((...o)=>{p.debug&&p.run("debug",{component:this,_:">",event:e,p:o,current_state:this.state,options:t});try{const l=n(this.state,...o);p.debug&&p.run("debug",{component:this,_:"<",event:e,p:o,newState:l,state:this.state,options:t}),this.setState(l,t)}catch(n){console.error(`Error in component action '${e}':`,n),p.debug&&p.run("debug",{component:this,_:"!",event:e,p:o,error:n,state:this.state,options:t})}}),t)):console.warn(`Component action for '${e}' is not a valid function:`,n)}add_actions(){const e=this.update||{};a.getMetadataKeys(this).forEach((n=>{if(n.startsWith("apprun-update:")){const t=a.getMetadata(n,this);e[t.name]=[this[t.key].bind(this),t.options]}}));const n={};Array.isArray(e)?e.forEach((e=>{const[t,o,l]=e;t.toString().split(",").forEach((e=>n[e.trim()]=[o,l]))})):Object.keys(e).forEach((t=>{const o=e[t];("function"==typeof o||Array.isArray(o))&&t.split(",").forEach((e=>n[e.trim()]=o))})),n["."]||(n["."]=c),Object.keys(n).forEach((e=>{const t=n[e];"function"==typeof t?this.add_action(e,t):Array.isArray(t)&&this.add_action(e,t[0],t[1])}))}run(e,...n){if(this.state instanceof Promise)return Promise.resolve(this.state).then((t=>{this.state=t,this.run(e,...n)}));{const t=e.toString();return this.is_global_event(t)?p.run(t,...n):this._app.run(t,...n)}}on(e,n,t){const o=e.toString();return this._actions.push({name:o,fn:n}),this.is_global_event(o)?p.on(o,n,t):this._app.on(o,n,t)}runAsync(e,...n){const t=e.toString();return this.is_global_event(t)?p.runAsync(t,...n):this._app.runAsync(t,...n)}query(e,...n){return console.warn("component.query() is deprecated. Use component.runAsync() instead."),this.runAsync(e,...n)}unmount(){this.observer?.disconnect(),this._actions.forEach((e=>{const{name:n,fn:t}=e;this.is_global_event(n)?p.off(n,t):this._app.off(n,t)}))}}function h(){const e=o.A.find("#");if(e&&e.length>0)return o.A.run("#"),void o.A.run(m,"#");const n=o.A.find("/");if(n&&n.length>0)return o.A.run("/"),void o.A.run(m,"/");const t=o.A.find("#/");if(t&&t.length>0)return o.A.run("#/"),void o.A.run(m,"#/");console.warn("No subscribers for event: "),o.A.run(g,""),o.A.run(m,"")}d.__isAppRunComponent=!0;const f=(e,...n)=>{if(!e||e===m||e===g)return;const t=o.A.find(e);t&&0!==t.length?o.A.run(e,...n):(console.warn(`No subscribers for event: ${e}`),o.A.run(g,e,...n)),o.A.run(m,e,...n)},m="//",g="///",y=e=>{o.A.lastUrl!==e&&(o.A.lastUrl=e,function(e){if(!e)return void h();e=function(e){return e&&"/"!==e&&"#"!==e&&"#/"!==e&&e.endsWith("/")?e.slice(0,-1):e}(e);const n=o.A.basePath;n&&(e=function(e,n){if(!n||"/"===n||""===n)return e;const t=n.startsWith("/")?n:"/"+n;if(e.startsWith(t)){const n=e.substring(t.length);return n.startsWith("/")?n:"/"+n}return e}(e,n));const t=function(e){return e?e.startsWith("#/")?e.substring(2).split("/"):e.startsWith("#")||e.startsWith("/")?e.substring(1).split("/"):e.split("/"):[]}(e);let l;!function(e){const n=e.filter(Boolean);n.length>11&&console.warn(`Deep route hierarchy detected: ${n.join("/")} (${n.length} levels)`)}(t),l=e.startsWith("#/")?"hash-slash":e.startsWith("#")?"hash":e.startsWith("/")?"path":"non-prefixed";const r=function(e,n){const t=[];for(let o=e.length;o>0;o--){const l=e.slice(0,o);let r="";switch(n){case"path":r="/"+l.join("/");break;case"hash":r="#"+l.join("/");break;case"hash-slash":r="#/"+l.join("/");break;case"non-prefixed":r=l.join("/")}t.push(r)}return t}(t,l),i=function(e,n){for(let t=0;t<e.length;t++){const l=e[t],r=o.A.find(l);if(r&&r.length>0){const o=e.length-t;return{eventName:l,parameters:n.slice(o)}}}return null}(r,t);if(i)f(i.eventName,...i.parameters);else if(r.length>0){const n=r[r.length-1];console.warn(`No subscribers for event: ${n}`),o.A.run(g,e),o.A.run(m,e)}else h()}(e))};function v(e){return e&&"object"==typeof e&&"function"==typeof e.mount}function b(e){return"function"==typeof e&&e.prototype&&e.prototype.constructor===e&&(void 0!==e.prototype.mount||void 0!==e.prototype.state||void 0!==e.prototype.view)}function w(e){return"function"==typeof e&&!b(e)}async function k(e,n=3){let t=e,o=0;for(;w(t)&&o<n;)try{const e=await t();if(e===t)break;t=e,o++}catch(e){console.error(`Error executing component function: ${e}`);break}return t}const _=async(e,n)=>{for(const[t,l]of Object.entries(n))if(l&&t)if(v(l)){const n={route:t};l.mount(e,n)}else if(b(l)){const n={route:t};(new l).mount(e,n)}else if(w(l)){let n=await k(l);if(v(n)){const o={route:t};n.mount(e,o);continue}if(b(n)){const o={route:t};(new n).mount(e,o);continue}o.A.on(t,((...n)=>{const t=l(...n);if("string"!=typeof e||(e=document.querySelector(e)))return o.A.render(e,t);console.error(`Element not found: ${e}`)}))}else console.error("Invalid component: component must be a class, instance, or function that returns a class/instance");else console.error(`Invalid component configuration: component=${l}, route=${t}`)};var S=t(672);const C=o.A;if(!C.start){C.version=S.a,C.h=C.createElement=l.createElement,C.render=l.render,C.Fragment=l.Fragment,C.webComponent=i,C.safeHTML=l.safeHTML,C.start=(e,n,t,o,l)=>{const r={render:!0,global_event:!0,...l},i=new d(n,t,o);return l&&l.rendered&&(i.rendered=l.rendered),l&&l.mounted&&(i.mounted=l.mounted),i.start(e,r),i},C.query=C.query||C.runAsync;const e=e=>{};if(C.on("/",e),C.on("debug",(n=>e)),C.on(m,e),C.on(g,e),C.route=y,C.on("route",(e=>C.route&&C.route(e))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{const e=document.body.hasAttribute("apprun-no-init")||C["no-init-route"]||!1,n=C.find("#")||C.find("#/")||!1;window.addEventListener("hashchange",(()=>y(location.hash))),window.addEventListener("popstate",(()=>y(location.pathname))),n?!e&&y(location.hash):(!e&&(()=>{const e=C.basePath||"";let n=location.pathname;e&&n.startsWith(e)&&(n=n.substring(e.length),n.startsWith("/")||(n="/"+n)),y(n)})(),document.body.addEventListener("click",(e=>{const n=e.target;if(!n)return;const t="A"===n.tagName?n:n.closest("a");if(t&&t.origin===location.origin&&t.pathname){e.preventDefault();const n=(C.basePath||"")+t.pathname;history.pushState(null,"",n),y(t.pathname)}})))})),"object"==typeof window){const e=window;e.Component=d,e._React=e.React,e.React=C,e.on=function(e,n={}){return function(t,o){const l=e?e.toString():o;a.defineMetadata(`apprun-update:${l}`,{name:l,key:o,options:n},t)}},e.customElement=function(e,n){return function(t){return i(e,t,n),t}},e.safeHTML=l.safeHTML}C.use_render=(e,n=0)=>{C.render=0===n?(n,t)=>e(t,n):(n,t)=>e(n,t)},C.use_react=(e,n)=>{if(e&&n)if("function"==typeof e.createElement)if(e.Fragment)if(C.h=C.createElement=e.createElement,C.Fragment=e.Fragment,e.version&&e.version.startsWith("18")){if(!n.createRoot||"function"!=typeof n.createRoot)return void console.error("AppRun use_react: ReactDOM.createRoot not found in React 18+");C.render=(e,t)=>{e&&void 0!==t&&(e._root||(e._root=n.createRoot(e)),e._root.render(t))}}else{if(!n.render||"function"!=typeof n.render)return void console.error("AppRun use_react: ReactDOM.render not found in legacy React");C.render=(e,t)=>n.render(t,e)}else console.error("AppRun use_react: Invalid React object - Fragment not found");else console.error("AppRun use_react: Invalid React object - createElement method not found");else console.error("AppRun use_react: React and ReactDOM parameters are required")},C.addComponents=_}}},n={};function t(o){var l=n[o];if(void 0!==l)return l.exports;var r=n[o]={exports:{}};return e[o](r,r.exports,t),r.exports}t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.r(o);var l=t(971);class r extends l.Component{constructor(){super(...arguments),this.view=({code:e,hide_code:n})=>l.app.h(l.app.Fragment,null,l.app.h("style",null,"\n.CodeMirror, .apprun-play iframe {\n height: 100%;\n border: dotted gray 1px;\n}\n\n.apprun-play {\n height: 100%;\n display: flex;\n font-size: 1.1rem;\n}\n\n.apprun-play .col {\n margin: 2px;\n}\n\n.apprun-play .editor, .apprun-play .preview {\n width: 100%;\n height: 100%;\n}\n"),n?l.app.h("div",{class:"apprun-play"},l.app.h("iframe",{class:"preview"})):l.app.h("div",{class:"apprun-play"},l.app.h("div",{class:"col",style:"width:75%"},l.app.h("textarea",{class:"editor"},e)),l.app.h("div",{class:"col",style:"flex:1"},l.app.h("iframe",{class:"preview"})))),this.mounted=e=>{const n=this.element,t=e["code-id"],o=e["hide-code"],l=e["code-width"];let r;r=t?document.getElementById(t):n.previousElementSibling||n.parentElement.previousElementSibling;const i=r?.innerText||r?.value||n.textContent;return r&&(r.style.display="none"),{code:i,hide_code:o,code_width:l}},this.rendered=({code:e,hide_code:n,code_width:t})=>{const o=this.element,l=o.querySelector(".apprun-play .editor");let r=o.querySelector(".apprun-play .preview");if(!r||!l)return;const i=e=>{const n=r.cloneNode();r.parentNode?.replaceChild(n,r),r=n;const t=r.contentWindow?.document;t&&(t.open(),e.indexOf("<html")>=0?t.write(e):t.write((e=>`<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <meta http-equiv="X-UA-Compatible" content="ie=edge">\n <title>AppRun Playground</title>\n <style>\n body {\n font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;\n margin: 2em;\n }\n </style>\n <script src="https://cdn.jsdelivr.net/npm/typescript@latest"><\/script>\n <script src="dist/apprun-html.js"><\/script>\n</head>\n<body>\n<pre id="code" style="display:none">${(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"))(e)}</pre>\n<script type="module">\nconst code = document.getElementById('code').innerText;\nconst compiled = ts.transpileModule(code, {\n compilerOptions: {\n "jsx": "react",\n "jsxFactory": "app.h",\n "jsxFragmentFactory": "app.Fragment",\n "target": "es2020",\n "module": "esnext",\n },\n reportDiagnostics: true,\n});\n\nif (compiled.diagnostics && compiled.diagnostics.length) {\n const pre = document.createElement('pre');\n pre.style = 'font-size: 10px;';\n pre.innerText = compiled.diagnostics.map(d => {\n const start = d.start;\n const end = d.start + d.length;\n const line = code.substring(0, end).split('\\n').length;\n const column = code.substring(0, end).split('\\n').pop().length;\n return \`Line: \${line}, Column: \${column}, \${d.messageText}\`;\n }).join('\\n');\n document.body.appendChild(pre);\n} else {\n window.onerror = function () {\n const pre = document.createElement('pre');\n pre.style = 'font-size: 10px;';\n pre.innerText = compiled.outputText;;\n document.body.appendChild(pre);\n };\n const script = document.createElement('script');\n script.type = 'module';\n script.text = compiled.outputText;\n document.body.appendChild(script);\n}\n<\/script>\n</body>\n</html>`)(e)),t.close())};if(e&&i(e),!n&&l)if(t&&(l.parentElement.style.width=t),"undefined"==typeof CodeMirror)l.onkeyup=()=>i(l.value);else{const n=CodeMirror.fromTextArea(l,{lineNumbers:!0,mode:"jsx"});n.setValue(e),n.on("change",(e=>i(e.getValue())))}}}}return l.app.webComponent("apprun-code",r),o})()));
1
+ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.apprun=n():e.apprun=n()}(this,(()=>(()=>{"use strict";var e={9:(e,n,t)=>{t.d(n,{EM:()=>a,W9:()=>l,on:()=>r});var o=t(436);const l={meta:new WeakMap,defineMetadata(e,n,t){this.meta.has(t)||this.meta.set(t,{}),this.meta.get(t)[e]=n},getMetadataKeys(e){return e=Object.getPrototypeOf(e),this.meta.get(e)?Object.keys(this.meta.get(e)):[]},getMetadata(e,n){return n=Object.getPrototypeOf(n),this.meta.get(n)?this.meta.get(n)[e]:null}};function r(e,n={}){return function(t,o){const r=e?e.toString():o;l.defineMetadata(`apprun-update:${r}`,{name:r,key:o,options:n},t)}}function a(e,n){return function(t){return(0,o.A)(e,t,n),t}}},18:(e,n,t)=>{t.r(n),t.d(n,{boolean:()=>l,booleanish:()=>r,commaOrSpaceSeparated:()=>c,commaSeparated:()=>u,number:()=>i,overloadedBoolean:()=>a,spaceSeparated:()=>s});let o=0;const l=p(),r=p(),a=p(),i=p(),s=p(),u=p(),c=p();function p(){return 2**++o}},72:(e,n,t)=>{t.d(n,{z:()=>r});var o=t(259),l=t(530);const r=(0,o.v)({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:l._})},91:(e,n,t)=>{t.d(n,{u:()=>g});var o=t(859),l=t(9),r=t(741),a=t(634);const i=e=>e,s=o.A;let u=0;const c="_c",p=new Map;let d=null;function h(){0===p.size&&d&&(d.disconnect(),d=null)}function m(e){const n=p.get(e);n&&(p.delete(e),n.component.unload?.(n.component.state),h())}function f(e){e&&(p.delete(e),h())}class g{renderState(e,n=null){if(!this.view)return;let t=n||this.view(e);if(s.debug&&s.run("debug",{component:this,_:t?".":"-",state:e,vdom:t,el:this.element}),"object"!=typeof document)return;const o="string"==typeof this.element&&this.element?(0,a.oP)(this.element)||(0,a.bV)(this.element):this.element;o?(this.unload?o._component===this&&o.getAttribute(c)===this.tracking_id||(this.tracking_element&&this.tracking_element!==o&&f(this.tracking_element),this.tracking_id=(++u).toString(36),o.setAttribute(c,this.tracking_id),this.tracking_element=o,function(e,n,t){const o=p.get(n);o&&o.component!==e&&m(n),p.set(n,{component:e,tracking_id:t}),!d&&"undefined"!=typeof MutationObserver&&"object"==typeof document&&document.body&&(d=new MutationObserver((e=>{e.forEach((e=>{if("attributes"===e.type){const n=e.target,t=p.get(n);t&&e.oldValue===t.tracking_id&&m(n)}else"childList"===e.type&&Array.from(p.keys()).forEach((e=>{document.body.contains(e)||m(e)}))}))})),d.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[c]}))}(this,o,this.tracking_id)):(f(this.tracking_element),this.tracking_element=null,o.removeAttribute&&o.removeAttribute(c)),o._component=this,!n&&t&&(t=(0,r.A)(t,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>s.render(o,t,this))):s.render(o,t,this)),this.rendered&&this.rendered(this.state)):console.warn(`Component element not found: ${this.element}`)}setState(e,n={render:!0,history:!1}){const t=e;if(t?.[Symbol.asyncIterator])this.setState((async e=>{try{for(;;){const{value:t,done:o}=await e.next();if(o)break;this.setState(t,n)}}catch(e){console.error("Error in async iterator:",e)}})(t[Symbol.asyncIterator]()),n);else if(t?.[Symbol.iterator]&&"function"==typeof t.next)for(const e of t)this.setState(e,n);else if(e&&e instanceof Promise){const t=e;this._pending_state=t,Promise.resolve(t).then((e=>{this._pending_state===t&&(this._pending_state=null,this.setState(e,n))}))}else{if(this._state=e,null==e)return;this._pending_state=null,this.state=e,!1!==n.render&&(n.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(e))):this.renderState(e)),!1!==n.history&&this.enable_history&&(this._history=[...this._history,e],this._history_idx=this._history.length-1),"function"==typeof n.callback&&n.callback(this.state)}}constructor(e,n,t,l={}){this.state=e,this.view=n,this.update=t,this.options=l,this._app=new o.q,this._actions=[],this._global_events=[],this._history=[],this._history_idx=-1,this.enable_history=!1,this.global_event=!1,this.tracking_element=null,this._history_prev=()=>{this._history_idx--,this._history_idx>=0?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=0},this._history_next=()=>{this._history_idx++,this._history_idx<this._history.length?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=this._history.length-1},this.start=(e=null,n)=>{if(this.mount(e,{render:!0,...n}),this.mounted&&"function"==typeof this.mounted){const e=this.mounted({},[],this.state);void 0!==e&&this.setState(e)}return this}}mount(e=null,n){if(console.assert(!this.element,"Component already mounted."),this.options=n={...this.options,...n},this.element=e,this.global_event=n.global_event,this.enable_history=!!n.history,this.enable_history){const e=function(e){return"object"==typeof e&&null!==e?e:{}}(n.history);this.on(e.prev||"history-prev",this._history_prev),this.on(e.next||"history-next",this._history_next)}return n.route&&(this.update=this.update||{},this.update[n.route]||(this.update[n.route]=i)),this.add_actions(),this.state=this.state??this.model??{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!n.render,history:!0}),s.debug&&s.find("debug-create-component")?.length&&s.run("debug-create-component",this),this}is_global_event(e){return e&&(this.global_event||this._global_events.indexOf(e)>=0||e.startsWith("#")||e.startsWith("/")||e.startsWith("@"))}add_action(e,n,t={}){n&&"function"==typeof n?(t.global&&this._global_events.push(e),this.on(e,((...o)=>{s.debug&&s.run("debug",{component:this,_:">",event:e,p:o,current_state:this.state,options:t});try{const l=n(this.state,...o);s.debug&&s.run("debug",{component:this,_:"<",event:e,p:o,newState:l,state:this.state,options:t}),this.setState(l,t)}catch(n){const l={event:e,error:n,component:this,state:this.state,args:o,phase:"component"};s.find("error")?.length?s.run("error",l):console.error(`Error in component action '${e}':`,n),s.debug&&s.run("debug",{component:this,_:"!",event:e,p:o,error:n,state:this.state,options:t})}}),t)):console.warn(`Component action for '${e}' is not a valid function:`,n)}add_actions(){const e=this.update||{};l.W9.getMetadataKeys(this).forEach((n=>{if(n.startsWith("apprun-update:")){const t=l.W9.getMetadata(n,this);e[t.name]=[this[t.key].bind(this),t.options]}}));const n={};Array.isArray(e)?e.forEach((e=>{const[t,o,l]=e;t.toString().split(",").forEach((e=>n[e.trim()]=[o,l]))})):Object.keys(e).forEach((t=>{const o=e[t];("function"==typeof o||Array.isArray(o))&&t.split(",").forEach((e=>n[e.trim()]=o))})),n["."]||(n["."]=i),Object.keys(n).forEach((e=>{const t=n[e];"function"==typeof t?this.add_action(e,t):Array.isArray(t)&&this.add_action(e,t[0],t[1])}))}run(e,...n){if(this.state instanceof Promise)return Promise.resolve(this.state).then((t=>{this.state=t,this.run(e,...n)}));{const t=e.toString();return this.is_global_event(t)?s.run(t,...n):this._app.run(t,...n)}}on(e,n,t){const o=e.toString();return this._actions.push({name:o,fn:n}),this.is_global_event(o)?s.on(o,n,t):this._app.on(o,n,t)}runAsync(e,...n){const t=e.toString();return this.is_global_event(t)?s.runAsync(t,...n):this._app.runAsync(t,...n)}unmount(){f(this.tracking_element),this.tracking_element=null,this._actions.forEach((e=>{const{name:n,fn:t}=e;this.is_global_event(n)?s.off(n,t):this._app.off(n,t)}))}}g.__isAppRunComponent=!0},147:(e,n,t)=>{t.d(n,{E:()=>a});var o=t(627),l=t(18);const r=Object.keys(l);class a extends o.R{constructor(e,n,t,o){let a=-1;if(super(e,n),i(this,"space",o),"number"==typeof t)for(;++a<r.length;){const e=r[a];i(this,r[a],(t&l[e])===l[e])}}}function i(e,n,t){t&&(e[n]=t)}a.prototype.defined=!0},176:(e,n,t)=>{t.d(n,{S:()=>o});class o{constructor(e,n,t){this.normal=n,this.property=e,t&&(this.space=t)}}o.prototype.normal={},o.prototype.property={},o.prototype.space=void 0},259:(e,n,t)=>{t.d(n,{v:()=>a});var o=t(457),l=t(147),r=t(176);function a(e){const n={},t={};for(const[r,a]of Object.entries(e.properties)){const i=new l.E(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),n[r]=i,t[(0,o.S)(r)]=r,t[(0,o.S)(i.attribute)]=r}return new r.S(n,t,e.space)}},277:(e,n,t)=>{t.d(n,{a:()=>r});var o=t(259),l=t(18);const r=(0,o.v)({properties:{ariaActiveDescendant:null,ariaAtomic:l.booleanish,ariaAutoComplete:null,ariaBusy:l.booleanish,ariaChecked:l.booleanish,ariaColCount:l.number,ariaColIndex:l.number,ariaColSpan:l.number,ariaControls:l.spaceSeparated,ariaCurrent:null,ariaDescribedBy:l.spaceSeparated,ariaDetails:null,ariaDisabled:l.booleanish,ariaDropEffect:l.spaceSeparated,ariaErrorMessage:null,ariaExpanded:l.booleanish,ariaFlowTo:l.spaceSeparated,ariaGrabbed:l.booleanish,ariaHasPopup:null,ariaHidden:l.booleanish,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:l.spaceSeparated,ariaLevel:l.number,ariaLive:null,ariaModal:l.booleanish,ariaMultiLine:l.booleanish,ariaMultiSelectable:l.booleanish,ariaOrientation:null,ariaOwns:l.spaceSeparated,ariaPlaceholder:null,ariaPosInSet:l.number,ariaPressed:l.booleanish,ariaReadOnly:l.booleanish,ariaRelevant:null,ariaRequired:l.booleanish,ariaRoleDescription:l.spaceSeparated,ariaRowCount:l.number,ariaRowIndex:l.number,ariaRowSpan:l.number,ariaSelected:l.booleanish,ariaSetSize:l.number,ariaSort:null,ariaValueMax:l.number,ariaValueMin:l.number,ariaValueNow:l.number,ariaValueText:null,role:null},transform:(e,n)=>"role"===n?n:"aria-"+n.slice(4).toLowerCase()})},292:(e,n,t)=>{t.d(n,{app:()=>f});var o=t(859),l=t(791),r=t(91),a=t(9),i=t(475),s=t(436);function u(e){return e&&"object"==typeof e&&"function"==typeof e.mount}function c(e){return"function"==typeof e&&e.prototype&&e.prototype.constructor===e&&(void 0!==e.prototype.mount||void 0!==e.prototype.state||void 0!==e.prototype.view)}function p(e){return"function"==typeof e&&!c(e)}async function d(e,n=3){let t=e,o=0;for(;p(t)&&o<n;)try{const e=await t();if(e===t)break;t=e,o++}catch(e){console.error(`Error executing component function: ${e}`);break}return t}const h=async(e,n)=>{for(const[t,l]of Object.entries(n))if(l&&t)if(u(l)){const n={route:t};l.mount(e,n)}else if(c(l)){const n={route:t};(new l).mount(e,n)}else if(p(l)){let n=await d(l);if(u(n)){const o={route:t};n.mount(e,o);continue}if(c(n)){const o={route:t};(new n).mount(e,o);continue}o.A.on(t,((...n)=>{const t=l(...n),r="string"==typeof e?document.querySelector(e):e;if(r)return o.A.render(r,t);console.error(`Element not found: ${e}`)}))}else console.error("Invalid component: component must be a class, instance, or function that returns a class/instance");else console.error(`Invalid component configuration: component=${l}, route=${t}`)};var m=t(672);const f=o.A;if(!f.start){f.version=m.a,f.h=f.createElement=l.n,f.render=l.cJ,f.Fragment=l.FK,f.webComponent=s.A,f.trustedHTML=l.Fs,f.safeHTML=l.t_,f.start=(e,n,t,o,l)=>{const a={render:!0,global_event:!0,...l},i=new r.u(n,t,o);return l&&l.rendered&&(i.rendered=l.rendered),l&&l.mounted&&(i.mounted=l.mounted),i.start(e,a),i};const e=e=>{};if(f.on("/",e),f.on("debug",(n=>e)),f.on(i.z0,e),f.on(i.a6,e),f.route=i.wE,f.on("route",(e=>f.route&&f.route(e))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{const e=document.body.hasAttribute("apprun-no-init")||f["no-init-route"]||!1,n=f.find("#")||f.find("#/")||!1;window.addEventListener("hashchange",(()=>(0,i.wE)(location.hash))),window.addEventListener("popstate",(()=>(0,i.wE)(location.pathname))),n?!e&&(0,i.wE)(location.hash):(!e&&(()=>{const e=f.basePath||"";let n=location.pathname;e&&n.startsWith(e)&&(n=n.substring(e.length),n.startsWith("/")||(n="/"+n)),(0,i.wE)(n)})(),document.body.addEventListener("click",(e=>{const n=e.target,t=n instanceof Element?n:n?.parentElement;if(!t)return;((e,n)=>{if(!((e,n)=>!(!n||e.defaultPrevented||0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||n.target&&"_self"!==n.target.toLowerCase()||n.hasAttribute("download")||(n.getAttribute("rel")||"").toLowerCase().split(/\s+/).includes("external")||n.origin!==location.origin||!n.pathname))(e,n))return!1;e.preventDefault();const t=(f.basePath||"")+n.pathname;history.pushState(null,"",t),(0,i.wE)(n.pathname)})(e,"A"===t.tagName?t:t.closest("a"))})))})),"object"==typeof window){const e=window;e.Component=r.u,e.on=a.on,e.customElement=a.EM,e.trustedHTML=l.Fs,e.safeHTML=l.t_}f.use_render=(e,n=0)=>{f.render=0===n?(n,t)=>e(t,n):(n,t)=>e(n,t)},f.use_react=(e,n)=>{if(e&&n)if("function"==typeof e.createElement)if(e.Fragment)if(f.h=f.createElement=e.createElement,f.Fragment=e.Fragment,e.version&&e.version.startsWith("18")){if(!n.createRoot||"function"!=typeof n.createRoot)return void console.error("AppRun use_react: ReactDOM.createRoot not found in React 18+");f.render=(e,t)=>{e&&void 0!==t&&(e._root||(e._root=n.createRoot(e)),e._root.render(t))}}else{if(!n.render||"function"!=typeof n.render)return void console.error("AppRun use_react: ReactDOM.render not found in legacy React");f.render=(e,t)=>n.render(t,e)}else console.error("AppRun use_react: Invalid React object - Fragment not found");else console.error("AppRun use_react: Invalid React object - createElement method not found");else console.error("AppRun use_react: React and ReactDOM parameters are required")},f.addComponents=h}},436:(e,n,t)=>{t.d(n,{A:()=>l});const o=(e,n={})=>class extends HTMLElement{constructor(){super(),this._pendingAttributes=[]}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(n.observedAttributes||[]).map((e=>e.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component&&null==this._mountFrame){const t=n||{};this._shadowRoot=t.shadow?this.attachShadow({mode:"open"}):this;const o=t.observedAttributes||[],l=o.reduce(((e,n)=>{const t=n.toLowerCase();return t!==n&&(e[t]=n),e}),{});this._attrMap=e=>l[e]||e;const r={};Array.from(this.attributes).forEach((e=>r[this._attrMap(e.name)]=e.value)),o.forEach((e=>{void 0!==this[e]&&(r[e]=this[e]),Object.defineProperty(this,e,{get:()=>r[e],set(n){this.attributeChangedCallback(e,r[e],n)},configurable:!0,enumerable:!0})})),this._mountFrame=requestAnimationFrame((()=>{if(this._mountFrame=null,!this.isConnected)return;const n=this.children?Array.from(this.children):[];if(this._component=new e({...r,children:n}).mount(this._shadowRoot,t),this._component._props=r,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const e=this._component.mounted(r,n,this._component.state);void 0!==e&&(this._component.state=e)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component);const o=this._pendingAttributes;this._pendingAttributes=[],o.forEach((({name:e,oldValue:n,value:t})=>{this.attributeChangedCallback(e,n,t)})),!1!==t.render&&this._component.run(".")}))}}disconnectedCallback(){null!=this._mountFrame&&(cancelAnimationFrame(this._mountFrame),this._mountFrame=null),this._pendingAttributes=[],this._component?.unload?.(this._component.state),this._component?.unmount?.(),this._component=null}attributeChangedCallback(e,t,o){if(this._component){const l=this._attrMap?this._attrMap(e):e;this._component._props[l]=o,this._component.run("attributeChanged",l,t,o),o!==t&&!1!==n.render&&window.requestAnimationFrame((()=>{this._component?.run(".")}))}else this._pendingAttributes.push({name:e,oldValue:t,value:o})}},l=(e,n,t)=>{"undefined"!=typeof customElements&&customElements.define(e,o(n,t))}},457:(e,n,t)=>{function o(e){return e.toLowerCase()}t.d(n,{S:()=>o})},475:(e,n,t)=>{t.d(n,{a6:()=>c,wE:()=>p,z0:()=>u});var o=t(859);function l(e){return e?e.startsWith("#/")?e.substring(2).split("/"):e.startsWith("#")||e.startsWith("/")?e.substring(1).split("/"):e.split("/"):[]}function r(e){return e.startsWith("#/")?"hash-slash":e.startsWith("#")?"hash":e.startsWith("/")?"path":"non-prefixed"}function a(){const e=o.A.find("#");if(e&&e.length>0)return o.A.run("#"),void o.A.run(u,"#");const n=o.A.find("/");if(n&&n.length>0)return o.A.run("/"),void o.A.run(u,"/");const t=o.A.find("#/");if(t&&t.length>0)return o.A.run("#/"),void o.A.run(u,"#/");o.A.debug&&console.warn("No subscribers for event: "),o.A.run(c,""),o.A.run(u,"")}function i(e){if(!e)return void a();e=function(e){return e&&"/"!==e&&"#"!==e&&"#/"!==e&&e.endsWith("/")?e.slice(0,-1):e}(e);const n=o.A.basePath;n&&(e=function(e,n){if(!n||"/"===n||""===n)return e;const t=n.startsWith("/")?n:"/"+n;if(e.startsWith(t)){const n=e.substring(t.length);return n.startsWith("/")?n:"/"+n}return e}(e,n));const t=l(e);!function(e){const n=e.filter(Boolean);n.length>11&&console.warn(`Deep route hierarchy detected: ${n.join("/")} (${n.length} levels)`)}(t);const i=r(e),p=function(e,n){const t=[];for(let o=e.length;o>0;o--){const l=e.slice(0,o);let r="";switch(n){case"path":r="/"+l.join("/");break;case"hash":r="#"+l.join("/");break;case"hash-slash":r="#/"+l.join("/");break;case"non-prefixed":r=l.join("/")}t.push(r)}return t}(t,i),d=p[0],h=o.A.find(d),m=h&&h.length>0?{eventName:d,parameters:[]}:function(e,n){const t=Object.keys(o.A._events||{}).map((t=>function(e,n,t){if(r(e)!==n||!l(e).some((e=>"*"===e||e.startsWith(":"))))return null;const o=l(e),a=[];let i=0;for(let n=0;n<o.length;n++){const l=o[n];if("*"===l)return a.push(t.slice(n).join("/")),{eventName:e,parameters:a,score:10*i+o.length};const r=t[n];if(void 0===r)return null;if(l.startsWith(":"))a.push(r);else{if(l!==r)return null;i++}}return o.length!==t.length?null:{eventName:e,parameters:a,score:10*i+o.length}}(t,e,n))).filter(Boolean).sort(((e,n)=>n.score-e.score||n.eventName.length-e.eventName.length));return t.length>0?{eventName:t[0].eventName,parameters:t[0].parameters}:null}(i,t)||function(e,n){for(let t=0;t<e.length;t++){const l=e[t],r=o.A.find(l);if(r&&r.length>0){const o=e.length-t;return{eventName:l,parameters:n.slice(o)}}}return null}(p.slice(1),t);if(m)s(m.eventName,...m.parameters);else if(p.length>0){const n=p[p.length-1];o.A.debug&&console.warn(`No subscribers for event: ${n}`),o.A.run(c,e),o.A.run(u,e)}else a()}const s=(e,...n)=>{if(!e||e===u||e===c)return;const t=o.A.find(e);t&&0!==t.length?o.A.run(e,...n):(o.A.debug&&console.warn(`No subscribers for event: ${e}`),o.A.run(c,e,...n)),o.A.run(u,e,...n)},u="//",c="///",p=e=>{o.A.lastUrl!==e&&(o.A.lastUrl=e,i(e))}},530:(e,n,t)=>{t.d(n,{_:()=>l});var o=t(815);function l(e,n){return(0,o.B)(e,n.toLowerCase())}},559:(e,n,t)=>{t.d(n,{_:()=>o});const o=(0,t(259).v)({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,n)=>"xml:"+n.slice(3).toLowerCase()})},564:(e,n,t)=>{t.d(n,{J:()=>a});var o=t(815),l=t(259),r=t(18);const a=(0,l.v)({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:r.commaOrSpaceSeparated,accentHeight:r.number,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:r.number,amplitude:r.number,arabicForm:null,ascent:r.number,attributeName:null,attributeType:null,azimuth:r.number,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:r.number,by:null,calcMode:null,capHeight:r.number,className:r.spaceSeparated,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:r.number,diffuseConstant:r.number,direction:null,display:null,dur:null,divisor:r.number,dominantBaseline:null,download:r.boolean,dx:null,dy:null,edgeMode:null,editable:null,elevation:r.number,enableBackground:null,end:null,event:null,exponent:r.number,externalResourcesRequired:null,fill:null,fillOpacity:r.number,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:r.commaSeparated,g2:r.commaSeparated,glyphName:r.commaSeparated,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:r.number,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:r.number,horizOriginX:r.number,horizOriginY:r.number,id:null,ideographic:r.number,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:r.number,k:r.number,k1:r.number,k2:r.number,k3:r.number,k4:r.number,kernelMatrix:r.commaOrSpaceSeparated,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:r.number,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:r.number,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:r.number,overlineThickness:r.number,paintOrder:null,panose1:null,path:null,pathLength:r.number,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:r.spaceSeparated,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:r.number,pointsAtY:r.number,pointsAtZ:r.number,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:r.commaOrSpaceSeparated,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:r.commaOrSpaceSeparated,rev:r.commaOrSpaceSeparated,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:r.commaOrSpaceSeparated,requiredFeatures:r.commaOrSpaceSeparated,requiredFonts:r.commaOrSpaceSeparated,requiredFormats:r.commaOrSpaceSeparated,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:r.number,specularExponent:r.number,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:r.number,strikethroughThickness:r.number,string:null,stroke:null,strokeDashArray:r.commaOrSpaceSeparated,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:r.number,strokeOpacity:r.number,strokeWidth:null,style:null,surfaceScale:r.number,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:r.commaOrSpaceSeparated,tabIndex:r.number,tableValues:null,target:null,targetX:r.number,targetY:r.number,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:r.commaOrSpaceSeparated,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:r.number,underlineThickness:r.number,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:r.number,values:null,vAlphabetic:r.number,vMathematical:r.number,vectorEffect:null,vHanging:r.number,vIdeographic:r.number,version:null,vertAdvY:r.number,vertOriginX:r.number,vertOriginY:r.number,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:r.number,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:o.B})},569:(e,n,t)=>{t.d(n,{q:()=>a});var o=t(530),l=t(259),r=t(18);const a=(0,l.v)({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:r.commaSeparated,acceptCharset:r.spaceSeparated,accessKey:r.spaceSeparated,action:null,allow:null,allowFullScreen:r.boolean,allowPaymentRequest:r.boolean,allowUserMedia:r.boolean,alt:null,as:null,async:r.boolean,autoCapitalize:null,autoComplete:r.spaceSeparated,autoFocus:r.boolean,autoPlay:r.boolean,blocking:r.spaceSeparated,capture:null,charSet:null,checked:r.boolean,cite:null,className:r.spaceSeparated,cols:r.number,colSpan:null,content:null,contentEditable:r.booleanish,controls:r.boolean,controlsList:r.spaceSeparated,coords:r.number|r.commaSeparated,crossOrigin:null,data:null,dateTime:null,decoding:null,default:r.boolean,defer:r.boolean,dir:null,dirName:null,disabled:r.boolean,download:r.overloadedBoolean,draggable:r.booleanish,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:r.boolean,formTarget:null,headers:r.spaceSeparated,height:r.number,hidden:r.overloadedBoolean,high:r.number,href:null,hrefLang:null,htmlFor:r.spaceSeparated,httpEquiv:r.spaceSeparated,id:null,imageSizes:null,imageSrcSet:null,inert:r.boolean,inputMode:null,integrity:null,is:null,isMap:r.boolean,itemId:null,itemProp:r.spaceSeparated,itemRef:r.spaceSeparated,itemScope:r.boolean,itemType:r.spaceSeparated,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:r.boolean,low:r.number,manifest:null,max:null,maxLength:r.number,media:null,method:null,min:null,minLength:r.number,multiple:r.boolean,muted:r.boolean,name:null,nonce:null,noModule:r.boolean,noValidate:r.boolean,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:r.boolean,optimum:r.number,pattern:null,ping:r.spaceSeparated,placeholder:null,playsInline:r.boolean,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:r.boolean,referrerPolicy:null,rel:r.spaceSeparated,required:r.boolean,reversed:r.boolean,rows:r.number,rowSpan:r.number,sandbox:r.spaceSeparated,scope:null,scoped:r.boolean,seamless:r.boolean,selected:r.boolean,shadowRootClonable:r.boolean,shadowRootDelegatesFocus:r.boolean,shadowRootMode:null,shape:null,size:r.number,sizes:null,slot:null,span:r.number,spellCheck:r.booleanish,src:null,srcDoc:null,srcLang:null,srcSet:null,start:r.number,step:null,style:null,tabIndex:r.number,target:null,title:null,translate:null,type:null,typeMustMatch:r.boolean,useMap:null,value:r.booleanish,width:r.number,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:r.spaceSeparated,axis:null,background:null,bgColor:null,border:r.number,borderColor:null,bottomMargin:r.number,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:r.boolean,declare:r.boolean,event:null,face:null,frame:null,frameBorder:null,hSpace:r.number,leftMargin:r.number,link:null,longDesc:null,lowSrc:null,marginHeight:r.number,marginWidth:r.number,noResize:r.boolean,noHref:r.boolean,noShade:r.boolean,noWrap:r.boolean,object:null,profile:null,prompt:null,rev:null,rightMargin:r.number,rules:null,scheme:null,scrolling:r.booleanish,standby:null,summary:null,text:null,topMargin:r.number,valueType:null,version:null,vAlign:null,vLink:null,vSpace:r.number,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:r.boolean,disableRemotePlayback:r.boolean,prefix:null,property:null,results:r.number,security:null,unselectable:null},space:"html",transform:o._})},597:(e,n,t)=>{t.d(n,{o:()=>d});var o=t(775),l=t(862);const r="_props",a=new Map;function i(e,n,t){!function(e){return null!=e&&!1!==e&&""!==e&&(!0===e||("string"==typeof e?"false"!==e.toLowerCase()&&"0"!==e:Boolean(e)))}(t)?e.removeAttribute(n):e.setAttribute(n,n)}function s(e,n,t){try{e[n]=t}catch(o){u(e,n,t,!1)}}function u(e,n,t,o){if(null==t)return void e.removeAttribute(n);const l=String(t);if(o&&n.includes(":")){const[t]=n.split(":");"xlink"===t?e.setAttributeNS("http://www.w3.org/1999/xlink",n,l):e.setAttribute(n,l)}else e.setAttribute(n,l)}function c(e,n,t,r){if(c=e,p=n,document.activeElement===c?["selectionStart","selectionEnd","selectionDirection"].includes(p):"scrollTop"===p||"scrollLeft"===p||c instanceof HTMLMediaElement&&["currentTime","paused","playbackRate","volume"].includes(p))return;var c,p;if("style"===n){if(e.style.cssText&&(e.style.cssText=""),"string"==typeof t)e.style.cssText=t;else if(t&&"object"==typeof t)for(const n in t)e.style[n]!==t[n]&&(e.style[n]=t[n]);return}if("key"===n)return void(null!=t&&(e.key=t));if(n.startsWith("data-"))return void function(e,n,t){const o=(l=n.slice(5)).length<=1?l.toLowerCase():l.split("-").map(((e,n)=>0===n?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join("");var l;null==t?delete e.dataset[o]:e.dataset[o]=String(t)}(e,n,t);if(n.startsWith("on"))return void function(e,n,t){n.startsWith("on")&&(t&&"function"!=typeof t?"string"==typeof t&&(t?e.setAttribute(n,t):e.removeAttribute(n)):e[n]=t)}(e,n,t);if(!("INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&"SELECT"!==e.tagName||"value"!==n&&"selected"!==n&&"selectedIndex"!==n))return void s(e,n,t);if("INPUT"===e.tagName&&"checked"===n)return s(e,n,t),void i(e,n,t);const d=function(e,n){const t=`${e}:${n}`;let r=a.get(t);return void 0===r&&(r=(0,o.I)(n?l.JW:l.qy,e)||null,a.set(t,r)),r}(n,r);d?d.boolean||d.overloadedBoolean?i(e,d.attribute,t):d.mustUseProperty&&!r?s(e,d.property,t):u(e,d.attribute,t,r):n.startsWith("aria-")||"role"===n?u(e,n,t,r):n in e||void 0!==e[n]?s(e,n,t):u(e,n,t,r)}function p(e){return/^[a-zA-Z_:][\w\-:.]*$/.test(e)&&!e.includes("<")&&!e.includes(">")&&!e.includes('"')&&!e.includes("'")}function d(e,n,t){const o=function(e,n){if(n&&(n.class=n.class||n.className,delete n.className),!e||0===Object.keys(e).length)return n||{};if(!n||0===Object.keys(n).length){const n={};return Object.keys(e).forEach((e=>n[e]=null)),n}const t={};return Object.keys(e).forEach((e=>{e in n||(t[e]=null)})),Object.keys(n).forEach((e=>t[e]=n[e])),t}(e[r]||{},n);e[r]=n||{},function(e,n,t,o){for(const t in n)p(t)&&c(e,t,n[t],o);n&&"function"==typeof n.ref&&window.requestAnimationFrame((()=>n.ref(e)))}(e,o,0,t)}},627:(e,n,t)=>{t.d(n,{R:()=>o});class o{constructor(e,n){this.attribute=n,this.property=e}}o.prototype.attribute="",o.prototype.booleanish=!1,o.prototype.boolean=!1,o.prototype.commaOrSpaceSeparated=!1,o.prototype.commaSeparated=!1,o.prototype.defined=!1,o.prototype.mustUseProperty=!1,o.prototype.number=!1,o.prototype.overloadedBoolean=!1,o.prototype.property="",o.prototype.spaceSeparated=!1,o.prototype.space=void 0},634:(e,n,t)=>{function o(e){return e?.target instanceof HTMLElement?e.target:null}function l(e,n=document){try{return n.querySelector(e)}catch(n){return console.warn(`Invalid selector: ${e}`,n),null}}function r(e){try{return document.getElementById(e)}catch(n){return console.warn(`Error getting element by id: ${e}`,n),null}}t.d(n,{PB:()=>o,bV:()=>l,oP:()=>r})},670:(e,n,t)=>{t.d(n,{F:()=>o});const o=(0,t(259).v)({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,n)=>"xlink:"+n.slice(5).toLowerCase()})},672:(e,n,t)=>{t.d(n,{C:()=>l,a:()=>o});const o="6.0.0",l=`AppRun-${o}`},741:(e,n,t)=>{t.d(n,{A:()=>u});var o=t(859),l=t(634);const r=e=>{if(!e)return[];const n=[];let t="",o=!1,l="";for(let r=0;r<e.length;r++){const a=e[r];"["!==a||o?"]"===a&&o?(l?t=t.slice(1,-1):/^\d+$/.test(t)&&(t=parseInt(t,10)),n.push(t),t="",o=!1,l=""):'"'!==a&&"'"!==a||!o?"."!==a||o?t+=a:t&&(n.push(t),t=""):(l?a===l&&(l=""):l=a,t+=a):(t&&(n.push(t),t=""),o=!0)}return t&&n.push(t),n},a=(e,n)=>{if(!n)return e.state||"";const t=r(n),o=((e,n)=>{let t=e;for(const e of n){if(null==t)return;t=t[e]}return t})(e.state,t);return void 0!==o?o:""},i=(e,n,t)=>{if(!n)return void e.setState(t);const o=r(n),l=((e,n,t)=>{if(0===n.length)return t;const o={...e};let l=o;for(let e=0;e<n.length-1;e++){const t=n[e],o=n[e+1];null==l[t]?l[t]="number"==typeof o?[]:{}:Array.isArray(l[t])?l[t]=[...l[t]]:"object"==typeof l[t]&&(l[t]={...l[t]}),l=l[t]}return l[n[n.length-1]]=t,o})(e.state||{},o,t);e.setState(l)},s=(e,n)=>{if(Array.isArray(e))return e.map((e=>s(e,n)));{let{type:t,tag:r,props:u,children:c}=e;return r=r||t,c=c||u?.children,u&&Object.keys(u).forEach((e=>{e.startsWith("$")&&(((e,n,t,r)=>{if(e.startsWith("$on")){const t=n[e];if(e=e.substring(1),"boolean"==typeof t)n[e]=n=>r.run?r.run(e,n):o.A.run(e,n);else if("string"==typeof t)n[e]=e=>r.run?r.run(t,e):o.A.run(t,e);else if("function"==typeof t)n[e]=e=>r.setState(t(r.state,e));else if(Array.isArray(t)){const[l,...a]=t;"string"==typeof l?n[e]=e=>r.run?r.run(l,...a,e):o.A.run(l,...a,e):"function"==typeof l&&(n[e]=e=>r.setState(l(r.state,...a,e)))}}else if("$bind"===e){const o=n.type||"text",s="string"==typeof n[e]?n[e]:n.name;if("input"===t)switch(o){case"checkbox":n.checked=a(r,s),n.onclick=e=>{const n=(0,l.PB)(e);n&&i(r,s||n.name,n.checked)};break;case"radio":n.checked=a(r,s)===n.value,n.onclick=e=>{const n=(0,l.PB)(e);n&&i(r,s||n.name,n.value)};break;case"number":case"range":n.value=a(r,s),n.oninput=e=>{const n=(0,l.PB)(e);n&&i(r,s||n.name,Number(n.value))};break;default:n.value=a(r,s),n.oninput=e=>{const n=(0,l.PB)(e);n&&i(r,s||n.name,n.value)}}else"select"===t?(n.value=a(r,s),n.onchange=e=>{const n=(0,l.PB)(e);n&&!n.multiple&&i(r,s||n.name,n.value)}):"option"===t?(n.selected=a(r,s),n.onclick=e=>{const n=(0,l.PB)(e);n&&i(r,s||n.name,n.selected)}):"textarea"===t&&(n.value=a(r,s),n.oninput=e=>{const n=(0,l.PB)(e);n&&i(r,s||n.name,n.value)})}else o.A.run("$",{key:e,tag:t,props:n,component:r})})(e,u,r,n),delete u[e])})),c&&s(c,n),e}},u=s},775:(e,n,t)=>{t.d(n,{I:()=>u});var o=t(147),l=t(627),r=t(457);const a=/[A-Z]/g,i=/-[a-z]/g,s=/^data[-\w.:]+$/i;function u(e,n){const t=(0,r.S)(n);let u=n,d=l.R;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&"data"===t.slice(0,4)&&s.test(n)){if("-"===n.charAt(4)){const e=n.slice(5).replace(i,p);u="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=n.slice(4);if(!i.test(e)){let t=e.replace(a,c);"-"!==t.charAt(0)&&(t="-"+t),n="data"+t}}d=o.E}return new d(u,n)}function c(e){return"-"+e.toLowerCase()}function p(e){return e.charAt(1).toUpperCase()}},791:(e,n,t)=>{t.d(n,{FK:()=>r,Fs:()=>d,cJ:()=>s,n:()=>i,t_:()=>h});var o=t(741),l=t(597);function r(e,...n){return a(n)}function a(e){const n=[],t=e=>{null!=e&&""!==e&&!1!==e&&n.push("function"==typeof e||"object"==typeof e?e:`${e}`)};return e&&e.forEach((e=>{Array.isArray(e)?e.forEach((e=>t(e))):t(e)})),n}function i(e,n,...t){const o=a(t);if("string"==typeof e)return{tag:e,props:n,children:o};if(Array.isArray(e))return e;if(void 0===e&&t)return o;if(Object.getPrototypeOf(e).__isAppRunComponent)return{tag:e,props:n,children:o};if("function"==typeof e)return e(n,o);throw new Error(`Unknown tag in vdom ${e}`)}const s=(e,n,t={})=>{null!=n&&!1!==n&&function(e,n,t={}){if(null==n||!1===n)return;if(function(e){e&&e.__componentCache&&(e.__componentCacheUsed={})}(t),n=g(n,t),function(e){e&&e.__componentCache&&e.__componentCacheUsed&&(Object.keys(e.__componentCache).forEach((n=>{e.__componentCacheUsed[n]||(e.__componentCache[n]?.unmount?.(),delete e.__componentCache[n])})),e.__componentCacheUsed=null)}(t),!e)return;const o="SVG"===e.nodeName;Array.isArray(n)?c(e,n,o):c(e,[n],o)}("string"==typeof e&&e?document.getElementById(e)||document.querySelector(e):e,n=(0,o.A)(n,t),t)};function u(e,n,t){t=t||"svg"===n.tag,function(e,n){const t=e.nodeName,o=`${n.tag||""}`;return t.toUpperCase()===o.toUpperCase()}(e,n)?(c(e,n.children,t),(0,l.o)(e,n.props,t)):e.parentNode.replaceChild(f(n,t),e)}function c(e,n,t){const o={};Array.from(e.childNodes||[]).forEach((e=>{void 0!==e.key&&null!==e.key&&(o[p(e.key)]=e)}));const l=e.childNodes?.length||0,r=n?.length||0,a=Math.min(l,r);for(let l=0;l<a;l++){const r=n[l],a=e.childNodes[l];if("string"==typeof r)a.textContent!==r&&(3===a.nodeType?a.nodeValue=r:e.replaceChild(m(r),a));else if(r instanceof HTMLElement||r instanceof SVGElement)e.insertBefore(r,a);else{const n=r.props?r.props.key:void 0;if(null!=n)if(a.key===n)u(e.childNodes[l],r,t);else{const i=o[p(n)];i?(e.insertBefore(i,a),u(e.childNodes[l],r,t)):e.replaceChild(f(r,t),a)}else u(e.childNodes[l],r,t)}}let i=e.childNodes?.length||0;for(;i>a;)e.removeChild(e.lastChild),i--;if(r>a){const o=document.createDocumentFragment();for(let e=a;e<n.length;e++)o.appendChild(f(n[e],t));e.appendChild(o)}}function p(e){return`${typeof e}:${String(e)}`}const d=e=>{const n=document.createElement("section");return n.insertAdjacentHTML("afterbegin",e),Array.from(n.children)},h=d;function m(e){return document.createTextNode(e??"")}function f(e,n){if(e instanceof HTMLElement||e instanceof SVGElement)return e;if("string"==typeof e)return m(e);if(!e.tag||"function"==typeof e.tag)return m(JSON.stringify(e));const t=(n=n||"svg"===e.tag)?document.createElementNS("http://www.w3.org/2000/svg",e.tag):document.createElement(e.tag);return(0,l.o)(t,e.props,n),e.children&&e.children.forEach((e=>t.appendChild(f(e,n)))),e.props&&void 0!==e.props.key&&null!==e.props.key&&(t.key=e.props.key),t}function g(e,n,t=0){if("string"==typeof e)return e;if(Array.isArray(e))return e.map((e=>g(e,n,t++)));let o=e;if(e&&"function"==typeof e.tag&&Object.getPrototypeOf(e.tag).__isAppRunComponent&&(o=function(e,n,t){const{tag:o,props:r,children:a}=e,i=r&&r.id,s=null!=i?String(i):`_${t}`;let u="section";r&&r.as&&(u=r.as,delete r.as),n.__componentCache||(n.__componentCache={}),function(e,n){e&&(e.__componentCacheUsed=e.__componentCacheUsed||{},e.__componentCacheUsed[n]=!0)}(n,s);let c=n.__componentCache[s];if(c&&c instanceof o&&c.element)c.renderState(c.state);else{const e=document.createElement(u);c=n.__componentCache[s]=new o({...r,children:a}).mount(e,{render:!0})}if(c.mounted){const e=c.mounted(r,a,c.state);void 0!==e&&c.setState(e)}return(0,l.o)(c.element,r,!1),c.element}(e,n,t)),o&&Array.isArray(o.children)){const e=o.props?._component;if(e){let n=0;o.children=o.children.map((t=>g(t,e,n++)))}else o.children=o.children.map((e=>g(e,n,t++)))}return o}},815:(e,n,t)=>{function o(e,n){return n in e?e[n]:n}t.d(n,{B:()=>o})},859:(e,n,t)=>{t.d(n,{A:()=>s,q:()=>l});var o=t(672);class l{constructor(){this._reporting_error=!1,this._events={},this._wildcard_events=[]}on(e,n,t={}){this._events[e]=this._events[e]||[];const o={fn:n,options:t};this._events[e].push(o),e.endsWith("*")&&(this._wildcard_events.push({name:e,prefix:e.replace("*",""),sub:o}),this._wildcard_events.sort(((e,n)=>n.name.length-e.name.length)))}off(e,n){const t=this._events[e]||[];this._events[e]=t.filter((e=>e.fn!==n)),e.endsWith("*")&&(this._wildcard_events=this._wildcard_events.filter((t=>!(t.name===e&&t.sub.fn===n))))}find(e){return this._events[e]}run(e,...n){const t=this.getSubscribers(e,this._events);return this.debug&&console.assert(t&&t.length>0,"No subscriber for event: "+e),t.forEach((t=>{const{fn:o,options:l}=t;if(!o||"function"!=typeof o)return console.error(`AppRun event handler for '${e}' is not a function:`,o),!1;if(l.delay)this.delay(e,t,n);else try{Object.keys(l).length>0?o.apply(this,[...n,l]):o.apply(this,n)}catch(t){this.reportError(e,t,{phase:"run",args:n})}})),t.length}once(e,n,t={}){this.on(e,n,{...t,once:!0})}delay(e,n,t){const o=n._source||n,{fn:l,options:r}=n;o._t&&clearTimeout(o._t),o._t=setTimeout((()=>{clearTimeout(o._t),o._t=null;try{Object.keys(r).length>0?l.apply(this,[...t,r]):l.apply(this,t)}catch(n){this.reportError(e,n,{phase:"delay",args:t})}}),r.delay)}runAsync(e,...n){const t=this.getSubscribers(e,this._events);this.debug&&console.assert(t&&t.length>0,"No subscriber for event: "+e);const o=t.map((t=>{const{fn:o,options:l}=t;if(!o||"function"!=typeof o)return console.error(`AppRun async event handler for '${e}' is not a function:`,o),Promise.resolve(null);try{const t=Object.keys(l).length>0?o.apply(this,[...n,l]):o.apply(this,n);return Promise.resolve(t).catch((t=>(this.reportError(e,t,{phase:"runAsync",args:n}),Promise.reject(t))))}catch(t){return this.reportError(e,t,{phase:"runAsync",args:n}),Promise.reject(t)}}));return Promise.all(o)}reportError(e,n,t={}){const o={event:e,error:n,app:this,...t},l="error"===e||this._reporting_error?[]:this.getSubscribers("error",this._events);if(l.length>0){this._reporting_error=!0;try{l.forEach((e=>{try{e.fn.call(this,o)}catch(e){console.error("Error in error event handler:",e)}}))}finally{this._reporting_error=!1}}else"delay"===t.phase?console.error(`Error in delayed event handler for '${e}':`,n):"runAsync"===t.phase?console.error(`Error in async event handler for '${e}':`,n):console.error(`Error in event handler for '${e}':`,n)}removeOnceWildcardSubscriber(e,n){this._events[e]=(this._events[e]||[]).filter((e=>e!==n)),this._wildcard_events=this._wildcard_events.filter((e=>e.sub!==n))}getSubscribers(e,n){const t=n[e]||[],o=t.slice();return n[e]=t.filter((e=>!e.options.once)),this._wildcard_events.filter((({name:n,prefix:t})=>n!==e&&e.startsWith(t))).forEach((({name:n,sub:t})=>{t.options.once&&this.removeOnceWildcardSubscriber(n,t),o.push({...t,_source:t,options:{...t.options,event:e}})})),o}}const r=o.C;let a;const i="undefined"!=typeof window?window:void 0!==t.g?t.g:"undefined"!=typeof self?self:{};i.app&&i._AppRunVersions?a=i.app:(a=new l,i.app=a,i._AppRunVersions=r);const s=a},862:(e,n,t)=>{t.d(n,{JW:()=>p,qy:()=>c});var o=t(987),l=t(277),r=t(569),a=t(564),i=t(670),s=t(72),u=t(559);const c=(0,o.h)([l.a,r.q,i.F,s.z,u._],"html"),p=(0,o.h)([l.a,a.J,i.F,s.z,u._],"svg")},987:(e,n,t)=>{t.d(n,{h:()=>l});var o=t(176);function l(e,n){const t={},l={};for(const n of e)Object.assign(t,n.property),Object.assign(l,n.normal);return new o.S(t,l,n)}}},n={};function t(o){var l=n[o];if(void 0!==l)return l.exports;var r=n[o]={exports:{}};return e[o](r,r.exports,t),r.exports}t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.r(o);var l=t(91),r=t(292);class a extends l.u{constructor(){super(...arguments),this.view=({code:e,hide_code:n})=>r.app.h(r.app.Fragment,null,r.app.h("style",null,"\n.CodeMirror, .apprun-play iframe {\n height: 100%;\n border: dotted gray 1px;\n}\n\n.apprun-play {\n height: 100%;\n display: flex;\n font-size: 1.1rem;\n}\n\n.apprun-play .col {\n margin: 2px;\n}\n\n.apprun-play .editor, .apprun-play .preview {\n width: 100%;\n height: 100%;\n}\n"),n?r.app.h("div",{class:"apprun-play"},r.app.h("iframe",{class:"preview"})):r.app.h("div",{class:"apprun-play"},r.app.h("div",{class:"col",style:"width:75%"},r.app.h("textarea",{class:"editor"},e)),r.app.h("div",{class:"col",style:"flex:1"},r.app.h("iframe",{class:"preview"})))),this.mounted=e=>{const n=this.element,t=e["code-id"],o=e["hide-code"],l=e["code-width"];let r;r=t?document.getElementById(t):n.previousElementSibling||n.parentElement.previousElementSibling;const a=r?.innerText||r?.value||n.textContent;return r&&(r.style.display="none"),{code:a,hide_code:o,code_width:l}},this.rendered=({code:e,hide_code:n,code_width:t})=>{const o=this.element,l=o.querySelector(".apprun-play .editor");let r=o.querySelector(".apprun-play .preview");if(!r||!l)return;const a=e=>{const n=r.cloneNode();r.parentNode?.replaceChild(n,r),r=n;const t=r.contentWindow?.document;t&&(t.open(),e.indexOf("<html")>=0?t.write(e):t.write((e=>`<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <meta http-equiv="X-UA-Compatible" content="ie=edge">\n <title>AppRun Playground</title>\n <style>\n body {\n font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;\n margin: 2em;\n }\n </style>\n <script src="https://cdn.jsdelivr.net/npm/typescript@latest"><\/script>\n <script src="dist/apprun-html.js"><\/script>\n</head>\n<body>\n<pre id="code" style="display:none">${(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"))(e)}</pre>\n<script type="module">\nconst code = document.getElementById('code').innerText;\nconst compiled = ts.transpileModule(code, {\n compilerOptions: {\n "jsx": "react",\n "jsxFactory": "app.h",\n "jsxFragmentFactory": "app.Fragment",\n "target": "es2020",\n "module": "esnext",\n },\n reportDiagnostics: true,\n});\n\nif (compiled.diagnostics && compiled.diagnostics.length) {\n const pre = document.createElement('pre');\n pre.style = 'font-size: 10px;';\n pre.innerText = compiled.diagnostics.map(d => {\n const start = d.start;\n const end = d.start + d.length;\n const line = code.substring(0, end).split('\\n').length;\n const column = code.substring(0, end).split('\\n').pop().length;\n return \`Line: \${line}, Column: \${column}, \${d.messageText}\`;\n }).join('\\n');\n document.body.appendChild(pre);\n} else {\n window.onerror = function () {\n const pre = document.createElement('pre');\n pre.style = 'font-size: 10px;';\n pre.innerText = compiled.outputText;;\n document.body.appendChild(pre);\n };\n const script = document.createElement('script');\n script.type = 'module';\n script.text = compiled.outputText;\n document.body.appendChild(script);\n}\n<\/script>\n</body>\n</html>`)(e)),t.close())};if(e&&a(e),!n&&l)if(t&&(l.parentElement.style.width=t),"undefined"==typeof CodeMirror)l.onkeyup=()=>a(l.value);else{const n=CodeMirror.fromTextArea(l,{lineNumbers:!0,mode:"jsx"});n.setValue(e),n.on("change",(e=>a(e.getValue())))}}}}return r.app.webComponent("apprun-code",a),o})()));
2
2
  //# sourceMappingURL=apprun-code.js.map