apprun 3.31.0 → 3.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,22 @@
1
1
  # AppRun [![Build][travis-image]][travis-url] [![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]
2
2
 
3
- AppRun is a JavaScript library for building reliable, high-performance web applications using the Elm-inspired architecture, events, and components.
3
+
4
+ ## Introduction
5
+
6
+ AppRun is a sleek and efficient JavaScript library designed to revolutionize statement management in web development. At its core, AppRun harnesses the power of the event PubsSub (Publish-Subscribe) pattern to streamline your application’s state handling.
7
+
8
+
9
+ ## Why the Event Pubsub Pattern?
10
+
11
+ The event PubSub pattern isn't new; it's a well-established design pattern used widely in software development to handle communication between components or services in a decoupled manner. Web developers are likely already familiar with the PubSub pattern through their use of DOM event handling.
12
+
13
+ AppRun takes the familiar PubSub concept and extends it into your application's logic, providing a more structured and powerful approach to state management. The result? Cleaner, more maintainable code and a smoother development experience.
14
+
15
+ Here is an example of a simple counter application built with AppRun:
16
+
4
17
 
5
18
  ```js
6
- // define the application state
19
+ // define the initial state
7
20
  const state = 0;
8
21
 
9
22
  // view is a pure function to display the state
@@ -18,15 +31,16 @@ const update = {
18
31
  '+1': state => state + 1,
19
32
  '-1': state => state - 1
20
33
  };
21
- app.start(document.body, state, view, update, { history: true });
34
+
35
+ // start the app
36
+ app.start(document.body, state, view, update);
22
37
  ```
23
38
  <apprun-play style="height:200px"></apprun-play>
24
39
 
25
- > Note, the transition option is newly added to enable the [View Transition API](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent) during the rendering of the view.
26
40
 
27
41
  ## AppRun Benefits
28
42
 
29
- * Clean architecure that needs less code
43
+ * Clean architecture that needs less code
30
44
  * State management and routing included
31
45
  * No proprietary syntax to learn (no hooks)
32
46
  * Use directly in the browser or with a compiler/bundler
@@ -66,46 +80,6 @@ Or, you can create an AppRun app by using the `npm create apprun-app` command.
66
80
  npm create apprun-app [my-app]
67
81
  ```
68
82
 
69
- ## Component and Web Component
70
-
71
- An AppRun component is a mini-application with elm architecture, which means inside a component, there are _state_, _view_, and _update_. In addition, components provide a local scope.
72
-
73
- ```js
74
- class Counter extends Component {
75
- state = 0;
76
- view = state => {
77
- const add = (state, num) => state + num;
78
- return <>
79
- <h1>{state}</h1>
80
- <button $onclick={[add, -1]}>-1</button>
81
- <button $onclick={[add, +1]}>+1</button>
82
- </>;
83
- }
84
- }
85
- app.render(document.body, <Counter/>);
86
- ```
87
-
88
- You can convert AppRun components into [web components/custom elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components). AppRun components become the custom elements that also can handle AppRun events.
89
-
90
- ```js
91
- class Counter extends Component {
92
- state = 0;
93
- view = state => {
94
- const add = (state, num) => state + num;
95
- return <>
96
- <h1>{state}</h1>
97
- <button $onclick={[add, -1]}>-1</button>
98
- <button $onclick={[add, +1]}>+1</button>
99
- </>;
100
- }
101
- }
102
- app.webComponent('my-app', Counter);
103
- app.render(document.body, <my-app />);
104
- ```
105
-
106
- > [All the Ways to Make a Web Component - May 2021 Update](https://webcomponents.dev/blog/all-the-ways-to-make-a-web-component/) compares the coding style, bundle size, and performance of 55 different ways to make a Web Component. It put AppRun on the top 1/3 of the list of bundle size and performance.
107
- >
108
-
109
83
  ### Learn More
110
84
 
111
85
  You can get started with [AppRun Docs](https://apprun.js.org/docs) and [the AppRun Playground](https://apprun.js.org/#play).
@@ -158,7 +132,7 @@ AppRun is an MIT-licensed open source project. Please consider [supporting the p
158
132
 
159
133
  MIT
160
134
 
161
- Copyright (c) 2015-2022 Yiyi Sun
135
+ Copyright (c) 2015-2024 Yiyi Sun
162
136
 
163
137
 
164
138
  [travis-image]: https://travis-ci.org/yysun/apprun.svg?branch=master
package/WHATSNEW.md CHANGED
@@ -1,5 +1,53 @@
1
1
  ## What's New
2
2
 
3
+ > Aug 12, 2024, V3.33.0
4
+
5
+ ### Add app.use_render and app.use_react function
6
+
7
+ The `app.use_render` function allows you to use a custom render function for rendering the view (e.g., React < 18 ). The `app.use_react` function allows you to use React 18 and up for rendering the view.
8
+
9
+ ```js
10
+ import { createRoot } from 'react-dom/client'
11
+ import app from 'apprun';
12
+ app.use_react(createRoot);
13
+ ```
14
+
15
+ See https://github.com/yysun/apprun-antd-demo-js for an example.
16
+
17
+ ### Support the _mounted_ function when starting a component manually
18
+
19
+ > Dec, 8, 2023
20
+
21
+ When using a component in JSX, AppRun always invokes the the _mounted_ lifecycle function each time the component is loaded.
22
+
23
+ ```js
24
+ class ComponentClass extends Component {
25
+ mounted = () => console.log('mounted is called');
26
+ }
27
+ app.render(document.body, <ComponentClass />);
28
+ ```
29
+
30
+ However, the _mounted_ function is not called when you start the component manully in the previous versions.
31
+
32
+ ```js
33
+ class ComponentClass extends Component {
34
+ mounted = () => console.log('mounted is called'); // not called in previous versions
35
+ }
36
+ new ComponentClass().start(document.body);
37
+ ```
38
+
39
+ Now, the _mounted_ function is called when the component is started.
40
+
41
+ ```js
42
+ class ComponentClass extends Component {
43
+ mounted = () => console.log('mounted is called'); // called in this version
44
+ }
45
+ new ComponentClass().start(document.body);
46
+ ```
47
+
48
+ This change make the _mounted_ funciton compatible in JSX and in manual start.
49
+
50
+
3
51
  ### Support View Transition API
4
52
 
5
53
  > September, 27, 2023
package/apprun.d.ts CHANGED
@@ -48,7 +48,8 @@ declare module 'apprun' {
48
48
  off(name: string, fn: (...args: any[]) => void): void;
49
49
  find(name: string): any;
50
50
  run(name: string, ...args: any[]): number;
51
- query(name: string, ...args): Promise<any[]>;
51
+ query(name: string, ...args): Promise<any[]>; // obsolete
52
+ runAsync(name: string, ...args): Promise<any[]>;
52
53
  h(tag: string | Function, ...children: any[]): VNode | VNode[];
53
54
  createElement(tag: string | Function, ...children: any[]): VNode | VNode[];
54
55
  render(element: Element | string, node: VDOM): void;
@@ -67,7 +68,8 @@ declare module 'apprun' {
67
68
  start(element?: Element | string, options?: MountOptions): Component<T, E>;
68
69
  on(name: E, fn: (...args: any[]) => void, options?: any): void;
69
70
  run(name: E, ...args: any[]): number;
70
- query(name: string, ...args): Promise<any[]>;
71
+ query(name: string, ...args): Promise<any[]>; // obsolete
72
+ runAsync(name: string, ...args): Promise<any[]>;
71
73
  rendered: (state: T) => void;
72
74
  mounted: (props: any, children: any[], state: T) => T | void;
73
75
  unmount: () => void;
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apprun=t():e.apprun=t()}(this,(()=>(()=>{"use strict";var e={752:(e,t,n)=>{n.d(t,{Z:()=>l});let o;const s="object"==typeof self&&self.self===self&&self||"object"==typeof n.g&&n.g.global===n.g&&n.g;s.app&&s._AppRunVersions?o=s.app:(o=new class{constructor(){this._events={}}on(e,t,n={}){this._events[e]=this._events[e]||[],this._events[e].push({fn:t,options:n})}off(e,t){const n=this._events[e]||[];this._events[e]=n.filter((e=>e.fn!==t))}find(e){return this._events[e]}run(e,...t){const n=this.getSubscribers(e,this._events);return console.assert(n&&n.length>0,"No subscriber for event: "+e),n.forEach((n=>{const{fn:o,options:s}=n;return s.delay?this.delay(e,o,t,s):Object.keys(s).length>0?o.apply(this,[...t,s]):o.apply(this,t),!n.options.once})),n.length}once(e,t,n={}){this.on(e,t,Object.assign(Object.assign({},n),{once:!0}))}delay(e,t,n,o){o._t&&clearTimeout(o._t),o._t=setTimeout((()=>{clearTimeout(o._t),Object.keys(o).length>0?t.apply(this,[...n,o]):t.apply(this,n)}),o.delay)}query(e,...t){const n=this.getSubscribers(e,this._events);console.assert(n&&n.length>0,"No subscriber for event: "+e);const o=n.map((e=>{const{fn:n,options:o}=e;return Object.keys(o).length>0?n.apply(this,[...t,o]):n.apply(this,t)}));return Promise.all(o)}getSubscribers(e,t){const n=t[e]||[];return t[e]=n.filter((e=>!e.options.once)),Object.keys(t).filter((t=>t.endsWith("*")&&e.startsWith(t.replace("*","")))).sort(((e,t)=>t.length-e.length)).forEach((o=>n.push(...t[o].map((t=>Object.assign(Object.assign({},t),{options:Object.assign(Object.assign({},t.options),{event:e})})))))),n}},s.app=o,s._AppRunVersions="AppRun-3");const l=o}},t={};function n(o){var s=t[o];if(void 0!==s)return s.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o);var e=n(752);function t(e){return e.map((e=>l(e))).join("")}function s(e){for(var t in e)null==e[t]?delete e[t]:"object"==typeof e[t]&&s(e[t])}function l(e){if(!e)return"";if("_$litType$"in e)return e.toString();if(s(e),Array.isArray(e))return t(e);if("string"==typeof e)return e.startsWith("_html:")?e.substring(6):e;if(e.tag){const n=e.props?function(e){return Object.keys(e).map((t=>{return` ${"className"===t?"class":t}="${n=e[t],"object"==typeof n?Object.keys(n).map((e=>`${e}:${n[e]}`)).join(";"):n.toString()}"`;var n})).join("")}(e.props):"",o=e.children?t(e.children):"";return`<${e.tag}${n}>${o}</${e.tag}>`}return"object"==typeof e?JSON.stringify(e):void 0}const r=l;let c;function i(e){c=window.open("",e),c.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI" }\n </style>\n <body><pre>`)}function a(e){c.document.write(e+"\n")}function p(){c.document.write("</pre>\n </body>\n </html>"),c.document.close()}app.debug=!0;const u=e=>{a(`import ${e.constructor.name} from '../src/${e.constructor.name}'`),a(`describe('${e.constructor.name}', ()=>{`),e._actions.forEach((t=>{"."!==t.name&&(a(` it ('should handle event: ${t.name}', (done)=>{`),a(` const component = new ${e.constructor.name}().mount();`),a(` component.run('${t.name}');`),a(" setTimeout(() => {"),a(" //expect(?).toHaveBeenCalled();"),a(" //expect(component.state).toBe(?);"),a(" done();"),a(" })"))})),a("});")};let f=!1,d=[];app.on("debug",(e=>{f&&e.vdom&&(d.push(e),console.log(`* ${d.length} state(s) recorded.`))}));var m;function h(e){const t=window.open("","_apprun_debug","toolbar=0");t.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI" }\n li { margin-left: 80px; }\n </style>\n <body>\n <div id="main">${e}</div>\n <\/script>\n </body>\n </html>`),t.document.close()}e.Z.debug=!0,window["_apprun-help"]=["",()=>{Object.keys(window).forEach((e=>{e.startsWith("_apprun-")&&("_apprun-help"===e?console.log("AppRun Commands:"):console.log(`* ${e.substring(8)}: ${window[e][0]}`))}))}];const g=()=>{const t={components:{}};e.Z.run("get-components",t);const{components:n}=t;return n};let v=Number(null===(m=null===window||void 0===window?void 0:window.localStorage)||void 0===m?void 0:m.getItem("__apprun_debugging__"))||0;if(e.Z.on("debug",(e=>{1&v&&e.event&&console.log(e),2&v&&e.vdom&&console.log(e)})),window["_apprun-components"]=["components [print]",t=>{(t=>{const n=g(),o=[];if(n instanceof Map)for(let[e,t]of n){const n="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;o.push({element:n,comps:t})}else Object.keys(n).forEach((e=>{const t="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;o.push({element:t,comps:n[e]})}));if(t){const t=(t=>{const n=({events:t})=>e.Z.h("ul",null,t&&t.filter((e=>"."!==e.name)).map((t=>e.Z.h("li",null,t.name)))),o=({components:t})=>e.Z.h("ul",null,t.map((t=>e.Z.h("li",null,e.Z.h("div",null,t.constructor.name),e.Z.h(n,{events:t._actions})))));return e.Z.h("ul",null,t.map((({element:t,comps:n})=>e.Z.h("li",null,e.Z.h("div",null,(t=>e.Z.h("div",null,t.tagName.toLowerCase(),t.id?"#"+t.id:""," ",t.className&&t.className.split(" ").map((e=>"."+e)).join()))(t)),e.Z.h(o,{components:n})))))})(o);h(r(t))}else o.forEach((({element:e,comps:t})=>console.log(e,t)))})("print"===t)}],window["_apprun-events"]=["events [print]",t=>{(t=>{const n=e.Z._events,o={},s=g(),l=e=>e._actions.forEach((t=>{o[t.name]=o[t.name]||[],o[t.name].push(e)}));if(s instanceof Map)for(let[e,t]of s)t.forEach(l);else Object.keys(s).forEach((e=>s[e].forEach(l)));const c=[];if(Object.keys(o).forEach((e=>{c.push({event:e,components:o[e],global:!!n[e]})})),c.sort(((e,t)=>e.event>t.event?1:-1)).map((e=>e.event)),t){const t=(t=>{const n=({components:t})=>e.Z.h("ul",null,t.map((t=>e.Z.h("li",null,e.Z.h("div",null,t.constructor.name))))),o=({events:t,global:o})=>e.Z.h("ul",null,t&&t.filter((e=>e.global===o&&"."!==e.event)).map((({event:t,components:o})=>e.Z.h("li",null,e.Z.h("div",null,t),e.Z.h(n,{components:o})))));return e.Z.h("div",null,e.Z.h("div",null,"GLOBAL EVENTS"),e.Z.h(o,{events:t,global:!0}),e.Z.h("div",null,"LOCAL EVENTS"),e.Z.h(o,{events:t,global:!1}))})(c);h(r(t))}else console.log("=== GLOBAL EVENTS ==="),c.filter((e=>e.global&&"."!==e.event)).forEach((({event:e,components:t})=>console.log({event:e},t))),console.log("=== LOCAL EVENTS ==="),c.filter((e=>!e.global&&"."!==e.event)).forEach((({event:e,components:t})=>console.log({event:e},t)))})("print"===t)}],window["_apprun-log"]=["log [event|view] on|off",(e,t)=>{var n;"on"===e?v=3:"off"===e?v=0:"event"===e?"on"===t?v|=1:"off"===t&&(v&=-2):"view"===e&&("on"===t?v|=2:"off"===t&&(v&=-3)),console.log(`* log ${e} ${t||""}`),null===(n=null===window||void 0===window?void 0:window.localStorage)||void 0===n||n.setItem("__apprun_debugging__",`${v}`)}],window["_apprun-create-event-tests"]=["create-event-tests",()=>(()=>{const e={components:{}};app.run("get-components",e);const{components:t}=e;if(i(""),t instanceof Map)for(let[e,n]of t)n.forEach(u);else Object.keys(t).forEach((e=>{t[e].forEach(u)}));p()})()],window["_apprun-create-state-tests"]=["create-state-tests <start|stop>",e=>{var t;"start"===(t=e)?(d=[],f=!0,console.log("* State logging started.")):"stop"===t?(0!==d.length?(i(""),d.forEach(((e,t)=>{a(` it ('view snapshot: #${t+1}', ()=>{`),a(` const component = new ${e.component.constructor.name}()`),a(` const state = ${JSON.stringify(e.state,void 0,2)};`),a(" const vdom = component['view'](state);"),a(" expect(JSON.stringify(vdom)).toMatchSnapshot();"),a(" })")})),p()):console.log("* No state recorded."),f=!1,d=[],console.log("* State logging stopped.")):console.log("create-state-tests <start|stop>")}],window._apprun=e=>{const[t,...n]=e[0].split(" ").filter((e=>!!e)),o=window[`_apprun-${t}`];o?o[1](...n):window["_apprun-help"][1]()},console.info('AppRun DevTools 2.27: type "_apprun `help`" to list all available commands.'),window.__REDUX_DEVTOOLS_EXTENSION__){let t=!1;const n=window.__REDUX_DEVTOOLS_EXTENSION__.connect();if(n){const o=location.hash||"#";n.send(o,"");const s=[{component:null,state:""}];console.info("Connected to the Redux DevTools"),n.subscribe((n=>{if("START"===n.type)t=!0;else if("STOP"===n.type)t=!1;else if("DISPATCH"===n.type){const t=n.payload.index;if(0===t)e.Z.run(o);else{const{component:e,state:n}=s[t];null==e||e.setState(n)}}}));const l=(e,t,o)=>{null!=o&&(s.push({component:e,state:o}),n.send(t,o))};e.Z.on("debug",(e=>{if(t&&e.event){const t=e.newState,n={type:e.event,payload:e.p},o=e.component;t instanceof Promise?t.then((e=>l(o,n,e))):l(o,n,t)}}))}}})(),o})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apprun=t():e.apprun=t()}(this,(()=>(()=>{"use strict";var e={752:(e,t,n)=>{n.d(t,{Z:()=>l});let o;const s="object"==typeof self&&self.self===self&&self||"object"==typeof n.g&&n.g.global===n.g&&n.g;s.app&&s._AppRunVersions?o=s.app:(o=new class{constructor(){this._events={}}on(e,t,n={}){this._events[e]=this._events[e]||[],this._events[e].push({fn:t,options:n})}off(e,t){const n=this._events[e]||[];this._events[e]=n.filter((e=>e.fn!==t))}find(e){return this._events[e]}run(e,...t){const n=this.getSubscribers(e,this._events);return console.assert(n&&n.length>0,"No subscriber for event: "+e),n.forEach((n=>{const{fn:o,options:s}=n;return s.delay?this.delay(e,o,t,s):Object.keys(s).length>0?o.apply(this,[...t,s]):o.apply(this,t),!n.options.once})),n.length}once(e,t,n={}){this.on(e,t,Object.assign(Object.assign({},n),{once:!0}))}delay(e,t,n,o){o._t&&clearTimeout(o._t),o._t=setTimeout((()=>{clearTimeout(o._t),Object.keys(o).length>0?t.apply(this,[...n,o]):t.apply(this,n)}),o.delay)}runAsync(e,...t){const n=this.getSubscribers(e,this._events);console.assert(n&&n.length>0,"No subscriber for event: "+e);const o=n.map((e=>{const{fn:n,options:o}=e;return Object.keys(o).length>0?n.apply(this,[...t,o]):n.apply(this,t)}));return Promise.all(o)}query(e,...t){return this.query(e,...t)}getSubscribers(e,t){const n=t[e]||[];return t[e]=n.filter((e=>!e.options.once)),Object.keys(t).filter((t=>t.endsWith("*")&&e.startsWith(t.replace("*","")))).sort(((e,t)=>t.length-e.length)).forEach((o=>n.push(...t[o].map((t=>Object.assign(Object.assign({},t),{options:Object.assign(Object.assign({},t.options),{event:e})})))))),n}},s.app=o,s._AppRunVersions="AppRun-3");const l=o}},t={};function n(o){var s=t[o];if(void 0!==s)return s.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o);var e=n(752);function t(e){return e.map((e=>l(e))).join("")}function s(e){for(var t in e)null==e[t]?delete e[t]:"object"==typeof e[t]&&s(e[t])}function l(e){if(!e)return"";if("_$litType$"in e)return e.toString();if(s(e),Array.isArray(e))return t(e);if("string"==typeof e)return e.startsWith("_html:")?e.substring(6):e;if(e.tag){const n=e.props?function(e){return Object.keys(e).map((t=>{return` ${"className"===t?"class":t}="${n=e[t],"object"==typeof n?Object.keys(n).map((e=>`${e}:${n[e]}`)).join(";"):n.toString()}"`;var n})).join("")}(e.props):"",o=e.children?t(e.children):"";return`<${e.tag}${n}>${o}</${e.tag}>`}return"object"==typeof e?JSON.stringify(e):void 0}const r=l;let c;function i(e){c=window.open("",e),c.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI" }\n </style>\n <body><pre>`)}function a(e){c.document.write(e+"\n")}function p(){c.document.write("</pre>\n </body>\n </html>"),c.document.close()}app.debug=!0;const u=e=>{a(`import ${e.constructor.name} from '../src/${e.constructor.name}'`),a(`describe('${e.constructor.name}', ()=>{`),e._actions.forEach((t=>{"."!==t.name&&(a(` it ('should handle event: ${t.name}', (done)=>{`),a(` const component = new ${e.constructor.name}().mount();`),a(` component.run('${t.name}');`),a(" setTimeout(() => {"),a(" //expect(?).toHaveBeenCalled();"),a(" //expect(component.state).toBe(?);"),a(" done();"),a(" })"))})),a("});")};let f=!1,d=[];app.on("debug",(e=>{f&&e.vdom&&(d.push(e),console.log(`* ${d.length} state(s) recorded.`))}));var m;function h(e){const t=window.open("","_apprun_debug","toolbar=0");t.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI" }\n li { margin-left: 80px; }\n </style>\n <body>\n <div id="main">${e}</div>\n <\/script>\n </body>\n </html>`),t.document.close()}e.Z.debug=!0,window["_apprun-help"]=["",()=>{Object.keys(window).forEach((e=>{e.startsWith("_apprun-")&&("_apprun-help"===e?console.log("AppRun Commands:"):console.log(`* ${e.substring(8)}: ${window[e][0]}`))}))}];const g=()=>{const t={components:{}};e.Z.run("get-components",t);const{components:n}=t;return n};let v=Number(null===(m=null===window||void 0===window?void 0:window.localStorage)||void 0===m?void 0:m.getItem("__apprun_debugging__"))||0;if(e.Z.on("debug",(e=>{1&v&&e.event&&console.log(e),2&v&&e.vdom&&console.log(e)})),window["_apprun-components"]=["components [print]",t=>{(t=>{const n=g(),o=[];if(n instanceof Map)for(let[e,t]of n){const n="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;o.push({element:n,comps:t})}else Object.keys(n).forEach((e=>{const t="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;o.push({element:t,comps:n[e]})}));if(t){const t=(t=>{const n=({events:t})=>e.Z.h("ul",null,t&&t.filter((e=>"."!==e.name)).map((t=>e.Z.h("li",null,t.name)))),o=({components:t})=>e.Z.h("ul",null,t.map((t=>e.Z.h("li",null,e.Z.h("div",null,t.constructor.name),e.Z.h(n,{events:t._actions})))));return e.Z.h("ul",null,t.map((({element:t,comps:n})=>e.Z.h("li",null,e.Z.h("div",null,(t=>e.Z.h("div",null,t.tagName.toLowerCase(),t.id?"#"+t.id:""," ",t.className&&t.className.split(" ").map((e=>"."+e)).join()))(t)),e.Z.h(o,{components:n})))))})(o);h(r(t))}else o.forEach((({element:e,comps:t})=>console.log(e,t)))})("print"===t)}],window["_apprun-events"]=["events [print]",t=>{(t=>{const n=e.Z._events,o={},s=g(),l=e=>e._actions.forEach((t=>{o[t.name]=o[t.name]||[],o[t.name].push(e)}));if(s instanceof Map)for(let[e,t]of s)t.forEach(l);else Object.keys(s).forEach((e=>s[e].forEach(l)));const c=[];if(Object.keys(o).forEach((e=>{c.push({event:e,components:o[e],global:!!n[e]})})),c.sort(((e,t)=>e.event>t.event?1:-1)).map((e=>e.event)),t){const t=(t=>{const n=({components:t})=>e.Z.h("ul",null,t.map((t=>e.Z.h("li",null,e.Z.h("div",null,t.constructor.name))))),o=({events:t,global:o})=>e.Z.h("ul",null,t&&t.filter((e=>e.global===o&&"."!==e.event)).map((({event:t,components:o})=>e.Z.h("li",null,e.Z.h("div",null,t),e.Z.h(n,{components:o})))));return e.Z.h("div",null,e.Z.h("div",null,"GLOBAL EVENTS"),e.Z.h(o,{events:t,global:!0}),e.Z.h("div",null,"LOCAL EVENTS"),e.Z.h(o,{events:t,global:!1}))})(c);h(r(t))}else console.log("=== GLOBAL EVENTS ==="),c.filter((e=>e.global&&"."!==e.event)).forEach((({event:e,components:t})=>console.log({event:e},t))),console.log("=== LOCAL EVENTS ==="),c.filter((e=>!e.global&&"."!==e.event)).forEach((({event:e,components:t})=>console.log({event:e},t)))})("print"===t)}],window["_apprun-log"]=["log [event|view] on|off",(e,t)=>{var n;"on"===e?v=3:"off"===e?v=0:"event"===e?"on"===t?v|=1:"off"===t&&(v&=-2):"view"===e&&("on"===t?v|=2:"off"===t&&(v&=-3)),console.log(`* log ${e} ${t||""}`),null===(n=null===window||void 0===window?void 0:window.localStorage)||void 0===n||n.setItem("__apprun_debugging__",`${v}`)}],window["_apprun-create-event-tests"]=["create-event-tests",()=>(()=>{const e={components:{}};app.run("get-components",e);const{components:t}=e;if(i(""),t instanceof Map)for(let[e,n]of t)n.forEach(u);else Object.keys(t).forEach((e=>{t[e].forEach(u)}));p()})()],window["_apprun-create-state-tests"]=["create-state-tests <start|stop>",e=>{var t;"start"===(t=e)?(d=[],f=!0,console.log("* State logging started.")):"stop"===t?(0!==d.length?(i(""),d.forEach(((e,t)=>{a(` it ('view snapshot: #${t+1}', ()=>{`),a(` const component = new ${e.component.constructor.name}()`),a(` const state = ${JSON.stringify(e.state,void 0,2)};`),a(" const vdom = component['view'](state);"),a(" expect(JSON.stringify(vdom)).toMatchSnapshot();"),a(" })")})),p()):console.log("* No state recorded."),f=!1,d=[],console.log("* State logging stopped.")):console.log("create-state-tests <start|stop>")}],window._apprun=e=>{const[t,...n]=e[0].split(" ").filter((e=>!!e)),o=window[`_apprun-${t}`];o?o[1](...n):window["_apprun-help"][1]()},console.info('AppRun DevTools 2.27: type "_apprun `help`" to list all available commands.'),window.__REDUX_DEVTOOLS_EXTENSION__){let t=!1;const n=window.__REDUX_DEVTOOLS_EXTENSION__.connect();if(n){const o=location.hash||"#";n.send(o,"");const s=[{component:null,state:""}];console.info("Connected to the Redux DevTools"),n.subscribe((n=>{if("START"===n.type)t=!0;else if("STOP"===n.type)t=!1;else if("DISPATCH"===n.type){const t=n.payload.index;if(0===t)e.Z.run(o);else{const{component:e,state:n}=s[t];null==e||e.setState(n)}}}));const l=(e,t,o)=>{null!=o&&(s.push({component:e,state:o}),n.send(t,o))};e.Z.on("debug",(e=>{if(t&&e.event){const t=e.newState,n={type:e.event,payload:e.p},o=e.component;t instanceof Promise?t.then((e=>l(o,n,e))):l(o,n,t)}}))}}})(),o})()));
2
2
  //# sourceMappingURL=apprun-dev-tools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dist/apprun-dev-tools.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,yDCiFT,IAAIC,EACJ,MAAMP,EAAwB,iBAATQ,MAAqBA,KAAKA,OAASA,MAAQA,MAC3C,iBAAX,EAAAC,GAAuB,EAAAA,EAAOC,SAAW,EAAAD,GAAU,EAAAA,EACzDT,EAAU,KAAKA,EAAsB,gBACvCO,EAAMP,EAAU,KAEhBO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AEyF,UACxD,GAAID,EAAU,CACZ,MAAME,EAAOzD,SAASyD,MAAQ,IAC9BF,EAASG,KAAKD,EAAM,IACpB,MAAME,EAAM,CAAC,CAAErD,UAAU,KAAMuB,MAAM,KACrCxG,QAAQgI,KAAK,mCACbE,EAASK,WAAWC,IAClB,GAAqB,UAAjBA,EAAQC,KAAkBR,GAAmB,OAC5C,GAAqB,SAAjBO,EAAQC,KAAiBR,GAAmB,OAChD,GAAqB,aAAjBO,EAAQC,KAAqB,CAEpC,MAAMZ,EAAMW,EAAQE,QAAQC,MAC5B,GAAY,IAARd,EAAa,QAAQO,OACpB,CACH,MAAM,UAAEnD,EAAS,MAAEuB,GAAU8B,EAAIT,GACjC5C,SAAAA,EAAW2D,SAASpC,E,MAK1B,MAAM6B,EAAO,CAACpD,EAAWE,EAAQqB,KAClB,MAATA,IACJ8B,EAAI/I,KAAK,CAAE0F,YAAWuB,UACtB0B,EAASG,KAAKlD,EAAQqB,GAAM,EAG9B,OAAO,SAASnB,IACd,GAAI4C,GAAoB5C,EAAE5D,MAAO,CAC/B,MAAM+E,EAAQnB,EAAEwD,SAGV1D,EAAS,CAAEsD,KAFJpD,EAAE5D,MAEQiH,QADPrD,EAAEA,GAEZJ,EAAYI,EAAEJ,UAChBuB,aAAiBzF,QACnByF,EAAMsC,MAAKlB,GAAKS,EAAKpD,EAAWE,EAAQyC,KAExCS,EAAKpD,EAAWE,EAAQqB,E","sources":["webpack://apprun/webpack/universalModuleDefinition","webpack://apprun/./src/app.ts","webpack://apprun/webpack/bootstrap","webpack://apprun/webpack/runtime/define property getters","webpack://apprun/webpack/runtime/global","webpack://apprun/webpack/runtime/hasOwnProperty shorthand","webpack://apprun/webpack/runtime/make namespace object","webpack://apprun/./src/vdom-to-html.tsx","webpack://apprun/./src/apprun-dev-tools-tests.tsx","webpack://apprun/./src/apprun-dev-tools.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"apprun\"] = factory();\n\telse\n\t\troot[\"apprun\"] = factory();\n})(this, () => {\nreturn ","import { EventOptions} from './types'\nexport class App {\n\n private _events: Object;\n\n public start;\n public h;\n public createElement;\n public render;\n public Fragment;\n public webComponent;\n public safeHTML;\n\n constructor() {\n this._events = {};\n }\n\n on(name: string, fn: (...args) => void, options: EventOptions = {}): void {\n this._events[name] = this._events[name] || [];\n this._events[name].push({ fn, options });\n }\n\n off(name: string, fn: (...args) => void): void {\n const subscribers = this._events[name] || [];\n\n this._events[name] = subscribers.filter((sub) => sub.fn !== fn);\n }\n\n find(name: string): any {\n return this._events[name];\n }\n\n run(name: string, ...args): number {\n const subscribers = this.getSubscribers(name, this._events);\n console.assert(subscribers && subscribers.length > 0, 'No subscriber for event: ' + name);\n subscribers.forEach((sub) => {\n const { fn, options } = sub;\n if (options.delay) {\n this.delay(name, fn, args, options);\n } else {\n Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n }\n return !sub.options.once;\n });\n\n return subscribers.length;\n }\n\n once(name: string, fn, options: EventOptions = {}): void {\n this.on(name, fn, { ...options, once: true });\n }\n\n private delay(name, fn, args, options): void {\n if (options._t) clearTimeout(options._t);\n options._t = setTimeout(() => {\n clearTimeout(options._t);\n Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n }, options.delay);\n }\n\n query(name: string, ...args): Promise<any[]> {\n const subscribers = this.getSubscribers(name, this._events);\n console.assert(subscribers && subscribers.length > 0, 'No subscriber for event: ' + name);\n const promises = subscribers.map(sub => {\n const { fn, options } = sub;\n return Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n });\n return Promise.all(promises);\n }\n\n private getSubscribers(name: string, events) {\n const subscribers = events[name] || [];\n\n // Update the list of subscribers by pulling out those which will run once.\n // We must do this update prior to running any of the events in case they\n // cause additional events to be turned off or on.\n events[name] = subscribers.filter((sub) => {\n return !sub.options.once;\n });\n Object.keys(events).filter(evt => evt.endsWith('*') && name.startsWith(evt.replace('*', '')))\n .sort((a, b) => b.length - a.length)\n .forEach(evt => subscribers.push(...events[evt].map(sub => ({\n ...sub,\n options: { ...sub.options, event: name }\n }))));\n return subscribers;\n }\n}\n\nconst AppRunVersions = 'AppRun-3';\nlet app: App;\nconst root = (typeof self === 'object' && self.self === self && self) ||\n (typeof global === 'object' && global.global === global && global)\nif (root['app'] && root['_AppRunVersions']) {\n app = root['app'];\n} else {\n app = new App();\n root['app'] = app;\n root['_AppRunVersions'] = AppRunVersions;\n}\nexport default app;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\nimport { VDOM } from './types';\nimport { TemplateResult } from 'lit-html';\n\nfunction getProp(prop) {\n if (typeof prop === 'object') {\n return Object.keys(prop).map(name => `${name}:${prop[name]}`).join(';');\n }\n else return prop.toString();\n}\n\nfunction toProps(props) {\n return Object.keys(props)\n .map(name => ` ${name === 'className' ? 'class' : name}=\"${getProp(props[name])}\"`)\n .join('');\n}\n\nfunction toHTMLArray(nodes) {\n return nodes.map(node => toHTML(node)).join('');\n}\n\nfunction clean(obj) {\n for (var i in obj) {\n if (obj[i] == null) {\n delete obj[i];\n } else if (typeof obj[i] === 'object') {\n clean(obj[i]);\n }\n }\n}\n\nfunction toHTML (vdom) {\n if (!vdom) return '';\n if ('_$litType$' in vdom) {\n return vdom.toString();\n }\n clean(vdom);\n if (Array.isArray(vdom)) return toHTMLArray(vdom);\n if (typeof vdom === 'string') {\n return vdom.startsWith('_html:') ? vdom.substring(6) : vdom;\n } else if (vdom.tag) {\n const props = vdom.props ? toProps(vdom.props) : '';\n const children = vdom.children ? toHTMLArray(vdom.children) : '';\n return `<${vdom.tag}${props}>${children}</${vdom.tag}>`;\n }\n if (typeof vdom === 'object') return JSON.stringify(vdom);\n}\n\nexport default toHTML;","declare var app;\nlet win;\napp['debug'] = true;\n\nfunction openWin(name) {\n win = window.open('', name);\n win.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\" }\n </style>\n <body><pre>`);\n}\n\nfunction write(text) {\n win.document.write(text + '\\n');\n}\n\nfunction closeWin() {\n win.document.write(`</pre>\n </body>\n </html>`);\n win.document.close();\n}\n\nconst print_component_test = component => {\n write(`import ${component.constructor.name} from '../src/${component.constructor.name}'`);\n write(`describe('${component.constructor.name}', ()=>{`);\n component._actions.forEach(action => {\n if (action.name !== '.') {\n write(` it ('should handle event: ${action.name}', (done)=>{`);\n write(` const component = new ${component.constructor.name}().mount();`);\n write(` component.run('${action.name}');`);\n write(` setTimeout(() => {`);\n write(` \\/\\/expect(?).toHaveBeenCalled();`);\n write(` \\/\\/expect(component.state).toBe(?);`);\n write(` done();`);\n write(` })`);\n }\n });\n write(`});`);\n};\nexport const _createEventTests = () => {\n const o = { components: {} };\n app.run('get-components', o);\n const { components } = o;\n openWin('');\n if (components instanceof Map) {\n for (let [key, comps] of components) {\n comps.forEach(print_component_test);\n }\n } else {\n Object.keys(components).forEach(el => {\n components[el].forEach(print_component_test);\n });\n }\n closeWin();\n}\n\nlet recording = false;\nlet events = [];\n\napp.on('debug', p => {\n if (recording && p.vdom) {\n events.push(p);\n console.log(`* ${events.length} state(s) recorded.`);\n }\n});\n\nexport const _createStateTests = (s) => {\n\n const printTests = () => {\n if (events.length === 0) {\n console.log('* No state recorded.');\n return;\n }\n openWin('');\n events.forEach((event, idx) => {\n write(` it ('view snapshot: #${idx + 1}', ()=>{`);\n write(` const component = new ${event.component.constructor.name}()`);\n write(` const state = ${JSON.stringify(event.state, undefined, 2)};`);\n write(` const vdom = component['view'](state);`);\n write(` expect(JSON.stringify(vdom)).toMatchSnapshot();`);\n write(` })`);\n });\n closeWin();\n }\n\n if (s === 'start') {\n events = [];\n recording = true;\n console.log('* State logging started.');\n } else if (s === 'stop') {\n printTests();\n recording = false;\n events = [];\n console.log('* State logging stopped.');\n } else {\n console.log('create-state-tests <start|stop>');\n }\n}\n","import app from './app';\nimport toHTML from './vdom-to-html';\nimport { _createEventTests, _createStateTests } from './apprun-dev-tools-tests';\n\napp['debug'] = true;\n\nwindow['_apprun-help'] = ['', () => {\n Object.keys(window).forEach(cmd => {\n if (cmd.startsWith('_apprun-')) {\n cmd === '_apprun-help' ?\n console.log('AppRun Commands:') :\n console.log(`* ${cmd.substring(8)}: ${window[cmd][0]}`);\n }\n });\n}];\n\nfunction newWin(html) {\n const win = window.open('', '_apprun_debug', 'toolbar=0');\n win.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\" }\n li { margin-left: 80px; }\n </style>\n <body>\n <div id=\"main\">${html}</div>\n </script>\n </body>\n </html>`);\n win.document.close();\n}\n\nconst get_components = () => {\n const o = { components: {} };\n app.run('get-components', o);\n const { components } = o;\n return components;\n}\nconst viewElement = element => <div>\n {element.tagName.toLowerCase()}{element.id ? '#' + element.id : ''}\n {' '}\n {element.className && element.className.split(' ').map(c => '.' + c).join() }\n</div>;\n\nconst viewComponents = state => {\n\n const Events = ({ events }) => <ul>\n {events && events.filter(event => event.name !== '.').map(event => <li>\n {event.name}\n </li>)}\n </ul>;\n\n const Components = ({ components }) => <ul>\n {components.map(component => <li>\n <div>{component.constructor.name}</div>\n <Events events={component['_actions']} />\n </li>)}\n </ul>;\n\n return <ul>\n {state.map(({ element, comps}) => <li>\n <div>{viewElement(element)}</div>\n <Components components={comps} />\n </li>)}\n </ul>\n}\n\nconst viewEvents = state => {\n\n const Components = ({ components }) => <ul>\n {components.map(component => <li>\n <div>{component.constructor.name}</div>\n </li>)}\n </ul>;\n\n const Events = ({ events, global }) => <ul>\n {events && events\n .filter(event =>\n event.global === global && event.event !== '.')\n .map(({ event, components }) => <li>\n <div>{event}</div>\n <Components components={components} />\n </li>)}\n </ul>;\n\n return <div>\n <div>GLOBAL EVENTS</div>\n <Events events={state} global={true} />\n <div>LOCAL EVENTS</div>\n <Events events={state} global={false} />\n </div>\n}\n\nconst _events = (print?) => {\n const global_events = app['_events']\n const events = {};\n const cache = get_components();\n\n const add_component = component => component['_actions'].forEach(event => {\n events[event.name] = events[event.name] || [];\n events[event.name].push(component);\n });\n\n if (cache instanceof Map) {\n for (let [key, comps] of cache) {\n comps.forEach(add_component);\n }\n } else {\n Object.keys(cache).forEach(el =>\n cache[el].forEach(add_component)\n );\n }\n const data = [];\n Object.keys(events).forEach(event => {\n data.push({ event, components: events[event], global: global_events[event] ? true : false });\n });\n\n data.sort(((a, b) => a.event > b.event ? 1 : -1)).map(e => e.event);\n\n if (print) {\n const vdom = viewEvents(data);\n newWin(toHTML(vdom));\n } else {\n console.log('=== GLOBAL EVENTS ===')\n data.filter(event => event.global && event.event !== '.')\n .forEach(({ event, components }) => console.log({ event }, components));\n console.log('=== LOCAL EVENTS ===')\n data.filter(event => !event.global && event.event !== '.')\n .forEach(({ event, components }) => console.log({ event }, components));\n }\n}\n\nconst _components = (print?) => {\n const components = get_components();\n const data = [];\n\n if (components instanceof Map) {\n for (let [key, comps] of components) {\n const element = typeof key === 'string' ? document.getElementById(key) || document.querySelector(key): key;\n data.push({ element, comps });\n }\n } else {\n Object.keys(components).forEach(el => {\n const element = typeof el === 'string' ? document.getElementById(el) || document.querySelector(el): el;\n data.push({ element, comps: components[el] });\n });\n }\n if (print) {\n const vdom = viewComponents(data);\n newWin(toHTML(vdom));\n } else {\n data.forEach(({ element, comps }) => console.log(element, comps));\n }\n}\n\nlet debugging = Number(window?.localStorage?.getItem('__apprun_debugging__')) || 0;\napp.on('debug', p => {\n if (debugging & 1 && p.event) console.log(p);\n if (debugging & 2 && p.vdom) console.log(p);\n});\n\nwindow['_apprun-components'] = ['components [print]', (p) => {\n _components(p === 'print');\n}]\n\nwindow['_apprun-events'] = ['events [print]', (p) => {\n _events(p === 'print');\n}]\n\nwindow['_apprun-log'] = ['log [event|view] on|off', (a1?, a2?) => {\n if (a1 === 'on') {\n debugging = 3;\n } else if (a1 === 'off') {\n debugging = 0;\n } else if (a1 === 'event') {\n if (a2 === 'on') {\n debugging |= 1;\n } else if (a2 === 'off') {\n debugging &= ~1;\n }\n } else if (a1 === 'view') {\n if (a2 === 'on') {\n debugging |= 2;\n } else if (a2 === 'off') {\n debugging &= ~2;\n }\n }\n console.log(`* log ${a1} ${a2 || ''}`);\n window?.localStorage?.setItem('__apprun_debugging__', `${debugging}`)\n}];\n\nwindow['_apprun-create-event-tests'] = ['create-event-tests',\n () => _createEventTests()\n]\n\nwindow['_apprun-create-state-tests'] = ['create-state-tests <start|stop>',\n (p?) => _createStateTests(p)\n]\n\nwindow['_apprun'] = (strings) => {\n const [cmd, ...p] = strings[0].split(' ').filter(c => !!c);\n const command = window[`_apprun-${cmd}`];\n if (command) command[1](...p);\n else window['_apprun-help'][1]();\n}\n\nconsole.info('AppRun DevTools 2.27: type \"_apprun `help`\" to list all available commands.');\n\nconst reduxExt = window['__REDUX_DEVTOOLS_EXTENSION__'];\nif (reduxExt) {\n let devTools_running = false;\n const devTools = window['__REDUX_DEVTOOLS_EXTENSION__'].connect();\n if (devTools) {\n const hash = location.hash || '#';\n devTools.send(hash, '' );\n const buf = [{ component:null, state:''}];\n console.info('Connected to the Redux DevTools');\n devTools.subscribe((message) => {\n if (message.type === 'START') devTools_running = true;\n else if (message.type === 'STOP') devTools_running = false;\n else if (message.type === 'DISPATCH') {\n // console.log('From Redux DevTools: ', message);\n const idx = message.payload.index;\n if (idx === 0) { app.run(hash) }\n else {\n const { component, state } = buf[idx];\n component?.setState(state);\n }\n }\n });\n\n const send = (component, action, state) => {\n if (state == null) return;\n buf.push({ component, state });\n devTools.send(action, state);\n }\n\n app.on('debug', p => {\n if (devTools_running && p.event) {\n const state = p.newState;\n const type = p.event;\n const payload = p.p;\n const action = { type, payload };\n const component = p.component;\n if (state instanceof Promise) {\n state.then(s => send(component, action, s));\n } else {\n send(component, action, state);\n }\n }\n });\n }\n}\n"],"names":["root","factory","exports","module","define","amd","this","app","self","g","global","constructor","_events","on","name","fn","options","push","off","subscribers","filter","sub","find","run","args","getSubscribers","console","assert","length","forEach","delay","Object","keys","apply","once","_t","clearTimeout","setTimeout","query","promises","map","Promise","all","events","evt","endsWith","startsWith","replace","sort","a","b","event","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","defineProperty","enumerable","get","globalThis","Function","e","window","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","toHTMLArray","nodes","node","toHTML","join","clean","i","vdom","toString","Array","isArray","substring","tag","props","toProps","children","JSON","stringify","win","openWin","open","document","write","location","href","text","closeWin","close","print_component_test","component","_actions","action","recording","p","log","newWin","html","cmd","get_components","components","debugging","Number","localStorage","getItem","print","data","Map","comps","element","getElementById","querySelector","el","state","Events","Components","tagName","toLowerCase","id","className","split","c","viewElement","viewComponents","_components","global_events","cache","add_component","viewEvents","a1","a2","setItem","_createEventTests","s","idx","strings","command","info","devTools_running","devTools","connect","hash","send","buf","subscribe","message","type","payload","index","setState","newState","then"],"sourceRoot":""}
1
+ {"version":3,"file":"dist/apprun-dev-tools.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,yDCqFT,IAAIC,EACJ,MAAMP,EAAwB,iBAATQ,MAAqBA,KAAKA,OAASA,MAAQA,MAC3C,iBAAX,EAAAC,GAAuB,EAAAA,EAAOC,SAAW,EAAAD,GAAU,EAAAA,EACzDT,EAAU,KAAKA,EAAsB,gBACvCO,EAAMP,EAAU,KAEhBO,EAAM,IAnGD,MAYL,WAAAI,GACEL,KAAKM,QAAU,CAAC,CAClB,CAEA,EAAAC,CAAGC,EAAcC,EAAuBC,EAAwB,CAAC,GAC/DV,KAAKM,QAAQE,GAAQR,KAAKM,QAAQE,IAAS,GAC3CR,KAAKM,QAAQE,GAAMG,KAAK,CAAEF,KAAIC,WAChC,CAEA,GAAAE,CAAIJ,EAAcC,GAChB,MAAMI,EAAcb,KAAKM,QAAQE,IAAS,GAE1CR,KAAKM,QAAQE,GAAQK,EAAYC,QAAQC,GAAQA,EAAIN,KAAOA,GAC9D,CAEA,IAAAO,CAAKR,GACH,OAAOR,KAAKM,QAAQE,EACtB,CAEA,GAAAS,CAAIT,KAAiBU,GACnB,MAAML,EAAcb,KAAK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,EAAQC,KAAqB,CAEpC,MAAMZ,EAAMW,EAAQE,QAAQC,MAC5B,GAAY,IAARd,EAAa,IAAIjI,IAAIwI,OACpB,CACH,MAAM,UAAEnD,EAAS,MAAEuB,GAAU8B,EAAIT,GACjC5C,SAAAA,EAAW2D,SAASpC,E,MAK1B,MAAM6B,EAAO,CAACpD,EAAWE,EAAQqB,KAClB,MAATA,IACJ8B,EAAIhJ,KAAK,CAAE2F,YAAWuB,UACtB0B,EAASG,KAAKlD,EAAQqB,GAAM,EAG9B,IAAItH,GAAG,SAASmG,IACd,GAAI4C,GAAoB5C,EAAE5D,MAAO,CAC/B,MAAM+E,EAAQnB,EAAEwD,SAGV1D,EAAS,CAAEsD,KAFJpD,EAAE5D,MAEQiH,QADPrD,EAAEA,GAEZJ,EAAYI,EAAEJ,UAChBuB,aAAiB1F,QACnB0F,EAAMsC,MAAKlB,GAAKS,EAAKpD,EAAWE,EAAQyC,KAExCS,EAAKpD,EAAWE,EAAQqB,E","sources":["webpack://apprun/webpack/universalModuleDefinition","webpack://apprun/./src/app.ts","webpack://apprun/webpack/bootstrap","webpack://apprun/webpack/runtime/define property getters","webpack://apprun/webpack/runtime/global","webpack://apprun/webpack/runtime/hasOwnProperty shorthand","webpack://apprun/webpack/runtime/make namespace object","webpack://apprun/./src/vdom-to-html.tsx","webpack://apprun/./src/apprun-dev-tools-tests.tsx","webpack://apprun/./src/apprun-dev-tools.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"apprun\"] = factory();\n\telse\n\t\troot[\"apprun\"] = factory();\n})(this, () => {\nreturn ","import { EventOptions} from './types'\nexport class App {\n\n private _events: Object;\n\n public start;\n public h;\n public createElement;\n public render;\n public Fragment;\n public webComponent;\n public safeHTML;\n\n constructor() {\n this._events = {};\n }\n\n on(name: string, fn: (...args) => void, options: EventOptions = {}): void {\n this._events[name] = this._events[name] || [];\n this._events[name].push({ fn, options });\n }\n\n off(name: string, fn: (...args) => void): void {\n const subscribers = this._events[name] || [];\n\n this._events[name] = subscribers.filter((sub) => sub.fn !== fn);\n }\n\n find(name: string): any {\n return this._events[name];\n }\n\n run(name: string, ...args): number {\n const subscribers = this.getSubscribers(name, this._events);\n console.assert(subscribers && subscribers.length > 0, 'No subscriber for event: ' + name);\n subscribers.forEach((sub) => {\n const { fn, options } = sub;\n if (options.delay) {\n this.delay(name, fn, args, options);\n } else {\n Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n }\n return !sub.options.once;\n });\n\n return subscribers.length;\n }\n\n once(name: string, fn, options: EventOptions = {}): void {\n this.on(name, fn, { ...options, once: true });\n }\n\n private delay(name, fn, args, options): void {\n if (options._t) clearTimeout(options._t);\n options._t = setTimeout(() => {\n clearTimeout(options._t);\n Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n }, options.delay);\n }\n\n runAsync(name: string, ...args): Promise<any[]> {\n const subscribers = this.getSubscribers(name, this._events);\n console.assert(subscribers && subscribers.length > 0, 'No subscriber for event: ' + name);\n const promises = subscribers.map(sub => {\n const { fn, options } = sub;\n return Object.keys(options).length > 0 ? fn.apply(this, [...args, options]) : fn.apply(this, args);\n });\n return Promise.all(promises);\n }\n\n query(name: string, ...args): Promise<any[]> {\n return this.query(name, ...args);\n }\n\n private getSubscribers(name: string, events) {\n const subscribers = events[name] || [];\n\n // Update the list of subscribers by pulling out those which will run once.\n // We must do this update prior to running any of the events in case they\n // cause additional events to be turned off or on.\n events[name] = subscribers.filter((sub) => {\n return !sub.options.once;\n });\n Object.keys(events).filter(evt => evt.endsWith('*') && name.startsWith(evt.replace('*', '')))\n .sort((a, b) => b.length - a.length)\n .forEach(evt => subscribers.push(...events[evt].map(sub => ({\n ...sub,\n options: { ...sub.options, event: name }\n }))));\n return subscribers;\n }\n}\n\nconst AppRunVersions = 'AppRun-3';\nlet app: App;\nconst root = (typeof self === 'object' && self.self === self && self) ||\n (typeof global === 'object' && global.global === global && global)\nif (root['app'] && root['_AppRunVersions']) {\n app = root['app'];\n} else {\n app = new App();\n root['app'] = app;\n root['_AppRunVersions'] = AppRunVersions;\n}\nexport default app;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\nimport { VDOM } from './types';\nimport { TemplateResult } from 'lit-html';\n\nfunction getProp(prop) {\n if (typeof prop === 'object') {\n return Object.keys(prop).map(name => `${name}:${prop[name]}`).join(';');\n }\n else return prop.toString();\n}\n\nfunction toProps(props) {\n return Object.keys(props)\n .map(name => ` ${name === 'className' ? 'class' : name}=\"${getProp(props[name])}\"`)\n .join('');\n}\n\nfunction toHTMLArray(nodes) {\n return nodes.map(node => toHTML(node)).join('');\n}\n\nfunction clean(obj) {\n for (var i in obj) {\n if (obj[i] == null) {\n delete obj[i];\n } else if (typeof obj[i] === 'object') {\n clean(obj[i]);\n }\n }\n}\n\nfunction toHTML (vdom) {\n if (!vdom) return '';\n if ('_$litType$' in vdom) {\n return vdom.toString();\n }\n clean(vdom);\n if (Array.isArray(vdom)) return toHTMLArray(vdom);\n if (typeof vdom === 'string') {\n return vdom.startsWith('_html:') ? vdom.substring(6) : vdom;\n } else if (vdom.tag) {\n const props = vdom.props ? toProps(vdom.props) : '';\n const children = vdom.children ? toHTMLArray(vdom.children) : '';\n return `<${vdom.tag}${props}>${children}</${vdom.tag}>`;\n }\n if (typeof vdom === 'object') return JSON.stringify(vdom);\n}\n\nexport default toHTML;","declare var app;\nlet win;\napp['debug'] = true;\n\nfunction openWin(name) {\n win = window.open('', name);\n win.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\" }\n </style>\n <body><pre>`);\n}\n\nfunction write(text) {\n win.document.write(text + '\\n');\n}\n\nfunction closeWin() {\n win.document.write(`</pre>\n </body>\n </html>`);\n win.document.close();\n}\n\nconst print_component_test = component => {\n write(`import ${component.constructor.name} from '../src/${component.constructor.name}'`);\n write(`describe('${component.constructor.name}', ()=>{`);\n component._actions.forEach(action => {\n if (action.name !== '.') {\n write(` it ('should handle event: ${action.name}', (done)=>{`);\n write(` const component = new ${component.constructor.name}().mount();`);\n write(` component.run('${action.name}');`);\n write(` setTimeout(() => {`);\n write(` \\/\\/expect(?).toHaveBeenCalled();`);\n write(` \\/\\/expect(component.state).toBe(?);`);\n write(` done();`);\n write(` })`);\n }\n });\n write(`});`);\n};\nexport const _createEventTests = () => {\n const o = { components: {} };\n app.run('get-components', o);\n const { components } = o;\n openWin('');\n if (components instanceof Map) {\n for (let [key, comps] of components) {\n comps.forEach(print_component_test);\n }\n } else {\n Object.keys(components).forEach(el => {\n components[el].forEach(print_component_test);\n });\n }\n closeWin();\n}\n\nlet recording = false;\nlet events = [];\n\napp.on('debug', p => {\n if (recording && p.vdom) {\n events.push(p);\n console.log(`* ${events.length} state(s) recorded.`);\n }\n});\n\nexport const _createStateTests = (s) => {\n\n const printTests = () => {\n if (events.length === 0) {\n console.log('* No state recorded.');\n return;\n }\n openWin('');\n events.forEach((event, idx) => {\n write(` it ('view snapshot: #${idx + 1}', ()=>{`);\n write(` const component = new ${event.component.constructor.name}()`);\n write(` const state = ${JSON.stringify(event.state, undefined, 2)};`);\n write(` const vdom = component['view'](state);`);\n write(` expect(JSON.stringify(vdom)).toMatchSnapshot();`);\n write(` })`);\n });\n closeWin();\n }\n\n if (s === 'start') {\n events = [];\n recording = true;\n console.log('* State logging started.');\n } else if (s === 'stop') {\n printTests();\n recording = false;\n events = [];\n console.log('* State logging stopped.');\n } else {\n console.log('create-state-tests <start|stop>');\n }\n}\n","import app from './app';\nimport toHTML from './vdom-to-html';\nimport { _createEventTests, _createStateTests } from './apprun-dev-tools-tests';\n\napp['debug'] = true;\n\nwindow['_apprun-help'] = ['', () => {\n Object.keys(window).forEach(cmd => {\n if (cmd.startsWith('_apprun-')) {\n cmd === '_apprun-help' ?\n console.log('AppRun Commands:') :\n console.log(`* ${cmd.substring(8)}: ${window[cmd][0]}`);\n }\n });\n}];\n\nfunction newWin(html) {\n const win = window.open('', '_apprun_debug', 'toolbar=0');\n win.document.write(`<html>\n <title>AppRun Analyzer | ${document.location.href}</title>\n <style>\n body { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\" }\n li { margin-left: 80px; }\n </style>\n <body>\n <div id=\"main\">${html}</div>\n </script>\n </body>\n </html>`);\n win.document.close();\n}\n\nconst get_components = () => {\n const o = { components: {} };\n app.run('get-components', o);\n const { components } = o;\n return components;\n}\nconst viewElement = element => <div>\n {element.tagName.toLowerCase()}{element.id ? '#' + element.id : ''}\n {' '}\n {element.className && element.className.split(' ').map(c => '.' + c).join() }\n</div>;\n\nconst viewComponents = state => {\n\n const Events = ({ events }) => <ul>\n {events && events.filter(event => event.name !== '.').map(event => <li>\n {event.name}\n </li>)}\n </ul>;\n\n const Components = ({ components }) => <ul>\n {components.map(component => <li>\n <div>{component.constructor.name}</div>\n <Events events={component['_actions']} />\n </li>)}\n </ul>;\n\n return <ul>\n {state.map(({ element, comps}) => <li>\n <div>{viewElement(element)}</div>\n <Components components={comps} />\n </li>)}\n </ul>\n}\n\nconst viewEvents = state => {\n\n const Components = ({ components }) => <ul>\n {components.map(component => <li>\n <div>{component.constructor.name}</div>\n </li>)}\n </ul>;\n\n const Events = ({ events, global }) => <ul>\n {events && events\n .filter(event =>\n event.global === global && event.event !== '.')\n .map(({ event, components }) => <li>\n <div>{event}</div>\n <Components components={components} />\n </li>)}\n </ul>;\n\n return <div>\n <div>GLOBAL EVENTS</div>\n <Events events={state} global={true} />\n <div>LOCAL EVENTS</div>\n <Events events={state} global={false} />\n </div>\n}\n\nconst _events = (print?) => {\n const global_events = app['_events']\n const events = {};\n const cache = get_components();\n\n const add_component = component => component['_actions'].forEach(event => {\n events[event.name] = events[event.name] || [];\n events[event.name].push(component);\n });\n\n if (cache instanceof Map) {\n for (let [key, comps] of cache) {\n comps.forEach(add_component);\n }\n } else {\n Object.keys(cache).forEach(el =>\n cache[el].forEach(add_component)\n );\n }\n const data = [];\n Object.keys(events).forEach(event => {\n data.push({ event, components: events[event], global: global_events[event] ? true : false });\n });\n\n data.sort(((a, b) => a.event > b.event ? 1 : -1)).map(e => e.event);\n\n if (print) {\n const vdom = viewEvents(data);\n newWin(toHTML(vdom));\n } else {\n console.log('=== GLOBAL EVENTS ===')\n data.filter(event => event.global && event.event !== '.')\n .forEach(({ event, components }) => console.log({ event }, components));\n console.log('=== LOCAL EVENTS ===')\n data.filter(event => !event.global && event.event !== '.')\n .forEach(({ event, components }) => console.log({ event }, components));\n }\n}\n\nconst _components = (print?) => {\n const components = get_components();\n const data = [];\n\n if (components instanceof Map) {\n for (let [key, comps] of components) {\n const element = typeof key === 'string' ? document.getElementById(key) || document.querySelector(key): key;\n data.push({ element, comps });\n }\n } else {\n Object.keys(components).forEach(el => {\n const element = typeof el === 'string' ? document.getElementById(el) || document.querySelector(el): el;\n data.push({ element, comps: components[el] });\n });\n }\n if (print) {\n const vdom = viewComponents(data);\n newWin(toHTML(vdom));\n } else {\n data.forEach(({ element, comps }) => console.log(element, comps));\n }\n}\n\nlet debugging = Number(window?.localStorage?.getItem('__apprun_debugging__')) || 0;\napp.on('debug', p => {\n if (debugging & 1 && p.event) console.log(p);\n if (debugging & 2 && p.vdom) console.log(p);\n});\n\nwindow['_apprun-components'] = ['components [print]', (p) => {\n _components(p === 'print');\n}]\n\nwindow['_apprun-events'] = ['events [print]', (p) => {\n _events(p === 'print');\n}]\n\nwindow['_apprun-log'] = ['log [event|view] on|off', (a1?, a2?) => {\n if (a1 === 'on') {\n debugging = 3;\n } else if (a1 === 'off') {\n debugging = 0;\n } else if (a1 === 'event') {\n if (a2 === 'on') {\n debugging |= 1;\n } else if (a2 === 'off') {\n debugging &= ~1;\n }\n } else if (a1 === 'view') {\n if (a2 === 'on') {\n debugging |= 2;\n } else if (a2 === 'off') {\n debugging &= ~2;\n }\n }\n console.log(`* log ${a1} ${a2 || ''}`);\n window?.localStorage?.setItem('__apprun_debugging__', `${debugging}`)\n}];\n\nwindow['_apprun-create-event-tests'] = ['create-event-tests',\n () => _createEventTests()\n]\n\nwindow['_apprun-create-state-tests'] = ['create-state-tests <start|stop>',\n (p?) => _createStateTests(p)\n]\n\nwindow['_apprun'] = (strings) => {\n const [cmd, ...p] = strings[0].split(' ').filter(c => !!c);\n const command = window[`_apprun-${cmd}`];\n if (command) command[1](...p);\n else window['_apprun-help'][1]();\n}\n\nconsole.info('AppRun DevTools 2.27: type \"_apprun `help`\" to list all available commands.');\n\nconst reduxExt = window['__REDUX_DEVTOOLS_EXTENSION__'];\nif (reduxExt) {\n let devTools_running = false;\n const devTools = window['__REDUX_DEVTOOLS_EXTENSION__'].connect();\n if (devTools) {\n const hash = location.hash || '#';\n devTools.send(hash, '' );\n const buf = [{ component:null, state:''}];\n console.info('Connected to the Redux DevTools');\n devTools.subscribe((message) => {\n if (message.type === 'START') devTools_running = true;\n else if (message.type === 'STOP') devTools_running = false;\n else if (message.type === 'DISPATCH') {\n // console.log('From Redux DevTools: ', message);\n const idx = message.payload.index;\n if (idx === 0) { app.run(hash) }\n else {\n const { component, state } = buf[idx];\n component?.setState(state);\n }\n }\n });\n\n const send = (component, action, state) => {\n if (state == null) return;\n buf.push({ component, state });\n devTools.send(action, state);\n }\n\n app.on('debug', p => {\n if (devTools_running && p.event) {\n const state = p.newState;\n const type = p.event;\n const payload = p.p;\n const action = { type, payload };\n const component = p.component;\n if (state instanceof Promise) {\n state.then(s => send(component, action, s));\n } else {\n send(component, action, state);\n }\n }\n });\n }\n}\n"],"names":["root","factory","exports","module","define","amd","this","app","self","g","global","constructor","_events","on","name","fn","options","push","off","subscribers","filter","sub","find","run","args","getSubscribers","console","assert","length","forEach","delay","Object","keys","apply","once","_t","clearTimeout","setTimeout","runAsync","promises","map","Promise","all","query","events","evt","endsWith","startsWith","replace","sort","a","b","event","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","defineProperty","enumerable","get","globalThis","Function","e","window","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","toHTMLArray","nodes","node","toHTML","join","clean","i","vdom","toString","Array","isArray","substring","tag","props","toProps","children","JSON","stringify","win","openWin","open","document","write","location","href","text","closeWin","close","print_component_test","component","_actions","action","recording","p","log","newWin","html","cmd","get_components","components","debugging","Number","localStorage","getItem","print","data","Map","comps","element","getElementById","querySelector","el","state","Events","Components","tagName","toLowerCase","id","className","split","c","viewElement","viewComponents","_components","global_events","cache","add_component","viewEvents","a1","a2","setItem","_createEventTests","s","idx","strings","command","info","devTools_running","devTools","connect","hash","send","buf","subscribe","message","type","payload","index","setState","newState","then"],"sourceRoot":""}
@@ -1,10 +1,10 @@
1
- class t{constructor(){this._events={}}on(t,i,s={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:i,options:s})}off(t,i){const s=this._events[t]||[];this._events[t]=s.filter((t=>t.fn!==i))}find(t){return this._events[t]}run(t,...i){const s=this.getSubscribers(t,this._events);return console.assert(s&&s.length>0,"No subscriber for event: "+t),s.forEach((s=>{const{fn:n,options:e}=s;return e.delay?this.delay(t,n,i,e):Object.keys(e).length>0?n.apply(this,[...i,e]):n.apply(this,i),!s.options.once})),s.length}once(t,i,s={}){this.on(t,i,Object.assign(Object.assign({},s),{once:!0}))}delay(t,i,s,n){n._t&&clearTimeout(n._t),n._t=setTimeout((()=>{clearTimeout(n._t),Object.keys(n).length>0?i.apply(this,[...s,n]):i.apply(this,s)}),n.delay)}query(t,...i){const s=this.getSubscribers(t,this._events);console.assert(s&&s.length>0,"No subscriber for event: "+t);const n=s.map((t=>{const{fn:s,options:n}=t;return Object.keys(n).length>0?s.apply(this,[...i,n]):s.apply(this,i)}));return Promise.all(n)}getSubscribers(t,i){const s=i[t]||[];return i[t]=s.filter((t=>!t.options.once)),Object.keys(i).filter((i=>i.endsWith("*")&&t.startsWith(i.replace("*","")))).sort(((t,i)=>i.length-t.length)).forEach((n=>s.push(...i[n].map((i=>Object.assign(Object.assign({},i),{options:Object.assign(Object.assign({},i.options),{event:t})})))))),s}}let i;const s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;s.app&&s._AppRunVersions?i=s.app:(i=new t,s.app=i,s._AppRunVersions="AppRun-3");var n=i;const e=(t,i)=>(i?t.state[i]:t.state)||"",o=(t,i,s)=>{if(i){const n=t.state||{};n[i]=s,t.setState(n)}else t.setState(s)},r=(t,i)=>{if(Array.isArray(t))return t.map((t=>r(t,i)));{let{tag:s,props:h,children:c}=t;return s?(h&&Object.keys(h).forEach((t=>{t.startsWith("$")&&(((t,i,s,r)=>{if(t.startsWith("$on")){const s=i[t];if(t=t.substring(1),"boolean"==typeof s)i[t]=i=>r.run?r.run(t,i):n.run(t,i);else if("string"==typeof s)i[t]=t=>r.run?r.run(s,t):n.run(s,t);else if("function"==typeof s)i[t]=t=>r.setState(s(r.state,t));else if(Array.isArray(s)){const[e,...o]=s;"string"==typeof e?i[t]=t=>r.run?r.run(e,...o,t):n.run(e,...o,t):"function"==typeof e&&(i[t]=t=>r.setState(e(r.state,...o,t)))}}else if("$bind"===t){const n=i.type||"text",h="string"==typeof i[t]?i[t]:i.name;if("input"===s)switch(n){case"checkbox":i.checked=e(r,h),i.onclick=t=>o(r,h||t.target.name,t.target.checked);break;case"radio":i.checked=e(r,h)===i.value,i.onclick=t=>o(r,h||t.target.name,t.target.value);break;case"number":case"range":i.value=e(r,h),i.oninput=t=>o(r,h||t.target.name,Number(t.target.value));break;default:i.value=e(r,h),i.oninput=t=>o(r,h||t.target.name,t.target.value)}else"select"===s?(i.value=e(r,h),i.onchange=t=>{t.target.multiple||o(r,h||t.target.name,t.target.value)}):"option"===s?(i.selected=e(r,h),i.onclick=t=>o(r,h||t.target.name,t.target.selected)):"textarea"===s&&(i.innerHTML=e(r,h),i.oninput=t=>o(r,h||t.target.name,t.target.value))}else n.run("$",{key:t,tag:s,props:i,component:r})})(t,h,s,i),delete h[t])})),c&&(c=r(c,i)),{tag:s,props:h,children:c}):t}};function h(t,...i){return l(i)}const c="_props";function l(t){const i=[],s=t=>{null!=t&&""!==t&&!1!==t&&i.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>s(t))):s(t)})),i}function u(t,i,...s){const n=l(s);if("string"==typeof t)return{tag:t,props:i,children:n};if(Array.isArray(t))return t;if(void 0===t&&s)return n;if(Object.getPrototypeOf(t).t)return{tag:t,props:i,children:n};if("function"==typeof t)return t(i,n);throw new Error(`Unknown tag in vdom ${t}`)}const d=new WeakMap,a=(t,i,s={})=>{if(null==i||!1===i)return;!function(t,i,s={}){if(null==i||!1===i)return;if(i=m(i,s),!t)return;const n="SVG"===t.nodeName;Array.isArray(i)?v(t,i,n):v(t,[i],n)}("string"==typeof t&&t?document.getElementById(t)||document.querySelector(t):t,i=r(i,s),s)};function f(t,i,s){3!==i._op&&(s=s||"svg"===i.tag,!function(t,i){const s=t.nodeName,n=`${i.tag||""}`;return s.toUpperCase()===n.toUpperCase()}(t,i)?t.parentNode.replaceChild(b(i,s),t):(!(2&i._op)&&v(t,i.children,s),!(1&i._op)&&g(t,i.props,s)))}function v(t,i,s){var n,e;const o=(null===(n=t.childNodes)||void 0===n?void 0:n.length)||0,r=(null==i?void 0:i.length)||0,h=Math.min(o,r);for(let n=0;n<h;n++){const e=i[n];if(3===e._op)continue;const o=t.childNodes[n];if("string"==typeof e)o.textContent!==e&&(3===o.nodeType?o.nodeValue=e:t.replaceChild(y(e),o));else if(e instanceof HTMLElement||e instanceof SVGElement)t.insertBefore(e,o);else{const i=e.props&&e.props.key;if(i)if(o.key===i)f(t.childNodes[n],e,s);else{const r=d[i];if(r){const i=r.nextSibling;t.insertBefore(r,o),i?t.insertBefore(o,i):t.appendChild(o),f(t.childNodes[n],e,s)}else t.replaceChild(b(e,s),o)}else f(t.childNodes[n],e,s)}}let c=(null===(e=t.childNodes)||void 0===e?void 0:e.length)||0;for(;c>h;)t.removeChild(t.lastChild),c--;if(r>h){const n=document.createDocumentFragment();for(let t=h;t<i.length;t++)n.appendChild(b(i[t],s));t.appendChild(n)}}const p=t=>{const i=document.createElement("section");return i.insertAdjacentHTML("afterbegin",t),Array.from(i.children)};function y(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const i=document.createElement("div");return i.insertAdjacentHTML("afterbegin",t.substring(6)),i}return document.createTextNode(null!=t?t:"")}function b(t,i){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return y(t);if(!t.tag||"function"==typeof t.tag)return y(JSON.stringify(t));const s=(i=i||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return g(s,t.props,i),t.children&&t.children.forEach((t=>s.appendChild(b(t,i)))),s}function g(t,i,s){const n=t[c]||{};i=function(t,i){i.class=i.class||i.className,delete i.className;const s={};return t&&Object.keys(t).forEach((t=>s[t]=null)),i&&Object.keys(i).forEach((t=>s[t]=i[t])),s}(n,i||{}),t[c]=i;for(const n in i){const e=i[n];if(n.startsWith("data-")){const i=n.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[i]!==e&&(e||""===e?t.dataset[i]=e:delete t.dataset[i])}else if("style"===n)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof e)t.style.cssText=e;else for(const i in e)t.style[i]!==e[i]&&(t.style[i]=e[i]);else if(n.startsWith("xlink")){const i=n.replace("xlink","").toLowerCase();null==e||!1===e?t.removeAttributeNS("http://www.w3.org/1999/xlink",i):t.setAttributeNS("http://www.w3.org/1999/xlink",i,e)}else n.startsWith("on")?e&&"function"!=typeof e?"string"==typeof e&&(e?t.setAttribute(n,e):t.removeAttribute(n)):t[n]=e:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-|^for$/g.test(n)||s?t.getAttribute(n)!==e&&(e?t.setAttribute(n,e):t.removeAttribute(n)):t[n]!==e&&(t[n]=e);"key"===n&&e&&(d[e]=t)}i&&"function"==typeof i.ref&&window.requestAnimationFrame((()=>i.ref(t)))}function m(t,i,s=0){var n;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>m(t,i,s++)));let e=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).t&&(e=function(t,i,s){const{tag:n,props:e,children:o}=t;let r=`_${s}`,h=e&&e.id;h?r=h:h=`_${s}${Date.now()}`;let c="section";e&&e.as&&(c=e.as,delete e.as),i.i||(i.i={});let l=i.i[r];if(l&&l instanceof n&&l.element)l.renderState(l.state);else{const t=document.createElement(c);l=i.i[r]=new n(Object.assign(Object.assign({},e),{children:o})).start(t)}if(l.mounted){const t=l.mounted(e,o,l.state);void 0!==t&&l.setState(t)}return g(l.element,e,!1),l.element}(t,i,s)),e&&Array.isArray(e.children)){const t=null===(n=e.props)||void 0===n?void 0:n._component;if(t){let i=0;e.children=e.children.map((s=>m(s,t,i++)))}else e.children=e.children.map((t=>m(t,i,s++)))}return e}const w=(t,i={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(i.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const s=i||{};this._shadowRoot=s.shadow?this.attachShadow({mode:"open"}):this;const n=s.observedAttributes||[],e=n.reduce(((t,i)=>{const s=i.toLowerCase();return s!==i&&(t[s]=i),t}),{});this._attrMap=t=>e[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),n.forEach((t=>{void 0!==this[t]&&(o[t]=this[t]),Object.defineProperty(this,t,{get:()=>o[t],set(i){this.attributeChangedCallback(t,o[t],i)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const i=this.children?Array.from(this.children):[];if(i.forEach((t=>t.parentElement.removeChild(t))),this._component=new t(Object.assign(Object.assign({},o),{children:i})).mount(this._shadowRoot,s),this._component._props=o,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const t=this._component.mounted(o,i,this._component.state);void 0!==t&&(this._component.state=t)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==s.render&&this._component.run(".")}))}}disconnectedCallback(){var t,i,s,n;null===(i=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===i||i.call(t),null===(n=null===(s=this._component)||void 0===s?void 0:s.unmount)||void 0===n||n.call(s),this._component=null}attributeChangedCallback(t,s,n){if(this._component){const e=this._attrMap(t);this._component._props[e]=n,this._component.run("attributeChanged",e,s,n),n!==s&&!1!==i.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var $=(t,i,s)=>{"undefined"!=typeof customElements&&customElements.define(t,w(i,s))};const j={meta:new WeakMap,defineMetadata(t,i,s){this.meta.has(s)||this.meta.set(s,{}),this.meta.get(s)[t]=i},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,i){return i=Object.getPrototypeOf(i),this.meta.get(i)?this.meta.get(i)[t]:null}};function A(t,i={}){return(s,n,e)=>{const o=t?t.toString():n;return j.defineMetadata(`apprun-update:${o}`,{name:o,key:n,options:i},s),e}}function O(t,i={}){return function(s,n){const e=t?t.toString():n;j.defineMetadata(`apprun-update:${e}`,{name:e,key:n,options:i},s)}}function _(t,i){return function(s){return $(t,s,i),s}}const x=new Map;n.find("get-components")||n.on("get-components",(t=>t.components=x));const k=t=>t;class T{constructor(i,s,n,e){this.state=i,this.view=s,this.update=n,this.options=e,this._app=new t,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=(t=null,i)=>this.mount(t,Object.assign({render:!0},i))}renderState(t,i=null){if(!this.view)return;let s=i||this.view(t);if(n.debug&&n.run("debug",{component:this,_:s?".":"-",state:t,vdom:s,el:this.element}),"object"!=typeof document)return;const e="string"==typeof this.element&&this.element?document.getElementById(this.element)||document.querySelector(this.element):this.element;if(e){const t="_c";this.unload?e._component===this&&e.getAttribute(t)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),e.setAttribute(t,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(e)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[t]}))):e.removeAttribute&&e.removeAttribute(t),e._component=this}!i&&s&&(s=r(s,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>n.render(e,s,this))):n.render(e,s,this)),this.rendered&&this.rendered(this.state)}setState(t,i={render:!0,history:!1}){if(t instanceof Promise)Promise.resolve(t).then((s=>{this.setState(s,i),this._state=t}));else{if(this._state=t,null==t)return;this.state=t,!1!==i.render&&(i.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(t))):this.renderState(t)),!1!==i.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof i.callback&&i.callback(this.state)}}mount(t=null,i){var s,e;return console.assert(!this.element,"Component already mounted."),this.options=i=Object.assign(Object.assign({},this.options),i),this.element=t,this.global_event=i.global_event,this.enable_history=!!i.history,this.enable_history&&(this.on(i.history.prev||"history-prev",this._history_prev),this.on(i.history.next||"history-next",this._history_next)),i.route&&(this.update=this.update||{},this.update[i.route]||(this.update[i.route]=k)),this.add_actions(),this.state=null!==(e=null!==(s=this.state)&&void 0!==s?s:this.model)&&void 0!==e?e:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!i.render,history:!0}),n.debug&&(x.get(t)?x.get(t).push(this):x.set(t,[this])),this}is_global_event(t){return t&&(this.global_event||this._global_events.indexOf(t)>=0||t.startsWith("#")||t.startsWith("/")||t.startsWith("@"))}add_action(t,i,s={}){i&&"function"==typeof i&&(s.global&&this._global_events.push(t),this.on(t,((...e)=>{n.debug&&n.run("debug",{component:this,_:">",event:t,p:e,current_state:this.state,options:s});const o=i(this.state,...e);n.debug&&n.run("debug",{component:this,_:"<",event:t,p:e,newState:o,state:this.state,options:s}),this.setState(o,s)}),s))}add_actions(){const t=this.update||{};j.getMetadataKeys(this).forEach((i=>{if(i.startsWith("apprun-update:")){const s=j.getMetadata(i,this);t[s.name]=[this[s.key].bind(this),s.options]}}));const i={};Array.isArray(t)?t.forEach((t=>{const[s,n,e]=t;s.toString().split(",").forEach((t=>i[t.trim()]=[n,e]))})):Object.keys(t).forEach((s=>{const n=t[s];("function"==typeof n||Array.isArray(n))&&s.split(",").forEach((t=>i[t.trim()]=n))})),i["."]||(i["."]=k),Object.keys(i).forEach((t=>{const s=i[t];"function"==typeof s?this.add_action(t,s):Array.isArray(s)&&this.add_action(t,s[0],s[1])}))}run(t,...i){if(this.state instanceof Promise)return Promise.resolve(this.state).then((s=>{this.state=s,this.run(t,...i)}));{const s=t.toString();return this.is_global_event(s)?n.run(s,...i):this._app.run(s,...i)}}on(t,i,s){const e=t.toString();return this._actions.push({name:e,fn:i}),this.is_global_event(e)?n.on(e,i,s):this._app.on(e,i,s)}query(t,...i){const s=t.toString();return this.is_global_event(s)?n.query(s,...i):this._app.query(s,...i)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:i,fn:s}=t;this.is_global_event(i)?n.off(i,s):this._app.off(i,s)}))}}T.t=!0;const M="//",E="///",C=t=>{if(t||(t="#"),t.startsWith("#")){const[i,...s]=t.split("/");n.run(i,...s)||n.run(E,i,...s),n.run(M,i,...s)}else if(t.startsWith("/")){const[i,s,...e]=t.split("/");n.run("/"+s,...e)||n.run(E,"/"+s,...e),n.run(M,"/"+s,...e)}else n.run(t)||n.run(E,t),n.run(M,t)};n.h=n.createElement=u,n.render=a,n.Fragment=h,n.webComponent=$,n.safeHTML=p,n.start=(t,i,s,n,e)=>{const o=Object.assign({render:!0,global_event:!0},e),r=new T(i,s,n);return e&&e.rendered&&(r.rendered=e.rendered),r.mount(t,o),r};const S=t=>{};
1
+ class t{constructor(){this._events={}}on(t,i,s={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:i,options:s})}off(t,i){const s=this._events[t]||[];this._events[t]=s.filter((t=>t.fn!==i))}find(t){return this._events[t]}run(t,...i){const s=this.getSubscribers(t,this._events);return console.assert(s&&s.length>0,"No subscriber for event: "+t),s.forEach((s=>{const{fn:n,options:e}=s;return e.delay?this.delay(t,n,i,e):Object.keys(e).length>0?n.apply(this,[...i,e]):n.apply(this,i),!s.options.once})),s.length}once(t,i,s={}){this.on(t,i,Object.assign(Object.assign({},s),{once:!0}))}delay(t,i,s,n){n._t&&clearTimeout(n._t),n._t=setTimeout((()=>{clearTimeout(n._t),Object.keys(n).length>0?i.apply(this,[...s,n]):i.apply(this,s)}),n.delay)}runAsync(t,...i){const s=this.getSubscribers(t,this._events);console.assert(s&&s.length>0,"No subscriber for event: "+t);const n=s.map((t=>{const{fn:s,options:n}=t;return Object.keys(n).length>0?s.apply(this,[...i,n]):s.apply(this,i)}));return Promise.all(n)}query(t,...i){return this.query(t,...i)}getSubscribers(t,i){const s=i[t]||[];return i[t]=s.filter((t=>!t.options.once)),Object.keys(i).filter((i=>i.endsWith("*")&&t.startsWith(i.replace("*","")))).sort(((t,i)=>i.length-t.length)).forEach((n=>s.push(...i[n].map((i=>Object.assign(Object.assign({},i),{options:Object.assign(Object.assign({},i.options),{event:t})})))))),s}}let i;const s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;s.app&&s._AppRunVersions?i=s.app:(i=new t,s.app=i,s._AppRunVersions="AppRun-3");var n=i;const e=(t,i)=>(i?t.state[i]:t.state)||"",o=(t,i,s)=>{if(i){const n=t.state||{};n[i]=s,t.setState(n)}else t.setState(s)},r=(t,i)=>{if(Array.isArray(t))return t.map((t=>r(t,i)));{let{tag:s,props:h,children:c}=t;return s?(h&&Object.keys(h).forEach((t=>{t.startsWith("$")&&(((t,i,s,r)=>{if(t.startsWith("$on")){const s=i[t];if(t=t.substring(1),"boolean"==typeof s)i[t]=i=>r.run?r.run(t,i):n.run(t,i);else if("string"==typeof s)i[t]=t=>r.run?r.run(s,t):n.run(s,t);else if("function"==typeof s)i[t]=t=>r.setState(s(r.state,t));else if(Array.isArray(s)){const[e,...o]=s;"string"==typeof e?i[t]=t=>r.run?r.run(e,...o,t):n.run(e,...o,t):"function"==typeof e&&(i[t]=t=>r.setState(e(r.state,...o,t)))}}else if("$bind"===t){const n=i.type||"text",h="string"==typeof i[t]?i[t]:i.name;if("input"===s)switch(n){case"checkbox":i.checked=e(r,h),i.onclick=t=>o(r,h||t.target.name,t.target.checked);break;case"radio":i.checked=e(r,h)===i.value,i.onclick=t=>o(r,h||t.target.name,t.target.value);break;case"number":case"range":i.value=e(r,h),i.oninput=t=>o(r,h||t.target.name,Number(t.target.value));break;default:i.value=e(r,h),i.oninput=t=>o(r,h||t.target.name,t.target.value)}else"select"===s?(i.value=e(r,h),i.onchange=t=>{t.target.multiple||o(r,h||t.target.name,t.target.value)}):"option"===s?(i.selected=e(r,h),i.onclick=t=>o(r,h||t.target.name,t.target.selected)):"textarea"===s&&(i.innerHTML=e(r,h),i.oninput=t=>o(r,h||t.target.name,t.target.value))}else n.run("$",{key:t,tag:s,props:i,component:r})})(t,h,s,i),delete h[t])})),c&&(c=r(c,i)),{tag:s,props:h,children:c}):t}};function h(t,...i){return l(i)}const c="_props";function l(t){const i=[],s=t=>{null!=t&&""!==t&&!1!==t&&i.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>s(t))):s(t)})),i}function u(t,i,...s){const n=l(s);if("string"==typeof t)return{tag:t,props:i,children:n};if(Array.isArray(t))return t;if(void 0===t&&s)return n;if(Object.getPrototypeOf(t).t)return{tag:t,props:i,children:n};if("function"==typeof t)return t(i,n);throw new Error(`Unknown tag in vdom ${t}`)}const d=new WeakMap,f=(t,i,s={})=>{if(null==i||!1===i)return;!function(t,i,s={}){if(null==i||!1===i)return;if(i=m(i,s),!t)return;const n="SVG"===t.nodeName;Array.isArray(i)?v(t,i,n):v(t,[i],n)}("string"==typeof t&&t?document.getElementById(t)||document.querySelector(t):t,i=r(i,s),s)};function a(t,i,s){3!==i._op&&(s=s||"svg"===i.tag,!function(t,i){const s=t.nodeName,n=`${i.tag||""}`;return s.toUpperCase()===n.toUpperCase()}(t,i)?t.parentNode.replaceChild(b(i,s),t):(!(2&i._op)&&v(t,i.children,s),!(1&i._op)&&g(t,i.props,s)))}function v(t,i,s){var n,e;const o=(null===(n=t.childNodes)||void 0===n?void 0:n.length)||0,r=(null==i?void 0:i.length)||0,h=Math.min(o,r);for(let n=0;n<h;n++){const e=i[n];if(3===e._op)continue;const o=t.childNodes[n];if("string"==typeof e)o.textContent!==e&&(3===o.nodeType?o.nodeValue=e:t.replaceChild(y(e),o));else if(e instanceof HTMLElement||e instanceof SVGElement)t.insertBefore(e,o);else{const i=e.props&&e.props.key;if(i)if(o.key===i)a(t.childNodes[n],e,s);else{const r=d[i];if(r){const i=r.nextSibling;t.insertBefore(r,o),i?t.insertBefore(o,i):t.appendChild(o),a(t.childNodes[n],e,s)}else t.replaceChild(b(e,s),o)}else a(t.childNodes[n],e,s)}}let c=(null===(e=t.childNodes)||void 0===e?void 0:e.length)||0;for(;c>h;)t.removeChild(t.lastChild),c--;if(r>h){const n=document.createDocumentFragment();for(let t=h;t<i.length;t++)n.appendChild(b(i[t],s));t.appendChild(n)}}const p=t=>{const i=document.createElement("section");return i.insertAdjacentHTML("afterbegin",t),Array.from(i.children)};function y(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const i=document.createElement("div");return i.insertAdjacentHTML("afterbegin",t.substring(6)),i}return document.createTextNode(null!=t?t:"")}function b(t,i){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return y(t);if(!t.tag||"function"==typeof t.tag)return y(JSON.stringify(t));const s=(i=i||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return g(s,t.props,i),t.children&&t.children.forEach((t=>s.appendChild(b(t,i)))),s}function g(t,i,s){const n=t[c]||{};i=function(t,i){i.class=i.class||i.className,delete i.className;const s={};return t&&Object.keys(t).forEach((t=>s[t]=null)),i&&Object.keys(i).forEach((t=>s[t]=i[t])),s}(n,i||{}),t[c]=i;for(const n in i){const e=i[n];if(n.startsWith("data-")){const i=n.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[i]!==e&&(e||""===e?t.dataset[i]=e:delete t.dataset[i])}else if("style"===n)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof e)t.style.cssText=e;else for(const i in e)t.style[i]!==e[i]&&(t.style[i]=e[i]);else if(n.startsWith("xlink")){const i=n.replace("xlink","").toLowerCase();null==e||!1===e?t.removeAttributeNS("http://www.w3.org/1999/xlink",i):t.setAttributeNS("http://www.w3.org/1999/xlink",i,e)}else n.startsWith("on")?e&&"function"!=typeof e?"string"==typeof e&&(e?t.setAttribute(n,e):t.removeAttribute(n)):t[n]=e:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-|^for$/g.test(n)||s?t.getAttribute(n)!==e&&(e?t.setAttribute(n,e):t.removeAttribute(n)):t[n]!==e&&(t[n]=e);"key"===n&&e&&(d[e]=t)}i&&"function"==typeof i.ref&&window.requestAnimationFrame((()=>i.ref(t)))}function m(t,i,s=0){var n;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>m(t,i,s++)));let e=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).t&&(e=function(t,i,s){const{tag:n,props:e,children:o}=t;let r=`_${s}`,h=e&&e.id;h?r=h:h=`_${s}${Date.now()}`;let c="section";e&&e.as&&(c=e.as,delete e.as),i.i||(i.i={});let l=i.i[r];if(l&&l instanceof n&&l.element)l.renderState(l.state);else{const t=document.createElement(c);l=i.i[r]=new n(Object.assign(Object.assign({},e),{children:o})).mount(t,{render:!0})}if(l.mounted){const t=l.mounted(e,o,l.state);void 0!==t&&l.setState(t)}return g(l.element,e,!1),l.element}(t,i,s)),e&&Array.isArray(e.children)){const t=null===(n=e.props)||void 0===n?void 0:n._component;if(t){let i=0;e.children=e.children.map((s=>m(s,t,i++)))}else e.children=e.children.map((t=>m(t,i,s++)))}return e}const w=(t,i={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(i.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const s=i||{};this._shadowRoot=s.shadow?this.attachShadow({mode:"open"}):this;const n=s.observedAttributes||[],e=n.reduce(((t,i)=>{const s=i.toLowerCase();return s!==i&&(t[s]=i),t}),{});this._attrMap=t=>e[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),n.forEach((t=>{void 0!==this[t]&&(o[t]=this[t]),Object.defineProperty(this,t,{get:()=>o[t],set(i){this.attributeChangedCallback(t,o[t],i)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const i=this.children?Array.from(this.children):[];if(i.forEach((t=>t.parentElement.removeChild(t))),this._component=new t(Object.assign(Object.assign({},o),{children:i})).mount(this._shadowRoot,s),this._component._props=o,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const t=this._component.mounted(o,i,this._component.state);void 0!==t&&(this._component.state=t)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==s.render&&this._component.run(".")}))}}disconnectedCallback(){var t,i,s,n;null===(i=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===i||i.call(t),null===(n=null===(s=this._component)||void 0===s?void 0:s.unmount)||void 0===n||n.call(s),this._component=null}attributeChangedCallback(t,s,n){if(this._component){const e=this._attrMap(t);this._component._props[e]=n,this._component.run("attributeChanged",e,s,n),n!==s&&!1!==i.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var $=(t,i,s)=>{"undefined"!=typeof customElements&&customElements.define(t,w(i,s))};const j={meta:new WeakMap,defineMetadata(t,i,s){this.meta.has(s)||this.meta.set(s,{}),this.meta.get(s)[t]=i},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,i){return i=Object.getPrototypeOf(i),this.meta.get(i)?this.meta.get(i)[t]:null}};function A(t,i={}){return(s,n,e)=>{const o=t?t.toString():n;return j.defineMetadata(`apprun-update:${o}`,{name:o,key:n,options:i},s),e}}function O(t,i={}){return function(s,n){const e=t?t.toString():n;j.defineMetadata(`apprun-update:${e}`,{name:e,key:n,options:i},s)}}function _(t,i){return function(s){return $(t,s,i),s}}const x=new Map;n.find("get-components")||n.on("get-components",(t=>t.components=x));const k=t=>t;class T{renderState(t,i=null){if(!this.view)return;let s=i||this.view(t);if(n.debug&&n.run("debug",{component:this,_:s?".":"-",state:t,vdom:s,el:this.element}),"object"!=typeof document)return;const e="string"==typeof this.element&&this.element?document.getElementById(this.element)||document.querySelector(this.element):this.element;if(e){const t="_c";this.unload?e._component===this&&e.getAttribute(t)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),e.setAttribute(t,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(e)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[t]}))):e.removeAttribute&&e.removeAttribute(t),e._component=this}!i&&s&&(s=r(s,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>n.render(e,s,this))):n.render(e,s,this)),this.rendered&&this.rendered(this.state)}setState(t,i={render:!0,history:!1}){if(t instanceof Promise)Promise.resolve(t).then((s=>{this.setState(s,i),this._state=t}));else{if(this._state=t,null==t)return;this.state=t,!1!==i.render&&(i.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(t))):this.renderState(t)),!1!==i.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof i.callback&&i.callback(this.state)}}constructor(i,s,n,e){this.state=i,this.view=s,this.update=n,this.options=e,this._app=new t,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=(t=null,i)=>{if(this.mount(t,Object.assign({render:!0},i)),this.mounted&&"function"==typeof this.mounted){const t=this.mounted({},[],this.state);void 0!==t&&this.setState(t)}return this}}mount(t=null,i){var s,e;return console.assert(!this.element,"Component already mounted."),this.options=i=Object.assign(Object.assign({},this.options),i),this.element=t,this.global_event=i.global_event,this.enable_history=!!i.history,this.enable_history&&(this.on(i.history.prev||"history-prev",this._history_prev),this.on(i.history.next||"history-next",this._history_next)),i.route&&(this.update=this.update||{},this.update[i.route]||(this.update[i.route]=k)),this.add_actions(),this.state=null!==(e=null!==(s=this.state)&&void 0!==s?s:this.model)&&void 0!==e?e:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!i.render,history:!0}),n.debug&&(x.get(t)?x.get(t).push(this):x.set(t,[this])),this}is_global_event(t){return t&&(this.global_event||this._global_events.indexOf(t)>=0||t.startsWith("#")||t.startsWith("/")||t.startsWith("@"))}add_action(t,i,s={}){i&&"function"==typeof i&&(s.global&&this._global_events.push(t),this.on(t,((...e)=>{n.debug&&n.run("debug",{component:this,_:">",event:t,p:e,current_state:this.state,options:s});const o=i(this.state,...e);n.debug&&n.run("debug",{component:this,_:"<",event:t,p:e,newState:o,state:this.state,options:s}),this.setState(o,s)}),s))}add_actions(){const t=this.update||{};j.getMetadataKeys(this).forEach((i=>{if(i.startsWith("apprun-update:")){const s=j.getMetadata(i,this);t[s.name]=[this[s.key].bind(this),s.options]}}));const i={};Array.isArray(t)?t.forEach((t=>{const[s,n,e]=t;s.toString().split(",").forEach((t=>i[t.trim()]=[n,e]))})):Object.keys(t).forEach((s=>{const n=t[s];("function"==typeof n||Array.isArray(n))&&s.split(",").forEach((t=>i[t.trim()]=n))})),i["."]||(i["."]=k),Object.keys(i).forEach((t=>{const s=i[t];"function"==typeof s?this.add_action(t,s):Array.isArray(s)&&this.add_action(t,s[0],s[1])}))}run(t,...i){if(this.state instanceof Promise)return Promise.resolve(this.state).then((s=>{this.state=s,this.run(t,...i)}));{const s=t.toString();return this.is_global_event(s)?n.run(s,...i):this._app.run(s,...i)}}on(t,i,s){const e=t.toString();return this._actions.push({name:e,fn:i}),this.is_global_event(e)?n.on(e,i,s):this._app.on(e,i,s)}runAsync(t,...i){const s=t.toString();return this.is_global_event(s)?n.runAsync(s,...i):this._app.runAsync(s,...i)}query(t,...i){return this.runAsync(t,...i)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:i,fn:s}=t;this.is_global_event(i)?n.off(i,s):this._app.off(i,s)}))}}T.t=!0;const M="//",E="///",C=t=>{if(t||(t="#"),t.startsWith("#")){const[i,...s]=t.split("/");n.run(i,...s)||n.run(E,i,...s),n.run(M,i,...s)}else if(t.startsWith("/")){const[i,s,...e]=t.split("/");n.run("/"+s,...e)||n.run(E,"/"+s,...e),n.run(M,"/"+s,...e)}else n.run(t)||n.run(E,t),n.run(M,t)};n.h=n.createElement=u,n.render=f,n.Fragment=h,n.webComponent=$,n.safeHTML=p,n.start=(t,i,s,n,e)=>{const o=Object.assign({render:!0,global_event:!0},e),r=new T(i,s,n);return e&&e.rendered&&(r.rendered=e.rendered),e&&e.mounted&&(r.mounted=e.mounted),r.start(t,o),r};const S=t=>{};
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2017 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
6
  */
7
- var N;n.on("$",S),n.on("debug",(t=>S)),n.on(M,S),n.on("#",S),n.route=C,n.on("route",(t=>n.route&&n.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{n.route===C&&(window.onpopstate=()=>C(location.hash),document.body.hasAttribute("apprun-no-init")||n["no-init-route"]||C(location.hash))})),"object"==typeof window&&(window.Component=T,window._React=window.React,window.React=n,window.on=O,window.customElement=_,window.safeHTML=p);const L=globalThis.trustedTypes,U=L?L.createPolicy("lit-html",{createHTML:t=>t}):void 0,H=`lit$${(Math.random()+"").slice(9)}$`,P="?"+H,D=`<${P}>`,I=document,V=(t="")=>I.createComment(t),q=t=>null===t||"object"!=typeof t&&"function"!=typeof t,G=Array.isArray,R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,W=/-->/g,z=/>/g,F=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,Z=/'/g,J=/"/g,K=/^(?:script|style|textarea|title)$/i,B=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),Q=B(1),X=B(2),Y=Symbol.for("lit-noChange"),tt=Symbol.for("lit-nothing"),it=new WeakMap,st=(t,i,s)=>{var n,e;const o=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:i;let r=o._$litPart$;if(void 0===r){const t=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:null;o._$litPart$=r=new ct(i.insertBefore(V(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r},nt=I.createTreeWalker(I,129,null,!1),et=(t,i)=>{const s=t.length-1,n=[];let e,o=2===i?"<svg>":"",r=R;for(let i=0;i<s;i++){const s=t[i];let h,c,l=-1,u=0;for(;u<s.length&&(r.lastIndex=u,c=r.exec(s),null!==c);)u=r.lastIndex,r===R?"!--"===c[1]?r=W:void 0!==c[1]?r=z:void 0!==c[2]?(K.test(c[2])&&(e=RegExp("</"+c[2],"g")),r=F):void 0!==c[3]&&(r=F):r===F?">"===c[0]?(r=null!=e?e:R,l=-1):void 0===c[1]?l=-2:(l=r.lastIndex-c[2].length,h=c[1],r=void 0===c[3]?F:'"'===c[3]?J:Z):r===J||r===Z?r=F:r===W||r===z?r=R:(r=F,e=void 0);const d=r===F&&t[i+1].startsWith("/>")?" ":"";o+=r===R?s+D:l>=0?(n.push(h),s.slice(0,l)+"$lit$"+s.slice(l)+H+d):s+H+(-2===l?(n.push(void 0),i):d)}const h=o+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==U?U.createHTML(h):h,n]};class ot{constructor({strings:t,_$litType$:i},s){let n;this.parts=[];let e=0,o=0;const r=t.length-1,h=this.parts,[c,l]=et(t,i);if(this.el=ot.createElement(c,s),nt.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(n=nt.nextNode())&&h.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const i of n.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(H)){const s=l[o++];if(t.push(i),void 0!==s){const t=n.getAttribute(s.toLowerCase()+"$lit$").split(H),i=/([.?@])?(.*)/.exec(s);h.push({type:1,index:e,name:i[2],strings:t,ctor:"."===i[1]?ut:"?"===i[1]?at:"@"===i[1]?ft:lt})}else h.push({type:6,index:e})}for(const i of t)n.removeAttribute(i)}if(K.test(n.tagName)){const t=n.textContent.split(H),i=t.length-1;if(i>0){n.textContent=L?L.emptyScript:"";for(let s=0;s<i;s++)n.append(t[s],V()),nt.nextNode(),h.push({type:2,index:++e});n.append(t[i],V())}}}else if(8===n.nodeType)if(n.data===P)h.push({type:2,index:e});else{let t=-1;for(;-1!==(t=n.data.indexOf(H,t+1));)h.push({type:7,index:e}),t+=H.length-1}e++}}static createElement(t,i){const s=I.createElement("template");return s.innerHTML=t,s}}function rt(t,i,s=t,n){var e,o,r,h;if(i===Y)return i;let c=void 0!==n?null===(e=s._$Cl)||void 0===e?void 0:e[n]:s._$Cu;const l=q(i)?void 0:i._$litDirective$;return(null==c?void 0:c.constructor)!==l&&(null===(o=null==c?void 0:c._$AO)||void 0===o||o.call(c,!1),void 0===l?c=void 0:(c=new l(t),c._$AT(t,s,n)),void 0!==n?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[n]=c:s._$Cu=c),void 0!==c&&(i=rt(t,c._$AS(t,i.values),c,n)),i}class ht{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:n}=this._$AD,e=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:I).importNode(s,!0);nt.currentNode=e;let o=nt.nextNode(),r=0,h=0,c=n[0];for(;void 0!==c;){if(r===c.index){let i;2===c.type?i=new ct(o,o.nextSibling,this,t):1===c.type?i=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(i=new vt(o,this,t)),this.v.push(i),c=n[++h]}r!==(null==c?void 0:c.index)&&(o=nt.nextNode(),r++)}return e}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class ct{constructor(t,i,s,n){var e;this.type=2,this._$AH=tt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=n,this._$Cg=null===(e=null==n?void 0:n.isConnected)||void 0===e||e}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=rt(this,t,i),q(t)?t===tt||null==t||""===t?(this._$AH!==tt&&this._$AR(),this._$AH=tt):t!==this._$AH&&t!==Y&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var i;return G(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==tt&&q(this._$AH)?this._$AA.nextSibling.data=t:this.k(I.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:n}=t,e="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=ot.createElement(n.h,this.options)),n);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===e)this._$AH.m(s);else{const t=new ht(e,this),i=t.p(this.options);t.m(s),this.k(i),this._$AH=t}}_$AC(t){let i=it.get(t.strings);return void 0===i&&it.set(t.strings,i=new ot(t)),i}S(t){G(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,n=0;for(const e of t)n===i.length?i.push(s=new ct(this.A(V()),this.A(V()),this,this.options)):s=i[n],s._$AI(e),n++;n<i.length&&(this._$AR(s&&s._$AB.nextSibling,n),i.length=n)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class lt{constructor(t,i,s,n,e){this.type=1,this._$AH=tt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=e,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=tt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,n){const e=this.strings;let o=!1;if(void 0===e)t=rt(this,t,i,0),o=!q(t)||t!==this._$AH&&t!==Y,o&&(this._$AH=t);else{const n=t;let r,h;for(t=e[0],r=0;r<e.length-1;r++)h=rt(this,n[s+r],i,r),h===Y&&(h=this._$AH[r]),o||(o=!q(h)||h!==this._$AH[r]),h===tt?t=tt:t!==tt&&(t+=(null!=h?h:"")+e[r+1]),this._$AH[r]=h}o&&!n&&this.C(t)}C(t){t===tt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class ut extends lt{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===tt?void 0:t}}const dt=L?L.emptyScript:"";class at extends lt{constructor(){super(...arguments),this.type=4}C(t){t&&t!==tt?this.element.setAttribute(this.name,dt):this.element.removeAttribute(this.name)}}class ft extends lt{constructor(t,i,s,n,e){super(t,i,s,n,e),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=rt(this,t,i,0))&&void 0!==s?s:tt)===Y)return;const n=this._$AH,e=t===tt&&n!==tt||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==tt&&(n===tt||e);e&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class vt{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){rt(this,t)}}const pt=window.litHtmlPolyfillSupport;null==pt||pt(ot,ct),(null!==(N=globalThis.litHtmlVersions)&&void 0!==N?N:globalThis.litHtmlVersions=[]).push("2.2.1");
7
+ var N;n.on("$",S),n.on("debug",(t=>S)),n.on(M,S),n.on("#",S),n.route=C,n.on("route",(t=>n.route&&n.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{n.route===C&&(window.onpopstate=()=>C(location.hash),document.body.hasAttribute("apprun-no-init")||n["no-init-route"]||C(location.hash))})),"object"==typeof window&&(window.Component=T,window._React=window.React,window.React=n,window.on=O,window.customElement=_,window.safeHTML=p),n.use_render=(t,i=0)=>n.render=0===i?(i,s)=>t(s,i):(i,s)=>t(i,s),n.use_react=t=>{n.render=(i,s)=>{i&&s&&(i._root||(i._root=t(i)),i._root.render(s))}};const L=globalThis.trustedTypes,U=L?L.createPolicy("lit-html",{createHTML:t=>t}):void 0,H=`lit$${(Math.random()+"").slice(9)}$`,P="?"+H,D=`<${P}>`,I=document,V=(t="")=>I.createComment(t),q=t=>null===t||"object"!=typeof t&&"function"!=typeof t,G=Array.isArray,R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,W=/-->/g,z=/>/g,F=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,Z=/'/g,J=/"/g,K=/^(?:script|style|textarea|title)$/i,B=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),Q=B(1),X=B(2),Y=Symbol.for("lit-noChange"),tt=Symbol.for("lit-nothing"),it=new WeakMap,st=(t,i,s)=>{var n,e;const o=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:i;let r=o._$litPart$;if(void 0===r){const t=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:null;o._$litPart$=r=new ct(i.insertBefore(V(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r},nt=I.createTreeWalker(I,129,null,!1),et=(t,i)=>{const s=t.length-1,n=[];let e,o=2===i?"<svg>":"",r=R;for(let i=0;i<s;i++){const s=t[i];let h,c,l=-1,u=0;for(;u<s.length&&(r.lastIndex=u,c=r.exec(s),null!==c);)u=r.lastIndex,r===R?"!--"===c[1]?r=W:void 0!==c[1]?r=z:void 0!==c[2]?(K.test(c[2])&&(e=RegExp("</"+c[2],"g")),r=F):void 0!==c[3]&&(r=F):r===F?">"===c[0]?(r=null!=e?e:R,l=-1):void 0===c[1]?l=-2:(l=r.lastIndex-c[2].length,h=c[1],r=void 0===c[3]?F:'"'===c[3]?J:Z):r===J||r===Z?r=F:r===W||r===z?r=R:(r=F,e=void 0);const d=r===F&&t[i+1].startsWith("/>")?" ":"";o+=r===R?s+D:l>=0?(n.push(h),s.slice(0,l)+"$lit$"+s.slice(l)+H+d):s+H+(-2===l?(n.push(void 0),i):d)}const h=o+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==U?U.createHTML(h):h,n]};class ot{constructor({strings:t,_$litType$:i},s){let n;this.parts=[];let e=0,o=0;const r=t.length-1,h=this.parts,[c,l]=et(t,i);if(this.el=ot.createElement(c,s),nt.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(n=nt.nextNode())&&h.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const i of n.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(H)){const s=l[o++];if(t.push(i),void 0!==s){const t=n.getAttribute(s.toLowerCase()+"$lit$").split(H),i=/([.?@])?(.*)/.exec(s);h.push({type:1,index:e,name:i[2],strings:t,ctor:"."===i[1]?ut:"?"===i[1]?ft:"@"===i[1]?at:lt})}else h.push({type:6,index:e})}for(const i of t)n.removeAttribute(i)}if(K.test(n.tagName)){const t=n.textContent.split(H),i=t.length-1;if(i>0){n.textContent=L?L.emptyScript:"";for(let s=0;s<i;s++)n.append(t[s],V()),nt.nextNode(),h.push({type:2,index:++e});n.append(t[i],V())}}}else if(8===n.nodeType)if(n.data===P)h.push({type:2,index:e});else{let t=-1;for(;-1!==(t=n.data.indexOf(H,t+1));)h.push({type:7,index:e}),t+=H.length-1}e++}}static createElement(t,i){const s=I.createElement("template");return s.innerHTML=t,s}}function rt(t,i,s=t,n){var e,o,r,h;if(i===Y)return i;let c=void 0!==n?null===(e=s._$Cl)||void 0===e?void 0:e[n]:s._$Cu;const l=q(i)?void 0:i._$litDirective$;return(null==c?void 0:c.constructor)!==l&&(null===(o=null==c?void 0:c._$AO)||void 0===o||o.call(c,!1),void 0===l?c=void 0:(c=new l(t),c._$AT(t,s,n)),void 0!==n?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[n]=c:s._$Cu=c),void 0!==c&&(i=rt(t,c._$AS(t,i.values),c,n)),i}class ht{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:n}=this._$AD,e=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:I).importNode(s,!0);nt.currentNode=e;let o=nt.nextNode(),r=0,h=0,c=n[0];for(;void 0!==c;){if(r===c.index){let i;2===c.type?i=new ct(o,o.nextSibling,this,t):1===c.type?i=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(i=new vt(o,this,t)),this.v.push(i),c=n[++h]}r!==(null==c?void 0:c.index)&&(o=nt.nextNode(),r++)}return e}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class ct{constructor(t,i,s,n){var e;this.type=2,this._$AH=tt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=n,this._$Cg=null===(e=null==n?void 0:n.isConnected)||void 0===e||e}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=rt(this,t,i),q(t)?t===tt||null==t||""===t?(this._$AH!==tt&&this._$AR(),this._$AH=tt):t!==this._$AH&&t!==Y&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var i;return G(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==tt&&q(this._$AH)?this._$AA.nextSibling.data=t:this.k(I.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:n}=t,e="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=ot.createElement(n.h,this.options)),n);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===e)this._$AH.m(s);else{const t=new ht(e,this),i=t.p(this.options);t.m(s),this.k(i),this._$AH=t}}_$AC(t){let i=it.get(t.strings);return void 0===i&&it.set(t.strings,i=new ot(t)),i}S(t){G(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,n=0;for(const e of t)n===i.length?i.push(s=new ct(this.A(V()),this.A(V()),this,this.options)):s=i[n],s._$AI(e),n++;n<i.length&&(this._$AR(s&&s._$AB.nextSibling,n),i.length=n)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class lt{constructor(t,i,s,n,e){this.type=1,this._$AH=tt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=e,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=tt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,n){const e=this.strings;let o=!1;if(void 0===e)t=rt(this,t,i,0),o=!q(t)||t!==this._$AH&&t!==Y,o&&(this._$AH=t);else{const n=t;let r,h;for(t=e[0],r=0;r<e.length-1;r++)h=rt(this,n[s+r],i,r),h===Y&&(h=this._$AH[r]),o||(o=!q(h)||h!==this._$AH[r]),h===tt?t=tt:t!==tt&&(t+=(null!=h?h:"")+e[r+1]),this._$AH[r]=h}o&&!n&&this.C(t)}C(t){t===tt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class ut extends lt{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===tt?void 0:t}}const dt=L?L.emptyScript:"";class ft extends lt{constructor(){super(...arguments),this.type=4}C(t){t&&t!==tt?this.element.setAttribute(this.name,dt):this.element.removeAttribute(this.name)}}class at extends lt{constructor(t,i,s,n,e){super(t,i,s,n,e),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=rt(this,t,i,0))&&void 0!==s?s:tt)===Y)return;const n=this._$AH,e=t===tt&&n!==tt||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==tt&&(n===tt||e);e&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class vt{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){rt(this,t)}}const pt=window.litHtmlPolyfillSupport;null==pt||pt(ot,ct),(null!==(N=globalThis.litHtmlVersions)&&void 0!==N?N:globalThis.litHtmlVersions=[]).push("2.2.1");
8
8
  /**
9
9
  * @license
10
10
  * Copyright 2017 Google LLC
@@ -15,5 +15,5 @@ const yt=2,bt=5,gt=t=>(...i)=>({_$litDirective$:t,values:i});class mt{constructo
15
15
  * @license
16
16
  * Copyright 2017 Google LLC
17
17
  * SPDX-License-Identifier: BSD-3-Clause
18
- */class wt extends mt{constructor(t){if(super(t),this.it=tt,t.type!==yt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===tt||null==t)return this.ft=void 0,this.it=t;if(t===Y)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const i=[t];return i.raw=i,this.ft={_$litType$:this.constructor.resultType,strings:i,values:[]}}}wt.directiveName="unsafeHTML",wt.resultType=1;const $t=gt(wt);function jt(t,i,s){i&&("string"==typeof i?(t._$litPart$||t.replaceChildren(),st(Q`${$t(i)}`,t)):"_$litType$"in i?(t._$litPart$||t.replaceChildren(),st(i,t)):(a(t,i,s),t._$litPart$=void 0))}const At=gt(class extends mt{constructor(t){if(super(t),t.type!==bt)throw new Error("${run} can only be used in event handlers")}update(t,i){let{element:s,name:e}=t;const o=()=>{let t=s._component;for(;!t&&s;)s=s.parentElement,t=s&&s._component;return console.assert(!!t,"Component not found."),t},[r,...h]=i;return"string"==typeof r?s[`on${e}`]=t=>{const i=o();i?i.run(r,...h,t):n.run(r,...h,t)}:"function"==typeof r&&(s[`on${e}`]=t=>o().setState(r(o().state,...h,t))),this.render()}render(){return Y}});n.createElement=u,n.render=jt,n.Fragment=h,"object"==typeof window&&(window.React=window._React||n,window.html=Q,window.svg=X,window.run=At);export{T as Component,E as ROUTER_404_EVENT,M as ROUTER_EVENT,n as app,_ as customElement,n as default,A as event,Q as html,O as on,jt as render,At as run,p as safeHTML,X as svg,A as update};
18
+ */class wt extends mt{constructor(t){if(super(t),this.it=tt,t.type!==yt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===tt||null==t)return this.ft=void 0,this.it=t;if(t===Y)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const i=[t];return i.raw=i,this.ft={_$litType$:this.constructor.resultType,strings:i,values:[]}}}wt.directiveName="unsafeHTML",wt.resultType=1;const $t=gt(wt);function jt(t,i,s){i&&("string"==typeof i?(t._$litPart$||t.replaceChildren(),st(Q`${$t(i)}`,t)):"_$litType$"in i?(t._$litPart$||t.replaceChildren(),st(i,t)):(f(t,i,s),t._$litPart$=void 0))}const At=gt(class extends mt{constructor(t){if(super(t),t.type!==bt)throw new Error("${run} can only be used in event handlers")}update(t,i){let{element:s,name:e}=t;const o=()=>{let t=s._component;for(;!t&&s;)s=s.parentElement,t=s&&s._component;return console.assert(!!t,"Component not found."),t},[r,...h]=i;return"string"==typeof r?s[`on${e}`]=t=>{const i=o();i?i.run(r,...h,t):n.run(r,...h,t)}:"function"==typeof r&&(s[`on${e}`]=t=>o().setState(r(o().state,...h,t))),this.render()}render(){return Y}});n.createElement=u,n.render=jt,n.Fragment=h,"object"==typeof window&&(window.React=window._React||n,window.html=Q,window.svg=X,window.run=At);export{T as Component,E as ROUTER_404_EVENT,M as ROUTER_EVENT,n as app,_ as customElement,n as default,A as event,Q as html,O as on,jt as render,At as run,p as safeHTML,X as svg,A as update};
19
19
  //# sourceMappingURL=apprun-html.esm.js.map