apprun 3.35.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 (75) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +134 -16
  3. package/WHATSNEW.md +28 -12
  4. package/apprun-book.jpg +0 -0
  5. package/apprun.d.ts +9 -6
  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 +60 -12
  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-html.js +8 -4
  28. package/esm/apprun-html.js.map +1 -1
  29. package/esm/apprun.js +81 -17
  30. package/esm/apprun.js.map +1 -1
  31. package/esm/component.js +60 -19
  32. package/esm/component.js.map +1 -1
  33. package/esm/decorator.js +22 -5
  34. package/esm/decorator.js.map +1 -1
  35. package/esm/directive.js +64 -13
  36. package/esm/directive.js.map +1 -1
  37. package/esm/router.js +263 -22
  38. package/esm/router.js.map +1 -1
  39. package/esm/type-utils.js +91 -0
  40. package/esm/type-utils.js.map +1 -0
  41. package/esm/types.js +32 -11
  42. package/esm/types.js.map +1 -1
  43. package/esm/vdom-my-new.js +329 -0
  44. package/esm/vdom-my-new.js.map +1 -0
  45. package/esm/vdom-my-prop-attr.js +227 -0
  46. package/esm/vdom-my-prop-attr.js.map +1 -0
  47. package/esm/vdom-my.js +77 -88
  48. package/esm/vdom-my.js.map +1 -1
  49. package/esm/version.js +15 -0
  50. package/esm/version.js.map +1 -0
  51. package/esm/web-component.js +30 -10
  52. package/esm/web-component.js.map +1 -1
  53. package/index.html +1 -1
  54. package/jest.config.js +3 -8
  55. package/jest.setup.js +29 -3
  56. package/jsx-runtime.js +1 -1
  57. package/jsx-runtime.js.map +1 -1
  58. package/package.json +7 -7
  59. package/src/app.ts +58 -12
  60. package/src/apprun-dev-tools.tsx +1 -7
  61. package/src/apprun-html.ts +8 -4
  62. package/src/apprun.ts +97 -20
  63. package/src/component.ts +62 -20
  64. package/src/decorator.ts +23 -6
  65. package/src/directive.ts +64 -13
  66. package/src/router.ts +282 -20
  67. package/src/type-utils.ts +130 -0
  68. package/src/types.ts +33 -12
  69. package/src/vdom-my-new.ts +311 -0
  70. package/src/vdom-my-prop-attr.ts +241 -0
  71. package/src/vdom-my.ts +82 -71
  72. package/src/version.ts +16 -0
  73. package/src/web-component.ts +31 -11
  74. package/cli/export.js +0 -92
  75. package/cli/import.js +0 -68
@@ -1,34 +1,34 @@
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:e,options:n}=s;return n.delay?this.delay(t,e,i,n):Object.keys(n).length>0?e.apply(this,[...i,n]):e.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,e){e._t&&clearTimeout(e._t),e._t=setTimeout((()=>{clearTimeout(e._t),Object.keys(e).length>0?i.apply(this,[...s,e]):i.apply(this,s)}),e.delay)}runAsync(t,...i){const s=this.getSubscribers(t,this._events);console.assert(s&&s.length>0,"No subscriber for event: "+t);const e=s.map((t=>{const{fn:s,options:e}=t;return Object.keys(e).length>0?s.apply(this,[...i,e]):s.apply(this,i)}));return Promise.all(e)}query(t,...i){return this.runAsync(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((e=>s.push(...i[e].map((i=>Object.assign(Object.assign({},i),{options:Object.assign(Object.assign({},i.options),{event:t})})))))),s}}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 t,s.app=i,s._AppRunVersions="AppRun-3.3.11");var e=i;const n=(t,i)=>(i?t.state[i]:t.state)||"",o=(t,i,s)=>{if(i){const e=t.state||{};e[i]=s,t.setState(e)}else t.setState(s)},r=(t,i)=>{if(Array.isArray(t))return t.map((t=>r(t,i)));{let{type:s,tag:h,props:c,children:l}=t;return h=h||s,l=l||(null==c?void 0:c.children),c&&Object.keys(c).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):e.run(t,i);else if("string"==typeof s)i[t]=t=>r.run?r.run(s,t):e.run(s,t);else if("function"==typeof s)i[t]=t=>r.setState(s(r.state,t));else if(Array.isArray(s)){const[n,...o]=s;"string"==typeof n?i[t]=t=>r.run?r.run(n,...o,t):e.run(n,...o,t):"function"==typeof n&&(i[t]=t=>r.setState(n(r.state,...o,t)))}}else if("$bind"===t){const e=i.type||"text",h="string"==typeof i[t]?i[t]:i.name;if("input"===s)switch(e){case"checkbox":i.checked=n(r,h),i.onclick=t=>o(r,h||t.target.name,t.target.checked);break;case"radio":i.checked=n(r,h)===i.value,i.onclick=t=>o(r,h||t.target.name,t.target.value);break;case"number":case"range":i.value=n(r,h),i.oninput=t=>o(r,h||t.target.name,Number(t.target.value));break;default:i.value=n(r,h),i.oninput=t=>o(r,h||t.target.name,t.target.value)}else"select"===s?(i.value=n(r,h),i.onchange=t=>{t.target.multiple||o(r,h||t.target.name,t.target.value)}):"option"===s?(i.selected=n(r,h),i.onclick=t=>o(r,h||t.target.name,t.target.selected)):"textarea"===s&&(i.innerHTML=n(r,h),i.oninput=t=>o(r,h||t.target.name,t.target.value))}else e.run("$",{key:t,tag:s,props:i,component:r})})(t,c,h,i),delete c[t])})),l&&r(l,i),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 a(t,i,...s){const e=l(s);if("string"==typeof t)return{tag:t,props:i,children:e};if(Array.isArray(t))return t;if(void 0===t&&s)return e;if(Object.getPrototypeOf(t).i)return{tag:t,props:i,children:e};if("function"==typeof t)return t(i,e);throw new Error(`Unknown tag in vdom ${t}`)}const u=new WeakMap,d=(t,i,s={})=>{if(null==i||!1===i)return;!function(t,i,s={}){if(null==i||!1===i)return;if(i=g(i,s),!t)return;const e="SVG"===t.nodeName;Array.isArray(i)?f(t,i,e):f(t,[i],e)}("string"==typeof t&&t?document.getElementById(t)||document.querySelector(t):t,i=r(i,s),s)};function p(t,i,s){3!==i._op&&(s=s||"svg"===i.tag,!function(t,i){const s=t.nodeName,e=`${i.tag||""}`;return s.toUpperCase()===e.toUpperCase()}(t,i)?t.parentNode.replaceChild(b(i,s),t):(!(2&i._op)&&f(t,i.children,s),!(1&i._op)&&m(t,i.props,s)))}function f(t,i,s){var e,n;const o=(null===(e=t.childNodes)||void 0===e?void 0:e.length)||0,r=(null==i?void 0:i.length)||0,h=Math.min(o,r);for(let e=0;e<h;e++){const n=i[e];if(3===n._op)continue;const o=t.childNodes[e];if("string"==typeof n)o.textContent!==n&&(3===o.nodeType?o.nodeValue=n:t.replaceChild(v(n),o));else if(n instanceof HTMLElement||n instanceof SVGElement)t.insertBefore(n,o);else{const i=n.props&&n.props.key;if(i)if(o.key===i)p(t.childNodes[e],n,s);else{const r=u[i];if(r){const i=r.nextSibling;t.insertBefore(r,o),i?t.insertBefore(o,i):t.appendChild(o),p(t.childNodes[e],n,s)}else t.replaceChild(b(n,s),o)}else p(t.childNodes[e],n,s)}}let c=(null===(n=t.childNodes)||void 0===n?void 0:n.length)||0;for(;c>h;)t.removeChild(t.lastChild),c--;if(r>h){const e=document.createDocumentFragment();for(let t=h;t<i.length;t++)e.appendChild(b(i[t],s));t.appendChild(e)}}const y=t=>{const i=document.createElement("section");return i.insertAdjacentHTML("afterbegin",t),Array.from(i.children)};function v(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 v(t);if(!t.tag||"function"==typeof t.tag)return v(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 m(s,t.props,i),t.children&&t.children.forEach((t=>s.appendChild(b(t,i)))),s}function m(t,i,s){const e=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)),Object.keys(i).forEach((t=>s[t]=i[t])),s}(e,i||{}),t[c]=i;for(const e in i){const n=i[e];if(e.startsWith("data-")){const i=e.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[i]!==n&&(n||""===n?t.dataset[i]=n:delete t.dataset[i])}else if("style"===e)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof n)t.style.cssText=n;else for(const i in n)t.style[i]!==n[i]&&(t.style[i]=n[i]);else if(e.startsWith("xlink")){const i=e.replace("xlink","").toLowerCase();null==n||!1===n?t.removeAttributeNS("http://www.w3.org/1999/xlink",i):t.setAttributeNS("http://www.w3.org/1999/xlink",i,n)}else e.startsWith("on")?n&&"function"!=typeof n?"string"==typeof n&&(n?t.setAttribute(e,n):t.removeAttribute(e)):t[e]=n:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-|^for$/g.test(e)||s?t.getAttribute(e)!==n&&(n?t.setAttribute(e,n):t.removeAttribute(e)):t[e]!==n&&(t[e]=n);"key"===e&&n&&(u[n]=t)}i&&"function"==typeof i.ref&&window.requestAnimationFrame((()=>i.ref(t)))}function g(t,i,s=0){var e;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>g(t,i,s++)));let n=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).i&&(n=function(t,i,s){const{tag:e,props:n,children:o}=t;let r=`_${s}`,h=n&&n.id;h?r=h:h=`_${s}${Date.now()}`;let c="section";n&&n.as&&(c=n.as,delete n.as),i.v||(i.v={});let l=i.v[r];if(l&&l instanceof e&&l.element)l.renderState(l.state);else{const t=document.createElement(c);l=i.v[r]=new e(Object.assign(Object.assign({},n),{children:o})).mount(t,{render:!0})}if(l.mounted){const t=l.mounted(n,o,l.state);void 0!==t&&l.setState(t)}return m(l.element,n,!1),l.element}(t,i,s)),n&&Array.isArray(n.children)){const t=null===(e=n.props)||void 0===e?void 0:e._component;if(t){let i=0;n.children=n.children.map((s=>g(s,t,i++)))}else n.children=n.children.map((t=>g(t,i,s++)))}return n}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 e=s.observedAttributes||[],n=e.reduce(((t,i)=>{const s=i.toLowerCase();return s!==i&&(t[s]=i),t}),{});this._attrMap=t=>n[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),e.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(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,e;null===(i=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===i||i.call(t),null===(e=null===(s=this._component)||void 0===s?void 0:s.unmount)||void 0===e||e.call(s),this._component=null}attributeChangedCallback(t,s,e){if(this._component){const n=this._attrMap(t);this._component._props[n]=e,this._component.run("attributeChanged",n,s,e),e!==s&&!1!==i.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var $=(t,i,s)=>{"undefined"!=typeof customElements&&customElements.define(t,w(i,s))};const S={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}};const A=new Map;e.find("get-components")||e.on("get-components",(t=>t.components=A));const j=t=>t;class x{renderState(t,i=null){if(!this.view)return;let s=i||this.view(t);if(e.debug&&e.run("debug",{component:this,_:s?".":"-",state:t,vdom:s,el:this.element}),"object"!=typeof document)return;const n="string"==typeof this.element&&this.element?document.getElementById(this.element)||document.querySelector(this.element):this.element;if(!n)return;const o="_c";this.unload?n._component===this&&n.getAttribute(o)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),n.setAttribute(o,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(n)||(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]}))):n.removeAttribute&&n.removeAttribute(o),n._component=this,!i&&s&&(s=r(s,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>e.render(n,s,this))):e.render(n,s,this)),this.rendered&&this.rendered(this.state)}setState(t,i={render:!0,history:!1}){const s=async t=>{try{for(;;){const{value:s,done:e}=await t.next();if(e)break;this.setState(s,i)}}catch(t){console.error("Error in async iterator:",t)}},e=t;if(null==e?void 0:e[Symbol.asyncIterator])this.setState(s(e[Symbol.asyncIterator]()),i);else if((null==e?void 0:e[Symbol.iterator])&&"function"==typeof e.next)for(const t of e)this.setState(t,i);else if(t&&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,e,n){this.state=i,this.view=s,this.update=e,this.options=n,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,n;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]=j)),this.add_actions(),this.state=null!==(n=null!==(s=this.state)&&void 0!==s?s:this.model)&&void 0!==n?n:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!i.render,history:!0}),e.debug&&(A.get(t)?A.get(t).push(this):A.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,((...n)=>{e.debug&&e.run("debug",{component:this,_:">",event:t,p:n,current_state:this.state,options:s});const o=i(this.state,...n);e.debug&&e.run("debug",{component:this,_:"<",event:t,p:n,newState:o,state:this.state,options:s}),this.setState(o,s)}),s))}add_actions(){const t=this.update||{};S.getMetadataKeys(this).forEach((i=>{if(i.startsWith("apprun-update:")){const s=S.getMetadata(i,this);t[s.name]=[this[s.key].bind(this),s.options]}}));const i={};Array.isArray(t)?t.forEach((t=>{const[s,e,n]=t;s.toString().split(",").forEach((t=>i[t.trim()]=[e,n]))})):Object.keys(t).forEach((s=>{const e=t[s];("function"==typeof e||Array.isArray(e))&&s.split(",").forEach((t=>i[t.trim()]=e))})),i["."]||(i["."]=j),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)?e.run(s,...i):this._app.run(s,...i)}}on(t,i,s){const n=t.toString();return this._actions.push({name:n,fn:i}),this.is_global_event(n)?e.on(n,i,s):this._app.on(n,i,s)}runAsync(t,...i){const s=t.toString();return this.is_global_event(s)?e.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)?e.off(i,s):this._app.off(i,s)}))}}x.i=!0;const O="//",_="///",k=t=>{if(e.lastUrl!==t)if(e.lastUrl=t,t||(t="#"),t.startsWith("#")){const[i,...s]=t.split("/");e.run(i,...s)||e.run(_,i,...s),e.run(O,i,...s)}else if(t.startsWith("/")){const[i,s,...n]=t.split("/");e.run("/"+s,...n)||e.run(_,"/"+s,...n),e.run(O,"/"+s,...n)}else e.run(t)||e.run(_,t),e.run(O,t)};if(!e.start){e.version="3.35.0",e.h=e.createElement=a,e.render=d,e.Fragment=h,e.webComponent=$,e.safeHTML=y,e.start=(t,i,s,e,n)=>{const o=Object.assign({render:!0,global_event:!0},n),r=new x(i,s,e);return n&&n.rendered&&(r.rendered=n.rendered),n&&n.mounted&&(r.mounted=n.mounted),r.start(t,o),r};const t=t=>{};e.on("debug",(i=>t)),e.on(O,t),e.on(_,t),e.route=k,e.on("route",(t=>e.route&&e.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{const t=document.body.hasAttribute("apprun-no-init")||e["no-init-route"]||!1,i=e.find("#")||e.find("#/")||!1;window.addEventListener("hashchange",(()=>k(location.hash))),window.addEventListener("popstate",(()=>k(location.pathname))),i?t&&k(location.hash):(t&&k(location.pathname),document.body.addEventListener("click",(t=>{const i=t.target,s="A"===i.tagName?i:i.closest("a");s&&s.origin===location.origin&&(t.preventDefault(),history.pushState(null,"",s.pathname),k(s.pathname))})))})),"object"==typeof window&&(window.Component=x,window._React=window.React,window.React=e,window.on=function(t,i={}){return function(s,e){const n=t?t.toString():e;S.defineMetadata(`apprun-update:${n}`,{name:n,key:e,options:i},s)}},window.customElement=function(t,i){return function(s){return $(t,s,i),s}},window.safeHTML=y),e.use_render=(t,i=0)=>{e.render=0===i?(i,s)=>t(s,i):(i,s)=>t(i,s)},e.use_react=(t,i)=>{e.h=e.createElement=t.createElement,e.Fragment=t.Fragment,e.render=(t,s)=>i.render(s,t),t.version&&t.version.startsWith("18")&&(e.render=(t,s)=>{t&&s&&(t._root||(t._root=i.createRoot(t)),t._root.render(s))})}}
1
+ const n="3.36.1",t=`AppRun-${n}`;class e{constructor(){this._events={}}on(n,t,e={}){this._events[n]=this._events[n]||[],this._events[n].push({fn:t,options:e})}off(n,t){const e=this._events[n]||[];this._events[n]=e.filter((n=>n.fn!==t))}find(n){return this._events[n]}run(n,...t){const e=this.getSubscribers(n,this._events);return console.assert(e&&e.length>0,"No subscriber for event: "+n),e.forEach((e=>{const{fn:l,options:o}=e;if(!l||"function"!=typeof l)return console.error(`AppRun event handler for '${n}' is not a function:`,l),!1;if(o.delay)this.delay(n,l,t,o);else try{Object.keys(o).length>0?l.apply(this,[...t,o]):l.apply(this,t)}catch(t){console.error(`Error in event handler for '${n}':`,t)}return!e.options.once})),e.length}once(n,t,e={}){this.on(n,t,Object.assign(Object.assign({},e),{once:!0}))}delay(n,t,e,l){l._t&&clearTimeout(l._t),l._t=setTimeout((()=>{clearTimeout(l._t);try{Object.keys(l).length>0?t.apply(this,[...e,l]):t.apply(this,e)}catch(t){console.error(`Error in delayed event handler for '${n}':`,t)}}),l.delay)}runAsync(n,...t){const e=this.getSubscribers(n,this._events);console.assert(e&&e.length>0,"No subscriber for event: "+n);const l=e.map((e=>{const{fn:l,options:o}=e;if(!l||"function"!=typeof l)return console.error(`AppRun async event handler for '${n}' is not a function:`,l),Promise.resolve(null);try{return Object.keys(o).length>0?l.apply(this,[...t,o]):l.apply(this,t)}catch(t){return console.error(`Error in async event handler for '${n}':`,t),Promise.reject(t)}}));return Promise.all(l)}query(n,...t){return console.warn("app.query() is deprecated. Use app.runAsync() instead."),this.runAsync(n,...t)}getSubscribers(n,t){const e=t[n]||[];return t[n]=e.filter((n=>!n.options.once)),Object.keys(t).filter((t=>t.endsWith("*")&&n.startsWith(t.replace("*","")))).sort(((n,t)=>t.length-n.length)).forEach((l=>e.push(...t[l].map((t=>Object.assign(Object.assign({},t),{options:Object.assign(Object.assign({},t.options),{event:n})})))))),e}}const l=t;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 e,i.app=o,i._AppRunVersions=l);var s=o;function r(n){return(null==n?void 0:n.target)instanceof HTMLElement?n.target:null}const a=(n,t)=>(t?n.state[t]:n.state)||"",u=(n,t,e)=>{if(t){const l=n.state||{};l[t]=e,n.setState(l)}else n.setState(e)},c=(n,t)=>{if(Array.isArray(n))return n.map((n=>c(n,t)));{let{type:e,tag:l,props:o,children:i}=n;return l=l||e,i=i||(null==o?void 0:o.children),o&&Object.keys(o).forEach((n=>{n.startsWith("$")&&(((n,t,e,l)=>{if(n.startsWith("$on")){const e=t[n];if(n=n.substring(1),"boolean"==typeof e)t[n]=t=>l.run?l.run(n,t):s.run(n,t);else if("string"==typeof e)t[n]=n=>l.run?l.run(e,n):s.run(e,n);else if("function"==typeof e)t[n]=n=>l.setState(e(l.state,n));else if(Array.isArray(e)){const[o,...i]=e;"string"==typeof o?t[n]=n=>l.run?l.run(o,...i,n):s.run(o,...i,n):"function"==typeof o&&(t[n]=n=>l.setState(o(l.state,...i,n)))}}else if("$bind"===n){const o=t.type||"text",i="string"==typeof t[n]?t[n]:t.name;if("input"===e)switch(o){case"checkbox":t.checked=a(l,i),t.onclick=n=>{const t=r(n);t&&u(l,i||t.name,t.checked)};break;case"radio":t.checked=a(l,i)===t.value,t.onclick=n=>{const t=r(n);t&&u(l,i||t.name,t.value)};break;case"number":case"range":t.value=a(l,i),t.oninput=n=>{const t=r(n);t&&u(l,i||t.name,Number(t.value))};break;default:t.value=a(l,i),t.oninput=n=>{const t=r(n);t&&u(l,i||t.name,t.value)}}else"select"===e?(t.value=a(l,i),t.onchange=n=>{const t=r(n);t&&!t.multiple&&u(l,i||t.name,t.value)}):"option"===e?(t.selected=a(l,i),t.onclick=n=>{const t=r(n);t&&u(l,i||t.name,t.selected)}):"textarea"===e&&(t.innerHTML=a(l,i),t.oninput=n=>{const t=r(n);t&&u(l,i||t.name,t.value)})}else s.run("$",{key:n,tag:e,props:t,component:l})})(n,o,l,t),delete o[n])})),i&&c(i,t),n}};class h{constructor(n,t,e){this.normal=t,this.property=n,e&&(this.space=e)}}function d(n,t){const e={},l={};for(const t of n)Object.assign(e,t.property),Object.assign(l,t.normal);return new h(e,l,t)}function p(n){return n.toLowerCase()}h.prototype.normal={},h.prototype.property={},h.prototype.space=void 0;class f{constructor(n,t){this.attribute=t,this.property=n}}f.prototype.attribute="",f.prototype.booleanish=!1,f.prototype.boolean=!1,f.prototype.commaOrSpaceSeparated=!1,f.prototype.commaSeparated=!1,f.prototype.defined=!1,f.prototype.mustUseProperty=!1,f.prototype.number=!1,f.prototype.overloadedBoolean=!1,f.prototype.property="",f.prototype.spaceSeparated=!1,f.prototype.space=void 0;let g=0;const m=x(),v=x(),y=x(),b=x(),w=x(),k=x(),S=x();function x(){return 2**++g}var C=Object.freeze({__proto__:null,boolean:m,booleanish:v,commaOrSpaceSeparated:S,commaSeparated:k,number:b,overloadedBoolean:y,spaceSeparated:w});const O=Object.keys(C);class P extends f{constructor(n,t,e,l){let o=-1;if(super(n,t),M(this,"space",l),"number"==typeof e)for(;++o<O.length;){const n=O[o];M(this,O[o],(e&C[n])===C[n])}}}function M(n,t,e){e&&(n[t]=e)}function A(n){const t={},e={};for(const[l,o]of Object.entries(n.properties)){const i=new P(l,n.transform(n.attributes||{},l),o,n.space);n.mustUseProperty&&n.mustUseProperty.includes(l)&&(i.mustUseProperty=!0),t[l]=i,e[p(l)]=l,e[p(i.attribute)]=l}return new h(t,e,n.space)}P.prototype.defined=!0;const E=A({properties:{ariaActiveDescendant:null,ariaAtomic:v,ariaAutoComplete:null,ariaBusy:v,ariaChecked:v,ariaColCount:b,ariaColIndex:b,ariaColSpan:b,ariaControls:w,ariaCurrent:null,ariaDescribedBy:w,ariaDetails:null,ariaDisabled:v,ariaDropEffect:w,ariaErrorMessage:null,ariaExpanded:v,ariaFlowTo:w,ariaGrabbed:v,ariaHasPopup:null,ariaHidden:v,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:w,ariaLevel:b,ariaLive:null,ariaModal:v,ariaMultiLine:v,ariaMultiSelectable:v,ariaOrientation:null,ariaOwns:w,ariaPlaceholder:null,ariaPosInSet:b,ariaPressed:v,ariaReadOnly:v,ariaRelevant:null,ariaRequired:v,ariaRoleDescription:w,ariaRowCount:b,ariaRowIndex:b,ariaRowSpan:b,ariaSelected:v,ariaSetSize:b,ariaSort:null,ariaValueMax:b,ariaValueMin:b,ariaValueNow:b,ariaValueText:null,role:null},transform:(n,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function R(n,t){return t in n?n[t]:t}function D(n,t){return R(n,t.toLowerCase())}const $=A({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:k,acceptCharset:w,accessKey:w,action:null,allow:null,allowFullScreen:m,allowPaymentRequest:m,allowUserMedia:m,alt:null,as:null,async:m,autoCapitalize:null,autoComplete:w,autoFocus:m,autoPlay:m,blocking:w,capture:null,charSet:null,checked:m,cite:null,className:w,cols:b,colSpan:null,content:null,contentEditable:v,controls:m,controlsList:w,coords:b|k,crossOrigin:null,data:null,dateTime:null,decoding:null,default:m,defer:m,dir:null,dirName:null,disabled:m,download:y,draggable:v,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:m,formTarget:null,headers:w,height:b,hidden:y,high:b,href:null,hrefLang:null,htmlFor:w,httpEquiv:w,id:null,imageSizes:null,imageSrcSet:null,inert:m,inputMode:null,integrity:null,is:null,isMap:m,itemId:null,itemProp:w,itemRef:w,itemScope:m,itemType:w,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:w,placeholder:null,playsInline:m,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:m,referrerPolicy:null,rel:w,required:m,reversed:m,rows:b,rowSpan:b,sandbox:w,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:v,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:v,width:b,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:w,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:v,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:D}),T=A({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:w,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:k,g2:k,glyphName:k,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:w,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:R}),j=A({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(n,t)=>"xlink:"+t.slice(5).toLowerCase()}),L=A({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:D}),_=A({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(n,t)=>"xml:"+t.slice(3).toLowerCase()}),U=/[A-Z]/g,z=/-[a-z]/g,B=/^data[-\w.:]+$/i;function I(n){return"-"+n.toLowerCase()}function H(n){return n.charAt(1).toUpperCase()}const N=d([E,$,j,L,_],"html"),F=d([E,T,j,L,_],"svg"),q="_props",V=new Map;function W(n,t){const e=`${n}:${t}`;let l=V.get(e);return void 0===l&&(l=function(n,t){const e=p(t);let l=t,o=f;if(e in n.normal)return n.property[n.normal[e]];if(e.length>4&&"data"===e.slice(0,4)&&B.test(t)){if("-"===t.charAt(4)){const n=t.slice(5).replace(z,H);l="data"+n.charAt(0).toUpperCase()+n.slice(1)}else{const n=t.slice(4);if(!z.test(n)){let e=n.replace(U,I);"-"!==e.charAt(0)&&(e="-"+e),t="data"+e}}o=P}return new o(l,t)}(t?F:N,n)||null,V.set(e,l)),l}function K(n,t,e){!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)}(e)?n.removeAttribute(t):n.setAttribute(t,t)}function X(n,t,e){try{n[t]=e}catch(l){Y(n,t,e,!1)}}function Y(n,t,e,l){if(null==e)return void n.removeAttribute(t);const o=String(e);if(l&&t.includes(":")){const[e]=t.split(":");"xlink"===e?n.setAttributeNS("http://www.w3.org/1999/xlink",t,o):n.setAttribute(t,o)}else n.setAttribute(t,o)}function Z(n,t,e,l){if(function(n,t){if(document.activeElement===n)return["value","selectionStart","selectionEnd","selectionDirection"].includes(t);if("scrollTop"===t||"scrollLeft"===t)return!0;if(n instanceof HTMLMediaElement&&["currentTime","paused","playbackRate","volume"].includes(t))return!0;return!1}(n,t))return;if("style"===t){if(n.style.cssText&&(n.style.cssText=""),"string"==typeof e)n.style.cssText=e;else if(e&&"object"==typeof e)for(const t in e)n.style[t]!==e[t]&&(n.style[t]=e[t]);return}if("key"===t)return void(null!=e&&(n.key=e));if(t.startsWith("data-"))return void function(n,t,e){const l=(o=t.slice(5)).length<=1?o.toLowerCase():o.split("-").map(((n,t)=>0===t?n.toLowerCase():n.charAt(0).toUpperCase()+n.slice(1).toLowerCase())).join("");var o;null==e?delete n.dataset[l]:n.dataset[l]=String(e)}(n,t,e);if(t.startsWith("on"))return void function(n,t,e){t.startsWith("on")&&(e&&"function"!=typeof e?"string"==typeof e&&(e?n.setAttribute(t,e):n.removeAttribute(t)):n[t]=e)}(n,t,e);if(!("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName&&"SELECT"!==n.tagName||"value"!==t&&"selected"!==t&&"selectedIndex"!==t))return void X(n,t,e);if("INPUT"===n.tagName&&"checked"===t)return X(n,t,e),void K(n,t,e);const o=W(t,l);o?o.boolean||o.overloadedBoolean?K(n,o.attribute,e):o.mustUseProperty&&!l?X(n,o.property,e):Y(n,o.attribute,e,l):t.startsWith("aria-")||"role"===t?Y(n,t,e,l):t in n||void 0!==n[t]?X(n,t,e):Y(n,t,e,l)}function J(n){return/^[a-zA-Z_:][\w\-:.]*$/.test(n)&&!n.includes("<")&&!n.includes(">")&&!n.includes('"')&&!n.includes("'")}function G(n,t,e){const l=function(n,t){if(t&&(t.class=t.class||t.className,delete t.className),!n||0===Object.keys(n).length)return t||{};if(!t||0===Object.keys(t).length){const t={};return Object.keys(n).forEach((n=>t[n]=null)),t}const e={};return Object.keys(n).forEach((n=>{n in t||(e[n]=null)})),Object.keys(t).forEach((n=>e[n]=t[n])),e}(n[q]||{},t);n[q]=t||{},function(n,t,e,l){for(const e in t)J(e)&&Z(n,e,t[e],l);t&&"function"==typeof t.ref&&window.requestAnimationFrame((()=>t.ref(n)))}(n,l,0,e)}function Q(n,...t){return nn(t)}function nn(n){const t=[],e=n=>{null!=n&&""!==n&&!1!==n&&t.push("function"==typeof n||"object"==typeof n?n:`${n}`)};return n&&n.forEach((n=>{Array.isArray(n)?n.forEach((n=>e(n))):e(n)})),t}const tn={};let en=0;function ln(n,t,...e){const l=nn(e);if("string"==typeof n)return{tag:n,props:t,children:l};if(Array.isArray(n))return n;if(void 0===n&&e)return l;if(Object.getPrototypeOf(n).i)return{tag:n,props:t,children:l};if("function"==typeof n)return n(t,l);throw new Error(`Unknown tag in vdom ${n}`)}const on=(n,t,e={})=>{if(null==t||!1===t)return;!function(n,t,e={}){if(null==t||!1===t)return;if(t=hn(t,e),!n)return;const l="SVG"===n.nodeName;Array.isArray(t)?rn(n,t,l):rn(n,[t],l)}("string"==typeof n&&n?document.getElementById(n)||document.querySelector(n):n,t=c(t,e),e)};function sn(n,t,e){e=e||"svg"===t.tag,function(n,t){const e=n.nodeName,l=`${t.tag||""}`;return e.toUpperCase()===l.toUpperCase()}(n,t)?(rn(n,t.children,e),G(n,t.props,e)):n.parentNode.replaceChild(cn(t,e),n)}function rn(n,t,e){var l,o;const i=(null===(l=n.childNodes)||void 0===l?void 0:l.length)||0,s=(null==t?void 0:t.length)||0,r=Math.min(i,s);for(let l=0;l<r;l++){const o=t[l],i=n.childNodes[l];if("string"==typeof o)i.textContent!==o&&(3===i.nodeType?i.nodeValue=o:n.replaceChild(un(o),i));else if(o instanceof HTMLElement||o instanceof SVGElement)n.insertBefore(o,i);else{const t=o.props&&o.props.key;if(t)if(i.key===t)sn(n.childNodes[l],o,e);else{const s=tn[t];s?(n.insertBefore(s,i),sn(n.childNodes[l],o,e)):n.replaceChild(cn(o,e),i)}else sn(n.childNodes[l],o,e)}}let a=(null===(o=n.childNodes)||void 0===o?void 0:o.length)||0;for(;a>r;)n.removeChild(n.lastChild),a--;if(s>r){const l=document.createDocumentFragment();for(let n=r;n<t.length;n++)l.appendChild(cn(t[n],e));n.appendChild(l)}}const an=n=>{const t=document.createElement("section");return t.insertAdjacentHTML("afterbegin",n),Array.from(t.children)};function un(n){if(0===(null==n?void 0:n.indexOf("_html:"))){const t=document.createElement("div");return t.insertAdjacentHTML("afterbegin",n.substring(6)),t}return document.createTextNode(null!=n?n:"")}function cn(n,t){if(n instanceof HTMLElement||n instanceof SVGElement)return n;if("string"==typeof n)return un(n);if(!n.tag||"function"==typeof n.tag)return un(JSON.stringify(n));const e=(t=t||"svg"===n.tag)?document.createElementNS("http://www.w3.org/2000/svg",n.tag):document.createElement(n.tag);return G(e,n.props,t),n.children&&n.children.forEach((n=>e.appendChild(cn(n,t)))),n.props&&void 0!==n.props.key&&(e.key=n.props.key,tn[n.props.key]=e,++en>=500&&(!function(){if(!(Object.keys(tn).length<=1e3))for(const[n,t]of Object.entries(tn))t.isConnected||delete tn[n]}(),en=0)),e}function hn(n,t,e=0){var l;if("string"==typeof n)return n;if(Array.isArray(n))return n.map((n=>hn(n,t,e++)));let o=n;if(n&&"function"==typeof n.tag&&Object.getPrototypeOf(n.tag).i&&(o=function(n,t,e){const{tag:l,props:o,children:i}=n;let s=`_${e}`,r=o&&o.id;r?s=r:r=`_${e}${Date.now()}`;let a="section";o&&o.as&&(a=o.as,delete o.as),t.m||(t.m={});let u=t.m[s];if(u&&u instanceof l&&u.element)u.renderState(u.state);else{const n=document.createElement(a);u=t.m[s]=new l(Object.assign(Object.assign({},o),{children:i})).mount(n,{render:!0})}if(u.mounted){const n=u.mounted(o,i,u.state);void 0!==n&&u.setState(n)}return G(u.element,o,!1),u.element}(n,t,e)),o&&Array.isArray(o.children)){const n=null===(l=o.props)||void 0===l?void 0:l._component;if(n){let t=0;o.children=o.children.map((e=>hn(e,n,t++)))}else o.children=o.children.map((n=>hn(n,t,e++)))}return o}const dn=(n,t={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(t.observedAttributes||[]).map((n=>n.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const e=t||{};this._shadowRoot=e.shadow?this.attachShadow({mode:"open"}):this;const l=e.observedAttributes||[],o=l.reduce(((n,t)=>{const e=t.toLowerCase();return e!==t&&(n[e]=t),n}),{});this._attrMap=n=>o[n]||n;const i={};Array.from(this.attributes).forEach((n=>i[this._attrMap(n.name)]=n.value)),l.forEach((n=>{void 0!==this[n]&&(i[n]=this[n]),Object.defineProperty(this,n,{get:()=>i[n],set(t){this.attributeChangedCallback(n,i[n],t)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const t=this.children?Array.from(this.children):[];if(this._component=new n(Object.assign(Object.assign({},i),{children:t})).mount(this._shadowRoot,e),this._component._props=i,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const n=this._component.mounted(i,t,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!==e.render&&this._component.run(".")}))}}disconnectedCallback(){var n,t,e,l;null===(t=null===(n=this._component)||void 0===n?void 0:n.unload)||void 0===t||t.call(n),null===(l=null===(e=this._component)||void 0===e?void 0:e.unmount)||void 0===l||l.call(e),this._component=null}attributeChangedCallback(n,e,l){if(this._component){const o=this._attrMap(n);this._component._props[o]=l,this._component.run("attributeChanged",o,e,l),l!==e&&!1!==t.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var pn=(n,t,e)=>{"undefined"!=typeof customElements&&customElements.define(n,dn(t,e))};const fn={meta:new WeakMap,defineMetadata(n,t,e){this.meta.has(e)||this.meta.set(e,{}),this.meta.get(e)[n]=t},getMetadataKeys(n){return n=Object.getPrototypeOf(n),this.meta.get(n)?Object.keys(this.meta.get(n)):[]},getMetadata(n,t){return t=Object.getPrototypeOf(t),this.meta.get(t)?this.meta.get(t)[n]:null}};const gn=new Map;s.find("get-components")||s.on("get-components",(n=>n.components=gn));const mn=n=>n;class vn{renderState(n,t=null){if(!this.view)return;let e=t||this.view(n);if(s.debug&&s.run("debug",{component:this,_:e?".":"-",state:n,vdom:e,el:this.element}),"object"!=typeof document)return;const l="string"==typeof this.element&&this.element?function(n){try{return document.getElementById(n)}catch(t){return console.warn(`Error getting element by id: ${n}`,t),null}}(this.element)||function(n,t=document){try{return t.querySelector(n)}catch(t){return console.warn(`Invalid selector: ${n}`,t),null}}(this.element):this.element;if(!l)return void console.warn(`Component element not found: ${this.element}`);const o="_c";this.unload?l._component===this&&l.getAttribute(o)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),l.setAttribute(o,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((n=>{n[0].oldValue!==this.tracking_id&&document.body.contains(l)||(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]}))):l.removeAttribute&&l.removeAttribute(o),l._component=this,!t&&e&&(e=c(e,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>s.render(l,e,this))):s.render(l,e,this)),this.rendered&&this.rendered(this.state)}setState(n,t={render:!0,history:!1}){const e=async n=>{try{for(;;){const{value:e,done:l}=await n.next();if(l)break;this.setState(e,t)}}catch(n){console.error("Error in async iterator:",n)}},l=n;if(null==l?void 0:l[Symbol.asyncIterator])this.setState(e(l[Symbol.asyncIterator]()),t);else if((null==l?void 0:l[Symbol.iterator])&&"function"==typeof l.next)for(const n of l)this.setState(n,t);else if(n&&n instanceof Promise)Promise.resolve(n).then((e=>{this.setState(e,t),this._state=n}));else{if(this._state=n,null==n)return;this.state=n,!1!==t.render&&(t.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(n))):this.renderState(n)),!1!==t.history&&this.enable_history&&(this._history=[...this._history,n],this._history_idx=this._history.length-1),"function"==typeof t.callback&&t.callback(this.state)}}constructor(n,t,l,o){this.state=n,this.view=t,this.update=l,this.options=o,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=(n=null,t)=>{if(this.mount(n,Object.assign({render:!0},t)),this.mounted&&"function"==typeof this.mounted){const n=this.mounted({},[],this.state);void 0!==n&&this.setState(n)}return this}}mount(n=null,t){var e,l;return console.assert(!this.element,"Component already mounted."),this.options=t=Object.assign(Object.assign({},this.options),t),this.element=n,this.global_event=t.global_event,this.enable_history=!!t.history,this.enable_history&&(this.on(t.history.prev||"history-prev",this._history_prev),this.on(t.history.next||"history-next",this._history_next)),t.route&&(this.update=this.update||{},this.update[t.route]||(this.update[t.route]=mn)),this.add_actions(),this.state=null!==(l=null!==(e=this.state)&&void 0!==e?e:this.model)&&void 0!==l?l:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!t.render,history:!0}),s.debug&&(gn.get(n)?gn.get(n).push(this):gn.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,t,e={}){t&&"function"==typeof t?(e.global&&this._global_events.push(n),this.on(n,((...l)=>{s.debug&&s.run("debug",{component:this,_:">",event:n,p:l,current_state:this.state,options:e});try{const o=t(this.state,...l);s.debug&&s.run("debug",{component:this,_:"<",event:n,p:l,newState:o,state:this.state,options:e}),this.setState(o,e)}catch(t){console.error(`Error in component action '${n}':`,t),s.debug&&s.run("debug",{component:this,_:"!",event:n,p:l,error:t,state:this.state,options:e})}}),e)):console.warn(`Component action for '${n}' is not a valid function:`,t)}add_actions(){const n=this.update||{};fn.getMetadataKeys(this).forEach((t=>{if(t.startsWith("apprun-update:")){const e=fn.getMetadata(t,this);n[e.name]=[this[e.key].bind(this),e.options]}}));const t={};Array.isArray(n)?n.forEach((n=>{const[e,l,o]=n;e.toString().split(",").forEach((n=>t[n.trim()]=[l,o]))})):Object.keys(n).forEach((e=>{const l=n[e];("function"==typeof l||Array.isArray(l))&&e.split(",").forEach((n=>t[n.trim()]=l))})),t["."]||(t["."]=mn),Object.keys(t).forEach((n=>{const e=t[n];"function"==typeof e?this.add_action(n,e):Array.isArray(e)&&this.add_action(n,e[0],e[1])}))}run(n,...t){if(this.state instanceof Promise)return Promise.resolve(this.state).then((e=>{this.state=e,this.run(n,...t)}));{const e=n.toString();return this.is_global_event(e)?s.run(e,...t):this._app.run(e,...t)}}on(n,t,e){const l=n.toString();return this._actions.push({name:l,fn:t}),this.is_global_event(l)?s.on(l,t,e):this._app.on(l,t,e)}runAsync(n,...t){const e=n.toString();return this.is_global_event(e)?s.runAsync(e,...t):this._app.runAsync(e,...t)}query(n,...t){return console.warn("component.query() is deprecated. Use component.runAsync() instead."),this.runAsync(n,...t)}unmount(){var n;null===(n=this.observer)||void 0===n||n.disconnect(),this._actions.forEach((n=>{const{name:t,fn:e}=n;this.is_global_event(t)?s.off(t,e):this._app.off(t,e)}))}}function yn(){const n=s.find("#");if(n&&n.length>0)return s.run("#"),void s.run(kn,"#");const t=s.find("/");if(t&&t.length>0)return s.run("/"),void s.run(kn,"/");const e=s.find("#/");if(e&&e.length>0)return s.run("#/"),void s.run(kn,"#/");console.warn("No subscribers for event: "),s.run(Sn,""),s.run(kn,"")}function bn(n){if(!n)return void yn();n=function(n){return n&&"/"!==n&&"#"!==n&&"#/"!==n&&n.endsWith("/")?n.slice(0,-1):n}(n);const t=s.basePath;t&&(n=function(n,t){if(!t||"/"===t||""===t)return n;const e=t.startsWith("/")?t:"/"+t;if(n.startsWith(e)){const t=n.substring(e.length);return t.startsWith("/")?t:"/"+t}return n}(n,t));const e=function(n){return n?n.startsWith("#/")?n.substring(2).split("/"):n.startsWith("#")||n.startsWith("/")?n.substring(1).split("/"):n.split("/"):[]}(n);let l;!function(n){const t=n.filter(Boolean);t.length>11&&console.warn(`Deep route hierarchy detected: ${t.join("/")} (${t.length} levels)`)}(e),l=n.startsWith("#/")?"hash-slash":n.startsWith("#")?"hash":n.startsWith("/")?"path":"non-prefixed";const o=function(n,t){const e=[];for(let l=n.length;l>0;l--){const o=n.slice(0,l);let i="";switch(t){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("/")}e.push(i)}return e}(e,l),i=function(n,t){for(let e=0;e<n.length;e++){const l=n[e],o=s.find(l);if(o&&o.length>0){const o=n.length-e;return{eventName:l,parameters:t.slice(o)}}}return null}(o,e);if(i)wn(i.eventName,...i.parameters);else if(o.length>0){const t=o[o.length-1];console.warn(`No subscribers for event: ${t}`),s.run(Sn,n),s.run(kn,n)}else yn()}vn.i=!0;const wn=(n,...t)=>{if(!n||n===kn||n===Sn)return;const e=s.find(n);e&&0!==e.length?s.run(n,...t):(console.warn(`No subscribers for event: ${n}`),s.run(Sn,n,...t)),s.run(kn,n,...t)},kn="//",Sn="///",xn=n=>{s.lastUrl!==n&&(s.lastUrl=n,bn(n))};if(!s.start){s.version=n,s.h=s.createElement=ln,s.render=on,s.Fragment=Q,s.webComponent=pn,s.safeHTML=an,s.start=(n,t,e,l,o)=>{const i=Object.assign({render:!0,global_event:!0},o),s=new vn(t,e,l);return o&&o.rendered&&(s.rendered=o.rendered),o&&o.mounted&&(s.mounted=o.mounted),s.start(n,i),s},s.once=s.once||((n,t,e={})=>{s.on(n,t,Object.assign(Object.assign({},e),{once:!0}))}),s.query=s.query||s.runAsync;const t=n=>{};if(s.on("/",t),s.on("debug",(n=>t)),s.on(kn,t),s.on(Sn,t),s.route=xn,s.on("route",(n=>s.route&&s.route(n))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{const n=document.body.hasAttribute("apprun-no-init")||s["no-init-route"]||!1,t=s.find("#")||s.find("#/")||!1;window.addEventListener("hashchange",(()=>xn(location.hash))),window.addEventListener("popstate",(()=>xn(location.pathname))),t?!n&&xn(location.hash):(!n&&(()=>{const n=s.basePath||"";let t=location.pathname;n&&t.startsWith(n)&&(t=t.substring(n.length),t.startsWith("/")||(t="/"+t)),xn(t)})(),document.body.addEventListener("click",(n=>{const t=n.target;if(!t)return;const e="A"===t.tagName?t:t.closest("a");if(e&&e.origin===location.origin&&e.pathname){n.preventDefault();const t=(s.basePath||"")+e.pathname;history.pushState(null,"",t),xn(e.pathname)}})))})),"object"==typeof window){const n=window;n.Component=vn,n._React=n.React,n.React=s,n.on=function(n,t={}){return function(e,l){const o=n?n.toString():l;fn.defineMetadata(`apprun-update:${o}`,{name:o,key:l,options:t},e)}},n.customElement=function(n,t){return function(e){return pn(n,e,t),e}},n.safeHTML=an}s.use_render=(n,t=0)=>{s.render=0===t?(t,e)=>n(e,t):(t,e)=>n(t,e)},s.use_react=(n,t)=>{if(n&&t)if("function"==typeof n.createElement)if(n.Fragment)if(s.h=s.createElement=n.createElement,s.Fragment=n.Fragment,n.version&&n.version.startsWith("18")){if(!t.createRoot||"function"!=typeof t.createRoot)return void console.error("AppRun use_react: ReactDOM.createRoot not found in React 18+");s.render=(n,e)=>{n&&void 0!==e&&(n._root||(n._root=t.createRoot(n)),n._root.render(e))}}else{if(!t.render||"function"!=typeof t.render)return void console.error("AppRun use_react: ReactDOM.render not found in legacy React");s.render=(n,e)=>t.render(e,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")}}
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
- */const C=globalThis,E=C.ShadowRoot&&(void 0===C.ShadyCSS||C.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,M=Symbol(),P=new WeakMap;let T=class{constructor(t,i,s){if(this._$cssResult$=!0,s!==M)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o;const i=this.t;if(E&&void 0===t){const s=void 0!==i&&1===i.length;s&&(t=P.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&P.set(i,t))}return t}toString(){return this.cssText}};const U=E?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const s of t.cssRules)i+=s.cssText;return(t=>new T("string"==typeof t?t:t+"",void 0,M))(i)})(t):t
6
+ */const Cn=globalThis,On=Cn.ShadowRoot&&(void 0===Cn.ShadyCSS||Cn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Pn=Symbol(),Mn=new WeakMap;let An=class{constructor(n,t,e){if(this._$cssResult$=!0,e!==Pn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=n,this.t=t}get styleSheet(){let n=this.o;const t=this.t;if(On&&void 0===n){const e=void 0!==t&&1===t.length;e&&(n=Mn.get(t)),void 0===n&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),e&&Mn.set(t,n))}return n}toString(){return this.cssText}};const En=On?n=>n:n=>n instanceof CSSStyleSheet?(n=>{let t="";for(const e of n.cssRules)t+=e.cssText;return(n=>new An("string"==typeof n?n:n+"",void 0,Pn))(t)})(n):n
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */,{is:N,defineProperty:R,getOwnPropertyDescriptor:z,getOwnPropertyNames:D,getOwnPropertySymbols:L,getPrototypeOf:B}=Object,H=globalThis,q=H.trustedTypes,I=q?q.emptyScript:"",W=H.reactiveElementPolyfillSupport,F=(t,i)=>t,V={toAttribute(t,i){switch(i){case Boolean:t=t?I:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},G=(t,i)=>!N(t,i),J={attribute:!0,type:String,converter:V,reflect:!1,useDefault:!1,hasChanged:G};Symbol.metadata??=Symbol("metadata"),H.litPropertyMetadata??=new WeakMap;let K=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=J){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(t,i),!i.noAccessor){const s=Symbol(),e=this.getPropertyDescriptor(t,s,i);void 0!==e&&R(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){const{get:e,set:n}=z(this.prototype,t)??{get(){return this[i]},set(t){this[i]=t}};return{get:e,set(i){const o=e?.call(this);n?.call(this,i),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??J}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;const t=B(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){const t=this.properties,i=[...D(t),...L(t)];for(const s of i)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const i=litPropertyMetadata.get(t);if(void 0!==i)for(const[t,s]of i)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const s=this._$Eu(t,i);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)i.unshift(U(t))}else void 0!==t&&i.push(U(t));return i}static _$Eu(t,i){const s=i.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,i=this.constructor.elementProperties;for(const s of i.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,i)=>{if(E)t.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const s of i){const i=document.createElement("style"),e=C.litNonce;void 0!==e&&i.setAttribute("nonce",e),i.textContent=s.cssText,t.appendChild(i)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$ET(t,i){const s=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,s);if(void 0!==e&&!0===s.reflect){const n=(void 0!==s.converter?.toAttribute?s.converter:V).toAttribute(i,s.type);this._$Em=t,null==n?this.removeAttribute(e):this.setAttribute(e,n),this._$Em=null}}_$AK(t,i){const s=this.constructor,e=s._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=s.getPropertyOptions(e),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:V;this._$Em=e,this[e]=n.fromAttribute(i,t.type)??this._$Ej?.get(e)??null,this._$Em=null}}requestUpdate(t,i,s){if(void 0!==t){const e=this.constructor,n=this[t];if(s??=e.getPropertyOptions(t),!((s.hasChanged??G)(n,i)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,s))))return;this.C(t,i,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,i,{useDefault:s,reflect:e,wrapped:n},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??i??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||s||(i=void 0),this._$AL.set(t,i)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,i]of this._$Ep)this[t]=i;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[i,s]of t){const{wrapped:t}=s,e=this[i];!0!==t||this._$AL.has(i)||void 0===e||this.C(i,void 0,s,e)}}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(i)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(i)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};K.elementStyles=[],K.shadowRootOptions={mode:"open"},K[F("elementProperties")]=new Map,K[F("finalized")]=new Map,W?.({ReactiveElement:K}),(H.reactiveElementVersions??=[]).push("2.1.0");
11
+ */,{is:Rn,defineProperty:Dn,getOwnPropertyDescriptor:$n,getOwnPropertyNames:Tn,getOwnPropertySymbols:jn,getPrototypeOf:Ln}=Object,_n=globalThis,Un=_n.trustedTypes,zn=Un?Un.emptyScript:"",Bn=_n.reactiveElementPolyfillSupport,In=(n,t)=>n,Hn={toAttribute(n,t){switch(t){case Boolean:n=n?zn:null;break;case Object:case Array:n=null==n?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=null!==n;break;case Number:e=null===n?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch(n){e=null}}return e}},Nn=(n,t)=>!Rn(n,t),Fn={attribute:!0,type:String,converter:Hn,reflect:!1,useDefault:!1,hasChanged:Nn};Symbol.metadata??=Symbol("metadata"),_n.litPropertyMetadata??=new WeakMap;let qn=class extends HTMLElement{static addInitializer(n){this._$Ei(),(this.l??=[]).push(n)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(n,t=Fn){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(n)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(n,t),!t.noAccessor){const e=Symbol(),l=this.getPropertyDescriptor(n,e,t);void 0!==l&&Dn(this.prototype,n,l)}}static getPropertyDescriptor(n,t,e){const{get:l,set:o}=$n(this.prototype,n)??{get(){return this[t]},set(n){this[t]=n}};return{get:l,set(t){const i=l?.call(this);o?.call(this,t),this.requestUpdate(n,i,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(n){return this.elementProperties.get(n)??Fn}static _$Ei(){if(this.hasOwnProperty(In("elementProperties")))return;const n=Ln(this);n.finalize(),void 0!==n.l&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(In("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(In("properties"))){const n=this.properties,t=[...Tn(n),...jn(n)];for(const e of t)this.createProperty(e,n[e])}const n=this[Symbol.metadata];if(null!==n){const t=litPropertyMetadata.get(n);if(void 0!==t)for(const[n,e]of t)this.elementProperties.set(n,e)}this._$Eh=new Map;for(const[n,t]of this.elementProperties){const e=this._$Eu(n,t);void 0!==e&&this._$Eh.set(e,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(n){const t=[];if(Array.isArray(n)){const e=new Set(n.flat(1/0).reverse());for(const n of e)t.unshift(En(n))}else void 0!==n&&t.push(En(n));return t}static _$Eu(n,t){const e=t.attribute;return!1===e?void 0:"string"==typeof e?e:"string"==typeof n?n.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((n=>this.enableUpdating=n)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((n=>n(this)))}addController(n){(this._$EO??=new Set).add(n),void 0!==this.renderRoot&&this.isConnected&&n.hostConnected?.()}removeController(n){this._$EO?.delete(n)}_$E_(){const n=new Map,t=this.constructor.elementProperties;for(const e of t.keys())this.hasOwnProperty(e)&&(n.set(e,this[e]),delete this[e]);n.size>0&&(this._$Ep=n)}createRenderRoot(){const n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((n,t)=>{if(On)n.adoptedStyleSheets=t.map((n=>n instanceof CSSStyleSheet?n:n.styleSheet));else for(const e of t){const t=document.createElement("style"),l=Cn.litNonce;void 0!==l&&t.setAttribute("nonce",l),t.textContent=e.cssText,n.appendChild(t)}})(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((n=>n.hostConnected?.()))}enableUpdating(n){}disconnectedCallback(){this._$EO?.forEach((n=>n.hostDisconnected?.()))}attributeChangedCallback(n,t,e){this._$AK(n,e)}_$ET(n,t){const e=this.constructor.elementProperties.get(n),l=this.constructor._$Eu(n,e);if(void 0!==l&&!0===e.reflect){const o=(void 0!==e.converter?.toAttribute?e.converter:Hn).toAttribute(t,e.type);this._$Em=n,null==o?this.removeAttribute(l):this.setAttribute(l,o),this._$Em=null}}_$AK(n,t){const e=this.constructor,l=e._$Eh.get(n);if(void 0!==l&&this._$Em!==l){const n=e.getPropertyOptions(l),o="function"==typeof n.converter?{fromAttribute:n.converter}:void 0!==n.converter?.fromAttribute?n.converter:Hn;this._$Em=l,this[l]=o.fromAttribute(t,n.type)??this._$Ej?.get(l)??null,this._$Em=null}}requestUpdate(n,t,e){if(void 0!==n){const l=this.constructor,o=this[n];if(e??=l.getPropertyOptions(n),!((e.hasChanged??Nn)(o,t)||e.useDefault&&e.reflect&&o===this._$Ej?.get(n)&&!this.hasAttribute(l._$Eu(n,e))))return;this.C(n,t,e)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(n,t,{useDefault:e,reflect:l,wrapped:o},i){e&&!(this._$Ej??=new Map).has(n)&&(this._$Ej.set(n,i??t??this[n]),!0!==o||void 0!==i)||(this._$AL.has(n)||(this.hasUpdated||e||(t=void 0),this._$AL.set(n,t)),!0===l&&this._$Em!==n&&(this._$Eq??=new Set).add(n))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const n=this.scheduleUpdate();return null!=n&&await n,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,t]of this._$Ep)this[n]=t;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[t,e]of n){const{wrapped:n}=e,l=this[t];!0!==n||this._$AL.has(t)||void 0===l||this.C(t,void 0,e,l)}}let n=!1;const t=this._$AL;try{n=this.shouldUpdate(t),n?(this.willUpdate(t),this._$EO?.forEach((n=>n.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw n=!1,this._$EM(),t}n&&this._$AE(t)}willUpdate(n){}_$AE(n){this._$EO?.forEach((n=>n.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(n)),this.updated(n)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(n){return!0}update(n){this._$Eq&&=this._$Eq.forEach((n=>this._$ET(n,this[n]))),this._$EM()}updated(n){}firstUpdated(n){}};qn.elementStyles=[],qn.shadowRootOptions={mode:"open"},qn[In("elementProperties")]=new Map,qn[In("finalized")]=new Map,Bn?.({ReactiveElement:qn}),(_n.reactiveElementVersions??=[]).push("2.1.0");
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const X=globalThis,Z=X.trustedTypes,Y=Z?Z.createPolicy("lit-html",{createHTML:t=>t}):void 0,Q="$lit$",tt=`lit$${Math.random().toFixed(9).slice(2)}$`,it="?"+tt,st=`<${it}>`,et=document,nt=()=>et.createComment(""),ot=t=>null===t||"object"!=typeof t&&"function"!=typeof t,rt=Array.isArray,ht="[ \t\n\f\r]",ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,lt=/-->/g,at=/>/g,ut=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),dt=/'/g,pt=/"/g,ft=/^(?:script|style|textarea|title)$/i,yt=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),vt=yt(1),bt=yt(2),mt=Symbol.for("lit-noChange"),gt=Symbol.for("lit-nothing"),wt=new WeakMap,$t=et.createTreeWalker(et,129);function St(t,i){if(!rt(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Y?Y.createHTML(i):i}const At=(t,i)=>{const s=t.length-1,e=[];let n,o=2===i?"<svg>":3===i?"<math>":"",r=ct;for(let i=0;i<s;i++){const s=t[i];let h,c,l=-1,a=0;for(;a<s.length&&(r.lastIndex=a,c=r.exec(s),null!==c);)a=r.lastIndex,r===ct?"!--"===c[1]?r=lt:void 0!==c[1]?r=at:void 0!==c[2]?(ft.test(c[2])&&(n=RegExp("</"+c[2],"g")),r=ut):void 0!==c[3]&&(r=ut):r===ut?">"===c[0]?(r=n??ct,l=-1):void 0===c[1]?l=-2:(l=r.lastIndex-c[2].length,h=c[1],r=void 0===c[3]?ut:'"'===c[3]?pt:dt):r===pt||r===dt?r=ut:r===lt||r===at?r=ct:(r=ut,n=void 0);const u=r===ut&&t[i+1].startsWith("/>")?" ":"";o+=r===ct?s+st:l>=0?(e.push(h),s.slice(0,l)+Q+s.slice(l)+tt+u):s+tt+(-2===l?i:u)}return[St(t,o+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class jt{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let n=0,o=0;const r=t.length-1,h=this.parts,[c,l]=At(t,i);if(this.el=jt.createElement(c,s),$t.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(e=$t.nextNode())&&h.length<r;){if(1===e.nodeType){if(e.hasAttributes())for(const t of e.getAttributeNames())if(t.endsWith(Q)){const i=l[o++],s=e.getAttribute(t).split(tt),r=/([.?@])?(.*)/.exec(i);h.push({type:1,index:n,name:r[2],strings:s,ctor:"."===r[1]?Ct:"?"===r[1]?Et:"@"===r[1]?Mt:kt}),e.removeAttribute(t)}else t.startsWith(tt)&&(h.push({type:6,index:n}),e.removeAttribute(t));if(ft.test(e.tagName)){const t=e.textContent.split(tt),i=t.length-1;if(i>0){e.textContent=Z?Z.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],nt()),$t.nextNode(),h.push({type:2,index:++n});e.append(t[i],nt())}}}else if(8===e.nodeType)if(e.data===it)h.push({type:2,index:n});else{let t=-1;for(;-1!==(t=e.data.indexOf(tt,t+1));)h.push({type:7,index:n}),t+=tt.length-1}n++}}static createElement(t,i){const s=et.createElement("template");return s.innerHTML=t,s}}function xt(t,i,s=t,e){if(i===mt)return i;let n=void 0!==e?s._$Co?.[e]:s._$Cl;const o=ot(i)?void 0:i._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=n:s._$Cl=n),void 0!==n&&(i=xt(t,n._$AS(t,i.values),n,e)),i}class Ot{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??et).importNode(i,!0);$t.currentNode=e;let n=$t.nextNode(),o=0,r=0,h=s[0];for(;void 0!==h;){if(o===h.index){let i;2===h.type?i=new _t(n,n.nextSibling,this,t):1===h.type?i=new h.ctor(n,h.name,h.strings,this,t):6===h.type&&(i=new Pt(n,this,t)),this._$AV.push(i),h=s[++r]}o!==h?.index&&(n=$t.nextNode(),o++)}return $t.currentNode=et,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class _t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=gt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0}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=xt(this,t,i),ot(t)?t===gt||null==t||""===t?(this._$AH!==gt&&this._$AR(),this._$AH=gt):t!==this._$AH&&t!==mt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>rt(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==gt&&ot(this._$AH)?this._$AA.nextSibling.data=t:this.T(et.createTextNode(t)),this._$AH=t}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=jt.createElement(St(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else{const t=new Ot(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t}}_$AC(t){let i=wt.get(t.strings);return void 0===i&&wt.set(t.strings,i=new jt(t)),i}k(t){rt(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const n of t)e===i.length?i.push(s=new _t(this.O(nt()),this.O(nt()),this,this.options)):s=i[e],s._$AI(n),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class kt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,n){this.type=1,this._$AH=gt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=gt}_$AI(t,i=this,s,e){const n=this.strings;let o=!1;if(void 0===n)t=xt(this,t,i,0),o=!ot(t)||t!==this._$AH&&t!==mt,o&&(this._$AH=t);else{const e=t;let r,h;for(t=n[0],r=0;r<n.length-1;r++)h=xt(this,e[s+r],i,r),h===mt&&(h=this._$AH[r]),o||=!ot(h)||h!==this._$AH[r],h===gt?t=gt:t!==gt&&(t+=(h??"")+n[r+1]),this._$AH[r]=h}o&&!e&&this.j(t)}j(t){t===gt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ct extends kt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===gt?void 0:t}}class Et extends kt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==gt)}}class Mt extends kt{constructor(t,i,s,e,n){super(t,i,s,e,n),this.type=5}_$AI(t,i=this){if((t=xt(this,t,i,0)??gt)===mt)return;const s=this._$AH,e=t===gt&&s!==gt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==gt&&(s===gt||e);e&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Pt{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){xt(this,t)}}const Tt=X.litHtmlPolyfillSupport;Tt?.(jt,_t),(X.litHtmlVersions??=[]).push("3.3.0");const Ut=(t,i,s)=>{const e=s?.renderBefore??i;let n=e._$litPart$;if(void 0===n){const t=s?.renderBefore??null;e._$litPart$=n=new _t(i.insertBefore(nt(),t),t,void 0,s??{})}return n._$AI(t),n
17
+ const Vn=globalThis,Wn=Vn.trustedTypes,Kn=Wn?Wn.createPolicy("lit-html",{createHTML:n=>n}):void 0,Xn="$lit$",Yn=`lit$${Math.random().toFixed(9).slice(2)}$`,Zn="?"+Yn,Jn=`<${Zn}>`,Gn=document,Qn=()=>Gn.createComment(""),nt=n=>null===n||"object"!=typeof n&&"function"!=typeof n,tt=Array.isArray,et="[ \t\n\f\r]",lt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ot=/-->/g,it=/>/g,st=RegExp(`>|${et}(?:([^\\s"'>=/]+)(${et}*=${et}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),rt=/'/g,at=/"/g,ut=/^(?:script|style|textarea|title)$/i,ct=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),ht=ct(1),dt=ct(2),pt=Symbol.for("lit-noChange"),ft=Symbol.for("lit-nothing"),gt=new WeakMap,mt=Gn.createTreeWalker(Gn,129);function vt(n,t){if(!tt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Kn?Kn.createHTML(t):t}const yt=(n,t)=>{const e=n.length-1,l=[];let o,i=2===t?"<svg>":3===t?"<math>":"",s=lt;for(let t=0;t<e;t++){const e=n[t];let r,a,u=-1,c=0;for(;c<e.length&&(s.lastIndex=c,a=s.exec(e),null!==a);)c=s.lastIndex,s===lt?"!--"===a[1]?s=ot:void 0!==a[1]?s=it:void 0!==a[2]?(ut.test(a[2])&&(o=RegExp("</"+a[2],"g")),s=st):void 0!==a[3]&&(s=st):s===st?">"===a[0]?(s=o??lt,u=-1):void 0===a[1]?u=-2:(u=s.lastIndex-a[2].length,r=a[1],s=void 0===a[3]?st:'"'===a[3]?at:rt):s===at||s===rt?s=st:s===ot||s===it?s=lt:(s=st,o=void 0);const h=s===st&&n[t+1].startsWith("/>")?" ":"";i+=s===lt?e+Jn:u>=0?(l.push(r),e.slice(0,u)+Xn+e.slice(u)+Yn+h):e+Yn+(-2===u?t:h)}return[vt(n,i+(n[e]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),l]};class bt{constructor({strings:n,_$litType$:t},e){let l;this.parts=[];let o=0,i=0;const s=n.length-1,r=this.parts,[a,u]=yt(n,t);if(this.el=bt.createElement(a,e),mt.currentNode=this.el.content,2===t||3===t){const n=this.el.content.firstChild;n.replaceWith(...n.childNodes)}for(;null!==(l=mt.nextNode())&&r.length<s;){if(1===l.nodeType){if(l.hasAttributes())for(const n of l.getAttributeNames())if(n.endsWith(Xn)){const t=u[i++],e=l.getAttribute(n).split(Yn),s=/([.?@])?(.*)/.exec(t);r.push({type:1,index:o,name:s[2],strings:e,ctor:"."===s[1]?Ct:"?"===s[1]?Ot:"@"===s[1]?Pt:xt}),l.removeAttribute(n)}else n.startsWith(Yn)&&(r.push({type:6,index:o}),l.removeAttribute(n));if(ut.test(l.tagName)){const n=l.textContent.split(Yn),t=n.length-1;if(t>0){l.textContent=Wn?Wn.emptyScript:"";for(let e=0;e<t;e++)l.append(n[e],Qn()),mt.nextNode(),r.push({type:2,index:++o});l.append(n[t],Qn())}}}else if(8===l.nodeType)if(l.data===Zn)r.push({type:2,index:o});else{let n=-1;for(;-1!==(n=l.data.indexOf(Yn,n+1));)r.push({type:7,index:o}),n+=Yn.length-1}o++}}static createElement(n,t){const e=Gn.createElement("template");return e.innerHTML=n,e}}function wt(n,t,e=n,l){if(t===pt)return t;let o=void 0!==l?e._$Co?.[l]:e._$Cl;const i=nt(t)?void 0:t._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),void 0===i?o=void 0:(o=new i(n),o._$AT(n,e,l)),void 0!==l?(e._$Co??=[])[l]=o:e._$Cl=o),void 0!==o&&(t=wt(n,o._$AS(n,t.values),o,l)),t}class kt{constructor(n,t){this._$AV=[],this._$AN=void 0,this._$AD=n,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(n){const{el:{content:t},parts:e}=this._$AD,l=(n?.creationScope??Gn).importNode(t,!0);mt.currentNode=l;let o=mt.nextNode(),i=0,s=0,r=e[0];for(;void 0!==r;){if(i===r.index){let t;2===r.type?t=new St(o,o.nextSibling,this,n):1===r.type?t=new r.ctor(o,r.name,r.strings,this,n):6===r.type&&(t=new Mt(o,this,n)),this._$AV.push(t),r=e[++s]}i!==r?.index&&(o=mt.nextNode(),i++)}return mt.currentNode=Gn,l}p(n){let t=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(n,e,t),t+=e.strings.length-2):e._$AI(n[t])),t++}}class St{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(n,t,e,l){this.type=2,this._$AH=ft,this._$AN=void 0,this._$AA=n,this._$AB=t,this._$AM=e,this.options=l,this._$Cv=l?.isConnected??!0}get parentNode(){let n=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===n?.nodeType&&(n=t.parentNode),n}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(n,t=this){n=wt(this,n,t),nt(n)?n===ft||null==n||""===n?(this._$AH!==ft&&this._$AR(),this._$AH=ft):n!==this._$AH&&n!==pt&&this._(n):void 0!==n._$litType$?this.$(n):void 0!==n.nodeType?this.T(n):(n=>tt(n)||"function"==typeof n?.[Symbol.iterator])(n)?this.k(n):this._(n)}O(n){return this._$AA.parentNode.insertBefore(n,this._$AB)}T(n){this._$AH!==n&&(this._$AR(),this._$AH=this.O(n))}_(n){this._$AH!==ft&&nt(this._$AH)?this._$AA.nextSibling.data=n:this.T(Gn.createTextNode(n)),this._$AH=n}$(n){const{values:t,_$litType$:e}=n,l="number"==typeof e?this._$AC(n):(void 0===e.el&&(e.el=bt.createElement(vt(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===l)this._$AH.p(t);else{const n=new kt(l,this),e=n.u(this.options);n.p(t),this.T(e),this._$AH=n}}_$AC(n){let t=gt.get(n.strings);return void 0===t&&gt.set(n.strings,t=new bt(n)),t}k(n){tt(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let e,l=0;for(const o of n)l===t.length?t.push(e=new St(this.O(Qn()),this.O(Qn()),this,this.options)):e=t[l],e._$AI(o),l++;l<t.length&&(this._$AR(e&&e._$AB.nextSibling,l),t.length=l)}_$AR(n=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);n&&n!==this._$AB;){const t=n.nextSibling;n.remove(),n=t}}setConnected(n){void 0===this._$AM&&(this._$Cv=n,this._$AP?.(n))}}class xt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(n,t,e,l,o){this.type=1,this._$AH=ft,this._$AN=void 0,this.element=n,this.name=t,this._$AM=l,this.options=o,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=ft}_$AI(n,t=this,e,l){const o=this.strings;let i=!1;if(void 0===o)n=wt(this,n,t,0),i=!nt(n)||n!==this._$AH&&n!==pt,i&&(this._$AH=n);else{const l=n;let s,r;for(n=o[0],s=0;s<o.length-1;s++)r=wt(this,l[e+s],t,s),r===pt&&(r=this._$AH[s]),i||=!nt(r)||r!==this._$AH[s],r===ft?n=ft:n!==ft&&(n+=(r??"")+o[s+1]),this._$AH[s]=r}i&&!l&&this.j(n)}j(n){n===ft?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}}class Ct extends xt{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===ft?void 0:n}}class Ot extends xt{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==ft)}}class Pt extends xt{constructor(n,t,e,l,o){super(n,t,e,l,o),this.type=5}_$AI(n,t=this){if((n=wt(this,n,t,0)??ft)===pt)return;const e=this._$AH,l=n===ft&&e!==ft||n.capture!==e.capture||n.once!==e.once||n.passive!==e.passive,o=n!==ft&&(e===ft||l);l&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,n),this._$AH=n}handleEvent(n){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,n):this._$AH.handleEvent(n)}}class Mt{constructor(n,t,e){this.element=n,this.type=6,this._$AN=void 0,this._$AM=t,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(n){wt(this,n)}}const At=Vn.litHtmlPolyfillSupport;At?.(bt,St),(Vn.litHtmlVersions??=[]).push("3.3.0");const Et=(n,t,e)=>{const l=e?.renderBefore??t;let o=l._$litPart$;if(void 0===o){const n=e?.renderBefore??null;l._$litPart$=o=new St(t.insertBefore(Qn(),n),n,void 0,e??{})}return o._$AI(n),o
18
18
  /**
19
19
  * @license
20
20
  * Copyright 2017 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */},Nt=globalThis;let Rt=class extends K{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ut(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return mt}};Rt._$litElement$=!0,Rt.finalized=!0,Nt.litElementHydrateSupport?.({LitElement:Rt});const zt=Nt.litElementPolyfillSupport;zt?.({LitElement:Rt}),(Nt.litElementVersions??=[]).push("4.2.0");
22
+ */},Rt=globalThis;let Dt=class extends qn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const n=super.createRenderRoot();return this.renderOptions.renderBefore??=n.firstChild,n}update(n){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(n),this._$Do=Et(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return pt}};Dt._$litElement$=!0,Dt.finalized=!0,Rt.litElementHydrateSupport?.({LitElement:Dt});const $t=Rt.litElementPolyfillSupport;$t?.({LitElement:Dt}),(Rt.litElementVersions??=[]).push("4.2.0");
23
23
  /**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
27
  */
28
- const Dt=2,Lt=5,Bt=t=>(...i)=>({_$litDirective$:t,values:i});class Ht{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,s){this._$Ct=t,this._$AM=i,this._$Ci=s}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}
28
+ const Tt=2,jt=5,Lt=n=>(...t)=>({_$litDirective$:n,values:t});class _t{constructor(n){}get _$AU(){return this._$AM._$AU}_$AT(n,t,e){this._$Ct=n,this._$AM=t,this._$Ci=e}_$AS(n,t){return this.update(n,t)}update(n,t){return this.render(...t)}}
29
29
  /**
30
30
  * @license
31
31
  * Copyright 2017 Google LLC
32
32
  * SPDX-License-Identifier: BSD-3-Clause
33
- */class qt extends Ht{constructor(t){if(super(t),this.it=gt,t.type!==Dt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===gt||null==t)return this._t=void 0,this.it=t;if(t===mt)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const i=[t];return i.raw=i,this._t={_$litType$:this.constructor.resultType,strings:i,values:[]}}}qt.directiveName="unsafeHTML",qt.resultType=1;const It=Bt(qt);const Wt=Bt(class extends Ht{constructor(t){if(super(t),t.type!==Lt)throw new Error("run() can only be used in event handlers")}update(t,i){const s=t.element,n=t.name,[o,...r]=i,h=()=>{let t=s,i=t._component;for(;!i&&t;)t=t.parentElement,i=t&&t._component;return console.assert(!!i,"Component not found."),i};return"string"==typeof o?s[`on${n}`]=t=>{const i=h();i?i.run(o,...r,t):e.run(o,...r,t)}:"function"==typeof o&&(s[`on${n}`]=t=>h().setState(o(h().state,...r,t))),this.render()}render(){return mt}});e.createElement=a,e.render=function(t,i,s){i&&("string"==typeof i?(t._$litPart$||t.replaceChildren(),Ut(vt`${It(i)}`,t)):i._$litType$?(t._$litPart$||t.replaceChildren(),Ut(i,t)):(d(t,i,s),t._$litPart$=void 0))},e.Fragment=h,"object"==typeof window&&(window.React=window._React||e,window.html=vt,window.svg=bt,window.run=Wt);const Ft=(t,i,s,e)=>{if(!i||!s)return;const n=t=>{var s,e;const n=i.cloneNode();null===(s=i.parentNode)||void 0===s||s.replaceChild(n,i);const o=null===(e=(i=n).contentWindow)||void 0===e?void 0:e.document;o&&(o.open(),t.indexOf("<html")>=0?o.write(t):o.write((t=>`<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <meta http-equiv="X-UA-Compatible" content="ie=edge">\n <script src="https://cdnjs.cloudflare.com/ajax/libs/custom-elements/1.1.2/custom-elements.min.js"><\/script>\n <title>AppRun Playground</title>\n <style>\n body {\n font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;\n margin: 2em;\n }\n </style>\n <script src="https://unpkg.com/@babel/standalone/babel.min.js"><\/script>\n <script src="https://unpkg.com/apprun/dist/apprun-html.js"><\/script>\n</head>\n<body>\n<script>\n Babel.registerPlugin("d", [Babel.availablePlugins["proposal-decorators"], {legacy: true}]);\n Babel.registerPlugin("c", [Babel.availablePlugins["proposal-class-properties"], {loose: true}]);\n Babel.registerPlugin("b", [Babel.availablePlugins["proposal-private-methods"], {loose: true}]);\n<\/script>\n<script type="text/babel" data-plugins="d, c, b">\n ${t}\n<\/script>\n</body>\n</html>`)(t)),o.close())};n(s),!e&&t&&"TEXTAREA"===t.nodeName&&("undefined"==typeof CodeMirror?t.onkeyup=()=>n(t.value):t.editor||(t.editor=CodeMirror.fromTextArea(t,{lineNumbers:!0,mode:"jsx"}),t.editor.on("change",(t=>n(t.getValue())))))};e.webComponent("apprun-play",class extends x{constructor(){super(...arguments),this.view=t=>{const i=t["code-element"],s=this.element;let e,n;return e=i?document.querySelector(i):s.previousElementSibling||s.parentElement.previousElementSibling,n=(null==e?void 0:e.innerText)||(null==e?void 0:e.value)||t.code,this.state.code_area=e,this.state.code=n,n?`<div class="toolbox">\n ${!t.hide_button&&'<a class="button" onclick="app.run("@show-popup")" >Try the Code</a>'}\n </div>`:"<div>AppRun Play cannot find code to run, please set code-element selector.</div>"},this.rendered=({style:t,hide_src:i,code_area:s,code:e})=>{if(!e)return;if(!document.getElementById("play-popup")){document.body.insertAdjacentHTML("beforeend",'<div id="play-popup" class="overlay">\n<style id="apprun-play-style">\n.apprun-play .col {\n height: 100%;\n flex: 1;\n}\n.apprun-preview {\n width: 100%\n}\n.apprun-play .editor, .apprun-play .preview {\n display: inline-block;\n width: calc(100% - 20px);\n height: calc(100% - 10px);\n}\n\na.button {\n font-size: .8em;\n padding: 10px;\n cursor: pointer;\n color: var(--md-primary-bg-color);\n background: var(--md-primary-fg-color)\n}\na.button:hover {\n color: var(--md-primary-fg-color);\n background: var(--md-primary-bg-color)\n}\n\n.overlay {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.7);\n visibility: hidden;\n opacity: 0;\n z-index: 999;\n}\n.overlay.show {\n visibility: visible;\n opacity: 1;\n}\n\n.popup {\n margin: 80px auto;\n padding: 20px;\n background: #fff;\n border-radius: 3px;\n position: relative;\n width: 90%;\n height: calc(100% - 150px);\n}\n\n.popup .close {\n position: absolute;\n top: 10px;\n right: 20px;\n font-size: 20px;\n font-weight: bold;\n text-decoration: none;\n color: #333;\n}\n.popup .close:hover {\n color: #06D85F;\n}\n.popup .content {\n height: 100%;\n overflow: hidden;\n display: flex;\n}\n\n.cm-s-default {\n height: 100%;\n font-size: small;\n line-height: 1.5em;\n z-index: 0;\n}\n</style>\n\n\t<div class="popup apprun-play">\n\t\t<a class="close" href="javascript:app.run(\'@close-popup\')">&times;</a>\n\t\t<div class="content">\n\t\t\t<div class="col">\n <textarea class="editor"></textarea>\n </div>\n <div class="col">\n <iframe class="preview"/>\n </div>\n </div>\n\t</div>\n</div>');const t=document.querySelector(".apprun-play .editor"),i=document.querySelector(".apprun-play .preview");t.value=e,Ft(t,i,e,!1)}const n=document.createElement("iframe");n.classList.add("apprun-preview"),n.style.cssText=t,this.element.before(n),i&&(s.style.display="none"),Ft(s,n,e,i)},this.update={"@show-popup":({code:t})=>{var i;null===(i=document.querySelector(".apprun-play .editor").editor)||void 0===i||i.setValue(t),document.getElementById("play-popup").classList.add("show")},"@close-popup":()=>{document.getElementById("play-popup").classList.remove("show")}}}});
33
+ */class Ut extends _t{constructor(n){if(super(n),this.it=ft,n.type!==Tt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(n){if(n===ft||null==n)return this._t=void 0,this.it=n;if(n===pt)return n;if("string"!=typeof n)throw Error(this.constructor.directiveName+"() called with a non-string value");if(n===this.it)return this._t;this.it=n;const t=[n];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Ut.directiveName="unsafeHTML",Ut.resultType=1;const zt=Lt(Ut);const Bt=Lt(class extends _t{constructor(n){if(super(n),n.type!==jt)throw new Error("run() can only be used in event handlers")}update(n,t){const e=n.element,l=n.name,[o,...i]=t,r=()=>{let n=e,t=n._component;for(;!t&&n;)n=n.parentElement,t=n&&n._component;return console.assert(!!t,"Component not found."),t};return"string"==typeof o?e[`on${l}`]=n=>{const t=r();t?t.run(o,...i,n):s.run(o,...i,n)}:"function"==typeof o&&(e[`on${l}`]=n=>r().setState(o(r().state,...i,n))),this.render()}render(){return pt}});if(s.createElement=ln,s.render=function(n,t,e){t&&("string"==typeof t?(n._$litPart$||n.replaceChildren(),Et(ht`${zt(t)}`,n)):t._$litType$?(n._$litPart$||n.replaceChildren(),Et(t,n)):(on(n,t,e),n._$litPart$=void 0))},s.Fragment=Q,"object"==typeof window){const n=window;It=n,Ht={React:n._React||s,html:ht,svg:dt,run:Bt},"object"==typeof It&&null!==It&&Object.keys(Ht).forEach((n=>{It[n]=Ht[n]}))}var It,Ht;const Nt=(n,t,e,l)=>{if(!t||!e)return;const o=n=>{var e,l;const o=t.cloneNode();null===(e=t.parentNode)||void 0===e||e.replaceChild(o,t);const i=null===(l=(t=o).contentWindow)||void 0===l?void 0:l.document;i&&(i.open(),n.indexOf("<html")>=0?i.write(n):i.write((n=>`<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <meta http-equiv="X-UA-Compatible" content="ie=edge">\n <script src="https://cdnjs.cloudflare.com/ajax/libs/custom-elements/1.1.2/custom-elements.min.js"><\/script>\n <title>AppRun Playground</title>\n <style>\n body {\n font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;\n margin: 2em;\n }\n </style>\n <script src="https://unpkg.com/@babel/standalone/babel.min.js"><\/script>\n <script src="https://unpkg.com/apprun/dist/apprun-html.js"><\/script>\n</head>\n<body>\n<script>\n Babel.registerPlugin("d", [Babel.availablePlugins["proposal-decorators"], {legacy: true}]);\n Babel.registerPlugin("c", [Babel.availablePlugins["proposal-class-properties"], {loose: true}]);\n Babel.registerPlugin("b", [Babel.availablePlugins["proposal-private-methods"], {loose: true}]);\n<\/script>\n<script type="text/babel" data-plugins="d, c, b">\n ${n}\n<\/script>\n</body>\n</html>`)(n)),i.close())};o(e),!l&&n&&"TEXTAREA"===n.nodeName&&("undefined"==typeof CodeMirror?n.onkeyup=()=>o(n.value):n.editor||(n.editor=CodeMirror.fromTextArea(n,{lineNumbers:!0,mode:"jsx"}),n.editor.on("change",(n=>o(n.getValue())))))};s.webComponent("apprun-play",class extends vn{constructor(){super(...arguments),this.view=n=>{const t=n["code-element"],e=this.element;let l,o;return l=t?document.querySelector(t):e.previousElementSibling||e.parentElement.previousElementSibling,o=(null==l?void 0:l.innerText)||(null==l?void 0:l.value)||n.code,this.state.code_area=l,this.state.code=o,o?`<div class="toolbox">\n ${!n.hide_button&&'<a class="button" onclick="app.run("@show-popup")" >Try the Code</a>'}\n </div>`:"<div>AppRun Play cannot find code to run, please set code-element selector.</div>"},this.rendered=({style:n,hide_src:t,code_area:e,code:l})=>{if(!l)return;if(!document.getElementById("play-popup")){document.body.insertAdjacentHTML("beforeend",'<div id="play-popup" class="overlay">\n<style id="apprun-play-style">\n.apprun-play .col {\n height: 100%;\n flex: 1;\n}\n.apprun-preview {\n width: 100%\n}\n.apprun-play .editor, .apprun-play .preview {\n display: inline-block;\n width: calc(100% - 20px);\n height: calc(100% - 10px);\n}\n\na.button {\n font-size: .8em;\n padding: 10px;\n cursor: pointer;\n color: var(--md-primary-bg-color);\n background: var(--md-primary-fg-color)\n}\na.button:hover {\n color: var(--md-primary-fg-color);\n background: var(--md-primary-bg-color)\n}\n\n.overlay {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.7);\n visibility: hidden;\n opacity: 0;\n z-index: 999;\n}\n.overlay.show {\n visibility: visible;\n opacity: 1;\n}\n\n.popup {\n margin: 80px auto;\n padding: 20px;\n background: #fff;\n border-radius: 3px;\n position: relative;\n width: 90%;\n height: calc(100% - 150px);\n}\n\n.popup .close {\n position: absolute;\n top: 10px;\n right: 20px;\n font-size: 20px;\n font-weight: bold;\n text-decoration: none;\n color: #333;\n}\n.popup .close:hover {\n color: #06D85F;\n}\n.popup .content {\n height: 100%;\n overflow: hidden;\n display: flex;\n}\n\n.cm-s-default {\n height: 100%;\n font-size: small;\n line-height: 1.5em;\n z-index: 0;\n}\n</style>\n\n\t<div class="popup apprun-play">\n\t\t<a class="close" href="javascript:app.run(\'@close-popup\')">&times;</a>\n\t\t<div class="content">\n\t\t\t<div class="col">\n <textarea class="editor"></textarea>\n </div>\n <div class="col">\n <iframe class="preview"/>\n </div>\n </div>\n\t</div>\n</div>');const n=document.querySelector(".apprun-play .editor"),t=document.querySelector(".apprun-play .preview");n.value=l,Nt(n,t,l,!1)}const o=document.createElement("iframe");o.classList.add("apprun-preview"),o.style.cssText=n,this.element.before(o),t&&(e.style.display="none"),Nt(e,o,l,t)},this.update={"@show-popup":({code:n})=>{var t;null===(t=document.querySelector(".apprun-play .editor").editor)||void 0===t||t.setValue(n),document.getElementById("play-popup").classList.add("show")},"@close-popup":()=>{document.getElementById("play-popup").classList.remove("show")}}}});
34
34
  //# sourceMappingURL=apprun-play-html.esm.js.map