apprun 3.36.0 → 3.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +133 -20
  3. package/WHATSNEW.md +20 -12
  4. package/apprun-book.jpg +0 -0
  5. package/apprun.d.ts +5 -2
  6. package/cli/app.js +29 -0
  7. package/cli/index.html +13 -0
  8. package/{apprun-cli.js → cli/index.js} +8 -14
  9. package/dist/apprun-dev-tools.js +1 -2
  10. package/dist/apprun-dev-tools.js.map +1 -1
  11. package/dist/apprun-html.esm.js +7 -7
  12. package/dist/apprun-html.esm.js.map +1 -1
  13. package/dist/apprun-html.js +1 -1
  14. package/dist/apprun-html.js.map +1 -1
  15. package/dist/apprun-play-html.esm.js +7 -7
  16. package/dist/apprun-play-html.esm.js.map +1 -1
  17. package/dist/apprun-play.js +1 -1
  18. package/dist/apprun-play.js.map +1 -1
  19. package/dist/apprun.esm.js +1 -1
  20. package/dist/apprun.esm.js.map +1 -1
  21. package/dist/apprun.js +1 -1
  22. package/dist/apprun.js.map +1 -1
  23. package/esm/app.js +10 -6
  24. package/esm/app.js.map +1 -1
  25. package/esm/apprun-dev-tools.js +1 -7
  26. package/esm/apprun-dev-tools.js.map +1 -1
  27. package/esm/apprun.js +18 -4
  28. package/esm/apprun.js.map +1 -1
  29. package/esm/component.js +4 -0
  30. package/esm/component.js.map +1 -1
  31. package/esm/router.js +241 -18
  32. package/esm/router.js.map +1 -1
  33. package/esm/vdom-my-new.js +329 -0
  34. package/esm/vdom-my-new.js.map +1 -0
  35. package/esm/vdom-my-prop-attr.js +227 -0
  36. package/esm/vdom-my-prop-attr.js.map +1 -0
  37. package/esm/vdom-my.js +109 -143
  38. package/esm/vdom-my.js.map +1 -1
  39. package/esm/version.js +1 -1
  40. package/index.html +1 -1
  41. package/jest.config.js +2 -1
  42. package/jest.setup.js +29 -3
  43. package/jsx-runtime.js +1 -1
  44. package/jsx-runtime.js.map +1 -1
  45. package/package.json +7 -7
  46. package/src/app.ts +11 -6
  47. package/src/apprun-dev-tools.tsx +1 -7
  48. package/src/apprun.ts +22 -4
  49. package/src/component.ts +4 -0
  50. package/src/router.ts +259 -15
  51. package/src/vdom-my-new.ts +311 -0
  52. package/src/vdom-my-prop-attr.ts +241 -0
  53. package/src/vdom-my.ts +109 -134
  54. package/src/version.ts +1 -1
  55. package/cli/export.js +0 -92
  56. package/cli/import.js +0 -68
  57. package/plan/plan-apprun-bugfixes.md +0 -207
@@ -1,2 +1,2 @@
1
- const t="3.36.0",n=`AppRun-${t}`;class e{constructor(){this._events={}}on(t,n,e={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:n,options:e})}off(t,n){const e=this._events[t]||[];this._events[t]=e.filter((t=>t.fn!==n))}find(t){return this._events[t]}run(t,...n){const e=this.getSubscribers(t,this._events);return console.assert(e&&e.length>0,"No subscriber for event: "+t),e.forEach((e=>{const{fn:o,options:i}=e;if(!o||"function"!=typeof o)return console.error(`AppRun event handler for '${t}' is not a function:`,o),!1;if(i.delay)this.delay(t,o,n,i);else try{Object.keys(i).length>0?o.apply(this,[...n,i]):o.apply(this,n)}catch(n){console.error(`Error in event handler for '${t}':`,n)}return!e.options.once})),e.length}once(t,n,e={}){this.on(t,n,Object.assign(Object.assign({},e),{once:!0}))}delay(t,n,e,o){o._t&&clearTimeout(o._t),o._t=setTimeout((()=>{clearTimeout(o._t);try{Object.keys(o).length>0?n.apply(this,[...e,o]):n.apply(this,e)}catch(n){console.error(`Error in delayed event handler for '${t}':`,n)}}),o.delay)}runAsync(t,...n){const e=this.getSubscribers(t,this._events);console.assert(e&&e.length>0,"No subscriber for event: "+t);const o=e.map((e=>{const{fn:o,options:i}=e;if(!o||"function"!=typeof o)return console.error(`AppRun async event handler for '${t}' is not a function:`,o),Promise.resolve(null);try{return Object.keys(i).length>0?o.apply(this,[...n,i]):o.apply(this,n)}catch(n){return console.error(`Error in async event handler for '${t}':`,n),Promise.reject(n)}}));return Promise.all(o)}query(t,...n){return this.runAsync(t,...n)}getSubscribers(t,n){const e=n[t]||[];return n[t]=e.filter((t=>!t.options.once)),Object.keys(n).filter((n=>n.endsWith("*")&&t.startsWith(n.replace("*","")))).sort(((t,n)=>n.length-t.length)).forEach((o=>e.push(...n[o].map((n=>Object.assign(Object.assign({},n),{options:Object.assign(Object.assign({},n.options),{event:t})})))))),e}}const o=n;let i;const s="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};s.app&&s._AppRunVersions?i=s.app:(i=new e,s.app=i,s._AppRunVersions=o);var r=i;function c(t){return(null==t?void 0:t.target)instanceof HTMLElement?t.target:null}const u=(t,n)=>(n?t.state[n]:t.state)||"",h=(t,n,e)=>{if(n){const o=t.state||{};o[n]=e,t.setState(o)}else t.setState(e)},l=(t,n)=>{if(Array.isArray(t))return t.map((t=>l(t,n)));{let{type:e,tag:o,props:i,children:s}=t;return o=o||e,s=s||(null==i?void 0:i.children),i&&Object.keys(i).forEach((t=>{t.startsWith("$")&&(((t,n,e,o)=>{if(t.startsWith("$on")){const e=n[t];if(t=t.substring(1),"boolean"==typeof e)n[t]=n=>o.run?o.run(t,n):r.run(t,n);else if("string"==typeof e)n[t]=t=>o.run?o.run(e,t):r.run(e,t);else if("function"==typeof e)n[t]=t=>o.setState(e(o.state,t));else if(Array.isArray(e)){const[i,...s]=e;"string"==typeof i?n[t]=t=>o.run?o.run(i,...s,t):r.run(i,...s,t):"function"==typeof i&&(n[t]=t=>o.setState(i(o.state,...s,t)))}}else if("$bind"===t){const i=n.type||"text",s="string"==typeof n[t]?n[t]:n.name;if("input"===e)switch(i){case"checkbox":n.checked=u(o,s),n.onclick=t=>{const n=c(t);n&&h(o,s||n.name,n.checked)};break;case"radio":n.checked=u(o,s)===n.value,n.onclick=t=>{const n=c(t);n&&h(o,s||n.name,n.value)};break;case"number":case"range":n.value=u(o,s),n.oninput=t=>{const n=c(t);n&&h(o,s||n.name,Number(n.value))};break;default:n.value=u(o,s),n.oninput=t=>{const n=c(t);n&&h(o,s||n.name,n.value)}}else"select"===e?(n.value=u(o,s),n.onchange=t=>{const n=c(t);n&&!n.multiple&&h(o,s||n.name,n.value)}):"option"===e?(n.selected=u(o,s),n.onclick=t=>{const n=c(t);n&&h(o,s||n.name,n.selected)}):"textarea"===e&&(n.innerHTML=u(o,s),n.oninput=t=>{const n=c(t);n&&h(o,s||n.name,n.value)})}else r.run("$",{key:t,tag:e,props:n,component:o})})(t,i,o,n),delete i[t])})),s&&l(s,n),t}};function f(t,...n){return d(n)}const a="_props";function d(t){const n=[],e=t=>{null!=t&&""!==t&&!1!==t&&n.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>e(t))):e(t)})),n}const p=(t,n,e={})=>{if(null==n||!1===n)return;!function(t,n,e={}){if(null==n||!1===n)return;if(n=j(n,e),!t)return;const o="SVG"===t.nodeName;Array.isArray(n)?b(t,n,o):b(t,[n],o)}("string"==typeof t&&t?document.getElementById(t)||document.querySelector(t):t,n=l(n,e),e)};function y(t,n,e){e=e||"svg"===n.tag,function(t,n){const e=t.nodeName,o=`${n.tag||""}`;return e.toUpperCase()===o.toUpperCase()}(t,n)?(b(t,n.children,e),w(t,n.props,e)):t.parentNode.replaceChild(g(n,e),t)}function b(t,n,e){var o;const i=(null===(o=t.childNodes)||void 0===o?void 0:o.length)||0,s=(null==n?void 0:n.length)||0;if(null==n?void 0:n.some((t=>t&&"object"==typeof t&&t.props&&void 0!==t.props.key))){const o=new Map;for(let n=0;n<i;n++){const e=t.childNodes[n];e&&e.key&&o.set(e.key,e)}const r=document.createDocumentFragment();for(let t=0;t<s;t++){const i=n[t];if(null==i)continue;const s=i.props&&i.props.key;if(s&&o.has(s)){const t=o.get(s);y(t,i,e),r.appendChild(t),o.delete(s)}else r.appendChild(g(i,e))}for(;t.firstChild;)t.removeChild(t.firstChild);return void t.appendChild(r)}const r=Math.min(i,s);for(let o=0;o<r;o++){const i=n[o];if(null==i)continue;const s=t.childNodes[o];s&&("string"==typeof i?3===s.nodeType?s.nodeValue!==i&&(s.nodeValue=i):t.replaceChild(v(i),s):i instanceof HTMLElement||i instanceof SVGElement?t.replaceChild(i,s):i&&"object"==typeof i&&y(t.childNodes[o],i,e))}for(;t.childNodes.length>r;)t.removeChild(t.lastChild);if(s>r){const o=document.createDocumentFragment();for(let t=r;t<n.length;t++){const i=n[t];null!=i&&o.appendChild(g(i,e))}t.appendChild(o)}}const m=t=>{const n=document.createElement("section");return n.insertAdjacentHTML("afterbegin",t),Array.from(n.children)};function v(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const n=document.createElement("div");return n.insertAdjacentHTML("afterbegin",t.substring(6)),n}return document.createTextNode(null!=t?t:"")}function g(t,n){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return v(t);if(!t||"object"!=typeof t||!t.tag||"function"==typeof t.tag)return v("object"==typeof t?JSON.stringify(t):String(null!=t?t:""));const e=(n=n||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return w(e,t.props,n),t.children&&t.children.forEach((t=>e.appendChild(g(t,n)))),e}function w(t,n,e){const o=t[a]||{};n=function(t,n){n.class=n.class||n.className,delete n.className;const e={};return t&&Object.keys(t).forEach((t=>e[t]=null)),Object.keys(n).forEach((t=>e[t]=n[t])),e}(o,n||{}),t[a]=n;for(const o in n){const i=n[o];if(o.startsWith("data-")){const n=o.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[n]!==i&&(i||""===i?t.dataset[n]=i:delete t.dataset[n])}else if("style"===o)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof i)t.style.cssText=i;else for(const n in i)t.style[n]!==i[n]&&(t.style[n]=i[n]);else if(o.startsWith("xlink")){const n=o.replace("xlink","").toLowerCase();null==i||!1===i?t.removeAttributeNS("http://www.w3.org/1999/xlink",n):t.setAttributeNS("http://www.w3.org/1999/xlink",n,i)}else o.startsWith("on")?i&&"function"!=typeof i?"string"==typeof i&&(i?t.setAttribute(o,i):t.removeAttribute(o)):t[o]=i:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-|^for$/g.test(o)||e?t.getAttribute(o)!==i&&(i?t.setAttribute(o,i):t.removeAttribute(o)):t[o]!==i&&(t[o]=i);"key"===o&&void 0!==i&&(t.key=i)}n&&"function"==typeof n.ref&&window.requestAnimationFrame((()=>n.ref(t)))}function j(t,n,e=0){var o;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>j(t,n,e++)));let i=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).t&&(i=function(t,n,e){const{tag:o,props:i,children:s}=t;let r=`_${e}`,c=i&&i.id;c?r=c:c=`_${e}${Date.now()}`;let u="section";i&&i.as&&(u=i.as,delete i.as),n.o||(n.o={});let h=n.o[r];if(h&&h instanceof o&&h.element)h.renderState(h.state);else{const t=document.createElement(u);h=n.o[r]=new o(Object.assign(Object.assign({},i),{children:s})).mount(t,{render:!0})}if(h.mounted){const t=h.mounted(i,s,h.state);void 0!==t&&h.setState(t)}return w(h.element,i,!1),h.element}(t,n,e)),i&&Array.isArray(i.children)){const t=null===(o=i.props)||void 0===o?void 0:o._component;if(t){let n=0;i.children=i.children.map((e=>j(e,t,n++)))}else i.children=i.children.map((t=>j(t,n,e++)))}return i}const O=(t,n={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(n.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const e=n||{};this._shadowRoot=e.shadow?this.attachShadow({mode:"open"}):this;const o=e.observedAttributes||[],i=o.reduce(((t,n)=>{const e=n.toLowerCase();return e!==n&&(t[e]=n),t}),{});this._attrMap=t=>i[t]||t;const s={};Array.from(this.attributes).forEach((t=>s[this._attrMap(t.name)]=t.value)),o.forEach((t=>{void 0!==this[t]&&(s[t]=this[t]),Object.defineProperty(this,t,{get:()=>s[t],set(n){this.attributeChangedCallback(t,s[t],n)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const n=this.children?Array.from(this.children):[];if(this._component=new t(Object.assign(Object.assign({},s),{children:n})).mount(this._shadowRoot,e),this._component._props=s,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const t=this._component.mounted(s,n,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!==e.render&&this._component.run(".")}))}}disconnectedCallback(){var t,n,e,o;null===(n=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===n||n.call(t),null===(o=null===(e=this._component)||void 0===e?void 0:e.unmount)||void 0===o||o.call(e),this._component=null}attributeChangedCallback(t,e,o){if(this._component){const i=this._attrMap(t);this._component._props[i]=o,this._component.run("attributeChanged",i,e,o),o!==e&&!1!==n.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var $=(t,n,e)=>{"undefined"!=typeof customElements&&customElements.define(t,O(n,e))};const A={meta:new WeakMap,defineMetadata(t,n,e){this.meta.has(e)||this.meta.set(e,{}),this.meta.get(e)[t]=n},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,n){return n=Object.getPrototypeOf(n),this.meta.get(n)?this.meta.get(n)[t]:null}};function _(t,n={}){return(e,o,i)=>{const s=t?t.toString():o;return A.defineMetadata(`apprun-update:${s}`,{name:s,key:o,options:n},e),i}}function k(t,n={}){return function(e,o){const i=t?t.toString():o;A.defineMetadata(`apprun-update:${i}`,{name:i,key:o,options:n},e)}}function M(t,n){return function(e){return $(t,e,n),e}}const R=new Map;r.find("get-components")||r.on("get-components",(t=>t.components=R));const E=t=>t;class S{renderState(t,n=null){if(!this.view)return;let e=n||this.view(t);if(r.debug&&r.run("debug",{component:this,_:e?".":"-",state:t,vdom:e,el:this.element}),"object"!=typeof document)return;const o="string"==typeof this.element&&this.element?function(t){try{return document.getElementById(t)}catch(n){return console.warn(`Error getting element by id: ${t}`,n),null}}(this.element)||function(t,n=document){try{return n.querySelector(t)}catch(n){return console.warn(`Invalid selector: ${t}`,n),null}}(this.element):this.element;if(!o)return void console.warn(`Component element not found: ${this.element}`);const i="_c";this.unload?o._component===this&&o.getAttribute(i)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),o.setAttribute(i,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(o)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[i]}))):o.removeAttribute&&o.removeAttribute(i),o._component=this,!n&&e&&(e=l(e,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>r.render(o,e,this))):r.render(o,e,this)),this.rendered&&this.rendered(this.state)}setState(t,n={render:!0,history:!1}){const e=async t=>{try{for(;;){const{value:e,done:o}=await t.next();if(o)break;this.setState(e,n)}}catch(t){console.error("Error in async iterator:",t)}},o=t;if(null==o?void 0:o[Symbol.asyncIterator])this.setState(e(o[Symbol.asyncIterator]()),n);else if((null==o?void 0:o[Symbol.iterator])&&"function"==typeof o.next)for(const t of o)this.setState(t,n);else if(t&&t instanceof Promise)Promise.resolve(t).then((e=>{this.setState(e,n),this._state=t}));else{if(this._state=t,null==t)return;this.state=t,!1!==n.render&&(n.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(t))):this.renderState(t)),!1!==n.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof n.callback&&n.callback(this.state)}}constructor(t,n,o,i){this.state=t,this.view=n,this.update=o,this.options=i,this._app=new e,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,n)=>{if(this.mount(t,Object.assign({render:!0},n)),this.mounted&&"function"==typeof this.mounted){const t=this.mounted({},[],this.state);void 0!==t&&this.setState(t)}return this}}mount(t=null,n){var e,o;return console.assert(!this.element,"Component already mounted."),this.options=n=Object.assign(Object.assign({},this.options),n),this.element=t,this.global_event=n.global_event,this.enable_history=!!n.history,this.enable_history&&(this.on(n.history.prev||"history-prev",this._history_prev),this.on(n.history.next||"history-next",this._history_next)),n.route&&(this.update=this.update||{},this.update[n.route]||(this.update[n.route]=E)),this.add_actions(),this.state=null!==(o=null!==(e=this.state)&&void 0!==e?e:this.model)&&void 0!==o?o:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!n.render,history:!0}),r.debug&&(R.get(t)?R.get(t).push(this):R.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,n,e={}){n&&"function"==typeof n?(e.global&&this._global_events.push(t),this.on(t,((...o)=>{r.debug&&r.run("debug",{component:this,_:">",event:t,p:o,current_state:this.state,options:e});try{const i=n(this.state,...o);r.debug&&r.run("debug",{component:this,_:"<",event:t,p:o,newState:i,state:this.state,options:e}),this.setState(i,e)}catch(n){console.error(`Error in component action '${t}':`,n),r.debug&&r.run("debug",{component:this,_:"!",event:t,p:o,error:n,state:this.state,options:e})}}),e)):console.warn(`Component action for '${t}' is not a valid function:`,n)}add_actions(){const t=this.update||{};A.getMetadataKeys(this).forEach((n=>{if(n.startsWith("apprun-update:")){const e=A.getMetadata(n,this);t[e.name]=[this[e.key].bind(this),e.options]}}));const n={};Array.isArray(t)?t.forEach((t=>{const[e,o,i]=t;e.toString().split(",").forEach((t=>n[t.trim()]=[o,i]))})):Object.keys(t).forEach((e=>{const o=t[e];("function"==typeof o||Array.isArray(o))&&e.split(",").forEach((t=>n[t.trim()]=o))})),n["."]||(n["."]=E),Object.keys(n).forEach((t=>{const e=n[t];"function"==typeof e?this.add_action(t,e):Array.isArray(e)&&this.add_action(t,e[0],e[1])}))}run(t,...n){if(this.state instanceof Promise)return Promise.resolve(this.state).then((e=>{this.state=e,this.run(t,...n)}));{const e=t.toString();return this.is_global_event(e)?r.run(e,...n):this._app.run(e,...n)}}on(t,n,e){const o=t.toString();return this._actions.push({name:o,fn:n}),this.is_global_event(o)?r.on(o,n,e):this._app.on(o,n,e)}runAsync(t,...n){const e=t.toString();return this.is_global_event(e)?r.runAsync(e,...n):this._app.runAsync(e,...n)}query(t,...n){return this.runAsync(t,...n)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:n,fn:e}=t;this.is_global_event(n)?r.off(n,e):this._app.off(n,e)}))}}S.t=!0;const x="//",C="///",P=t=>{if(r.lastUrl!==t)if(r.lastUrl=t,t||(t="#"),t.startsWith("#")){const[n,...e]=t.split("/");r.run(n,...e)||r.run(C,n,...e),r.run(x,n,...e)}else if(t.startsWith("/")){const[n,e,...o]=t.split("/");r.run("/"+e,...o)||r.run(C,"/"+e,...o),r.run(x,"/"+e,...o)}else r.run(t)||r.run(C,t),r.run(x,t)};if(!r.start){r.version=t,r.h=r.createElement=function(t,n,...e){const o=d(e);if("string"==typeof t)return{tag:t,props:n,children:o};if(Array.isArray(t))return t;if(void 0===t&&e)return o;if(Object.getPrototypeOf(t).t)return{tag:t,props:n,children:o};if("function"==typeof t)return t(n,o);throw new Error(`Unknown tag in vdom ${t}`)},r.render=p,r.Fragment=f,r.webComponent=$,r.safeHTML=m,r.start=(t,n,e,o,i)=>{const s=Object.assign({render:!0,global_event:!0},i),r=new S(n,e,o);return i&&i.rendered&&(r.rendered=i.rendered),i&&i.mounted&&(r.mounted=i.mounted),r.start(t,s),r},r.once=r.once||((t,n,e={})=>{r.on(t,n,Object.assign(Object.assign({},e),{once:!0}))}),r.query=r.query||r.runAsync;const n=t=>{};if(r.on("debug",(t=>n)),r.on(x,n),r.on(C,n),r.route=P,r.on("route",(t=>r.route&&r.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{const t=document.body.hasAttribute("apprun-no-init")||r["no-init-route"]||!1,n=r.find("#")||r.find("#/")||!1;window.addEventListener("hashchange",(()=>P(location.hash))),window.addEventListener("popstate",(()=>P(location.pathname))),n?!t&&P(location.hash):(!t&&P(location.pathname),document.body.addEventListener("click",(t=>{const n=t.target;if(!n)return;const e="A"===n.tagName?n:n.closest("a");e&&e.origin===location.origin&&e.pathname&&(t.preventDefault(),history.pushState(null,"",e.pathname),P(e.pathname))})))})),"object"==typeof window){const t=window;t.Component=S,t._React=t.React,t.React=r,t.on=k,t.customElement=M,t.safeHTML=m}r.use_render=(t,n=0)=>{r.render=0===n?(n,e)=>t(e,n):(n,e)=>t(n,e)},r.use_react=(t,n)=>{if(t&&n)if("function"==typeof t.createElement)if(t.Fragment)if(r.h=r.createElement=t.createElement,r.Fragment=t.Fragment,t.version&&t.version.startsWith("18")){if(!n.createRoot||"function"!=typeof n.createRoot)return void console.error("AppRun use_react: ReactDOM.createRoot not found in React 18+");r.render=(t,e)=>{t&&void 0!==e&&(t._root||(t._root=n.createRoot(t)),t._root.render(e))}}else{if(!n.render||"function"!=typeof n.render)return void console.error("AppRun use_react: ReactDOM.render not found in legacy React");r.render=(t,e)=>n.render(e,t)}else console.error("AppRun use_react: Invalid React object - Fragment not found");else console.error("AppRun use_react: Invalid React object - createElement method not found");else console.error("AppRun use_react: React and ReactDOM parameters are required")}}export{e as App,S as Component,f as Fragment,C as ROUTER_404_EVENT,x as ROUTER_EVENT,r as app,M as customElement,r as default,_ as event,k as on,m as safeHTML,_ as update};
1
+ const n="3.36.1",e=`AppRun-${n}`;class l{constructor(){this._events={}}on(n,e,l={}){this._events[n]=this._events[n]||[],this._events[n].push({fn:e,options:l})}off(n,e){const l=this._events[n]||[];this._events[n]=l.filter((n=>n.fn!==e))}find(n){return this._events[n]}run(n,...e){const l=this.getSubscribers(n,this._events);return console.assert(l&&l.length>0,"No subscriber for event: "+n),l.forEach((l=>{const{fn:t,options:o}=l;if(!t||"function"!=typeof t)return console.error(`AppRun event handler for '${n}' is not a function:`,t),!1;if(o.delay)this.delay(n,t,e,o);else try{Object.keys(o).length>0?t.apply(this,[...e,o]):t.apply(this,e)}catch(e){console.error(`Error in event handler for '${n}':`,e)}return!l.options.once})),l.length}once(n,e,l={}){this.on(n,e,Object.assign(Object.assign({},l),{once:!0}))}delay(n,e,l,t){t._t&&clearTimeout(t._t),t._t=setTimeout((()=>{clearTimeout(t._t);try{Object.keys(t).length>0?e.apply(this,[...l,t]):e.apply(this,l)}catch(e){console.error(`Error in delayed event handler for '${n}':`,e)}}),t.delay)}runAsync(n,...e){const l=this.getSubscribers(n,this._events);console.assert(l&&l.length>0,"No subscriber for event: "+n);const t=l.map((l=>{const{fn:t,options:o}=l;if(!t||"function"!=typeof t)return console.error(`AppRun async event handler for '${n}' is not a function:`,t),Promise.resolve(null);try{return Object.keys(o).length>0?t.apply(this,[...e,o]):t.apply(this,e)}catch(e){return console.error(`Error in async event handler for '${n}':`,e),Promise.reject(e)}}));return Promise.all(t)}query(n,...e){return console.warn("app.query() is deprecated. Use app.runAsync() instead."),this.runAsync(n,...e)}getSubscribers(n,e){const l=e[n]||[];return e[n]=l.filter((n=>!n.options.once)),Object.keys(e).filter((e=>e.endsWith("*")&&n.startsWith(e.replace("*","")))).sort(((n,e)=>e.length-n.length)).forEach((t=>l.push(...e[t].map((e=>Object.assign(Object.assign({},e),{options:Object.assign(Object.assign({},e.options),{event:n})})))))),l}}const t=e;let o;const i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};i.app&&i._AppRunVersions?o=i.app:(o=new l,i.app=o,i._AppRunVersions=t);var r=o;function u(n){return(null==n?void 0:n.target)instanceof HTMLElement?n.target:null}const a=(n,e)=>(e?n.state[e]:n.state)||"",s=(n,e,l)=>{if(e){const t=n.state||{};t[e]=l,n.setState(t)}else n.setState(l)},c=(n,e)=>{if(Array.isArray(n))return n.map((n=>c(n,e)));{let{type:l,tag:t,props:o,children:i}=n;return t=t||l,i=i||(null==o?void 0:o.children),o&&Object.keys(o).forEach((n=>{n.startsWith("$")&&(((n,e,l,t)=>{if(n.startsWith("$on")){const l=e[n];if(n=n.substring(1),"boolean"==typeof l)e[n]=e=>t.run?t.run(n,e):r.run(n,e);else if("string"==typeof l)e[n]=n=>t.run?t.run(l,n):r.run(l,n);else if("function"==typeof l)e[n]=n=>t.setState(l(t.state,n));else if(Array.isArray(l)){const[o,...i]=l;"string"==typeof o?e[n]=n=>t.run?t.run(o,...i,n):r.run(o,...i,n):"function"==typeof o&&(e[n]=n=>t.setState(o(t.state,...i,n)))}}else if("$bind"===n){const o=e.type||"text",i="string"==typeof e[n]?e[n]:e.name;if("input"===l)switch(o){case"checkbox":e.checked=a(t,i),e.onclick=n=>{const e=u(n);e&&s(t,i||e.name,e.checked)};break;case"radio":e.checked=a(t,i)===e.value,e.onclick=n=>{const e=u(n);e&&s(t,i||e.name,e.value)};break;case"number":case"range":e.value=a(t,i),e.oninput=n=>{const e=u(n);e&&s(t,i||e.name,Number(e.value))};break;default:e.value=a(t,i),e.oninput=n=>{const e=u(n);e&&s(t,i||e.name,e.value)}}else"select"===l?(e.value=a(t,i),e.onchange=n=>{const e=u(n);e&&!e.multiple&&s(t,i||e.name,e.value)}):"option"===l?(e.selected=a(t,i),e.onclick=n=>{const e=u(n);e&&s(t,i||e.name,e.selected)}):"textarea"===l&&(e.innerHTML=a(t,i),e.oninput=n=>{const e=u(n);e&&s(t,i||e.name,e.value)})}else r.run("$",{key:n,tag:l,props:e,component:t})})(n,o,t,e),delete o[n])})),i&&c(i,e),n}};class h{constructor(n,e,l){this.normal=e,this.property=n,l&&(this.space=l)}}function d(n,e){const l={},t={};for(const e of n)Object.assign(l,e.property),Object.assign(t,e.normal);return new h(l,t,e)}function f(n){return n.toLowerCase()}h.prototype.normal={},h.prototype.property={},h.prototype.space=void 0;class p{constructor(n,e){this.attribute=e,this.property=n}}p.prototype.attribute="",p.prototype.booleanish=!1,p.prototype.boolean=!1,p.prototype.commaOrSpaceSeparated=!1,p.prototype.commaSeparated=!1,p.prototype.defined=!1,p.prototype.mustUseProperty=!1,p.prototype.number=!1,p.prototype.overloadedBoolean=!1,p.prototype.property="",p.prototype.spaceSeparated=!1,p.prototype.space=void 0;let g=0;const m=O(),y=O(),v=O(),b=O(),k=O(),w=O(),S=O();function O(){return 2**++g}var C=Object.freeze({__proto__:null,boolean:m,booleanish:y,commaOrSpaceSeparated:S,commaSeparated:w,number:b,overloadedBoolean:v,spaceSeparated:k});const x=Object.keys(C);class M extends p{constructor(n,e,l,t){let o=-1;if(super(n,e),P(this,"space",t),"number"==typeof l)for(;++o<x.length;){const n=x[o];P(this,x[o],(l&C[n])===C[n])}}}function P(n,e,l){l&&(n[e]=l)}function R(n){const e={},l={};for(const[t,o]of Object.entries(n.properties)){const i=new M(t,n.transform(n.attributes||{},t),o,n.space);n.mustUseProperty&&n.mustUseProperty.includes(t)&&(i.mustUseProperty=!0),e[t]=i,l[f(t)]=t,l[f(i.attribute)]=t}return new h(e,l,n.space)}M.prototype.defined=!0;const D=R({properties:{ariaActiveDescendant:null,ariaAtomic:y,ariaAutoComplete:null,ariaBusy:y,ariaChecked:y,ariaColCount:b,ariaColIndex:b,ariaColSpan:b,ariaControls:k,ariaCurrent:null,ariaDescribedBy:k,ariaDetails:null,ariaDisabled:y,ariaDropEffect:k,ariaErrorMessage:null,ariaExpanded:y,ariaFlowTo:k,ariaGrabbed:y,ariaHasPopup:null,ariaHidden:y,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:k,ariaLevel:b,ariaLive:null,ariaModal:y,ariaMultiLine:y,ariaMultiSelectable:y,ariaOrientation:null,ariaOwns:k,ariaPlaceholder:null,ariaPosInSet:b,ariaPressed:y,ariaReadOnly:y,ariaRelevant:null,ariaRequired:y,ariaRoleDescription:k,ariaRowCount:b,ariaRowIndex:b,ariaRowSpan:b,ariaSelected:y,ariaSetSize:b,ariaSort:null,ariaValueMax:b,ariaValueMin:b,ariaValueNow:b,ariaValueText:null,role:null},transform:(n,e)=>"role"===e?e:"aria-"+e.slice(4).toLowerCase()});function A(n,e){return e in n?n[e]:e}function L(n,e){return A(n,e.toLowerCase())}const E=R({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:w,acceptCharset:k,accessKey:k,action:null,allow:null,allowFullScreen:m,allowPaymentRequest:m,allowUserMedia:m,alt:null,as:null,async:m,autoCapitalize:null,autoComplete:k,autoFocus:m,autoPlay:m,blocking:k,capture:null,charSet:null,checked:m,cite:null,className:k,cols:b,colSpan:null,content:null,contentEditable:y,controls:m,controlsList:k,coords:b|w,crossOrigin:null,data:null,dateTime:null,decoding:null,default:m,defer:m,dir:null,dirName:null,disabled:m,download:v,draggable:y,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:m,formTarget:null,headers:k,height:b,hidden:v,high:b,href:null,hrefLang:null,htmlFor:k,httpEquiv:k,id:null,imageSizes:null,imageSrcSet:null,inert:m,inputMode:null,integrity:null,is:null,isMap:m,itemId:null,itemProp:k,itemRef:k,itemScope:m,itemType:k,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:m,low:b,manifest:null,max:null,maxLength:b,media:null,method:null,min:null,minLength:b,multiple:m,muted:m,name:null,nonce:null,noModule:m,noValidate:m,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:m,optimum:b,pattern:null,ping:k,placeholder:null,playsInline:m,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:m,referrerPolicy:null,rel:k,required:m,reversed:m,rows:b,rowSpan:b,sandbox:k,scope:null,scoped:m,seamless:m,selected:m,shadowRootClonable:m,shadowRootDelegatesFocus:m,shadowRootMode:null,shape:null,size:b,sizes:null,slot:null,span:b,spellCheck:y,src:null,srcDoc:null,srcLang:null,srcSet:null,start:b,step:null,style:null,tabIndex:b,target:null,title:null,translate:null,type:null,typeMustMatch:m,useMap:null,value:y,width:b,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:k,axis:null,background:null,bgColor:null,border:b,borderColor:null,bottomMargin:b,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:m,declare:m,event:null,face:null,frame:null,frameBorder:null,hSpace:b,leftMargin:b,link:null,longDesc:null,lowSrc:null,marginHeight:b,marginWidth:b,noResize:m,noHref:m,noShade:m,noWrap:m,object:null,profile:null,prompt:null,rev:null,rightMargin:b,rules:null,scheme:null,scrolling:y,standby:null,summary:null,text:null,topMargin:b,valueType:null,version:null,vAlign:null,vLink:null,vSpace:b,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:m,disableRemotePlayback:m,prefix:null,property:null,results:b,security:null,unselectable:null},space:"html",transform:L}),T=R({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:S,accentHeight:b,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:b,amplitude:b,arabicForm:null,ascent:b,attributeName:null,attributeType:null,azimuth:b,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:b,by:null,calcMode:null,capHeight:b,className:k,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:b,diffuseConstant:b,direction:null,display:null,dur:null,divisor:b,dominantBaseline:null,download:m,dx:null,dy:null,edgeMode:null,editable:null,elevation:b,enableBackground:null,end:null,event:null,exponent:b,externalResourcesRequired:null,fill:null,fillOpacity:b,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:w,g2:w,glyphName:w,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:b,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:b,horizOriginX:b,horizOriginY:b,id:null,ideographic:b,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:b,k:b,k1:b,k2:b,k3:b,k4:b,kernelMatrix:S,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:b,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:b,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:b,overlineThickness:b,paintOrder:null,panose1:null,path:null,pathLength:b,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:k,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:b,pointsAtY:b,pointsAtZ:b,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:S,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:S,rev:S,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:S,requiredFeatures:S,requiredFonts:S,requiredFormats:S,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:b,specularExponent:b,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:b,strikethroughThickness:b,string:null,stroke:null,strokeDashArray:S,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:b,strokeOpacity:b,strokeWidth:null,style:null,surfaceScale:b,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:S,tabIndex:b,tableValues:null,target:null,targetX:b,targetY:b,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:S,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:b,underlineThickness:b,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:b,values:null,vAlphabetic:b,vMathematical:b,vectorEffect:null,vHanging:b,vIdeographic:b,version:null,vertAdvY:b,vertOriginX:b,vertOriginY:b,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:b,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:A}),j=R({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(n,e)=>"xlink:"+e.slice(5).toLowerCase()}),U=R({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:L}),z=R({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(n,e)=>"xml:"+e.slice(3).toLowerCase()}),I=/[A-Z]/g,B=/-[a-z]/g,$=/^data[-\w.:]+$/i;function H(n){return"-"+n.toLowerCase()}function F(n){return n.charAt(1).toUpperCase()}const _=d([D,E,j,U,z],"html"),N=d([D,T,j,U,z],"svg"),V="_props",q=new Map;function W(n,e){const l=`${n}:${e}`;let t=q.get(l);return void 0===t&&(t=function(n,e){const l=f(e);let t=e,o=p;if(l in n.normal)return n.property[n.normal[l]];if(l.length>4&&"data"===l.slice(0,4)&&$.test(e)){if("-"===e.charAt(4)){const n=e.slice(5).replace(B,F);t="data"+n.charAt(0).toUpperCase()+n.slice(1)}else{const n=e.slice(4);if(!B.test(n)){let l=n.replace(I,H);"-"!==l.charAt(0)&&(l="-"+l),e="data"+l}}o=M}return new o(t,e)}(e?N:_,n)||null,q.set(l,t)),t}function K(n,e,l){!function(n){if(null==n||!1===n||""===n)return!1;if(!0===n)return!0;if("string"==typeof n){return"false"!==n.toLowerCase()&&"0"!==n}return Boolean(n)}(l)?n.removeAttribute(e):n.setAttribute(e,e)}function X(n,e,l){try{n[e]=l}catch(t){Y(n,e,l,!1)}}function Y(n,e,l,t){if(null==l)return void n.removeAttribute(e);const o=String(l);if(t&&e.includes(":")){const[l]=e.split(":");"xlink"===l?n.setAttributeNS("http://www.w3.org/1999/xlink",e,o):n.setAttribute(e,o)}else n.setAttribute(e,o)}function Z(n,e,l,t){if(function(n,e){if(document.activeElement===n)return["value","selectionStart","selectionEnd","selectionDirection"].includes(e);if("scrollTop"===e||"scrollLeft"===e)return!0;if(n instanceof HTMLMediaElement&&["currentTime","paused","playbackRate","volume"].includes(e))return!0;return!1}(n,e))return;if("style"===e){if(n.style.cssText&&(n.style.cssText=""),"string"==typeof l)n.style.cssText=l;else if(l&&"object"==typeof l)for(const e in l)n.style[e]!==l[e]&&(n.style[e]=l[e]);return}if("key"===e)return void(null!=l&&(n.key=l));if(e.startsWith("data-"))return void function(n,e,l){const t=(o=e.slice(5)).length<=1?o.toLowerCase():o.split("-").map(((n,e)=>0===e?n.toLowerCase():n.charAt(0).toUpperCase()+n.slice(1).toLowerCase())).join("");var o;null==l?delete n.dataset[t]:n.dataset[t]=String(l)}(n,e,l);if(e.startsWith("on"))return void function(n,e,l){e.startsWith("on")&&(l&&"function"!=typeof l?"string"==typeof l&&(l?n.setAttribute(e,l):n.removeAttribute(e)):n[e]=l)}(n,e,l);if(!("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName&&"SELECT"!==n.tagName||"value"!==e&&"selected"!==e&&"selectedIndex"!==e))return void X(n,e,l);if("INPUT"===n.tagName&&"checked"===e)return X(n,e,l),void K(n,e,l);const o=W(e,t);o?o.boolean||o.overloadedBoolean?K(n,o.attribute,l):o.mustUseProperty&&!t?X(n,o.property,l):Y(n,o.attribute,l,t):e.startsWith("aria-")||"role"===e?Y(n,e,l,t):e in n||void 0!==n[e]?X(n,e,l):Y(n,e,l,t)}function G(n){return/^[a-zA-Z_:][\w\-:.]*$/.test(n)&&!n.includes("<")&&!n.includes(">")&&!n.includes('"')&&!n.includes("'")}function J(n,e,l){const t=function(n,e){if(e&&(e.class=e.class||e.className,delete e.className),!n||0===Object.keys(n).length)return e||{};if(!e||0===Object.keys(e).length){const e={};return Object.keys(n).forEach((n=>e[n]=null)),e}const l={};return Object.keys(n).forEach((n=>{n in e||(l[n]=null)})),Object.keys(e).forEach((n=>l[n]=e[n])),l}(n[V]||{},e);n[V]=e||{},function(n,e,l,t){for(const l in e)G(l)&&Z(n,l,e[l],t);e&&"function"==typeof e.ref&&window.requestAnimationFrame((()=>e.ref(n)))}(n,t,0,l)}function Q(n,...e){return nn(e)}function nn(n){const e=[],l=n=>{null!=n&&""!==n&&!1!==n&&e.push("function"==typeof n||"object"==typeof n?n:`${n}`)};return n&&n.forEach((n=>{Array.isArray(n)?n.forEach((n=>l(n))):l(n)})),e}const en={};let ln=0;const tn=(n,e,l={})=>{if(null==e||!1===e)return;!function(n,e,l={}){if(null==e||!1===e)return;if(e=cn(e,l),!n)return;const t="SVG"===n.nodeName;Array.isArray(e)?rn(n,e,t):rn(n,[e],t)}("string"==typeof n&&n?document.getElementById(n)||document.querySelector(n):n,e=c(e,l),l)};function on(n,e,l){l=l||"svg"===e.tag,function(n,e){const l=n.nodeName,t=`${e.tag||""}`;return l.toUpperCase()===t.toUpperCase()}(n,e)?(rn(n,e.children,l),J(n,e.props,l)):n.parentNode.replaceChild(sn(e,l),n)}function rn(n,e,l){var t,o;const i=(null===(t=n.childNodes)||void 0===t?void 0:t.length)||0,r=(null==e?void 0:e.length)||0,u=Math.min(i,r);for(let t=0;t<u;t++){const o=e[t],i=n.childNodes[t];if("string"==typeof o)i.textContent!==o&&(3===i.nodeType?i.nodeValue=o:n.replaceChild(an(o),i));else if(o instanceof HTMLElement||o instanceof SVGElement)n.insertBefore(o,i);else{const e=o.props&&o.props.key;if(e)if(i.key===e)on(n.childNodes[t],o,l);else{const r=en[e];r?(n.insertBefore(r,i),on(n.childNodes[t],o,l)):n.replaceChild(sn(o,l),i)}else on(n.childNodes[t],o,l)}}let a=(null===(o=n.childNodes)||void 0===o?void 0:o.length)||0;for(;a>u;)n.removeChild(n.lastChild),a--;if(r>u){const t=document.createDocumentFragment();for(let n=u;n<e.length;n++)t.appendChild(sn(e[n],l));n.appendChild(t)}}const un=n=>{const e=document.createElement("section");return e.insertAdjacentHTML("afterbegin",n),Array.from(e.children)};function an(n){if(0===(null==n?void 0:n.indexOf("_html:"))){const e=document.createElement("div");return e.insertAdjacentHTML("afterbegin",n.substring(6)),e}return document.createTextNode(null!=n?n:"")}function sn(n,e){if(n instanceof HTMLElement||n instanceof SVGElement)return n;if("string"==typeof n)return an(n);if(!n.tag||"function"==typeof n.tag)return an(JSON.stringify(n));const l=(e=e||"svg"===n.tag)?document.createElementNS("http://www.w3.org/2000/svg",n.tag):document.createElement(n.tag);return J(l,n.props,e),n.children&&n.children.forEach((n=>l.appendChild(sn(n,e)))),n.props&&void 0!==n.props.key&&(l.key=n.props.key,en[n.props.key]=l,++ln>=500&&(!function(){if(!(Object.keys(en).length<=1e3))for(const[n,e]of Object.entries(en))e.isConnected||delete en[n]}(),ln=0)),l}function cn(n,e,l=0){var t;if("string"==typeof n)return n;if(Array.isArray(n))return n.map((n=>cn(n,e,l++)));let o=n;if(n&&"function"==typeof n.tag&&Object.getPrototypeOf(n.tag).l&&(o=function(n,e,l){const{tag:t,props:o,children:i}=n;let r=`_${l}`,u=o&&o.id;u?r=u:u=`_${l}${Date.now()}`;let a="section";o&&o.as&&(a=o.as,delete o.as),e.t||(e.t={});let s=e.t[r];if(s&&s instanceof t&&s.element)s.renderState(s.state);else{const n=document.createElement(a);s=e.t[r]=new t(Object.assign(Object.assign({},o),{children:i})).mount(n,{render:!0})}if(s.mounted){const n=s.mounted(o,i,s.state);void 0!==n&&s.setState(n)}return J(s.element,o,!1),s.element}(n,e,l)),o&&Array.isArray(o.children)){const n=null===(t=o.props)||void 0===t?void 0:t._component;if(n){let e=0;o.children=o.children.map((l=>cn(l,n,e++)))}else o.children=o.children.map((n=>cn(n,e,l++)))}return o}const hn=(n,e={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(e.observedAttributes||[]).map((n=>n.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const l=e||{};this._shadowRoot=l.shadow?this.attachShadow({mode:"open"}):this;const t=l.observedAttributes||[],o=t.reduce(((n,e)=>{const l=e.toLowerCase();return l!==e&&(n[l]=e),n}),{});this._attrMap=n=>o[n]||n;const i={};Array.from(this.attributes).forEach((n=>i[this._attrMap(n.name)]=n.value)),t.forEach((n=>{void 0!==this[n]&&(i[n]=this[n]),Object.defineProperty(this,n,{get:()=>i[n],set(e){this.attributeChangedCallback(n,i[n],e)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const e=this.children?Array.from(this.children):[];if(this._component=new n(Object.assign(Object.assign({},i),{children:e})).mount(this._shadowRoot,l),this._component._props=i,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const n=this._component.mounted(i,e,this._component.state);void 0!==n&&(this._component.state=n)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==l.render&&this._component.run(".")}))}}disconnectedCallback(){var n,e,l,t;null===(e=null===(n=this._component)||void 0===n?void 0:n.unload)||void 0===e||e.call(n),null===(t=null===(l=this._component)||void 0===l?void 0:l.unmount)||void 0===t||t.call(l),this._component=null}attributeChangedCallback(n,l,t){if(this._component){const o=this._attrMap(n);this._component._props[o]=t,this._component.run("attributeChanged",o,l,t),t!==l&&!1!==e.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var dn=(n,e,l)=>{"undefined"!=typeof customElements&&customElements.define(n,hn(e,l))};const fn={meta:new WeakMap,defineMetadata(n,e,l){this.meta.has(l)||this.meta.set(l,{}),this.meta.get(l)[n]=e},getMetadataKeys(n){return n=Object.getPrototypeOf(n),this.meta.get(n)?Object.keys(this.meta.get(n)):[]},getMetadata(n,e){return e=Object.getPrototypeOf(e),this.meta.get(e)?this.meta.get(e)[n]:null}};function pn(n,e={}){return(l,t,o)=>{const i=n?n.toString():t;return fn.defineMetadata(`apprun-update:${i}`,{name:i,key:t,options:e},l),o}}function gn(n,e={}){return function(l,t){const o=n?n.toString():t;fn.defineMetadata(`apprun-update:${o}`,{name:o,key:t,options:e},l)}}function mn(n,e){return function(l){return dn(n,l,e),l}}const yn=new Map;r.find("get-components")||r.on("get-components",(n=>n.components=yn));const vn=n=>n;class bn{renderState(n,e=null){if(!this.view)return;let l=e||this.view(n);if(r.debug&&r.run("debug",{component:this,_:l?".":"-",state:n,vdom:l,el:this.element}),"object"!=typeof document)return;const t="string"==typeof this.element&&this.element?function(n){try{return document.getElementById(n)}catch(e){return console.warn(`Error getting element by id: ${n}`,e),null}}(this.element)||function(n,e=document){try{return e.querySelector(n)}catch(e){return console.warn(`Invalid selector: ${n}`,e),null}}(this.element):this.element;if(!t)return void console.warn(`Component element not found: ${this.element}`);const o="_c";this.unload?t._component===this&&t.getAttribute(o)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),t.setAttribute(o,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((n=>{n[0].oldValue!==this.tracking_id&&document.body.contains(t)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[o]}))):t.removeAttribute&&t.removeAttribute(o),t._component=this,!e&&l&&(l=c(l,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>r.render(t,l,this))):r.render(t,l,this)),this.rendered&&this.rendered(this.state)}setState(n,e={render:!0,history:!1}){const l=async n=>{try{for(;;){const{value:l,done:t}=await n.next();if(t)break;this.setState(l,e)}}catch(n){console.error("Error in async iterator:",n)}},t=n;if(null==t?void 0:t[Symbol.asyncIterator])this.setState(l(t[Symbol.asyncIterator]()),e);else if((null==t?void 0:t[Symbol.iterator])&&"function"==typeof t.next)for(const n of t)this.setState(n,e);else if(n&&n instanceof Promise)Promise.resolve(n).then((l=>{this.setState(l,e),this._state=n}));else{if(this._state=n,null==n)return;this.state=n,!1!==e.render&&(e.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(n))):this.renderState(n)),!1!==e.history&&this.enable_history&&(this._history=[...this._history,n],this._history_idx=this._history.length-1),"function"==typeof e.callback&&e.callback(this.state)}}constructor(n,e,t,o){this.state=n,this.view=e,this.update=t,this.options=o,this._app=new l,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=(n=null,e)=>{if(this.mount(n,Object.assign({render:!0},e)),this.mounted&&"function"==typeof this.mounted){const n=this.mounted({},[],this.state);void 0!==n&&this.setState(n)}return this}}mount(n=null,e){var l,t;return console.assert(!this.element,"Component already mounted."),this.options=e=Object.assign(Object.assign({},this.options),e),this.element=n,this.global_event=e.global_event,this.enable_history=!!e.history,this.enable_history&&(this.on(e.history.prev||"history-prev",this._history_prev),this.on(e.history.next||"history-next",this._history_next)),e.route&&(this.update=this.update||{},this.update[e.route]||(this.update[e.route]=vn)),this.add_actions(),this.state=null!==(t=null!==(l=this.state)&&void 0!==l?l:this.model)&&void 0!==t?t:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!e.render,history:!0}),r.debug&&(yn.get(n)?yn.get(n).push(this):yn.set(n,[this])),this}is_global_event(n){return n&&(this.global_event||this._global_events.indexOf(n)>=0||n.startsWith("#")||n.startsWith("/")||n.startsWith("@"))}add_action(n,e,l={}){e&&"function"==typeof e?(l.global&&this._global_events.push(n),this.on(n,((...t)=>{r.debug&&r.run("debug",{component:this,_:">",event:n,p:t,current_state:this.state,options:l});try{const o=e(this.state,...t);r.debug&&r.run("debug",{component:this,_:"<",event:n,p:t,newState:o,state:this.state,options:l}),this.setState(o,l)}catch(e){console.error(`Error in component action '${n}':`,e),r.debug&&r.run("debug",{component:this,_:"!",event:n,p:t,error:e,state:this.state,options:l})}}),l)):console.warn(`Component action for '${n}' is not a valid function:`,e)}add_actions(){const n=this.update||{};fn.getMetadataKeys(this).forEach((e=>{if(e.startsWith("apprun-update:")){const l=fn.getMetadata(e,this);n[l.name]=[this[l.key].bind(this),l.options]}}));const e={};Array.isArray(n)?n.forEach((n=>{const[l,t,o]=n;l.toString().split(",").forEach((n=>e[n.trim()]=[t,o]))})):Object.keys(n).forEach((l=>{const t=n[l];("function"==typeof t||Array.isArray(t))&&l.split(",").forEach((n=>e[n.trim()]=t))})),e["."]||(e["."]=vn),Object.keys(e).forEach((n=>{const l=e[n];"function"==typeof l?this.add_action(n,l):Array.isArray(l)&&this.add_action(n,l[0],l[1])}))}run(n,...e){if(this.state instanceof Promise)return Promise.resolve(this.state).then((l=>{this.state=l,this.run(n,...e)}));{const l=n.toString();return this.is_global_event(l)?r.run(l,...e):this._app.run(l,...e)}}on(n,e,l){const t=n.toString();return this._actions.push({name:t,fn:e}),this.is_global_event(t)?r.on(t,e,l):this._app.on(t,e,l)}runAsync(n,...e){const l=n.toString();return this.is_global_event(l)?r.runAsync(l,...e):this._app.runAsync(l,...e)}query(n,...e){return console.warn("component.query() is deprecated. Use component.runAsync() instead."),this.runAsync(n,...e)}unmount(){var n;null===(n=this.observer)||void 0===n||n.disconnect(),this._actions.forEach((n=>{const{name:e,fn:l}=n;this.is_global_event(e)?r.off(e,l):this._app.off(e,l)}))}}function kn(){const n=r.find("#");if(n&&n.length>0)return r.run("#"),void r.run(On,"#");const e=r.find("/");if(e&&e.length>0)return r.run("/"),void r.run(On,"/");const l=r.find("#/");if(l&&l.length>0)return r.run("#/"),void r.run(On,"#/");console.warn("No subscribers for event: "),r.run(Cn,""),r.run(On,"")}function wn(n){if(!n)return void kn();n=function(n){return n&&"/"!==n&&"#"!==n&&"#/"!==n&&n.endsWith("/")?n.slice(0,-1):n}(n);const e=r.basePath;e&&(n=function(n,e){if(!e||"/"===e||""===e)return n;const l=e.startsWith("/")?e:"/"+e;if(n.startsWith(l)){const e=n.substring(l.length);return e.startsWith("/")?e:"/"+e}return n}(n,e));const l=function(n){return n?n.startsWith("#/")?n.substring(2).split("/"):n.startsWith("#")||n.startsWith("/")?n.substring(1).split("/"):n.split("/"):[]}(n);let t;!function(n){const e=n.filter(Boolean);e.length>11&&console.warn(`Deep route hierarchy detected: ${e.join("/")} (${e.length} levels)`)}(l),t=n.startsWith("#/")?"hash-slash":n.startsWith("#")?"hash":n.startsWith("/")?"path":"non-prefixed";const o=function(n,e){const l=[];for(let t=n.length;t>0;t--){const o=n.slice(0,t);let i="";switch(e){case"path":i="/"+o.join("/");break;case"hash":i="#"+o.join("/");break;case"hash-slash":i="#/"+o.join("/");break;case"non-prefixed":i=o.join("/")}l.push(i)}return l}(l,t),i=function(n,e){for(let l=0;l<n.length;l++){const t=n[l],o=r.find(t);if(o&&o.length>0){const o=n.length-l;return{eventName:t,parameters:e.slice(o)}}}return null}(o,l);if(i)Sn(i.eventName,...i.parameters);else if(o.length>0){const e=o[o.length-1];console.warn(`No subscribers for event: ${e}`),r.run(Cn,n),r.run(On,n)}else kn()}bn.l=!0;const Sn=(n,...e)=>{if(!n||n===On||n===Cn)return;const l=r.find(n);l&&0!==l.length?r.run(n,...e):(console.warn(`No subscribers for event: ${n}`),r.run(Cn,n,...e)),r.run(On,n,...e)},On="//",Cn="///",xn=n=>{r.lastUrl!==n&&(r.lastUrl=n,wn(n))};if(!r.start){r.version=n,r.h=r.createElement=function(n,e,...l){const t=nn(l);if("string"==typeof n)return{tag:n,props:e,children:t};if(Array.isArray(n))return n;if(void 0===n&&l)return t;if(Object.getPrototypeOf(n).l)return{tag:n,props:e,children:t};if("function"==typeof n)return n(e,t);throw new Error(`Unknown tag in vdom ${n}`)},r.render=tn,r.Fragment=Q,r.webComponent=dn,r.safeHTML=un,r.start=(n,e,l,t,o)=>{const i=Object.assign({render:!0,global_event:!0},o),r=new bn(e,l,t);return o&&o.rendered&&(r.rendered=o.rendered),o&&o.mounted&&(r.mounted=o.mounted),r.start(n,i),r},r.once=r.once||((n,e,l={})=>{r.on(n,e,Object.assign(Object.assign({},l),{once:!0}))}),r.query=r.query||r.runAsync;const e=n=>{};if(r.on("/",e),r.on("debug",(n=>e)),r.on(On,e),r.on(Cn,e),r.route=xn,r.on("route",(n=>r.route&&r.route(n))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{const n=document.body.hasAttribute("apprun-no-init")||r["no-init-route"]||!1,e=r.find("#")||r.find("#/")||!1;window.addEventListener("hashchange",(()=>xn(location.hash))),window.addEventListener("popstate",(()=>xn(location.pathname))),e?!n&&xn(location.hash):(!n&&(()=>{const n=r.basePath||"";let e=location.pathname;n&&e.startsWith(n)&&(e=e.substring(n.length),e.startsWith("/")||(e="/"+e)),xn(e)})(),document.body.addEventListener("click",(n=>{const e=n.target;if(!e)return;const l="A"===e.tagName?e:e.closest("a");if(l&&l.origin===location.origin&&l.pathname){n.preventDefault();const e=(r.basePath||"")+l.pathname;history.pushState(null,"",e),xn(l.pathname)}})))})),"object"==typeof window){const n=window;n.Component=bn,n._React=n.React,n.React=r,n.on=gn,n.customElement=mn,n.safeHTML=un}r.use_render=(n,e=0)=>{r.render=0===e?(e,l)=>n(l,e):(e,l)=>n(e,l)},r.use_react=(n,e)=>{if(n&&e)if("function"==typeof n.createElement)if(n.Fragment)if(r.h=r.createElement=n.createElement,r.Fragment=n.Fragment,n.version&&n.version.startsWith("18")){if(!e.createRoot||"function"!=typeof e.createRoot)return void console.error("AppRun use_react: ReactDOM.createRoot not found in React 18+");r.render=(n,l)=>{n&&void 0!==l&&(n._root||(n._root=e.createRoot(n)),n._root.render(l))}}else{if(!e.render||"function"!=typeof e.render)return void console.error("AppRun use_react: ReactDOM.render not found in legacy React");r.render=(n,l)=>e.render(l,n)}else console.error("AppRun use_react: Invalid React object - Fragment not found");else console.error("AppRun use_react: Invalid React object - createElement method not found");else console.error("AppRun use_react: React and ReactDOM parameters are required")}}export{l as App,bn as Component,Q as Fragment,Cn as ROUTER_404_EVENT,On as ROUTER_EVENT,r as app,mn as customElement,r as default,pn as event,gn as on,un as safeHTML,pn as update};
2
2
  //# sourceMappingURL=apprun.esm.js.map