@benev/tact 0.4.0-1 → 0.4.0-10

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 (122) hide show
  1. package/README.md +134 -46
  2. package/package.json +7 -6
  3. package/s/demo/main.css +38 -3
  4. package/s/index.html.ts +26 -20
  5. package/s/lib/index.ts +1 -1
  6. package/s/lib/input/controller.ts +4 -1
  7. package/s/lib/input/data/intent/decode.ts +2 -2
  8. package/s/lib/input/data/intent/encode.ts +2 -2
  9. package/s/lib/input/data/intent/minihash.ts +5 -0
  10. package/s/lib/input/decoder.ts +2 -2
  11. package/s/lib/input/evaluate/context.ts +5 -1
  12. package/s/lib/input/evaluate/evaluate.ts +27 -14
  13. package/s/lib/input/investigate/hash-bindings.ts +5 -3
  14. package/s/lib/input/investigate/investigate.ts +24 -9
  15. package/s/lib/input/test.ts +52 -30
  16. package/s/lib/input/testing/quickbind.ts +3 -3
  17. package/s/lib/ui/deck/auto-gamepads.ts +1 -0
  18. package/s/lib/ui/deck/controls/internal/data.ts +7 -5
  19. package/s/lib/ui/deck/hub.ts +4 -3
  20. package/s/lib/ui/deck/players.ts +73 -0
  21. package/s/lib/ui/deck/setup/deck.ts +33 -20
  22. package/s/lib/ui/deck/setup/tact.ts +26 -11
  23. package/s/lib/ui/deck/setup/types.ts +1 -0
  24. package/s/lib/ui/deck/setup/utils/broadcast-channel.ts +17 -0
  25. package/s/lib/ui/deck/setup/utils/kv.ts +20 -0
  26. package/s/lib/ui/deck/types.ts +1 -1
  27. package/s/lib/ui/views/controllers/style.css.ts +1 -1
  28. package/s/lib/ui/views/controllers/view.ts +3 -2
  29. package/s/lib/ui/views/customize/style.css.ts +1 -1
  30. package/s/lib/ui/views/customize/view.ts +6 -5
  31. package/s/lib/ui/views/deck/style.css.ts +1 -1
  32. package/s/lib/ui/views/deck/view.ts +13 -7
  33. package/s/lib/ui/views/theme.css.ts +1 -1
  34. package/s/lib/ui/views/visualizer/style.css.ts +8 -6
  35. package/s/lib/ui/views/visualizer/view.ts +1 -0
  36. package/s/lib/utils/hash.ts +47 -0
  37. package/x/demo/main.bundle.min.js +330 -326
  38. package/x/demo/main.bundle.min.js.map +4 -4
  39. package/x/demo/main.css +38 -3
  40. package/x/gamepad/index.html +2 -2
  41. package/x/gamepad/main.bundle.min.js +8 -8
  42. package/x/gamepad/main.bundle.min.js.map +4 -4
  43. package/x/index.html +28 -22
  44. package/x/index.html.js +26 -20
  45. package/x/index.html.js.map +1 -1
  46. package/x/lib/index.d.ts +1 -1
  47. package/x/lib/index.js +1 -1
  48. package/x/lib/index.js.map +1 -1
  49. package/x/lib/input/controller.js +1 -1
  50. package/x/lib/input/controller.js.map +1 -1
  51. package/x/lib/input/data/intent/decode.d.ts +1 -1
  52. package/x/lib/input/data/intent/decode.js +2 -2
  53. package/x/lib/input/data/intent/decode.js.map +1 -1
  54. package/x/lib/input/data/intent/encode.d.ts +1 -1
  55. package/x/lib/input/data/intent/encode.js +2 -2
  56. package/x/lib/input/data/intent/encode.js.map +1 -1
  57. package/x/lib/input/data/intent/minihash.d.ts +1 -0
  58. package/x/lib/input/data/intent/minihash.js +4 -0
  59. package/x/lib/input/data/intent/minihash.js.map +1 -0
  60. package/x/lib/input/decoder.d.ts +1 -1
  61. package/x/lib/input/decoder.js +2 -2
  62. package/x/lib/input/decoder.js.map +1 -1
  63. package/x/lib/input/evaluate/context.d.ts +3 -1
  64. package/x/lib/input/evaluate/context.js.map +1 -1
  65. package/x/lib/input/evaluate/evaluate.js +24 -11
  66. package/x/lib/input/evaluate/evaluate.js.map +1 -1
  67. package/x/lib/input/investigate/hash-bindings.d.ts +1 -1
  68. package/x/lib/input/investigate/hash-bindings.js +5 -3
  69. package/x/lib/input/investigate/hash-bindings.js.map +1 -1
  70. package/x/lib/input/investigate/investigate.d.ts +2 -1
  71. package/x/lib/input/investigate/investigate.js +14 -9
  72. package/x/lib/input/investigate/investigate.js.map +1 -1
  73. package/x/lib/input/test.d.ts +4 -2
  74. package/x/lib/input/test.js +49 -22
  75. package/x/lib/input/test.js.map +1 -1
  76. package/x/lib/input/testing/quickbind.d.ts +3 -2
  77. package/x/lib/input/testing/quickbind.js +3 -3
  78. package/x/lib/input/testing/quickbind.js.map +1 -1
  79. package/x/lib/ui/deck/auto-gamepads.js +1 -0
  80. package/x/lib/ui/deck/auto-gamepads.js.map +1 -1
  81. package/x/lib/ui/deck/controls/internal/data.d.ts +1 -1
  82. package/x/lib/ui/deck/controls/internal/data.js +4 -1
  83. package/x/lib/ui/deck/controls/internal/data.js.map +1 -1
  84. package/x/lib/ui/deck/hub.js +4 -3
  85. package/x/lib/ui/deck/hub.js.map +1 -1
  86. package/x/lib/ui/deck/players.d.ts +16 -0
  87. package/x/lib/ui/deck/players.js +56 -0
  88. package/x/lib/ui/deck/players.js.map +1 -0
  89. package/x/lib/ui/deck/setup/deck.js +23 -13
  90. package/x/lib/ui/deck/setup/deck.js.map +1 -1
  91. package/x/lib/ui/deck/setup/tact.d.ts +3 -0
  92. package/x/lib/ui/deck/setup/tact.js +19 -8
  93. package/x/lib/ui/deck/setup/tact.js.map +1 -1
  94. package/x/lib/ui/deck/setup/types.d.ts +1 -0
  95. package/x/lib/ui/deck/setup/utils/broadcast-channel.d.ts +4 -0
  96. package/x/lib/ui/deck/setup/utils/broadcast-channel.js +10 -0
  97. package/x/lib/ui/deck/setup/utils/broadcast-channel.js.map +1 -0
  98. package/x/lib/ui/deck/setup/utils/kv.d.ts +5 -0
  99. package/x/lib/ui/deck/setup/utils/kv.js +12 -0
  100. package/x/lib/ui/deck/setup/utils/kv.js.map +1 -0
  101. package/x/lib/ui/deck/types.d.ts +1 -0
  102. package/x/lib/ui/views/controllers/style.css.js +1 -1
  103. package/x/lib/ui/views/controllers/view.js +3 -2
  104. package/x/lib/ui/views/controllers/view.js.map +1 -1
  105. package/x/lib/ui/views/customize/style.css.js +1 -1
  106. package/x/lib/ui/views/customize/view.js +6 -5
  107. package/x/lib/ui/views/customize/view.js.map +1 -1
  108. package/x/lib/ui/views/deck/style.css.js +1 -1
  109. package/x/lib/ui/views/deck/view.js +13 -6
  110. package/x/lib/ui/views/deck/view.js.map +1 -1
  111. package/x/lib/ui/views/theme.css.js +1 -1
  112. package/x/lib/ui/views/visualizer/style.css.js +8 -6
  113. package/x/lib/ui/views/visualizer/style.css.js.map +1 -1
  114. package/x/lib/ui/views/visualizer/view.js +1 -0
  115. package/x/lib/ui/views/visualizer/view.js.map +1 -1
  116. package/x/lib/utils/hash.d.ts +1 -0
  117. package/x/lib/utils/hash.js +47 -0
  118. package/x/lib/utils/hash.js.map +1 -0
  119. package/s/lib/ui/deck/collector.ts +0 -52
  120. package/x/lib/ui/deck/collector.d.ts +0 -13
  121. package/x/lib/ui/deck/collector.js +0 -35
  122. package/x/lib/ui/deck/collector.js.map +0 -1
@@ -1,6 +1,6 @@
1
- var _s=Object.defineProperty;var Cs=(r,t)=>{for(var e in t)_s(r,e,{get:t[e],enumerable:!0})};function Pr(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function te(r,t={}){let{soft:e=!1,upgrade:o=!0}=t;for(let[s,n]of Object.entries(r)){let i=Pr(s),a=customElements.get(i);e&&a||(customElements.define(i,n),o&&document.querySelectorAll(i).forEach(c=>{c.constructor===HTMLElement&&customElements.upgrade(c)}))}}var ee=globalThis,re=ee.ShadowRoot&&(ee.ShadyCSS===void 0||ee.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,or=Symbol(),zr=new WeakMap,Bt=class{constructor(t,e,o){if(this._$cssResult$=!0,o!==or)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(re&&t===void 0){let o=e!==void 0&&e.length===1;o&&(t=zr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&zr.set(e,t))}return t}toString(){return this.cssText}},Or=r=>new Bt(typeof r=="string"?r:r+"",void 0,or),b=(r,...t)=>{let e=r.length===1?r[0]:t.reduce((o,s,n)=>o+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[n+1],r[0]);return new Bt(e,r,or)},oe=(r,t)=>{if(re)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let o=document.createElement("style"),s=ee.litNonce;s!==void 0&&o.setAttribute("nonce",s),o.textContent=e.cssText,r.appendChild(o)}},pt=re?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let o of t.cssRules)e+=o.cssText;return Or(e)})(r):r;var{is:Es,defineProperty:Ms,getOwnPropertyDescriptor:Ps,getOwnPropertyNames:zs,getOwnPropertySymbols:Os,getPrototypeOf:Ts}=Object,se=globalThis,Tr=se.trustedTypes,Bs=Tr?Tr.emptyScript:"",js=se.reactiveElementPolyfillSupport,jt=(r,t)=>r,sr={toAttribute(r,t){switch(t){case Boolean:r=r?Bs:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},jr=(r,t)=>!Es(r,t),Br={attribute:!0,type:String,converter:sr,reflect:!1,useDefault:!1,hasChanged:jr};Symbol.metadata??=Symbol("metadata"),se.litPropertyMetadata??=new WeakMap;var N=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,e=Br){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let o=Symbol(),s=this.getPropertyDescriptor(t,o,e);s!==void 0&&Ms(this.prototype,t,s)}}static getPropertyDescriptor(t,e,o){let{get:s,set:n}=Ps(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:s,set(i){let a=s?.call(this);n?.call(this,i),this.requestUpdate(t,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Br}static _$Ei(){if(this.hasOwnProperty(jt("elementProperties")))return;let t=Ts(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(jt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(jt("properties"))){let e=this.properties,o=[...zs(e),...Os(e)];for(let s of o)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[o,s]of e)this.elementProperties.set(o,s)}this._$Eh=new Map;for(let[e,o]of this.elementProperties){let s=this._$Eu(e,o);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let o=new Set(t.flat(1/0).reverse());for(let s of o)e.unshift(pt(s))}else t!==void 0&&e.push(pt(t));return e}static _$Eu(t,e){let o=e.attribute;return o===!1?void 0:typeof o=="string"?o:typeof t=="string"?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),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let o of e.keys())this.hasOwnProperty(o)&&(t.set(o,this[o]),delete this[o]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return oe(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,e,o){this._$AK(t,o)}_$ET(t,e){let o=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,o);if(s!==void 0&&o.reflect===!0){let n=(o.converter?.toAttribute!==void 0?o.converter:sr).toAttribute(e,o.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){let o=this.constructor,s=o._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let n=o.getPropertyOptions(s),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:sr;this._$Em=s;let a=i.fromAttribute(e,n.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,o,s=!1,n){if(t!==void 0){let i=this.constructor;if(s===!1&&(n=this[t]),o??=i.getPropertyOptions(t),!((o.hasChanged??jr)(n,e)||o.useDefault&&o.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,o))))return;this.C(t,e,o)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:o,reflect:s,wrapped:n},i){o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||o||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,n]of this._$Ep)this[s]=n;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[s,n]of o){let{wrapped:i}=n,a=this[s];i!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(o=>o.hostUpdate?.()),this.update(e)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.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(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[jt("elementProperties")]=new Map,N[jt("finalized")]=new Map,js?.({ReactiveElement:N}),(se.reactiveElementVersions??=[]).push("2.1.2");var ir=globalThis,Dr=r=>r,ne=ir.trustedTypes,Rr=ne?ne.createPolicy("lit-html",{createHTML:r=>r}):void 0,ar="$lit$",I=`lit$${Math.random().toFixed(9).slice(2)}$`,cr="?"+I,Ds=`<${cr}>`,tt=document,Rt=()=>tt.createComment(""),Lt=r=>r===null||typeof r!="object"&&typeof r!="function",lr=Array.isArray,Ur=r=>lr(r)||typeof r?.[Symbol.iterator]=="function",nr=`[
2
- \f\r]`,Dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lr=/-->/g,Nr=/>/g,X=RegExp(`>|${nr}(?:([^\\s"'>=/]+)(${nr}*=${nr}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ir=/'/g,Hr=/"/g,qr=/^(?:script|style|textarea|title)$/i,ur=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),h=ur(1),f=ur(2),On=ur(3),et=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),Vr=new WeakMap,Y=tt.createTreeWalker(tt,129);function Wr(r,t){if(!lr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Rr!==void 0?Rr.createHTML(t):t}var Fr=(r,t)=>{let e=r.length-1,o=[],s,n=t===2?"<svg>":t===3?"<math>":"",i=Dt;for(let a=0;a<e;a++){let c=r[a],l,p,u=-1,m=0;for(;m<c.length&&(i.lastIndex=m,p=i.exec(c),p!==null);)m=i.lastIndex,i===Dt?p[1]==="!--"?i=Lr:p[1]!==void 0?i=Nr:p[2]!==void 0?(qr.test(p[2])&&(s=RegExp("</"+p[2],"g")),i=X):p[3]!==void 0&&(i=X):i===X?p[0]===">"?(i=s??Dt,u=-1):p[1]===void 0?u=-2:(u=i.lastIndex-p[2].length,l=p[1],i=p[3]===void 0?X:p[3]==='"'?Hr:Ir):i===Hr||i===Ir?i=X:i===Lr||i===Nr?i=Dt:(i=X,s=void 0);let _=i===X&&r[a+1].startsWith("/>")?" ":"";n+=i===Dt?c+Ds:u>=0?(o.push(l),c.slice(0,u)+ar+c.slice(u)+I+_):c+I+(u===-2?a:_)}return[Wr(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),o]},Nt=class r{constructor({strings:t,_$litType$:e},o){let s;this.parts=[];let n=0,i=0,a=t.length-1,c=this.parts,[l,p]=Fr(t,e);if(this.el=r.createElement(l,o),Y.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(s=Y.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let u of s.getAttributeNames())if(u.endsWith(ar)){let m=p[i++],_=s.getAttribute(u).split(I),Q=/([.?@])?(.*)/.exec(m);c.push({type:1,index:n,name:Q[2],strings:_,ctor:Q[1]==="."?ae:Q[1]==="?"?ce:Q[1]==="@"?le:ot}),s.removeAttribute(u)}else u.startsWith(I)&&(c.push({type:6,index:n}),s.removeAttribute(u));if(qr.test(s.tagName)){let u=s.textContent.split(I),m=u.length-1;if(m>0){s.textContent=ne?ne.emptyScript:"";for(let _=0;_<m;_++)s.append(u[_],Rt()),Y.nextNode(),c.push({type:2,index:++n});s.append(u[m],Rt())}}}else if(s.nodeType===8)if(s.data===cr)c.push({type:2,index:n});else{let u=-1;for(;(u=s.data.indexOf(I,u+1))!==-1;)c.push({type:7,index:n}),u+=I.length-1}n++}}static createElement(t,e){let o=tt.createElement("template");return o.innerHTML=t,o}};function rt(r,t,e=r,o){if(t===et)return t;let s=o!==void 0?e._$Co?.[o]:e._$Cl,n=Lt(t)?void 0:t._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,e,o)),o!==void 0?(e._$Co??=[])[o]=s:e._$Cl=s),s!==void 0&&(t=rt(r,s._$AS(r,t.values),s,o)),t}var ie=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:o}=this._$AD,s=(t?.creationScope??tt).importNode(e,!0);Y.currentNode=s;let n=Y.nextNode(),i=0,a=0,c=o[0];for(;c!==void 0;){if(i===c.index){let l;c.type===2?l=new ht(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new ue(n,this,t)),this._$AV.push(l),c=o[++a]}i!==c?.index&&(n=Y.nextNode(),i++)}return Y.currentNode=tt,s}p(t){let e=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,e),e+=o.strings.length-2):o._$AI(t[e])),e++}},ht=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,o,s){this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=o,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=rt(this,t,e),Lt(t)?t===w||t==null||t===""?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==et&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ur(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!==w&&Lt(this._$AH)?this._$AA.nextSibling.data=t:this.T(tt.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:o}=t,s=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=Nt.createElement(Wr(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===s)this._$AH.p(e);else{let n=new ie(s,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Vr.get(t.strings);return e===void 0&&Vr.set(t.strings,e=new Nt(t)),e}k(t){lr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,o,s=0;for(let n of t)s===e.length?e.push(o=new r(this.O(Rt()),this.O(Rt()),this,this.options)):o=e[s],o._$AI(n),s++;s<e.length&&(this._$AR(o&&o._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let o=Dr(t).nextSibling;Dr(t).remove(),t=o}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ot=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,o,s,n){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=w}_$AI(t,e=this,o,s){let n=this.strings,i=!1;if(n===void 0)t=rt(this,t,e,0),i=!Lt(t)||t!==this._$AH&&t!==et,i&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=rt(this,a[o+c],e,c),l===et&&(l=this._$AH[c]),i||=!Lt(l)||l!==this._$AH[c],l===w?t=w:t!==w&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}i&&!s&&this.j(t)}j(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ae=class extends ot{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===w?void 0:t}},ce=class extends ot{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==w)}},le=class extends ot{constructor(t,e,o,s,n){super(t,e,o,s,n),this.type=5}_$AI(t,e=this){if((t=rt(this,t,e,0)??w)===et)return;let o=this._$AH,s=t===w&&o!==w||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==w&&(o===w||s);s&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ue=class{constructor(t,e,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){rt(this,t)}},Gr={M:ar,P:I,A:cr,C:1,L:Fr,R:ie,D:Ur,V:rt,I:ht,H:ot,N:ce,U:le,B:ae,F:ue},Rs=ir.litHtmlPolyfillSupport;Rs?.(Nt,ht),(ir.litHtmlVersions??=[]).push("3.3.3");var x=(r,t,e)=>{let o=e?.renderBefore??t,s=o._$litPart$;if(s===void 0){let n=e?.renderBefore??null;o._$litPart$=s=new ht(t.insertBefore(Rt(),n),n,void 0,e??{})}return s._$AI(r),s};var pr=globalThis,dt=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=x(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return et}};dt._$litElement$=!0,dt.finalized=!0,pr.litElementHydrateSupport?.({LitElement:dt});var Ls=pr.litElementPolyfillSupport;Ls?.({LitElement:dt});(pr.litElementVersions??=[]).push("4.2.2");var P={string:(r,t)=>r.getAttribute(t)??void 0,number:(r,t)=>{let e=r.getAttribute(t);return e===null||!e?void 0:Number(e)},boolean:(r,t)=>r.getAttribute(t)!==null},$={string:(r,t,e)=>(e===void 0?r.removeAttribute(t):r.setAttribute(t,e),!0),number:(r,t,e)=>(e===void 0?r.removeAttribute(t):r.setAttribute(t,e.toString()),!0),boolean:(r,t,e)=>(e?r.setAttribute(t,""):r.removeAttribute(t),!0),any:(r,t,e)=>{e==null?r.removeAttribute(t):typeof e=="string"?r.setAttribute(t,e):typeof e=="number"?r.setAttribute(t,e.toString()):typeof e=="boolean"?e===!0?r.setAttribute(t,""):r.removeAttribute(t):console.warn(`invalid attribute "${t}" type is "${typeof e}"`)},entries:(r,t)=>{for(let[e,o]of t)$.any(r,e,o)},record:(r,t)=>$.entries(r,Object.entries(t))};function Kr(r,t={}){let e=document.createElement(r);return $.record(e,t),e}function Jr(r){let t=document.createDocumentFragment();return x(r,t),t.firstElementChild}function pe(r,t){let e=[];for(let[o,s]of Object.entries(t))if(typeof s=="function")r.addEventListener(o,s),e.push(()=>r.removeEventListener(o,s));else{let[n,i]=s;r.addEventListener(o,i,n),e.push(()=>r.removeEventListener(o,i))}return()=>e.forEach(o=>o())}function Zr(r,t){let e=new MutationObserver(t);return e.observe(r,{attributes:!0}),()=>e.disconnect()}var he=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>P.string(this.element,e),set:(t,e,o)=>$.string(this.element,e,o)});numbers=new Proxy({},{get:(t,e)=>P.number(this.element,e),set:(t,e,o)=>$.number(this.element,e,o)});booleans=new Proxy({},{get:(t,e)=>P.boolean(this.element,e),set:(t,e,o)=>$.boolean(this.element,e,o)})};var Qr=(r,t,e={})=>new Proxy(t,{get:(o,s)=>{switch(t[s]){case String:return P.string(r,s);case Number:return P.number(r,s);case Boolean:return P.boolean(r,s);default:throw new Error(`invalid attribute type for "${s}"`)}},set:(o,s,n)=>{try{switch(e.beforeSet?.(s),t[s]){case String:return $.string(r,s,n);case Number:return $.number(r,s,n);case Boolean:return $.boolean(r,s,n);default:throw new Error(`invalid attribute type for "${s}"`)}}finally{e.afterSet?.(s)}}});function mt(r){let t=new he(r);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>Zr(r,e),spec:(e,o={})=>Qr(r,e,o)}}mt.get=P;mt.set=$;function Xr(r){return new hr(r)}var hr=class{tagName;#t=new Map;#e=[];constructor(t){this.tagName=t}attr(t,e=!0){return this.#t.set(t,e),this}attrs(t){for(let[e,o]of Object.entries(t))this.attr(e,o);return this}children(...t){return this.#e.push(...t),this}done(){let t=document.createElement(this.tagName);return $.entries(t,this.#t),t.append(...this.#e),t}};function ft(r,t=document){let e=t.querySelector(r);if(!e)throw new Error(`element not found (${r})`);return e}function de(r,t=document){return t.querySelector(r)}function me(r,t=document){return Array.from(t.querySelectorAll(r))}var fe=class r{element;#t;constructor(t){this.element=t}in(t){return new r(typeof t=="string"?ft(t,this.element):t)}require(t){return ft(t,this.element)}maybe(t){return de(t,this.element)}all(t){return me(t,this.element)}render(...t){return x(t,this.element)}get attrs(){return this.#t??=mt(this.element)}events(t){return pe(this.element,t)}};function g(r,t=document){return ft(r,t)}g.in=(r,t=document)=>new fe(t).in(r);g.need=ft;g.maybe=de;g.all=me;g.el=Kr;g.elmer=Xr;g.mk=Jr;g.events=pe;g.attrs=mt;g.register=te;g.render=(r,...t)=>x(t,r);var $e={};Cs($e,{DragAndDrops:()=>xr,Drops:()=>yr,files:()=>Gs,hasFiles:()=>Fs,outsideCurrentTarget:()=>qt});var Yr=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;let e=0;for(let o=0;o<r.length;o++)e|=r[o]^t[o];return e===0},random(r){return crypto.getRandomValues(new Uint8Array(r))},concat(r){let t=0;for(let s of r)t+=s.byteLength;let e=new Uint8Array(t),o=0;for(let s of r)e.set(s,o),o+=s.byteLength;return e}});var v=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef",caseInsensitive:!0},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(t){this.lexicon=t,this.lookup=Object.fromEntries([...t.characters].map((o,s)=>[o,s])),this.negativePrefix=t.negativePrefix??"-";let e=this.fromBytes.bind(this);return Object.setPrototypeOf(e,new.target.prototype),Object.assign(e,this),e}toBytes(t){this.lexicon.caseInsensitive&&(t=t.toLowerCase());let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let l=0,p=0,u=[];for(let m of t){if(m===this.lexicon.padding?.character)continue;let _=this.lookup[m];if(_===void 0)throw new Error(`Invalid character: ${m}`);for(l=l<<e|_,p+=e;p>=8;)p-=8,u.push(l>>p&255)}return new Uint8Array(u)}let o=0n,s=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length));let n=this.lexicon.characters[0],i=0;for(;t[i]===n;)i++;t=t.slice(i);for(let l of t){let p=this.lookup[l];if(p===void 0)throw new Error(`Invalid character: ${l}`);o=o*s+BigInt(p)}let a=new Uint8Array(i+(o===0n?0:this.countBytes(o))),c=a.length;for(;o>0n;)a[--c]=Number(o%256n),o=o/256n;return a}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let c=0,l=0,p="";for(let u of t)for(c=c<<8|u,l+=8;l>=e;){l-=e;let m=c>>l&(1<<e)-1;p+=this.lexicon.characters[m]}if(l>0){let u=c<<e-l&(1<<e)-1;p+=this.lexicon.characters[u]}if(this.lexicon.padding)for(;p.length%this.lexicon.padding.size!==0;)p+=this.lexicon.padding.character;return p}if(t.length===0)return"";let o=this.lexicon.characters[0],s=0;for(;t[s]===0;)s++;let n=0n;for(let c of t.slice(s))n=(n<<8n)+BigInt(c);if(n===0n)return o.repeat(s);let i=BigInt(this.lexicon.characters.length),a="";for(;n>0n;)a=this.lexicon.characters[Number(n%i)]+a,n=n/i;return o.repeat(s)+a}toInteger(t){if(!t)return 0;let e=0n,o=!1,s=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),o=!0);for(let n of t){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);e=e*s+BigInt(i)}return Number(o?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,o=BigInt(e?-t:t);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return e?`${this.negativePrefix}${n}`:n}random(t=32){return this.fromBytes(Yr.random(t))}countBytes(t){let e=0;for(;t>0n;)e++,t=t/256n;return e}};var ge=new v(v.lexicons.hex),Li=new v(v.lexicons.base2),Ni=new v(v.lexicons.base36),Ii=new v(v.lexicons.base58),Hi=new v(v.lexicons.base62),Vi=new v(v.lexicons.base64),Ui=new v(v.lexicons.base64url);function to(r,t){let e,o,s=[];function n(){e=[],o&&clearTimeout(o),o=void 0,s=[]}return n(),((...i)=>{e=i,o&&clearTimeout(o);let a=new Promise((c,l)=>{s.push({resolve:c,reject:l})});return o=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(c=>{for(let{resolve:l}of s)l(c);n()}).catch(c=>{for(let{reject:l}of s)l(c);n()})},r),a})}function st(){let r,t,e=new Promise((o,s)=>{r=o,t=s});return e.resolve=r,e.reject=t,e.promise=e,e.entangle=o=>(o.then(r,t),e),e}function gt(r){let t=null;return((...e)=>(t?t.params=e:(t={params:e,deferred:st()},queueMicrotask(()=>{let{params:o,deferred:s}=t;t=null,Promise.resolve(r(...o)).then(s.resolve).catch(s.reject)})),t.deferred.promise))}function z(r,t=new Set){if(t.has(r))throw new Error("cannot clone circular reference");let e;return typeof r=="function"||r!==null&&typeof r=="object"?(t.add(r),Array.isArray(r)?e=r.map(o=>z(o,new Set(t))):r.constructor===Object?e=Object.fromEntries(Object.entries(r).map(([o,s])=>[o,z(s,new Set(t))])):r instanceof Map?e=new Map(Array.from(r,([o,s])=>[o,z(s,new Set(t))])):r instanceof Set?e=new Set(Array.from(r,o=>z(o,new Set(t)))):r instanceof Date?e=new Date(r.getTime()):e=r,t.delete(r)):e=r,e}function C(r){return r!=null}var bt=r=>typeof r=="number",xt=r=>typeof r=="string";var It=r=>typeof r=="object"&&r!==null,be=r=>Array.isArray(r);function Ns(r){return r!=null}function Is(r){return r==null}var Zi=Object.freeze({happy:Ns,sad:Is,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});var eo=(r,t)=>{function e(o,s,n){if(!It(o)||!It(s))return o===s;if(n.includes(o))throw new Error("forbidden circularity detected in deep equal comparison");let i=[...n,o];if(o instanceof Map&&s instanceof Map){if(o.size!==s.size)return!1;for(let[a,c]of o)if(!s.has(a)||!e(c,s.get(a),i))return!1}else if(o instanceof Set&&s instanceof Set){if(o.size!==s.size)return!1;for(let a of o)if(!Array.from(s).some(c=>e(a,c,i)))return!1}else{let a=Object.keys(o),c=Object.keys(s);if(a.length!==c.length)return!1;for(let l of a)if(!c.includes(l)||!e(o[l],s[l],i))return!1}return!0}return e(r,t,[])};function nt(r){function t(e,o){if(!It(e)||o.includes(e))return e;let s=[...o,e];if(e instanceof Map)for(let n of e.entries())for(let i of n)t(i,s);else if(e instanceof Set)for(let n of e)t(n,s);else if(Array.isArray(e))for(let n of e)t(n,s);else for(let n of Object.values(e))t(n,s);return Object.freeze(e)}return t(r,[])}function ro(r){if(r.ok)return r.value;let{error:t}=r;throw t instanceof Error?t:typeof t=="string"?new Error(t):new Error("unknown")}function oo(r){if(r.ok)throw new Error("didn't get needed error");return r.error}var Hs=new TextEncoder;function dr(r){return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),r^=r>>>14,r>>>0}function Vs(r){let t=2166136261;for(let e of Hs.encode(r))t^=e,t=Math.imul(t,16777619);return dr(t)}function so(...r){let t=2654435769;for(let e of r){let o=typeof e=="string"?Vs(e):e>>>0;t=t+1831565813>>>0,t^=dr(o),t=dr(t)}return t}function k(r,t="got failed"){if(r==null)throw new Error(t);return r}function yt(r,t,e){if(r.has(t))return r.get(t);{let o=e();return r.set(t,o),o}}function Ht(r,t){for(let[e,o]of t)r.set(e,o);return r}function xe(r,t){return t<=0?[]:r.length>t?r.slice(-t):r}async function mr(r){let t=[];for await(let e of r)t.push(e);return t}function wt(r){let t,e=!1,o=()=>{e=!0,clearTimeout(t)},s=async()=>{e||(await r(o),!e&&(t=setTimeout(s,0)))};return s(),o}function V(){let r=[],t=()=>{let o=r;r=[];for(let s=o.length-1;s>=0;s--)o[s]()};function e(){t()}return e.dispose=t,e.schedule=(...o)=>(r.push(...o),e),e.own=(o,s)=>(r.push(()=>s(o)),o),e.disposable=o=>(r.push(()=>o.dispose()),o),e.disposables=e.disposable,e}function E(r,t){let e=Object.entries(t);for(let[o,s]of e)r.addEventListener(o,s);return()=>{for(let[o,s]of e)r.removeEventListener(o,s)}}var vt=class{count;constructor(t=0){this.count=t}next(){return this.count++}};var $t=(r=0)=>new Promise(t=>setTimeout(t,r));var fr=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,o])=>[e,t(o,e)])),Us=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,o])=>t(o,e)));function qs(r){return{map:t=>no(r,t),filter:t=>io(r,t)}}qs.pipe=Object.freeze({map:r=>(t=>no(t,r)),filter:r=>(t=>io(t,r))});var no=fr,io=Us;function U(r){let t=Ws(),e=o=>t.on(o);return Object.assign(e,t),r&&t.on(r),e}function Ws(){let r=new Set,t,e=()=>t??=st(),o=a=>{let c=t;t=void 0,c?.resolve(a)};return{set:r,on:a=>(r.add(a),()=>{r.delete(a)}),publish:(...a)=>{o(a);for(let c of[...r])c(...a)},publishAsync:async(...a)=>{o(a),await Promise.all([...r].map(async c=>c(...a)))},next:e}}function q(r,...t){let e=r.length-1;return r.slice(0,e).reduce((o,s,n)=>o+s+t[n],"")+r[e]}function kt(r,t,e){return r?t():e?.()}function ye(r,t,e){return C(r)?t(r):e?.()}var we=class{#t=new Set;#e=[];#o=new WeakMap;#r=0;#s=new Set;read(t){this.#e.at(-1)?.add(t)}write(t){let e=this.#o.get(t);if(e){for(let o of e)this.#s.add(o);this.#r===0&&this.#n()}}observe(t){let e=new Set;this.#e.push(e);try{let o=t();return{seen:e,value:o}}finally{this.#e.pop()}}subscribe(t,e){let o=yt(this.#o,t,()=>new Set);return o.add(e),()=>{o.delete(e),o.size===0&&this.#o.delete(t)}}batch=t=>{this.#r++;try{return t()}finally{this.#r--,this.#r===0&&this.#n()}};#i(t){if(this.#t.has(t))throw new Error("circularity forbidden");this.#t.add(t);try{t()}finally{this.#t.delete(t)}}#n(){for(;this.#s.size>0;){let t=[...this.#s];this.#s.clear();for(let e of t)this.#i(e)}}};var d=globalThis[Symbol.for("e280.tracker.2")]??=new we;function S(r){let t;function e(){return arguments.length===0?(d.read(e),r):(r=arguments[0],d.write(e),t?.publish(r),r)}return e.get=()=>e(),e.set=o=>e(o),e.on=o=>(t??=U())(o),e}var O=class extends Map{get size(){return d.read(this),super.size}[Symbol.iterator](){return d.read(this),super[Symbol.iterator]()}forEach(t){d.read(this);for(let[e,o]of this)t(o,e,this);return this}keys(){return d.read(this),super.keys()}values(){return d.read(this),super.values()}entries(){return d.read(this),super.entries()}has(t){return d.read(this),super.has(t)}get(t){return d.read(this),super.get(t)}set(t,e){return super.set(t,e),d.write(this),this}delete(t){let e=super.delete(t);return d.write(this),e}clear(){return super.clear(),d.write(this),this}};var Vt=class extends Set{get size(){return d.read(this),super.size}[Symbol.iterator](){return d.read(this),super[Symbol.iterator]()}forEach(t){d.read(this);for(let e of this)t(e,e,this);return this}values(){return d.read(this),super.values()}has(t){return d.read(this),super.has(t)}add(t){return super.add(t),d.write(this),this}delete(t){let e=super.delete(t);return d.write(this),e}clear(){return super.clear(),d.write(this),this}};var Fa=d.batch;function co(r){return nt(z(r))}var T=Symbol("optic");var Ut=class{calculate;#t=!1;#e;constructor(t){this.calculate=t,this.#e=t()}get(){return this.#t&&(this.#t=!1,this.#e=this.calculate()),this.#e}invalidate(){this.#t=!0}};var ve=class r{[T];#t;#e;#o;#r=U();constructor(t){this[T]=t,this.#t=z(t.getState()),this.#e=new Ut(()=>z(t.getState())),this.#o=new Ut(()=>co(t.getState()))}get on(){return this.#r.on}update(){let t=this[T].getState();!eo(t,this.#t)&&(this.#e.invalidate(),this.#o.invalidate(),this.#t=z(t),d.write(this),this.#r.set.size&&this.#r.publish(this.#e.get()))}get state(){return d.read(this),this.#e.get()}get frozen(){return d.read(this),this.#o.get()}mutate(t){return this[T].mutate(t)}lens(t){let e=new r({getState:()=>t(this[T].getState()),mutate:o=>this[T].mutate(s=>o(t(s))),registerLens:this[T].registerLens});return this[T].registerLens(e),e}};function lo(r){if(!r.done)throw new Error("wait not done");return ro(r)}function uo(r){if(!r.done)throw new Error("wait not done");return oo(r)}var po=r=>!r.done;var br=r=>r.done&&r.ok;function ho(r,t){let{pending:e=()=>{},ok:o=()=>{},err:s=()=>{}}=t;return po(r)?e():br(r)?o(lo(r)):s(uo(r))}function Fs(r){return!!(r.dataTransfer&&r.dataTransfer.types.includes("Files"))}function Gs(r){return r.dataTransfer?Array.from(r.dataTransfer.files):[]}function qt(r){let t=r.currentTarget,e=r.relatedTarget;return!t||!e||!t.contains(e)}var xr=class{params;$draggy=S(void 0);$droppy=S(void 0);constructor(t){this.params=t}get dragging(){return this.$draggy()}get hovering(){return this.$droppy()}dragzone=t=>({draggable:"true",dragstart:e=>{this.$draggy(t())},dragend:e=>{this.$draggy(void 0),this.$droppy(void 0)}});dropzone=t=>({dragenter:e=>{},dragover:e=>{e.preventDefault(),this.$draggy()?this.$droppy(t()):this.params.backchannelDrops?.dragover(e)},dragleave:e=>{qt(e)&&this.$droppy(void 0),this.params.backchannelDrops?.dragleave(e)},drop:e=>{e.preventDefault();let{acceptDrop:o}=this.params,s=this.$draggy(),n=this.$droppy();try{s&&n?o(e,s,n):this.params.backchannelDrops?.drop(e)}finally{this.$draggy(void 0),this.$droppy(void 0)}}})};var yr=class{params;$indicator=S(!1);constructor(t){this.params=t}dragover=t=>{t.preventDefault(),this.$indicator(this.params.predicate(t))};dragleave=t=>{qt(t)&&this.$indicator(!1)};drop=t=>{t.preventDefault(),this.$indicator(!1),this.params.predicate(t)&&this.params.acceptDrop(t)}};var St=b`
1
+ var gm=Object.defineProperty;var bm=(o,t)=>{for(var e in t)gm(o,e,{get:t[e],enumerable:!0})};function pd(o){return o.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function yu(o,t={}){let{soft:e=!1,upgrade:s=!0}=t;for(let[r,n]of Object.entries(o)){let c=pd(r),i=customElements.get(c);e&&i||(customElements.define(c,n),s&&document.querySelectorAll(c).forEach(a=>{a.constructor===HTMLElement&&customElements.upgrade(a)}))}}var wu=globalThis,ku=wu.ShadowRoot&&(wu.ShadyCSS===void 0||wu.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,kp=Symbol(),dd=new WeakMap,ou=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==kp)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(ku&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=dd.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&dd.set(e,t))}return t}toString(){return this.cssText}},hd=o=>new ou(typeof o=="string"?o:o+"",void 0,kp),ee=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((s,r,n)=>s+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+o[n+1],o[0]);return new ou(e,o,kp)},_u=(o,t)=>{if(ku)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),r=wu.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,o.appendChild(s)}},Af=ku?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return hd(e)})(o):o;var{is:ym,defineProperty:wm,getOwnPropertyDescriptor:km,getOwnPropertyNames:_m,getOwnPropertySymbols:Am,getPrototypeOf:Sm}=Object,Au=globalThis,md=Au.trustedTypes,$m=md?md.emptyScript:"",Em=Au.reactiveElementPolyfillSupport,nu=(o,t)=>o,_p={toAttribute(o,t){switch(t){case Boolean:o=o?$m:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},gd=(o,t)=>!ym(o,t),xd={attribute:!0,type:String,converter:_p,reflect:!1,useDefault:!1,hasChanged:gd};Symbol.metadata??=Symbol("metadata"),Au.litPropertyMetadata??=new WeakMap;var u2=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,e=xd){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),r=this.getPropertyDescriptor(t,s,e);r!==void 0&&wm(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){let{get:r,set:n}=km(this.prototype,t)??{get(){return this[e]},set(c){this[e]=c}};return{get:r,set(c){let i=r?.call(this);n?.call(this,c),this.requestUpdate(t,i,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??xd}static _$Ei(){if(this.hasOwnProperty(nu("elementProperties")))return;let t=Sm(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(nu("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(nu("properties"))){let e=this.properties,s=[..._m(e),...Am(e)];for(let r of s)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,r]of e)this.elementProperties.set(s,r)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let r=this._$Eu(e,s);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let r of s)e.unshift(Af(r))}else t!==void 0&&e.push(Af(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?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),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _u(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,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(r!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:_p).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,r=s._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let n=s.getPropertyOptions(r),c=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:_p;this._$Em=r;let i=c.fromAttribute(e,n.type);this[r]=i??this._$Ej?.get(r)??i,this._$Em=null}}requestUpdate(t,e,s,r=!1,n){if(t!==void 0){let c=this.constructor;if(r===!1&&(n=this[t]),s??=c.getPropertyOptions(t),!((s.hasChanged??gd)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(c._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:n},c){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,c??e??this[t]),n!==!0||c!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[r,n]of s){let{wrapped:c}=n,i=this[r];c!==!0||this._$AL.has(r)||i===void 0||this.C(r,void 0,n,i)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.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(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};u2.elementStyles=[],u2.shadowRootOptions={mode:"open"},u2[nu("elementProperties")]=new Map,u2[nu("finalized")]=new Map,Em?.({ReactiveElement:u2}),(Au.reactiveElementVersions??=[]).push("2.1.2");var Sp=globalThis,bd=o=>o,Su=Sp.trustedTypes,yd=Su?Su.createPolicy("lit-html",{createHTML:o=>o}):void 0,$p="$lit$",v2=`lit$${Math.random().toFixed(9).slice(2)}$`,Ep="?"+v2,Lm=`<${Ep}>`,ff=document,ru=()=>ff.createComment(""),cu=o=>o===null||typeof o!="object"&&typeof o!="function",Lp=Array.isArray,$d=o=>Lp(o)||typeof o?.[Symbol.iterator]=="function",Ap=`[
2
+ \f\r]`,su=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wd=/-->/g,kd=/>/g,af=RegExp(`>|${Ap}(?:([^\\s"'>=/]+)(${Ap}*=${Ap}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),_d=/'/g,Ad=/"/g,Ed=/^(?:script|style|textarea|title)$/i,Mp=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),I=Mp(1),mt=Mp(2),P3=Mp(3),uf=Symbol.for("lit-noChange"),ke=Symbol.for("lit-nothing"),Sd=new WeakMap,lf=ff.createTreeWalker(ff,129);function Ld(o,t){if(!Lp(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return yd!==void 0?yd.createHTML(t):t}var Md=(o,t)=>{let e=o.length-1,s=[],r,n=t===2?"<svg>":t===3?"<math>":"",c=su;for(let i=0;i<e;i++){let a=o[i],u,v,m=-1,$=0;for(;$<a.length&&(c.lastIndex=$,v=c.exec(a),v!==null);)$=c.lastIndex,c===su?v[1]==="!--"?c=wd:v[1]!==void 0?c=kd:v[2]!==void 0?(Ed.test(v[2])&&(r=RegExp("</"+v[2],"g")),c=af):v[3]!==void 0&&(c=af):c===af?v[0]===">"?(c=r??su,m=-1):v[1]===void 0?m=-2:(m=c.lastIndex-v[2].length,u=v[1],c=v[3]===void 0?af:v[3]==='"'?Ad:_d):c===Ad||c===_d?c=af:c===wd||c===kd?c=su:(c=af,r=void 0);let H=c===af&&o[i+1].startsWith("/>")?" ":"";n+=c===su?a+Lm:m>=0?(s.push(u),a.slice(0,m)+$p+a.slice(m)+v2+H):a+v2+(m===-2?i:H)}return[Ld(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},iu=class o{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,c=0,i=t.length-1,a=this.parts,[u,v]=Md(t,e);if(this.el=o.createElement(u,s),lf.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(r=lf.nextNode())!==null&&a.length<i;){if(r.nodeType===1){if(r.hasAttributes())for(let m of r.getAttributeNames())if(m.endsWith($p)){let $=v[c++],H=r.getAttribute(m).split(v2),ht=/([.?@])?(.*)/.exec($);a.push({type:1,index:n,name:ht[2],strings:H,ctor:ht[1]==="."?Eu:ht[1]==="?"?Lu:ht[1]==="@"?Mu:pf}),r.removeAttribute(m)}else m.startsWith(v2)&&(a.push({type:6,index:n}),r.removeAttribute(m));if(Ed.test(r.tagName)){let m=r.textContent.split(v2),$=m.length-1;if($>0){r.textContent=Su?Su.emptyScript:"";for(let H=0;H<$;H++)r.append(m[H],ru()),lf.nextNode(),a.push({type:2,index:++n});r.append(m[$],ru())}}}else if(r.nodeType===8)if(r.data===Ep)a.push({type:2,index:n});else{let m=-1;for(;(m=r.data.indexOf(v2,m+1))!==-1;)a.push({type:7,index:n}),m+=v2.length-1}n++}}static createElement(t,e){let s=ff.createElement("template");return s.innerHTML=t,s}};function vf(o,t,e=o,s){if(t===uf)return t;let r=s!==void 0?e._$Co?.[s]:e._$Cl,n=cu(t)?void 0:t._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(o),r._$AT(o,e,s)),s!==void 0?(e._$Co??=[])[s]=r:e._$Cl=r),r!==void 0&&(t=vf(o,r._$AS(o,t.values),r,s)),t}var $u=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??ff).importNode(e,!0);lf.currentNode=r;let n=lf.nextNode(),c=0,i=0,a=s[0];for(;a!==void 0;){if(c===a.index){let u;a.type===2?u=new Sf(n,n.nextSibling,this,t):a.type===1?u=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(u=new Ou(n,this,t)),this._$AV.push(u),a=s[++i]}c!==a?.index&&(n=lf.nextNode(),c++)}return lf.currentNode=ff,r}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},Sf=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=ke,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=vf(this,t,e),cu(t)?t===ke||t==null||t===""?(this._$AH!==ke&&this._$AR(),this._$AH=ke):t!==this._$AH&&t!==uf&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):$d(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!==ke&&cu(this._$AH)?this._$AA.nextSibling.data=t:this.T(ff.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=iu.createElement(Ld(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{let n=new $u(r,this),c=n.u(this.options);n.p(e),this.T(c),this._$AH=n}}_$AC(t){let e=Sd.get(t.strings);return e===void 0&&Sd.set(t.strings,e=new iu(t)),e}k(t){Lp(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,r=0;for(let n of t)r===e.length?e.push(s=new o(this.O(ru()),this.O(ru()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=bd(t).nextSibling;bd(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},pf=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=ke,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=ke}_$AI(t,e=this,s,r){let n=this.strings,c=!1;if(n===void 0)t=vf(this,t,e,0),c=!cu(t)||t!==this._$AH&&t!==uf,c&&(this._$AH=t);else{let i=t,a,u;for(t=n[0],a=0;a<n.length-1;a++)u=vf(this,i[s+a],e,a),u===uf&&(u=this._$AH[a]),c||=!cu(u)||u!==this._$AH[a],u===ke?t=ke:t!==ke&&(t+=(u??"")+n[a+1]),this._$AH[a]=u}c&&!r&&this.j(t)}j(t){t===ke?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Eu=class extends pf{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===ke?void 0:t}},Lu=class extends pf{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==ke)}},Mu=class extends pf{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=vf(this,t,e,0)??ke)===uf)return;let s=this._$AH,r=t===ke&&s!==ke||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==ke&&(s===ke||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ou=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){vf(this,t)}},Od={M:$p,P:v2,A:Ep,C:1,L:Md,R:$u,D:$d,V:vf,I:Sf,H:pf,N:Lu,U:Mu,B:Eu,F:Ou},Mm=Sp.litHtmlPolyfillSupport;Mm?.(iu,Sf),(Sp.litHtmlVersions??=[]).push("3.3.3");var oe=(o,t,e)=>{let s=e?.renderBefore??t,r=s._$litPart$;if(r===void 0){let n=e?.renderBefore??null;s._$litPart$=r=new Sf(t.insertBefore(ru(),n),n,void 0,e??{})}return r._$AI(o),r};var Op=globalThis,$f=class extends u2{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=oe(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return uf}};$f._$litElement$=!0,$f.finalized=!0,Op.litElementHydrateSupport?.({LitElement:$f});var Om=Op.litElementPolyfillSupport;Om?.({LitElement:$f});(Op.litElementVersions??=[]).push("4.2.2");var t2={string:(o,t)=>o.getAttribute(t)??void 0,number:(o,t)=>{let e=o.getAttribute(t);return e===null||!e?void 0:Number(e)},boolean:(o,t)=>o.getAttribute(t)!==null},oo={string:(o,t,e)=>(e===void 0?o.removeAttribute(t):o.setAttribute(t,e),!0),number:(o,t,e)=>(e===void 0?o.removeAttribute(t):o.setAttribute(t,e.toString()),!0),boolean:(o,t,e)=>(e?o.setAttribute(t,""):o.removeAttribute(t),!0),any:(o,t,e)=>{e==null?o.removeAttribute(t):typeof e=="string"?o.setAttribute(t,e):typeof e=="number"?o.setAttribute(t,e.toString()):typeof e=="boolean"?e===!0?o.setAttribute(t,""):o.removeAttribute(t):console.warn(`invalid attribute "${t}" type is "${typeof e}"`)},entries:(o,t)=>{for(let[e,s]of t)oo.any(o,e,s)},record:(o,t)=>oo.entries(o,Object.entries(t))};function Bd(o,t={}){let e=document.createElement(o);return oo.record(e,t),e}function Pd(o){let t=document.createDocumentFragment();return oe(o,t),t.firstElementChild}function Bu(o,t){let e=[];for(let[s,r]of Object.entries(t))if(typeof r=="function")o.addEventListener(s,r),e.push(()=>o.removeEventListener(s,r));else{let[n,c]=r;o.addEventListener(s,c,n),e.push(()=>o.removeEventListener(s,c))}return()=>e.forEach(s=>s())}function Cd(o,t){let e=new MutationObserver(t);return e.observe(o,{attributes:!0}),()=>e.disconnect()}var Pu=class{element;constructor(t){this.element=t}strings=new Proxy({},{get:(t,e)=>t2.string(this.element,e),set:(t,e,s)=>oo.string(this.element,e,s)});numbers=new Proxy({},{get:(t,e)=>t2.number(this.element,e),set:(t,e,s)=>oo.number(this.element,e,s)});booleans=new Proxy({},{get:(t,e)=>t2.boolean(this.element,e),set:(t,e,s)=>oo.boolean(this.element,e,s)})};var jd=(o,t,e={})=>new Proxy(t,{get:(s,r)=>{switch(t[r]){case String:return t2.string(o,r);case Number:return t2.number(o,r);case Boolean:return t2.boolean(o,r);default:throw new Error(`invalid attribute type for "${r}"`)}},set:(s,r,n)=>{try{switch(e.beforeSet?.(r),t[r]){case String:return oo.string(o,r,n);case Number:return oo.number(o,r,n);case Boolean:return oo.boolean(o,r,n);default:throw new Error(`invalid attribute type for "${r}"`)}}finally{e.afterSet?.(r)}}});function Ef(o){let t=new Pu(o);return{strings:t.strings,numbers:t.numbers,booleans:t.booleans,on:e=>Cd(o,e),spec:(e,s={})=>jd(o,e,s)}}Ef.get=t2;Ef.set=oo;function Id(o){return new Bp(o)}var Bp=class{tagName;#t=new Map;#e=[];constructor(t){this.tagName=t}attr(t,e=!0){return this.#t.set(t,e),this}attrs(t){for(let[e,s]of Object.entries(t))this.attr(e,s);return this}children(...t){return this.#e.push(...t),this}done(){let t=document.createElement(this.tagName);return oo.entries(t,this.#t),t.append(...this.#e),t}};function Lf(o,t=document){let e=t.querySelector(o);if(!e)throw new Error(`element not found (${o})`);return e}function Cu(o,t=document){return t.querySelector(o)}function ju(o,t=document){return Array.from(t.querySelectorAll(o))}var Iu=class o{element;#t;constructor(t){this.element=t}in(t){return new o(typeof t=="string"?Lf(t,this.element):t)}require(t){return Lf(t,this.element)}maybe(t){return Cu(t,this.element)}all(t){return ju(t,this.element)}render(...t){return oe(t,this.element)}get attrs(){return this.#t??=Ef(this.element)}events(t){return Bu(this.element,t)}};function xt(o,t=document){return Lf(o,t)}xt.in=(o,t=document)=>new Iu(t).in(o);xt.need=Lf;xt.maybe=Cu;xt.all=ju;xt.el=Bd;xt.elmer=Id;xt.mk=Pd;xt.events=Bu;xt.attrs=Ef;xt.register=yu;xt.render=(o,...t)=>oe(t,o);var Hu={};bm(Hu,{DragAndDrops:()=>Tp,Drops:()=>Up,files:()=>Um,hasFiles:()=>Tm,outsideCurrentTarget:()=>vu});var zd=Object.freeze({eq(o,t){if(o.length!==t.length)return!1;let e=0;for(let s=0;s<o.length;s++)e|=o[s]^t[s];return e===0},random(o){return crypto.getRandomValues(new Uint8Array(o))},concat(o){let t=0;for(let r of o)t+=r.byteLength;let e=new Uint8Array(t),s=0;for(let r of o)e.set(r,s),s+=r.byteLength;return e}});var Oe=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef",caseInsensitive:!0},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(t){this.lexicon=t,this.lookup=Object.fromEntries([...t.characters].map((s,r)=>[s,r])),this.negativePrefix=t.negativePrefix??"-";let e=this.fromBytes.bind(this);return Object.setPrototypeOf(e,new.target.prototype),Object.assign(e,this),e}toBytes(t){this.lexicon.caseInsensitive&&(t=t.toLowerCase());let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let u=0,v=0,m=[];for(let $ of t){if($===this.lexicon.padding?.character)continue;let H=this.lookup[$];if(H===void 0)throw new Error(`Invalid character: ${$}`);for(u=u<<e|H,v+=e;v>=8;)v-=8,m.push(u>>v&255)}return new Uint8Array(m)}let s=0n,r=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length));let n=this.lexicon.characters[0],c=0;for(;t[c]===n;)c++;t=t.slice(c);for(let u of t){let v=this.lookup[u];if(v===void 0)throw new Error(`Invalid character: ${u}`);s=s*r+BigInt(v)}let i=new Uint8Array(c+(s===0n?0:this.countBytes(s))),a=i.length;for(;s>0n;)i[--a]=Number(s%256n),s=s/256n;return i}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let a=0,u=0,v="";for(let m of t)for(a=a<<8|m,u+=8;u>=e;){u-=e;let $=a>>u&(1<<e)-1;v+=this.lexicon.characters[$]}if(u>0){let m=a<<e-u&(1<<e)-1;v+=this.lexicon.characters[m]}if(this.lexicon.padding)for(;v.length%this.lexicon.padding.size!==0;)v+=this.lexicon.padding.character;return v}if(t.length===0)return"";let s=this.lexicon.characters[0],r=0;for(;t[r]===0;)r++;let n=0n;for(let a of t.slice(r))n=(n<<8n)+BigInt(a);if(n===0n)return s.repeat(r);let c=BigInt(this.lexicon.characters.length),i="";for(;n>0n;)i=this.lexicon.characters[Number(n%c)]+i,n=n/c;return s.repeat(r)+i}toInteger(t){if(!t)return 0;let e=0n,s=!1,r=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),s=!0);for(let n of t){let c=this.lookup[n];if(c===void 0)throw new Error(`Invalid character: ${n}`);e=e*r+BigInt(c)}return Number(s?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,s=BigInt(e?-t:t);if(s===0n)return this.lexicon.characters[0];let r=BigInt(this.lexicon.characters.length),n="";for(;s>0n;)n=this.lexicon.characters[Number(s%r)]+n,s=s/r;return e?`${this.negativePrefix}${n}`:n}random(t=32){return this.fromBytes(zd.random(t))}countBytes(t){let e=0;for(;t>0n;)e++,t=t/256n;return e}};var Mf=new Oe(Oe.lexicons.hex),U4=new Oe(Oe.lexicons.base2),R4=new Oe(Oe.lexicons.base36),D4=new Oe(Oe.lexicons.base58),H4=new Oe(Oe.lexicons.base62),V4=new Oe(Oe.lexicons.base64),N4=new Oe(Oe.lexicons.base64url);var Td=o=>new TextDecoder().decode(o),Bm=o=>new TextEncoder().encode(o);function zu(o){return Td(o)}zu.fromBytes=Td;zu.toBytes=Bm;function Ud(o,t){let e,s,r=[];function n(){e=[],s&&clearTimeout(s),s=void 0,r=[]}return n(),((...c)=>{e=c,s&&clearTimeout(s);let i=new Promise((a,u)=>{r.push({resolve:a,reject:u})});return s=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(a=>{for(let{resolve:u}of r)u(a);n()}).catch(a=>{for(let{reject:u}of r)u(a);n()})},o),i})}function df(){let o,t,e=new Promise((s,r)=>{o=s,t=r});return e.resolve=o,e.reject=t,e.promise=e,e.entangle=s=>(s.then(o,t),e),e}function Of(o){let t=null;return((...e)=>(t?t.params=e:(t={params:e,deferred:df()},queueMicrotask(()=>{let{params:s,deferred:r}=t;t=null,Promise.resolve(o(...s)).then(r.resolve).catch(r.reject)})),t.deferred.promise))}function e2(o,t=new Set){if(t.has(o))throw new Error("cannot clone circular reference");let e;return typeof o=="function"||o!==null&&typeof o=="object"?(t.add(o),Array.isArray(o)?e=o.map(s=>e2(s,new Set(t))):o.constructor===Object?e=Object.fromEntries(Object.entries(o).map(([s,r])=>[s,e2(r,new Set(t))])):o instanceof Map?e=new Map(Array.from(o,([s,r])=>[s,e2(r,new Set(t))])):o instanceof Set?e=new Set(Array.from(o,s=>e2(s,new Set(t)))):o instanceof Date?e=new Date(o.getTime()):e=o,t.delete(o)):e=o,e}function k0(o){return o!=null}var Bf=o=>typeof o=="number",Pf=o=>typeof o=="string";var au=o=>typeof o=="object"&&o!==null,Tu=o=>Array.isArray(o);function Pm(o){return o!=null}function Cm(o){return o==null}var Y4=Object.freeze({happy:Pm,sad:Cm,boolean:o=>typeof o=="boolean",number:o=>typeof o=="number",string:o=>typeof o=="string",bigint:o=>typeof o=="bigint",object:o=>typeof o=="object"&&o!==null,array:o=>Array.isArray(o),fn:o=>typeof o=="function",symbol:o=>typeof o=="symbol"});var Rd=(o,t)=>{function e(s,r,n){if(!au(s)||!au(r))return s===r;if(n.includes(s))throw new Error("forbidden circularity detected in deep equal comparison");let c=[...n,s];if(s instanceof Map&&r instanceof Map){if(s.size!==r.size)return!1;for(let[i,a]of s)if(!r.has(i)||!e(a,r.get(i),c))return!1}else if(s instanceof Set&&r instanceof Set){if(s.size!==r.size)return!1;for(let i of s)if(!Array.from(r).some(a=>e(i,a,c)))return!1}else{let i=Object.keys(s),a=Object.keys(r);if(i.length!==a.length)return!1;for(let u of i)if(!a.includes(u)||!e(s[u],r[u],c))return!1}return!0}return e(o,t,[])};function hf(o){function t(e,s){if(!au(e)||s.includes(e))return e;let r=[...s,e];if(e instanceof Map)for(let n of e.entries())for(let c of n)t(c,r);else if(e instanceof Set)for(let n of e)t(n,r);else if(Array.isArray(e))for(let n of e)t(n,r);else for(let n of Object.values(e))t(n,r);return Object.freeze(e)}return t(o,[])}function Dd(o){if(o.ok)return o.value;let{error:t}=o;throw t instanceof Error?t:typeof t=="string"?new Error(t):new Error("unknown")}function Hd(o){if(o.ok)throw new Error("didn't get needed error");return o.error}function tc(o,t="got failed"){if(o==null)throw new Error(t);return o}function Cf(o,t,e){if(o.has(t))return o.get(t);{let s=e();return o.set(t,s),s}}function lu(o,t){for(let[e,s]of t)o.set(e,s);return o}function Vd(o,t){return t<=0?[]:o.length>t?o.slice(-t):o}async function Pp(o){let t=[];for await(let e of o)t.push(e);return t}function jf(o){let t,e=!1,s=()=>{e=!0,clearTimeout(t)},r=async()=>{e||(await o(s),!e&&(t=setTimeout(r,0)))};return r(),s}function Cp(o){return new DataView(o.buffer,o.byteOffset,o.byteLength)}function J0(){let o=[],t=()=>{let s=o;o=[];for(let r=s.length-1;r>=0;r--)s[r]()};function e(){t()}return e.dispose=t,e.schedule=(...s)=>(o.push(...s),e),e.own=(s,r)=>(o.push(()=>r(s)),s),e.disposable=s=>(o.push(()=>s.dispose()),s),e.disposables=e.disposable,e}function ec(o,t){let e=Object.entries(t);for(let[s,r]of e)o.addEventListener(s,r);return()=>{for(let[s,r]of e)o.removeEventListener(s,r)}}var If=class{count;constructor(t=0){this.count=t}next(){return this.count++}};var zf=(o=0)=>new Promise(t=>setTimeout(t,o));var jp=(o,t)=>Object.fromEntries(Object.entries(o).map(([e,s])=>[e,t(s,e)])),jm=(o,t)=>Object.fromEntries(Object.entries(o).filter(([e,s])=>t(s,e)));function Im(o){return{map:t=>Nd(o,t),filter:t=>Fd(o,t)}}Im.pipe=Object.freeze({map:o=>(t=>Nd(t,o)),filter:o=>(t=>Fd(t,o))});var Nd=jp,Fd=jm;function h2(o){let t=zm(),e=s=>t.on(s);return Object.assign(e,t),o&&t.on(o),e}function zm(){let o=new Set,t,e=()=>t??=df(),s=i=>{let a=t;t=void 0,a?.resolve(i)};return{set:o,on:i=>(o.add(i),()=>{o.delete(i)}),publish:(...i)=>{s(i);for(let a of[...o])a(...i)},publishAsync:async(...i)=>{s(i),await Promise.all([...o].map(async a=>a(...i)))},next:e}}function m2(o,...t){let e=o.length-1;return o.slice(0,e).reduce((s,r,n)=>s+r+t[n],"")+o[e]}function Tf(o,t,e){return o?t():e?.()}function Uu(o,t,e){return k0(o)?t(o):e?.()}var Ru=class{#t=new Set;#e=[];#n=new WeakMap;#o=0;#s=new Set;read(t){this.#e.at(-1)?.add(t)}write(t){let e=this.#n.get(t);if(e){for(let s of e)this.#s.add(s);this.#o===0&&this.#r()}}observe(t){let e=new Set;this.#e.push(e);try{let s=t();return{seen:e,value:s}}finally{this.#e.pop()}}subscribe(t,e){let s=Cf(this.#n,t,()=>new Set);return s.add(e),()=>{s.delete(e),s.size===0&&this.#n.delete(t)}}batch=t=>{this.#o++;try{return t()}finally{this.#o--,this.#o===0&&this.#r()}};#c(t){if(this.#t.has(t))throw new Error("circularity forbidden");this.#t.add(t);try{t()}finally{this.#t.delete(t)}}#r(){for(;this.#s.size>0;){let t=[...this.#s];this.#s.clear();for(let e of t)this.#c(e)}}};var q=globalThis[Symbol.for("e280.tracker.2")]??=new Ru;function oc(o){let t;function e(){return arguments.length===0?(q.read(e),o):(o=arguments[0],q.write(e),t?.publish(o),o)}return e.get=()=>e(),e.set=s=>e(s),e.on=s=>(t??=h2())(s),e}var o2=class extends Map{get size(){return q.read(this),super.size}[Symbol.iterator](){return q.read(this),super[Symbol.iterator]()}forEach(t){q.read(this);for(let[e,s]of this)t(s,e,this);return this}keys(){return q.read(this),super.keys()}values(){return q.read(this),super.values()}entries(){return q.read(this),super.entries()}has(t){return q.read(this),super.has(t)}get(t){return q.read(this),super.get(t)}set(t,e){return super.set(t,e),q.write(this),this}delete(t){let e=super.delete(t);return q.write(this),e}clear(){return super.clear(),q.write(this),this}};var fu=class extends Set{get size(){return q.read(this),super.size}[Symbol.iterator](){return q.read(this),super[Symbol.iterator]()}forEach(t){q.read(this);for(let e of this)t(e,e,this);return this}values(){return q.read(this),super.values()}has(t){return q.read(this),super.has(t)}add(t){return super.add(t),q.write(this),this}delete(t){let e=super.delete(t);return q.write(this),e}clear(){return super.clear(),q.write(this),this}};var W6=q.batch;function Kd(o){return hf(e2(o))}var n2=Symbol("optic");var uu=class{calculate;#t=!1;#e;constructor(t){this.calculate=t,this.#e=t()}get(){return this.#t&&(this.#t=!1,this.#e=this.calculate()),this.#e}invalidate(){this.#t=!0}};var Du=class o{[n2];#t;#e;#n;#o=h2();constructor(t){this[n2]=t,this.#t=e2(t.getState()),this.#e=new uu(()=>e2(t.getState())),this.#n=new uu(()=>Kd(t.getState()))}get on(){return this.#o.on}update(){let t=this[n2].getState();!Rd(t,this.#t)&&(this.#e.invalidate(),this.#n.invalidate(),this.#t=e2(t),q.write(this),this.#o.set.size&&this.#o.publish(this.#e.get()))}get state(){return q.read(this),this.#e.get()}get frozen(){return q.read(this),this.#n.get()}mutate(t){return this[n2].mutate(t)}lens(t){let e=new o({getState:()=>t(this[n2].getState()),mutate:s=>this[n2].mutate(r=>s(t(r))),registerLens:this[n2].registerLens});return this[n2].registerLens(e),e}};function Wd(o){if(!o.done)throw new Error("wait not done");return Dd(o)}function Gd(o){if(!o.done)throw new Error("wait not done");return Hd(o)}var Xd=o=>!o.done;var zp=o=>o.done&&o.ok;function Jd(o,t){let{pending:e=()=>{},ok:s=()=>{},err:r=()=>{}}=t;return Xd(o)?e():zp(o)?s(Wd(o)):r(Gd(o))}function Tm(o){return!!(o.dataTransfer&&o.dataTransfer.types.includes("Files"))}function Um(o){return o.dataTransfer?Array.from(o.dataTransfer.files):[]}function vu(o){let t=o.currentTarget,e=o.relatedTarget;return!t||!e||!t.contains(e)}var Tp=class{params;$draggy=oc(void 0);$droppy=oc(void 0);constructor(t){this.params=t}get dragging(){return this.$draggy()}get hovering(){return this.$droppy()}dragzone=t=>({draggable:"true",dragstart:e=>{this.$draggy(t())},dragend:e=>{this.$draggy(void 0),this.$droppy(void 0)}});dropzone=t=>({dragenter:e=>{},dragover:e=>{e.preventDefault(),this.$draggy()?this.$droppy(t()):this.params.backchannelDrops?.dragover(e)},dragleave:e=>{vu(e)&&this.$droppy(void 0),this.params.backchannelDrops?.dragleave(e)},drop:e=>{e.preventDefault();let{acceptDrop:s}=this.params,r=this.$draggy(),n=this.$droppy();try{r&&n?s(e,r,n):this.params.backchannelDrops?.drop(e)}finally{this.$draggy(void 0),this.$droppy(void 0)}}})};var Up=class{params;$indicator=oc(!1);constructor(t){this.params=t}dragover=t=>{t.preventDefault(),this.$indicator(this.params.predicate(t))};dragleave=t=>{vu(t)&&this.$indicator(!1)};drop=t=>{t.preventDefault(),this.$indicator(!1),this.params.predicate(t)&&this.params.acceptDrop(t)}};var Uf=ee`
4
4
  * {
5
5
  margin: 0;
6
6
  padding: 0;
@@ -14,18 +14,18 @@ var _s=Object.defineProperty;var Cs=(r,t)=>{for(var e in t)_s(r,e,{get:t[e],enum
14
14
  ::-webkit-scrollbar-track { background: transparent; }
15
15
  ::-webkit-scrollbar-thumb { background: #888; border-radius: 1em; }
16
16
  ::-webkit-scrollbar-thumb:hover { background: #999; }
17
- `;var ke=class r extends HTMLElement{static register(){g.register({SlyShadow:r},{soft:!0})}connectedCallback(){this.hasAttribute("view")||this.setAttribute("view","")}};var Wt=class{render;count=0;rendered=st();constructor(t){this.render=t}doneRender(){this.count++,this.rendered.resolve(),this.rendered=st()}},W=class extends Wt{host;shadow;constructor(t,e,o){super(t),this.host=e,this.shadow=o}};var wr=class{#t=[];get scope(){let t=this.#t.at(-1);if(!t)throw new Error("hooks must be called within a render fn");return t}increment(){let t=this.scope,e=t.position++;return{scope:t,position:e}}wrap(t,e){t.position=0,this.#t.push(t);try{return e()}finally{this.#t.pop()}}},M=globalThis[Symbol.for("e280.hooks")]??=new wr;var F=class{#t=[];clear(){this.#t.forEach(t=>t()),this.#t=[]}observe(t,e){let{seen:o,value:s}=d.observe(t);this.clear();for(let n of o){let i=d.subscribe(n,e);this.#t.push(i)}return s}};var Se=class{#t=[];#e=[];mount(t){this.#t.push(t),this.#e.push(t())}unmountAll(){for(let t of this.#e)t();this.#e=[]}remountAll(){for(let t of this.#t)this.#e.push(t())}};var G=class{cx;position=0;values=new Map;mounts=new Se;constructor(t){this.cx=t}};var{I:eu}=Gr;var mo=r=>r.strings===void 0;var fo={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ft=r=>(...t)=>({_$litDirective$:r,values:t}),Ae=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,o){this._$Ct=t,this._$AM=e,this._$Ci=o}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var Gt=(r,t)=>{let e=r._$AN;if(e===void 0)return!1;for(let o of e)o._$AO?.(t,!1),Gt(o,t);return!0},_e=r=>{let t,e;do{if((t=r._$AM)===void 0)break;e=t._$AN,e.delete(r),r=t}while(e?.size===0)},go=r=>{for(let t;t=r._$AM;r=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(r))break;e.add(r),Xs(t)}};function Zs(r){this._$AN!==void 0?(_e(this),this._$AM=r,go(this)):this._$AM=r}function Qs(r,t=!1,e=0){let o=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(o))for(let n=e;n<o.length;n++)Gt(o[n],!1),_e(o[n]);else o!=null&&(Gt(o,!1),_e(o));else Gt(this,r)}var Xs=r=>{r.type==fo.CHILD&&(r._$AP??=Qs,r._$AQ??=Zs)},At=class extends Ae{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,o){super._$AT(t,e,o),go(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Gt(this,t),_e(this))}setValue(t){if(mo(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};function A(r){return Ft(class extends At{#t;#e=new Wt(gt(()=>{if(!this.#t)throw new Error("cannot render before props");if(this.isConnected){let e=this.render(...this.#t);this.setValue(e),this.#e.doneRender()}}));#o=new G(this.#e);#r=new F;update(e,o){let s=super.update(e,o);return this.isConnected&&this.#e.doneRender(),s}render(...e){return this.#t=e,this.#r.observe(()=>M.wrap(this.#o,()=>r(...this.#t)),this.#e.render)}disconnected(){this.#o.mounts.unmountAll(),this.#r.clear()}reconnected(){this.#o.mounts.remountAll(),this.#e.render()}})}function bo(r,t){for(let[e,o]of Object.entries(t))Ys(r,e,o)}function Ys(r,t,e){let o=r.getAttribute(t),s=tn(e);s!==o&&(s===null?r.removeAttribute(t):r.setAttribute(t,s))}function tn(r){return typeof r=="string"?r:typeof r=="number"?r.toString():r?"":null}function en(){ke.register();let r=document.createElement("sly-shadow"),t=r.attachShadow({mode:"open"});return{host:r,shadow:t}}function K(r){return yo(en,r)}K.setup=r=>(t=>yo(r,t));var xo=K;function yo(r,t){let e=Ft(class extends At{#t;#e;#o;#r=new F;constructor(s){super(s);let{host:n,shadow:i}=r(),a=gt(()=>{if(!this.#o)throw new Error("cannot render before props");if(!this.isConnected)return;let c=this.#s(this.#o);x(c,this.#t.shadow),this.#t.doneRender()});this.#t=new W(a,n,i),this.#e=new G(this.#t)}#s(s){return this.#o=s,this.#r.observe(()=>M.wrap(this.#e,()=>t(...this.#o)),this.#t.render)}render({props:s,children:n,attrs:i}){let{host:a}=this.#t;return this.isConnected&&(i&&bo(a,i),x(n,this.#t.host),x(this.#s(s),this.#t.shadow),this.#t.doneRender()),a}disconnected(){x(null,this.#t.shadow),x(null,this.#t.host),this.#e.mounts.unmountAll(),this.#r.clear()}reconnected(){this.#e.mounts.remountAll(),this.#t.render()}});function o(...s){return e({props:s})}return o.with=e,o}function wo(r){return class extends HTMLElement{#t;#e;#o=new F;#r=this.attachShadow({mode:"open"});constructor(){super();let t=gt(()=>{if(!this.isConnected)return;let e=this.#s();x(e,this.#t.shadow),this.#t.doneRender()});this.#t=new W(t,this,this.#r),this.#e=new G(this.#t)}#s(){return this.#o.observe(()=>M.wrap(this.#e,()=>r()),this.#t.render)}render(){x(this.#s(),this.#t.shadow),this.#t.doneRender()}connectedCallback(){this.#e.mounts.remountAll(),this.#t.render()}disconnectedCallback(){this.#e.mounts.unmountAll(),this.#o.clear()}}}function J(r){return[K(r),(...o)=>wo(()=>r(...o))]}function y(r){let{scope:t,position:e}=M.increment();return yt(t.values,e,r)}function Kt(){return M.increment().scope.cx}function Ce(){let r=Kt();if(!(r instanceof W))throw new Error("this hook only works on shadow views (but was called in a light view)");return r}function Jt(){return Ce().host}function it(r){let{scope:t}=M.increment();return y(()=>t.mounts.mount(r))}function $o(){return Ce().shadow}function ko(r,t){oe(r,on(t))}function on(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let o of e)t.unshift(pt(o))}else r!==void 0&&t.push(pt(r));return t}function B(...r){let t=$o();y(()=>ko(t,r))}function _t(r=""){let t=Jt();y(()=>t.setAttribute("view",r))}function H(r){return y(()=>S(r))}var Ct=B;function So(r){return it(()=>r)}function j(r,t){return()=>nn({hz:r,frames:t})}var nn=K(({hz:r,frames:t})=>{_t("loading"),Ct(St,an);let e=H(0);return it(()=>wt(async()=>{await $t(1e3/r);let o=e()+1;e(o>=t.length?0:o)})),t.at(e())}),an=b`
17
+ `;var Vu=class o extends HTMLElement{static register(){xt.register({SlyShadow:o},{soft:!0})}connectedCallback(){this.hasAttribute("view")||this.setAttribute("view","")}};var pu=class{render;count=0;rendered=df();constructor(t){this.render=t}doneRender(){this.count++,this.rendered.resolve(),this.rendered=df()}},s2=class extends pu{host;shadow;constructor(t,e,s){super(t),this.host=e,this.shadow=s}};var Rp=class{#t=[];get scope(){let t=this.#t.at(-1);if(!t)throw new Error("hooks must be called within a render fn");return t}increment(){let t=this.scope,e=t.position++;return{scope:t,position:e}}wrap(t,e){t.position=0,this.#t.push(t);try{return e()}finally{this.#t.pop()}}},Y0=globalThis[Symbol.for("e280.hooks")]??=new Rp;var x2=class{#t=[];clear(){this.#t.forEach(t=>t()),this.#t=[]}observe(t,e){let{seen:s,value:r}=q.observe(t);this.clear();for(let n of s){let c=q.subscribe(n,e);this.#t.push(c)}return r}};var Nu=class{#t=[];#e=[];mount(t){this.#t.push(t),this.#e.push(t())}unmountAll(){for(let t of this.#e)t();this.#e=[]}remountAll(){for(let t of this.#t)this.#e.push(t())}};var g2=class{cx;position=0;values=new Map;mounts=new Nu;constructor(t){this.cx=t}};var{I:og}=Od;var Yd=o=>o.strings===void 0;var Zd={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},du=o=>(...t)=>({_$litDirective$:o,values:t}),Fu=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var hu=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),hu(s,t);return!0},qu=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Qd=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Nm(t)}};function Hm(o){this._$AN!==void 0?(qu(this),this._$AM=o,Qd(this)):this._$AM=o}function Vm(o,t=!1,e=0){let s=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)hu(s[n],!1),qu(s[n]);else s!=null&&(hu(s,!1),qu(s));else hu(this,o)}var Nm=o=>{o.type==Zd.CHILD&&(o._$AP??=Vm,o._$AQ??=Hm)},Rf=class extends Fu{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),Qd(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(hu(this,t),qu(this))}setValue(t){if(Yd(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};function Ei(o){return du(class extends Rf{#t;#e=new pu(Of(()=>{if(!this.#t)throw new Error("cannot render before props");if(this.isConnected){let e=this.render(...this.#t);this.setValue(e),this.#e.doneRender()}}));#n=new g2(this.#e);#o=new x2;update(e,s){let r=super.update(e,s);return this.isConnected&&this.#e.doneRender(),r}render(...e){return this.#t=e,this.#o.observe(()=>Y0.wrap(this.#n,()=>o(...this.#t)),this.#e.render)}disconnected(){this.#n.mounts.unmountAll(),this.#o.clear()}reconnected(){this.#n.mounts.remountAll(),this.#e.render()}})}function th(o,t){for(let[e,s]of Object.entries(t))Fm(o,e,s)}function Fm(o,t,e){let s=o.getAttribute(t),r=qm(e);r!==s&&(r===null?o.removeAttribute(t):o.setAttribute(t,r))}function qm(o){return typeof o=="string"?o:typeof o=="number"?o.toString():o?"":null}function Km(){Vu.register();let o=document.createElement("sly-shadow"),t=o.attachShadow({mode:"open"});return{host:o,shadow:t}}function b2(o){return oh(Km,o)}b2.setup=o=>(t=>oh(o,t));var eh=b2;function oh(o,t){let e=du(class extends Rf{#t;#e;#n;#o=new x2;constructor(r){super(r);let{host:n,shadow:c}=o(),i=Of(()=>{if(!this.#n)throw new Error("cannot render before props");if(!this.isConnected)return;let a=this.#s(this.#n);oe(a,this.#t.shadow),this.#t.doneRender()});this.#t=new s2(i,n,c),this.#e=new g2(this.#t)}#s(r){return this.#n=r,this.#o.observe(()=>Y0.wrap(this.#e,()=>t(...this.#n)),this.#t.render)}render({props:r,children:n,attrs:c}){let{host:i}=this.#t;return this.isConnected&&(c&&th(i,c),oe(n,this.#t.host),oe(this.#s(r),this.#t.shadow),this.#t.doneRender()),i}disconnected(){oe(null,this.#t.shadow),oe(null,this.#t.host),this.#e.mounts.unmountAll(),this.#o.clear()}reconnected(){this.#e.mounts.remountAll(),this.#t.render()}});function s(...r){return e({props:r})}return s.with=e,s}function nh(o){return class extends HTMLElement{#t;#e;#n=new x2;#o=this.attachShadow({mode:"open"});constructor(){super();let t=Of(()=>{if(!this.isConnected)return;let e=this.#s();oe(e,this.#t.shadow),this.#t.doneRender()});this.#t=new s2(t,this,this.#o),this.#e=new g2(this.#t)}#s(){return this.#n.observe(()=>Y0.wrap(this.#e,()=>o()),this.#t.render)}render(){oe(this.#s(),this.#t.shadow),this.#t.doneRender()}connectedCallback(){this.#e.mounts.remountAll(),this.#t.render()}disconnectedCallback(){this.#e.mounts.unmountAll(),this.#n.clear()}}}function y2(o){return[b2(o),(...s)=>nh(()=>o(...s))]}function ne(o){let{scope:t,position:e}=Y0.increment();return Cf(t.values,e,o)}function mf(){return Y0.increment().scope.cx}function Ku(){let o=mf();if(!(o instanceof s2))throw new Error("this hook only works on shadow views (but was called in a light view)");return o}function Dp(){return Ku().host}function xf(o){let{scope:t}=Y0.increment();return ne(()=>t.mounts.mount(o))}function rh(){return Ku().shadow}function ch(o,t){_u(o,Gm(t))}function Gm(o){let t=[];if(Array.isArray(o)){let e=new Set(o.flat(1/0).reverse());for(let s of e)t.unshift(Af(s))}else o!==void 0&&t.push(Af(o));return t}function r2(...o){let t=rh();ne(()=>ch(t,o))}function Z0(o=""){let t=mf();ne(()=>{t instanceof s2&&t.host.setAttribute("view",o)})}function p2(o){return ne(()=>oc(o))}var Df=r2;function ih(o){return xf(()=>o)}function c2(o,t){return()=>Jm({hz:o,frames:t})}var Jm=b2(({hz:o,frames:t})=>{Z0("loading"),Df(Uf,Ym);let e=p2(0);return xf(()=>jf(async()=>{await zf(1e3/o);let s=e()+1;e(s>=t.length?0:s)})),t.at(e())}),Ym=ee`
18
18
  :host {
19
19
  font-family: monospace;
20
20
  white-space: pre;
21
21
  user-select: none;
22
22
  }
23
- `;var D=K(r=>(_t("error"),Ct(St,cn),typeof r=="string"?r:r instanceof Error?h`<strong>${r.name}:</strong> <span>${r.message}</span>`:"error")),cn=b`
23
+ `;var i2=b2(o=>(Z0("error"),Df(Uf,Zm),typeof o=="string"?o:o instanceof Error?I`<strong>${o.name}:</strong> <span>${o.message}</span>`:"error")),Zm=ee`
24
24
  :host {
25
25
  font-family: monospace;
26
26
  color: red;
27
27
  }
28
- `;function R(r,t){return(e,o)=>ho(e,{pending:r,err:t,ok:o})}var sd=R(j(10,[" "," ",". ",".. ","..."," .."," ."]),D);var ld=R(j(3,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),D);var md=R(j(10,["\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F311}","\u{1F311}","\u{1F311}"]),D);var yd=R(j(16,["|","/","-","\\"]),D);var Sd=R(j(20,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),D);var _o=r=>r;var Co=r=>r,Eo=r=>r;var ln=_o({looking:{horizontal:["accumulate","pointer.x"],vertical:["accumulate","pointer.y"]},moving:{forward:"KeyW",backward:"KeyS",leftward:"KeyA",rightward:"KeyD"},interactions:{use:"KeyE"}}),Mo=Eo({standard:{label:"\u2328\uFE0Fstandard",bindings:ln},gamer:{label:"\u{1F3AE}gamer",bindings:{looking:{horizontal:["*",["dt"],"gamepad.axis.3",100],vertical:["*",["dt"],"gamepad.axis.4",100]},moving:{forward:["remap",0,-1,0,1,"gamepad.axis.2"],backward:["remap",0,1,0,1,"gamepad.axis.2"],leftward:["remap",0,-1,0,1,"gamepad.axis.1"],rightward:["remap",0,1,0,1,"gamepad.axis.1"]},interactions:{use:"gamepad.1"}}},micro:{label:"\u{1F9A0}micro",bindings:{looking:{horizontal:["*",["dt"],["+","gamepad.1",["-","gamepad.4"]],100],vertical:["*",["dt"],["+","gamepad.2",["-","gamepad.3"]],100]},moving:{forward:["remap",0,-1,0,1,"gamepad.axis.2"],backward:["remap",0,1,0,1,"gamepad.axis.2"],leftward:["remap",0,-1,0,1,"gamepad.axis.1"],rightward:["remap",0,1,0,1,"gamepad.axis.1"]},interactions:{use:["*","gamepad.5","gamepad.6"]}}}});function Po({start:r,end:t}){if(C(r)&&C(t))return IDBKeyRange.bound(r,t,!1,!0);if(C(r))return IDBKeyRange.lowerBound(r,!1);if(C(t))return IDBKeyRange.upperBound(t,!0)}async function zo(r){return new Promise((t,e)=>{r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error)})}function Oo({db:r,storeName:t}){let e=o=>(async s=>{let n=r.transaction(t,o),i=n.objectStore(t),a=new Promise((c,l)=>{n.onabort=()=>l(n.error??new Error("transaction aborted")),n.oncomplete=()=>c(void 0)});try{let c=await s(i,zo);return n.commit(),await a,c}catch(c){try{n.abort()}catch{}throw c}});return{readonly:e("readonly"),readwrite:e("readwrite")}}var Ee=class{#t;constructor(t){this.#t=Oo(t)}async commit(t){return this.#t.readwrite(async e=>{for(let[o,s]of t)s===void 0?e.delete(o):e.put(s,o)})}async getMany(t){return this.#t.readonly((e,o)=>Promise.all(t.map(s=>o(e.get(s)))))}async*entries(t={}){t.limit!==0&&(yield*await this.#t.readonly(async(e,o)=>{let s=[],n=t.reverse?"prev":"next",i=e.openCursor(Po(t),n),a=await o(i);for(;a&&(s.push([a.key,a.value]),!(t.limit!==void 0&&s.length>=t.limit));)a.continue(),a=await o(i);return s}))}};var To=(r,t)=>r<t?-1:r>t?1:0;function Bo(r,{start:t,end:e}){return!(t!==void 0&&r<t||e!==void 0&&r>=e)}function*vr(r,t){if(r.limit===0)return;let e=t.filter(([o,s])=>s!==void 0&&Bo(o,r)).sort(([o],[s])=>To(o,s));r.reverse&&e.reverse(),yield*e.slice(0,r.limit??1/0)}var Me=class{#t=new Map;async commit(t){for(let[e,o]of t)o===void 0?this.#t.delete(e):this.#t.set(e,structuredClone(o))}async getMany(t){return t.map(e=>structuredClone(this.#t.get(e)))}async*entries(t={}){yield*vr(t,[...this.#t.entries()].map(([e,o])=>[e,structuredClone(o)]))}};async function jo(r,t=r){return{db:await new Promise((o,s)=>{let n=indexedDB.open(r,1);n.onblocked=()=>s(new Error("idb blocked")),n.onerror=()=>s(n.error),n.onupgradeneeded=()=>n.result.createObjectStore(t),n.onsuccess=()=>o(n.result)}),storeName:t}}var Pe=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e}set(t){return this.#e.set(this.#t,t)}delete(){return this.#e.delete(this.#t)}};var ze=class{kv;key;op;constructor(t,e){this.kv=t,this.key=e,this.op=new Pe(e,t.op)}async set(t){return this.kv.set(this.key,t)}async get(){return this.kv.get(this.key)}async has(){return await this.get()!==void 0}async need(){return k(await this.get(),`key not found "${this.key}"`)}async delete(){return this.kv.set(this.key,void 0)}};var Et=nt({divisor:".",delimiter:":",chunkSize:1024});function Zt(r){for(let t=r.length-1;t>=0;t--){let e=r.charCodeAt(t);if(e<65535)return r.slice(0,t)+String.fromCharCode(e+1)}}var Oe=class{#t;#e=[{}];constructor(t,e){if(this.#t=t,e.length){let o=e.join(Et.divisor),s=o+".",n=o+":";this.#e=[{start:n,end:Zt(n)},{start:s,end:Zt(s)}]}}async count(){let t=0;for(let e of this.#e)for await(let o of this.#t.entries(e))t++;return t}async clear(){let t=[];for(let e of this.#e)for await(let[o]of this.#t.entries(e))t.push([o,void 0]),t.length>=1024&&(await this.#t.commit(t),t=[]);t.length&&await this.#t.commit(t)}};var Te=class{#t;constructor(t){this.#t=t}set(t,e){return[this.#t.prefix(t),e]}delete(t){return[this.#t.prefix(t),void 0]}};var{divisor:pn,delimiter:hn}=Et,Be=class{#t;#e;constructor(t){let{scopes:e}=t;this.#t=e.join(pn)+hn,this.#e=Zt(this.#t)}prefix=t=>this.#t+t;unprefix=t=>t.slice(this.#t.length);scan=t=>{let{start:e,end:o,limit:s,reverse:n}=t;return{start:this.#t+(e??""),end:o===void 0?this.#e:this.#t+o,limit:s,reverse:n}}};function Do(r){let t=r.limit;if(t!==void 0){if(!Number.isInteger(t))throw new Error("scan limit must be integer");if(t<0)throw new Error("scan limit must be positive")}return r}function Lo(r){for(let t of r){if(t==="")throw new Error("invalid scope empty string");Ro(t,"."),Ro(t,":")}return r}function Ro(r,t){if(r.includes(t))throw new Error(`invalid scope "${r}" contains illegal "${t}"`)}var je=class r{op;subtree;#t;#e;#o;#r;constructor(t=new Me,e={}){this.#t=t,this.#r={strict:!1,scopes:[],...e},Lo(this.#r.scopes),this.#e=new Be(this.#r),this.op=new Te(this.#e),this.subtree=new Oe(this.#t,this.#r.scopes),this.#o=this.#r.strict?o=>JSON.parse(JSON.stringify(o)):o=>o}cell(t){return new ze(this,t)}scope(...t){return new r(this.#t,{...this.#r,scopes:[...this.#r.scopes,...t]})}async commit(t){await this.#t.commit(t.map(([e,o])=>[e,o===void 0?void 0:this.#o(o)]))}async set(t,e){return this.commit([this.op.set(t,e)])}async setMany(t){return this.commit(t.map(([e,o])=>this.op.set(e,o)))}async delete(...t){return this.commit(t.map(e=>this.op.delete(e)))}async getMany(t){return t=t.map(e=>this.#e.prefix(e)),(await this.#t.getMany(t)).map(e=>e===void 0?void 0:e)}async get(t){let[e]=await this.getMany([t]);return e}async has(t){return await this.get(t)!==void 0}async need(t){return k(await this.get(t),`key not found "${t}"`)}async needMany(t){let e=await this.getMany(t);for(let[o,s]of t.entries())k(e[o],`key not found "${s}"`);return e}async*entries(t={}){t=Do(this.#e.scan(t));for await(let[e,o]of this.#t.entries(t)){let s=this.#e.unprefix(e);o!==void 0&&(yield[s,o])}}[Symbol.asyncIterator](){return this.entries()}async*keys(t={}){for await(let[e]of this.entries(t))yield e}async*values(t={}){for await(let[,e]of this.entries(t))yield e}async count(t={}){let e=0;for await(let o of this.keys(t))e++;return e}async clear(t={}){let e=[];for await(let[o]of this.entries(t))e.push(this.op.delete(o)),e.length>=Et.chunkSize&&(await this.commit(e),e=[]);e.length&&await this.commit(e)}};function No(r){let e=r.reduce((a,{intents:c})=>a+8+c.byteLength,0),o=new ArrayBuffer(e),s=new DataView(o),n=new Uint8Array(o),i=0;for(let{playerId:a,intents:c}of r)s.setUint32(i,a,!1),i+=4,s.setUint32(i,c.byteLength,!1),i+=4,n.set(new Uint8Array(c),i),i+=c.byteLength;return o}function Re(r,t){let e=4+t.length*6,o=new ArrayBuffer(e),s=new DataView(o),n=0;s.setUint32(n,r,!1),n+=4;for(let i of t)s.setUint16(n,i.id,!1),n+=2,s.setFloat32(n,i.value,!1),n+=4;return o}function at(r){return!!(r===null||xt(r)||bt(r)||be(r))}function ct(r){let t=[];function e(o,s){if(at(o))t.push(s.join("."));else for(let[n,i]of Object.entries(o))e(i,[...s,n])}return e(r,["b"]),so(...t)}var Le=class{bindings;#t;#e=new vt;#o=new Vt;#r=new O;constructor(t){this.bindings=t,this.#t=ct(t)}get playerIds(){return[...this.#r.keys()]}get controllers(){return{unassigned:[...this.#o],assigned:new Map([...this.#r].map(([t,e])=>[t,[...e.controllers]]))}}createPlayer(){let t=this.#e.next();return this.#r.set(t,{controllers:new Vt}),t}deletePlayer(t){return this.#r.get(t)?.controllers.forEach(e=>this.#o.add(e)),this.#r.delete(t),this}add(t){return this.unplug(t),this}remove(t){return this.unplug(t),this.#o.delete(t),this}unplug(t){this.#o.add(t);for(let e of this.#r.values())e.controllers.delete(t);return this}plug(t,e){return e??=this.playerIds.at(-1)??this.createPlayer(),this.unplug(t),k(this.#r.get(e)).controllers.add(t),this.#o.delete(t),this}encode(t,e=performance.now()){let o=new Map,{controllers:s}=k(this.#r.get(t));for(let i of s)for(let a of i.evaluate(e)){let c=o.get(a.id)??0;o.set(a.id,c+a.value)}let n=[...o].filter(([,i])=>i!==0).map(([i,a])=>({id:i,value:a}));return Re(this.#t,n)}encodeAll(t=performance.now()){for(let o of this.#o)o.clear();let e=Array.from(this.#r.keys()).map(o=>({playerId:o,intents:this.encode(o,t)}));return No(e)}};function $r(r,t){let{presets:e,customs:o,fallback:s}=r.profiles;return t===void 0?s.profile:o.get(t)??e.get(t)??k(e.get(s.key))}async function Ne(r,t,e){let{kvs:o,controllers:s,assignments:n}=r;t.bindings=$r(r,e).bindings,n.set(t,e),await ye(s.get(t)?.handle,async i=>{r.preferences.set(i,e),await o.preferences.set(i,e)})}function Io(r,t){return ct(r)===ct(t)}var Ie=class{#t;constructor(t){this.#t=t}#e(t){if(!Io(t,this.#t.bindings))throw new Error("incompatible bindings")}get presets(){return[...this.#t.profiles.presets]}get customs(){return[...this.#t.profiles.customs]}isPreset(t){return this.#t.profiles.presets.has(t)}get(t){return $r(this.#t,t)}async create(t,e){let{kvs:o,profiles:s}=this.#t;this.#e(e.bindings),s.customs.set(t,e),await o.profiles.set(t,e),this.#t.subby.publish()}async clone(t,e){let{label:o,bindings:s}=this.get(e);await this.create(t,{basedOn:e,bindings:s,label:`${o} copy`})}async delete(t){let{kvs:e,assignments:o,profiles:{customs:s,fallback:n}}=this.#t;s.delete(t),await e.profiles.delete(t);for(let[i,a]of o)a===t&&await Ne(this.#t,i,n.key);this.#t.subby.publish()}async update(t,e){let{kvs:o,assignments:s,profiles:{customs:n}}=this.#t;e.bindings&&this.#e(e.bindings);let i=this.get(t),a={...structuredClone(i),...e};n.set(t,a);for(let[c,l]of s)l===t&&(c.bindings=a.bindings);await o.profiles.set(t,a),this.#t.subby.publish()}};function Ho({kv:r,presets:t}){let e=k(Object.keys(t)[0],"missing presets"),o=k(t[e]),s=o.bindings,n={presets:new O,customs:new O,fallback:{key:e,profile:o}};return Ht(n.presets,Object.entries(t)),{subby:U(),kv:r,presets:t,bindings:s,idCounter:new vt,profiles:n,controllers:new O,assignments:new O,preferences:new O,kvs:{profiles:r.scope("profiles"),preferences:r.scope("preferences")}}}var He=class{#t;constructor(t){this.#t=t}async assign(t,e){await Ne(this.#t,t,e),this.#t.subby.publish()}assignedProfileKeyOf(t){let{assignments:e}=this.#t;return e.get(t)??this.#t.profiles.fallback.key}};var Ve=class{#t;profiles;assignments;presets;constructor(t){this.#t=Ho(t),this.profiles=new Ie(this.#t),this.assignments=new He(this.#t),this.presets=t.presets}get on(){return this.#t.subby.on}#e(t){let{preferences:e,assignments:o,controllers:s}=this.#t,n=k(s.get(t)),i=o.get(t)??e.get(n.handle)??n.defaultProfileKey;t.bindings=this.profiles.get(i).bindings,o.set(t,i)}async load(){let{kvs:t,controllers:e,preferences:o,profiles:{customs:s}}=this.#t;s.clear(),Ht(s,await mr(t.profiles)),o.clear(),Ht(o,await mr(t.preferences));for(let n of e.keys())this.#e(n)}get controllers(){return[...this.#t.controllers.keys()]}get fallbackProfileKey(){return this.#t.profiles.fallback.key}meta(t){return this.#t.controllers.get(t)}attach(t,e){let o=this.#t.idCounter.next();this.#t.controllers.set(t,{...e,id:o}),this.#e(t)}detach(t){this.#t.controllers.delete(t),this.#t.assignments.delete(t)}};function Qt(r){let[t,e]=Object.entries(r)[0];return{key:t,profile:e}}async function Vo(r){let t=r.kv??new je(new Ee(await jo("tact","kv"))),e=r.broadcastChannel??new BroadcastChannel("tact"),{maxPlayers:o}=r,{bindings:s}=Qt(r.presets).profile,n=new Le(s),i=new Ve({...r,kv:t});return await i.load(),e.onmessage=()=>i.load(),i.on(()=>e.postMessage({})),Co({hub:n,controls:i,maxPlayers:o})}var kr=1024,Ue=class{dispose;#t;#e=[];constructor(t){this.#t=t,this.dispose=t.onSample(e=>{this.#e.push(e),this.#e.length>kr&&console.warn(`tact sampler exceeded limit ${kr}`),this.#e=xe(this.#e,kr)})}take(){this.#t.poll?.();let t=this.#e;return this.#e=[],t}};var{min:mn,max:fn,abs:gn,sign:bn,floor:Vf,ceil:Uf,pow:qf}=Math;function lt(r,t=0,e=1){return r=mn(r,e),r=fn(r,t),r}function xn(r,t,e,o){let n=(e-t)*r;return o!==void 0&&gn(n)>o&&(n=bn(n)*o),t+n}function yn(r,t,e){return(r-t)/(e-t)}function Uo(r,t,e,o=0,s=1,n=!1){let i=yn(r,t,e);return n&&(i=lt(i)),xn(i,o,s)}var qe=class r{x;y;constructor(t=0,e=0){this.x=t,this.y=e}static new(t=0,e=0){return new this(t,e)}static zero(){return new this}static fill(t){return new this(t,t)}static from(t){return Array.isArray(t)?new this(...t):new this(t.x,t.y)}static magnitudeSquared(t,e){return t*t+e*e}static magnitude(t,e){return Math.sqrt(this.magnitudeSquared(t,e))}static average(...t){return new this().add(...t).divBy(t.length)}static min(...t){return new this(Math.min(...t.map(e=>e.x)),Math.min(...t.map(e=>e.y)))}static max(...t){return new this(Math.max(...t.map(e=>e.x)),Math.max(...t.map(e=>e.y)))}static rotation(t){return new this(Math.cos(t),Math.sin(t))}dup(){return new this.constructor(this.x,this.y)}*[Symbol.iterator](){yield this.x,yield this.y}array(){return[this.x,this.y]}toJSON(){return this.array()}toString(){return`(${this.constructor.name} x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}fill(t){return this.x=t,this.y=t,this}zero(){return this.fill(0)}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}from(t){if(Array.isArray(t)){let[e,o]=t;this.x=e,this.y=o}else{let{x:e,y:o}=t;this.x=e,this.y=o}return this}magnitudeSquared(){return r.magnitudeSquared(this.x,this.y)}magnitude(){return r.magnitude(this.x,this.y)}rotation(){return Math.atan2(this.y,this.x)}equals_(t,e){return this.x===t&&this.y===e}equals(...t){return t.every(({x:e,y:o})=>this.equals_(e,o))}near_(t,e,o=1e-6){return Math.abs(this.x-t)<=o&&Math.abs(this.y-e)<=o}near({x:t,y:e},o=1e-6){return this.near_(t,e,o)}dot_(t,e){return this.x*t+this.y*e}dot({x:t,y:e}){return this.dot_(t,e)}distanceSquared_(t,e){return t=this.x-t,e=this.y-e,t*t+e*e}distanceSquared({x:t,y:e}){return this.distanceSquared_(t,e)}distance_(t,e){return Math.sqrt(this.distanceSquared_(t,e))}distance({x:t,y:e}){return this.distance_(t,e)}angleBetween_(t,e){let o=this.dot_(t,e),s=this.magnitude()*r.magnitude(t,e);if(s===0)return 0;let n=lt(o/s,-1,1);return Math.acos(n)}angleBetween({x:t,y:e}){return this.angleBetween_(t,e)}normalize(){return this.divBy(this.magnitude())}half(){return this.divBy(2)}double(){return this.mulBy(2)}abs(){return this.map(t=>Math.abs(t))}rotate(t){let{x:e,y:o}=this;return this.x=e*Math.cos(t)-o*Math.sin(t),this.y=e*Math.sin(t)+o*Math.cos(t),this}perpendicular(){let{x:t,y:e}=this;return this.x=-e,this.y=t,this}clampMagnitude(t){return this.magnitude()>t&&this.normalize().mulBy(t),this}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}map(t){return this.x=t(this.x,0),this.y=t(this.y,1),this}morph(t){let e=t(this);return e&&e!==this&&this.set(e),this}clamp(t={x:0,y:0},e={x:1,y:1}){return this.x=lt(this.x,t.x,e.x),this.y=lt(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=lt(this.x,t,e),this.y=lt(this.y,t,e),this}negate(){return this.map(t=>t*-1)}addBy(t){return this.x+=t,this.y+=t,this}subBy(t){return this.x-=t,this.y-=t,this}mulBy(t){return this.x*=t,this.y*=t,this}scale(t){return this.x*=t,this.y*=t,this}divBy(t){return t===0?this:(this.x/=t,this.y/=t,this)}add_(t,e){return this.x+=t,this.y+=e,this}add(...t){for(let{x:e,y:o}of t)this.add_(e,o);return this}sub_(t,e){return this.x-=t,this.y-=e,this}sub(...t){for(let{x:e,y:o}of t)this.sub_(e,o);return this}mul_(t,e){return this.x*=t,this.y*=e,this}mul(...t){for(let{x:e,y:o}of t)this.mul_(e,o);return this}div_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}div(...t){for(let{x:e,y:o}of t)this.div_(e,o);return this}lerp_(t,e,o){return this.x+=(t-this.x)*o,this.y+=(e-this.y)*o,this}lerp(t,{x:e,y:o}){return this.lerp_(t,e,o)}reflect_(t,e){let o=2*this.dot_(t,e);return this.x-=o*t,this.y-=o*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,o){let s=this.x-e,n=this.y-o,i=Math.cos(t),a=Math.sin(t);return this.x=i*s-a*n+e,this.y=a*s+i*n+o,this}rotateAroundPoint(t,{x:e,y:o}){return this.rotateAroundPoint_(t,e,o)}};function ut(r){return r!==0}function Sr(r,t){let e=o=>Sr(r,o);if(t===null)return 0;if(bt(t))return t;if(xt(t)){let o=r.latestValues.get(t)??0;return r.recentSamples.filter(s=>s.code===t).reduce((s,n)=>Math.abs(n.value)>Math.abs(s)?n.value:s,o)}else switch(t[0]){case"accumulate":{let o=t[1],s=0;for(let n of r.recentSamples)n.code===o&&(s+=n.value);return s}case"up":{let o=t[1],s=0,n=r.previousValues.get(o)??0;for(let i of r.recentSamples)i.code===o&&(ut(n)&&!ut(i.value)&&s++,n=i.value);return s}case"down":{let o=t[1],s=0,n=r.previousValues.get(o)??0;for(let i of r.recentSamples)i.code===o&&(!ut(n)&&ut(i.value)&&s++,n=i.value);return s}case"was":{let o=t[1];return r.previousValues.get(o)??0}case"since":{let o=t[1],s=r.previousValues.get(o)??0;return(r.latestValues.get(o)??0)-s}case"if":{let[,o,s,n]=t;return e(o)?e(s):C(n)?e(n):0}case"min":return Math.min(...t.slice(1).map(e));case"max":return Math.max(...t.slice(1).map(e));case"+":return t.slice(1).map(e).reduce((o,s)=>o+s,0);case"*":return t.slice(1).map(e).reduce((o,s)=>o*s,1);case"==":return+(e(t[1])===e(t[2]));case"!=":return+(e(t[1])!==e(t[2]));case">":return+(e(t[1])>e(t[2]));case"<":return+(e(t[1])<e(t[2]));case">=":return+(e(t[1])>=e(t[2]));case"<=":return+(e(t[1])<=e(t[2]));case"!":return+(e(t[1])===0);case"!!":return+(e(t[1])!==0);case"-":{let[,o,...s]=t;if(s.length===0)return-e(o);let n=e(o);for(let i of s)n-=e(i);return n}case"clamp":{let[,o,s,n]=t,i=e(n);return Math.min(s===null?1/0:e(s),Math.max(o===null?-1/0:e(o),i))}case"remap":{let[o,s,n,i,a]=t.slice(1).map(e);return Uo(a,o,s,n,i)}case"dt":return r.dt;case"held":{let[,o,s]=t,n=ut(e(s)),i=r.holding.get(t);return n&&!i&&(i={start:r.clock.time},r.holding.set(t,i)),!n&&i&&(i=void 0,r.holding.delete(t)),i&&r.clock.time-i.start>=o?1:0}case"taps":{let[,o,s,n]=t,i=e(n),a=r.clock.time,c=yt(r.tapping,t,()=>({events:[]}));for(let l=0;l<i;l++)c.events.push(a);return c.events=xe(c.events.filter(l=>l>=a-s),128),c.events.length>=o?(c.events=[],1):0}case"mod":{let[,...o]=t,s=l=>ut(r.latestValues.get(l)??0),n=s("ShiftLeft")||s("ShiftRight"),i=s("ControlLeft")||s("ControlRight"),a=s("AltLeft")||s("AltRight"),c=s("MetaLeft")||s("MetaRight");return o.includes("shift")!==n||o.includes("ctrl")!==i||o.includes("alt")!==a||o.includes("meta")!==c?0:1}default:throw new Error("unknown expression")}}var We=class{time;since=0;last;constructor(t=performance.now()){this.time=t}update(t=performance.now()){this.since=t-(this.time??t),this.last=this.time,this.time=t}};var Fe=class{dt=0;clock=new We;recentSamples=[];latestValues=new Map;previousValues=new Map;holding=new Map;tapping=new Map};function qo(){return{value:0,was:0,sum:0}}function Ar(r){let t=ct(r),e=[],o=[];function s(i){if(at(i)){let a=qo();return e.push(a),o.push(i),a}else return fr(i,s)}let n=s(r);return{hash:t,inputs:n,inputList:e,rootList:o}}var Mt=class{#t;#e;#o;#r;constructor(t){this.#e=nt(structuredClone(t.bindings)),this.#o=Ar(this.#e),this.#t=new Ue(t.source),this.#r=new Fe}get bindings(){return this.#e}set bindings(t){let e=nt(structuredClone(t)),o=Ar(e),s=this.#o.hash;if(o.hash!==s)throw new Error("incompatible bindings");this.#e=e,this.#o.rootList=o.rootList}*evaluate(t=performance.now()){let e=this.#t.take();this.#r.clock.update(t),this.#r.recentSamples=e,this.#r.dt=this.#r.clock.since/1e3;for(let{code:o,value:s}of e)this.#r.latestValues.set(o,s);for(let[o,s]of this.#o.rootList.entries()){let n=Sr(this.#r,s);n!==0&&(yield{id:o,value:n})}for(let{code:o,value:s}of e)this.#r.previousValues.set(o,s)}encode(t=performance.now()){return Re(this.#o.hash,[...this.evaluate(t)])}clear(){this.#t.take()}dispose(){return this.#t.dispose()}};var Ge=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function Wo(r,t){let e=r;return()=>{let o=t();return o!=null&&(e=o),e}}function Ke(r){let t=new Map;function e(){o(),s()}function o(){for(let i of navigator.getGamepads())if(i?.connected&&!t.has(i.index)){let a=()=>navigator.getGamepads()[i.index],c=new Ge(Wo(i,a)),l=r(c);t.set(i.index,{pad:c,dispose:l})}}function s(){for(let[i,{pad:a,dispose:c}]of t)navigator.getGamepads()[a.gamepad.index]?.connected||(c(),t.delete(i))}e();let n=E(window,{gamepadconnected:e,gamepaddisconnected:e});return()=>{n();for(let{dispose:i}of t.values())i();t.clear()}}var L=class{onSample=U();dispose=V()};var Pt=class extends L{pad;#t=new Map;constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}poll(){let t=this.gamepad;this.#o(t),this.#r(t)}#e(t,e){let o=this.#t.get(t)??0;e!==o&&(this.#t.set(t,e),this.onSample.publish({code:t,value:e}))}#o(t){let e=0;for(let[o,s]of t.buttons.entries()){let n=s.value;this.#e(`gamepad.${o+1}`,n),e=Math.max(e,n)}this.#e("gamepad.any",e>=.9?1:0)}#r(t){for(let[e,o]of t.axes.entries())this.#e(`gamepad.axis.${e+1}`,o)}};function Fo(r,t){return Ke(e=>{let o=new Pt(e),s=new Mt({source:o,bindings:r.bindings});r.plug(s);let n=t?.(s,o);return()=>{r.remove(s),n?.()}})}var Je=class extends L{#t;constructor(...t){super(),this.#t=t;for(let e of t)this.dispose.schedule(e.onSample(o=>this.onSample.publish(o)))}poll(){for(let t of this.#t)t.poll?.()}};var Ze=class{$hex=S("");clear=to(250,()=>{this.$hex.set("")});update(t){this.$hex(ge(new Uint8Array(t))),this.clear()}};function zt(r){return`pointer.${r+1}`}var Qe=class extends L{client=new qe;constructor(t=window){super(),this.dispose.schedule(E(t,this.#t))}#t={pointerdown:t=>{this.onSample.publish({code:zt(t.button),value:1})},pointerup:t=>{this.onSample.publish({code:zt(t.button),value:0})},pointermove:({clientX:t,clientY:e,movementX:o,movementY:s})=>{this.client.set_(t,e),o&&this.onSample.publish({code:"pointer.x",value:o}),s&&this.onSample.publish({code:"pointer.y",value:s})},wheel:({deltaX:t,deltaY:e})=>{t&&this.onSample.publish({code:"pointer.wheel.x",value:t}),e&&this.onSample.publish({code:"pointer.wheel.y",value:e})}}};var Xe=class extends L{#t=new Set;constructor(t=window){super(),this.dispose.schedule(E(t,this.#e)),this.dispose.schedule(E(window,this.#o))}#e={keydown:t=>{t.repeat||(this.#t.size===0&&this.onSample.publish({code:"keyboard.any",value:1}),this.onSample.publish({code:t.code,value:1}),this.#t.add(t.code))},keyup:t=>{this.onSample.publish({code:t.code,value:0}),this.#t.delete(t.code),this.#t.size===0&&this.onSample.publish({code:"keyboard.any",value:0})}};#o={blur:()=>{for(let t of this.#t)this.onSample.publish({code:t,value:0});this.#t.size&&this.onSample.publish({code:"keyboard.any",value:0}),this.#t.clear()}}};var Go=q`@layer core {
28
+ `;function a2(o,t){return(e,s)=>Jd(e,{pending:o,err:t,ok:s})}var c5=a2(c2(10,[" "," ",". ",".. ","..."," .."," ."]),i2);var u5=a2(c2(3,["\u{1F30E}","\u{1F30F}","\u{1F30D}"]),i2);var m5=a2(c2(10,["\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F311}","\u{1F311}","\u{1F311}"]),i2);var w5=a2(c2(16,["|","/","-","\\"]),i2);var $5=a2(c2(20,[":....",":....","::...",".::..","..::.","...::","....:","....:","...::","..::.",".::..","::..."]),i2);var lh=o=>o;var fh=o=>o,uh=o=>o;var Qm=lh({looking:{horizontal:["accumulate","pointer.x"],vertical:["accumulate","pointer.y"]},moving:{forward:"KeyW",backward:"KeyS",leftward:"KeyA",rightward:"KeyD"},interactions:{use:"KeyE"}}),vh=uh({standard:{label:"\u2328\uFE0Fstandard",bindings:Qm},gamer:{label:"\u{1F3AE}gamer",bindings:{looking:{horizontal:["*",["dt"],"gamepad.axis.3",100],vertical:["*",["dt"],"gamepad.axis.4",100]},moving:{forward:["remap",0,-1,0,1,"gamepad.axis.2"],backward:["remap",0,1,0,1,"gamepad.axis.2"],leftward:["remap",0,-1,0,1,"gamepad.axis.1"],rightward:["remap",0,1,0,1,"gamepad.axis.1"]},interactions:{use:"gamepad.1"}}},micro:{label:"\u{1F9A0}micro",bindings:{looking:{horizontal:["*",["dt"],["+","gamepad.1",["-","gamepad.4"]],100],vertical:["*",["dt"],["+","gamepad.2",["-","gamepad.3"]],100]},moving:{forward:["remap",0,-1,0,1,"gamepad.axis.2"],backward:["remap",0,1,0,1,"gamepad.axis.2"],leftward:["remap",0,-1,0,1,"gamepad.axis.1"],rightward:["remap",0,1,0,1,"gamepad.axis.1"]},interactions:{use:["*","gamepad.5","gamepad.6"]}}}});function Wu(o){return Number.parseInt(o.slice(0,8),16)}function ph(o){let e=o.reduce((i,{intents:a})=>i+8+a.byteLength,0),s=new ArrayBuffer(e),r=new DataView(s),n=new Uint8Array(s),c=0;for(let{playerId:i,intents:a}of o)r.setUint32(c,i,!1),c+=4,r.setUint32(c,a.byteLength,!1),c+=4,n.set(new Uint8Array(a),c),c+=a.byteLength;return s}function Xu(o,t){let e=4+t.length*6,s=new ArrayBuffer(e),r=new DataView(s),n=0;r.setUint32(n,o,!1),n+=4;for(let c of t)r.setUint16(n,c.id,!1),n+=2,r.setFloat32(n,c.value,!1),n+=4;return s}var e3=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,o3=(o=e3)=>{if(!o)throw new Error("big-endian platforms are unsupported")};o3();function Hf(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in o&&o.BYTES_PER_ELEMENT===1}function Li(o,t=""){let e=t&&`"${t}" `;if(typeof o!="number")throw new TypeError(`${e}expected number, got ${typeof o}`);if(!Number.isSafeInteger(o)||o<0)throw new RangeError(`${e}expected integer >= 0, got ${o}`)}function Q0(o,t,e=""){let s=Hf(o),r=o?.length,n=t!==void 0,c=e&&`"${e}" `;if(!s)throw new TypeError(c+"expected Uint8Array, got type="+typeof o);if(n&&r!==t)throw new RangeError(c+"expected Uint8Array of length "+t+", got length="+r);return o}function dh(o){return new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}function hh(o){return new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4))}function mh(...o){for(let t=0;t<o.length;t++)o[t].fill(0)}function gt(o,t,e,s,r){if(!(r<=0))if(r<=64)for(let n=0;n<r;n++)o[t+n]=e[s+n];else o.set(e.subarray(s,s+r),t)}function Ju(o){return Uint8Array.from(Q0(o))}function n3(o,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new TypeError("options must be object or undefined");return Object.assign(o,t)}function Yu(o){let t=o,e=r=>{let n=!1,c=-1,i=0,a=0,u,v=H=>{},m=H=>{},$=async()=>{};return{save:()=>{!r||!a||(u||(u=new Uint8Array(a)),v(u))},restore:()=>{!r||!u||m(u)},nextTick:()=>$(),onEnd:()=>{if(!(c<0)&&i!==c)throw new Error(`done (${i}) < progressTotal(${c})`)},setup:H=>{let ht=H;if(n)throw new Error("setup already called");if(n=!0,!r){Li(ht.total,"total"),c=ht.total;let R=ht.onProgress;if(R!==void 0&&typeof R!="function")throw new Error("onProgress must be a function");if(!R)return(N=1)=>(i+=N,!1);let U=Math.max(Math.floor(c/1e4),1);return(N=1)=>(i+=N,(!(i%U)||i===c)&&R(c?i/c:1),!1)}let bt={...ht};bt.asyncTick===void 0&&delete bt.asyncTick;let{asyncTick:f2,onProgress:vt,stateBytes:ta,save:A,restore:y,nextTick:V,total:nt}=n3({asyncTick:10},bt);Li(f2,"asyncTick"),Li(nt,"total"),c=nt;for(let[R,U]of Object.entries({onProgress:vt,save:A,restore:y,nextTick:V}))if(U!==void 0&&typeof U!="function")throw new Error(`${R} must be a function`);if(ta!==void 0&&Li(ta,"stateBytes"),ta!==void 0&&(a=ta),(A!==void 0||y!==void 0)&&!a)throw new Error("stateBytes must be a positive integer when save/restore is used");A!==void 0&&(v=A),y!==void 0&&(m=y),V!==void 0&&($=V);let J=()=>!1;if(r){let R=Date.now();J=()=>{let U=Date.now()-R;return U>=0&&U<f2?!1:(R+=U,!0)}}let w=Math.max(Math.floor(c/1e4),1),k=(R=1)=>(i+=R,J());return vt&&(k=(R=1)=>(i+=R,vt&&(!(i%w)||i===nt)&&vt(nt?i/nt:1),J())),k}}},s=(...r)=>{let n=!1,c=-1,i=0,a=(m=>{let $=m;if(n)throw new Error("setup already called");n=!0,Li($.total,"total"),c=$.total;let H=$.onProgress;if(H!==void 0&&typeof H!="function")throw new Error("onProgress must be a function");if(!H)return(bt=1)=>(i+=bt,!1);let ht=Math.max(Math.floor(c/1e4),1);return(bt=1)=>(i+=bt,(!(i%ht)||i===c)&&H(c?i/c:1),!1)});a.isAsync=!1;let u=t(a,...r),v=u.next();for(;!v.done;)v=u.next();if(c>=0&&i!==c)throw new Error(`done (${i}) < progressTotal(${c})`);return v.value};return s.async=async(...r)=>{let{setup:n,save:c,restore:i,onEnd:a,nextTick:u}=e(!0),v=n;v.isAsync=!0;let m=t(v,...r),$=m.next();for(;!$.done;)c(),await u(),i(),$=m.next();return a(),$.value},s}var s3=(o,t,e,s)=>{let r=Hf(o)?{}:o||{};r.dkLen!==void 0&&Li(r.dkLen,"opts.dkLen"),r.outPos!==void 0&&Li(r.outPos,"opts.outPos");let n=(r.dkLen===void 0?e:r.dkLen)|0;if(!s&&n>e)throw new RangeError(`"opts.dkLen" expected <= ${e}, got ${n}`);if(Array.isArray(r.out)){if(r.outPos!==void 0&&r.outPos!==0)throw new Error("outPos is not supported with output view arrays");if(r.out.length!==t)throw new RangeError("output array length must match messages length");for(let u=0;u<t;u++)Q0(r.out[u],n,"output");return{dkLen:n,out:r.out}}r.out!==void 0&&Q0(r.out,void 0,"output");let c=r.out||new Uint8Array(n*t),i=(r.outPos===void 0?0:r.outPos)|0;if(i<0||i+n*t>c.length)throw new RangeError("out/outPos too small");let a=[];for(let u=0;u<t;u++){let v=i+u*n;a.push(c.subarray(v,v+n))}return{dkLen:n,out:a}},r3=Symbol("hash_impl_brand"),c3=new WeakSet;function xh(o,t,e){let s=t,{outputLen:r,blockLen:n,suffix:c=0,init:i,canXOF:a,oid:u}=s,v=s.outputBlockLen?s.outputBlockLen:s.outputLen,m,$,H,ht,bt,f2,vt,ta,A=!1;function y(){if(A)throw new Error("second lazyInit call");let w=o();A=!0;let{processBlocks:k,processOutBlocks:R,padding:U,reset:N}=w,j=w.segments.buffer,ct=w.segments.state_chunks[0],no=w.segments.state_chunks,st=w.segments.state_chunks.length,O=Math.floor(j.length/n),tt=O-2;if(tt<1)throw new Error("wrong chunks");let P=Math.floor(j.length/v),rt=new WeakSet;function K(d,f=0){let l=d;N(f,1,0,v,P);let p=0,h=r;if(l.dkLen!==void 0&&(Li(l.dkLen,"opts.dkLen"),h=l.dkLen|0,!a&&h>r))throw new RangeError(`"opts.dkLen" expected <= ${r}, got ${h}`);if(i){let x=i(f,O,w,V,l);x&&x.blocks!==void 0&&(p=x.blocks),x&&x.outputLen!==void 0&&(h=x.outputLen)}return{blocks:p,outputLen:h}}function D(d,f){if(f>0){if(d.length===0){let p=U(0,f*n,O,0,n,c);k(0,1,f+p,O,n,1,0,p);return}k(0,1,f,O,n,0,0,0)}let l=0;do{let p=Math.min(d.length-l,tt*n);gt(j,0,d,l,p);let h=l+p==d.length,x=Math.ceil(p/n),b=x*n-p,g=0;h&&(g=U(0,p,O,b,n,c),x+=g),k(0,1,x,O,n,h?1:0,b,g),l+=p}while(l<d.length)}function G(d,f,l){let p=tt*n|0,h=l?l.buf.length:0,x=h;for(let _=0;_<d.length;_++)x+=d[_].length;if(f>0){if(x===0){let _=U(0,f*n,O,0,n,c);k(0,1,f+_,O,n,1,0,_);return}k(0,1,f,O,n,0,0,0)}let b=0,g=0,L=0;for(;b<x;){let _=Math.min(x-b,p)|0,z=0;if(l&&b<h){let C=Math.min(_,h-b)|0;gt(j,z,l.buf,b,C),z+=C}for(;z<_;){let C=d[g],W=C.length-L|0,M=(_-z<W?_-z:W)|0;gt(j,z,C,L,M),z+=M,L+=M,L===C.length&&(g++,L=0)}let B=b+_===x,S=Math.ceil(_/n)|0,E=S*n-_|0,T=0;B&&(T=U(0,_,O,E,n,c)|0,S=S+T|0),k(0,1,S,O,n,B?1:0,E,T),b+=_}}function Y(d,f,l,p,h,x){let b=h-2;if(b<1)throw new Error("wrong chunks");let g=x?x.buf.length:0,L=d[f].length,_=g+L,z=(S,E,T,C)=>{let W=0;if(x&&T<g){let M=Math.min(C,g-T);gt(j,S,x.buf,T,M),W+=M}W<C&&gt(j,S+W,E,T+W-g,C-W)};if(p>0){if(_===0){let S=U(0,p*n,h,0,n,c);for(let E=0;E<l;E++)if(U(E,p*n,h,0,n,c)!==S)throw new Error("different padding across batch");k(0,l,p+S,h,n,1,0,S);return}k(0,l,p,h,n,0,0,0)}let B=0;do{let S=Math.min(_-B,b*n);for(let M=0;M<l;M++)z(M*h*n,d[f+M],B,S);let E=B+S==_,T=Math.ceil(S/n),C=T*n-S,W=0;if(E){W=U(0,S,h,C,n,c);for(let M=1;M<l;M++)if(U(M,S,h,C,n,c)!==W)throw new Error("parallel batch: different padding");T+=W}k(0,l,T,h,n,E?1:0,C,W),B+=S}while(B<_)}function et(d={},f,l=r){let p=d;p.dkLen!==void 0&&Li(p.dkLen,"opts.dkLen"),p.outPos!==void 0&&Li(p.outPos,"opts.outPos"),p.out!==void 0&&Q0(p.out,void 0,"output"),f!==void 0&&Li(f,"xof.bytes");let h=f!==void 0?f:(p.dkLen===void 0?l:p.dkLen)|0;if(!a&&h>r)throw new RangeError(`"opts.dkLen" expected <= ${r}, got ${h}`);let x=p.out||new Uint8Array(h),b=(p.outPos===void 0?0:p.outPos)|0;if(b<0||b+h>x.length)throw new RangeError("out/outPos too small");return{dkLen:h,out:x,outPos:b}}function it(d={},f=et(d)){let{dkLen:l,out:p,outPos:h}=f,x=tt|0,b=(l+v-1)/v|0,g=0,L=b,_=0;for(;L>0;){let z=L>x?x:L;R(0,1,z,P,v,L===z?1:0);let S=z*v,E=l-g,T=E<S?E:S;gt(p,h+g,j,0,T),_=Math.max(_,T,z*v),g+=T,L-=z}return{maxWritten:_,out:p}}function ut(d,f,l,p){let h=f,{dkLen:x,out:b}=l,g=0,L=h|0,_=(x+v-1)/v|0,z=0,B=_;for(;B>0;){let S=B>L?L:B;R(0,d,S,f,v,B===S?1:0);let T=S*v,C=x-z,W=C<T?C:T;for(let M=0;M<d;M++)gt(b[p+M],z,j,M*v*f,W),g=Math.max(g,W,T);z+=W,B-=S}return{out:b,maxWritten:g}}let F=d=>{if(!Hf(d))throw new Error("prefixState is not from this hash");if(d.length<ct.length)throw new Error("prefixState is too short");if(d.length>=ct.length+n)throw new Error("prefixState is too long");if(!rt.has(d))throw new Error("prefixState is not from this hash");return d},Z=(d={})=>{let f=d;if(f.prefixState===void 0)return;let l=F(f.prefixState);return{state:l.subarray(0,ct.length),buf:l.subarray(ct.length)}};class Q{canXOF;blockLen;outputLen;buf;pos;state;finished;destroyed;constructor(f){if(f.streamBufLen%n||f.streamBufLen<n)throw new Error("wrong streamBufLen");if(this.finished=!1,this.destroyed=!1,this.buf=new Uint8Array(f.streamBufLen),this.pos=0,f.blocks!==void 0){if(f.blocks*n>this.buf.length)throw new Error("too much blocks");gt(this.buf,0,j,0,f.blocks*n),this.pos=f.blocks*n}this.canXOF=!!a,this.blockLen=n,this.outputLen=f.outputLen,this.state=Ju(ct),N(0,1,0,v,P)}restoreState(){gt(ct,0,this.state,0,ct.length)}saveState(){this.state=Ju(ct)}update(f){if(Q0(f),this.destroyed)throw new Error("Hash instance has been destroyed");if(this.finished)throw new Error("Hash#digest() has already been called");let l=0,p=Math.ceil((this.pos+f.length)/n)-1;if(p>0){this.restoreState();let x=Math.min(tt,p),b=x*n-this.pos;for(gt(j,0,this.buf,0,this.pos),gt(j,this.pos,f,l,b),this.pos=0,l+=b,k(0,1,x,O,n,0,0,0),p-=x;l<f.length&&p;){let g=Math.min(tt,p);gt(j,0,f,l,g*n),k(0,1,g,O,n,0,0,0),p-=g,l+=g*n}this.saveState(),N(0,1,0,v,P)}let h=f.length-l;return h&&(gt(this.buf,this.pos,f,l,h),this.pos+=h),this}finish(){if(this.finished)throw new Error("Hash#digest() has already been called");this.restoreState(),this.finished=!0;let f=!0,l=this.pos,p=Math.ceil(l/n);gt(j,0,this.buf,0,this.pos);let h=p*n-l,x=0;return f&&(x=U(0,l,O,h,n,c),p+=x),k(0,1,p,O,n,1,h,x),this.pos=v,p*n}digest(f={}){if(this.destroyed)throw new Error("Hash instance has been destroyed");let l=et(f,void 0,this.outputLen);this.finish();let{out:p,maxWritten:h}=it(f,l);return this.destroy(),N(0,1,h,v,P),p}destroy(){this.destroyed=!0,this.state.fill(0),this.buf.fill(0)}xof(f,l={}){if(!a)throw new Error("XOF is not possible for this instance");if(this.destroyed)throw new Error("Hash instance has been destroyed");let p=et(l,f);this.finished||(this.finish(),this.saveState()),this.restoreState();let{out:h,outPos:x}=p;for(let b=0;b<f;){this.pos>=v&&(R(0,1,1,P,v,0),gt(this.buf,0,j,0,v),this.pos=0);let g=(v-this.pos<f-b?v-this.pos:f-b)|0;gt(h,x+b|0,this.buf,this.pos,g),this.pos=this.pos+g|0,b=b+g|0}return this.saveState(),N(0,1,0,v,P),h}digestInto(f){if(Q0(f,void 0,"output"),f.length<this.outputLen)throw new RangeError("digestInto() expects output buffer of length at least "+this.outputLen);this.digest({out:f.subarray(0,this.outputLen),dkLen:this.outputLen})}xofInto(f){return this.xof(f.length,{out:f})}_cloneInto(f){if(this.destroyed)throw new Error("Hash instance has been destroyed");let l=f||new this.constructor({streamBufLen:this.buf.length});if(!(l instanceof Q))throw new Error("wrong instance");if(l.buf.length!==this.buf.length)throw new Error("wrong buffer length");return l.blockLen=this.blockLen,l.outputLen=this.outputLen,l.canXOF=this.canXOF,this.pos&&gt(l.buf,0,this.buf,0,this.pos),l.pos=this.pos|0,l.state=Ju(this.state),l.finished=!!this.finished,l.destroyed=!!this.destroyed,l}clone(){return this._cloneInto()}exportState(){if(this.destroyed)throw new Error("Hash instance has been destroyed");if(this.finished)throw new Error("Hash#digest() has already been called");this.pos===n&&(this.restoreState(),gt(j,0,this.buf,0,n),k(0,1,1,O,n,0,0,0),this.saveState(),this.pos=0,this.buf.fill(0),N(0,1,0,v,P));let f=new Uint8Array(this.state.length+this.pos);return f.set(this.state),this.pos&&f.set(this.buf.subarray(0,this.pos),this.state.length),rt.add(f),f}}let at=(d,f={})=>{Q0(d);let l=et(f),{blocks:p}=K(f);D(d,p);let{out:h,maxWritten:x}=it(f,l);return N(0,1,x,v,P),h},X=(d,f={})=>{if(!Array.isArray(d))throw new Error("expected array of messages");let l=0;for(let g of d)Q0(g),l+=g.length;let p=Z(f);if(p&&l===0)throw new Error("prefixState requires a non-empty message");let h=et(f);if(p)N(0,1,0,v,P),gt(ct,0,p.state,0,p.state.length),G(d,0,p);else{let{blocks:g}=K(f);G(d,g)}let{out:x,maxWritten:b}=it(f,h);return N(0,1,b,v,P),x},ot=(d,f={})=>{if(!Array.isArray(d))throw new Error("expected array of messages");let l=Z(f);if(l&&d.length===0)throw new Error("prefixState requires a non-empty message");let p=Math.floor(j.length/(n*3)),h=Math.floor(j.length/v);for(let b=0;b<d.length;b+=st){let g=Math.min(st,d.length-b,p,h);for(let L=0;L<g;L++)if(!Hf(d[b+L]))throw new Error(`expected Uint8Array, got type=${typeof d[b+L]}`);if(l&&d[b].length===0)throw new Error("prefixState requires a non-empty message");for(let L=1;L<g;L++)if(d[b+L].length!==d[b].length)throw new Error("different sizes inside chunk")}let x=s3(f,d.length,r,a);for(let b=0;b<d.length;b+=st){let g=Math.min(st,d.length-b,p,h),L=Math.floor(j.length/(n*g)),_=Math.floor(j.length/(v*g)),z=0;if(l){N(0,g,0,v,_);for(let S=0;S<g;S++)gt(no[S],0,l.state,0,l.state.length)}else if(i){let S=i(0,L,w,V,f);S&&S.blocks!==void 0&&(z=S.blocks);for(let E=0;E<g;E++){let T=i(E,L,w,V,f);if((T&&T.blocks)!==(S&&S.blocks))throw new Error("inconsistent init blocks inside parallel group")}}Y(d,b,g,z,L,l);let{maxWritten:B}=ut(g,_,x,b);N(0,g,B,v,_)}return x.out},lt=(d,f,l)=>{let p=d,h=l;return p.isAsync?p({total:f,asyncTick:h?.asyncTick,onProgress:h?.onProgress,nextTick:h?.nextTick}):h?.onProgress?p({total:f,onProgress:h.onProgress}):(p({total:0}),x=>!1)},pt=Yu(function*(d,f,l={}){let p=d;if(!p.isAsync&&!l?.onProgress)return at(f,l);let h=lt(p,f.length,l),x=at(f,l);return(p.isAsync||l?.onProgress)&&h(f.length)&&(yield),x}),dt=Yu(function*(d,f,l={}){let p=d;if(!p.isAsync&&!l?.onProgress)return X(f,l);let h=0;for(let g of f)h+=g.length;let x=lt(p,h,l),b=X(f,l);return(p.isAsync||l?.onProgress)&&x(h)&&(yield),b}),_t=Yu(function*(d,f,l={}){let p=d;if(!p.isAsync&&!l?.onProgress)return ot(f,l);let h=0;for(let g of f)h+=g.length;let x=lt(p,h,l),b=ot(f,l);return(p.isAsync||l?.onProgress)&&x(h)&&(yield),b});m=(d,f={})=>at(d,f),$=async(d,f)=>{let l=f;return l?l.asyncTick!==void 0||l.onProgress!==void 0||l.nextTick!==void 0?pt.async(d,l):at(d,l):at(d,{})},H=(d,f={})=>X(d,f),ht=async(d,f)=>{let l=f;return l?l.asyncTick!==void 0||l.onProgress!==void 0||l.nextTick!==void 0?dt.async(d,l):X(d,l):X(d,{})},bt=(d,f={})=>ot(d,f),f2=async(d,f)=>{let l=f;return l?l.asyncTick!==void 0||l.onProgress!==void 0||l.nextTick!==void 0?_t.async(d,l):ot(d,l):ot(d,{})},vt=(d={})=>{let f=d;N(0,1,0,v,P);let{blocks:l,outputLen:p}=K(f);return new Q({...f,streamBufLen:n,blocks:l,outputLen:p})},ta=d=>{let f=F(d);mh(f),rt.delete(f)}}m=(w,k)=>(y(),m(w,k)),$=(w,k)=>(y(),$(w,k)),H=(w,k)=>(y(),H(w,k)),ht=(w,k)=>(y(),ht(w,k)),bt=(w,k)=>(y(),bt(w,k)),f2=(w,k)=>(y(),f2(w,k)),vt=w=>(y(),vt(w)),ta=w=>(y(),ta(w));let V=((w,k={})=>m(w,k)),nt=(w,k={})=>H(w,k);Object.assign(nt,{async:(w,k)=>ht(w,k)});let J=(w,k={})=>bt(w,k);return Object.assign(J,{async:(w,k)=>f2(w,k)}),Object.assign(V,{async:(w,k)=>$(w,k),chunks:nt,parallel:J,create:(w={})=>vt(w),cleanState:w=>ta(w),getPlatform:()=>e,getDefinition:()=>s,canXOF:!!a,outputLen:r,blockLen:n,oid:u}),Object.defineProperty(V,r3,{value:!0,enumerable:!1}),c3.add(V),Object.freeze(V)}var i3=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var Zu={CHUNK_START:1,CHUNK_END:2,PARENT:4,ROOT:8,KEYED_HASH:16,DERIVE_KEY_CONTEXT:32,DERIVE_KEY_MATERIAL:64},a3=i3.slice(),gh=dh(a3);var bh=Object.freeze({blockLen:64,outputBlockLen:64,outputLen:32,chunks:10*1024*16,canXOF:!0,init(o,t,e,s,r={}){let{key:n,context:c,_keyContext:i}=r;r.dkLen!==void 0&&Li(r.dkLen,"opts.dkLen");let a=0,u=gh;if(n!==void 0){if(Q0(n,32,"key"),c!==void 0||i!==void 0)throw new Error('Only "key" or "context" can be specified at same time');u=n,a=Zu.KEYED_HASH}else if(i!==void 0){if(c!==void 0||n!==void 0)throw new Error('Only "key" or "context" can be specified at same time');a=Zu.DERIVE_KEY_CONTEXT}else if(c!==void 0){if(Q0(c,void 0,"context"),i!==void 0||n!==void 0)throw new Error('Only "key" or "context" can be specified at same time');if(i!==void 0&&typeof i!="boolean")throw new Error("wrong type for _keyContext");u=s(c,{dkLen:32,_keyContext:!0}),a=Zu.DERIVE_KEY_MATERIAL}e.segments["state.iv_chunks"][o].set(u),e.segments["state.state_chunks"][o].set(u),hh(e.segments["state.flags_chunks"][o])[0]=a}});function f3(o={},t){let e={env:{}};o={...e,...o,env:{...e.env,...o.env}};let s=new ArrayBuffer(15730784);if(!(s instanceof ArrayBuffer))throw new Error("wrong buffer");let r=new Uint8Array(s),n=new Int32Array(s);function c(A,y,V){let nt=32+Math.imul(2144,A)|0,J=n[(nt>>>0)+0>>>2],w=4+nt|0,k=n[(w>>>0)+0>>>2],R=4+w|0,U=n[(R>>>0)+0>>>2],N=4+R|0,j=n[(N>>>0)+0>>>2],ct=4+N|0,no=n[(ct>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Jr=Xr+vr|0,Yr=(Jr^rr)>>>12|(Jr^rr)<<20,Zr=(C+Yr|0)+Gr|0,bi=(Zr^Xr)>>>8|(Zr^Xr)<<24,Qr=bi+Jr|0,yi=(96+(V<<5)|0)+Math.imul(2144,A)|0;n[(yi>>>0)+0>>>2]=Wr^jr;let wi=4+yi|0;n[(wi>>>0)+0>>>2]=Qr^Dr;let ki=4+wi|0;n[(ki>>>0)+0>>>2]=Ir^Kr;let _i=4+ki|0;n[(_i>>>0)+0>>>2]=Hr^Zr;let Ai=4+_i|0;n[(Ai>>>0)+0>>>2]=xi^((Qr^Yr)>>>7|(Qr^Yr)<<25);let Si=4+Ai|0;n[(Si>>>0)+0>>>2]=gi^((Ir^Cr)>>>7|(Ir^Cr)<<25);let $i=4+Si|0;n[($i>>>0)+0>>>2]=bi^((Hr^Rr)>>>7|(Hr^Rr)<<25),n[((4+$i|0)>>>0)+0>>>2]=mi^((Wr^qr)>>>7|(Wr^qr)<<25)}function i(A,y){let V=Math.imul(2144,A),nt=n[((24+Math.imul(2144,A)|0)>>>0)+0>>>2],J=n[(V>>>0)+0>>>2],w=n[(V>>>0)+4>>>2],k=1+J|0,R=k,U=(((-1^k)&(1|J)|1&J)>>>31)+w|0,N=nt;e:{let P=R,rt=U,K=N;if((((1&P|0)===0|0|y)&((K|0)!==0|0)|0)===0|0){R=P,U=rt,N=K;break e}let D=P,G=rt,Y=K;s:{let F=D,Z=G,Q=Y,at=F,X=Z,ot=Q;t:for(;;){let _t=at,d=X,f=ot,l=_t,p=d,h=f;{let z=l,B=p,E=h-1|0;if(((E|0)===0|0)&y){D=z,G=B,Y=E;break s}c(A,E,E),l=z,p=B,h=E}let x=l,b=p,g=h,L=b<<31|x>>>1,_=b>>>1;if(((1&L|0)===0|0|y)&((g|0)!==0|0)){at=L,X=_,ot=g;continue t}at=L,X=_,ot=g;break t}let lt=at,pt=X,dt=ot;D=lt,G=pt,Y=dt}let et=D,it=G,ut=Y;R=et,U=it,N=ut}let j=N,ct=Math.imul(2144,A),no=Math.imul(2144,A),st=n[(ct>>>0)+0>>>2],O=n[(ct>>>0)+4>>>2],tt=1+st|0;n[(no>>>0)+0>>>2]=tt,n[(no>>>0)+4>>>2]=(((-1^tt)&(1|st)|1&st)>>>31)+O|0,n[((24+Math.imul(2144,A)|0)>>>0)+0>>>2]=1+j|0}function a(A,y,V,nt,J,w){return r.fill(0,((2144+y|0)+(Math.imul(V,A)<<6)|0)>>>0,(((2144+y|0)+(Math.imul(V,A)<<6)|0)>>>0)+(((y|0)===0|0?J:nt)>>>0)),0}function u(A,y,V,nt,J,w,k,R){let U=0;e:{let N=U;if((N>>>0<y>>>0|0|0)===0|0){U=N;break e}let j=N;{let st=j;t:for(;;){let P=st;{let D=P,G=D+A|0,Y=32+Math.imul(2144,G)|0,et=64+Math.imul(2144,G)|0,it=n[(Y>>>0)+0>>>2],ut=4+Y|0,F=n[(ut>>>0)+0>>>2],Z=4+ut|0,Q=n[(Z>>>0)+0>>>2],at=4+Z|0,X=n[(at>>>0)+0>>>2],ot=4+at|0,lt=n[(ot>>>0)+0>>>2],pt=4+ot|0,dt=n[(pt>>>0)+0>>>2],_t=4+pt|0,d=n[(_t>>>0)+0>>>2],f=n[((4+_t|0)>>>0)+0>>>2],l=n[((20+Math.imul(2144,G)|0)>>>0)+0>>>2],p=Math.imul(2144,G),h=n[((16+Math.imul(2144,G)|0)>>>0)+0>>>2],x=n[(et>>>0)+0>>>2],b=4+et|0,g=n[(b>>>0)+0>>>2],L=4+b|0,_=n[(L>>>0)+0>>>2],z=4+L|0,B=n[(z>>>0)+0>>>2],S=4+z|0,E=n[(S>>>0)+0>>>2],T=4+S|0,C=n[(T>>>0)+0>>>2],W=4+T|0,M=n[(W>>>0)+0>>>2],ft=n[((4+W|0)>>>0)+0>>>2],At=n[(p>>>0)+0>>>2],nc=n[(p>>>0)+4>>>2],Be=0,Pe=0,Ce=x,St=g,_e=_,se=B,yt=E,$t=C,Et=M,Lt=ft,Mt=l;n:{let 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Bi=Hi,Pi=Vi,Ci=Ni,ji=Fi,Ii=qi,zi=ha}let ea=_0,oa=cc,na=ic,sa=A0,ra=S0,ca=Bi,ia=Pi,ac=Ci,lc=ji,fc=Ii,uc=zi;Be=ea,Pe=oa,Ce=na,St=sa,_e=ra,se=ca,yt=ia,$t=ac,Et=lc,Lt=fc,Mt=uc}let je=Ce,Ie=St,sc=_e,Mi=se,Oi=yt,rc=$t,Ae=Et,so=Lt,ze=Mt;n[((20+Math.imul(2144,G)|0)>>>0)+0>>>2]=ze;n:{o:{if(((ze|0)!==0|0|0)===0|0)break o;n[(et>>>0)+0>>>2]=je;let Ot=4+et|0;n[(Ot>>>0)+0>>>2]=Ie;let re=4+Ot|0;n[(re>>>0)+0>>>2]=sc;let Bt=4+re|0;n[(Bt>>>0)+0>>>2]=Mi;let Pt=4+Bt|0;n[(Pt>>>0)+0>>>2]=Oi;let Ct=4+Pt|0;n[(Ct>>>0)+0>>>2]=rc;let jt=4+Ct|0;n[(jt>>>0)+0>>>2]=Ae,n[((4+jt|0)>>>0)+0>>>2]=so;break n}r.copyWithin((64+Math.imul(2144,G)|0)>>>0,(32+Math.imul(2144,G)|0)>>>0,((32+Math.imul(2144,G)|0)>>>0)+32)}P=D}let K=1+P|0;if(K>>>0<y>>>0|0){st=K;continue t}st=K;break t}j=st}U=j}}function v(A,y,V,nt,J,w,k,R,U){let N=0;e:{let j=N;if((j>>>0<y>>>0|0|0)===0|0){N=j;break e}let ct=j;{let O=ct;t:for(;;){let rt=O;{let G=rt,Y=G+A|0,et=32+Math.imul(2144,U)|0,it=Math.imul(2144,U),ut=n[((16+Math.imul(2144,U)|0)>>>0)+0>>>2],F=1|ut,Z=2|ut,Q=n[(et>>>0)+0>>>2],at=4+et|0,X=n[(at>>>0)+0>>>2],ot=4+at|0,lt=n[(ot>>>0)+0>>>2],pt=4+ot|0,dt=n[(pt>>>0)+0>>>2],_t=4+pt|0,d=n[(_t>>>0)+0>>>2],f=4+_t|0,l=n[(f>>>0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function m(A,y,V,nt,J,w,k,R){let U=n[((20+Math.imul(2144,A)|0)>>>0)+0>>>2],N=n[((24+Math.imul(2144,A)|0)>>>0)+0>>>2],j=((U+V|0)>>>0<=16|0)&((N|0)===0|0)&((V|0)!==0|0)&w,ct=V-1|0,no=(V>>>0>=4096|0)&((y|0)===3|0|((y|0)===2|0)),st=j?V-1|0:V;e:{s:{if((no|0)===0|0)break s;let O=0;t:{let tt=O;if((tt>>>0<y>>>0|0|0)===0|0){O=tt;break t}let P=tt;{let D=P;n:for(;;){let et=D;{let F=et;m(F+A|0,1,V,nt,J,w,k,R),et=F}let ut=1+et|0;if(ut>>>0<y>>>0|0){D=ut;continue n}D=ut;break n}P=D}O=P}break e}s:{t:{if((y>>>0>1|0|0)===0|0||(st|0)===0|0)break t;u(A,y,st,0,nt,J,((j|0)===0|0)&w,k);break s}let O=Math.min((16-U|0)>>>0,st>>>0)|0,tt=((O|0)!==0|0)&((U|0)!==0|0);t:{if((tt|0)===0|0)break t;u(A,y,O,0,nt,J,((j|0)===0|0)&((O|0)===(st|0)|0)&w,k)}let P=tt?st-O|0:st,rt=(P>>>0)/16>>>0,K=P-(rt<<4)|0,D=tt?O:0;t:{let Y=D;if(((P|0)!==0|0|0)===0|0){D=Y;break t}let et=((K|0)===0|0)&w?rt-1|0:rt,it=Y;r:{let Z=it;if(((rt|0)!==0|0|0)===0|0){it=Z;break r}v(0,rt,16,Z,J,et,k,nt,A),it=(rt<<4)+Z|0}let ut=it,F=0;r:{let Z=F;if((Z>>>0<rt>>>0|0|0)===0|0){F=Z;break r}let Q=Z;{let ot=Q;o:for(;;){let dt=ot;{let f=dt,l=10487904+(f<<5)|0,p=n[(l>>>0)+0>>>2],h=4+l|0,x=n[(h>>>0)+0>>>2],b=4+h|0,g=n[(b>>>0)+0>>>2],L=4+b|0,_=n[(L>>>0)+0>>>2],z=4+L|0,B=n[(z>>>0)+0>>>2],S=4+z|0,E=n[(S>>>0)+0>>>2],T=4+S|0,C=n[(T>>>0)+0>>>2],W=n[((4+T|0)>>>0)+0>>>2];n[(l>>>0)+0>>>2]=0;let M=4+l|0;n[(M>>>0)+0>>>2]=0;let ft=4+M|0;n[(ft>>>0)+0>>>2]=0;let At=4+ft|0;n[(At>>>0)+0>>>2]=0;let nc=4+At|0;n[(nc>>>0)+0>>>2]=0;let Be=4+nc|0;n[(Be>>>0)+0>>>2]=0;let Pe=4+Be|0;n[(Pe>>>0)+0>>>2]=0,n[((4+Pe|0)>>>0)+0>>>2]=0;let St=(96+(n[((24+Math.imul(2144,A)|0)>>>0)+0>>>2]<<5)|0)+Math.imul(2144,A)|0;n[(St>>>0)+0>>>2]=p;let _e=4+St|0;n[(_e>>>0)+0>>>2]=x;let se=4+_e|0;n[(se>>>0)+0>>>2]=g;let yt=4+se|0;n[(yt>>>0)+0>>>2]=_;let $t=4+yt|0;n[($t>>>0)+0>>>2]=B;let Et=4+$t|0;n[(Et>>>0)+0>>>2]=E;let Lt=4+Et|0;n[(Lt>>>0)+0>>>2]=C,n[((4+Lt|0)>>>0)+0>>>2]=W,i(A,((f|0)===(et|0)|0)&w),dt=f}let d=1+dt|0;if(d>>>0<rt>>>0|0){ot=d;continue o}ot=d;break o}Q=ot}F=Q}D=ut}let G=D;t:{if(((K|0)!==0|0|0)===0|0)break t;u(A,y,K,G,nt,J,((j|0)===0|0)&w,k)}}}e:{if(((no|0)===0|0|0)===0|0)break e;let O=0;s:{let tt=O;if((tt>>>0<y>>>0|0|0)===0|0){O=tt;break s}let P=tt;{let D=P;r:for(;;){let et=D;{let F=et,Z=F+A|0,Q=n[((20+Math.imul(2144,Z)|0)>>>0)+0>>>2];o:{if(((Q|0)===0|0|0)===0|0)break o;r.copyWithin((64+Math.imul(2144,Z)|0)>>>0,(32+Math.imul(2144,Z)|0)>>>0,((32+Math.imul(2144,Z)|0)>>>0)+32)}o:{if((j|0)===0|0)break o;let at=(2144+(ct<<6)|0)+(Math.imul(nt,F+A|0)<<6)|0,X=n[(at>>>0)+0>>>2],ot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;let re=4+Ot|0;n[(re>>>0)+0>>>2]=l;let Bt=4+re|0;n[(Bt>>>0)+0>>>2]=h;let Pt=4+Bt|0;n[(Pt>>>0)+0>>>2]=b,n[((4+Pt|0)>>>0)+0>>>2]=L;let Ct=128+Math.imul(2144,Z)|0;n[(Ct>>>0)+0>>>2]=z;let jt=4+Ct|0;n[(jt>>>0)+0>>>2]=S;let Te=4+jt|0;n[(Te>>>0)+0>>>2]=T;let Ue=4+Te|0;n[(Ue>>>0)+0>>>2]=W;let ce=4+Ue|0;n[(ce>>>0)+0>>>2]=ft;let Re=4+ce|0;n[(Re>>>0)+0>>>2]=nc;let ie=4+Re|0;n[(ie>>>0)+0>>>2]=Pe,n[((4+ie|0)>>>0)+0>>>2]=Ce,n[((28+Math.imul(2144,Z)|0)>>>0)+0>>>2]=J-k|0}et=F}let ut=1+et|0;if(ut>>>0<y>>>0|0){D=ut;continue r}D=ut;break r}P=D}O=P}}}function $(A,y,V,nt,J,w){let k=0;e:{let R=k;if((R>>>0<y>>>0|0|0)===0|0){k=R;break e}let U=R;{let ct=U;t:for(;;){let O=ct;{let rt=O,K=rt+A|0,D=64+Math.imul(2144,K)|0,G=n[((16+Math.imul(2144,K)|0)>>>0)+0>>>2],Y=n[((24+Math.imul(2144,K)|0)>>>0)+0>>>2],et=n[((20+Math.imul(2144,K)|0)>>>0)+0>>>2],it=8|((Y|0)===0|0?2|((et|0)===0|0?1:0):4)|G,ut=96+Math.imul(2144,K)|0,F=n[(ut>>>0)+0>>>2],Z=4+ut|0,Q=n[(Z>>>0)+0>>>2],at=4+Z|0,X=n[(at>>>0)+0>>>2],ot=4+at|0,lt=n[(ot>>>0)+0>>>2],pt=4+ot|0,dt=n[(pt>>>0)+0>>>2],_t=4+pt|0,d=n[(_t>>>0)+0>>>2],f=4+_t|0,l=n[(f>>>0)+0>>>2],p=n[((4+f|0)>>>0)+0>>>2],h=128+Math.imul(2144,K)|0,x=n[(h>>>0)+0>>>2],b=4+h|0,g=n[(b>>>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0;n[(Na>>>0)+0>>>2]=Oa^((K0^$i)>>>7|(K0^$i)<<25);let Fa=4+Na|0;n[(Fa>>>0)+0>>>2]=za^((W0^ka)>>>7|(W0^ka)<<25);let qa=4+Fa|0;n[(qa>>>0)+0>>>2]=ga^((G0^La)>>>7|(G0^La)<<25);let Ka=4+qa|0;n[(Ka>>>0)+0>>>2]=G0^Ot;let Wa=4+Ka|0;n[(Wa>>>0)+0>>>2]=X0^Bt;let Ga=4+Wa|0;n[(Ga>>>0)+0>>>2]=K0^Ct;let Xa=4+Ga|0;n[(Xa>>>0)+0>>>2]=W0^Te;let Ja=4+Xa|0;n[(Ja>>>0)+0>>>2]=Aa^ce;let Ya=4+Ja|0;n[(Ya>>>0)+0>>>2]=Oa^ie;let Za=4+Ya|0;n[(Za>>>0)+0>>>2]=za^cc,n[((4+Za|0)>>>0)+0>>>2]=ga^ic;let Ta=1+Ae|0,Qa=(((-1^Ta)&(1|Ae)|1&Ae)>>>31)+so|0;if(ze>>>0<V>>>0|0){Mt=ze,je=Ta,Ie=Qa;continue o}Mt=ze,je=Ta,Ie=Qa;break o}let sc=Mt,Mi=je,Oi=Ie;Pe=sc,Ce=Mi,St=Oi}let _e=Ce,se=St,yt=8+Math.imul(2144,K)|0;n[(yt>>>0)+0>>>2]=_e,n[(yt>>>0)+4>>>2]=se,O=rt}let P=1+O|0;if(P>>>0<y>>>0|0){ct=P;continue t}ct=P;break t}U=ct}k=U}}function H(A,y,V,nt,J){r.fill(0,Math.imul(2144,A)>>>0,(Math.imul(2144,A)>>>0)+(Math.imul(y,2144)>>>0));let w=0;e:{let k=w;if((k>>>0<y>>>0|0|0)===0|0){w=k;break e}let R=k;{let j=R;t:for(;;){let st=j;{let P=st;r.fill(0,(2144+(Math.imul(J,P+A|0)<<6)|0)>>>0,((2144+(Math.imul(J,P+A|0)<<6)|0)>>>0)+(V>>>0)),st=P}let tt=1+st|0;if(tt>>>0<y>>>0|0){j=tt;continue t}j=tt;break t}R=j}w=R}}let bt={exports:{compressParents:c,compressParentsFull:i,padding:a,proccessChunksParallel:u,proccessChunksSequential:v,processBlocks:m,processOutBlocks:$,reset:H,memory:{buffer:s}}}.exports,f2=bt.memory?bt.memory.buffer:new ArrayBuffer(0),vt=new Uint8Array(f2,0,15730784),ta=Object.freeze({state:new Uint8Array(vt.buffer,0,2144),state_chunks:Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,0+y*2144,2144))),"state.chunksDone_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,0+y*2144,8))),"state.chunkOut_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,8+y*2144,8))),"state.flags_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,16+y*2144,4))),"state.chunkPos_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,20+y*2144,4))),"state.stackPos_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,24+y*2144,4))),"state.lastBlockRem_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,28+y*2144,4))),"state.iv_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,32+y*2144,32))),"state.state_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,64+y*2144,32))),"state.stack_chunks":Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,96+y*2144,2048))),buffer:new Uint8Array(vt.buffer,2144,10485760),buffer_chunks:Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,2144+y*10485760,10485760))),stackBuffer:new Uint8Array(vt.buffer,10487904,5242880),stackBuffer_chunks:Object.freeze(Array.from({length:1},(A,y)=>new Uint8Array(vt.buffer,10487904+y*5242880,5242880)))});return Object.freeze({...bt,memory:vt,segments:ta})}var Hp;function Vp(o={},t){return Hp||(Hp=f3(o,t))}var yh=xh(Vp,bh,"js");var Qu=!1,mu;(function(o){o[o.String=0]="String",o[o.Number=1]="Number",o[o.Bytes=2]="Bytes"})(mu||(mu={}));function wh(...o){if(o.length===0)throw new RangeError("hash requires entropy");let t=yh.create(),e=new Uint8Array(1),s=new Uint8Array(4),r=Cp(s);for(let n of o)if(typeof n=="string"){let c=zu.toBytes(n);e[0]=mu.String,r.setUint32(0,c.byteLength,Qu),t.update(e),t.update(s),t.update(c)}else if(typeof n=="number"){let c=new Uint8Array(8);Cp(c).setFloat64(0,n,Qu),e[0]=mu.Number,r.setUint32(0,c.byteLength,Qu),t.update(e),t.update(s),t.update(c)}else if(n instanceof Uint8Array)e[0]=mu.Bytes,r.setUint32(0,n.byteLength,Qu),t.update(e),t.update(s),t.update(n);else throw new Error("unknown part type");return t.digest()}function gf(o){return!!(o===null||Pf(o)||Bf(o)||Tu(o))}function d2(o){let t=[];function e(s,r){if(gf(s))t.push(JSON.stringify(r));else for(let[n,c]of Object.entries(s))e(c,[...r,n])}return e(o,["b"]),t.sort(),Mf(wh("tact/bindings/v1",...t).slice(16))}var t1=class{bindings;#t;#e=new If;#n=new fu;#o=new o2;constructor(t){this.bindings=t,this.#t=Wu(d2(t))}get playerIds(){return[...this.#o.keys()]}get controllers(){return{unassigned:[...this.#n],assigned:new Map([...this.#o].map(([t,e])=>[t,[...e.controllers]]))}}createPlayer(){let t=this.#e.next();return this.#o.set(t,{controllers:new fu}),t}deletePlayer(t){return this.#o.get(t)?.controllers.forEach(e=>this.#n.add(e)),this.#o.delete(t),this}add(t){return this.unplug(t),this}remove(t){return this.unplug(t),this.#n.delete(t),this}unplug(t){this.#n.add(t);for(let e of this.#o.values())e.controllers.delete(t);return this}plug(t,e){return e??=this.playerIds.at(-1)??this.createPlayer(),this.unplug(t),tc(this.#o.get(e)).controllers.add(t),this.#n.delete(t),this}encode(t,e=performance.now()){let s=new Map,{controllers:r}=tc(this.#o.get(t));for(let c of r)for(let i of c.evaluate(e)){let a=s.get(i.id)??0;s.set(i.id,a+i.value)}let n=[...s].filter(([,c])=>c!==0).map(([c,i])=>({id:c,value:i}));return Xu(this.#t,n)}encodeAll(t=performance.now()){for(let s of this.#n)s.clear();let e=Array.from(this.#o.keys()).map(s=>({playerId:s,intents:this.encode(s,t)}));return ph(e)}};async function Np(o){return new Promise((t,e)=>{o.onsuccess=()=>t(o.result),o.onerror=()=>e(o.error)})}async function kh(o,t=o){return{dbName:o,storeName:t,db:await new Promise((e,s)=>{let r=indexedDB.open(o,1);r.onblocked=()=>s(new Error("idb blocked")),r.onerror=()=>s(r.error),r.onupgradeneeded=()=>r.result.createObjectStore(t),r.onsuccess=()=>e(r.result)})}}function _h({start:o,end:t}){if(k0(o)&&k0(t))return IDBKeyRange.bound(o,t,!1,!0);if(k0(o))return IDBKeyRange.lowerBound(o,!1);if(k0(t))return IDBKeyRange.upperBound(t,!0)}function Ah({db:o,storeName:t}){let e=s=>(async r=>{let n=o.transaction(t,s),c=n.objectStore(t),i=new Promise((a,u)=>{n.onabort=()=>u(n.error??new Error("transaction aborted")),n.oncomplete=()=>a(void 0)});try{let a=await r(c,Np);return n.commit(),await i,a}catch(a){try{n.abort()}catch{}throw a}});return{readonly:e("readonly"),readwrite:e("readwrite")}}var e1=class{#t;constructor(t){this.#t=Ah(t)}async commit(t){return this.#t.readwrite(async e=>{for(let[s,r]of t)r===void 0?e.delete(s):e.put(r,s)})}async getMany(t){return this.#t.readonly((e,s)=>Promise.all(t.map(r=>s(e.get(r)))))}async*entries(t={}){t.limit!==0&&(yield*await this.#t.readonly(async(e,s)=>{let r=[],n=t.reverse?"prev":"next",c=e.openCursor(_h(t),n),i=await s(c);for(;i&&(r.push([i.key,i.value]),!(t.limit!==void 0&&r.length>=t.limit));)i.continue(),i=await s(c);return r}))}};var Sh=(o,t)=>o<t?-1:o>t?1:0;function $h(o,{start:t,end:e}){return!(t!==void 0&&o<t||e!==void 0&&o>=e)}function*Fp(o,t){if(o.limit===0)return;let e=t.filter(([s,r])=>r!==void 0&&$h(s,o)).sort(([s],[r])=>Sh(s,r));o.reverse&&e.reverse(),yield*e.slice(0,o.limit??1/0)}var o1=class{#t=new Map;async commit(t){for(let[e,s]of t)s===void 0?this.#t.delete(e):this.#t.set(e,structuredClone(s))}async getMany(t){return t.map(e=>structuredClone(this.#t.get(e)))}async*entries(t={}){yield*Fp(t,[...this.#t.entries()].map(([e,s])=>[e,structuredClone(s)]))}};var n1=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e}set(t){return this.#e.set(this.#t,t)}delete(){return this.#e.delete(this.#t)}};var s1=class{kv;key;op;constructor(t,e){this.kv=t,this.key=e,this.op=new n1(e,t.op)}async set(t){return this.kv.set(this.key,t)}async get(){return this.kv.get(this.key)}async has(){return await this.get()!==void 0}async need(){return tc(await this.get(),`key not found "${this.key}"`)}async delete(){return this.kv.set(this.key,void 0)}};var Vf=hf({divisor:".",delimiter:":",chunkSize:1024});function xu(o){for(let t=o.length-1;t>=0;t--){let e=o.charCodeAt(t);if(e<65535)return o.slice(0,t)+String.fromCharCode(e+1)}}var r1=class{#t;#e=[{}];constructor(t,e){if(this.#t=t,e.length){let s=e.join(Vf.divisor),r=s+".",n=s+":";this.#e=[{start:n,end:xu(n)},{start:r,end:xu(r)}]}}async count(){let t=0;for(let e of this.#e)for await(let s of this.#t.entries(e))t++;return t}async clear(){let t=[];for(let e of this.#e)for await(let[s]of this.#t.entries(e))t.push([s,void 0]),t.length>=1024&&(await this.#t.commit(t),t=[]);t.length&&await this.#t.commit(t)}};var c1=class{#t;constructor(t){this.#t=t}set(t,e){return[this.#t.prefix(t),e]}delete(t){return[this.#t.prefix(t),void 0]}};var{divisor:v3,delimiter:p3}=Vf,i1=class{#t;#e;constructor(t){let{scopes:e}=t;this.#t=e.join(v3)+p3,this.#e=xu(this.#t)}prefix=t=>this.#t+t;unprefix=t=>t.slice(this.#t.length);scan=t=>{let{start:e,end:s,limit:r,reverse:n}=t;return{start:this.#t+(e??""),end:s===void 0?this.#e:this.#t+s,limit:r,reverse:n}}};function Eh(o){let t=o.limit;if(t!==void 0){if(!Number.isInteger(t))throw new Error("scan limit must be integer");if(t<0)throw new Error("scan limit must be positive")}return o}function Mh(o){for(let t of o){if(t==="")throw new Error("invalid scope empty string");Lh(t,"."),Lh(t,":")}return o}function Lh(o,t){if(o.includes(t))throw new Error(`invalid scope "${o}" contains illegal "${t}"`)}var a1=class o{op;subtree;#t;#e;#n;#o;constructor(t=new o1,e={}){this.#t=t,this.#o={strict:!1,scopes:[],...e},Mh(this.#o.scopes),this.#e=new i1(this.#o),this.op=new c1(this.#e),this.subtree=new r1(this.#t,this.#o.scopes),this.#n=this.#o.strict?s=>JSON.parse(JSON.stringify(s)):s=>s}cell(t){return new s1(this,t)}scope(...t){return new o(this.#t,{...this.#o,scopes:[...this.#o.scopes,...t]})}async commit(t){await this.#t.commit(t.map(([e,s])=>[e,s===void 0?void 0:this.#n(s)]))}async set(t,e){return this.commit([this.op.set(t,e)])}async setMany(t){return this.commit(t.map(([e,s])=>this.op.set(e,s)))}async delete(...t){return this.commit(t.map(e=>this.op.delete(e)))}async getMany(t){return t=t.map(e=>this.#e.prefix(e)),(await this.#t.getMany(t)).map(e=>e===void 0?void 0:e)}async get(t){let[e]=await this.getMany([t]);return e}async has(t){return await this.get(t)!==void 0}async need(t){return tc(await this.get(t),`key not found "${t}"`)}async needMany(t){let e=await this.getMany(t);for(let[s,r]of t.entries())tc(e[s],`key not found "${r}"`);return e}async*entries(t={}){t=Eh(this.#e.scan(t));for await(let[e,s]of this.#t.entries(t)){let r=this.#e.unprefix(e);s!==void 0&&(yield[r,s])}}[Symbol.asyncIterator](){return this.entries()}async*keys(t={}){for await(let[e]of this.entries(t))yield e}async*values(t={}){for await(let[,e]of this.entries(t))yield e}async count(t={}){let e=0;for await(let s of this.keys(t))e++;return e}async clear(t={}){let e=[];for await(let[s]of this.entries(t))e.push(this.op.delete(s)),e.length>=Vf.chunkSize&&(await this.commit(e),e=[]);e.length&&await this.commit(e)}};async function Oh(o,t){let e=()=>{};if(!t){let s=await kh(o,"kv"),r=new e1(s);t=new a1(r),e=()=>s.db.close()}return{kv:t,dispose:e}}function qp(o,t){let{presets:e,customs:s,fallback:r}=o.profiles;return t===void 0?r.profile:s.get(t)??e.get(t)??tc(e.get(r.key))}async function l1(o,t,e){let{kvs:s,controllers:r,assignments:n}=o;t.bindings=qp(o,e).bindings,n.set(t,e),await Uu(r.get(t)?.handle,async c=>{o.preferences.set(c,e),await s.preferences.set(c,e)})}function Bh(o,t){return d2(o)===d2(t)}var f1=class{#t;constructor(t){this.#t=t}#e(t){if(!Bh(t,this.#t.bindings))throw new Error("incompatible bindings")}get presets(){return[...this.#t.profiles.presets]}get customs(){return[...this.#t.profiles.customs]}isPreset(t){return this.#t.profiles.presets.has(t)}get(t){return qp(this.#t,t)}async create(t,e){let{kvs:s,profiles:r}=this.#t;this.#e(e.bindings),r.customs.set(t,e),await s.profiles.set(t,e),this.#t.subby.publish()}async clone(t,e){let{label:s,bindings:r}=this.get(e);await this.create(t,{basedOn:e,bindings:r,label:`${s} copy`})}async delete(t){let{kvs:e,assignments:s,profiles:{customs:r,fallback:n}}=this.#t;r.delete(t),await e.profiles.delete(t);for(let[c,i]of s)i===t&&await l1(this.#t,c,n.key);this.#t.subby.publish()}async update(t,e){let{kvs:s,assignments:r,profiles:{customs:n}}=this.#t;e.bindings&&this.#e(e.bindings);let c=this.get(t),i={...structuredClone(c),...e};n.set(t,i);for(let[a,u]of r)u===t&&(a.bindings=i.bindings);await s.profiles.set(t,i),this.#t.subby.publish()}};function Ph(o){let{presets:t}=o,e=tc(Object.keys(t)[0],"missing presets"),s=tc(t[e]),r=s.bindings,n=o.kv.scope(d2(r).toString()),c={presets:new o2,customs:new o2,fallback:{key:e,profile:s}};return lu(c.presets,Object.entries(t)),{subby:h2(),kv:n,presets:t,bindings:r,idCounter:new If,profiles:c,controllers:new o2,assignments:new o2,preferences:new o2,kvs:{profiles:n.scope("profiles"),preferences:n.scope("preferences")}}}var u1=class{#t;constructor(t){this.#t=t}async assign(t,e){await l1(this.#t,t,e),this.#t.subby.publish()}assignedProfileKeyOf(t){let{assignments:e}=this.#t;return e.get(t)??this.#t.profiles.fallback.key}};var v1=class{#t;profiles;assignments;presets;constructor(t){this.#t=Ph(t),this.profiles=new f1(this.#t),this.assignments=new u1(this.#t),this.presets=t.presets}get on(){return this.#t.subby.on}#e(t){let{preferences:e,assignments:s,controllers:r}=this.#t,n=tc(r.get(t)),c=s.get(t)??e.get(n.handle)??n.defaultProfileKey;t.bindings=this.profiles.get(c).bindings,s.set(t,c)}async load(){let{kvs:t,controllers:e,preferences:s,profiles:{customs:r}}=this.#t;r.clear(),lu(r,await Pp(t.profiles)),s.clear(),lu(s,await Pp(t.preferences));for(let n of e.keys())this.#e(n)}get controllers(){return[...this.#t.controllers.keys()]}get fallbackProfileKey(){return this.#t.profiles.fallback.key}meta(t){return this.#t.controllers.get(t)}attach(t,e){let s=this.#t.idCounter.next();this.#t.controllers.set(t,{...e,id:s}),this.#e(t)}detach(t){this.#t.controllers.delete(t),this.#t.assignments.delete(t)}};function p1(o){let[t,e]=Object.entries(o)[0];return{key:t,profile:e}}async function Ch(o,t){let e=()=>{};if(!t){let s=new BroadcastChannel(o);t=s,e=()=>s.close()}return{broadcastChannel:t,dispose:e}}async function jh(o){let{dispose:t,schedule:e,disposable:s}=J0(),r=o.namespace?`tact_${o.namespace}`:"tact",{kv:n}=s(await Oh(r,o.kv)),{broadcastChannel:c}=s(await Ch(r,o.broadcastChannel));try{let{maxPlayers:i}=o,{bindings:a}=p1(o.presets).profile,u=new t1(a),v=new v1({...o,kv:n});return e(ec(c,{message:()=>v.load()})),e(v.on(()=>c.postMessage({}))),await v.load(),fh({hub:u,controls:v,maxPlayers:i,dispose:t})}catch(i){throw t(),i}}var Kp=1024,d1=class{dispose;#t;#e=[];constructor(t){this.#t=t,this.dispose=t.onSample(e=>{this.#e.push(e),this.#e.length>Kp&&console.warn(`tact sampler exceeded limit ${Kp}`),this.#e=Vd(this.#e,Kp)})}take(){this.#t.poll?.();let t=this.#e;return this.#e=[],t}};var{min:d3,max:h3,abs:m3,sign:x3,floor:zk,ceil:Tk,pow:Uk}=Math;function bf(o,t=0,e=1){return o=d3(o,e),o=h3(o,t),o}function g3(o,t,e,s){let n=(e-t)*o;return s!==void 0&&m3(n)>s&&(n=x3(n)*s),t+n}function b3(o,t,e){return(o-t)/(e-t)}function Ih(o,t,e,s=0,r=1,n=!1){let c=b3(o,t,e);return n&&(c=bf(c)),g3(c,s,r)}var h1=class o{x;y;constructor(t=0,e=0){this.x=t,this.y=e}static new(t=0,e=0){return new this(t,e)}static zero(){return new this}static fill(t){return new this(t,t)}static from(t){return Array.isArray(t)?new this(...t):new this(t.x,t.y)}static magnitudeSquared(t,e){return t*t+e*e}static magnitude(t,e){return Math.sqrt(this.magnitudeSquared(t,e))}static average(...t){return new this().add(...t).divBy(t.length)}static min(...t){return new this(Math.min(...t.map(e=>e.x)),Math.min(...t.map(e=>e.y)))}static max(...t){return new this(Math.max(...t.map(e=>e.x)),Math.max(...t.map(e=>e.y)))}static rotation(t){return new this(Math.cos(t),Math.sin(t))}dup(){return new this.constructor(this.x,this.y)}*[Symbol.iterator](){yield this.x,yield this.y}array(){return[this.x,this.y]}toJSON(){return this.array()}toString(){return`(${this.constructor.name} x${this.x.toFixed(2)}, y${this.y.toFixed(2)})`}fill(t){return this.x=t,this.y=t,this}zero(){return this.fill(0)}set_(t,e){return this.x=t,this.y=e,this}set({x:t,y:e}){return this.x=t,this.y=e,this}from(t){if(Array.isArray(t)){let[e,s]=t;this.x=e,this.y=s}else{let{x:e,y:s}=t;this.x=e,this.y=s}return this}magnitudeSquared(){return o.magnitudeSquared(this.x,this.y)}magnitude(){return o.magnitude(this.x,this.y)}rotation(){return Math.atan2(this.y,this.x)}equals_(t,e){return this.x===t&&this.y===e}equals(...t){return t.every(({x:e,y:s})=>this.equals_(e,s))}near_(t,e,s=1e-6){return Math.abs(this.x-t)<=s&&Math.abs(this.y-e)<=s}near({x:t,y:e},s=1e-6){return this.near_(t,e,s)}dot_(t,e){return this.x*t+this.y*e}dot({x:t,y:e}){return this.dot_(t,e)}distanceSquared_(t,e){return t=this.x-t,e=this.y-e,t*t+e*e}distanceSquared({x:t,y:e}){return this.distanceSquared_(t,e)}distance_(t,e){return Math.sqrt(this.distanceSquared_(t,e))}distance({x:t,y:e}){return this.distance_(t,e)}angleBetween_(t,e){let s=this.dot_(t,e),r=this.magnitude()*o.magnitude(t,e);if(r===0)return 0;let n=bf(s/r,-1,1);return Math.acos(n)}angleBetween({x:t,y:e}){return this.angleBetween_(t,e)}normalize(){return this.divBy(this.magnitude())}half(){return this.divBy(2)}double(){return this.mulBy(2)}abs(){return this.map(t=>Math.abs(t))}rotate(t){let{x:e,y:s}=this;return this.x=e*Math.cos(t)-s*Math.sin(t),this.y=e*Math.sin(t)+s*Math.cos(t),this}perpendicular(){let{x:t,y:e}=this;return this.x=-e,this.y=t,this}clampMagnitude(t){return this.magnitude()>t&&this.normalize().mulBy(t),this}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}map(t){return this.x=t(this.x,0),this.y=t(this.y,1),this}morph(t){let e=t(this);return e&&e!==this&&this.set(e),this}clamp(t={x:0,y:0},e={x:1,y:1}){return this.x=bf(this.x,t.x,e.x),this.y=bf(this.y,t.y,e.y),this}clampBy(t=0,e=1){return this.x=bf(this.x,t,e),this.y=bf(this.y,t,e),this}negate(){return this.map(t=>t*-1)}addBy(t){return this.x+=t,this.y+=t,this}subBy(t){return this.x-=t,this.y-=t,this}mulBy(t){return this.x*=t,this.y*=t,this}scale(t){return this.x*=t,this.y*=t,this}divBy(t){return t===0?this:(this.x/=t,this.y/=t,this)}add_(t,e){return this.x+=t,this.y+=e,this}add(...t){for(let{x:e,y:s}of t)this.add_(e,s);return this}sub_(t,e){return this.x-=t,this.y-=e,this}sub(...t){for(let{x:e,y:s}of t)this.sub_(e,s);return this}mul_(t,e){return this.x*=t,this.y*=e,this}mul(...t){for(let{x:e,y:s}of t)this.mul_(e,s);return this}div_(t,e){return t!==0&&(this.x/=t),e!==0&&(this.y/=e),this}div(...t){for(let{x:e,y:s}of t)this.div_(e,s);return this}lerp_(t,e,s){return this.x+=(t-this.x)*s,this.y+=(e-this.y)*s,this}lerp(t,{x:e,y:s}){return this.lerp_(t,e,s)}reflect_(t,e){let s=2*this.dot_(t,e);return this.x-=s*t,this.y-=s*e,this}reflect({x:t,y:e}){return this.reflect_(t,e)}rotateAroundPoint_(t,e,s){let r=this.x-e,n=this.y-s,c=Math.cos(t),i=Math.sin(t);return this.x=c*r-i*n+e,this.y=i*r+c*n+s,this}rotateAroundPoint(t,{x:e,y:s}){return this.rotateAroundPoint_(t,e,s)}};function w2(o){return o!==0}function Wp(o,t){let e=s=>Wp(o,s);if(t===null)return 0;if(Bf(t))return t;if(Pf(t)){let s=o.latestValues.get(t)??0;return o.recentSamples.filter(r=>r.code===t).reduce((r,n)=>Math.abs(n.value)>Math.abs(r)?n.value:r,s)}else switch(t[0]){case"accumulate":{let s=t[1],r=0;for(let n of o.recentSamples)n.code===s&&(r+=n.value);return r}case"up":{let s=t[1],r=0,n=o.previousValues.get(s)??0;for(let c of o.recentSamples)c.code===s&&(w2(n)&&!w2(c.value)&&r++,n=c.value);return r}case"down":{let s=t[1],r=0,n=o.previousValues.get(s)??0;for(let c of o.recentSamples)c.code===s&&(!w2(n)&&w2(c.value)&&r++,n=c.value);return r}case"was":{let s=t[1];return o.previousValues.get(s)??0}case"since":{let s=t[1],r=o.previousValues.get(s)??0;return(o.latestValues.get(s)??0)-r}case"if":{let[,s,r,n]=t;return e(s)?e(r):k0(n)?e(n):0}case"min":return Math.min(...t.slice(1).map(e));case"max":return Math.max(...t.slice(1).map(e));case"+":return t.slice(1).map(e).reduce((s,r)=>s+r,0);case"*":return t.slice(1).map(e).reduce((s,r)=>s*r,1);case"==":return+(e(t[1])===e(t[2]));case"!=":return+(e(t[1])!==e(t[2]));case">":return+(e(t[1])>e(t[2]));case"<":return+(e(t[1])<e(t[2]));case">=":return+(e(t[1])>=e(t[2]));case"<=":return+(e(t[1])<=e(t[2]));case"!":return+(e(t[1])===0);case"!!":return+(e(t[1])!==0);case"-":{let[,s,...r]=t;if(r.length===0)return-e(s);let n=e(s);for(let c of r)n-=e(c);return n}case"clamp":{let[,s,r,n]=t,c=e(n);return Math.min(r===null?1/0:e(r),Math.max(s===null?-1/0:e(s),c))}case"remap":{let[s,r,n,c,i]=t.slice(1).map(e);return Ih(i,s,r,n,c)}case"dt":return o.dt;case"held":{let[,s,r]=t,n=w2(e(r)),c=o.holding.get(t);return n&&!c&&(c={start:o.clock.time},o.holding.set(t,c)),!n&&c&&(c=void 0,o.holding.delete(t)),c&&o.clock.time-c.start>=s?1:0}case"taps":{let[,s,r,n]=t,c=w2(e(n)),i=o.clock.time,a=Cf(o.tapping,t,()=>({wasDown:!1,startedAt:null,count:0})),u=c&&!a.wasDown,v=!c&&a.wasDown;a.startedAt!==null&&i-a.startedAt>=r&&(a.startedAt=null,a.count=0);let m=0;return u&&a.startedAt===null&&(a.startedAt=i),v&&a.startedAt!==null&&(a.count++,a.count===s&&(m=1,a.count=0,a.startedAt=null)),a.wasDown=c,m}case"mod":{let[,...s]=t,r=u=>w2(o.latestValues.get(u)??0),n=r("ShiftLeft")||r("ShiftRight"),c=r("ControlLeft")||r("ControlRight"),i=r("AltLeft")||r("AltRight"),a=r("MetaLeft")||r("MetaRight");return s.includes("shift")!==n||s.includes("ctrl")!==c||s.includes("alt")!==i||s.includes("meta")!==a?0:1}default:throw new Error("unknown expression")}}var m1=class{time;since=0;last;constructor(t=performance.now()){this.time=t}update(t=performance.now()){this.since=t-(this.time??t),this.last=this.time,this.time=t}};var x1=class{dt=0;clock=new m1;recentSamples=[];latestValues=new Map;previousValues=new Map;holding=new Map;tapping=new Map};function zh(){return{value:0,was:0,sum:0}}function Gp(o){let t=d2(o),e=[];function s(n,c){if(gf(n)){let i=zh();return e.push({path:JSON.stringify(c),input:i,expression:n}),i}else return jp(n,(i,a)=>s(i,[...c,a]))}let r=s(o,["b"]);return e.sort((n,c)=>n.path<c.path?-1:n.path>c.path?1:0),{hash:t,minihash:Wu(t),inputs:r,inputList:e.map(n=>n.input),rootList:e.map(n=>n.expression)}}var Nf=class{#t;#e;#n;#o;constructor(t){this.#e=hf(structuredClone(t.bindings)),this.#n=Gp(this.#e),this.#t=new d1(t.source),this.#o=new x1}get bindings(){return this.#e}set bindings(t){let e=hf(structuredClone(t)),s=Gp(e),r=this.#n.hash;if(s.hash!==r)throw new Error("incompatible bindings");this.#e=e,this.#n.rootList=s.rootList}*evaluate(t=performance.now()){let e=this.#t.take();this.#o.clock.update(t),this.#o.recentSamples=e,this.#o.dt=this.#o.clock.since/1e3;for(let{code:s,value:r}of e)this.#o.latestValues.set(s,r);for(let[s,r]of this.#n.rootList.entries()){let n=Wp(this.#o,r);n!==0&&(yield{id:s,value:n})}for(let{code:s,value:r}of e)this.#o.previousValues.set(s,r)}encode(t=performance.now()){return Xu(this.#n.minihash,[...this.evaluate(t)])}clear(){this.#t.take()}dispose(){return this.#t.dispose()}};var g1=class{get;constructor(t){this.get=t}get gamepad(){return this.get()}};function Th(o,t){let e=o;return()=>{let s=t();return s!=null&&(e=s),e}}function b1(o){let t=new Map;function e(){s(),r()}function s(){for(let c of navigator.getGamepads())if(c?.connected&&!t.has(c.index)){let i=()=>navigator.getGamepads()[c.index],a=new g1(Th(c,i)),u=o(a);t.set(c.index,{pad:a,dispose:u})}}function r(){for(let[c,{pad:i,dispose:a}]of t)navigator.getGamepads()[i.gamepad.index]?.connected||(a(),t.delete(c))}e();let n=ec(window,{gamepadconnected:e,gamepaddisconnected:e});return()=>{n();for(let{dispose:c}of t.values())c();t.clear()}}var l2=class{onSample=h2();dispose=J0()};var Ff=class extends l2{pad;#t=new Map;constructor(t){super(),this.pad=t}get gamepad(){return this.pad.gamepad}poll(){let t=this.gamepad;this.#n(t),this.#o(t)}#e(t,e){let s=this.#t.get(t)??0;e!==s&&(this.#t.set(t,e),this.onSample.publish({code:t,value:e}))}#n(t){let e=0;for(let[s,r]of t.buttons.entries()){let n=r.value;this.#e(`gamepad.${s+1}`,n),e=Math.max(e,n)}this.#e("gamepad.any",e>=.9?1:0)}#o(t){for(let[e,s]of t.axes.entries())this.#e(`gamepad.axis.${e+1}`,s)}};function Uh(o,t){return b1(e=>{let s=new Ff(e),r=new Nf({source:s,bindings:o.bindings});o.plug(r);let n=t?.(r,s);return()=>{r.dispose(),o.remove(r),n?.()}})}function Rh(o,t){return o.length>t?o.slice(0,t)+"...":o}var y1=class extends l2{#t;constructor(...t){super(),this.#t=t;for(let e of t)this.dispose.schedule(e.onSample(s=>this.onSample.publish(s)))}poll(){for(let t of this.#t)t.poll?.()}};var w1=class{$hex=oc("");clear=Ud(250,()=>{this.$hex.set("")});update(t){this.$hex(Mf(new Uint8Array(t))),this.clear()}};function qf(o){return`pointer.${o+1}`}var k1=class extends l2{client=new h1;constructor(t=window){super(),this.dispose.schedule(ec(t,this.#t))}#t={pointerdown:t=>{this.onSample.publish({code:qf(t.button),value:1})},pointerup:t=>{this.onSample.publish({code:qf(t.button),value:0})},pointermove:({clientX:t,clientY:e,movementX:s,movementY:r})=>{this.client.set_(t,e),s&&this.onSample.publish({code:"pointer.x",value:s}),r&&this.onSample.publish({code:"pointer.y",value:r})},wheel:({deltaX:t,deltaY:e})=>{t&&this.onSample.publish({code:"pointer.wheel.x",value:t}),e&&this.onSample.publish({code:"pointer.wheel.y",value:e})}}};var _1=class extends l2{#t=new Set;constructor(t=window){super(),this.dispose.schedule(ec(t,this.#e)),this.dispose.schedule(ec(window,this.#n))}#e={keydown:t=>{t.repeat||(this.#t.size===0&&this.onSample.publish({code:"keyboard.any",value:1}),this.onSample.publish({code:t.code,value:1}),this.#t.add(t.code))},keyup:t=>{this.onSample.publish({code:t.code,value:0}),this.#t.delete(t.code),this.#t.size===0&&this.onSample.publish({code:"keyboard.any",value:0})}};#n={blur:()=>{for(let t of this.#t)this.onSample.publish({code:t,value:0});this.#t.size&&this.onSample.publish({code:"keyboard.any",value:0}),this.#t.clear()}}};var Dh=m2`@layer core {
29
29
 
30
30
  ::selection {
31
31
  color: var(--selection);
@@ -55,14 +55,14 @@ a {
55
55
  }
56
56
  }
57
57
 
58
- }`;var Ko=q`@layer vars {
58
+ }`;var Hh=m2`@layer vars {
59
59
 
60
60
  :is(:root, :host) {
61
- ${vn({bg:"#111",alpha:"#def",rounded:"0.5em",padding:"0.5em",prime:"#d068ff",code:"#3f1",link:"cyan",selection:"white","selection-bg":"#f70",lame:"#8888",angry:"#f50",zesty:"#cf0",happy:"#0fa",calm:"#0af",sad:"#74f",quirky:"#f49","inactive-opacity":"0.5","anim-duration":"150ms"})}
61
+ ${w3({bg:"#111",alpha:"#def",rounded:"0.5em",padding:"0.5em",prime:"#d068ff",code:"#3f1",link:"cyan",selection:"white","selection-bg":"#f70",lame:"#8888",angry:"#f50",zesty:"#cf0",happy:"#0fa",calm:"#0af",sad:"#74f",quirky:"#f49","inactive-opacity":"0.5","anim-duration":"150ms"})}
62
62
  }
63
63
 
64
- }`;function wn([r,t]){return`--${r}: var(--shiny-${r}, ${t});`}function vn(r){return Object.entries(r).map(wn).join(`
65
- `)}var Jo=q`@layer reset {
64
+ }`;function y3([o,t]){return`--${o}: var(--shiny-${o}, ${t});`}function w3(o){return Object.entries(o).map(y3).join(`
65
+ `)}var Vh=m2`@layer reset {
66
66
 
67
67
  * {
68
68
  margin: 0;
@@ -78,15 +78,15 @@ a {
78
78
  ::-webkit-scrollbar-thumb { background: #888; border-radius: 1em; }
79
79
  ::-webkit-scrollbar-thumb:hover { background: #999; }
80
80
 
81
- }`;var Zo=q`
81
+ }`;var Nh=m2`
82
82
 
83
83
  @layer vars, reset, core, underlay, view, overlay;
84
84
 
85
- ${Ko}
86
- ${Jo}
87
- ${Go}
85
+ ${Hh}
86
+ ${Vh}
87
+ ${Dh}
88
88
 
89
- `;var _r=new CSSStyleSheet;_r.replaceSync(Zo);var Ot=class{length=1;$index=S(0);constructor(t=0){this.$index(t)}clamp(t){return t=Math.min(t,this.length-1),t=Math.max(t,0),t}get index(){return this.clamp(this.$index())}async setIndex(t){return this.$index(t)}async shimmy(t){let e=this.clamp(this.index+t);return this.setIndex(e)}};var Qo=b`@layer view {
89
+ `;var Xp=new CSSStyleSheet;Xp.replaceSync(Nh);var Kf=class{length=1;$index=oc(0);constructor(t=0){this.$index(t)}clamp(t){return t=Math.min(t,this.length-1),t=Math.max(t,0),t}get index(){return this.clamp(this.$index())}async setIndex(t){return this.$index(t)}async shimmy(t){let e=this.clamp(this.index+t);return this.setIndex(e)}};var Fh=ee`@layer view {
90
90
 
91
91
  :host {
92
92
  display: inline-flex;
@@ -128,10 +128,10 @@ slot[part="tabs"][data-snug] {
128
128
  }
129
129
  }
130
130
 
131
- } `;var Xo=xo((r={})=>{_t("shiny-tabs"),Ct(_r,Qo);let t=Jt(),e=y(()=>g.attrs(t).spec({index:Number})),o=y(()=>r.control??new Ot(e.index??0)),s=H([]),n=H([]);function i(l){let p=l.currentTarget;s(p.assignedElements())}function a(l){let p=l.currentTarget;n(p.assignedElements())}e.index=o.$index(),o.length=s().length;function c(l,p){let u=o.clamp(l+p);return u===l?!1:u===o.index}for(let[l,p]of s().entries()){let u=l===o.index,m=g.attrs(p);m.booleans.disabled=u,m.booleans["data-snug"]=r.snug,m.booleans["data-tabbed"]=u,m.booleans["data-first"]=l===0,m.booleans["data-last"]=l===o.length-1,m.booleans["data-next-is-tabbed"]=c(l,1),m.booleans["data-previous-is-tabbed"]=c(l,-1),p.onclick=()=>o.setIndex(l)}for(let[l,p]of n().entries()){let u=l===o.index;g.attrs(p).booleans["data-tabbed"]=u,g.attrs(p).booleans.hidden=!u}return h`
132
- <slot part=tabs ?data-snug="${r.snug}" @slotchange="${i}"></slot>
133
- <slot part=panels name=panel @slotchange="${a}"></slot>
134
- `});var Yo=b`@layer view {
131
+ } `;var qh=eh((o={})=>{Z0("shiny-tabs"),Df(Xp,Fh);let t=Dp(),e=ne(()=>xt.attrs(t).spec({index:Number})),s=ne(()=>o.control??new Kf(e.index??0)),r=p2([]),n=p2([]);function c(u){let v=u.currentTarget;r(v.assignedElements())}function i(u){let v=u.currentTarget;n(v.assignedElements())}e.index=s.$index(),s.length=r().length;function a(u,v){let m=s.clamp(u+v);return m===u?!1:m===s.index}for(let[u,v]of r().entries()){let m=u===s.index,$=xt.attrs(v);$.booleans.disabled=m,$.booleans["data-snug"]=o.snug,$.booleans["data-tabbed"]=m,$.booleans["data-first"]=u===0,$.booleans["data-last"]=u===s.length-1,$.booleans["data-next-is-tabbed"]=a(u,1),$.booleans["data-previous-is-tabbed"]=a(u,-1),v.onclick=()=>s.setIndex(u)}for(let[u,v]of n().entries()){let m=u===s.index;xt.attrs(v).booleans["data-tabbed"]=m,xt.attrs(v).booleans.hidden=!m}return I`
132
+ <slot part=tabs ?data-snug="${o.snug}" @slotchange="${c}"></slot>
133
+ <slot part=panels name=panel @slotchange="${i}"></slot>
134
+ `});var Kh=ee`@layer view {
135
135
 
136
136
  :host {
137
137
  display: block;
@@ -141,7 +141,7 @@ slot[part="tabs"][data-snug] {
141
141
  text-shadow: var(--text-shadow);
142
142
  }
143
143
 
144
- .deck {
144
+ [part="plate"] {
145
145
  padding: var(--pad);
146
146
  --tint: oklch(from var(--prime) l c h / 50%);
147
147
  }
@@ -196,11 +196,11 @@ slot[part="tabs"][data-snug] {
196
196
  }
197
197
  }
198
198
 
199
- }`;var Z=b`
199
+ }`;var k2=ee`
200
200
  @layer theme, view;
201
201
  @layer theme {
202
202
 
203
- ${St}
203
+ ${Uf}
204
204
 
205
205
  :host {
206
206
  --prime: var(--tact-prime, #fb0);
@@ -276,7 +276,7 @@ ${St}
276
276
  --base: var(--tint, var(--prime));
277
277
  font: inherit;
278
278
  color: inherit;
279
- background: transparent;
279
+ background: var(--bg);
280
280
  border: 1px solid var(--base);
281
281
  border-radius: var(--round);
282
282
  padding: var(--nib) var(--pad);
@@ -305,252 +305,9 @@ ${St}
305
305
  box-shadow: inset 0 0 1em oklch(from var(--chill) l c h / 20%);
306
306
  }
307
307
 
308
- }`;var Tt=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-GameController"><path d="M9 15l-2.968 2.968A2.362 2.362 0 0 1 2 16.298V15l1.357-6.784A4 4 0 0 1 7.279 5h9.442a4 4 0 0 1 3.922 3.216L22 15v1.297a2.362 2.362 0 0 1-4.032 1.67L15 15H9z"/><path d="M9 5l1 2h4l1-2"/></svg>`;var ts=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-SettingsHorizontal"><path d="M3 5h4m14 0H11m-8 7h12m6 0h-2M3 19h2m16 0H9"/><circle cx="9" cy="5" r="2"/><circle cx="17" cy="12" r="2"/><circle cx="7" cy="19" r="2"/></svg>`;var es=b`@layer view {
308
+ }`;var Wf=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-GameController"><path d="M9 15l-2.968 2.968A2.362 2.362 0 0 1 2 16.298V15l1.357-6.784A4 4 0 0 1 7.279 5h9.442a4 4 0 0 1 3.922 3.216L22 15v1.297a2.362 2.362 0 0 1-4.032 1.67L15 15H9z"/><path d="M9 5l1 2h4l1-2"/></svg>`;var Wh=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-SettingsHorizontal"><path d="M3 5h4m14 0H11m-8 7h12m6 0h-2M3 19h2m16 0H9"/><circle cx="9" cy="5" r="2"/><circle cx="17" cy="12" r="2"/><circle cx="7" cy="19" r="2"/></svg>`;var Gh=ee`@layer view {
309
309
 
310
- .plate {
311
- user-select: none;
312
- display: flex;
313
- flex-direction: column;
314
- align-items: center;
315
- gap: var(--pad);
316
- }
317
-
318
- [data-drag-and-drop] {
319
- .player[data-drop-candidate] {
320
- outline: 2px dashed color-mix(in oklch, transparent, var(--droppy) 80%);
321
- background: color-mix(in oklch, var(--slate), var(--droppy) 20%);
322
-
323
- &[data-dropping] {
324
- outline: 2px solid var(--droppy);
325
- background: color-mix(in oklch, var(--slate), var(--droppy) 50%);
326
- }
327
- }
328
- }
329
-
330
- .playerlist {
331
- display: grid;
332
- grid-template-columns: repeat(
333
- auto-fit,
334
- minmax(min(100%, 20em), 1fr)
335
- );
336
-
337
- width: min(100%, calc(48em + var(--pad)));
338
- gap: var(--pad);
339
-
340
- > * {
341
- min-width: 0;
342
- min-height: 7em;
343
- }
344
- }
345
-
346
- .player {
347
- display: flex;
348
- flex-direction: column;
349
-
350
- &.new {
351
- justify-content: center;
352
- align-items: center;
353
- padding: var(--pad);
354
-
355
- border-style: dashed;
356
- border-width: 2px;
357
- border-color: oklch(from var(--text) l c h / 30%);
358
- background: transparent;
359
- box-shadow: none;
360
-
361
- button {
362
- display: flex;
363
- flex-direction: column;
364
- svg {
365
- width: 2.5em;
366
- height: 2.5em;
367
- }
368
- }
369
- }
370
-
371
- h3 {
372
- display: flex;
373
- flex-wrap: wrap;
374
- justify-content: space-between;
375
- padding: var(--nib) var(--pad);
376
- }
377
-
378
- .controllerlist {
379
- display: flex;
380
- flex: 1 1 auto;
381
- flex-direction: column;
382
- gap: var(--pad);
383
- padding: var(--pad);
384
- }
385
-
386
- .controller {
387
- --tint: oklch(0.7 0.3 var(--hue, 0));
388
- background: color-mix(in oklch, transparent, var(--bg) 50%);
389
- border: 2px solid var(--shimmer);
390
- box-shadow:
391
- inset 0 0 2em color-mix(in oklch, transparent, var(--shimmer)),
392
- var(--box-shadow);
393
-
394
- &:hover {
395
- background: color-mix(in oklch, transparent, var(--bg) 70%);
396
- filter: brightness(120%);
397
- }
398
-
399
- [view="profile-select"]::part(select) {
400
- --base: oklch(from var(--tint) l c h / 50%);
401
- }
402
- }
403
-
404
- .controller {
405
- cursor: grab;
406
- display: flex;
407
- align-items: center;
408
-
409
- gap: var(--pad);
410
- padding: var(--nib);
411
-
412
- border-radius: 0.5em;
413
- overflow: clip;
414
-
415
- .griptape {
416
- display: flex;
417
- justify-content: center;
418
- align-items: center;
419
-
420
- width: 1.5em;
421
- flex: 0 0 auto;
422
-
423
- svg {
424
- opacity: 0.5;
425
- }
426
- }
427
-
428
- .label {
429
- display: flex;
430
- align-items: center;
431
- gap: var(--pad);
432
- min-width: 0;
433
-
434
- flex: 1 1 auto;
435
- font-size: 1em;
436
- font-weight: normal;
437
-
438
- .icon {
439
- display: flex;
440
- flex: 0 0 auto;
441
- svg {
442
- width: 2em;
443
- height: 2em;
444
- }
445
- }
446
-
447
- .name {
448
- min-width: 0;
449
- line-height: 1.1;
450
- font-size: 0.7em;
451
- overflow: hidden;
452
- text-overflow: ellipsis;
453
- }
454
- }
455
-
456
- select {
457
- padding: var(--nib) var(--pad);
458
- }
459
- }
460
- }
461
-
462
- }`;var rs=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-PersonAdd"><circle cx="12" cy="7" r="5"/><path d="M17 22H5.266a2 2 0 0 1-1.985-2.248l.39-3.124A3 3 0 0 1 6.649 14H7"/><path d="M19 14v4"/><path d="M17 16h4"/></svg>`;var Ye=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-XSmall"><path d="M17 17L7 7m10 0L7 17"/></svg>`;var Xt=A(r=>{let{dnd:t}=r.context,e=t.dropzone(()=>({playerId:r.playerId}));return h`
463
- <div class="${r.class}"
464
- theme-card="${r.themeCard??""}"
465
- data-drop-candidate
466
- ?data-dropping="${t.hovering?.playerId===r.playerId}"
467
- @dragenter="${e.dragenter}"
468
- @dragleave="${e.dragleave}"
469
- @dragover="${e.dragover}"
470
- @drop="${e.drop}">
471
-
472
- ${r.content}
473
- </div>
474
- `});var os=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="currentColor" stroke-width="2" class="ai ai-DragVerticalFill"><path fill-rule="evenodd" clip-rule="evenodd" d="M16 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 18a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 18a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/></svg>`;function ss(r){return r*137.508}var tr=A((r,t,e)=>{let{profiles:o}=r.controls;function s(n){let i=n.currentTarget;e(i.value)}return h`
475
- <select
476
- part=select
477
- theme-select
478
- .value="${t}"
479
- @change="${s}">
480
-
481
- ${o.presets.map(([n,i])=>h`
482
- <option
483
- value="${n}"
484
- ?selected="${n===t}">
485
- ${i.label}
486
- </option>
487
- `)}
488
-
489
- ${o.customs.map(([n,i])=>h`
490
- <option
491
- value="${n}"
492
- ?selected="${n===t}">
493
- ${i.label}
494
- </option>
495
- `)}
496
- </select>
497
- `});var er=A((r,t)=>{let{deck:e,dnd:o}=r,{controls:s}=e,n=o.dragzone(()=>({controller:t})),i=s.assignments.assignedProfileKeyOf(t),a=s.meta(t)??{id:0,icon:Tt,handle:"controller",name:"controller",tooltip:"",defaultProfileKey:s.fallbackProfileKey},c=`--hue: ${ss(a?.id??0)};`;return h`
498
- <div class=controller
499
- style="${c}"
500
- theme-card
501
- ?data-dragging="${o.dragging?.controller===t}"
502
- draggable="${n.draggable}"
503
- @dragstart="${n.dragstart}"
504
- @dragend="${n.dragend}">
505
-
506
- <div class=griptape>
507
- ${os}
508
- </div>
509
-
510
- <h4 class=label title="${a.tooltip}">
511
- <span class=icon>${a.icon}</span>
512
- <span class=name>${a.name}</span>
513
- </h4>
514
-
515
- ${tr(e,i,l=>{s.assignments.assign(t,l)})}
516
- </div>
517
- `});var ns=A((r,t,e)=>{let{hub:o}=r.deck,s=()=>o.deletePlayer(t),n=o.controllers.assigned.get(t)??[];return Xt({class:"player",playerId:t,context:r,content:h`
518
- <h3>
519
- <span>player ${e+1}</span>
520
-
521
- ${kt(o.playerIds.length>1,()=>h`
522
- <button theme-button="naked angry" @click=${s}>
523
- ${Ye}
524
- </button>
525
- `)}
526
- </h3>
527
-
528
- <div class=controllerlist>
529
- ${n.map(i=>er(r,i))}
530
- </div>
531
- `})});var Cr=Symbol("droppyNewPlayer");var[is,as]=J(r=>{B(Z,es);let{hub:t}=r,e=t.controllers,o=()=>r.hub.createPlayer(),s=(i,a)=>ns(n,i,a),n=y(()=>({deck:r,dnd:new $e.DragAndDrops({acceptDrop(i,a,c){c.playerId===Cr?t.plug(a.controller,t.createPlayer()):C(c.playerId)?t.plug(a.controller,c.playerId):t.unplug(a.controller)}})}));return h`
532
- <div class=plate ?data-drag-and-drop="${!!n.dnd.dragging}">
533
- <div class=playerlist>
534
- ${t.playerIds.map(s)}
535
-
536
- ${kt(t.playerIds.length<r.maxPlayers,()=>Xt({class:"player new",themeCard:"dull",playerId:Cr,context:n,content:h`
537
- <button theme-button=naked @click="${o}">
538
- ${rs}
539
- <span>add player</span>
540
- </button>
541
- `}))}
542
-
543
- ${Xt({class:"player unassigned",themeCard:"dull",playerId:null,context:n,content:h`
544
- <h3>unassigned</h3>
545
- <div class=controllerlist>
546
- ${e.unassigned.map(i=>er(n,i))}
547
- </div>
548
- `})}
549
- </div>
550
- </div>
551
- `});var cs=b`@layer view {
552
-
553
- .plate {
310
+ [part="plate"] {
554
311
  display: flex;
555
312
  flex-direction: column;
556
313
  }
@@ -688,131 +445,375 @@ ${St}
688
445
  }
689
446
  }
690
447
 
691
- }`;var ls=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Copy"><path d="M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.083 2.57A2 2 0 0 0 14.685 2H10a2 2 0 0 0-2 2z"/><path d="M16 18v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h2"/></svg>`;var us=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-TrashCan"><path d="M4 6h16l-1.58 14.22A2 2 0 0 1 16.432 22H7.568a2 2 0 0 1-1.988-1.78L4 6z"/><path d="M7.345 3.147A2 2 0 0 1 9.154 2h5.692a2 2 0 0 1 1.81 1.147L18 6H6l1.345-2.853z"/><path d="M2 6h20"/><path d="M10 11v5"/><path d="M14 11v5"/></svg>`;function Er(){return ge.random(16)}var ps=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-KeyCap"><path d="M7 3s3 .5 5 .5 5-.5 5-.5l1 9s-3 1-6 1-6-1-6-1l1-9z"/><path d="M3.869 8.147l-.862 10.294c-.03.366.04.733.205 1.06l.197.393A2.01 2.01 0 0 0 5.206 21h13.588a2.01 2.01 0 0 0 1.797-1.106l.197-.392c.165-.328.236-.695.205-1.06l-.862-10.295a3.99 3.99 0 0 0-.79-2.068L17 3s-3 .5-5 .5S6.978 3 6.978 3l-2.32 3.08a3.99 3.99 0 0 0-.79 2.067z"/><path d="M6 12l-2.5 8M18 12l2.5 8"/></svg>`;var hs=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Backspace"><path d="M17 15l-6-6m6 0l-6 6"/><path d="M7.4 4.8A2 2 0 0 1 9 4h11a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H9a2 2 0 0 1-1.6-.8l-4.5-6a2 2 0 0 1 0-2.4l4.5-6z"/></svg>`;var ds=f`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Cross"><path d="M20 20L4 4m16 0L4 20"/></svg>`;function ms(r,t){let e=new Set,o=new Set;function s(a){if(a==="ShiftLeft"||a==="ShiftRight")return"shift";if(a==="ControlLeft"||a==="ControlRight")return"ctrl";if(a==="MetaLeft"||a==="MetaRight")return"meta";if(a==="AltLeft"||a==="AltRight")return"alt"}let n=E(window,{blur:()=>i(),keydown:a=>{if(a.preventDefault(),a.code==="Escape")return i();e.add(a.code),o.add(a.code)},keyup:a=>{if(a.preventDefault(),e.delete(a.code),e.size===0){let c=new Set,l=new Set;for(let p of o){let u=s(p);u?l.add(u):c.add(p)}o.size===0||(c.size===0?r(["*",...o]):l.size>0?r(["*",["mod",...l],...c]):o.size>1?r(["*",...o]):r([...o][0])),i()}}}),i=()=>{n(),t()};return i}function fs(r,t){let{dispose:e,schedule:o}=V();o(t);let s=new Set,n=new Set,i=new Set;return o(E(window,{blur:()=>e()})),o(Ke(a=>{let c=new Pt(a);return s.add(c),c.onSample(l=>{if(l.code!=="gamepad.any")if(l.value>.9)n.add(l.code),i.add(l.code);else{if(!n.delete(l.code))return;n.size===0&&(i.size===1?r([...i][0]):i.size>1&&r(["*",...i]),e())}}),()=>{c.dispose(),s.delete(c)}})),o(wt(async()=>{for(let a of s)a.poll();await $t(16.67)})),e}function gs(r,t){let{dispose:e,schedule:o}=V();o(t);let s=new Set,n=new Set,i=a=>a.composedPath().some(c=>c instanceof Element&&c.matches("button.record"));return o(E(window,{blur:()=>e(),auxclick:a=>a.preventDefault(),mousedown:a=>{if(i(a))return;a.preventDefault();let c=zt(a.button);s.add(c),n.add(c)},mouseup:a=>{let c=zt(a.button);s.delete(c)&&(a.preventDefault(),s.size===0&&(n.size===1?r([...n][0]):n.size>1&&r(["*",...n]),e()))},contextmenu:a=>{a.preventDefault()}})),e}var bs=A((r,t,e,o)=>{let s=H(null),n=()=>s(null),i=()=>{let{dispose:p,schedule:u}=V();u(n),u(ms(t,p)),u(fs(t,p)),u(gs(t,p)),s(p)},a=()=>{s()?.(),n()};function c(){s()?a():i()}function l(){a(),e()}return So(a),h`
692
- <div class=recorder ?data-recording="${!!s()}">
693
- ${o}
694
- ${r?null:h`
448
+ }`;var Xh=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Copy"><path d="M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.083 2.57A2 2 0 0 0 14.685 2H10a2 2 0 0 0-2 2z"/><path d="M16 18v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h2"/></svg>`;var Jh=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-TrashCan"><path d="M4 6h16l-1.58 14.22A2 2 0 0 1 16.432 22H7.568a2 2 0 0 1-1.988-1.78L4 6z"/><path d="M7.345 3.147A2 2 0 0 1 9.154 2h5.692a2 2 0 0 1 1.81 1.147L18 6H6l1.345-2.853z"/><path d="M2 6h20"/><path d="M10 11v5"/><path d="M14 11v5"/></svg>`;function Jp(){return Mf.random(16)}var Yh=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-KeyCap"><path d="M7 3s3 .5 5 .5 5-.5 5-.5l1 9s-3 1-6 1-6-1-6-1l1-9z"/><path d="M3.869 8.147l-.862 10.294c-.03.366.04.733.205 1.06l.197.393A2.01 2.01 0 0 0 5.206 21h13.588a2.01 2.01 0 0 0 1.797-1.106l.197-.392c.165-.328.236-.695.205-1.06l-.862-10.295a3.99 3.99 0 0 0-.79-2.068L17 3s-3 .5-5 .5S6.978 3 6.978 3l-2.32 3.08a3.99 3.99 0 0 0-.79 2.067z"/><path d="M6 12l-2.5 8M18 12l2.5 8"/></svg>`;var Zh=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Backspace"><path d="M17 15l-6-6m6 0l-6 6"/><path d="M7.4 4.8A2 2 0 0 1 9 4h11a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H9a2 2 0 0 1-1.6-.8l-4.5-6a2 2 0 0 1 0-2.4l4.5-6z"/></svg>`;var Qh=mt`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Cross"><path d="M20 20L4 4m16 0L4 20"/></svg>`;function tm(o,t){let e=new Set,s=new Set;function r(i){if(i==="ShiftLeft"||i==="ShiftRight")return"shift";if(i==="ControlLeft"||i==="ControlRight")return"ctrl";if(i==="MetaLeft"||i==="MetaRight")return"meta";if(i==="AltLeft"||i==="AltRight")return"alt"}let n=ec(window,{blur:()=>c(),keydown:i=>{if(i.preventDefault(),i.code==="Escape")return c();e.add(i.code),s.add(i.code)},keyup:i=>{if(i.preventDefault(),e.delete(i.code),e.size===0){let a=new Set,u=new Set;for(let v of s){let m=r(v);m?u.add(m):a.add(v)}s.size===0||(a.size===0?o(["*",...s]):u.size>0?o(["*",["mod",...u],...a]):s.size>1?o(["*",...s]):o([...s][0])),c()}}}),c=()=>{n(),t()};return c}function em(o,t){let{dispose:e,schedule:s}=J0();s(t);let r=new Set,n=new Set,c=new Set;return s(ec(window,{blur:()=>e()})),s(b1(i=>{let a=new Ff(i);return r.add(a),a.onSample(u=>{if(u.code!=="gamepad.any")if(u.value>.9)n.add(u.code),c.add(u.code);else{if(!n.delete(u.code))return;n.size===0&&(c.size===1?o([...c][0]):c.size>1&&o(["*",...c]),e())}}),()=>{a.dispose(),r.delete(a)}})),s(jf(async()=>{for(let i of r)i.poll();await zf(16.67)})),e}function om(o,t){let{dispose:e,schedule:s}=J0();s(t);let r=new Set,n=new Set,c=i=>i.composedPath().some(a=>a instanceof Element&&a.matches("button.record"));return s(ec(window,{blur:()=>e(),auxclick:i=>i.preventDefault(),mousedown:i=>{if(c(i))return;i.preventDefault();let a=qf(i.button);r.add(a),n.add(a)},mouseup:i=>{let a=qf(i.button);r.delete(a)&&(i.preventDefault(),r.size===0&&(n.size===1?o([...n][0]):n.size>1&&o(["*",...n]),e()))},contextmenu:i=>{i.preventDefault()}})),e}var nm=Ei((o,t,e,s)=>{let r=p2(null),n=()=>r(null),c=()=>{let{dispose:v,schedule:m}=J0();m(n),m(tm(t,v)),m(em(t,v)),m(om(t,v)),r(v)},i=()=>{r()?.(),n()};function a(){r()?i():c()}function u(){i(),e()}return ih(i),I`
449
+ <div class=recorder ?data-recording="${!!r()}">
450
+ ${s}
451
+ ${o?null:I`
695
452
  <button
696
453
  class=record
697
454
  theme-button=naked
698
455
  title="record a keypress"
699
- @click=${c}>
700
- ${s()?ds:ps}
456
+ @click=${a}>
457
+ ${r()?Qh:Yh}
701
458
  </button>
702
459
 
703
460
  <button
704
461
  theme-button=naked
705
462
  title="reset to default"
706
- @click=${l}>
707
- ${hs}
463
+ @click=${u}>
464
+ ${Zh}
708
465
  </button>
709
466
  `}
710
467
  </div>
711
- `});var Mr=A((r,t,e)=>{if(!C(t))return h`
468
+ `});var A1=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-XSmall"><path d="M17 17L7 7m10 0L7 17"/></svg>`;var Yp=Ei((o,t,e)=>{if(!k0(t))return I`
712
469
  <div class=null>unset</div>
713
- `;if(bt(t))return h`
470
+ `;if(Bf(t))return I`
714
471
  <div class=number>
715
472
  <input
716
473
  type=number
717
474
  step=any
718
475
  theme-input
719
476
  .value="${t}"
720
- ?readonly="${r}"
721
- @change="${o=>{let n=o.currentTarget.valueAsNumber;Number.isFinite(n)&&e(n)}}"
477
+ ?readonly="${o}"
478
+ @change="${s=>{let n=s.currentTarget.valueAsNumber;Number.isFinite(n)&&e(n)}}"
722
479
  />
723
480
  </div>
724
- `;if(xt(t))return h`
481
+ `;if(Pf(t))return I`
725
482
  <input
726
483
  type=text
727
484
  theme-input
728
485
  .value="${t}"
729
- ?readonly="${r}"
730
- @change="${o=>{let n=o.currentTarget.value;e(n)}}"/>
731
- `;if(be(t))return t[0]==="mod"?h`
486
+ ?readonly="${o}"
487
+ @change="${s=>{let n=s.currentTarget.value;e(n)}}"/>
488
+ `;if(Tu(t))return t[0]==="mod"?I`
732
489
  <div class="bracket mod">
733
490
  ${t.slice(1).length===0?"unmodified":t.slice(1).join("+")}
734
491
 
735
- ${!r&&t.slice(1).length>0?h`
492
+ ${!o&&t.slice(1).length>0?I`
736
493
  <button
737
494
  theme-button=naked
738
495
  @click="${()=>e([t[0]])}">
739
- ${Ye}
496
+ ${A1}
740
497
  </button>
741
498
  `:null}
742
499
  </div>
743
- `:h`
500
+ `:I`
744
501
  <div class=bracket>
745
- ${t[0]==="*"?null:h`
502
+ ${t[0]==="*"?null:I`
746
503
  <strong>${t[0]}</strong>
747
504
  `}
748
- ${t.slice(1).map((o,s)=>Mr(r,o??null,n=>{let i=structuredClone(t);i[s+1]=n,e(i)}))}
505
+ ${t.slice(1).map((s,r)=>Yp(o,s??null,n=>{let c=structuredClone(t);c[r+1]=n,e(c)}))}
749
506
  </div>
750
- `;throw new Error("unknown expression")});function rr(r,t,e,o){return at(t)?Mr(r,t,o):Object.entries(t).map(([s,n])=>at(n)?kn(r,t,e,o,s):$n(r,t,e,o,s))}function $n(r,t,e,o,s){return h`
507
+ `;throw new Error("unknown expression")});function S1(o,t,e,s){return gf(t)?Yp(o,t,s):Object.entries(t).map(([r,n])=>gf(n)?_3(o,t,e,s,r):k3(o,t,e,s,r))}function k3(o,t,e,s,r){return I`
751
508
  <details class=group open>
752
- <summary>${s}</summary>
509
+ <summary>${r}</summary>
753
510
  <div class=children>
754
- ${rr(r,t[s],e[s],n=>o({...t,[s]:n}))}
511
+ ${S1(o,t[r],e[r],n=>s({...t,[r]:n}))}
755
512
  </div>
756
513
  </details>
757
- `}function kn(r,t,e,o,s){let n=a=>o({...t,[s]:a});return h`
514
+ `}function _3(o,t,e,s,r){let n=i=>s({...t,[r]:i});return I`
758
515
  <div class=expression>
759
- <strong>${s}</strong>
760
- ${bs(r,n,()=>n(e[s]),rr(r,t[s],e[s],n))}
516
+ <strong>${r}</strong>
517
+ ${nm(o,n,()=>n(e[r]),S1(o,t[r],e[r],n))}
761
518
  </div>
762
- `}var[xs,ys]=J(r=>{B(Z,cs);let{controls:t,controls:{profiles:e}}=r,o=H(t.fallbackProfileKey),s=e.get(o()),n=e.isPreset(o()),i=s.basedOn?e.get(s.basedOn):s,a=u=>{let m=o();if(e.isPreset(m)){let _=m,Q=Er();m=Q,e.clone(Q,_)}e.update(m,{bindings:u}),o(m)},c=(u,m)=>e.update(u,{label:m}),l=()=>{let u=Er();e.clone(u,o()),o.set(u)},p=()=>{e.delete(o()),o(t.fallbackProfileKey)};return h`
763
- <div class=plate theme-card>
519
+ `}var $1=Ei((o,t,e)=>{let{profiles:s}=o.controls;function r(n){let c=n.currentTarget;e(c.value)}return I`
520
+ <select
521
+ part=select
522
+ theme-select
523
+ .value="${t}"
524
+ @change="${r}">
525
+
526
+ ${s.presets.map(([n,c])=>I`
527
+ <option
528
+ value="${n}"
529
+ ?selected="${n===t}">
530
+ ${c.label}
531
+ </option>
532
+ `)}
533
+
534
+ ${s.customs.map(([n,c])=>I`
535
+ <option
536
+ value="${n}"
537
+ ?selected="${n===t}">
538
+ ${c.label}
539
+ </option>
540
+ `)}
541
+ </select>
542
+ `});var[sm,rm]=y2(o=>{Z0("tact-customize"),r2(k2,Gh);let{controls:t,controls:{profiles:e}}=o,s=p2(t.fallbackProfileKey),r=e.get(s()),n=e.isPreset(s()),c=r.basedOn?e.get(r.basedOn):r,i=async m=>{let $=s();if(e.isPreset($)){let H=$,ht=Jp();$=ht,await e.clone(ht,H)}await e.update($,{bindings:m}),s($)},a=(m,$)=>e.update(m,{label:$}),u=()=>{let m=Jp();e.clone(m,s()),s.set(m)},v=()=>{e.delete(s()),s(t.fallbackProfileKey)};return I`
543
+ <div part=plate>
764
544
  <header class=topbar>
765
545
  <div class=corner>
766
- ${tr(r,o(),o)}
546
+ ${$1(o,s(),s)}
767
547
 
768
- <button title="copy this profile" theme-button=naked @click="${l}">
769
- ${ls}
548
+ <button title="copy this profile" theme-button=naked @click="${u}">
549
+ ${Xh}
770
550
  </button>
771
551
 
772
- ${n?null:h`
773
- <button title="delete this profile" theme-button=naked @click="${p}">
774
- ${us}
552
+ ${n?null:I`
553
+ <button title="delete this profile" theme-button=naked @click="${v}">
554
+ ${Jh}
775
555
  </button>
776
556
  `}
777
557
 
778
- ${kt(n,()=>h`<small>readonly</small>`)}
779
- ${ye(s.basedOn,u=>h`<small>based on ${e.get(u).label}</small>`)}
558
+ ${Tf(n,()=>I`<small>readonly</small>`)}
559
+ ${Uu(r.basedOn,m=>I`<small>based on ${e.get(m).label}</small>`)}
780
560
  </div>
781
561
 
782
562
  <div class=tools>
783
- ${n?null:h`
563
+ ${n?null:I`
784
564
  <input
785
565
  type=text
786
566
  theme-input
787
- .value="${s.label}"
788
- @change="${u=>{let m=u.currentTarget;c(o(),m.value)}}"
567
+ .value="${r.label}"
568
+ @change="${m=>{let $=m.currentTarget;a(s(),$.value)}}"
789
569
  />
790
570
  `}
791
571
  </div>
792
572
  </header>
793
573
 
794
574
  <div class=bindings>
795
- ${rr(!1,s.bindings,i.bindings,a)}
575
+ ${S1(!1,r.bindings,c.bindings,i)}
576
+ </div>
577
+ </div>
578
+ `});var cm=ee`@layer view {
579
+
580
+ [part="plate"] {
581
+ user-select: none;
582
+ display: flex;
583
+ flex-direction: column;
584
+ align-items: center;
585
+ gap: var(--pad);
586
+ }
587
+
588
+ [data-drag-and-drop] {
589
+ .player[data-drop-candidate] {
590
+ outline: 2px dashed color-mix(in oklch, transparent, var(--droppy) 80%);
591
+ background: color-mix(in oklch, var(--slate), var(--droppy) 20%);
592
+
593
+ &[data-dropping] {
594
+ outline: 2px solid var(--droppy);
595
+ background: color-mix(in oklch, var(--slate), var(--droppy) 50%);
596
+ }
597
+ }
598
+ }
599
+
600
+ .playerlist {
601
+ display: grid;
602
+ grid-template-columns: repeat(
603
+ auto-fit,
604
+ minmax(min(100%, 20em), 1fr)
605
+ );
606
+
607
+ width: min(100%, calc(48em + var(--pad)));
608
+ gap: var(--pad);
609
+
610
+ > * {
611
+ min-width: 0;
612
+ min-height: 7em;
613
+ }
614
+ }
615
+
616
+ .player {
617
+ display: flex;
618
+ flex-direction: column;
619
+
620
+ &.new {
621
+ justify-content: center;
622
+ align-items: center;
623
+ padding: var(--pad);
624
+
625
+ border-style: dashed;
626
+ border-width: 2px;
627
+ border-color: oklch(from var(--text) l c h / 30%);
628
+ background: transparent;
629
+ box-shadow: none;
630
+
631
+ button {
632
+ display: flex;
633
+ flex-direction: column;
634
+ svg {
635
+ width: 2.5em;
636
+ height: 2.5em;
637
+ }
638
+ }
639
+ }
640
+
641
+ h3 {
642
+ display: flex;
643
+ flex-wrap: wrap;
644
+ justify-content: space-between;
645
+ padding: var(--nib) var(--pad);
646
+ }
647
+
648
+ .controllerlist {
649
+ display: flex;
650
+ flex: 1 1 auto;
651
+ flex-direction: column;
652
+ gap: var(--pad);
653
+ padding: var(--pad);
654
+ }
655
+
656
+ .controller {
657
+ --tint: oklch(0.7 0.3 var(--hue, 0));
658
+ background: color-mix(in oklch, transparent, var(--bg) 50%);
659
+ border: 2px solid var(--shimmer);
660
+ box-shadow:
661
+ inset 0 0 2em color-mix(in oklch, transparent, var(--shimmer)),
662
+ var(--box-shadow);
663
+
664
+ &:hover {
665
+ background: color-mix(in oklch, transparent, var(--bg) 70%);
666
+ filter: brightness(120%);
667
+ }
668
+
669
+ [view="profile-select"]::part(select) {
670
+ --base: oklch(from var(--tint) l c h / 50%);
671
+ }
672
+ }
673
+
674
+ .controller {
675
+ cursor: grab;
676
+ display: flex;
677
+ align-items: center;
678
+
679
+ gap: var(--pad);
680
+ padding: var(--nib);
681
+
682
+ border-radius: 0.5em;
683
+ overflow: clip;
684
+
685
+ .griptape {
686
+ display: flex;
687
+ justify-content: center;
688
+ align-items: center;
689
+
690
+ width: 1.5em;
691
+ flex: 0 0 auto;
692
+
693
+ svg {
694
+ opacity: 0.5;
695
+ }
696
+ }
697
+
698
+ .label {
699
+ display: flex;
700
+ align-items: center;
701
+ gap: var(--pad);
702
+ min-width: 0;
703
+
704
+ flex: 1 1 auto;
705
+ font-size: 1em;
706
+ font-weight: normal;
707
+
708
+ .icon {
709
+ display: flex;
710
+ flex: 0 0 auto;
711
+ svg {
712
+ width: 2em;
713
+ height: 2em;
714
+ }
715
+ }
716
+
717
+ .name {
718
+ min-width: 0;
719
+ line-height: 1.1;
720
+ font-size: 0.7em;
721
+ overflow: hidden;
722
+ text-overflow: ellipsis;
723
+ }
724
+ }
725
+
726
+ select {
727
+ padding: var(--nib) var(--pad);
728
+ }
729
+ }
730
+ }
731
+
732
+ }`;var im=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-PersonAdd"><circle cx="12" cy="7" r="5"/><path d="M17 22H5.266a2 2 0 0 1-1.985-2.248l.39-3.124A3 3 0 0 1 6.649 14H7"/><path d="M19 14v4"/><path d="M17 16h4"/></svg>`;var gu=Ei(o=>{let{dnd:t}=o.context,e=t.dropzone(()=>({playerId:o.playerId}));return I`
733
+ <div class="${o.class}"
734
+ theme-card="${o.themeCard??""}"
735
+ data-drop-candidate
736
+ ?data-dropping="${t.hovering?.playerId===o.playerId}"
737
+ @dragenter="${e.dragenter}"
738
+ @dragleave="${e.dragleave}"
739
+ @dragover="${e.dragover}"
740
+ @drop="${e.drop}">
741
+
742
+ ${o.content}
743
+ </div>
744
+ `});var am=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="currentColor" stroke-width="2" class="ai ai-DragVerticalFill"><path fill-rule="evenodd" clip-rule="evenodd" d="M16 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 18a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16 18a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"/></svg>`;function lm(o){return o*137.508}var E1=Ei((o,t)=>{let{deck:e,dnd:s}=o,{controls:r}=e,n=s.dragzone(()=>({controller:t})),c=r.assignments.assignedProfileKeyOf(t),i=r.meta(t)??{id:0,icon:Wf,handle:"controller",name:"controller",tooltip:"",defaultProfileKey:r.fallbackProfileKey},a=`--hue: ${lm(i?.id??0)};`;return I`
745
+ <div class=controller
746
+ style="${a}"
747
+ theme-card
748
+ ?data-dragging="${s.dragging?.controller===t}"
749
+ draggable="${n.draggable}"
750
+ @dragstart="${n.dragstart}"
751
+ @dragend="${n.dragend}">
752
+
753
+ <div class=griptape>
754
+ ${am}
755
+ </div>
756
+
757
+ <h4 class=label title="${i.tooltip}">
758
+ <span class=icon>${i.icon}</span>
759
+ <span class=name>${i.name}</span>
760
+ </h4>
761
+
762
+ ${$1(e,c,u=>{r.assignments.assign(t,u)})}
763
+ </div>
764
+ `});var fm=Ei((o,t,e)=>{let{hub:s}=o.deck,r=()=>s.deletePlayer(t),n=s.controllers.assigned.get(t)??[];return gu({class:"player",playerId:t,context:o,content:I`
765
+ <h3>
766
+ <span>player ${e+1}</span>
767
+
768
+ ${Tf(s.playerIds.length>1,()=>I`
769
+ <button theme-button="naked angry" @click=${r}>
770
+ ${A1}
771
+ </button>
772
+ `)}
773
+ </h3>
774
+
775
+ <div class=controllerlist>
776
+ ${n.map(c=>E1(o,c))}
777
+ </div>
778
+ `})});var Zp=Symbol("droppyNewPlayer");var[um,vm]=y2(o=>{Z0("tact-controllers"),r2(k2,cm);let{hub:t}=o,e=t.controllers,s=()=>o.hub.createPlayer(),r=(c,i)=>fm(n,c,i),n=ne(()=>({deck:o,dnd:new Hu.DragAndDrops({acceptDrop(c,i,a){a.playerId===Zp?t.plug(i.controller,t.createPlayer()):k0(a.playerId)?t.plug(i.controller,a.playerId):t.unplug(i.controller)}})}));return I`
779
+ <div part=plate ?data-drag-and-drop="${!!n.dnd.dragging}">
780
+ <div class=playerlist>
781
+ ${t.playerIds.map(r)}
782
+
783
+ ${Tf(t.playerIds.length<o.maxPlayers,()=>gu({class:"player new",themeCard:"dull",playerId:Zp,context:n,content:I`
784
+ <button theme-button=naked @click="${s}">
785
+ ${im}
786
+ <span>add player</span>
787
+ </button>
788
+ `}))}
789
+
790
+ ${gu({class:"player unassigned",themeCard:"dull",playerId:null,context:n,content:I`
791
+ <h3>unassigned</h3>
792
+ <div class=controllerlist>
793
+ ${e.unassigned.map(c=>E1(n,c))}
794
+ </div>
795
+ `})}
796
796
  </div>
797
797
  </div>
798
- `});var[by,ws]=J(r=>{B(Z,Yo);let t={slot:"panel"},e=y(()=>new Ot);return y(()=>{window.location.hash.includes("bindings")&&e.setIndex(1)}),h`
799
- <div class=deck theme-card>
800
- ${Xo.with({props:[{control:e}],children:h`
798
+ `});var[pS,pm]=y2(o=>{Z0("tact-deck"),r2(k2,Kh);let t=ne(()=>new Kf);return ne(()=>{window.location.hash.includes("bindings")&&t.setIndex(1)}),I`
799
+ <div part=plate theme-card>
800
+ ${qh.with({props:[{control:t}],children:I`
801
801
  <button theme-button>
802
- ${Tt}
802
+ ${Wf}
803
803
  <span>controllers</span>
804
804
  </button>
805
805
 
806
806
  <button theme-button>
807
- ${ts}
807
+ ${Wh}
808
808
  <span>customize</span>
809
809
  </button>
810
810
 
811
- ${is.with({attrs:t,props:[r]})}
812
- ${xs.with({attrs:t,props:[r]})}
811
+ ${um.with({props:[o],attrs:{slot:"panel"}})}
812
+
813
+ ${sm.with({props:[o],attrs:{slot:"panel"}})}
813
814
  `})}
814
815
  </div>
815
- `});var vs=b`@layer view {
816
+ `});var dm=ee`@layer view {
816
817
 
817
818
  :host {
818
819
  display: block;
@@ -820,19 +821,22 @@ ${St}
820
821
 
821
822
  output {
822
823
  opacity: 0.5;
823
- color: var(--prime);
824
- font-size: 1em;
825
- font-family: monospace;
826
824
  display: block;
827
- overflow-wrap: anywhere;
828
- text-overflow: ellipsis;
825
+
826
+ font-size: 1em;
829
827
  height: 8em;
830
- padding: 0 4em;
828
+
831
829
  overflow: hidden;
830
+ overflow-wrap: anywhere;
831
+
832
+ font-family: monospace;
833
+ color: var(--prime);
834
+ text-overflow: ellipsis;
832
835
  }
833
836
 
834
- }`;var[Ay,$s]=J(r=>(B(Z,vs),h`
835
- <output class=viz>${r.$hex()}</output>
836
- `));var ks=f`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Devices"><path d="M10 15H4V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2"/><path d="M2 18h12"/><path d="M14 9.2c0-.663.597-1.2 1.333-1.2h5.334C21.403 8 22 8.537 22 9.2v9.6c0 .663-.597 1.2-1.333 1.2h-5.334C14.597 20 14 19.463 14 18.8V9.2z"/><path d="M18 17h.01"/></svg>`;function Ss(r,t){return r.length>t?r.slice(0,t)+"...":r}async function As(r){let t=await Vo(r),e=new Ze,o={TactDeck:ws(t),TactCustomize:ys(t),TactControllers:as(t),TactVisualizer:$s(e)};function s(a){return Fo(t.hub,(c,l)=>{let p=`${l.pad.gamepad.id} ${l.pad.gamepad.index+1}`;return t.controls.attach(c,{icon:Tt,handle:p,tooltip:p,name:Ss(p,32),defaultProfileKey:a??Qt(t.controls.presets).key}),()=>t.controls.detach(c)})}function n(){let{key:a,profile:c}=Qt(t.controls.presets),l=new Mt({bindings:c.bindings,source:new Je(new Xe,new Qe)});return t.hub.plug(l),t.controls.attach(l,{icon:ks,handle:"standard",name:"mouse/keyboard",tooltip:"",defaultProfileKey:a}),l}function i(){te(o)}return{deck:t,gamepads:s,mouseKeyboard:n,visualizer:e,elements:o,registerElements:i}}var Yt=await As({presets:Mo,maxPlayers:4});Yt.mouseKeyboard();Yt.gamepads("gamer");Yt.registerElements();wt(async()=>{let r=Yt.deck.hub.encodeAll();Yt.visualizer.update(r),await $t(1e3/60)});{let r=g('input[type="color"]');r.value="#ffbb00",r.oninput=()=>document.body.style.setProperty("--tact-prime",r.value)}
837
+ }`;var[wS,hm]=y2(o=>(r2(k2,dm),I`
838
+ <slot></slot>
839
+ <output class=viz>${o.$hex()}</output>
840
+ `));var mm=mt`<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ai ai-Devices"><path d="M10 15H4V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2"/><path d="M2 18h12"/><path d="M14 9.2c0-.663.597-1.2 1.333-1.2h5.334C21.403 8 22 8.537 22 9.2v9.6c0 .663-.597 1.2-1.333 1.2h-5.334C14.597 20 14 19.463 14 18.8V9.2z"/><path d="M18 17h.01"/></svg>`;async function xm(o){let{dispose:t,schedule:e,disposable:s}=J0(),r=s(await jh(o)),n=p1(r.controls.presets),c=new w1,i={TactDeck:pm(r),TactCustomize:rm(r),TactControllers:vm(r),TactVisualizer:hm(c)};function a(m){let $=Uh(r.hub,(H,ht)=>{let bt=`${ht.pad.gamepad.id} ${ht.pad.gamepad.index+1}`;return r.controls.attach(H,{icon:Wf,handle:bt,tooltip:bt,name:Rh(bt,32),defaultProfileKey:m??n.key}),()=>r.controls.detach(H)});return e($),$}function u(){let{key:m,profile:$}=n,H=s(new Nf({bindings:$.bindings,source:s(new y1(s(new _1),s(new k1)))}));return r.hub.plug(H),r.controls.attach(H,{icon:mm,handle:"standard",name:"mouse/keyboard",tooltip:"",defaultProfileKey:m}),e(()=>{r.hub.remove(H),r.controls.detach(H)}),H}function v(){yu(i)}return{deck:r,gamepads:a,mouseKeyboard:u,visualizer:c,elements:i,registerElements:v,encodeAll:r.hub.encodeAll.bind(r.hub),dispose:t}}var bu=await xm({presets:vh,maxPlayers:4});bu.mouseKeyboard();bu.gamepads("gamer");bu.registerElements();jf(async()=>{let o=bu.deck.hub.encodeAll();bu.visualizer.update(o),await zf(1e3/60)});{let o=xt('input[type="color"]');o.value="#ffbb00",o.oninput=()=>document.body.style.setProperty("--tact-prime",o.value)}
837
841
  /*! For license information please see main.bundle.min.js.LEGAL.txt */
838
842
  //# sourceMappingURL=main.bundle.min.js.map