apprun 3.33.9 → 3.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/.clinerules +1 -0
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/WHATSNEW.md +106 -0
  5. package/apprun.d.ts +7 -1
  6. package/dist/apprun-dev-tools.js +1 -1
  7. package/dist/apprun-dev-tools.js.map +1 -1
  8. package/dist/apprun-html.esm.js +21 -4
  9. package/dist/apprun-html.esm.js.map +1 -1
  10. package/dist/apprun-html.js +1 -1
  11. package/dist/apprun-html.js.LICENSE.txt +6 -0
  12. package/dist/apprun-html.js.map +1 -1
  13. package/dist/apprun-play-html.esm.js +21 -4
  14. package/dist/apprun-play-html.esm.js.map +1 -1
  15. package/dist/apprun-play.js +1 -1
  16. package/dist/apprun-play.js.map +1 -1
  17. package/dist/apprun.esm.js +1 -1
  18. package/dist/apprun.esm.js.map +1 -1
  19. package/dist/apprun.js +1 -1
  20. package/dist/apprun.js.map +1 -1
  21. package/esm/app.js +38 -10
  22. package/esm/app.js.map +1 -1
  23. package/esm/apprun-code.js.map +1 -1
  24. package/esm/apprun-dev-tools-tests.js.map +1 -1
  25. package/esm/apprun-dev-tools.js.map +1 -1
  26. package/esm/apprun-html.js.map +1 -1
  27. package/esm/apprun-play.js.map +1 -1
  28. package/esm/apprun.js +65 -9
  29. package/esm/apprun.js.map +1 -1
  30. package/esm/component.js +59 -1
  31. package/esm/component.js.map +1 -1
  32. package/esm/decorator.js +33 -0
  33. package/esm/decorator.js.map +1 -1
  34. package/esm/directive.js +31 -0
  35. package/esm/directive.js.map +1 -1
  36. package/esm/router.js +27 -0
  37. package/esm/router.js.map +1 -1
  38. package/esm/types.js +28 -0
  39. package/esm/types.js.map +1 -1
  40. package/esm/vdom-lit-html.js +19 -17
  41. package/esm/vdom-lit-html.js.map +1 -1
  42. package/esm/vdom-my.js.map +1 -1
  43. package/esm/vdom-patch.js.map +1 -1
  44. package/esm/vdom-to-html.js.map +1 -1
  45. package/esm/vdom.js +24 -0
  46. package/esm/vdom.js.map +1 -1
  47. package/esm/web-component.js +32 -0
  48. package/esm/web-component.js.map +1 -1
  49. package/index.html +3 -2
  50. package/jest.config.js +63 -0
  51. package/jest.setup.js +47 -0
  52. package/jsx-runtime.js +1 -1
  53. package/jsx-runtime.js.map +1 -1
  54. package/package.json +16 -43
  55. package/react.js +0 -15
  56. package/rollup.config.js +27 -10
  57. package/src/app.ts +64 -30
  58. package/src/apprun.ts +94 -13
  59. package/src/component.ts +57 -1
  60. package/src/decorator.ts +34 -1
  61. package/src/directive.ts +33 -1
  62. package/src/global.d.ts +22 -0
  63. package/src/router.ts +28 -2
  64. package/src/types/apprun.d.ts +56 -0
  65. package/src/types.ts +30 -1
  66. package/src/vdom-lit-html.ts +21 -19
  67. package/src/vdom.ts +25 -2
  68. package/src/web-component.ts +33 -0
  69. package/tsconfig.jest.json +27 -3
  70. package/tsconfig.json +3 -3
  71. package/webpack.config.cjs +9 -2
@@ -1,17 +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:n,options:e}=s;return e.delay?this.delay(t,n,i,e):Object.keys(e).length>0?n.apply(this,[...i,e]):n.apply(this,i),!s.options.once})),s.length}once(t,i,s={}){this.on(t,i,Object.assign(Object.assign({},s),{once:!0}))}delay(t,i,s,n){n._t&&clearTimeout(n._t),n._t=setTimeout((()=>{clearTimeout(n._t),Object.keys(n).length>0?i.apply(this,[...s,n]):i.apply(this,s)}),n.delay)}runAsync(t,...i){const s=this.getSubscribers(t,this._events);console.assert(s&&s.length>0,"No subscriber for event: "+t);const n=s.map((t=>{const{fn:s,options:n}=t;return Object.keys(n).length>0?s.apply(this,[...i,n]):s.apply(this,i)}));return Promise.all(n)}query(t,...i){return this.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((n=>s.push(...i[n].map((i=>Object.assign(Object.assign({},i),{options:Object.assign(Object.assign({},i.options),{event:t})})))))),s}}let i;const s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;s.app&&s._AppRunVersions?i=s.app:(i=new t,s.app=i,s._AppRunVersions="AppRun-3");var n=i;const e=(t,i)=>(i?t.state[i]:t.state)||"",o=(t,i,s)=>{if(i){const n=t.state||{};n[i]=s,t.setState(n)}else t.setState(s)},r=(t,i)=>{if(Array.isArray(t))return t.map((t=>r(t,i)));{let{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):n.run(t,i);else if("string"==typeof s)i[t]=t=>r.run?r.run(s,t):n.run(s,t);else if("function"==typeof s)i[t]=t=>r.setState(s(r.state,t));else if(Array.isArray(s)){const[e,...o]=s;"string"==typeof e?i[t]=t=>r.run?r.run(e,...o,t):n.run(e,...o,t):"function"==typeof e&&(i[t]=t=>r.setState(e(r.state,...o,t)))}}else if("$bind"===t){const n=i.type||"text",h="string"==typeof i[t]?i[t]:i.name;if("input"===s)switch(n){case"checkbox":i.checked=e(r,h),i.onclick=t=>o(r,h||t.target.name,t.target.checked);break;case"radio":i.checked=e(r,h)===i.value,i.onclick=t=>o(r,h||t.target.name,t.target.value);break;case"number":case"range":i.value=e(r,h),i.oninput=t=>o(r,h||t.target.name,Number(t.target.value));break;default:i.value=e(r,h),i.oninput=t=>o(r,h||t.target.name,t.target.value)}else"select"===s?(i.value=e(r,h),i.onchange=t=>{t.target.multiple||o(r,h||t.target.name,t.target.value)}):"option"===s?(i.selected=e(r,h),i.onclick=t=>o(r,h||t.target.name,t.target.selected)):"textarea"===s&&(i.innerHTML=e(r,h),i.oninput=t=>o(r,h||t.target.name,t.target.value))}else n.run("$",{key:t,tag:s,props:i,component:r})})(t,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 u(t,i,...s){const n=l(s);if("string"==typeof t)return{tag:t,props:i,children:n};if(Array.isArray(t))return t;if(void 0===t&&s)return n;if(Object.getPrototypeOf(t).t)return{tag:t,props:i,children:n};if("function"==typeof t)return t(i,n);throw new Error(`Unknown tag in vdom ${t}`)}const d=new WeakMap,f=(t,i,s={})=>{if(null==i||!1===i)return;!function(t,i,s={}){if(null==i||!1===i)return;if(i=w(i,s),!t)return;const n="SVG"===t.nodeName;Array.isArray(i)?v(t,i,n):v(t,[i],n)}("string"==typeof t&&t?document.getElementById(t)||document.querySelector(t):t,i=r(i,s),s)};function a(t,i,s){3!==i._op&&(s=s||"svg"===i.tag,!function(t,i){const s=t.nodeName,n=`${i.tag||""}`;return s.toUpperCase()===n.toUpperCase()}(t,i)?t.parentNode.replaceChild(g(i,s),t):(!(2&i._op)&&v(t,i.children,s),!(1&i._op)&&b(t,i.props,s)))}function v(t,i,s){var n,e;const o=(null===(n=t.childNodes)||void 0===n?void 0:n.length)||0,r=(null==i?void 0:i.length)||0,h=Math.min(o,r);for(let n=0;n<h;n++){const e=i[n];if(3===e._op)continue;const o=t.childNodes[n];if("string"==typeof e)o.textContent!==e&&(3===o.nodeType?o.nodeValue=e:t.replaceChild(y(e),o));else if(e instanceof HTMLElement||e instanceof SVGElement)t.insertBefore(e,o);else{const i=e.props&&e.props.key;if(i)if(o.key===i)a(t.childNodes[n],e,s);else{const r=d[i];if(r){const i=r.nextSibling;t.insertBefore(r,o),i?t.insertBefore(o,i):t.appendChild(o),a(t.childNodes[n],e,s)}else t.replaceChild(g(e,s),o)}else a(t.childNodes[n],e,s)}}let c=(null===(e=t.childNodes)||void 0===e?void 0:e.length)||0;for(;c>h;)t.removeChild(t.lastChild),c--;if(r>h){const n=document.createDocumentFragment();for(let t=h;t<i.length;t++)n.appendChild(g(i[t],s));t.appendChild(n)}}const p=t=>{const i=document.createElement("section");return i.insertAdjacentHTML("afterbegin",t),Array.from(i.children)};function y(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const i=document.createElement("div");return i.insertAdjacentHTML("afterbegin",t.substring(6)),i}return document.createTextNode(null!=t?t:"")}function g(t,i){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return y(t);if(!t.tag||"function"==typeof t.tag)return y(JSON.stringify(t));const s=(i=i||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return b(s,t.props,i),t.children&&t.children.forEach((t=>s.appendChild(g(t,i)))),s}function b(t,i,s){const n=t[c]||{};i=function(t,i){i.class=i.class||i.className,delete i.className;const s={};return t&&Object.keys(t).forEach((t=>s[t]=null)),i&&Object.keys(i).forEach((t=>s[t]=i[t])),s}(n,i||{}),t[c]=i;for(const n in i){const e=i[n];if(n.startsWith("data-")){const i=n.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[i]!==e&&(e||""===e?t.dataset[i]=e:delete t.dataset[i])}else if("style"===n)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof e)t.style.cssText=e;else for(const i in e)t.style[i]!==e[i]&&(t.style[i]=e[i]);else if(n.startsWith("xlink")){const i=n.replace("xlink","").toLowerCase();null==e||!1===e?t.removeAttributeNS("http://www.w3.org/1999/xlink",i):t.setAttributeNS("http://www.w3.org/1999/xlink",i,e)}else n.startsWith("on")?e&&"function"!=typeof e?"string"==typeof e&&(e?t.setAttribute(n,e):t.removeAttribute(n)):t[n]=e:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-|^for$/g.test(n)||s?t.getAttribute(n)!==e&&(e?t.setAttribute(n,e):t.removeAttribute(n)):t[n]!==e&&(t[n]=e);"key"===n&&e&&(d[e]=t)}i&&"function"==typeof i.ref&&window.requestAnimationFrame((()=>i.ref(t)))}function w(t,i,s=0){var n;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>w(t,i,s++)));let e=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).t&&(e=function(t,i,s){const{tag:n,props:e,children:o}=t;let r=`_${s}`,h=e&&e.id;h?r=h:h=`_${s}${Date.now()}`;let c="section";e&&e.as&&(c=e.as,delete e.as),i.i||(i.i={});let l=i.i[r];if(l&&l instanceof n&&l.element)l.renderState(l.state);else{const t=document.createElement(c);l=i.i[r]=new n(Object.assign(Object.assign({},e),{children:o})).mount(t,{render:!0})}if(l.mounted){const t=l.mounted(e,o,l.state);void 0!==t&&l.setState(t)}return b(l.element,e,!1),l.element}(t,i,s)),e&&Array.isArray(e.children)){const t=null===(n=e.props)||void 0===n?void 0:n._component;if(t){let i=0;e.children=e.children.map((s=>w(s,t,i++)))}else e.children=e.children.map((t=>w(t,i,s++)))}return e}const m=(t,i={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(i.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const s=i||{};this._shadowRoot=s.shadow?this.attachShadow({mode:"open"}):this;const n=s.observedAttributes||[],e=n.reduce(((t,i)=>{const s=i.toLowerCase();return s!==i&&(t[s]=i),t}),{});this._attrMap=t=>e[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),n.forEach((t=>{void 0!==this[t]&&(o[t]=this[t]),Object.defineProperty(this,t,{get:()=>o[t],set(i){this.attributeChangedCallback(t,o[t],i)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const i=this.children?Array.from(this.children):[];if(this._component=new t(Object.assign(Object.assign({},o),{children:i})).mount(this._shadowRoot,s),this._component._props=o,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const t=this._component.mounted(o,i,this._component.state);void 0!==t&&(this._component.state=t)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==s.render&&this._component.run(".")}))}}disconnectedCallback(){var t,i,s,n;null===(i=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===i||i.call(t),null===(n=null===(s=this._component)||void 0===s?void 0:s.unmount)||void 0===n||n.call(s),this._component=null}attributeChangedCallback(t,s,n){if(this._component){const e=this._attrMap(t);this._component._props[e]=n,this._component.run("attributeChanged",e,s,n),n!==s&&!1!==i.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var $=(t,i,s)=>{"undefined"!=typeof customElements&&customElements.define(t,m(i,s))};const j={meta:new WeakMap,defineMetadata(t,i,s){this.meta.has(s)||this.meta.set(s,{}),this.meta.get(s)[t]=i},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,i){return i=Object.getPrototypeOf(i),this.meta.get(i)?this.meta.get(i)[t]:null}};function A(t,i={}){return(s,n,e)=>{const o=t?t.toString():n;return j.defineMetadata(`apprun-update:${o}`,{name:o,key:n,options:i},s),e}}function O(t,i={}){return function(s,n){const e=t?t.toString():n;j.defineMetadata(`apprun-update:${e}`,{name:e,key:n,options:i},s)}}function _(t,i){return function(s){return $(t,s,i),s}}const x=new Map;n.find("get-components")||n.on("get-components",(t=>t.components=x));const k=t=>t;class M{renderState(t,i=null){if(!this.view)return;let s=i||this.view(t);if(n.debug&&n.run("debug",{component:this,_:s?".":"-",state:t,vdom:s,el:this.element}),"object"!=typeof document)return;const e="string"==typeof this.element&&this.element?document.getElementById(this.element)||document.querySelector(this.element):this.element;if(!e)return;const o="_c";this.unload?e._component===this&&e.getAttribute(o)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),e.setAttribute(o,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(e)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[o]}))):e.removeAttribute&&e.removeAttribute(o),e._component=this,!i&&s&&(s=r(s,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>n.render(e,s,this))):n.render(e,s,this)),this.rendered&&this.rendered(this.state)}setState(t,i={render:!0,history:!1}){if(t instanceof Promise)Promise.resolve(t).then((s=>{this.setState(s,i),this._state=t}));else{if(this._state=t,null==t)return;this.state=t,!1!==i.render&&(i.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(t))):this.renderState(t)),!1!==i.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof i.callback&&i.callback(this.state)}}constructor(i,s,n,e){this.state=i,this.view=s,this.update=n,this.options=e,this._app=new t,this._actions=[],this._global_events=[],this._history=[],this._history_idx=-1,this._history_prev=()=>{this._history_idx--,this._history_idx>=0?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=0},this._history_next=()=>{this._history_idx++,this._history_idx<this._history.length?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=this._history.length-1},this.start=(t=null,i)=>{if(this.mount(t,Object.assign({render:!0},i)),this.mounted&&"function"==typeof this.mounted){const t=this.mounted({},[],this.state);void 0!==t&&this.setState(t)}return this}}mount(t=null,i){var s,e;return console.assert(!this.element,"Component already mounted."),this.options=i=Object.assign(Object.assign({},this.options),i),this.element=t,this.global_event=i.global_event,this.enable_history=!!i.history,this.enable_history&&(this.on(i.history.prev||"history-prev",this._history_prev),this.on(i.history.next||"history-next",this._history_next)),i.route&&(this.update=this.update||{},this.update[i.route]||(this.update[i.route]=k)),this.add_actions(),this.state=null!==(e=null!==(s=this.state)&&void 0!==s?s:this.model)&&void 0!==e?e:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!i.render,history:!0}),n.debug&&(x.get(t)?x.get(t).push(this):x.set(t,[this])),this}is_global_event(t){return t&&(this.global_event||this._global_events.indexOf(t)>=0||t.startsWith("#")||t.startsWith("/")||t.startsWith("@"))}add_action(t,i,s={}){i&&"function"==typeof i&&(s.global&&this._global_events.push(t),this.on(t,((...e)=>{n.debug&&n.run("debug",{component:this,_:">",event:t,p:e,current_state:this.state,options:s});const o=i(this.state,...e);n.debug&&n.run("debug",{component:this,_:"<",event:t,p:e,newState:o,state:this.state,options:s}),this.setState(o,s)}),s))}add_actions(){const t=this.update||{};j.getMetadataKeys(this).forEach((i=>{if(i.startsWith("apprun-update:")){const s=j.getMetadata(i,this);t[s.name]=[this[s.key].bind(this),s.options]}}));const i={};Array.isArray(t)?t.forEach((t=>{const[s,n,e]=t;s.toString().split(",").forEach((t=>i[t.trim()]=[n,e]))})):Object.keys(t).forEach((s=>{const n=t[s];("function"==typeof n||Array.isArray(n))&&s.split(",").forEach((t=>i[t.trim()]=n))})),i["."]||(i["."]=k),Object.keys(i).forEach((t=>{const s=i[t];"function"==typeof s?this.add_action(t,s):Array.isArray(s)&&this.add_action(t,s[0],s[1])}))}run(t,...i){if(this.state instanceof Promise)return Promise.resolve(this.state).then((s=>{this.state=s,this.run(t,...i)}));{const s=t.toString();return this.is_global_event(s)?n.run(s,...i):this._app.run(s,...i)}}on(t,i,s){const e=t.toString();return this._actions.push({name:e,fn:i}),this.is_global_event(e)?n.on(e,i,s):this._app.on(e,i,s)}runAsync(t,...i){const s=t.toString();return this.is_global_event(s)?n.runAsync(s,...i):this._app.runAsync(s,...i)}query(t,...i){return this.runAsync(t,...i)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:i,fn:s}=t;this.is_global_event(i)?n.off(i,s):this._app.off(i,s)}))}}M.t=!0;const E="//",T="///",S=t=>{if(t||(t="#"),t.startsWith("#")){const[i,...s]=t.split("/");n.run(i,...s)||n.run(T,i,...s),n.run(E,i,...s)}else if(t.startsWith("/")){const[i,s,...e]=t.split("/");n.run("/"+s,...e)||n.run(T,"/"+s,...e),n.run(E,"/"+s,...e)}else n.run(t)||n.run(T,t),n.run(E,t)};if(!n.start){n.h=n.createElement=u,n.render=f,n.Fragment=h,n.webComponent=$,n.safeHTML=p,n.start=(t,i,s,n,e)=>{const o=Object.assign({render:!0,global_event:!0},e),r=new M(i,s,n);return e&&e.rendered&&(r.rendered=e.rendered),e&&e.mounted&&(r.mounted=e.mounted),r.start(t,o),r};const t=t=>{};n.on("$",t),n.on("debug",(i=>t)),n.on(E,t),n.on("#",t),n.route=S,n.on("route",(t=>n.route&&n.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{n.route===S&&(window.onpopstate=()=>S(location.hash),document.body.hasAttribute("apprun-no-init")||n["no-init-route"]||S(location.hash))})),"object"==typeof window&&(window.Component=M,window._React=window.React,window.React=n,window.on=O,window.customElement=_,window.safeHTML=p),n.use_render=(t,i=0)=>n.render=0===i?(i,s)=>t(s,i):(i,s)=>t(i,s),n.use_react=(t,i)=>{n.h=n.createElement=t.createElement,n.Fragment=t.Fragment,n.render=(t,s)=>i.render(s,t),t.version&&t.version.startsWith("18")&&(n.render=(t,s)=>{t&&s&&(t._root||(t._root=i.createRoot(t)),t._root.render(s))})}}
1
+ class t{constructor(){this._events={}}on(t,s,i={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:s,options:i})}off(t,s){const i=this._events[t]||[];this._events[t]=i.filter((t=>t.fn!==s))}find(t){return this._events[t]}run(t,...s){const i=this.getSubscribers(t,this._events);return console.assert(i&&i.length>0,"No subscriber for event: "+t),i.forEach((i=>{const{fn:e,options:n}=i;return n.delay?this.delay(t,e,s,n):Object.keys(n).length>0?e.apply(this,[...s,n]):e.apply(this,s),!i.options.once})),i.length}once(t,s,i={}){this.on(t,s,Object.assign(Object.assign({},i),{once:!0}))}delay(t,s,i,e){e._t&&clearTimeout(e._t),e._t=setTimeout((()=>{clearTimeout(e._t),Object.keys(e).length>0?s.apply(this,[...i,e]):s.apply(this,i)}),e.delay)}runAsync(t,...s){const i=this.getSubscribers(t,this._events);console.assert(i&&i.length>0,"No subscriber for event: "+t);const e=i.map((t=>{const{fn:i,options:e}=t;return Object.keys(e).length>0?i.apply(this,[...s,e]):i.apply(this,s)}));return Promise.all(e)}query(t,...s){return this.runAsync(t,...s)}getSubscribers(t,s){const i=s[t]||[];return s[t]=i.filter((t=>!t.options.once)),Object.keys(s).filter((s=>s.endsWith("*")&&t.startsWith(s.replace("*","")))).sort(((t,s)=>s.length-t.length)).forEach((e=>i.push(...s[e].map((s=>Object.assign(Object.assign({},s),{options:Object.assign(Object.assign({},s.options),{event:t})})))))),i}}let s;const i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};i.app&&i._AppRunVersions?s=i.app:(s=new t,i.app=s,i._AppRunVersions="AppRun-3.3.11");var e=s;const n=(t,s)=>(s?t.state[s]:t.state)||"",o=(t,s,i)=>{if(s){const e=t.state||{};e[s]=i,t.setState(e)}else t.setState(i)},r=(t,s)=>{if(Array.isArray(t))return t.map((t=>r(t,s)));{let{type:i,tag:h,props:c,children:l}=t;return h=h||i,l=l||(null==c?void 0:c.children),c&&Object.keys(c).forEach((t=>{t.startsWith("$")&&(((t,s,i,r)=>{if(t.startsWith("$on")){const i=s[t];if(t=t.substring(1),"boolean"==typeof i)s[t]=s=>r.run?r.run(t,s):e.run(t,s);else if("string"==typeof i)s[t]=t=>r.run?r.run(i,t):e.run(i,t);else if("function"==typeof i)s[t]=t=>r.setState(i(r.state,t));else if(Array.isArray(i)){const[n,...o]=i;"string"==typeof n?s[t]=t=>r.run?r.run(n,...o,t):e.run(n,...o,t):"function"==typeof n&&(s[t]=t=>r.setState(n(r.state,...o,t)))}}else if("$bind"===t){const e=s.type||"text",h="string"==typeof s[t]?s[t]:s.name;if("input"===i)switch(e){case"checkbox":s.checked=n(r,h),s.onclick=t=>o(r,h||t.target.name,t.target.checked);break;case"radio":s.checked=n(r,h)===s.value,s.onclick=t=>o(r,h||t.target.name,t.target.value);break;case"number":case"range":s.value=n(r,h),s.oninput=t=>o(r,h||t.target.name,Number(t.target.value));break;default:s.value=n(r,h),s.oninput=t=>o(r,h||t.target.name,t.target.value)}else"select"===i?(s.value=n(r,h),s.onchange=t=>{t.target.multiple||o(r,h||t.target.name,t.target.value)}):"option"===i?(s.selected=n(r,h),s.onclick=t=>o(r,h||t.target.name,t.target.selected)):"textarea"===i&&(s.innerHTML=n(r,h),s.oninput=t=>o(r,h||t.target.name,t.target.value))}else e.run("$",{key:t,tag:i,props:s,component:r})})(t,c,h,s),delete c[t])})),l&&r(l,s),t}};function h(t,...s){return l(s)}const c="_props";function l(t){const s=[],i=t=>{null!=t&&""!==t&&!1!==t&&s.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>i(t))):i(t)})),s}function u(t,s,...i){const e=l(i);if("string"==typeof t)return{tag:t,props:s,children:e};if(Array.isArray(t))return t;if(void 0===t&&i)return e;if(Object.getPrototypeOf(t).i)return{tag:t,props:s,children:e};if("function"==typeof t)return t(s,e);throw new Error(`Unknown tag in vdom ${t}`)}const a=new WeakMap,f=(t,s,i={})=>{if(null==s||!1===s)return;!function(t,s,i={}){if(null==s||!1===s)return;if(s=m(s,i),!t)return;const e="SVG"===t.nodeName;Array.isArray(s)?p(t,s,e):p(t,[s],e)}("string"==typeof t&&t?document.getElementById(t)||document.querySelector(t):t,s=r(s,i),i)};function d(t,s,i){3!==s._op&&(i=i||"svg"===s.tag,!function(t,s){const i=t.nodeName,e=`${s.tag||""}`;return i.toUpperCase()===e.toUpperCase()}(t,s)?t.parentNode.replaceChild(b(s,i),t):(!(2&s._op)&&p(t,s.children,i),!(1&s._op)&&w(t,s.props,i)))}function p(t,s,i){var e,n;const o=(null===(e=t.childNodes)||void 0===e?void 0:e.length)||0,r=(null==s?void 0:s.length)||0,h=Math.min(o,r);for(let e=0;e<h;e++){const n=s[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 s=n.props&&n.props.key;if(s)if(o.key===s)d(t.childNodes[e],n,i);else{const r=a[s];if(r){const s=r.nextSibling;t.insertBefore(r,o),s?t.insertBefore(o,s):t.appendChild(o),d(t.childNodes[e],n,i)}else t.replaceChild(b(n,i),o)}else d(t.childNodes[e],n,i)}}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<s.length;t++)e.appendChild(b(s[t],i));t.appendChild(e)}}const y=t=>{const s=document.createElement("section");return s.insertAdjacentHTML("afterbegin",t),Array.from(s.children)};function v(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const s=document.createElement("div");return s.insertAdjacentHTML("afterbegin",t.substring(6)),s}return document.createTextNode(null!=t?t:"")}function b(t,s){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 i=(s=s||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return w(i,t.props,s),t.children&&t.children.forEach((t=>i.appendChild(b(t,s)))),i}function w(t,s,i){const e=t[c]||{};s=function(t,s){s.class=s.class||s.className,delete s.className;const i={};return t&&Object.keys(t).forEach((t=>i[t]=null)),Object.keys(s).forEach((t=>i[t]=s[t])),i}(e,s||{}),t[c]=s;for(const e in s){const n=s[e];if(e.startsWith("data-")){const s=e.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[s]!==n&&(n||""===n?t.dataset[s]=n:delete t.dataset[s])}else if("style"===e)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof n)t.style.cssText=n;else for(const s in n)t.style[s]!==n[s]&&(t.style[s]=n[s]);else if(e.startsWith("xlink")){const s=e.replace("xlink","").toLowerCase();null==n||!1===n?t.removeAttributeNS("http://www.w3.org/1999/xlink",s):t.setAttributeNS("http://www.w3.org/1999/xlink",s,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)||i?t.getAttribute(e)!==n&&(n?t.setAttribute(e,n):t.removeAttribute(e)):t[e]!==n&&(t[e]=n);"key"===e&&n&&(a[n]=t)}s&&"function"==typeof s.ref&&window.requestAnimationFrame((()=>s.ref(t)))}function m(t,s,i=0){var e;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>m(t,s,i++)));let n=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).i&&(n=function(t,s,i){const{tag:e,props:n,children:o}=t;let r=`_${i}`,h=n&&n.id;h?r=h:h=`_${i}${Date.now()}`;let c="section";n&&n.as&&(c=n.as,delete n.as),s.v||(s.v={});let l=s.v[r];if(l&&l instanceof e&&l.element)l.renderState(l.state);else{const t=document.createElement(c);l=s.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 w(l.element,n,!1),l.element}(t,s,i)),n&&Array.isArray(n.children)){const t=null===(e=n.props)||void 0===e?void 0:e._component;if(t){let s=0;n.children=n.children.map((i=>m(i,t,s++)))}else n.children=n.children.map((t=>m(t,s,i++)))}return n}const g=(t,s={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(s.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const i=s||{};this._shadowRoot=i.shadow?this.attachShadow({mode:"open"}):this;const e=i.observedAttributes||[],n=e.reduce(((t,s)=>{const i=s.toLowerCase();return i!==s&&(t[i]=s),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(s){this.attributeChangedCallback(t,o[t],s)},configurable:!0,enumerable:!0})})),requestAnimationFrame((()=>{const s=this.children?Array.from(this.children):[];if(this._component=new t(Object.assign(Object.assign({},o),{children:s})).mount(this._shadowRoot,i),this._component._props=o,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const t=this._component.mounted(o,s,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!==i.render&&this._component.run(".")}))}}disconnectedCallback(){var t,s,i,e;null===(s=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===s||s.call(t),null===(e=null===(i=this._component)||void 0===i?void 0:i.unmount)||void 0===e||e.call(i),this._component=null}attributeChangedCallback(t,i,e){if(this._component){const n=this._attrMap(t);this._component._props[n]=e,this._component.run("attributeChanged",n,i,e),e!==i&&!1!==s.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var $=(t,s,i)=>{"undefined"!=typeof customElements&&customElements.define(t,g(s,i))};const S={meta:new WeakMap,defineMetadata(t,s,i){this.meta.has(i)||this.meta.set(i,{}),this.meta.get(i)[t]=s},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,s){return s=Object.getPrototypeOf(s),this.meta.get(s)?this.meta.get(s)[t]:null}};function O(t,s={}){return(i,e,n)=>{const o=t?t.toString():e;return S.defineMetadata(`apprun-update:${o}`,{name:o,key:e,options:s},i),n}}function A(t,s={}){return function(i,e){const n=t?t.toString():e;S.defineMetadata(`apprun-update:${n}`,{name:n,key:e,options:s},i)}}function _(t,s){return function(i){return $(t,i,s),i}}const j=new Map;e.find("get-components")||e.on("get-components",(t=>t.components=j));const k=t=>t;class E{renderState(t,s=null){if(!this.view)return;let i=s||this.view(t);if(e.debug&&e.run("debug",{component:this,_:i?".":"-",state:t,vdom:i,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,!s&&i&&(i=r(i,this),this.options.transition&&document&&document.startViewTransition?document.startViewTransition((()=>e.render(n,i,this))):e.render(n,i,this)),this.rendered&&this.rendered(this.state)}setState(t,s={render:!0,history:!1}){const i=async t=>{try{for(;;){const{value:i,done:e}=await t.next();if(e)break;this.setState(i,s)}}catch(t){console.error("Error in async iterator:",t)}},e=t;if(null==e?void 0:e[Symbol.asyncIterator])this.setState(i(e[Symbol.asyncIterator]()),s);else if((null==e?void 0:e[Symbol.iterator])&&"function"==typeof e.next)for(const t of e)this.setState(t,s);else if(t&&t instanceof Promise)Promise.resolve(t).then((i=>{this.setState(i,s),this._state=t}));else{if(this._state=t,null==t)return;this.state=t,!1!==s.render&&(s.transition&&document&&document.startViewTransition?document.startViewTransition((()=>this.renderState(t))):this.renderState(t)),!1!==s.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof s.callback&&s.callback(this.state)}}constructor(s,i,e,n){this.state=s,this.view=i,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,s)=>{if(this.mount(t,Object.assign({render:!0},s)),this.mounted&&"function"==typeof this.mounted){const t=this.mounted({},[],this.state);void 0!==t&&this.setState(t)}return this}}mount(t=null,s){var i,n;return console.assert(!this.element,"Component already mounted."),this.options=s=Object.assign(Object.assign({},this.options),s),this.element=t,this.global_event=s.global_event,this.enable_history=!!s.history,this.enable_history&&(this.on(s.history.prev||"history-prev",this._history_prev),this.on(s.history.next||"history-next",this._history_next)),s.route&&(this.update=this.update||{},this.update[s.route]||(this.update[s.route]=k)),this.add_actions(),this.state=null!==(n=null!==(i=this.state)&&void 0!==i?i:this.model)&&void 0!==n?n:{},"function"==typeof this.state&&(this.state=this.state()),this.setState(this.state,{render:!!s.render,history:!0}),e.debug&&(j.get(t)?j.get(t).push(this):j.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,s,i={}){s&&"function"==typeof s&&(i.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:i});const o=s(this.state,...n);e.debug&&e.run("debug",{component:this,_:"<",event:t,p:n,newState:o,state:this.state,options:i}),this.setState(o,i)}),i))}add_actions(){const t=this.update||{};S.getMetadataKeys(this).forEach((s=>{if(s.startsWith("apprun-update:")){const i=S.getMetadata(s,this);t[i.name]=[this[i.key].bind(this),i.options]}}));const s={};Array.isArray(t)?t.forEach((t=>{const[i,e,n]=t;i.toString().split(",").forEach((t=>s[t.trim()]=[e,n]))})):Object.keys(t).forEach((i=>{const e=t[i];("function"==typeof e||Array.isArray(e))&&i.split(",").forEach((t=>s[t.trim()]=e))})),s["."]||(s["."]=k),Object.keys(s).forEach((t=>{const i=s[t];"function"==typeof i?this.add_action(t,i):Array.isArray(i)&&this.add_action(t,i[0],i[1])}))}run(t,...s){if(this.state instanceof Promise)return Promise.resolve(this.state).then((i=>{this.state=i,this.run(t,...s)}));{const i=t.toString();return this.is_global_event(i)?e.run(i,...s):this._app.run(i,...s)}}on(t,s,i){const n=t.toString();return this._actions.push({name:n,fn:s}),this.is_global_event(n)?e.on(n,s,i):this._app.on(n,s,i)}runAsync(t,...s){const i=t.toString();return this.is_global_event(i)?e.runAsync(i,...s):this._app.runAsync(i,...s)}query(t,...s){return this.runAsync(t,...s)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:s,fn:i}=t;this.is_global_event(s)?e.off(s,i):this._app.off(s,i)}))}}E.i=!0;const M="//",C="///",x=t=>{if(e.lastUrl!==t)if(e.lastUrl=t,t||(t="#"),t.startsWith("#")){const[s,...i]=t.split("/");e.run(s,...i)||e.run(C,s,...i),e.run(M,s,...i)}else if(t.startsWith("/")){const[s,i,...n]=t.split("/");e.run("/"+i,...n)||e.run(C,"/"+i,...n),e.run(M,"/"+i,...n)}else e.run(t)||e.run(C,t),e.run(M,t)};if(!e.start){e.version="3.35.0",e.h=e.createElement=u,e.render=f,e.Fragment=h,e.webComponent=$,e.safeHTML=y,e.start=(t,s,i,e,n)=>{const o=Object.assign({render:!0,global_event:!0},n),r=new E(s,i,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",(s=>t)),e.on(M,t),e.on(C,t),e.route=x,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,s=e.find("#")||e.find("#/")||!1;window.addEventListener("hashchange",(()=>x(location.hash))),window.addEventListener("popstate",(()=>x(location.pathname))),s?t&&x(location.hash):(t&&x(location.pathname),document.body.addEventListener("click",(t=>{const s=t.target,i="A"===s.tagName?s:s.closest("a");i&&i.origin===location.origin&&(t.preventDefault(),history.pushState(null,"",i.pathname),x(i.pathname))})))})),"object"==typeof window&&(window.Component=E,window._React=window.React,window.React=e,window.on=A,window.customElement=_,window.safeHTML=y),e.use_render=(t,s=0)=>{e.render=0===s?(s,i)=>t(i,s):(s,i)=>t(s,i)},e.use_react=(t,s)=>{e.h=e.createElement=t.createElement,e.Fragment=t.Fragment,e.render=(t,i)=>s.render(i,t),t.version&&t.version.startsWith("18")&&(e.render=(t,i)=>{t&&i&&(t._root||(t._root=s.createRoot(t)),t._root.render(i))})}}
2
+ /**
3
+ * @license
4
+ * Copyright 2019 Google LLC
5
+ * SPDX-License-Identifier: BSD-3-Clause
6
+ */const T=globalThis,P=T.ShadowRoot&&(void 0===T.ShadyCSS||T.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,U=Symbol(),N=new WeakMap;let L=class{constructor(t,s,i){if(this._$cssResult$=!0,i!==U)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o;const s=this.t;if(P&&void 0===t){const i=void 0!==s&&1===s.length;i&&(t=N.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&N.set(s,t))}return t}toString(){return this.cssText}};const R=P?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let s="";for(const i of t.cssRules)s+=i.cssText;return(t=>new L("string"==typeof t?t:t+"",void 0,U))(s)})(t):t
7
+ /**
8
+ * @license
9
+ * Copyright 2017 Google LLC
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */,{is:D,defineProperty:z,getOwnPropertyDescriptor:H,getOwnPropertyNames:I,getOwnPropertySymbols:W,getPrototypeOf:q}=Object,V=globalThis,G=V.trustedTypes,J=G?G.emptyScript:"",B=V.reactiveElementPolyfillSupport,F=(t,s)=>t,K={toAttribute(t,s){switch(s){case Boolean:t=t?J:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},Z=(t,s)=>!D(t,s),Q={attribute:!0,type:String,converter:K,reflect:!1,useDefault:!1,hasChanged:Z};Symbol.metadata??=Symbol("metadata"),V.litPropertyMetadata??=new WeakMap;let X=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,s=Q){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),e=this.getPropertyDescriptor(t,i,s);void 0!==e&&z(this.prototype,t,e)}}static getPropertyDescriptor(t,s,i){const{get:e,set:n}=H(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get:e,set(s){const o=e?.call(this);n?.call(this,s),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Q}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;const t=q(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,s=[...I(t),...W(t)];for(const i of s)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const s=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)s.unshift(R(t))}else void 0!==t&&s.push(R(t));return s}static _$Eu(t,s){const i=s.attribute;return!1===i?void 0:"string"==typeof i?i:"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,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,s)=>{if(P)t.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of s){const s=document.createElement("style"),e=T.litNonce;void 0!==e&&s.setAttribute("nonce",e),s.textContent=i.cssText,t.appendChild(s)}})(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,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:K).toAttribute(s,i.type);this._$Em=t,null==n?this.removeAttribute(e):this.setAttribute(e,n),this._$Em=null}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:K;this._$Em=e,this[e]=n.fromAttribute(s,t.type)??this._$Ej?.get(e)??null,this._$Em=null}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,n=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??Z)(n,s)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:e,wrapped:n},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??s??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!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,s]of this._$Ep)this[t]=s;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(s)}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){}};X.elementStyles=[],X.shadowRootOptions={mode:"open"},X[F("elementProperties")]=new Map,X[F("finalized")]=new Map,B?.({ReactiveElement:X}),(V.reactiveElementVersions??=[]).push("2.1.0");
12
+ /**
13
+ * @license
14
+ * Copyright 2017 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ */
17
+ const Y=globalThis,tt=Y.trustedTypes,st=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,it="$lit$",et=`lit$${Math.random().toFixed(9).slice(2)}$`,nt="?"+et,ot=`<${nt}>`,rt=document,ht=()=>rt.createComment(""),ct=t=>null===t||"object"!=typeof t&&"function"!=typeof t,lt=Array.isArray,ut="[ \t\n\f\r]",at=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ft=/-->/g,dt=/>/g,pt=RegExp(`>|${ut}(?:([^\\s"'>=/]+)(${ut}*=${ut}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),yt=/'/g,vt=/"/g,bt=/^(?:script|style|textarea|title)$/i,wt=t=>(s,...i)=>({_$litType$:t,strings:s,values:i}),mt=wt(1),gt=wt(2),$t=Symbol.for("lit-noChange"),St=Symbol.for("lit-nothing"),Ot=new WeakMap,At=rt.createTreeWalker(rt,129);function _t(t,s){if(!lt(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==st?st.createHTML(s):s}const jt=(t,s)=>{const i=t.length-1,e=[];let n,o=2===s?"<svg>":3===s?"<math>":"",r=at;for(let s=0;s<i;s++){const i=t[s];let h,c,l=-1,u=0;for(;u<i.length&&(r.lastIndex=u,c=r.exec(i),null!==c);)u=r.lastIndex,r===at?"!--"===c[1]?r=ft:void 0!==c[1]?r=dt:void 0!==c[2]?(bt.test(c[2])&&(n=RegExp("</"+c[2],"g")),r=pt):void 0!==c[3]&&(r=pt):r===pt?">"===c[0]?(r=n??at,l=-1):void 0===c[1]?l=-2:(l=r.lastIndex-c[2].length,h=c[1],r=void 0===c[3]?pt:'"'===c[3]?vt:yt):r===vt||r===yt?r=pt:r===ft||r===dt?r=at:(r=pt,n=void 0);const a=r===pt&&t[s+1].startsWith("/>")?" ":"";o+=r===at?i+ot:l>=0?(e.push(h),i.slice(0,l)+it+i.slice(l)+et+a):i+et+(-2===l?s:a)}return[_t(t,o+(t[i]||"<?>")+(2===s?"</svg>":3===s?"</math>":"")),e]};class kt{constructor({strings:t,_$litType$:s},i){let e;this.parts=[];let n=0,o=0;const r=t.length-1,h=this.parts,[c,l]=jt(t,s);if(this.el=kt.createElement(c,i),At.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(e=At.nextNode())&&h.length<r;){if(1===e.nodeType){if(e.hasAttributes())for(const t of e.getAttributeNames())if(t.endsWith(it)){const s=l[o++],i=e.getAttribute(t).split(et),r=/([.?@])?(.*)/.exec(s);h.push({type:1,index:n,name:r[2],strings:i,ctor:"."===r[1]?Tt:"?"===r[1]?Pt:"@"===r[1]?Ut:xt}),e.removeAttribute(t)}else t.startsWith(et)&&(h.push({type:6,index:n}),e.removeAttribute(t));if(bt.test(e.tagName)){const t=e.textContent.split(et),s=t.length-1;if(s>0){e.textContent=tt?tt.emptyScript:"";for(let i=0;i<s;i++)e.append(t[i],ht()),At.nextNode(),h.push({type:2,index:++n});e.append(t[s],ht())}}}else if(8===e.nodeType)if(e.data===nt)h.push({type:2,index:n});else{let t=-1;for(;-1!==(t=e.data.indexOf(et,t+1));)h.push({type:7,index:n}),t+=et.length-1}n++}}static createElement(t,s){const i=rt.createElement("template");return i.innerHTML=t,i}}function Et(t,s,i=t,e){if(s===$t)return s;let n=void 0!==e?i._$Co?.[e]:i._$Cl;const o=ct(s)?void 0:s._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,i,e)),void 0!==e?(i._$Co??=[])[e]=n:i._$Cl=n),void 0!==n&&(s=Et(t,n._$AS(t,s.values),n,e)),s}class Mt{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:s},parts:i}=this._$AD,e=(t?.creationScope??rt).importNode(s,!0);At.currentNode=e;let n=At.nextNode(),o=0,r=0,h=i[0];for(;void 0!==h;){if(o===h.index){let s;2===h.type?s=new Ct(n,n.nextSibling,this,t):1===h.type?s=new h.ctor(n,h.name,h.strings,this,t):6===h.type&&(s=new Nt(n,this,t)),this._$AV.push(s),h=i[++r]}o!==h?.index&&(n=At.nextNode(),o++)}return At.currentNode=rt,e}p(t){let s=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,s),s+=i.strings.length-2):i._$AI(t[s])),s++}}class Ct{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,s,i,e){this.type=2,this._$AH=St,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const s=this._$AM;return void 0!==s&&11===t?.nodeType&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=Et(this,t,s),ct(t)?t===St||null==t||""===t?(this._$AH!==St&&this._$AR(),this._$AH=St):t!==this._$AH&&t!==$t&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>lt(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!==St&&ct(this._$AH)?this._$AA.nextSibling.data=t:this.T(rt.createTextNode(t)),this._$AH=t}$(t){const{values:s,_$litType$:i}=t,e="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=kt.createElement(_t(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===e)this._$AH.p(s);else{const t=new Mt(e,this),i=t.u(this.options);t.p(s),this.T(i),this._$AH=t}}_$AC(t){let s=Ot.get(t.strings);return void 0===s&&Ot.set(t.strings,s=new kt(t)),s}k(t){lt(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,e=0;for(const n of t)e===s.length?s.push(i=new Ct(this.O(ht()),this.O(ht()),this,this.options)):i=s[e],i._$AI(n),e++;e<s.length&&(this._$AR(i&&i._$AB.nextSibling,e),s.length=e)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class xt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,s,i,e,n){this.type=1,this._$AH=St,this._$AN=void 0,this.element=t,this.name=s,this._$AM=e,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=St}_$AI(t,s=this,i,e){const n=this.strings;let o=!1;if(void 0===n)t=Et(this,t,s,0),o=!ct(t)||t!==this._$AH&&t!==$t,o&&(this._$AH=t);else{const e=t;let r,h;for(t=n[0],r=0;r<n.length-1;r++)h=Et(this,e[i+r],s,r),h===$t&&(h=this._$AH[r]),o||=!ct(h)||h!==this._$AH[r],h===St?t=St:t!==St&&(t+=(h??"")+n[r+1]),this._$AH[r]=h}o&&!e&&this.j(t)}j(t){t===St?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Tt extends xt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===St?void 0:t}}class Pt extends xt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==St)}}class Ut extends xt{constructor(t,s,i,e,n){super(t,s,i,e,n),this.type=5}_$AI(t,s=this){if((t=Et(this,t,s,0)??St)===$t)return;const i=this._$AH,e=t===St&&i!==St||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==St&&(i===St||e);e&&this.element.removeEventListener(this.name,this,i),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 Nt{constructor(t,s,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}}const Lt=Y.litHtmlPolyfillSupport;Lt?.(kt,Ct),(Y.litHtmlVersions??=[]).push("3.3.0");const Rt=(t,s,i)=>{const e=i?.renderBefore??s;let n=e._$litPart$;if(void 0===n){const t=i?.renderBefore??null;e._$litPart$=n=new Ct(s.insertBefore(ht(),t),t,void 0,i??{})}return n._$AI(t),n
2
18
  /**
3
19
  * @license
4
20
  * Copyright 2017 Google LLC
5
21
  * SPDX-License-Identifier: BSD-3-Clause
6
- */var C;const N=window,L=N.trustedTypes,U=L?L.createPolicy("lit-html",{createHTML:t=>t}):void 0,H="$lit$",P=`lit$${(Math.random()+"").slice(9)}$`,D="?"+P,I=`<${D}>`,R=document,V=()=>R.createComment(""),q=t=>null===t||"object"!=typeof t&&"function"!=typeof t,G=Array.isArray,W="[ \t\n\f\r]",z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,Z=/>/g,J=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),K=/'/g,B=/"/g,Q=/^(?:script|style|textarea|title)$/i,X=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),Y=X(1),tt=X(2),it=Symbol.for("lit-noChange"),st=Symbol.for("lit-nothing"),nt=new WeakMap,et=R.createTreeWalker(R,129,null,!1);function ot(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==U?U.createHTML(i):i}const rt=(t,i)=>{const s=t.length-1,n=[];let e,o=2===i?"<svg>":"",r=z;for(let i=0;i<s;i++){const s=t[i];let h,c,l=-1,u=0;for(;u<s.length&&(r.lastIndex=u,c=r.exec(s),null!==c);)u=r.lastIndex,r===z?"!--"===c[1]?r=F:void 0!==c[1]?r=Z:void 0!==c[2]?(Q.test(c[2])&&(e=RegExp("</"+c[2],"g")),r=J):void 0!==c[3]&&(r=J):r===J?">"===c[0]?(r=null!=e?e:z,l=-1):void 0===c[1]?l=-2:(l=r.lastIndex-c[2].length,h=c[1],r=void 0===c[3]?J:'"'===c[3]?B:K):r===B||r===K?r=J:r===F||r===Z?r=z:(r=J,e=void 0);const d=r===J&&t[i+1].startsWith("/>")?" ":"";o+=r===z?s+I:l>=0?(n.push(h),s.slice(0,l)+H+s.slice(l)+P+d):s+P+(-2===l?(n.push(void 0),i):d)}return[ot(t,o+(t[s]||"<?>")+(2===i?"</svg>":"")),n]};class ht{constructor({strings:t,_$litType$:i},s){let n;this.parts=[];let e=0,o=0;const r=t.length-1,h=this.parts,[c,l]=rt(t,i);if(this.el=ht.createElement(c,s),et.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(n=et.nextNode())&&h.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const i of n.getAttributeNames())if(i.endsWith(H)||i.startsWith(P)){const s=l[o++];if(t.push(i),void 0!==s){const t=n.getAttribute(s.toLowerCase()+H).split(P),i=/([.?@])?(.*)/.exec(s);h.push({type:1,index:e,name:i[2],strings:t,ctor:"."===i[1]?ft:"?"===i[1]?vt:"@"===i[1]?pt:dt})}else h.push({type:6,index:e})}for(const i of t)n.removeAttribute(i)}if(Q.test(n.tagName)){const t=n.textContent.split(P),i=t.length-1;if(i>0){n.textContent=L?L.emptyScript:"";for(let s=0;s<i;s++)n.append(t[s],V()),et.nextNode(),h.push({type:2,index:++e});n.append(t[i],V())}}}else if(8===n.nodeType)if(n.data===D)h.push({type:2,index:e});else{let t=-1;for(;-1!==(t=n.data.indexOf(P,t+1));)h.push({type:7,index:e}),t+=P.length-1}e++}}static createElement(t,i){const s=R.createElement("template");return s.innerHTML=t,s}}function ct(t,i,s=t,n){var e,o,r,h;if(i===it)return i;let c=void 0!==n?null===(e=s._$Co)||void 0===e?void 0:e[n]:s._$Cl;const l=q(i)?void 0:i._$litDirective$;return(null==c?void 0:c.constructor)!==l&&(null===(o=null==c?void 0:c._$AO)||void 0===o||o.call(c,!1),void 0===l?c=void 0:(c=new l(t),c._$AT(t,s,n)),void 0!==n?(null!==(r=(h=s)._$Co)&&void 0!==r?r:h._$Co=[])[n]=c:s._$Cl=c),void 0!==c&&(i=ct(t,c._$AS(t,i.values),c,n)),i}class lt{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){var i;const{el:{content:s},parts:n}=this._$AD,e=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:R).importNode(s,!0);et.currentNode=e;let o=et.nextNode(),r=0,h=0,c=n[0];for(;void 0!==c;){if(r===c.index){let i;2===c.type?i=new ut(o,o.nextSibling,this,t):1===c.type?i=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(i=new yt(o,this,t)),this._$AV.push(i),c=n[++h]}r!==(null==c?void 0:c.index)&&(o=et.nextNode(),r++)}return et.currentNode=R,e}v(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 ut{constructor(t,i,s,n){var e;this.type=2,this._$AH=st,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=n,this._$Cp=null===(e=null==n?void 0:n.isConnected)||void 0===e||e}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=ct(this,t,i),q(t)?t===st||null==t||""===t?(this._$AH!==st&&this._$AR(),this._$AH=st):t!==this._$AH&&t!==it&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>G(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==st&&q(this._$AH)?this._$AA.nextSibling.data=t:this.$(R.createTextNode(t)),this._$AH=t}g(t){var i;const{values:s,_$litType$:n}=t,e="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=ht.createElement(ot(n.h,n.h[0]),this.options)),n);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===e)this._$AH.v(s);else{const t=new lt(e,this),i=t.u(this.options);t.v(s),this.$(i),this._$AH=t}}_$AC(t){let i=nt.get(t.strings);return void 0===i&&nt.set(t.strings,i=new ht(t)),i}T(t){G(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,n=0;for(const e of t)n===i.length?i.push(s=new ut(this.k(V()),this.k(V()),this,this.options)):s=i[n],s._$AI(e),n++;n<i.length&&(this._$AR(s&&s._$AB.nextSibling,n),i.length=n)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class dt{constructor(t,i,s,n,e){this.type=1,this._$AH=st,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=e,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=st}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,n){const e=this.strings;let o=!1;if(void 0===e)t=ct(this,t,i,0),o=!q(t)||t!==this._$AH&&t!==it,o&&(this._$AH=t);else{const n=t;let r,h;for(t=e[0],r=0;r<e.length-1;r++)h=ct(this,n[s+r],i,r),h===it&&(h=this._$AH[r]),o||(o=!q(h)||h!==this._$AH[r]),h===st?t=st:t!==st&&(t+=(null!=h?h:"")+e[r+1]),this._$AH[r]=h}o&&!n&&this.j(t)}j(t){t===st?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class ft extends dt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===st?void 0:t}}const at=L?L.emptyScript:"";class vt extends dt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==st?this.element.setAttribute(this.name,at):this.element.removeAttribute(this.name)}}class pt extends dt{constructor(t,i,s,n,e){super(t,i,s,n,e),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=ct(this,t,i,0))&&void 0!==s?s:st)===it)return;const n=this._$AH,e=t===st&&n!==st||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==st&&(n===st||e);e&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class yt{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){ct(this,t)}}const gt=N.litHtmlPolyfillSupport;null==gt||gt(ht,ut),(null!==(C=N.litHtmlVersions)&&void 0!==C?C:N.litHtmlVersions=[]).push("2.8.0");const bt=(t,i,s)=>{var n,e;const o=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:i;let r=o._$litPart$;if(void 0===r){const t=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:null;o._$litPart$=r=new ut(i.insertBefore(V(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r
22
+ */},Dt=globalThis;let zt=class extends X{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 s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Rt(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return $t}};zt._$litElement$=!0,zt.finalized=!0,Dt.litElementHydrateSupport?.({LitElement:zt});const Ht=Dt.litElementPolyfillSupport;Ht?.({LitElement:zt}),(Dt.litElementVersions??=[]).push("4.2.0");
7
23
  /**
8
24
  * @license
9
25
  * Copyright 2017 Google LLC
10
26
  * SPDX-License-Identifier: BSD-3-Clause
11
- */},wt=2,mt=5,$t=t=>(...i)=>({_$litDirective$:t,values:i});class jt{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)}}
27
+ */
28
+ const It=2,Wt=5,qt=t=>(...s)=>({_$litDirective$:t,values:s});class Vt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,s,i){this._$Ct=t,this._$AM=s,this._$Ci=i}_$AS(t,s){return this.update(t,s)}update(t,s){return this.render(...s)}}
12
29
  /**
13
30
  * @license
14
31
  * Copyright 2017 Google LLC
15
32
  * SPDX-License-Identifier: BSD-3-Clause
16
- */class At extends jt{constructor(t){if(super(t),this.et=st,t.type!==wt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===st||null==t)return this.ft=void 0,this.et=t;if(t===it)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;const i=[t];return i.raw=i,this.ft={_$litType$:this.constructor.resultType,strings:i,values:[]}}}At.directiveName="unsafeHTML",At.resultType=1;const Ot=$t(At);function _t(t,i,s){i&&("string"==typeof i?(t._$litPart$||t.replaceChildren(),bt(Y`${Ot(i)}`,t)):i._$litType$?(t._$litPart$||t.replaceChildren(),bt(i,t)):(f(t,i,s),t._$litPart$=void 0))}const xt=$t(class extends jt{constructor(t){if(super(t),t.type!==mt)throw new Error("${run} can only be used in event handlers")}update(t,i){let{element:s,name:e}=t;const o=()=>{let t=s._component;for(;!t&&s;)s=s.parentElement,t=s&&s._component;return console.assert(!!t,"Component not found."),t},[r,...h]=i;return"string"==typeof r?s[`on${e}`]=t=>{const i=o();i?i.run(r,...h,t):n.run(r,...h,t)}:"function"==typeof r&&(s[`on${e}`]=t=>o().setState(r(o().state,...h,t))),this.render()}render(){return it}});n.createElement=u,n.render=_t,n.Fragment=h,"object"==typeof window&&(window.React=window._React||n,window.html=Y,window.svg=tt,window.run=xt);export{M as Component,T as ROUTER_404_EVENT,E as ROUTER_EVENT,n as app,_ as customElement,n as default,A as event,Y as html,O as on,_t as render,xt as run,p as safeHTML,tt as svg,A as update};
33
+ */class Gt extends Vt{constructor(t){if(super(t),this.it=St,t.type!==It)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===St||null==t)return this._t=void 0,this.it=t;if(t===$t)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 s=[t];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}Gt.directiveName="unsafeHTML",Gt.resultType=1;const Jt=qt(Gt);function Bt(t,s,i){s&&("string"==typeof s?(t._$litPart$||t.replaceChildren(),Rt(mt`${Jt(s)}`,t)):s._$litType$?(t._$litPart$||t.replaceChildren(),Rt(s,t)):(f(t,s,i),t._$litPart$=void 0))}const Ft=qt(class extends Vt{constructor(t){if(super(t),t.type!==Wt)throw new Error("run() can only be used in event handlers")}update(t,s){const i=t.element,n=t.name,[o,...r]=s,h=()=>{let t=i,s=t._component;for(;!s&&t;)t=t.parentElement,s=t&&t._component;return console.assert(!!s,"Component not found."),s};return"string"==typeof o?i[`on${n}`]=t=>{const s=h();s?s.run(o,...r,t):e.run(o,...r,t)}:"function"==typeof o&&(i[`on${n}`]=t=>h().setState(o(h().state,...r,t))),this.render()}render(){return $t}});e.createElement=u,e.render=Bt,e.Fragment=h,"object"==typeof window&&(window.React=window._React||e,window.html=mt,window.svg=gt,window.run=Ft);export{E as Component,C as ROUTER_404_EVENT,M as ROUTER_EVENT,e as app,_ as customElement,e as default,O as event,mt as html,A as on,Bt as render,Ft as run,y as safeHTML,gt as svg,O as update};
17
34
  //# sourceMappingURL=apprun-html.esm.js.map