@neuralnomads/codenomad-dev 0.20.0-dev-20260909-855d2ee7 → 0.20.0-dev-20260911-ea37f97b

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 (177) hide show
  1. package/dist/api-types.js.map +1 -1
  2. package/dist/index.js +42 -31
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.test.js +9 -1
  5. package/dist/index.test.js.map +1 -1
  6. package/dist/opencode/pruning-installation.js +65 -0
  7. package/dist/opencode/pruning-installation.js.map +1 -0
  8. package/dist/opencode/pruning-installation.test.js +101 -0
  9. package/dist/opencode/pruning-installation.test.js.map +1 -0
  10. package/dist/opencode/pruning-lifecycle.js +66 -0
  11. package/dist/opencode/pruning-lifecycle.js.map +1 -0
  12. package/dist/opencode/session-pruning/claim-fence.js +33 -0
  13. package/dist/opencode/session-pruning/claim-fence.js.map +1 -0
  14. package/dist/opencode/session-pruning/claim-fence.test.js +104 -0
  15. package/dist/opencode/session-pruning/claim-fence.test.js.map +1 -0
  16. package/dist/opencode/session-pruning/contract.js +40 -0
  17. package/dist/opencode/session-pruning/contract.js.map +1 -0
  18. package/dist/opencode/session-pruning/database-path.js +17 -0
  19. package/dist/opencode/session-pruning/database-path.js.map +1 -0
  20. package/dist/opencode/session-pruning/database-path.test.js +22 -0
  21. package/dist/opencode/session-pruning/database-path.test.js.map +1 -0
  22. package/dist/opencode/session-pruning/desktop-plugin.js +14 -0
  23. package/dist/opencode/session-pruning/desktop-plugin.js.map +1 -0
  24. package/dist/opencode/session-pruning/index.js +2 -0
  25. package/dist/opencode/session-pruning/index.js.map +1 -0
  26. package/dist/opencode/session-pruning/isolated-store.js +18 -0
  27. package/dist/opencode/session-pruning/isolated-store.js.map +1 -0
  28. package/dist/opencode/session-pruning/planner.js +36 -0
  29. package/dist/opencode/session-pruning/planner.js.map +1 -0
  30. package/dist/opencode/session-pruning/plugin.js +45 -0
  31. package/dist/opencode/session-pruning/plugin.js.map +1 -0
  32. package/dist/opencode/session-pruning/presence.js +42 -0
  33. package/dist/opencode/session-pruning/presence.js.map +1 -0
  34. package/dist/opencode/session-pruning/preview-store.js +21 -0
  35. package/dist/opencode/session-pruning/preview-store.js.map +1 -0
  36. package/dist/opencode/session-pruning/pruning.test.js +172 -0
  37. package/dist/opencode/session-pruning/pruning.test.js.map +1 -0
  38. package/dist/opencode/session-pruning/revision.js +18 -0
  39. package/dist/opencode/session-pruning/revision.js.map +1 -0
  40. package/dist/opencode/session-pruning/service.js +56 -0
  41. package/dist/opencode/session-pruning/service.js.map +1 -0
  42. package/dist/opencode/session-pruning/service.test.js +74 -0
  43. package/dist/opencode/session-pruning/service.test.js.map +1 -0
  44. package/dist/opencode/session-pruning/storage-path.js +6 -0
  45. package/dist/opencode/session-pruning/storage-path.js.map +1 -0
  46. package/dist/opencode/session-pruning/transaction.js +53 -0
  47. package/dist/opencode/session-pruning/transaction.js.map +1 -0
  48. package/dist/opencode/session-pruning/tui-reload.js +84 -0
  49. package/dist/opencode/session-pruning/tui-reload.js.map +1 -0
  50. package/dist/opencode/session-pruning/tui-reload.native.js +269 -0
  51. package/dist/opencode/session-pruning/tui-reload.native.js.map +1 -0
  52. package/dist/opencode/session-pruning/tui-reload.test.js +71 -0
  53. package/dist/opencode/session-pruning/tui-reload.test.js.map +1 -0
  54. package/dist/opencode/session-pruning/tui.js +12 -0
  55. package/dist/opencode/session-pruning/tui.js.map +1 -0
  56. package/dist/plugins/session-pruning/plugin.mjs +26559 -0
  57. package/dist/server/__tests__/instance-proxy.test.js +10 -5
  58. package/dist/server/__tests__/instance-proxy.test.js.map +1 -1
  59. package/dist/server/__tests__/listener-base-url.test.js +26 -1
  60. package/dist/server/__tests__/listener-base-url.test.js.map +1 -1
  61. package/dist/server/__tests__/network-addresses.test.js +40 -0
  62. package/dist/server/__tests__/network-addresses.test.js.map +1 -1
  63. package/dist/server/__tests__/network-host.test.js +34 -0
  64. package/dist/server/__tests__/network-host.test.js.map +1 -0
  65. package/dist/server/__tests__/tls-ipv6.test.js +54 -0
  66. package/dist/server/__tests__/tls-ipv6.test.js.map +1 -0
  67. package/dist/server/http-server.js +8 -6
  68. package/dist/server/http-server.js.map +1 -1
  69. package/dist/server/listener-base-url.js +12 -3
  70. package/dist/server/listener-base-url.js.map +1 -1
  71. package/dist/server/network-addresses.js +20 -42
  72. package/dist/server/network-addresses.js.map +1 -1
  73. package/dist/server/network-host.js +62 -0
  74. package/dist/server/network-host.js.map +1 -0
  75. package/dist/server/routes/meta.js +2 -4
  76. package/dist/server/routes/meta.js.map +1 -1
  77. package/dist/server/routes/session-pruning.js +45 -0
  78. package/dist/server/routes/session-pruning.js.map +1 -0
  79. package/dist/server/routes/session-pruning.test.js +98 -0
  80. package/dist/server/routes/session-pruning.test.js.map +1 -0
  81. package/dist/server/tls.js +52 -32
  82. package/dist/server/tls.js.map +1 -1
  83. package/dist/workspaces/manager.js +1 -0
  84. package/dist/workspaces/manager.js.map +1 -1
  85. package/package.json +6 -3
  86. package/public/assets/App-0-FcHzPS.js +44 -0
  87. package/public/assets/App-0-FcHzPS.js.map +1 -0
  88. package/public/assets/FilesTab-CRpGDs1B.js +3 -0
  89. package/public/assets/{FilesTab-z7UrjcAQ.js.map → FilesTab-CRpGDs1B.js.map} +1 -1
  90. package/public/assets/{GitChangesTab-C04bYKhs.js → GitChangesTab-DxFebTiq.js} +3 -3
  91. package/public/assets/{GitChangesTab-C04bYKhs.js.map → GitChangesTab-DxFebTiq.js.map} +1 -1
  92. package/public/assets/{SplitFilePanel-B29MqCuU.js → SplitFilePanel-DgTMrrO-.js} +2 -2
  93. package/public/assets/{SplitFilePanel-B29MqCuU.js.map → SplitFilePanel-DgTMrrO-.js.map} +1 -1
  94. package/public/assets/{StatusTab-wUKfwnFf.js → StatusTab-LKUA9cbH.js} +2 -2
  95. package/public/assets/{StatusTab-wUKfwnFf.js.map → StatusTab-LKUA9cbH.js.map} +1 -1
  96. package/public/assets/{align-justify-glU678D9.js → align-justify-v_yPXSys.js} +2 -2
  97. package/public/assets/{align-justify-glU678D9.js.map → align-justify-v_yPXSys.js.map} +1 -1
  98. package/public/assets/{bundle-full-BrsCElYv.js → bundle-full-HzL_Jtqk.js} +2 -2
  99. package/public/assets/{bundle-full-BrsCElYv.js.map → bundle-full-HzL_Jtqk.js.map} +1 -1
  100. package/public/assets/{client-state-j9Iu7F-E.js → client-state-CF-PJ0GG.js} +2 -2
  101. package/public/assets/{client-state-j9Iu7F-E.js.map → client-state-CF-PJ0GG.js.map} +1 -1
  102. package/public/assets/{diff-viewer-B0VS1voD.js → diff-viewer-BFDQBDVy.js} +2 -2
  103. package/public/assets/{diff-viewer-B0VS1voD.js.map → diff-viewer-BFDQBDVy.js.map} +1 -1
  104. package/public/assets/index-8iPlm2r0.js +2 -0
  105. package/public/assets/index-8iPlm2r0.js.map +1 -0
  106. package/public/assets/index-B185mC7m.js +2 -0
  107. package/public/assets/index-B185mC7m.js.map +1 -0
  108. package/public/assets/index-Bbj1xF8i.js +2 -0
  109. package/public/assets/index-Bbj1xF8i.js.map +1 -0
  110. package/public/assets/index-BsmFN3k1.js +2 -0
  111. package/public/assets/index-BsmFN3k1.js.map +1 -0
  112. package/public/assets/index-Bz_OQJYA.css +1 -0
  113. package/public/assets/index-C52CfqK3.js +2 -0
  114. package/public/assets/index-C52CfqK3.js.map +1 -0
  115. package/public/assets/index-CHYmKl10.js +2 -0
  116. package/public/assets/index-CHYmKl10.js.map +1 -0
  117. package/public/assets/index-CTKYD_VJ.js +2 -0
  118. package/public/assets/index-CTKYD_VJ.js.map +1 -0
  119. package/public/assets/index-D2UHSOG5.js +2 -0
  120. package/public/assets/{index-ClaHfu-1.js.map → index-D2UHSOG5.js.map} +1 -1
  121. package/public/assets/index-DDoB_Z36.js +2 -0
  122. package/public/assets/index-DDoB_Z36.js.map +1 -0
  123. package/public/assets/{index-BzAEHHap.js → index-DcwAtZw-.js} +3 -3
  124. package/public/assets/index-DcwAtZw-.js.map +1 -0
  125. package/public/assets/index-DxUD3RYr.js +2 -0
  126. package/public/assets/index-DxUD3RYr.js.map +1 -0
  127. package/public/assets/{index-B6bX3AMT.js → index-RK9gf0uk.js} +2 -2
  128. package/public/assets/{index-B6bX3AMT.js.map → index-RK9gf0uk.js.map} +1 -1
  129. package/public/assets/{loading-CYiiwb08.js → loading-BSB82snY.js} +2 -2
  130. package/public/assets/{loading-CYiiwb08.js.map → loading-BSB82snY.js.map} +1 -1
  131. package/public/assets/main-CZztwrfv.js +48 -0
  132. package/public/assets/main-CZztwrfv.js.map +1 -0
  133. package/public/assets/{markdown-DWvSdCZz.js → markdown-DtidoL2Z.js} +4 -4
  134. package/public/assets/{markdown-DWvSdCZz.js.map → markdown-DtidoL2Z.js.map} +1 -1
  135. package/public/assets/{monaco-viewer-Cc9bWg7I.js → monaco-viewer-CpxDfB-6.js} +2 -2
  136. package/public/assets/monaco-viewer-CpxDfB-6.js.map +1 -0
  137. package/public/assets/{startup-state-settings-card-2KHpBL8U.js → startup-state-settings-card-BY741Rt0.js} +2 -2
  138. package/public/assets/{startup-state-settings-card-2KHpBL8U.js.map → startup-state-settings-card-BY741Rt0.js.map} +1 -1
  139. package/public/assets/{terminal-square-lzHuj_of.js → terminal-square-BdC_jwm3.js} +2 -2
  140. package/public/assets/{terminal-square-lzHuj_of.js.map → terminal-square-BdC_jwm3.js.map} +1 -1
  141. package/public/assets/{tool-call-DjkszeT4.js → tool-call-DbtCsJ4x.js} +10 -10
  142. package/public/assets/{tool-call-DjkszeT4.js.map → tool-call-DbtCsJ4x.js.map} +1 -1
  143. package/public/assets/{unified-picker-5JmIM6a0.js → unified-picker-C0eo1chJ.js} +2 -2
  144. package/public/assets/{unified-picker-5JmIM6a0.js.map → unified-picker-C0eo1chJ.js.map} +1 -1
  145. package/public/assets/{wrap-text-N0Cav2Vp.js → wrap-text-BuMtdvMx.js} +2 -2
  146. package/public/assets/{wrap-text-N0Cav2Vp.js.map → wrap-text-BuMtdvMx.js.map} +1 -1
  147. package/public/index.html +4 -4
  148. package/public/loading.html +4 -4
  149. package/public/sw.js +1 -1
  150. package/public/sw.js.map +1 -1
  151. package/public/assets/App-Nlt9zV-v.js +0 -43
  152. package/public/assets/App-Nlt9zV-v.js.map +0 -1
  153. package/public/assets/FilesTab-z7UrjcAQ.js +0 -3
  154. package/public/assets/index-BIRLnDWY.js +0 -2
  155. package/public/assets/index-BIRLnDWY.js.map +0 -1
  156. package/public/assets/index-BuScpzpP.js +0 -2
  157. package/public/assets/index-BuScpzpP.js.map +0 -1
  158. package/public/assets/index-BzAEHHap.js.map +0 -1
  159. package/public/assets/index-C-DZt-oz.css +0 -1
  160. package/public/assets/index-C9RXVQl9.js +0 -2
  161. package/public/assets/index-C9RXVQl9.js.map +0 -1
  162. package/public/assets/index-ClaHfu-1.js +0 -2
  163. package/public/assets/index-DBx5htn3.js +0 -2
  164. package/public/assets/index-DBx5htn3.js.map +0 -1
  165. package/public/assets/index-DHHMf3u1.js +0 -2
  166. package/public/assets/index-DHHMf3u1.js.map +0 -1
  167. package/public/assets/index-DN4Kstsd.js +0 -2
  168. package/public/assets/index-DN4Kstsd.js.map +0 -1
  169. package/public/assets/index-DbMyNDyo.js +0 -2
  170. package/public/assets/index-DbMyNDyo.js.map +0 -1
  171. package/public/assets/index-rcsmuqww.js +0 -2
  172. package/public/assets/index-rcsmuqww.js.map +0 -1
  173. package/public/assets/index-uz2QFRlk.js +0 -2
  174. package/public/assets/index-uz2QFRlk.js.map +0 -1
  175. package/public/assets/main-OmXs7qtG.js +0 -48
  176. package/public/assets/main-OmXs7qtG.js.map +0 -1
  177. package/public/assets/monaco-viewer-Cc9bWg7I.js.map +0 -1
@@ -1,4 +1,4 @@
1
- var To=Object.defineProperty;var ko=(e,t,n)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pt=(e,t,n)=>ko(e,typeof t!="symbol"?t+"":t,n);import{c as F,a as le,u as ot,s as Ut,b as fr,d as W,g as In,r as Fo,e as $,o as ue,f as R,$ as V,h as we,i as Ot,j as st,k as de,l as Ke,m as ct,n as jt,p as hr,q as Io,t as Do,v as Lo,S as Ro}from"./git-diff-vendor-ChbWBukG.js";import{g as No}from"./fast-diff-vendor-DgdwVvTQ.js";const Bo=["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"],Uo=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...Bo]),jo=new Set(["innerHTML","textContent","innerText","children"]),_o=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Wo=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function Vo(e,t){const n=Wo[e];return typeof n=="object"?n[t]?n.$:void 0:n}const Ko=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),gr=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),zo={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},Ho=e=>F(()=>e());function Go(e,t,n){let r=n.length,o=t.length,s=r,i=0,a=0,c=t[o-1].nextSibling,u=null;for(;i<o||a<s;){if(t[i]===n[a]){i++,a++;continue}for(;t[o-1]===n[s-1];)o--,s--;if(o===i){const l=s<r?a?n[a-1].nextSibling:n[s-a]:c;for(;a<s;)e.insertBefore(n[a++],l)}else if(s===a)for(;i<o;)(!u||!u.has(t[i]))&&t[i].remove(),i++;else if(t[i]===n[s-1]&&n[a]===t[o-1]){const l=t[--o].nextSibling;e.insertBefore(n[a++],t[i++].nextSibling),e.insertBefore(n[--s],l),t[o]=n[s]}else{if(!u){u=new Map;let d=a;for(;d<s;)u.set(n[d],d++)}const l=u.get(t[i]);if(l!=null)if(a<l&&l<s){let d=i,f=1,g;for(;++d<o&&d<s&&!((g=u.get(t[d]))==null||g!==l+f);)f++;if(f>l-a){const b=t[i];for(;a<l;)e.insertBefore(n[a++],b)}else e.replaceChild(n[a++],t[i++])}else i++;else t[i++].remove()}}}const Dn="_$DX_DELEGATE";function Vl(e,t,n,r={}){let o;return fr(s=>{o=s,t===document?e():Et(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function An(e,t,n,r){let o;const s=()=>{const a=r?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=e,n?a.content.firstChild.firstChild:r?a.firstChild:a.content.firstChild},i=t?()=>ot(()=>document.importNode(o||(o=s()),!0)):()=>(o||(o=s())).cloneNode(!0);return i.cloneNode=i,i}function mr(e,t=window.document){const n=t[Dn]||(t[Dn]=new Set);for(let r=0,o=e.length;r<o;r++){const s=e[r];n.has(s)||(n.add(s),t.addEventListener(s,ns))}}function it(e,t,n){Ae(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Jo(e,t,n,r){Ae(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function qo(e,t,n){Ae(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function Yo(e,t){Ae(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Xo(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const o=n[0];e.addEventListener(t,n[0]=s=>o.call(e,n[1],s))}else e.addEventListener(t,n,typeof n!="function"&&n)}function Zo(e,t,n={}){const r=Object.keys(t||{}),o=Object.keys(n);let s,i;for(s=0,i=o.length;s<i;s++){const a=o[s];!a||a==="undefined"||t[a]||(Rn(e,a,!1),delete n[a])}for(s=0,i=r.length;s<i;s++){const a=r[s],c=!!t[a];!a||a==="undefined"||n[a]===c||!c||(Rn(e,a,!0),n[a]=c)}return n}function Qo(e,t,n){if(!t)return n?it(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let o,s;for(s in n)t[s]==null&&r.removeProperty(s),delete n[s];for(s in t)o=t[s],o!==n[s]&&(r.setProperty(s,o),n[s]=o);return n}function Ln(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function pr(e,t={},n,r){const o={};return r||le(()=>o.children=at(e,t.children,o.children)),le(()=>typeof t.ref=="function"&&On(t.ref,e)),le(()=>es(e,t,n,!0,o,!0)),o}function On(e,t,n){return ot(()=>e(t,n))}function Et(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return at(e,t,r,n);le(o=>at(e,t(),o,n),r)}function es(e,t,n,r,o={},s=!1){t||(t={});for(const i in o)if(!(i in t)){if(i==="children")continue;o[i]=Nn(e,i,null,o[i],n,s,t)}for(const i in t){if(i==="children")continue;const a=t[i];o[i]=Nn(e,i,a,o[i],n,s,t)}}function yr(e){let t,n;return!Ae()||!(t=R.registry.get(n=rs()))?e():(R.completed&&R.completed.add(t),R.registry.delete(n),t)}function Ae(e){return!!R.context&&!R.done&&(!e||e.isConnected)}function ts(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Rn(e,t,n){const r=t.trim().split(/\s+/);for(let o=0,s=r.length;o<s;o++)e.classList.toggle(r[o],n)}function Nn(e,t,n,r,o,s,i){let a,c,u,l,d;if(t==="style")return Qo(e,n,r);if(t==="classList")return Zo(e,n,r);if(n===r)return r;if(t==="ref")s||n(e);else if(t.slice(0,3)==="on:"){const f=t.slice(3);r&&e.removeEventListener(f,r,typeof r!="function"&&r),n&&e.addEventListener(f,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const f=t.slice(10);r&&e.removeEventListener(f,r,!0),n&&e.addEventListener(f,n,!0)}else if(t.slice(0,2)==="on"){const f=t.slice(2).toLowerCase(),g=Ko.has(f);if(!g&&r){const b=Array.isArray(r)?r[0]:r;e.removeEventListener(f,b)}(g||n)&&(Xo(e,f,n,g),g&&mr([f]))}else if(t.slice(0,5)==="attr:")it(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")qo(e,t.slice(5),n);else if((d=t.slice(0,5)==="prop:")||(u=jo.has(t))||!o&&((l=Vo(t,e.tagName))||(c=Uo.has(t)))||(a=e.nodeName.includes("-")||"is"in i)){if(d)t=t.slice(5),c=!0;else if(Ae(e))return n;t==="class"||t==="className"?Yo(e,n):a&&!c&&!u?e[ts(t)]=n:e[l||t]=n}else{const f=o&&t.indexOf(":")>-1&&zo[t.split(":")[0]];f?Jo(e,f,t,n):it(e,_o[t]||t,n)}return n}function ns(e){if(R.registry&&R.events&&R.events.find(([c,u])=>u===e))return;let t=e.target;const n=`$$${e.type}`,r=e.target,o=e.currentTarget,s=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),i=()=>{const c=t[n];if(c&&!t.disabled){const u=t[`${n}Data`];if(u!==void 0?c.call(t,u,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&s(t.host),!0},a=()=>{for(;i()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),R.registry&&!R.done&&(R.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();s(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!i());u++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();s(r)}function at(e,t,n,r,o){const s=Ae(e);if(s){!n&&(n=[...e.childNodes]);let c=[];for(let u=0;u<n.length;u++){const l=n[u];l.nodeType===8&&l.data.slice(0,2)==="!$"?l.remove():c.push(l)}n=c}for(;typeof n=="function";)n=n();if(t===n)return n;const i=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,i==="string"||i==="number"){if(s||i==="number"&&(t=t.toString(),t===n))return n;if(a){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=Pe(e,n,r,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||i==="boolean"){if(s)return n;n=Pe(e,n,r)}else{if(i==="function")return le(()=>{let c=t();for(;typeof c=="function";)c=c();n=at(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],u=n&&Array.isArray(n);if(un(c,t,n,o))return le(()=>n=at(e,c,n,r,!0)),()=>n;if(s){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let l=c[0];if(l.parentNode!==e)return n;const d=[l];for(;(l=l.nextSibling)!==r;)d.push(l);return n=d}if(c.length===0){if(n=Pe(e,n,r),a)return n}else u?n.length===0?Bn(e,c,r):Go(e,n,c):(n&&Pe(e),Bn(e,c));n=c}else if(t.nodeType){if(s&&t.parentNode)return n=a?[t]:t;if(Array.isArray(n)){if(a)return n=Pe(e,n,r,t);Pe(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function un(e,t,n,r){let o=!1;for(let s=0,i=t.length;s<i;s++){let a=t[s],c=n&&n[e.length],u;if(!(a==null||a===!0||a===!1))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=un(e,a,c)||o;else if(u==="function")if(r){for(;typeof a=="function";)a=a();o=un(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||o}else e.push(a),o=!0;else{const l=String(a);c&&c.nodeType===3&&c.data===l?e.push(c):e.push(document.createTextNode(l))}}return o}function Bn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Pe(e,t,n,r){if(n===void 0)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let s=!1;for(let i=t.length-1;i>=0;i--){const a=t[i];if(o!==a){const c=a.parentNode===e;!s&&!i?c?e.replaceChild(o,a):e.insertBefore(o,n):c&&a.remove()}else s=!0}}else e.insertBefore(o,n);return[o]}function rs(){return R.getNextContextId()}const os="http://www.w3.org/2000/svg";function br(e,t=!1,n=void 0){return t?document.createElementNS(os,e):document.createElement(e,{is:n})}function Kl(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=In();let s,i=!!R.context;return W(()=>{i&&(In().user=i=!1),s||(s=Fo(o,()=>F(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,u]=$(!1),l=()=>u(!0);fr(d=>Et(a,()=>c()?d():s(),null)),ue(l)}else{const c=br(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),Et(u,s),a.appendChild(c),e.ref&&e.ref(c),ue(()=>a.removeChild(c))}},void 0,{render:!i}),n}function ss(e,t){const n=F(e);return F(()=>{const r=n();switch(typeof r){case"function":return ot(()=>r(t));case"string":const o=gr.has(r),s=R.context?yr():br(r,o,ot(()=>t.is));return pr(s,t,o),s}})}function zl(e){const[,t]=Ut(e,["component"]);return ss(()=>e.component,t)}const Be=Symbol("store-raw"),oe=Symbol("store-node"),q=Symbol("store-has"),wr=Symbol("store-self");function Cr(e){let t=e[V];if(!t&&(Object.defineProperty(e,V,{value:t=new Proxy(e,as)}),!Array.isArray(e))){const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let o=0,s=n.length;o<s;o++){const i=n[o];r[i].get&&Object.defineProperty(e,i,{enumerable:r[i].enumerable,get:r[i].get.bind(t)})}}return t}function ee(e){let t;return e!=null&&typeof e=="object"&&(e[V]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function ie(e,t=new Set){let n,r,o,s;if(n=e!=null&&e[Be])return n;if(!ee(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let i=0,a=e.length;i<a;i++)o=e[i],(r=ie(o,t))!==o&&(e[i]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const i=Object.keys(e),a=Object.getOwnPropertyDescriptors(e);for(let c=0,u=i.length;c<u;c++)s=i[c],!a[s].get&&(o=e[s],(r=ie(o,t))!==o&&(e[s]=r))}return e}function Ue(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Ce(e,t,n){if(e[t])return e[t];const[r,o]=$(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function is(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===V||t===oe||(delete n.value,delete n.writable,n.get=()=>e[V][t]),n}function En(e){st()&&Ce(Ue(e,oe),wr)()}function Sr(e){return En(e),Reflect.ownKeys(e)}const as={get(e,t,n){if(t===Be)return e;if(t===V)return n;if(t===Ot)return En(e),n;const r=Ue(e,oe),o=r[t];let s=o?o():e[t];if(t===oe||t===q||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);st()&&(typeof s!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(s=Ce(r,t,s)())}return ee(s)?Cr(s):s},has(e,t){return t===Be||t===V||t===Ot||t===oe||t===q||t==="__proto__"?!0:(st()&&Ce(Ue(e,q),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Sr,getOwnPropertyDescriptor:is};function B(e,t,n,r=!1){if(!r&&e[t]===n)return;const o=e[t],s=e.length;n===void 0?(delete e[t],e[q]&&e[q][t]&&o!==void 0&&e[q][t].$()):(e[t]=n,e[q]&&e[q][t]&&o===void 0&&e[q][t].$());let i=Ue(e,oe),a;if((a=Ce(i,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==s){for(let c=e.length;c<s;c++)(a=i[c])&&a.$();(a=Ce(i,"length",s))&&a.$(e.length)}(a=i[wr])&&a.$()}function xr(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];B(e,o,t[o])}}function cs(e,t){if(typeof t=="function"&&(t=t(e)),t=ie(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){const o=t[n];e[n]!==o&&B(e,n,o)}B(e,"length",r)}else xr(e,t)}function Ze(e,t,n=[]){let r,o=e;if(t.length>1){r=t.shift();const i=typeof r,a=Array.isArray(e);if(Array.isArray(r)){for(let c=0;c<r.length;c++)Ze(e,[r[c]].concat(t),n);return}else if(a&&i==="function"){for(let c=0;c<e.length;c++)r(e[c],c)&&Ze(e,[c].concat(t),n);return}else if(a&&i==="object"){const{from:c=0,to:u=e.length-1,by:l=1}=r;for(let d=c;d<=u;d+=l)Ze(e,[d].concat(t),n);return}else if(t.length>1){Ze(e[r],t,[r].concat(n));return}o=e[r],n=[r].concat(n)}let s=t[0];typeof s=="function"&&(s=s(o,n),s===o)||r===void 0&&s==null||(s=ie(s),r===void 0||ee(o)&&ee(s)&&!Array.isArray(s)?xr(o,s):B(e,r,s))}function Hl(...[e,t]){const n=ie(e||{}),r=Array.isArray(n),o=Cr(n);function s(...i){we(()=>{r&&i.length===1?cs(n,i[0]):Ze(n,i)})}return[o,s]}function ls(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===V||t===oe||(delete n.value,delete n.writable,n.get=()=>e[V][t],n.set=r=>e[V][t]=r),n}const us={get(e,t,n){if(t===Be)return e;if(t===V)return n;if(t===Ot)return En(e),n;const r=Ue(e,oe),o=r[t];let s=o?o():e[t];if(t===oe||t===q||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t),a=typeof s=="function";if(st()&&(!a||e.hasOwnProperty(t))&&!(i&&i.get))s=Ce(r,t,s)();else if(s!=null&&a&&s===Array.prototype[t])return(...c)=>we(()=>Array.prototype[t].apply(n,c))}return ee(s)?vr(s):s},has(e,t){return t===Be||t===V||t===Ot||t===oe||t===q||t==="__proto__"?!0:(st()&&Ce(Ue(e,q),t)(),t in e)},set(e,t,n){return we(()=>B(e,t,ie(n))),!0},deleteProperty(e,t){return we(()=>B(e,t,void 0,!0)),!0},ownKeys:Sr,getOwnPropertyDescriptor:ls};function vr(e){let t=e[V];if(!t){Object.defineProperty(e,V,{value:t=new Proxy(e,us)});const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),o=Object.getPrototypeOf(e),s=o!==null&&e!==null&&typeof e=="object"&&!Array.isArray(e)&&o!==Object.prototype;if(s){let i=o;for(;i!=null;){const a=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(a)),Object.assign(r,a),i=Object.getPrototypeOf(i)}}for(let i=0,a=n.length;i<a;i++){const c=n[i];if(!(s&&c==="constructor")){if(r[c].get){const u=r[c].get.bind(t);Object.defineProperty(e,c,{get:u,configurable:!0})}if(r[c].set){const u=r[c].set;Object.defineProperty(e,c,{set:d=>we(()=>u.call(t,d)),configurable:!0})}}}}return t}function ds(e,t){const n=ie(e||{});return vr(n)}const dn=Symbol("store-root");function Te(e,t,n,r,o){const s=t[n];if(e===s)return;const i=Array.isArray(e);if(n!==dn&&(!ee(e)||!ee(s)||i!==Array.isArray(s)||o&&e[o]!==s[o])){B(t,n,e);return}if(i){if(e.length&&s.length&&(!r||o&&e[0]&&e[0][o]!=null)){let u,l,d,f,g,b,C,S;for(d=0,f=Math.min(s.length,e.length);d<f&&(s[d]===e[d]||o&&s[d]&&e[d]&&s[d][o]&&s[d][o]===e[d][o]);d++)Te(e[d],s,d,r,o);const I=new Array(e.length),y=new Map;for(f=s.length-1,g=e.length-1;f>=d&&g>=d&&(s[f]===e[g]||o&&s[f]&&e[g]&&s[f][o]&&s[f][o]===e[g][o]);f--,g--)I[g]=s[f];if(d>g||d>f){for(l=d;l<=g;l++)B(s,l,e[l]);for(;l<e.length;l++)B(s,l,I[l]),Te(e[l],s,l,r,o);s.length>e.length&&B(s,"length",e.length);return}for(C=new Array(g+1),l=g;l>=d;l--)b=e[l],S=o&&b?b[o]:b,u=y.get(S),C[l]=u===void 0?-1:u,y.set(S,l);for(u=d;u<=f;u++)b=s[u],S=o&&b?b[o]:b,l=y.get(S),l!==void 0&&l!==-1&&(I[l]=s[u],l=C[l],y.set(S,l));for(l=d;l<e.length;l++)l in I?(B(s,l,I[l]),Te(e[l],s,l,r,o)):B(s,l,e[l])}else for(let u=0,l=e.length;u<l;u++)Te(e[u],s,u,r,o);s.length>e.length&&B(s,"length",e.length);return}const a=Object.keys(e);for(let u=0,l=a.length;u<l;u++)Te(e[a[u]],s,a[u],r,o);const c=Object.keys(s);for(let u=0,l=c.length;u<l;u++)e[c[u]]===void 0&&B(s,c[u],void 0)}function Gl(e,t={}){const{merge:n,key:r="id"}=t,o=ie(e);return s=>{if(!ee(s)||!ee(o))return o;const i=Te(o,{[dn]:s},dn,n,r);return i===void 0?s:i}}const Pt=new WeakMap,Ar={get(e,t){if(t===Be)return e;const n=e[t];let r;return ee(n)?Pt.get(n)||(Pt.set(n,r=new Proxy(n,Ar)),r):n},set(e,t,n){return B(e,t,ie(n)),!0},deleteProperty(e,t){return B(e,t,void 0,!0),!0}};function Jl(e){return t=>{if(ee(t)){let n;(n=Pt.get(t))||Pt.set(t,n=new Proxy(t,Ar)),e(n)}return t}}const fs="codenomad.client-id",hs="codenomad.connection-id";let yt=null,bt=null;function Or(){return{clientId:gs(),connectionId:ms()}}function gs(){return yt||(yt=Er(fs,window.localStorage),yt)}function ms(){var t;const e=(t=window.__CODENOMAD_WINDOW_ID__)==null?void 0:t.trim();return e||bt||(bt=Er(hs,window.sessionStorage),bt)}function Er(e,t){if(typeof window>"u")return Xt();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Xt()}const n=Xt();try{t.setItem(e,n)}catch{}return n}function Xt(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var fn={exports:{}},Zt,Un;function ps(){if(Un)return Zt;Un=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;Zt=function(l,d){d=d||{};var f=typeof l;if(f==="string"&&l.length>0)return i(l);if(f==="number"&&isFinite(l))return d.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function i(l){if(l=String(l),!(l.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(d){var f=parseFloat(d[1]),g=(d[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return f*s;case"weeks":case"week":case"w":return f*o;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(l){var d=Math.abs(l);return d>=r?Math.round(l/r)+"d":d>=n?Math.round(l/n)+"h":d>=t?Math.round(l/t)+"m":d>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var d=Math.abs(l);return d>=r?u(l,d,r,"day"):d>=n?u(l,d,n,"hour"):d>=t?u(l,d,t,"minute"):d>=e?u(l,d,e,"second"):l+" ms"}function u(l,d,f,g){var b=d>=f*1.5;return Math.round(l/f)+" "+g+(b?"s":"")}return Zt}function ys(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=ps(),n.destroy=u,Object.keys(e).forEach(l=>{n[l]=e[l]}),n.names=[],n.skips=[],n.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(l){let d,f=null,g,b;function C(...S){if(!C.enabled)return;const I=C,y=Number(new Date),P=y-(d||y);I.diff=P,I.prev=d,I.curr=y,d=y,S[0]=n.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let N=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(K,m)=>{if(K==="%%")return"%";N++;const w=n.formatters[m];if(typeof w=="function"){const E=S[N];K=w.call(I,E),S.splice(N,1),N--}return K}),n.formatArgs.call(I,S),(I.log||n.log).apply(I,S)}return C.namespace=l,C.useColors=n.useColors(),C.color=n.selectColor(l),C.extend=r,C.destroy=n.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(g!==n.namespaces&&(g=n.namespaces,b=n.enabled(l)),b),set:S=>{f=S}}),typeof n.init=="function"&&n.init(C),C}function r(l,d){const f=n(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const d=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const f of d)f[0]==="-"?n.skips.push(f.slice(1)):n.names.push(f)}function s(l,d){let f=0,g=0,b=-1,C=0;for(;f<l.length;)if(g<d.length&&(d[g]===l[f]||d[g]==="*"))d[g]==="*"?(b=g,C=f,g++):(f++,g++);else if(b!==-1)g=b+1,C++,f=C;else return!1;for(;g<d.length&&d[g]==="*";)g++;return g===d.length}function i(){const l=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),l}function a(l){for(const d of n.skips)if(s(l,d))return!1;for(const d of n.names)if(s(l,d))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var bs=ys;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let u;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(u=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(u[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;u.splice(1,0,l,"color: inherit");let d=0,f=0;u[0].replace(/%[a-zA-Z%]/g,g=>{g!=="%%"&&(d++,g==="%c"&&(f=d))}),u.splice(f,0,l)}t.log=console.debug||console.log||(()=>{});function s(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function i(){let u;try{u=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=n.DEBUG),u}function a(){try{return localStorage}catch{}}e.exports=bs(t);const{formatters:c}=e.exports;c.j=function(u){try{return JSON.stringify(u)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(fn,fn.exports);var ws=fn.exports;const hn=No(ws),ze=["sse","api","session","actions","foreground-refresh"],Pr="opencode:logger:namespaces",Qt=new Map,te=new Set,re=typeof globalThis<"u"?globalThis.console:void 0;function lt(){te.size===0?hn.disable():hn.enable(Array.from(te).join(","))}function _t(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Pr,JSON.stringify(Array.from(te)))}catch(t){(e=re==null?void 0:re.warn)==null||e.call(re,"Failed to persist logger namespaces",t)}}function Cs(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Pr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)ze.includes(r)&&te.add(r)}catch(t){(e=re==null?void 0:re.warn)==null||e.call(re,"Failed to hydrate logger namespaces",t)}}Cs();lt();function Ss(e){const n=hn(e),r=(o,s)=>{n(o,...s)};return{log:(...o)=>n(...o),info:(...o)=>n(...o),warn:(...o)=>r("[warn]",o),error:(...o)=>r("[error]",o)}}function Oe(e){if(!ze.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return Qt.has(e)||Qt.set(e,Ss(e)),Qt.get(e)}function xs(){return ze.map(e=>({name:e,enabled:te.has(e)}))}function vs(e){if(!ze.includes(e))throw new Error(`Unknown logger namespace: ${e}`);te.has(e)||(te.add(e),_t(),lt())}function As(e){if(!ze.includes(e))throw new Error(`Unknown logger namespace: ${e}`);te.has(e)&&(te.delete(e),_t(),lt())}function Os(){te.clear(),_t(),lt()}function Es(){ze.forEach(e=>te.add(e)),_t(),lt()}const Ps={listLoggerNamespaces:xs,enableLogger:vs,disableLogger:As,enableAllLoggers:Es,disableAllLoggers:Os};function Ms(){typeof window>"u"||(window.codenomadLogger=Ps)}Ms();function $s(e,t){let n=!1;e.onmessage=o=>{try{const s=JSON.parse(o.data);t.onEvent(s)}catch(s){t.logger.error("Failed to parse event",s)}};const r=o=>{var s;n||(n=!0,t.logger.warn(o),(s=t.onError)==null||s.call(t))};e.onerror=()=>{r("EventSource error, closing stream")},e.onclose=()=>{r("EventSource closed")},e.addEventListener("close",()=>{r("EventSource closed")}),e.addEventListener("codenomad.client.ping",o=>{var s;try{const i=o.data?JSON.parse(o.data):{};(s=t.onPing)==null||s.call(t,i)}catch(i){t.logger.error("Failed to parse ping event",i)}})}const en={};var dr;const Ts=typeof window<"u"?(dr=window.location)==null?void 0:dr.origin:void 0,ks=typeof window<"u"?window.__CODENOMAD_API_BASE__??Ts:void 0,Fs=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",je=(en==null?void 0:en.VITE_CODENOMAD_API_BASE)??ks,tn=Is(je,Fs),ql=je;function Is(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(e){const n=t.startsWith("/")?t:`/${t}`;return`${e}${n}`}return t}const jn=Oe("api"),_n=Oe("sse");function Mr(e){const t={};if(!e)return t;if(e instanceof Headers)return e.forEach((n,r)=>{t[r]=n}),t;if(Array.isArray(e)){for(const[n,r]of e)t[n]=r;return t}return{...e}}function be(e,t){if(t){jn.info(e,t);return}jn.info(e)}async function $r(e){const t=await e.text();if(!t)return`Request failed with ${e.status}`;try{const n=JSON.parse(t);if(typeof(n==null?void 0:n.error)=="string"&&n.error.trim())return n.error;if(typeof(n==null?void 0:n.message)=="string"&&n.message.trim())return n.message}catch{}return t}async function p(e,t){const n=je?new URL(e,je).toString():e,r=Mr(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();be(`${o} ${e}`);try{const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const c=await $r(i);throw be(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:c}),new Error(c||`Request failed with ${i.status}`)}const a=Date.now()-s;return be(`${o} ${e} -> ${i.status}`,{durationMs:a}),i.status===204?void 0:await i.json()}catch(i){throw be(`${o} ${e} failed`,{durationMs:Date.now()-s,error:i}),i}}async function Ds(e,t){const n=je?new URL(e,je).toString():e,r=Mr(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&!r["Content-Type"]&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();be(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await $r(i);throw be(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return be(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const ne={fetchWorkspaces(){return p("/api/workspaces")},fetchProviderUsage(e,t){const n=new URLSearchParams;t&&n.set("modelId",t);const r=n.toString();return p(`/api/usage/${encodeURIComponent(e)}${r?`?${r}`:""}`)},fetchWorktrees(e){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees`)},createWorktree(e,t){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees`,{method:"POST",body:JSON.stringify(t)})},deleteWorktree(e,t,n){const r=new URLSearchParams;n!=null&&n.force&&r.set("force","true");const o=r.toString()?`?${r.toString()}`:"";return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}${o}`,{method:"DELETE"})},createWorkspace(e,t){return p("/api/workspaces",{method:"POST",body:JSON.stringify(e),signal:t==null?void 0:t.signal})},cancelWorkspaceCreation(e){return p("/api/workspaces/creation/cancel",{method:"POST",body:JSON.stringify({requestId:e})})},releaseWorkspaceCreation(e,t){return p(`/api/workspaces/${encodeURIComponent(e)}/creation/release`,{method:"POST",body:JSON.stringify({requestId:t})})},fetchSidecars(){return p("/api/sidecars")},createSidecar(e){return p("/api/sidecars",{method:"POST",body:JSON.stringify(e)})},updateSidecar(e,t){return p(`/api/sidecars/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteSidecar(e){return p(`/api/sidecars/${encodeURIComponent(e)}`,{method:"DELETE"})},createPreview(e){return p("/api/previews",{method:"POST",body:JSON.stringify(e)})},deletePreview(e){return p(`/api/previews/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchServerMeta(){return p("/api/meta")},probeRemoteServer(e){return p("/api/remote-servers/probe",{method:"POST",body:JSON.stringify(e)})},createRemoteProxySession(e){return p("/api/remote-proxy/sessions",{method:"POST",body:JSON.stringify(e)})},deleteRemoteProxySession(e){return p(`/api/remote-proxy/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchAuthStatus(){return p("/api/auth/status")},listConfigFiles(){return p("/api/config-files")},readConfigFile(e){return p(`/api/config-files/${encodeURIComponent(e)}/content`)},writeConfigFile(e,t){const n={contents:t};return p(`/api/config-files/${encodeURIComponent(e)}/content`,{method:"PUT",body:JSON.stringify(n)})},setServerPassword(e){return p("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return p(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},cloneWorkspaceRepository(e){return p("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})},listWorkspaceFiles(e,t="."){const n=new URLSearchParams({path:t});return p(`/api/workspaces/${encodeURIComponent(e)}/files?${n.toString()}`)},searchWorkspaceFiles(e,t,n){const r=t.trim();if(!r)return Promise.resolve([]);const o=new URLSearchParams({q:r});return n!=null&&n.limit&&o.set("limit",String(n.limit)),n!=null&&n.type&&o.set("type",n.type),p(`/api/workspaces/${encodeURIComponent(e)}/files/search?${o.toString()}`)},readWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return n!=null&&n.encoding&&r.set("encoding",n.encoding),p(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`)},writeWorkspaceFile(e,t,n,r){const o=new URLSearchParams({path:t});return r!=null&&r.worktree&&r.worktree!=="root"&&o.set("worktree",r.worktree),p(`/api/workspaces/${encodeURIComponent(e)}/files/content?${o.toString()}`,{method:"PUT",body:JSON.stringify({contents:n})})},fetchWorktreeGitStatus(e,t){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-status`)},fetchWorktreeGitDiff(e,t,n){const r=new URLSearchParams({path:n.path,scope:n.scope});return n.originalPath&&r.set("originalPath",n.originalPath),p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-diff?${r.toString()}`)},stageWorktreeGitPaths(e,t,n){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-stage`,{method:"POST",body:JSON.stringify(n)})},unstageWorktreeGitPaths(e,t,n){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-unstage`,{method:"POST",body:JSON.stringify(n)})},commitWorktreeGitChanges(e,t,n){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-commit`,{method:"POST",body:JSON.stringify(n)})},fetchConfigOwner(e){return p(`/api/storage/config/${encodeURIComponent(e)}`)},patchConfigOwner(e,t){return p(`/api/storage/config/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},fetchStateOwner(e){return p(`/api/storage/state/${encodeURIComponent(e)}`)},patchStateOwner(e,t){return p(`/api/storage/state/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},validateBinary(e){return p("/api/storage/binaries/validate",{method:"POST",body:JSON.stringify({path:e})})},fetchOpenCodeUpdateStatus(){return p("/api/opencode/update")},updateOpenCode(){return p("/api/opencode/update",{method:"POST"})},fetchSpeechCapabilities(){return p("/api/speech/capabilities")},transcribeAudio(e){return p("/api/speech/transcribe",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeech(e){return p("/api/speech/synthesize",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeechStream(e,t){return Ds("/api/speech/synthesize/stream",{method:"POST",body:JSON.stringify(e),signal:t})},listFileSystem(e,t){const n=new URLSearchParams;e&&e!=="."&&n.set("path",e),(t==null?void 0:t.includeFiles)!==void 0&&n.set("includeFiles",String(t.includeFiles));const r=n.toString();return p(r?`/api/filesystem?${r}`:"/api/filesystem")},createFileSystemFolder(e,t){return p("/api/filesystem/folders",{method:"POST",body:JSON.stringify({parentPath:e,name:t})})},readFileSystemFile(e,t){const n=new URLSearchParams({path:e});return t!=null&&t.encoding&&n.set("encoding",t.encoding),p(`/api/filesystem/files/content?${n.toString()}`)},readInstanceData(e){return p(`/api/storage/instances/${encodeURIComponent(e)}`)},writeInstanceData(e,t){return p(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteInstanceData(e){return p(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"DELETE"})},getYoloState(e,t){return p(`/workspaces/${encodeURIComponent(e)}/yolo/sessions/${encodeURIComponent(t)}`)},toggleYolo(e,t){return p(`/workspaces/${encodeURIComponent(e)}/yolo/sessions/${encodeURIComponent(t)}/toggle`,{method:"POST"})},sendClientConnectionPong(e,t){const n={method:"POST",body:JSON.stringify(e)};return t&&(n.signal=t),p("/api/client-connections/pong",n)},connectEvents(e,t,n){const r=Or(),o=Ls(r);_n.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return $s(s,{onEvent:e,onError:t,onPing:n,logger:_n}),s}};function Ls(e){const t=new URL(tn,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),tn.startsWith("http://")||tn.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}async function Rs(e){const t=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"disconnected"),(o=e.onError)==null||o.call(e)},n=ne.connectEvents(r=>{e.onBatch([r])},t,e.onPing);return n.onopen=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"connected"),(o=e.onOpen)==null||o.call(e)},{disconnect(){n.close()}}}async function Ns(e,t={}){const{maxAttempts:n=3,initialDelayMs:r=100,maxDelayMs:o=5e3,backoffMultiplier:s=2,timeoutMs:i,shouldRetry:a=()=>!0,wait:c=d=>new Promise(f=>setTimeout(f,d))}=t;let u=null,l=r;for(let d=1;d<=n;d++)try{if(i){const f=new AbortController,g=setTimeout(()=>f.abort(),i);try{const b=await e(f.signal);return clearTimeout(g),b}catch(b){throw clearTimeout(g),b}}return await e()}catch(f){const g=f instanceof Error?f:new Error(String(f));if(u=g,d<n&&a(g,d))await c(l),l=Math.min(l*s,o);else throw g}throw u||new Error("Failed after retries")}function Bs(e){return!!(e.name==="AbortError"||e.name==="TimeoutError"||e.message.includes("Failed to fetch")||e.message.includes("NetworkError")||e.message.includes("timeout"))}const nn=1e3,Us=1e4,gn=Oe("sse");function Me(e,t){if(t){gn.info(e,t);return}gn.info(e)}class js{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.statusHandlers=new Set,this.connection=null,this.connectGeneration=0,this.retryDelay=nn,this.retryTimer=null,this.connect()}async connect(){const t=++this.connectGeneration;this.clearReconnectTimer(),this.connection&&(this.emitTransportStatus("disconnected"),this.connection.disconnect(),this.connection=null),Me("Connecting to backend events stream");try{const n=await Rs({onBatch:r=>{t===this.connectGeneration&&this.dispatchBatch(r)},onError:()=>{t===this.connectGeneration&&this.scheduleReconnect()},onStatus:r=>{t===this.connectGeneration&&this.emitTransportStatus(r)},onOpen:()=>{t===this.connectGeneration&&(Me("Events stream connected"),this.retryDelay=nn,this.openHandlers.forEach(r=>r()))},onPing:r=>{if(t!==this.connectGeneration)return;const s={...Or(),pingTs:r.ts};Ns(i=>ne.sendClientConnectionPong(s,i),{maxAttempts:3,initialDelayMs:100,maxDelayMs:2e3,timeoutMs:1e4,shouldRetry:i=>Bs(i)}).catch(i=>{gn.warn("Failed to send client connection pong after retries",i)})}});if(t!==this.connectGeneration){n.disconnect();return}this.connection=n}catch(n){if(t!==this.connectGeneration)return;Me("Events stream failed to connect, scheduling reconnect",{error:n instanceof Error?n.message:String(n)}),this.scheduleReconnect()}}scheduleReconnect(){this.retryTimer||(this.connectGeneration+=1,this.connection&&(this.connection.disconnect(),this.connection=null),this.emitTransportStatus("disconnected"),Me("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.retryDelay=Math.min(this.retryDelay*2,Us),this.connect()},this.retryDelay))}clearReconnectTimer(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}dispatch(t){var n,r;(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(t))}dispatchBatch(t){t.length!==0&&(Me("event batch",{size:t.length}),we(()=>{for(const n of t)this.dispatch(n)}))}emitTransportStatus(t){this.statusHandlers.forEach(n=>n(t))}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set);const r=this.handlers.get(t);return r.add(n),()=>r.delete(n)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}onTransportStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}restart(t="manual restart"){this.retryDelay=nn,this.clearReconnectTimer(),this.connection&&(this.emitTransportStatus("disconnected"),this.connection.disconnect(),this.connection=null),Me("Restarting backend events stream",{reason:t}),this.connect()}}const rn=new js,_s=Oe("actions"),Wn={messageHistory:[],agentModelSelections:{}};function Vn(e,t){if(e===t)return!0;if(typeof e=="object"&&e!==null&&typeof t=="object"&&t!==null)try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){_s.warn("Failed to compare config objects",n)}return!1}class Ws{constructor(){this.configOwnerCache=new Map,this.stateOwnerCache=new Map,this.configOwnerLoadPromises=new Map,this.stateOwnerLoadPromises=new Map,this.configOwnerListeners=new Map,this.stateOwnerListeners=new Map,this.instanceDataCache=new Map,this.instanceDataListeners=new Map,this.instanceLoadPromises=new Map,this.pendingWrites=new Set,rn.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),rn.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),rn.on("instance.dataChanged",t=>{t.type==="instance.dataChanged"&&this.setInstanceDataCache(t.instanceId,t.data)})}async loadConfigOwner(t){const n=this.configOwnerCache.get(t);if(n)return n;if(!this.configOwnerLoadPromises.has(t)){const r=ne.fetchConfigOwner(t).then(o=>(this.setOwnerCache("config",t,o),o)).finally(()=>{this.configOwnerLoadPromises.delete(t)});this.configOwnerLoadPromises.set(t,r)}return this.configOwnerLoadPromises.get(t)}patchConfigOwner(t,n){return this.trackWrite(ne.patchConfigOwner(t,n).then(r=>(this.setOwnerCache("config",t,r),r)))}async loadStateOwner(t){const n=this.stateOwnerCache.get(t);if(n)return n;if(!this.stateOwnerLoadPromises.has(t)){const r=ne.fetchStateOwner(t).then(o=>(this.setOwnerCache("state",t,o),o)).finally(()=>{this.stateOwnerLoadPromises.delete(t)});this.stateOwnerLoadPromises.set(t,r)}return this.stateOwnerLoadPromises.get(t)}patchStateOwner(t,n){return this.trackWrite(ne.patchStateOwner(t,n).then(r=>(this.setOwnerCache("state",t,r),r)))}async loadInstanceData(t){const n=this.instanceDataCache.get(t);if(n)return n;if(!this.instanceLoadPromises.has(t)){const r=ne.readInstanceData(t).then(o=>{const s=this.normalizeInstanceData(o);return this.setInstanceDataCache(t,s),s}).finally(()=>{this.instanceLoadPromises.delete(t)});this.instanceLoadPromises.set(t,r)}return this.instanceLoadPromises.get(t)}saveInstanceData(t,n){const r=this.normalizeInstanceData(n);return this.trackWrite(ne.writeInstanceData(t,r).then(()=>{this.setInstanceDataCache(t,r)}))}deleteInstanceData(t){return this.trackWrite(ne.deleteInstanceData(t).then(()=>{this.setInstanceDataCache(t,Wn)}))}async flushWrites(){for(;this.pendingWrites.size>0;)await Promise.allSettled(this.pendingWrites)}onConfigOwnerChanged(t,n){this.configOwnerListeners.has(t)||this.configOwnerListeners.set(t,new Set);const r=this.configOwnerListeners.get(t);r.add(n);const o=this.configOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.configOwnerListeners.delete(t)}}onStateOwnerChanged(t,n){this.stateOwnerListeners.has(t)||this.stateOwnerListeners.set(t,new Set);const r=this.stateOwnerListeners.get(t);r.add(n);const o=this.stateOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.stateOwnerListeners.delete(t)}}onInstanceDataChanged(t,n){this.instanceDataListeners.has(t)||this.instanceDataListeners.set(t,new Set);const r=this.instanceDataListeners.get(t);r.add(n);const o=this.instanceDataCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.instanceDataListeners.delete(t)}}setOwnerCache(t,n,r){if(n==="*"){t==="config"?this.configOwnerCache.clear():this.stateOwnerCache.clear();return}const o=t==="config"?this.configOwnerCache:this.stateOwnerCache,s=t==="config"?this.configOwnerListeners:this.stateOwnerListeners,i=o.get(n);if(i&&Vn(i,r)){o.set(n,r);return}o.set(n,r);const a=s.get(n);if(a)for(const c of a)c(r)}trackWrite(t){return this.pendingWrites.add(t),t.finally(()=>this.pendingWrites.delete(t)).catch(()=>{}),t}normalizeInstanceData(t){const n=t??Wn,r=Array.isArray(n.messageHistory)?[...n.messageHistory]:[],o={...n.agentModelSelections??{}};return{...n,messageHistory:r,agentModelSelections:o}}setInstanceDataCache(t,n){const r=this.normalizeInstanceData(n),o=this.instanceDataCache.get(t);if(o&&Vn(o,r)){this.instanceDataCache.set(t,r);return}this.instanceDataCache.set(t,r),this.notifyInstanceDataChanged(t,r)}notifyInstanceDataChanged(t,n){const r=this.instanceDataListeners.get(t);if(r)for(const o of r)o(n)}}const Q=new Ws,Tr=Oe("api"),Wt={messageHistory:[],agentModelSelections:{}},[Pn,kr]=$(new Map),wt=new Map,_e=new Map;function Fr(e){const t=e??Wt;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function Kn(e){if(_e.has(e))return;const t=Q.onInstanceDataChanged(e,n=>{Mt(e,n)});_e.set(e,t)}function Vs(e){const t=_e.get(e);t&&(t(),_e.delete(e))}function Mt(e,t){kr(n=>{const r=new Map(n);return r.set(e,Fr(t)),r})}async function Vt(e){if(!e||Pn().has(e))return;if(wt.has(e)){await wt.get(e);return}const t=Q.loadInstanceData(e).then(n=>{Mt(e,n),Kn(e)}).catch(n=>{Tr.warn("Failed to load instance data",n),Mt(e,Wt),Kn(e)}).finally(()=>{wt.delete(e)});wt.set(e,t),await t}async function Ir(e,t){if(!e)return;await Vt(e);const n=Pn().get(e)??Wt,r=Fr(n);t(r);try{await Q.saveInstanceData(e,r)}catch(o){Tr.warn("Failed to persist instance data",o)}Mt(e,r)}function Dr(e){return Pn().get(e)??Wt}function Ks(e){kr(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),Vs(e)}const zs=Ke(),Hs={getInstanceConfig:Dr,ensureInstanceConfig:Vt,updateInstanceConfig:Ir,clearInstanceConfig:Ks},Yl=e=>(ue(()=>{for(const t of _e.values())t();_e.clear()}),de(zs.Provider,{value:Hs,get children(){return e.children}})),Gs=Oe("api");function Js(e){const t=e;return t.sttConfigured===void 0&&(t.sttConfigured=t.configured),t.ttsConfigured===void 0&&(t.ttsConfigured=t.configured),t.separateProviders===void 0&&(t.separateProviders=!1),t}const[zn,mn]=$(null),[Xl,Hn]=$(!1),[Zl,At]=$(null),[Ql,Lr]=$(!1);let Je=null;async function qs(e=!1){return!e&&zn()?zn():Je||(Hn(!0),At(null),Je=ne.fetchSpeechCapabilities().then(t=>{Lr("separateProviders"in t);const r=Js(t);return mn(r),At(null),r}).catch(t=>(Gs.error("Failed to load speech capabilities",t),mn(null),At(t instanceof Error?t.message:String(t)),null)).finally(()=>{Hn(!1),Je=null}),Je)}function Ys(){mn(null),At(null),Lr(!1)}function Xs(e){var n,r,o,s,i,a;const t={};e.separateProviders!==void 0&&(t.separateProviders=e.separateProviders),e.apiKey!==void 0&&(t.apiKey=e.apiKey),e.baseUrl!==void 0&&(t.baseUrl=((n=e.baseUrl)==null?void 0:n.trim())||null),e.sttModel!==void 0&&(t.sttModel=((r=e.sttModel)==null?void 0:r.trim())||null),e.ttsModel!==void 0&&(t.ttsModel=((o=e.ttsModel)==null?void 0:o.trim())||null),e.ttsVoice!==void 0&&(t.ttsVoice=((s=e.ttsVoice)==null?void 0:s.trim())||null),e.playbackMode!==void 0&&(t.playbackMode=e.playbackMode),e.ttsFormat!==void 0&&(t.ttsFormat=e.ttsFormat);for(const c of["stt","tts"]){const u=e[c];if(u){const l={};u.apiKey!==void 0&&(l.apiKey=u.apiKey),u.baseUrl!==void 0&&(l.baseUrl=((i=u.baseUrl)==null?void 0:i.trim())||null),u.model!==void 0&&(l.model=((a=u.model)==null?void 0:a.trim())||null),Object.keys(l).length>0&&(t[c]=l)}}return t}const Zs=["system","light","classic","basalt","fjord","lichen","velvet","ember","custom"],Rr=["surfaceBase","surfaceSecondary","surfaceMuted","borderBase","textPrimary","textMuted","accentPrimary","statusSuccess","statusWarning","statusError","userAccent","agentAccent","compactionAccent","yoloAccent"],Qs=Rr.slice(0,10),ke={userAccent:"#42A5F5",agentAccent:"#D97706",compactionAccent:"#C084FC",yoloAccent:"#8FA8FF"},$t={surfaceBase:"#17181A",surfaceSecondary:"#202226",surfaceMuted:"#292C31",borderBase:"#3B3F46",textPrimary:"#F0F1F3",textMuted:"#B2B6BE",accentPrimary:"#8FA8FF",statusSuccess:"#72C497",statusWarning:"#D8B36A",statusError:"#E28181",...ke},eu={surfaceBase:"#FFFFFF",surfaceSecondary:"#F5F5F5",surfaceMuted:"#ECEFF3",borderBase:"#D1D5DB",textPrimary:"#111827",textMuted:"#4B5563",accentPrimary:"#005FCC",statusSuccess:"#237A43",statusWarning:"#9A6700",statusError:"#C62828",userAccent:"#0066CC",agentAccent:"#A44B00",compactionAccent:"#7E22CE",yoloAccent:"#005FCC"},ei=[{id:"system",labelKey:"settings.appearance.colorScheme.option.system",descriptionKey:"settings.appearance.colorScheme.description.system",appearance:"system",editable:!1},{id:"light",labelKey:"settings.appearance.colorScheme.option.light",descriptionKey:"settings.appearance.colorScheme.description.light",appearance:"light",editable:!1},{id:"classic",labelKey:"settings.appearance.colorScheme.option.codeNomadClassic",descriptionKey:"settings.appearance.colorScheme.description.codeNomadClassic",appearance:"dark",editable:!1,colors:{surfaceBase:"#1A1A1A",surfaceSecondary:"#2A2A2A",surfaceMuted:"#212529",borderBase:"#3A3A3A",textPrimary:"#CFD4DC",textMuted:"#999999",accentPrimary:"#0080FF",statusSuccess:"#4CAF50",statusWarning:"#FF9800",statusError:"#F44336",userAccent:"#2196F3",agentAccent:"#D97706",compactionAccent:"#C084FC",yoloAccent:"#0080FF"}},{id:"basalt",labelKey:"settings.appearance.colorScheme.option.basalt",descriptionKey:"settings.appearance.colorScheme.description.basalt",appearance:"dark",editable:!1,colors:$t},{id:"fjord",labelKey:"settings.appearance.colorScheme.option.fjord",descriptionKey:"settings.appearance.colorScheme.description.fjord",appearance:"dark",editable:!1,colors:{surfaceBase:"#131A1F",surfaceSecondary:"#1B252C",surfaceMuted:"#243139",borderBase:"#354650",textPrimary:"#E7EEF1",textMuted:"#A8B8BF",accentPrimary:"#67C9BA",statusSuccess:"#72C497",statusWarning:"#D8B36A",statusError:"#E28181",...ke,yoloAccent:"#67C9BA"}},{id:"lichen",labelKey:"settings.appearance.colorScheme.option.lichen",descriptionKey:"settings.appearance.colorScheme.description.lichen",appearance:"dark",editable:!1,colors:{surfaceBase:"#181A15",surfaceSecondary:"#22251D",surfaceMuted:"#2C3025",borderBase:"#41473A",textPrimary:"#ECEEE8",textMuted:"#B2B8A7",accentPrimary:"#A9C47F",statusSuccess:"#77C49A",statusWarning:"#D6B36D",statusError:"#DF8580",...ke,yoloAccent:"#A9C47F"}},{id:"velvet",labelKey:"settings.appearance.colorScheme.option.velvet",descriptionKey:"settings.appearance.colorScheme.description.velvet",appearance:"dark",editable:!1,colors:{surfaceBase:"#160F16",surfaceSecondary:"#211721",surfaceMuted:"#2B1E2B",borderBase:"#443044",textPrimary:"#F1EAF0",textMuted:"#BAAAB7",accentPrimary:"#E5A77D",statusSuccess:"#78C59A",statusWarning:"#DDB46F",statusError:"#E28787",...ke,yoloAccent:"#E5A77D"}},{id:"ember",labelKey:"settings.appearance.colorScheme.option.ember",descriptionKey:"settings.appearance.colorScheme.description.ember",appearance:"dark",editable:!1,colors:{surfaceBase:"#1B1714",surfaceSecondary:"#27211D",surfaceMuted:"#312923",borderBase:"#493D34",textPrimary:"#F1ECE7",textMuted:"#BDB1A6",accentPrimary:"#D79A66",statusSuccess:"#78C296",statusWarning:"#D8AE62",statusError:"#DE817A",...ke,yoloAccent:"#D79A66"}},{id:"custom",labelKey:"settings.appearance.colorScheme.option.custom",descriptionKey:"settings.appearance.colorScheme.description.custom",appearance:"dark",editable:!0,colors:$t}],Gn=Object.fromEntries(ei.map(e=>[e.id,e])),tt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Tt=e=>typeof e=="string"&&/^#[0-9A-F]{6}$/.test(e);function Mn(e){return tt(e)&&Rr.every(t=>Tt(e[t]))}function ti(e){if(Mn(e))return{...e};if(!(!tt(e)||!Qs.every(t=>Tt(e[t]))))return{...e,...ke}}const ni=e=>({...e});function qe(e,t,n=Gn[e].appearance){const r=Gn[e];return{id:e,appearance:n,...r.colors?{colors:ni(t??r.colors)}:{}}}function he(e,t){const n=typeof e=="string"?e:tt(e)?e.id:void 0;if(typeof n=="string"&&Zs.includes(n)){const r=n;if(r!=="custom")return qe(r);const o=tt(e)?ti(e.colors)??$t:$t,s=tt(e)&&e.appearance==="light"?"light":"dark";return qe("custom",o,s)}return qe(t==="light"?"light":t==="dark"?"classic":"system")}const fe=(e,t)=>Number.parseInt(e.slice(t,t+2),16),Jn=e=>{const t=n=>{const r=n/255;return r<=.04045?r/12.92:((r+.055)/1.055)**2.4};return .2126*t(fe(e,1))+.7152*t(fe(e,3))+.0722*t(fe(e,5))};function kt(e,t){if(!Tt(e)||!Tt(t))return 0;const[n,r]=[Jn(e),Jn(t)].sort((o,s)=>s-o);return(n+.05)/(r+.05)}function Nr(e){if(!Mn(e))return!1;const t=[[e.textPrimary,e.surfaceBase],[e.textPrimary,e.surfaceSecondary],[e.textPrimary,e.surfaceMuted],[e.textMuted,e.surfaceBase],[e.textMuted,e.surfaceSecondary],[e.textMuted,e.surfaceMuted]],n=[e.accentPrimary,e.statusSuccess,e.statusWarning,e.statusError,e.userAccent,e.agentAccent,e.compactionAccent,e.yoloAccent],r=[e.surfaceBase,e.surfaceSecondary];return t.every(([o,s])=>kt(o,s)>=4.5)&&n.every(o=>r.every(s=>kt(o,s)>=3))}const pe=(e,t,n)=>`#${[1,3,5].map(o=>Math.round(fe(e,o)*n+fe(t,o)*(1-n))).map(o=>o.toString(16).padStart(2,"0")).join("").toUpperCase()}`,L=(e,t)=>`rgba(${fe(e,1)}, ${fe(e,3)}, ${fe(e,5)}, ${t})`,ri=e=>kt("#000000",e)>=kt("#FFFFFF",e)?"#000000":"#FFFFFF",oi=["--surface-base","--surface-primary","--surface-secondary","--surface-muted","--surface-code","--surface-hover","--border-base","--border-secondary","--border-muted","--border-strong","--border-critical","--text-primary","--text-secondary","--text-muted","--text-inverted","--text-on-accent","--accent-primary","--accent-hover","--focus-ring-color","--focus-ring-offset","--list-item-highlight-bg","--list-item-highlight-bg-solid","--list-item-highlight-border","--attachment-chip-bg","--attachment-chip-text","--attachment-chip-ring","--badge-neutral-bg","--badge-neutral-text","--env-vars-bg","--env-vars-border","--env-vars-text","--dropdown-highlight-bg","--selection-highlight-bg","--selection-highlight-strong-bg","--status-success","--status-warning","--status-error","--status-success-bg","--status-warning-bg","--status-error-bg","--status-success-ring","--status-warning-ring","--status-error-ring","--status-ready-fg","--status-ready-bg","--status-starting-fg","--status-starting-bg","--status-error-fg","--message-user-bg","--message-user-border","--message-assistant-border","--session-status-compacting-fg","--session-status-compacting-bg","--session-yolo-accent"];function si(e,t){const n=ri(e.accentPrimary);return{"--surface-base":e.surfaceBase,"--surface-primary":e.surfaceBase,"--surface-secondary":e.surfaceSecondary,"--surface-muted":e.surfaceMuted,"--surface-code":e.surfaceMuted,"--surface-hover":pe(e.textPrimary,e.surfaceSecondary,t?.12:.08),"--border-base":e.borderBase,"--border-secondary":pe(e.borderBase,e.surfaceSecondary,.72),"--border-muted":pe(e.borderBase,e.surfaceSecondary,.5),"--border-strong":pe(e.textPrimary,e.borderBase,.3),"--border-critical":e.statusError,"--text-primary":e.textPrimary,"--text-secondary":e.textMuted,"--text-muted":e.textMuted,"--text-inverted":n,"--text-on-accent":n,"--accent-primary":e.accentPrimary,"--accent-hover":pe(t?"#FFFFFF":"#000000",e.accentPrimary,t?.14:.18),"--focus-ring-color":e.accentPrimary,"--focus-ring-offset":e.surfaceBase,"--list-item-highlight-bg":L(e.accentPrimary,t?.2:.1),"--list-item-highlight-bg-solid":pe(e.accentPrimary,e.surfaceSecondary,t?.22:.1),"--list-item-highlight-border":L(e.accentPrimary,t?.4:.25),"--attachment-chip-bg":L(e.accentPrimary,.1),"--attachment-chip-text":e.accentPrimary,"--attachment-chip-ring":L(e.accentPrimary,t?.2:.1),"--badge-neutral-bg":L(e.accentPrimary,t?.15:.05),"--badge-neutral-text":e.accentPrimary,"--env-vars-bg":L(e.accentPrimary,t?.2:.1),"--env-vars-border":L(e.accentPrimary,t?.3:.2),"--env-vars-text":e.accentPrimary,"--dropdown-highlight-bg":L(e.accentPrimary,t?.2:.1),"--selection-highlight-bg":L(e.accentPrimary,t?.18:.12),"--selection-highlight-strong-bg":L(e.accentPrimary,t?.28:.18),"--status-success":e.statusSuccess,"--status-warning":e.statusWarning,"--status-error":e.statusError,"--status-success-bg":L(e.statusSuccess,.16),"--status-warning-bg":L(e.statusWarning,.16),"--status-error-bg":L(e.statusError,.16),"--status-success-ring":L(e.statusSuccess,.42),"--status-warning-ring":L(e.statusWarning,.42),"--status-error-ring":L(e.statusError,.42),"--status-ready-fg":e.statusSuccess,"--status-ready-bg":L(e.statusSuccess,.16),"--status-starting-fg":e.statusWarning,"--status-starting-bg":L(e.statusWarning,.16),"--status-error-fg":e.statusError,"--message-user-bg":pe(e.userAccent,e.surfaceSecondary,t?.1:.12),"--message-user-border":e.userAccent,"--message-assistant-border":e.agentAccent,"--session-status-compacting-fg":e.compactionAccent,"--session-status-compacting-bg":L(e.compactionAccent,t?.28:.18),"--session-yolo-accent":e.yoloAccent}}function ii(e,t={}){const n=e.appearance==="dark"||e.appearance==="system"&&!!t.systemDark,r=t.target??(typeof document>"u"?void 0:document.documentElement);if(!r)return n;for(const o of oi)r.style.removeProperty(o);if(r.dataset.colorScheme=e.id,e.appearance==="system"?r.removeAttribute("data-theme"):r.setAttribute("data-theme",n?"dark":"light"),e.colors&&e.id!=="classic")for(const[o,s]of Object.entries(si(e.colors,n)))r.style.setProperty(o,s);return n}const Br=50,qn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ai(e){if(!qn(e))return{};const t={};for(const[n,r]of Object.entries(e).slice(0,Br)){if(!n||n.length>128||!qn(r))continue;const o=typeof r.name=="string"?r.name.trim().slice(0,80):"",s=r.appearance==="light"?"light":r.appearance==="dark"?"dark":void 0;!o||!s||!Mn(r.colors)||!Nr(r.colors)||(t[n]={name:o,appearance:s,colors:{...r.colors}})}return t}function tu(e,t){var a;const n=e.trim()||"Custom",r=/^(.*?)(?:\s+(\d+))?$/.exec(n),o=((a=r==null?void 0:r[1])==null?void 0:a.trim())||n;let s=r!=null&&r[2]?Number(r[2])+1:2;const i=new Set(t.map(c=>c.trim().toLocaleLowerCase()));for(;i.has(`${o} ${s}`.toLocaleLowerCase());)s+=1;return`${o} ${s}`}function ci(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`palette-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Kt(e){if(!e||typeof e!="object"||Array.isArray(e))return{hiddenModelIds:[]};const t=e.hiddenModelIds;return Array.isArray(t)?{hiddenModelIds:Array.from(new Set(t.filter(n=>typeof n=="string"&&n.length>0)))}:{hiddenModelIds:[]}}function li(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))n&&(t[n]=Kt(r));return t}function nu(e,t){return!Kt(e).hiddenModelIds.includes(t)}function ru(e,t){return e&&t.some(n=>n.key===e.key)?e:void 0}const A=Oe("actions"),ui=20,di=5,fi=50,hi={preset:"balanced"},k={showThinkingBlocks:!1,showKeyboardShortcutHints:!1,thinkingBlocksExpansion:"collapsed",showMessageTimeline:!0,showTimelineTools:!1,holdLongAssistantReplies:!0,promptSubmitOnEnter:!0,followUpBehavior:"steer",showPromptVoiceInput:!0,diffViewMode:"split",toolOutputExpansion:"expanded",diagnosticsExpansion:"expanded",toolInputsVisibility:"collapsed",showUsageMetrics:!0,showProviderUsageCreditBalance:!1,autoCleanupBlankSessions:!0,keepUnseenSubagentIdleStatus:!0,osNotificationsEnabled:!1,osNotificationsAllowWhenVisible:!1,notifyOnNeedsInput:!0,notifyOnIdle:!0};function pn(e,t){return e==="expanded"||e==="collapsed"?e:t}function gi(e,t){return e==="hidden"||e==="expanded"||e==="collapsed"?e:t}function mi(e){return e==="minimal"||e==="balanced"||e==="detailed"||e==="everything"||e==="custom"?e:hi.preset}function pi(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))n&&(r==="hidden"||r==="expanded"||r==="collapsed")&&(t[n]=r);return t}function yi(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,r=pn(t.thinkingBlocksExpansion,"collapsed");return{preset:mi(n==null?void 0:n.preset),thinking:pn(n==null?void 0:n.thinking,r),tools:pi(n==null?void 0:n.tools)}}const $e={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function Ur(e){const t=e??{},n=yi(t.toolCallExpansionDefaults,t),r=n.preset==="minimal"||n.preset==="balanced"?"collapsed":"expanded";return{showThinkingBlocks:t.showThinkingBlocks??k.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??k.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??k.thinkingBlocksExpansion,showMessageTimeline:t.showMessageTimeline??k.showMessageTimeline,showTimelineTools:t.showTimelineTools??k.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??k.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??k.promptSubmitOnEnter,followUpBehavior:t.followUpBehavior==="queue"||t.followUpBehavior==="steer"?t.followUpBehavior:k.followUpBehavior,showPromptVoiceInput:t.showPromptVoiceInput??k.showPromptVoiceInput,locale:t.locale??k.locale,diffViewMode:t.diffViewMode??k.diffViewMode,toolCallExpansionDefaults:n,toolOutputExpansion:t.toolOutputExpansion??k.toolOutputExpansion,diagnosticsExpansion:gi(t.diagnosticsExpansion,k.diagnosticsExpansion),toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:k.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??k.showUsageMetrics,usageMetricsExpansion:pn(t.usageMetricsExpansion,r),showProviderUsageCreditBalance:t.showProviderUsageCreditBalance??k.showProviderUsageCreditBalance,autoCleanupBlankSessions:t.autoCleanupBlankSessions??k.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??k.keepUnseenSubagentIdleStatus,focusExistingWindowOnSecondLaunch:t.focusExistingWindowOnSecondLaunch===!0,modelVisibility:li(t.modelVisibility),osNotificationsEnabled:t.osNotificationsEnabled??k.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??k.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??k.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??k.notifyOnIdle}}function jr(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t}function bi(e){var o,s,i,a,c,u,l,d,f,g;const t=e??{},n=typeof t.sttModel=="string"&&t.sttModel.trim()?t.sttModel.trim():$e.sttModel,r=typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():$e.ttsModel;return{provider:t.provider==="openai-compatible"?t.provider:$e.provider,apiKey:typeof t.apiKey=="string"&&t.apiKey.trim()?t.apiKey.trim():void 0,hasApiKey:t.hasApiKey===!0||typeof t.apiKey=="string"&&t.apiKey.trim().length>0,baseUrl:typeof t.baseUrl=="string"&&t.baseUrl.trim()?t.baseUrl.trim():void 0,sttModel:n,ttsModel:r,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():$e.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:$e.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:$e.ttsFormat,separateProviders:t.separateProviders===!0,stt:{apiKey:typeof((o=t.stt)==null?void 0:o.apiKey)=="string"&&t.stt.apiKey.trim()?t.stt.apiKey.trim():void 0,hasApiKey:((s=t.stt)==null?void 0:s.hasApiKey)===!0||typeof((i=t.stt)==null?void 0:i.apiKey)=="string"&&t.stt.apiKey.trim().length>0,baseUrl:typeof((a=t.stt)==null?void 0:a.baseUrl)=="string"&&t.stt.baseUrl.trim()?t.stt.baseUrl.trim():void 0,model:typeof((c=t.stt)==null?void 0:c.model)=="string"&&t.stt.model.trim()?t.stt.model.trim():n},tts:{apiKey:typeof((u=t.tts)==null?void 0:u.apiKey)=="string"&&t.tts.apiKey.trim()?t.tts.apiKey.trim():void 0,hasApiKey:((l=t.tts)==null?void 0:l.hasApiKey)===!0||typeof((d=t.tts)==null?void 0:d.apiKey)=="string"&&t.tts.apiKey.trim().length>0,baseUrl:typeof((f=t.tts)==null?void 0:f.baseUrl)=="string"&&t.tts.baseUrl.trim()?t.tts.baseUrl.trim():void 0,model:typeof((g=t.tts)==null?void 0:g.model)=="string"&&t.tts.model.trim()?t.tts.model.trim():r}}}function Ye(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){const o=t(r);o&&n.push(o)}return n}function wi(e){var n,r,o;const t=e??{};return{recentFolders:Ye(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed,c=s.projectName;if(typeof i!="string")return null;const u=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:u,...typeof c=="string"&&c.trim()?{projectName:c.trim()}:{}}}),opencodeBinaries:Ye(t.opencodeBinaries,s=>{if(!s||typeof s!="object")return null;const i=s.path;if(typeof i!="string")return null;const a=typeof s.lastUsed=="number"?s.lastUsed:Date.now(),c=typeof s.version=="string"?s.version:void 0,u=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:u,lastUsed:a}}),remoteServers:Ye(t.remoteServers,s=>{if(!s||typeof s!="object")return null;const i=typeof s.id=="string"?s.id.trim():"",a=typeof s.name=="string"?s.name.trim():"",c=typeof s.baseUrl=="string"?s.baseUrl.trim():"";if(!i||!a||!c)return null;const u=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),l=typeof s.updatedAt=="string"?s.updatedAt:u,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:u,updatedAt:l,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:Ye((n=t.models)==null?void 0:n.recents,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),favorites:Ye((r=t.models)==null?void 0:r.favorites,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),thinkingSelections:jr((o=t.models)==null?void 0:o.thinkingSelections)}}}function Ci(e){const t=e??{},n=t.listeningMode==="all"?"all":"local",r=t.logLevel==="INFO"||t.logLevel==="WARN"||t.logLevel==="ERROR"||t.logLevel==="DEBUG"?t.logLevel:"DEBUG",o=typeof t.opencodeBinary=="string"&&t.opencodeBinary.trim()&&t.opencodeBinary!=="opencode"?t.opencodeBinary:"opencode2",s=jr(t.environmentVariables),i=Si(t.secureEnvVars),a=bi(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,secureEnvVars:i,speech:a}}function Si(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function _r(e){return`${e.providerId}/${e.modelId}`}function Wr(e,t,n){const r=new Set([e,n].filter(c=>!!c)),o=n?t.find(c=>c.path===n):void 0,s=t.find(c=>c.path===e),i=(o==null?void 0:o.projectName)??(s==null?void 0:s.projectName),a=t.filter(c=>!r.has(c.path));return a.unshift({path:e,lastAccessed:Date.now(),...i?{projectName:i}:{}}),a.slice(0,ui)}function Vr(e,t,n){if(e==="opencode"||e==="opencode2")return n;const r=Date.now(),o=n.find(i=>i.path===e);if(o){const i={...o,lastUsed:r,version:t??o.version},a=n.filter(c=>c.path!==e);return[i,...a]}return[t?{path:e,version:t,lastUsed:r}:{path:e,lastUsed:r},...n].slice(0,10)}function xi(e,t){const n=e.id?t.find(o=>o.id===e.id):void 0,r=new Date().toISOString();return{id:(n==null?void 0:n.id)??e.id??vi(),name:e.name.trim(),baseUrl:e.baseUrl.trim(),skipTlsVerify:!!e.skipTlsVerify,createdAt:(n==null?void 0:n.createdAt)??r,updatedAt:r,lastConnectedAt:n==null?void 0:n.lastConnectedAt}}function Kr(e,t){const n=t.filter(r=>r.id!==e.id);return[e,...n].sort((r,o)=>{const s=r.lastConnectedAt??r.updatedAt;return(o.lastConnectedAt??o.updatedAt).localeCompare(s)})}function vi(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[ut,Ft]=$({}),[Ai,It]=$({}),[He,Dt]=$({}),[zr,nt]=$(!1),Oi=F(()=>Ur(ut().settings)),Hr=F(()=>He().theme??ut().theme??"system"),Gr=F(()=>he(He().colorScheme??ut().colorScheme,Hr())),Ei=F(()=>{const e=He(),t=ut(),n=e.customColorScheme??t.customColorScheme??(Gr().id==="custom"?e.colorScheme??t.colorScheme:void 0),r=typeof n=="object"&&n!==null&&!Array.isArray(n)?{...n,id:"custom"}:{id:"custom"};return he(r)}),zt=F(()=>ai(He().colorSchemePresets)),Pi=F(()=>{const e=He().activeColorSchemePresetId;return typeof e=="string"&&zt()[e]?e:void 0}),Se=F(()=>Ci(Ai())),se=F(()=>wi(He())),j=Oi,dt=F(()=>se().recentFolders),Ht=F(()=>se().opencodeBinaries),We=F(()=>se().remoteServers);let Ct=null;async function Gt(){zr()||(Ct||(Ct=Promise.all([Q.loadConfigOwner("ui"),Q.loadConfigOwner("server"),Q.loadStateOwner("ui")]).then(([e,t,n])=>{Ft(e),It(t),Dt(n),nt(!0)}).catch(e=>{A.error("Failed to load settings",e),Ft({}),It({}),Dt({}),nt(!0)}).finally(()=>{Ct=null})),await Ct)}async function Y(e,t){await Gt();const n=await Q.patchConfigOwner(e,t);e==="ui"&&Ft(n),e==="server"&&It(n)}async function U(e,t){await Gt();const n=await Q.patchStateOwner(e,t);Dt(n)}function G(e){const t=ut(),n=Ur({...t.settings??{},...e}),r={settings:Object.fromEntries(Object.keys(e).map(o=>[o,n[o]]))};return Y("ui",r).then(()=>!0,o=>(A.error("Failed to patch ui settings",o),!1))}function Jr(e){return G(e)}const Xe=new Map;let Yn=Promise.resolve();const[Mi,on]=$(new Map),[$i,Xn]=$(new Set);function Ti(e){return Mi().get(e)??Kt(j().modelVisibility[e])}function ki(e){return $i().has(e)}async function Fi(e,t){if(!e)return;const n=Kt(t);on(s=>new Map(s).set(e,n)),Xn(s=>{const i=new Set(s);return i.delete(e),i});const o=Yn.catch(()=>{}).then(()=>Y("ui",{settings:{modelVisibility:{[e]:n}}}));Yn=o,Xe.set(e,o),o.then(()=>{Xe.get(e)===o&&(Xe.delete(e),on(s=>{const i=new Map(s);return i.delete(e),i}))},s=>{A.error("Failed to update provider model visibility",s),Xe.get(e)===o&&(Xe.delete(e),on(i=>{const a=new Map(i);return a.delete(e),a}),Xn(i=>new Set(i).add(e)))}),await o}function Ii(e){qr(he(e==="dark"?"classic":e))}let Ve=Promise.resolve();function qr(e){const t=he(e),r={theme:t.appearance==="system"?"system":t.appearance,colorScheme:t,...t.id==="custom"?{customColorScheme:t}:{},activeColorSchemePresetId:null},o=Ve.then(()=>U("ui",r));return Ve=o.then(()=>{},()=>{}),o.then(()=>{}).catch(s=>{throw A.error("Failed to set color scheme",s),s})}function Di(e){const t=zt()[e];if(!t)return Promise.resolve();const n=he({id:"custom",appearance:t.appearance,colors:t.colors}),r=Ve.then(()=>U("ui",{theme:t.appearance,colorScheme:n,customColorScheme:n,activeColorSchemePresetId:e}));return Ve=r.then(()=>{},()=>{}),r.then(()=>{})}function Li(e,t,n){const r=e.trim().slice(0,80);if(!r||!Nr(n))return Promise.reject(new Error("Invalid color scheme preset"));if(Object.keys(zt()).length>=Br)return Promise.reject(new Error("Color scheme preset limit reached"));const o=ci(),s=he({id:"custom",appearance:t,colors:n}),i=Ve.then(()=>U("ui",{theme:t,colorScheme:s,customColorScheme:s,colorSchemePresets:{[o]:{name:r,appearance:t,colors:{...n}}},activeColorSchemePresetId:o}));return Ve=i.then(()=>{},()=>{}),i.then(()=>o)}async function Ri(e){Se().listeningMode!==e&&await Y("server",{listeningMode:e})}function Yr(e){Y("server",{environmentVariables:e}).catch(t=>A.error("Failed to update environment variables",t))}function Ni(e,t,n=!0){const r=Se().environmentVariables;Yr({...r,[e]:t});const o=Se().secureEnvVars,s=e.toUpperCase(),i=o.some(a=>a.toUpperCase()===s);if(n){if(!i){const a=[...o,e];Y("server",{secureEnvVars:a}).catch(c=>A.error("Failed to add secure env var",c))}}else if(i){const a=o.filter(c=>c.toUpperCase()!==s);Y("server",{secureEnvVars:a}).catch(c=>A.error("Failed to remove secure env var",c))}}function Bi(e){Y("server",{environmentVariables:{[e]:null}}).catch(t=>A.error("Failed to remove environment variable",t))}function Ui(e){return Se().secureEnvVars.some(n=>n.toUpperCase()===e.toUpperCase())}function ji(e){const t=Se().secureEnvVars,n=e.toUpperCase(),o=t.some(s=>s.toUpperCase()===n)?t.filter(s=>s.toUpperCase()!==n):[...t,e];Y("server",{secureEnvVars:o}).catch(s=>A.error("Failed to update secure env vars",s))}function _i(e){const t=e&&e.trim().length>0?e:"opencode2";Y("server",{opencodeBinary:t}).catch(r=>A.error("Failed to set default binary",r));const n=Vr(t,void 0,Ht());U("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to update binary list",r))}function Wi(e){Y("server",{logLevel:e??"DEBUG"}).catch(n=>A.error("Failed to set log level",n))}async function Vi(e){const t=Xs(e);try{await Y("server",{speech:t})}catch(n){throw A.error("Failed to update speech settings",n),n}}function Ki(e,t){const n=Vr(e,t,Ht());U("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to add binary",r))}function zi(e){const t=Ht().filter(n=>n.path!==e);U("ui",{opencodeBinaries:t}).catch(n=>A.error("Failed to remove binary",n)),Se().opencodeBinary===e&&Y("server",{opencodeBinary:"opencode2"}).catch(n=>A.error("Failed to reset default binary",n))}function Hi(e){const t=Wr(e,dt());U("ui",{recentFolders:t}).catch(n=>A.error("Failed to add recent folder",n))}function Gi(e){const t=dt().filter(n=>n.path!==e);U("ui",{recentFolders:t}).catch(n=>A.error("Failed to remove recent folder",n))}async function Ji(e,t){const n=t.trim();if(!e||!n)return;const r=dt().map(o=>o.path===e?{...o,projectName:n}:o);try{await U("ui",{recentFolders:r})}catch(o){throw A.error("Failed to rename recent folder",o),o}}async function qi(e){const t=xi(e,We());return await U("ui",{remoteServers:Kr(t,We())}),t}async function Yi(e){const t=We().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await U("ui",{remoteServers:Kr(r,We())})}function Xi(e){const t=We().filter(n=>n.id!==e);U("ui",{remoteServers:t}).catch(n=>A.error("Failed to remove remote server",n))}function Zi(e,t){const n=Wr(e,dt(),t);U("ui",{recentFolders:n}).catch(r=>A.error("Failed to update ui state on launch",r))}function Qi(e){if(!e.providerId||!e.modelId)return;const n=se().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,di);U("ui",{models:{recents:r}}).catch(o=>A.error("Failed to update model recents",o))}function ea(e){return!e.providerId||!e.modelId?!1:se().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function ta(e){if(!e.providerId||!e.modelId)return;const t=se().models.favorites,r=t.some(o=>o.providerId===e.providerId&&o.modelId===e.modelId)?t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId):[e,...t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId)].slice(0,fi);U("ui",{models:{favorites:r}}).catch(o=>A.error("Failed to update model favorites",o))}function na(e){if(!(!e.providerId||!e.modelId))return se().models.thinkingSelections[_r(e)]}function ra(e,t){if(!e.providerId||!e.modelId)return;const n=_r(e);if(se().models.thinkingSelections[n]===t)return;const o={...se().models.thinkingSelections};t?o[n]=t:delete o[n],U("ui",{models:{thinkingSelections:o}}).catch(s=>A.error("Failed to update thinking selection",s))}function oa(e){j().diffViewMode!==e&&G({diffViewMode:e})}function sa(e){const t=j();t.toolCallExpansionDefaults.tools.other!==e&&G({toolOutputExpansion:e==="hidden"?t.toolOutputExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",tools:{...t.toolCallExpansionDefaults.tools,other:e}}})}function ia(e){j().diagnosticsExpansion!==e&&G({diagnosticsExpansion:e})}function aa(e){j().toolInputsVisibility!==e&&G({toolInputsVisibility:e})}function ca(e){const t=j();t.thinkingBlocksExpansion===e&&t.toolCallExpansionDefaults.thinking===e||G({thinkingBlocksExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",thinking:e}})}function la(){G({showThinkingBlocks:!j().showThinkingBlocks})}function ua(){Jr({showKeyboardShortcutHints:!j().showKeyboardShortcutHints})}function da(){G({showTimelineTools:!j().showTimelineTools})}function fa(){G({showMessageTimeline:!(j().showMessageTimeline??!0)})}function ha(){G({showUsageMetrics:!j().showUsageMetrics})}function ga(){G({promptSubmitOnEnter:!j().promptSubmitOnEnter})}function ma(){G({showPromptVoiceInput:!j().showPromptVoiceInput})}function pa(){const e=!j().autoCleanupBlankSessions;A.info("toggle auto cleanup",{value:e}),G({autoCleanupBlankSessions:e})}async function ya(e,t,n){!e||!t||!n.providerId||!n.modelId||(await Vt(e),await Ir(e,r=>{const o={...r.agentModelSelections??{}},s=o[t];s&&s.providerId===n.providerId&&s.modelId===n.modelId||(o[t]=n,r.agentModelSelections=o)}))}async function ba(e,t){return!e||!t?void 0:(await Vt(e),(Dr(e).agentModelSelections??{})[t])}Gt().catch(e=>{A.error("Failed to initialize settings",e)});const Xr=Ke(),wa={isLoaded:zr,preferences:j,updatePreferences:Jr,setProviderModelVisibility:Fi,getProviderModelVisibilityPreference:Ti,providerModelVisibilitySaveFailed:ki,themePreference:Hr,setThemePreference:Ii,colorSchemePreference:Gr,customColorSchemePreference:Ei,colorSchemePresets:zt,activeColorSchemePresetId:Pi,setColorSchemePreference:qr,selectColorSchemePreset:Di,saveColorSchemePreset:Li,serverSettings:Se,setListeningMode:Ri,updateEnvironmentVariables:Yr,addEnvironmentVariable:Ni,removeEnvironmentVariable:Bi,isSecureEnvVar:Ui,toggleSecureEnvVar:ji,updateLastUsedBinary:_i,updateLogLevel:Wi,updateSpeechSettings:Vi,recentFolders:dt,opencodeBinaries:Ht,remoteServers:We,uiState:se,addRecentFolder:Hi,removeRecentFolder:Gi,renameRecentFolderProject:Ji,addOpenCodeBinary:Ki,removeOpenCodeBinary:zi,saveRemoteServerProfile:qi,markRemoteServerConnected:Yi,removeRemoteServerProfile:Xi,recordWorkspaceLaunch:Zi,addRecentModelPreference:Qi,isFavoriteModelPreference:ea,toggleFavoriteModelPreference:ta,getModelThinkingSelection:na,setModelThinkingSelection:ra,toggleShowThinkingBlocks:la,toggleKeyboardShortcutHints:ua,toggleShowMessageTimeline:fa,toggleShowTimelineTools:da,toggleUsageMetrics:ha,toggleAutoCleanupBlankSessions:pa,togglePromptSubmitOnEnter:ga,toggleShowPromptVoiceInput:ma,setDiffViewMode:oa,setToolOutputExpansion:sa,setDiagnosticsExpansion:ia,setThinkingBlocksExpansion:ca,setToolInputsVisibility:aa,setAgentModelPreference:ya,getAgentModelPreference:ba},ou=e=>(jt(()=>{Gt().catch(o=>{A.error("Failed to initialize settings",o)});const t=Q.onConfigOwnerChanged("ui",o=>{Ft(o),nt(!0)}),n=Q.onConfigOwnerChanged("server",o=>{It(o),nt(!0),Ys(),qs(!0)}),r=Q.onStateOwnerChanged("ui",o=>{Dt(o),nt(!0)});return()=>{t(),n(),r()}}),de(Xr.Provider,{value:wa,get children(){return e.children}}));function Ca(){const e=ct(Xr);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function $n(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Sa(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&n[0].length===1&&(n=n.map(r=>r+r)),n?`rgb${n.length===4?"a":""}(${n.map((r,o)=>o<3?parseInt(r,16):Math.round(parseInt(r,16)/255*1e3)/1e3).join(", ")})`:""}function xe(e){if(typeof e!="string")return e;if(e.charAt(0)==="#")return xe(Sa(e));const t=e.indexOf("("),n=e.substring(0,t);if(["rgb","rgba","hsl","hsla","color"].indexOf(n)===-1)throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const r=e.substring(t+1,e.length-1);let o,s;if(n==="color"){if(o=r.split(" "),s=o.shift(),o.length===4&&o[3].charAt(0)==="/"&&(o[3]=o[3].substr(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(s)===-1)throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020. "+s)}else o=r.split(",");return{type:n,values:o.map(i=>parseFloat(i)),colorSpace:s}}function Jt(e){const{type:t,colorSpace:n}=e,{values:r}=e;let o;return t.indexOf("rgb")!==-1?o=r.map((s,i)=>i<3?parseInt(s.toString(),10):s).join(","):t.indexOf("hsl")!==-1&&(o=r.map((s,i)=>i===1||i===2?`${s}%`:s).join(",")),t.indexOf("color")!==-1?o=`${n} ${r.join(" ")}`:o=`${r.join(", ")}`,`${t}(${o})`}function xa(e){const t=xe(e),{values:n}=t,r=n[0],o=n[1]/100,s=n[2]/100,i=o*Math.min(s,1-s),a=(l,d=(l+r/30)%12)=>s-i*Math.max(Math.min(d-3,9-d,1),-1);let c="rgb";const u=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return t.type==="hsla"&&(c+="a",u.push(n[3])),Jt({type:c,values:u})}function Zn(e){const{type:t,values:n}=xe(e);let r=t==="hsl"?xe(xa(e)).values:n;return r=r.map(o=>(t!=="color"&&(o/=255),o<=.03928?o/12.92:((o+.055)/1.055)**2.4)),Number((.2126*r[0]+.7152*r[1]+.0722*r[2]).toFixed(3))}function va(e,t){const n=Zn(e),r=Zn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function su(e,t){let{type:n,values:r}=xe(e);return t=$n(t),(n==="rgb"||n==="hsl")&&(n+="a"),n==="color"?r[3]=`/${t}`:r[3]=t,Jt({type:n,values:r})}function Aa(e,t){const n=xe(e);if(t=$n(t),n.type.indexOf("hsl")!==-1)n.values[2]*=1-t;else if(n.type.indexOf("rgb")!==-1||n.type.indexOf("color")!==-1)for(let r=0;r<3;r+=1)n.values[r]*=1-t;return Jt(n)}function Oa(e,t){const n=xe(e);if(t=$n(t),n.type.indexOf("hsl")!==-1)n.values[2]+=(100-n.values[2])*t;else if(n.type.indexOf("rgb")!==-1)for(let r=0;r<3;r+=1)n.values[r]+=(255-n.values[r])*t;else if(n.type.indexOf("color")!==-1)for(let r=0;r<3;r+=1)n.values[r]+=(1-n.values[r])*t;return Jt(n)}const Ea={xs:0,sm:600,md:900,lg:1200,xl:1536};function Pa(e,t,n){const r=e.theme||{};if(Array.isArray(t)){const s=r.breakpoints;return t.reduce((i,a,c)=>(i={...i,...s.up(s.keys[c],n(t[c]))},i),{})}if(typeof t=="object"){const s=r.breakpoints;return Object.keys(t).reduce((a,c)=>{if(Object.keys(s.values||Ea).indexOf(c)!==-1)a={...a,...s.up(c,n(t[c],c))};else{const u=c;a[u]=t[u]}return a},{})}return n(t)}const Ma={cleanupStyles:!0},$a=Ke(Ma),ve={black:"#000",white:"#fff"},Ie={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},De={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Le={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Re={300:"#4fc3f7",400:"#29b6f6",700:"#0288d1",800:"#0277bd",900:"#01579b"},Ne={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},rt={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Ta={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function Qe(e){return e!==null&&typeof e=="object"&&e.constructor===Object}function ka(e,t){for(const n of t){const r=e[n];delete e[n],e[n]=r}}function Tn(e,t,n={clone:!0}){const r=n.clone?{...e}:e,o=n.sortKeys?[]:void 0;return Qe(e)&&Qe(t)&&(Object.keys(t).forEach(s=>{if(s==="__proto__")return;o&&o.push(s);let i,a;Qe(i=t[s])&&s in e&&Qe(a=e[s])?r[s]=Tn(a,i,n):i!==void 0&&(r[s]=i)}),o&&ka(r,o)),r}function yn(e){if(Array.isArray(e)){const t=[];for(const n of e)t.push(yn(n));return t}else if(Qe(e)){const t={};for(const n in e)n!=="__proto__"&&(t[n]=yn(e[n]));return t}else return e}function ft(e,...t){for(const n of t)Tn(e,yn(n),{clone:!1});return e}const Fa=()=>({text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:ve.white,default:ve.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}),Ia={primary:{main:Le[700],light:Le[400],dark:Le[800]},secondary:{main:De[500],light:De[300],dark:De[700]},error:{main:Ie[700],light:Ie[400],dark:Ie[800]},info:{main:Re[700],light:Re[800],dark:Re[900]},success:{main:Ne[800],light:Ne[500],dark:Ne[900]},warning:{main:"#ED6C02",light:rt[500],dark:rt[900]}},Da=()=>({text:{primary:ve.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:ve.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}),La={primary:{main:Le[200],light:Le[50],dark:Le[400]},secondary:{main:De[200],light:De[50],dark:De[400]},error:{main:Ie[500],light:Ie[300],dark:Ie[700]},info:{main:Re[400],light:Re[300],dark:Re[700]},success:{main:Ne[400],light:Ne[300],dark:Ne[700]},warning:{main:rt[400],light:rt[300],dark:rt[700]}},Ra={light:Fa,dark:Da};function Zr(e,t){return va(e,ve.white)>=t?ve.white:"rgba(0, 0, 0, 0.87)"}function Qn(e,t,n,r){const o=typeof r=="number"?r:r.light,s=typeof r=="number"?r*1.5:r.dark;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:t==="light"?e.light=Oa(e.main,o):t==="dark"&&(e.dark=Aa(e.main,s)))}function Na(e){const t={...e.color},n=e.mainShade??500;return!e.color.main&&e.color[n]&&(t.main=e.color[n]),Qn(t,"light",e.lightShade??300,e.tonalOffset),Qn(t,"dark",e.darkShade??700,e.tonalOffset),t.contrastText||(t.contrastText=Zr(t.main,e.contrastThreshold)),t}const Ba=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:Ta,common:ve});function Ua(e){const t=["error","info","primary","secondary","success","warning"],n=Ba(),r={...ft({},n,Ra[(e==null?void 0:e.mode)??n.mode](),e),isColorName(s){return t.includes(s)},getColorObject(s){return r[s]},getColor(s){return r.mode==="light"?r[s].light:r[s].dark},augmentColor(s){return Na({...s,tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold})},getContrastText(s){return Zr(s,r.contrastThreshold)}},o=s=>r.mode==="light"?Ia[s]:La[s];return r.primary=r.augmentColor({color:r.primary||o("primary")}),r.secondary=r.augmentColor({color:r.secondary||o("secondary"),mainShade:"A400",lightShade:"A200",darkShade:"A700"}),r.error=r.augmentColor({color:r.error||o("error")}),r.warning=r.augmentColor({color:r.warning||o("warning")}),r.info=r.augmentColor({color:r.info||o("info")}),r.success=r.augmentColor({color:r.success||o("success")}),r}const ja={};function _a(e){return{...ft({},ja,e??{})}}function Wa(e,t=void 0,n={}){return{toolbar:{minHeight:56,[`${e.up("xs")} and (orientation: landscape)`]:{minHeight:48},[e.up("sm")]:{minHeight:64}},...n}}const sn={},Va=.2,Ka=.14,za=.12;function M(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Va})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Ka})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${za})`].join(",")}const Ha=[()=>"none",()=>M(0,2,1,-1,0,1,1,0,0,1,3,0),()=>M(0,3,1,-2,0,2,2,0,0,1,5,0),()=>M(0,3,3,-2,0,3,4,0,0,1,8,0),()=>M(0,2,4,-1,0,4,5,0,0,1,10,0),()=>M(0,3,5,-1,0,5,8,0,0,1,14,0),()=>M(0,3,5,-1,0,6,10,0,0,1,18,0),()=>M(0,4,5,-2,0,7,10,1,0,2,16,1),()=>M(0,5,5,-3,0,8,10,1,0,3,14,2),()=>M(0,5,6,-3,0,9,12,1,0,3,16,2),()=>M(0,6,6,-3,0,10,14,1,0,4,18,3),()=>M(0,6,7,-4,0,11,15,1,0,4,20,3),()=>M(0,7,8,-4,0,12,17,2,0,5,22,4),()=>M(0,7,8,-4,0,13,19,2,0,5,24,4),()=>M(0,7,9,-4,0,14,21,2,0,5,26,4),()=>M(0,8,9,-5,0,15,22,2,0,6,28,5),()=>M(0,8,10,-5,0,16,24,2,0,6,30,5),()=>M(0,8,11,-5,0,17,26,2,0,6,32,5),()=>M(0,9,11,-5,0,18,28,2,0,7,34,6),()=>M(0,9,12,-6,0,19,29,2,0,7,36,6),()=>M(0,10,13,-6,0,20,31,3,0,8,38,7),()=>M(0,10,13,-6,0,21,33,3,0,8,40,7),()=>M(0,10,14,-6,0,22,35,3,0,8,42,7),()=>M(0,11,14,-7,0,23,36,3,0,9,44,8),()=>M(0,11,15,-7,0,24,38,3,0,9,46,8)];function Ga(){return new Proxy([],{get:(e,t)=>typeof t!="string"||isNaN(Number(t))?e[t]:t in sn?sn[t]:sn[t]=Ha[t]()})}const Ja={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},qa={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function er(e){return`${Math.round(e)}ms`}function Ya(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function Xa(e){const t={...Ja,...e.easing},n={...qa,...e.duration};return{getAutoHeightDuration:Ya,create:(o=["all"],s={})=>{const{duration:i=n.standard,easing:a=t.easeInOut,delay:c=0,...u}=s;return(Array.isArray(o)?o:[o]).map(l=>`${l} ${typeof i=="string"?i:er(i)} ${a} ${typeof c=="string"?c:er(c)}`).join(",")},...e,easing:t,duration:n}}const z={light:300,regular:400,medium:500},St={fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',fontSize:14,htmlFontSize:16,h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},subtitle1:{},subtitle2:{},body1:{},body2:{},button:{},caption:{},overline:{},fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:700};function Za(e){return Math.round(e*1e5)/1e5}function H(e,t,n,r,o,s){return{fontFamily:e.fontFamily,fontWeight:t,fontSize:e.pxToRem(n),lineHeight:`${r}`,letterSpacing:`${Za(o/n)}em`,...s?{textTransform:"uppercase"}:{}}}function Qa(e={}){const t={fontFamily:e.fontFamily??St.fontFamily,fontSize:e.fontSize??St.fontSize,htmlFontSize:(e==null?void 0:e.htmlFontSize)??St.htmlFontSize,pxToRem:n=>{const r=t.fontSize/14;return`${n/t.htmlFontSize*r}rem`}};return ft(St,t,{h1:H(t,z.light,96,1.167,-1.5),h2:H(t,z.light,60,1.2,-.5),h3:H(t,z.regular,48,1.167,0),h4:H(t,z.regular,34,1.235,.25),h5:H(t,z.regular,24,1.334,0),h6:H(t,z.medium,20,1.6,.15),subtitle1:H(t,z.regular,16,1.75,.15),subtitle2:H(t,z.medium,14,1.57,.1),body1:H(t,z.regular,16,1.5,.15),body2:H(t,z.regular,14,1.43,.15),button:H(t,z.medium,14,1.75,.4,!0),caption:H(t,z.regular,12,1.66,.4),overline:H(t,z.regular,12,2.66,1,!0)},e)}const ec={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function tc(e){return{...ft({},ec,e)}}function an(e,t,n="px"){let r;if(e==="up")r=`(min-width:${t}${n})`;else if(e==="down")r=`(max-width:${t}${n})`;else if(e==="between"){const[o,s]=t;r=`(max-width:${o}${n}) and (min-width:${s}${n})`}else throw new Error(`Invalid comparator: ${e}`);return`@media ${r}`}const nc={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function Qr(e){const t={...nc,...e??{},up:(n,r)=>{const o=an("up",t.resolve(n));return r?{[o]:r}:o},down:(n,r)=>{const o=an("down",t.resolve(n));return r?{[o]:r}:o},between:(n,r)=>{const o=an("between",[t.resolve(n[0]),t.resolve(n[1])]);return r?{[o]:r}:o},resolve:n=>typeof n=="number"?n:t.values[n]};return t}function eo(e){return typeof e=="function"?e:(...n)=>n.map(r=>typeof r=="number"?`${r*(e??8)}px`:r).join(" ")}const rc={borderRadius:4};function to(e){return{...ft({},rc,e)}}function no(e={}){const t={direction:"ltr",...e};function n(r,o){const s=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,...typeof s=="function"?{get:s}:{value:o({[r]:s})}})}return n("breakpoints",r=>Qr(r.breakpoints)),n("components",r=>_a(r.components)),n("palette",r=>Ua(r.palette)),n("shape",r=>to(r.shape)),n("spacing",r=>eo(r.spacing)),n("typography",r=>Qa(r.typography)),n("shadows",()=>Ga()),n("transitions",()=>Xa({})),n("zIndex",r=>tc(r.zIndex)),n("mixins",()=>Wa(t.breakpoints)),t}function ro(e){let t;return function(){return t||(t=e()),t}}const oc=ro(no);let oo;oo=Ke({});const qt=oo;function sc(e){return{direction:"ltr",shadows:void 0,transitions:void 0,components:void 0,palette:void 0,typography:void 0,zIndex:void 0,mixins:void 0,...e,breakpoints:Qr(e==null?void 0:e.breakpoints),shape:to(e==null?void 0:e.shape),spacing:eo(e==null?void 0:e.spacing)}}const ic=ro(sc);function ac(e){for(const t in e)return!1;return!0}function kn(e=ic,t=qt){const n=ct(t);if(typeof n=="function")return new Proxy({},{get:(r,o)=>n()[o]});if(ac(n)&&e)return typeof e=="function"?e():e;if(!n)throw new Error("Theme is not defined");return n}function so(e=oc){return kn(e,qt)}function cc(e){return kn(e,qt)}function lc(e){var s,i;const t=[],n=typeof e.propDefaults=="function"?e.propDefaults({set:a=>a,inProps:e.props}):e.propDefaults,o=(i=(s=cc().components)==null?void 0:s[e.name])==null?void 0:i.defaultProps;return n&&t.push(n),o&&t.push(o),t.length?hr(...t,e.props):e.props}function uc(e){return de(qt.Provider,{get value(){return e.theme},get children(){return e.children}})}function dc(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function fc(e,t){switch(typeof e){case"function":return Object.assign(e,{[Io]:!0}),ot(()=>e(t));case"string":const n=gr.has(e),r=R.context?yr():dc(e,n);return pr(r,t,n),r}}function io(e,t){const n=F(e);return F(()=>fc(n(),t))}function iu(e){const[t,n]=Ut(e,["$component"]);return io(()=>t.$component,n)}function hc(e){const t=e.reduce((n,r)=>("name"in r&&(n[`--${r.name}`]="0"),Tn(n,r,{clone:!1,sortKeys:!0}),n),{});return delete t.name,t}function ao(e){return e.startsWith("--")}function gc(e){return e.startsWith("__")}function co(e){return/[^a-z-]/i.test(e)&&!ao(e)}function lo(e){return e.startsWith("@global")}function bn(e){return e.startsWith("@media")}function uo(e){return e.startsWith("@keyframes")}function tr(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function nr(e,t,n=[],r={}){const o=e.split(",").map(s=>(s=s.trim(),s.includes("&")?s:`& ${s}`));return Lt(t,(n.length?n:[""]).flatMap(s=>o.map(i=>i.replace(/&/g,s).trim())),{...r})}function rr(e,t){if(!t)return tr(e);let n=t.get(e);return n||(t.set(e,n=tr(e)),n)}function Lt(e,t=[],n={}){const r=[],o=[];for(let i in e){const a=e[i];if(!gc(i))if(lo(i))for(const c in a)o.push(...nr(c,a[c],[],n));else if(bn(i))o.push(...Lt(a,t,{...n,sublevel:!0}).map(c=>`${i} {
1
+ var To=Object.defineProperty;var ko=(e,t,n)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pt=(e,t,n)=>ko(e,typeof t!="symbol"?t+"":t,n);import{c as F,a as le,u as ot,s as Ut,b as fr,d as W,g as In,r as Fo,e as $,o as ue,f as R,$ as V,h as we,i as Ot,j as st,k as de,l as Ke,m as ct,n as jt,p as hr,q as Io,t as Do,v as Lo,S as Ro}from"./git-diff-vendor-ChbWBukG.js";import{g as No}from"./fast-diff-vendor-DgdwVvTQ.js";const Bo=["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"],Uo=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...Bo]),jo=new Set(["innerHTML","textContent","innerText","children"]),_o=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Wo=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function Vo(e,t){const n=Wo[e];return typeof n=="object"?n[t]?n.$:void 0:n}const Ko=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),gr=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),zo={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},Ho=e=>F(()=>e());function Go(e,t,n){let r=n.length,o=t.length,s=r,i=0,a=0,c=t[o-1].nextSibling,u=null;for(;i<o||a<s;){if(t[i]===n[a]){i++,a++;continue}for(;t[o-1]===n[s-1];)o--,s--;if(o===i){const l=s<r?a?n[a-1].nextSibling:n[s-a]:c;for(;a<s;)e.insertBefore(n[a++],l)}else if(s===a)for(;i<o;)(!u||!u.has(t[i]))&&t[i].remove(),i++;else if(t[i]===n[s-1]&&n[a]===t[o-1]){const l=t[--o].nextSibling;e.insertBefore(n[a++],t[i++].nextSibling),e.insertBefore(n[--s],l),t[o]=n[s]}else{if(!u){u=new Map;let d=a;for(;d<s;)u.set(n[d],d++)}const l=u.get(t[i]);if(l!=null)if(a<l&&l<s){let d=i,f=1,g;for(;++d<o&&d<s&&!((g=u.get(t[d]))==null||g!==l+f);)f++;if(f>l-a){const b=t[i];for(;a<l;)e.insertBefore(n[a++],b)}else e.replaceChild(n[a++],t[i++])}else i++;else t[i++].remove()}}}const Dn="_$DX_DELEGATE";function Vl(e,t,n,r={}){let o;return fr(s=>{o=s,t===document?e():Et(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function An(e,t,n,r){let o;const s=()=>{const a=r?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=e,n?a.content.firstChild.firstChild:r?a.firstChild:a.content.firstChild},i=t?()=>ot(()=>document.importNode(o||(o=s()),!0)):()=>(o||(o=s())).cloneNode(!0);return i.cloneNode=i,i}function mr(e,t=window.document){const n=t[Dn]||(t[Dn]=new Set);for(let r=0,o=e.length;r<o;r++){const s=e[r];n.has(s)||(n.add(s),t.addEventListener(s,ns))}}function it(e,t,n){Ae(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Jo(e,t,n,r){Ae(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function qo(e,t,n){Ae(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function Yo(e,t){Ae(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Xo(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const o=n[0];e.addEventListener(t,n[0]=s=>o.call(e,n[1],s))}else e.addEventListener(t,n,typeof n!="function"&&n)}function Zo(e,t,n={}){const r=Object.keys(t||{}),o=Object.keys(n);let s,i;for(s=0,i=o.length;s<i;s++){const a=o[s];!a||a==="undefined"||t[a]||(Rn(e,a,!1),delete n[a])}for(s=0,i=r.length;s<i;s++){const a=r[s],c=!!t[a];!a||a==="undefined"||n[a]===c||!c||(Rn(e,a,!0),n[a]=c)}return n}function Qo(e,t,n){if(!t)return n?it(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let o,s;for(s in n)t[s]==null&&r.removeProperty(s),delete n[s];for(s in t)o=t[s],o!==n[s]&&(r.setProperty(s,o),n[s]=o);return n}function Ln(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function pr(e,t={},n,r){const o={};return r||le(()=>o.children=at(e,t.children,o.children)),le(()=>typeof t.ref=="function"&&On(t.ref,e)),le(()=>es(e,t,n,!0,o,!0)),o}function On(e,t,n){return ot(()=>e(t,n))}function Et(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return at(e,t,r,n);le(o=>at(e,t(),o,n),r)}function es(e,t,n,r,o={},s=!1){t||(t={});for(const i in o)if(!(i in t)){if(i==="children")continue;o[i]=Nn(e,i,null,o[i],n,s,t)}for(const i in t){if(i==="children")continue;const a=t[i];o[i]=Nn(e,i,a,o[i],n,s,t)}}function yr(e){let t,n;return!Ae()||!(t=R.registry.get(n=rs()))?e():(R.completed&&R.completed.add(t),R.registry.delete(n),t)}function Ae(e){return!!R.context&&!R.done&&(!e||e.isConnected)}function ts(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Rn(e,t,n){const r=t.trim().split(/\s+/);for(let o=0,s=r.length;o<s;o++)e.classList.toggle(r[o],n)}function Nn(e,t,n,r,o,s,i){let a,c,u,l,d;if(t==="style")return Qo(e,n,r);if(t==="classList")return Zo(e,n,r);if(n===r)return r;if(t==="ref")s||n(e);else if(t.slice(0,3)==="on:"){const f=t.slice(3);r&&e.removeEventListener(f,r,typeof r!="function"&&r),n&&e.addEventListener(f,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const f=t.slice(10);r&&e.removeEventListener(f,r,!0),n&&e.addEventListener(f,n,!0)}else if(t.slice(0,2)==="on"){const f=t.slice(2).toLowerCase(),g=Ko.has(f);if(!g&&r){const b=Array.isArray(r)?r[0]:r;e.removeEventListener(f,b)}(g||n)&&(Xo(e,f,n,g),g&&mr([f]))}else if(t.slice(0,5)==="attr:")it(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")qo(e,t.slice(5),n);else if((d=t.slice(0,5)==="prop:")||(u=jo.has(t))||!o&&((l=Vo(t,e.tagName))||(c=Uo.has(t)))||(a=e.nodeName.includes("-")||"is"in i)){if(d)t=t.slice(5),c=!0;else if(Ae(e))return n;t==="class"||t==="className"?Yo(e,n):a&&!c&&!u?e[ts(t)]=n:e[l||t]=n}else{const f=o&&t.indexOf(":")>-1&&zo[t.split(":")[0]];f?Jo(e,f,t,n):it(e,_o[t]||t,n)}return n}function ns(e){if(R.registry&&R.events&&R.events.find(([c,u])=>u===e))return;let t=e.target;const n=`$$${e.type}`,r=e.target,o=e.currentTarget,s=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),i=()=>{const c=t[n];if(c&&!t.disabled){const u=t[`${n}Data`];if(u!==void 0?c.call(t,u,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&s(t.host),!0},a=()=>{for(;i()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),R.registry&&!R.done&&(R.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();s(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!i());u++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();s(r)}function at(e,t,n,r,o){const s=Ae(e);if(s){!n&&(n=[...e.childNodes]);let c=[];for(let u=0;u<n.length;u++){const l=n[u];l.nodeType===8&&l.data.slice(0,2)==="!$"?l.remove():c.push(l)}n=c}for(;typeof n=="function";)n=n();if(t===n)return n;const i=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,i==="string"||i==="number"){if(s||i==="number"&&(t=t.toString(),t===n))return n;if(a){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=Pe(e,n,r,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||i==="boolean"){if(s)return n;n=Pe(e,n,r)}else{if(i==="function")return le(()=>{let c=t();for(;typeof c=="function";)c=c();n=at(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],u=n&&Array.isArray(n);if(un(c,t,n,o))return le(()=>n=at(e,c,n,r,!0)),()=>n;if(s){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let l=c[0];if(l.parentNode!==e)return n;const d=[l];for(;(l=l.nextSibling)!==r;)d.push(l);return n=d}if(c.length===0){if(n=Pe(e,n,r),a)return n}else u?n.length===0?Bn(e,c,r):Go(e,n,c):(n&&Pe(e),Bn(e,c));n=c}else if(t.nodeType){if(s&&t.parentNode)return n=a?[t]:t;if(Array.isArray(n)){if(a)return n=Pe(e,n,r,t);Pe(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function un(e,t,n,r){let o=!1;for(let s=0,i=t.length;s<i;s++){let a=t[s],c=n&&n[e.length],u;if(!(a==null||a===!0||a===!1))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=un(e,a,c)||o;else if(u==="function")if(r){for(;typeof a=="function";)a=a();o=un(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||o}else e.push(a),o=!0;else{const l=String(a);c&&c.nodeType===3&&c.data===l?e.push(c):e.push(document.createTextNode(l))}}return o}function Bn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Pe(e,t,n,r){if(n===void 0)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let s=!1;for(let i=t.length-1;i>=0;i--){const a=t[i];if(o!==a){const c=a.parentNode===e;!s&&!i?c?e.replaceChild(o,a):e.insertBefore(o,n):c&&a.remove()}else s=!0}}else e.insertBefore(o,n);return[o]}function rs(){return R.getNextContextId()}const os="http://www.w3.org/2000/svg";function br(e,t=!1,n=void 0){return t?document.createElementNS(os,e):document.createElement(e,{is:n})}function Kl(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=In();let s,i=!!R.context;return W(()=>{i&&(In().user=i=!1),s||(s=Fo(o,()=>F(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,u]=$(!1),l=()=>u(!0);fr(d=>Et(a,()=>c()?d():s(),null)),ue(l)}else{const c=br(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),Et(u,s),a.appendChild(c),e.ref&&e.ref(c),ue(()=>a.removeChild(c))}},void 0,{render:!i}),n}function ss(e,t){const n=F(e);return F(()=>{const r=n();switch(typeof r){case"function":return ot(()=>r(t));case"string":const o=gr.has(r),s=R.context?yr():br(r,o,ot(()=>t.is));return pr(s,t,o),s}})}function zl(e){const[,t]=Ut(e,["component"]);return ss(()=>e.component,t)}const Be=Symbol("store-raw"),oe=Symbol("store-node"),q=Symbol("store-has"),wr=Symbol("store-self");function Cr(e){let t=e[V];if(!t&&(Object.defineProperty(e,V,{value:t=new Proxy(e,as)}),!Array.isArray(e))){const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let o=0,s=n.length;o<s;o++){const i=n[o];r[i].get&&Object.defineProperty(e,i,{enumerable:r[i].enumerable,get:r[i].get.bind(t)})}}return t}function ee(e){let t;return e!=null&&typeof e=="object"&&(e[V]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function ie(e,t=new Set){let n,r,o,s;if(n=e!=null&&e[Be])return n;if(!ee(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let i=0,a=e.length;i<a;i++)o=e[i],(r=ie(o,t))!==o&&(e[i]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const i=Object.keys(e),a=Object.getOwnPropertyDescriptors(e);for(let c=0,u=i.length;c<u;c++)s=i[c],!a[s].get&&(o=e[s],(r=ie(o,t))!==o&&(e[s]=r))}return e}function Ue(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Ce(e,t,n){if(e[t])return e[t];const[r,o]=$(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function is(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===V||t===oe||(delete n.value,delete n.writable,n.get=()=>e[V][t]),n}function En(e){st()&&Ce(Ue(e,oe),wr)()}function Sr(e){return En(e),Reflect.ownKeys(e)}const as={get(e,t,n){if(t===Be)return e;if(t===V)return n;if(t===Ot)return En(e),n;const r=Ue(e,oe),o=r[t];let s=o?o():e[t];if(t===oe||t===q||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);st()&&(typeof s!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(s=Ce(r,t,s)())}return ee(s)?Cr(s):s},has(e,t){return t===Be||t===V||t===Ot||t===oe||t===q||t==="__proto__"?!0:(st()&&Ce(Ue(e,q),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Sr,getOwnPropertyDescriptor:is};function B(e,t,n,r=!1){if(!r&&e[t]===n)return;const o=e[t],s=e.length;n===void 0?(delete e[t],e[q]&&e[q][t]&&o!==void 0&&e[q][t].$()):(e[t]=n,e[q]&&e[q][t]&&o===void 0&&e[q][t].$());let i=Ue(e,oe),a;if((a=Ce(i,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==s){for(let c=e.length;c<s;c++)(a=i[c])&&a.$();(a=Ce(i,"length",s))&&a.$(e.length)}(a=i[wr])&&a.$()}function xr(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];B(e,o,t[o])}}function cs(e,t){if(typeof t=="function"&&(t=t(e)),t=ie(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){const o=t[n];e[n]!==o&&B(e,n,o)}B(e,"length",r)}else xr(e,t)}function Ze(e,t,n=[]){let r,o=e;if(t.length>1){r=t.shift();const i=typeof r,a=Array.isArray(e);if(Array.isArray(r)){for(let c=0;c<r.length;c++)Ze(e,[r[c]].concat(t),n);return}else if(a&&i==="function"){for(let c=0;c<e.length;c++)r(e[c],c)&&Ze(e,[c].concat(t),n);return}else if(a&&i==="object"){const{from:c=0,to:u=e.length-1,by:l=1}=r;for(let d=c;d<=u;d+=l)Ze(e,[d].concat(t),n);return}else if(t.length>1){Ze(e[r],t,[r].concat(n));return}o=e[r],n=[r].concat(n)}let s=t[0];typeof s=="function"&&(s=s(o,n),s===o)||r===void 0&&s==null||(s=ie(s),r===void 0||ee(o)&&ee(s)&&!Array.isArray(s)?xr(o,s):B(e,r,s))}function Hl(...[e,t]){const n=ie(e||{}),r=Array.isArray(n),o=Cr(n);function s(...i){we(()=>{r&&i.length===1?cs(n,i[0]):Ze(n,i)})}return[o,s]}function ls(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===V||t===oe||(delete n.value,delete n.writable,n.get=()=>e[V][t],n.set=r=>e[V][t]=r),n}const us={get(e,t,n){if(t===Be)return e;if(t===V)return n;if(t===Ot)return En(e),n;const r=Ue(e,oe),o=r[t];let s=o?o():e[t];if(t===oe||t===q||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t),a=typeof s=="function";if(st()&&(!a||e.hasOwnProperty(t))&&!(i&&i.get))s=Ce(r,t,s)();else if(s!=null&&a&&s===Array.prototype[t])return(...c)=>we(()=>Array.prototype[t].apply(n,c))}return ee(s)?vr(s):s},has(e,t){return t===Be||t===V||t===Ot||t===oe||t===q||t==="__proto__"?!0:(st()&&Ce(Ue(e,q),t)(),t in e)},set(e,t,n){return we(()=>B(e,t,ie(n))),!0},deleteProperty(e,t){return we(()=>B(e,t,void 0,!0)),!0},ownKeys:Sr,getOwnPropertyDescriptor:ls};function vr(e){let t=e[V];if(!t){Object.defineProperty(e,V,{value:t=new Proxy(e,us)});const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),o=Object.getPrototypeOf(e),s=o!==null&&e!==null&&typeof e=="object"&&!Array.isArray(e)&&o!==Object.prototype;if(s){let i=o;for(;i!=null;){const a=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(a)),Object.assign(r,a),i=Object.getPrototypeOf(i)}}for(let i=0,a=n.length;i<a;i++){const c=n[i];if(!(s&&c==="constructor")){if(r[c].get){const u=r[c].get.bind(t);Object.defineProperty(e,c,{get:u,configurable:!0})}if(r[c].set){const u=r[c].set;Object.defineProperty(e,c,{set:d=>we(()=>u.call(t,d)),configurable:!0})}}}}return t}function ds(e,t){const n=ie(e||{});return vr(n)}const dn=Symbol("store-root");function Te(e,t,n,r,o){const s=t[n];if(e===s)return;const i=Array.isArray(e);if(n!==dn&&(!ee(e)||!ee(s)||i!==Array.isArray(s)||o&&e[o]!==s[o])){B(t,n,e);return}if(i){if(e.length&&s.length&&(!r||o&&e[0]&&e[0][o]!=null)){let u,l,d,f,g,b,C,S;for(d=0,f=Math.min(s.length,e.length);d<f&&(s[d]===e[d]||o&&s[d]&&e[d]&&s[d][o]&&s[d][o]===e[d][o]);d++)Te(e[d],s,d,r,o);const I=new Array(e.length),y=new Map;for(f=s.length-1,g=e.length-1;f>=d&&g>=d&&(s[f]===e[g]||o&&s[f]&&e[g]&&s[f][o]&&s[f][o]===e[g][o]);f--,g--)I[g]=s[f];if(d>g||d>f){for(l=d;l<=g;l++)B(s,l,e[l]);for(;l<e.length;l++)B(s,l,I[l]),Te(e[l],s,l,r,o);s.length>e.length&&B(s,"length",e.length);return}for(C=new Array(g+1),l=g;l>=d;l--)b=e[l],S=o&&b?b[o]:b,u=y.get(S),C[l]=u===void 0?-1:u,y.set(S,l);for(u=d;u<=f;u++)b=s[u],S=o&&b?b[o]:b,l=y.get(S),l!==void 0&&l!==-1&&(I[l]=s[u],l=C[l],y.set(S,l));for(l=d;l<e.length;l++)l in I?(B(s,l,I[l]),Te(e[l],s,l,r,o)):B(s,l,e[l])}else for(let u=0,l=e.length;u<l;u++)Te(e[u],s,u,r,o);s.length>e.length&&B(s,"length",e.length);return}const a=Object.keys(e);for(let u=0,l=a.length;u<l;u++)Te(e[a[u]],s,a[u],r,o);const c=Object.keys(s);for(let u=0,l=c.length;u<l;u++)e[c[u]]===void 0&&B(s,c[u],void 0)}function Gl(e,t={}){const{merge:n,key:r="id"}=t,o=ie(e);return s=>{if(!ee(s)||!ee(o))return o;const i=Te(o,{[dn]:s},dn,n,r);return i===void 0?s:i}}const Pt=new WeakMap,Ar={get(e,t){if(t===Be)return e;const n=e[t];let r;return ee(n)?Pt.get(n)||(Pt.set(n,r=new Proxy(n,Ar)),r):n},set(e,t,n){return B(e,t,ie(n)),!0},deleteProperty(e,t){return B(e,t,void 0,!0),!0}};function Jl(e){return t=>{if(ee(t)){let n;(n=Pt.get(t))||Pt.set(t,n=new Proxy(t,Ar)),e(n)}return t}}const fs="codenomad.client-id",hs="codenomad.connection-id";let yt=null,bt=null;function Or(){return{clientId:gs(),connectionId:ms()}}function gs(){return yt||(yt=Er(fs,window.localStorage),yt)}function ms(){var t;const e=(t=window.__CODENOMAD_WINDOW_ID__)==null?void 0:t.trim();return e||bt||(bt=Er(hs,window.sessionStorage),bt)}function Er(e,t){if(typeof window>"u")return Xt();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Xt()}const n=Xt();try{t.setItem(e,n)}catch{}return n}function Xt(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var fn={exports:{}},Zt,Un;function ps(){if(Un)return Zt;Un=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;Zt=function(l,d){d=d||{};var f=typeof l;if(f==="string"&&l.length>0)return i(l);if(f==="number"&&isFinite(l))return d.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function i(l){if(l=String(l),!(l.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(d){var f=parseFloat(d[1]),g=(d[2]||"ms").toLowerCase();switch(g){case"years":case"year":case"yrs":case"yr":case"y":return f*s;case"weeks":case"week":case"w":return f*o;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(l){var d=Math.abs(l);return d>=r?Math.round(l/r)+"d":d>=n?Math.round(l/n)+"h":d>=t?Math.round(l/t)+"m":d>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var d=Math.abs(l);return d>=r?u(l,d,r,"day"):d>=n?u(l,d,n,"hour"):d>=t?u(l,d,t,"minute"):d>=e?u(l,d,e,"second"):l+" ms"}function u(l,d,f,g){var b=d>=f*1.5;return Math.round(l/f)+" "+g+(b?"s":"")}return Zt}function ys(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=ps(),n.destroy=u,Object.keys(e).forEach(l=>{n[l]=e[l]}),n.names=[],n.skips=[],n.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(l){let d,f=null,g,b;function C(...S){if(!C.enabled)return;const I=C,y=Number(new Date),P=y-(d||y);I.diff=P,I.prev=d,I.curr=y,d=y,S[0]=n.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let N=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(K,m)=>{if(K==="%%")return"%";N++;const w=n.formatters[m];if(typeof w=="function"){const E=S[N];K=w.call(I,E),S.splice(N,1),N--}return K}),n.formatArgs.call(I,S),(I.log||n.log).apply(I,S)}return C.namespace=l,C.useColors=n.useColors(),C.color=n.selectColor(l),C.extend=r,C.destroy=n.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(g!==n.namespaces&&(g=n.namespaces,b=n.enabled(l)),b),set:S=>{f=S}}),typeof n.init=="function"&&n.init(C),C}function r(l,d){const f=n(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const d=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const f of d)f[0]==="-"?n.skips.push(f.slice(1)):n.names.push(f)}function s(l,d){let f=0,g=0,b=-1,C=0;for(;f<l.length;)if(g<d.length&&(d[g]===l[f]||d[g]==="*"))d[g]==="*"?(b=g,C=f,g++):(f++,g++);else if(b!==-1)g=b+1,C++,f=C;else return!1;for(;g<d.length&&d[g]==="*";)g++;return g===d.length}function i(){const l=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),l}function a(l){for(const d of n.skips)if(s(l,d))return!1;for(const d of n.names)if(s(l,d))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var bs=ys;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let u;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(u=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(u[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;u.splice(1,0,l,"color: inherit");let d=0,f=0;u[0].replace(/%[a-zA-Z%]/g,g=>{g!=="%%"&&(d++,g==="%c"&&(f=d))}),u.splice(f,0,l)}t.log=console.debug||console.log||(()=>{});function s(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function i(){let u;try{u=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=n.DEBUG),u}function a(){try{return localStorage}catch{}}e.exports=bs(t);const{formatters:c}=e.exports;c.j=function(u){try{return JSON.stringify(u)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(fn,fn.exports);var ws=fn.exports;const hn=No(ws),ze=["sse","api","session","actions","foreground-refresh"],Pr="opencode:logger:namespaces",Qt=new Map,te=new Set,re=typeof globalThis<"u"?globalThis.console:void 0;function lt(){te.size===0?hn.disable():hn.enable(Array.from(te).join(","))}function _t(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Pr,JSON.stringify(Array.from(te)))}catch(t){(e=re==null?void 0:re.warn)==null||e.call(re,"Failed to persist logger namespaces",t)}}function Cs(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Pr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)ze.includes(r)&&te.add(r)}catch(t){(e=re==null?void 0:re.warn)==null||e.call(re,"Failed to hydrate logger namespaces",t)}}Cs();lt();function Ss(e){const n=hn(e),r=(o,s)=>{n(o,...s)};return{log:(...o)=>n(...o),info:(...o)=>n(...o),warn:(...o)=>r("[warn]",o),error:(...o)=>r("[error]",o)}}function Oe(e){if(!ze.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return Qt.has(e)||Qt.set(e,Ss(e)),Qt.get(e)}function xs(){return ze.map(e=>({name:e,enabled:te.has(e)}))}function vs(e){if(!ze.includes(e))throw new Error(`Unknown logger namespace: ${e}`);te.has(e)||(te.add(e),_t(),lt())}function As(e){if(!ze.includes(e))throw new Error(`Unknown logger namespace: ${e}`);te.has(e)&&(te.delete(e),_t(),lt())}function Os(){te.clear(),_t(),lt()}function Es(){ze.forEach(e=>te.add(e)),_t(),lt()}const Ps={listLoggerNamespaces:xs,enableLogger:vs,disableLogger:As,enableAllLoggers:Es,disableAllLoggers:Os};function Ms(){typeof window>"u"||(window.codenomadLogger=Ps)}Ms();function $s(e,t){let n=!1;e.onmessage=o=>{try{const s=JSON.parse(o.data);t.onEvent(s)}catch(s){t.logger.error("Failed to parse event",s)}};const r=o=>{var s;n||(n=!0,t.logger.warn(o),(s=t.onError)==null||s.call(t))};e.onerror=()=>{r("EventSource error, closing stream")},e.onclose=()=>{r("EventSource closed")},e.addEventListener("close",()=>{r("EventSource closed")}),e.addEventListener("codenomad.client.ping",o=>{var s;try{const i=o.data?JSON.parse(o.data):{};(s=t.onPing)==null||s.call(t,i)}catch(i){t.logger.error("Failed to parse ping event",i)}})}const en={};var dr;const Ts=typeof window<"u"?(dr=window.location)==null?void 0:dr.origin:void 0,ks=typeof window<"u"?window.__CODENOMAD_API_BASE__??Ts:void 0,Fs=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",je=(en==null?void 0:en.VITE_CODENOMAD_API_BASE)??ks,tn=Is(je,Fs),ql=je;function Is(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(e){const n=t.startsWith("/")?t:`/${t}`;return`${e}${n}`}return t}const jn=Oe("api"),_n=Oe("sse");function Mr(e){const t={};if(!e)return t;if(e instanceof Headers)return e.forEach((n,r)=>{t[r]=n}),t;if(Array.isArray(e)){for(const[n,r]of e)t[n]=r;return t}return{...e}}function be(e,t){if(t){jn.info(e,t);return}jn.info(e)}async function $r(e){const t=await e.text();if(!t)return`Request failed with ${e.status}`;try{const n=JSON.parse(t);if(typeof(n==null?void 0:n.error)=="string"&&n.error.trim())return n.error;if(typeof(n==null?void 0:n.message)=="string"&&n.message.trim())return n.message}catch{}return t}async function p(e,t){const n=je?new URL(e,je).toString():e,r=Mr(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();be(`${o} ${e}`);try{const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const c=await $r(i);throw be(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:c}),new Error(c||`Request failed with ${i.status}`)}const a=Date.now()-s;return be(`${o} ${e} -> ${i.status}`,{durationMs:a}),i.status===204?void 0:await i.json()}catch(i){throw be(`${o} ${e} failed`,{durationMs:Date.now()-s,error:i}),i}}async function Ds(e,t){const n=je?new URL(e,je).toString():e,r=Mr(t==null?void 0:t.headers);(t==null?void 0:t.body)!==void 0&&!r["Content-Type"]&&(r["Content-Type"]="application/json");const o=((t==null?void 0:t.method)??"GET").toUpperCase(),s=Date.now();be(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await $r(i);throw be(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return be(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const ne={pruneSessionMessage(e,t){return p(`/api/workspaces/${encodeURIComponent(e)}/session-pruning/prune`,{method:"POST",body:JSON.stringify(t)})},fetchWorkspaces(){return p("/api/workspaces")},fetchProviderUsage(e,t){const n=new URLSearchParams;t&&n.set("modelId",t);const r=n.toString();return p(`/api/usage/${encodeURIComponent(e)}${r?`?${r}`:""}`)},fetchWorktrees(e){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees`)},createWorktree(e,t){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees`,{method:"POST",body:JSON.stringify(t)})},deleteWorktree(e,t,n){const r=new URLSearchParams;n!=null&&n.force&&r.set("force","true");const o=r.toString()?`?${r.toString()}`:"";return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}${o}`,{method:"DELETE"})},createWorkspace(e,t){return p("/api/workspaces",{method:"POST",body:JSON.stringify(e),signal:t==null?void 0:t.signal})},cancelWorkspaceCreation(e){return p("/api/workspaces/creation/cancel",{method:"POST",body:JSON.stringify({requestId:e})})},releaseWorkspaceCreation(e,t){return p(`/api/workspaces/${encodeURIComponent(e)}/creation/release`,{method:"POST",body:JSON.stringify({requestId:t})})},fetchSidecars(){return p("/api/sidecars")},createSidecar(e){return p("/api/sidecars",{method:"POST",body:JSON.stringify(e)})},updateSidecar(e,t){return p(`/api/sidecars/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteSidecar(e){return p(`/api/sidecars/${encodeURIComponent(e)}`,{method:"DELETE"})},createPreview(e){return p("/api/previews",{method:"POST",body:JSON.stringify(e)})},deletePreview(e){return p(`/api/previews/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchServerMeta(){return p("/api/meta")},probeRemoteServer(e){return p("/api/remote-servers/probe",{method:"POST",body:JSON.stringify(e)})},createRemoteProxySession(e){return p("/api/remote-proxy/sessions",{method:"POST",body:JSON.stringify(e)})},deleteRemoteProxySession(e){return p(`/api/remote-proxy/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchAuthStatus(){return p("/api/auth/status")},listConfigFiles(){return p("/api/config-files")},readConfigFile(e){return p(`/api/config-files/${encodeURIComponent(e)}/content`)},writeConfigFile(e,t){const n={contents:t};return p(`/api/config-files/${encodeURIComponent(e)}/content`,{method:"PUT",body:JSON.stringify(n)})},setServerPassword(e){return p("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return p(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},cloneWorkspaceRepository(e){return p("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})},listWorkspaceFiles(e,t="."){const n=new URLSearchParams({path:t});return p(`/api/workspaces/${encodeURIComponent(e)}/files?${n.toString()}`)},searchWorkspaceFiles(e,t,n){const r=t.trim();if(!r)return Promise.resolve([]);const o=new URLSearchParams({q:r});return n!=null&&n.limit&&o.set("limit",String(n.limit)),n!=null&&n.type&&o.set("type",n.type),p(`/api/workspaces/${encodeURIComponent(e)}/files/search?${o.toString()}`)},readWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return n!=null&&n.encoding&&r.set("encoding",n.encoding),p(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`)},writeWorkspaceFile(e,t,n,r){const o=new URLSearchParams({path:t});return r!=null&&r.worktree&&r.worktree!=="root"&&o.set("worktree",r.worktree),p(`/api/workspaces/${encodeURIComponent(e)}/files/content?${o.toString()}`,{method:"PUT",body:JSON.stringify({contents:n})})},fetchWorktreeGitStatus(e,t){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-status`)},fetchWorktreeGitDiff(e,t,n){const r=new URLSearchParams({path:n.path,scope:n.scope});return n.originalPath&&r.set("originalPath",n.originalPath),p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-diff?${r.toString()}`)},stageWorktreeGitPaths(e,t,n){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-stage`,{method:"POST",body:JSON.stringify(n)})},unstageWorktreeGitPaths(e,t,n){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-unstage`,{method:"POST",body:JSON.stringify(n)})},commitWorktreeGitChanges(e,t,n){return p(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-commit`,{method:"POST",body:JSON.stringify(n)})},fetchConfigOwner(e){return p(`/api/storage/config/${encodeURIComponent(e)}`)},patchConfigOwner(e,t){return p(`/api/storage/config/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},fetchStateOwner(e){return p(`/api/storage/state/${encodeURIComponent(e)}`)},patchStateOwner(e,t){return p(`/api/storage/state/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},validateBinary(e){return p("/api/storage/binaries/validate",{method:"POST",body:JSON.stringify({path:e})})},fetchOpenCodeUpdateStatus(){return p("/api/opencode/update")},updateOpenCode(){return p("/api/opencode/update",{method:"POST"})},fetchSpeechCapabilities(){return p("/api/speech/capabilities")},transcribeAudio(e){return p("/api/speech/transcribe",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeech(e){return p("/api/speech/synthesize",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeechStream(e,t){return Ds("/api/speech/synthesize/stream",{method:"POST",body:JSON.stringify(e),signal:t})},listFileSystem(e,t){const n=new URLSearchParams;e&&e!=="."&&n.set("path",e),(t==null?void 0:t.includeFiles)!==void 0&&n.set("includeFiles",String(t.includeFiles));const r=n.toString();return p(r?`/api/filesystem?${r}`:"/api/filesystem")},createFileSystemFolder(e,t){return p("/api/filesystem/folders",{method:"POST",body:JSON.stringify({parentPath:e,name:t})})},readFileSystemFile(e,t){const n=new URLSearchParams({path:e});return t!=null&&t.encoding&&n.set("encoding",t.encoding),p(`/api/filesystem/files/content?${n.toString()}`)},readInstanceData(e){return p(`/api/storage/instances/${encodeURIComponent(e)}`)},writeInstanceData(e,t){return p(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteInstanceData(e){return p(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"DELETE"})},getYoloState(e,t){return p(`/workspaces/${encodeURIComponent(e)}/yolo/sessions/${encodeURIComponent(t)}`)},toggleYolo(e,t){return p(`/workspaces/${encodeURIComponent(e)}/yolo/sessions/${encodeURIComponent(t)}/toggle`,{method:"POST"})},sendClientConnectionPong(e,t){const n={method:"POST",body:JSON.stringify(e)};return t&&(n.signal=t),p("/api/client-connections/pong",n)},connectEvents(e,t,n){const r=Or(),o=Ls(r);_n.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return $s(s,{onEvent:e,onError:t,onPing:n,logger:_n}),s}};function Ls(e){const t=new URL(tn,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),tn.startsWith("http://")||tn.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}async function Rs(e){const t=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"disconnected"),(o=e.onError)==null||o.call(e)},n=ne.connectEvents(r=>{e.onBatch([r])},t,e.onPing);return n.onopen=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"connected"),(o=e.onOpen)==null||o.call(e)},{disconnect(){n.close()}}}async function Ns(e,t={}){const{maxAttempts:n=3,initialDelayMs:r=100,maxDelayMs:o=5e3,backoffMultiplier:s=2,timeoutMs:i,shouldRetry:a=()=>!0,wait:c=d=>new Promise(f=>setTimeout(f,d))}=t;let u=null,l=r;for(let d=1;d<=n;d++)try{if(i){const f=new AbortController,g=setTimeout(()=>f.abort(),i);try{const b=await e(f.signal);return clearTimeout(g),b}catch(b){throw clearTimeout(g),b}}return await e()}catch(f){const g=f instanceof Error?f:new Error(String(f));if(u=g,d<n&&a(g,d))await c(l),l=Math.min(l*s,o);else throw g}throw u||new Error("Failed after retries")}function Bs(e){return!!(e.name==="AbortError"||e.name==="TimeoutError"||e.message.includes("Failed to fetch")||e.message.includes("NetworkError")||e.message.includes("timeout"))}const nn=1e3,Us=1e4,gn=Oe("sse");function Me(e,t){if(t){gn.info(e,t);return}gn.info(e)}class js{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.statusHandlers=new Set,this.connection=null,this.connectGeneration=0,this.retryDelay=nn,this.retryTimer=null,this.connect()}async connect(){const t=++this.connectGeneration;this.clearReconnectTimer(),this.connection&&(this.emitTransportStatus("disconnected"),this.connection.disconnect(),this.connection=null),Me("Connecting to backend events stream");try{const n=await Rs({onBatch:r=>{t===this.connectGeneration&&this.dispatchBatch(r)},onError:()=>{t===this.connectGeneration&&this.scheduleReconnect()},onStatus:r=>{t===this.connectGeneration&&this.emitTransportStatus(r)},onOpen:()=>{t===this.connectGeneration&&(Me("Events stream connected"),this.retryDelay=nn,this.openHandlers.forEach(r=>r()))},onPing:r=>{if(t!==this.connectGeneration)return;const s={...Or(),pingTs:r.ts};Ns(i=>ne.sendClientConnectionPong(s,i),{maxAttempts:3,initialDelayMs:100,maxDelayMs:2e3,timeoutMs:1e4,shouldRetry:i=>Bs(i)}).catch(i=>{gn.warn("Failed to send client connection pong after retries",i)})}});if(t!==this.connectGeneration){n.disconnect();return}this.connection=n}catch(n){if(t!==this.connectGeneration)return;Me("Events stream failed to connect, scheduling reconnect",{error:n instanceof Error?n.message:String(n)}),this.scheduleReconnect()}}scheduleReconnect(){this.retryTimer||(this.connectGeneration+=1,this.connection&&(this.connection.disconnect(),this.connection=null),this.emitTransportStatus("disconnected"),Me("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.retryDelay=Math.min(this.retryDelay*2,Us),this.connect()},this.retryDelay))}clearReconnectTimer(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}dispatch(t){var n,r;(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(t))}dispatchBatch(t){t.length!==0&&(Me("event batch",{size:t.length}),we(()=>{for(const n of t)this.dispatch(n)}))}emitTransportStatus(t){this.statusHandlers.forEach(n=>n(t))}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set);const r=this.handlers.get(t);return r.add(n),()=>r.delete(n)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}onTransportStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}restart(t="manual restart"){this.retryDelay=nn,this.clearReconnectTimer(),this.connection&&(this.emitTransportStatus("disconnected"),this.connection.disconnect(),this.connection=null),Me("Restarting backend events stream",{reason:t}),this.connect()}}const rn=new js,_s=Oe("actions"),Wn={messageHistory:[],agentModelSelections:{}};function Vn(e,t){if(e===t)return!0;if(typeof e=="object"&&e!==null&&typeof t=="object"&&t!==null)try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){_s.warn("Failed to compare config objects",n)}return!1}class Ws{constructor(){this.configOwnerCache=new Map,this.stateOwnerCache=new Map,this.configOwnerLoadPromises=new Map,this.stateOwnerLoadPromises=new Map,this.configOwnerListeners=new Map,this.stateOwnerListeners=new Map,this.instanceDataCache=new Map,this.instanceDataListeners=new Map,this.instanceLoadPromises=new Map,this.pendingWrites=new Set,rn.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),rn.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),rn.on("instance.dataChanged",t=>{t.type==="instance.dataChanged"&&this.setInstanceDataCache(t.instanceId,t.data)})}async loadConfigOwner(t){const n=this.configOwnerCache.get(t);if(n)return n;if(!this.configOwnerLoadPromises.has(t)){const r=ne.fetchConfigOwner(t).then(o=>(this.setOwnerCache("config",t,o),o)).finally(()=>{this.configOwnerLoadPromises.delete(t)});this.configOwnerLoadPromises.set(t,r)}return this.configOwnerLoadPromises.get(t)}patchConfigOwner(t,n){return this.trackWrite(ne.patchConfigOwner(t,n).then(r=>(this.setOwnerCache("config",t,r),r)))}async loadStateOwner(t){const n=this.stateOwnerCache.get(t);if(n)return n;if(!this.stateOwnerLoadPromises.has(t)){const r=ne.fetchStateOwner(t).then(o=>(this.setOwnerCache("state",t,o),o)).finally(()=>{this.stateOwnerLoadPromises.delete(t)});this.stateOwnerLoadPromises.set(t,r)}return this.stateOwnerLoadPromises.get(t)}patchStateOwner(t,n){return this.trackWrite(ne.patchStateOwner(t,n).then(r=>(this.setOwnerCache("state",t,r),r)))}async loadInstanceData(t){const n=this.instanceDataCache.get(t);if(n)return n;if(!this.instanceLoadPromises.has(t)){const r=ne.readInstanceData(t).then(o=>{const s=this.normalizeInstanceData(o);return this.setInstanceDataCache(t,s),s}).finally(()=>{this.instanceLoadPromises.delete(t)});this.instanceLoadPromises.set(t,r)}return this.instanceLoadPromises.get(t)}saveInstanceData(t,n){const r=this.normalizeInstanceData(n);return this.trackWrite(ne.writeInstanceData(t,r).then(()=>{this.setInstanceDataCache(t,r)}))}deleteInstanceData(t){return this.trackWrite(ne.deleteInstanceData(t).then(()=>{this.setInstanceDataCache(t,Wn)}))}async flushWrites(){for(;this.pendingWrites.size>0;)await Promise.allSettled(this.pendingWrites)}onConfigOwnerChanged(t,n){this.configOwnerListeners.has(t)||this.configOwnerListeners.set(t,new Set);const r=this.configOwnerListeners.get(t);r.add(n);const o=this.configOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.configOwnerListeners.delete(t)}}onStateOwnerChanged(t,n){this.stateOwnerListeners.has(t)||this.stateOwnerListeners.set(t,new Set);const r=this.stateOwnerListeners.get(t);r.add(n);const o=this.stateOwnerCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.stateOwnerListeners.delete(t)}}onInstanceDataChanged(t,n){this.instanceDataListeners.has(t)||this.instanceDataListeners.set(t,new Set);const r=this.instanceDataListeners.get(t);r.add(n);const o=this.instanceDataCache.get(t);return o&&n(o),()=>{r.delete(n),r.size===0&&this.instanceDataListeners.delete(t)}}setOwnerCache(t,n,r){if(n==="*"){t==="config"?this.configOwnerCache.clear():this.stateOwnerCache.clear();return}const o=t==="config"?this.configOwnerCache:this.stateOwnerCache,s=t==="config"?this.configOwnerListeners:this.stateOwnerListeners,i=o.get(n);if(i&&Vn(i,r)){o.set(n,r);return}o.set(n,r);const a=s.get(n);if(a)for(const c of a)c(r)}trackWrite(t){return this.pendingWrites.add(t),t.finally(()=>this.pendingWrites.delete(t)).catch(()=>{}),t}normalizeInstanceData(t){const n=t??Wn,r=Array.isArray(n.messageHistory)?[...n.messageHistory]:[],o={...n.agentModelSelections??{}};return{...n,messageHistory:r,agentModelSelections:o}}setInstanceDataCache(t,n){const r=this.normalizeInstanceData(n),o=this.instanceDataCache.get(t);if(o&&Vn(o,r)){this.instanceDataCache.set(t,r);return}this.instanceDataCache.set(t,r),this.notifyInstanceDataChanged(t,r)}notifyInstanceDataChanged(t,n){const r=this.instanceDataListeners.get(t);if(r)for(const o of r)o(n)}}const Q=new Ws,Tr=Oe("api"),Wt={messageHistory:[],agentModelSelections:{}},[Pn,kr]=$(new Map),wt=new Map,_e=new Map;function Fr(e){const t=e??Wt;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function Kn(e){if(_e.has(e))return;const t=Q.onInstanceDataChanged(e,n=>{Mt(e,n)});_e.set(e,t)}function Vs(e){const t=_e.get(e);t&&(t(),_e.delete(e))}function Mt(e,t){kr(n=>{const r=new Map(n);return r.set(e,Fr(t)),r})}async function Vt(e){if(!e||Pn().has(e))return;if(wt.has(e)){await wt.get(e);return}const t=Q.loadInstanceData(e).then(n=>{Mt(e,n),Kn(e)}).catch(n=>{Tr.warn("Failed to load instance data",n),Mt(e,Wt),Kn(e)}).finally(()=>{wt.delete(e)});wt.set(e,t),await t}async function Ir(e,t){if(!e)return;await Vt(e);const n=Pn().get(e)??Wt,r=Fr(n);t(r);try{await Q.saveInstanceData(e,r)}catch(o){Tr.warn("Failed to persist instance data",o)}Mt(e,r)}function Dr(e){return Pn().get(e)??Wt}function Ks(e){kr(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),Vs(e)}const zs=Ke(),Hs={getInstanceConfig:Dr,ensureInstanceConfig:Vt,updateInstanceConfig:Ir,clearInstanceConfig:Ks},Yl=e=>(ue(()=>{for(const t of _e.values())t();_e.clear()}),de(zs.Provider,{value:Hs,get children(){return e.children}})),Gs=Oe("api");function Js(e){const t=e;return t.sttConfigured===void 0&&(t.sttConfigured=t.configured),t.ttsConfigured===void 0&&(t.ttsConfigured=t.configured),t.separateProviders===void 0&&(t.separateProviders=!1),t}const[zn,mn]=$(null),[Xl,Hn]=$(!1),[Zl,At]=$(null),[Ql,Lr]=$(!1);let Je=null;async function qs(e=!1){return!e&&zn()?zn():Je||(Hn(!0),At(null),Je=ne.fetchSpeechCapabilities().then(t=>{Lr("separateProviders"in t);const r=Js(t);return mn(r),At(null),r}).catch(t=>(Gs.error("Failed to load speech capabilities",t),mn(null),At(t instanceof Error?t.message:String(t)),null)).finally(()=>{Hn(!1),Je=null}),Je)}function Ys(){mn(null),At(null),Lr(!1)}function Xs(e){var n,r,o,s,i,a;const t={};e.separateProviders!==void 0&&(t.separateProviders=e.separateProviders),e.apiKey!==void 0&&(t.apiKey=e.apiKey),e.baseUrl!==void 0&&(t.baseUrl=((n=e.baseUrl)==null?void 0:n.trim())||null),e.sttModel!==void 0&&(t.sttModel=((r=e.sttModel)==null?void 0:r.trim())||null),e.ttsModel!==void 0&&(t.ttsModel=((o=e.ttsModel)==null?void 0:o.trim())||null),e.ttsVoice!==void 0&&(t.ttsVoice=((s=e.ttsVoice)==null?void 0:s.trim())||null),e.playbackMode!==void 0&&(t.playbackMode=e.playbackMode),e.ttsFormat!==void 0&&(t.ttsFormat=e.ttsFormat);for(const c of["stt","tts"]){const u=e[c];if(u){const l={};u.apiKey!==void 0&&(l.apiKey=u.apiKey),u.baseUrl!==void 0&&(l.baseUrl=((i=u.baseUrl)==null?void 0:i.trim())||null),u.model!==void 0&&(l.model=((a=u.model)==null?void 0:a.trim())||null),Object.keys(l).length>0&&(t[c]=l)}}return t}const Zs=["system","light","classic","basalt","fjord","lichen","velvet","ember","custom"],Rr=["surfaceBase","surfaceSecondary","surfaceMuted","borderBase","textPrimary","textMuted","accentPrimary","statusSuccess","statusWarning","statusError","userAccent","agentAccent","compactionAccent","yoloAccent"],Qs=Rr.slice(0,10),ke={userAccent:"#42A5F5",agentAccent:"#D97706",compactionAccent:"#C084FC",yoloAccent:"#8FA8FF"},$t={surfaceBase:"#17181A",surfaceSecondary:"#202226",surfaceMuted:"#292C31",borderBase:"#3B3F46",textPrimary:"#F0F1F3",textMuted:"#B2B6BE",accentPrimary:"#8FA8FF",statusSuccess:"#72C497",statusWarning:"#D8B36A",statusError:"#E28181",...ke},eu={surfaceBase:"#FFFFFF",surfaceSecondary:"#F5F5F5",surfaceMuted:"#ECEFF3",borderBase:"#D1D5DB",textPrimary:"#111827",textMuted:"#4B5563",accentPrimary:"#005FCC",statusSuccess:"#237A43",statusWarning:"#9A6700",statusError:"#C62828",userAccent:"#0066CC",agentAccent:"#A44B00",compactionAccent:"#7E22CE",yoloAccent:"#005FCC"},ei=[{id:"system",labelKey:"settings.appearance.colorScheme.option.system",descriptionKey:"settings.appearance.colorScheme.description.system",appearance:"system",editable:!1},{id:"light",labelKey:"settings.appearance.colorScheme.option.light",descriptionKey:"settings.appearance.colorScheme.description.light",appearance:"light",editable:!1},{id:"classic",labelKey:"settings.appearance.colorScheme.option.codeNomadClassic",descriptionKey:"settings.appearance.colorScheme.description.codeNomadClassic",appearance:"dark",editable:!1,colors:{surfaceBase:"#1A1A1A",surfaceSecondary:"#2A2A2A",surfaceMuted:"#212529",borderBase:"#3A3A3A",textPrimary:"#CFD4DC",textMuted:"#999999",accentPrimary:"#0080FF",statusSuccess:"#4CAF50",statusWarning:"#FF9800",statusError:"#F44336",userAccent:"#2196F3",agentAccent:"#D97706",compactionAccent:"#C084FC",yoloAccent:"#0080FF"}},{id:"basalt",labelKey:"settings.appearance.colorScheme.option.basalt",descriptionKey:"settings.appearance.colorScheme.description.basalt",appearance:"dark",editable:!1,colors:$t},{id:"fjord",labelKey:"settings.appearance.colorScheme.option.fjord",descriptionKey:"settings.appearance.colorScheme.description.fjord",appearance:"dark",editable:!1,colors:{surfaceBase:"#131A1F",surfaceSecondary:"#1B252C",surfaceMuted:"#243139",borderBase:"#354650",textPrimary:"#E7EEF1",textMuted:"#A8B8BF",accentPrimary:"#67C9BA",statusSuccess:"#72C497",statusWarning:"#D8B36A",statusError:"#E28181",...ke,yoloAccent:"#67C9BA"}},{id:"lichen",labelKey:"settings.appearance.colorScheme.option.lichen",descriptionKey:"settings.appearance.colorScheme.description.lichen",appearance:"dark",editable:!1,colors:{surfaceBase:"#181A15",surfaceSecondary:"#22251D",surfaceMuted:"#2C3025",borderBase:"#41473A",textPrimary:"#ECEEE8",textMuted:"#B2B8A7",accentPrimary:"#A9C47F",statusSuccess:"#77C49A",statusWarning:"#D6B36D",statusError:"#DF8580",...ke,yoloAccent:"#A9C47F"}},{id:"velvet",labelKey:"settings.appearance.colorScheme.option.velvet",descriptionKey:"settings.appearance.colorScheme.description.velvet",appearance:"dark",editable:!1,colors:{surfaceBase:"#160F16",surfaceSecondary:"#211721",surfaceMuted:"#2B1E2B",borderBase:"#443044",textPrimary:"#F1EAF0",textMuted:"#BAAAB7",accentPrimary:"#E5A77D",statusSuccess:"#78C59A",statusWarning:"#DDB46F",statusError:"#E28787",...ke,yoloAccent:"#E5A77D"}},{id:"ember",labelKey:"settings.appearance.colorScheme.option.ember",descriptionKey:"settings.appearance.colorScheme.description.ember",appearance:"dark",editable:!1,colors:{surfaceBase:"#1B1714",surfaceSecondary:"#27211D",surfaceMuted:"#312923",borderBase:"#493D34",textPrimary:"#F1ECE7",textMuted:"#BDB1A6",accentPrimary:"#D79A66",statusSuccess:"#78C296",statusWarning:"#D8AE62",statusError:"#DE817A",...ke,yoloAccent:"#D79A66"}},{id:"custom",labelKey:"settings.appearance.colorScheme.option.custom",descriptionKey:"settings.appearance.colorScheme.description.custom",appearance:"dark",editable:!0,colors:$t}],Gn=Object.fromEntries(ei.map(e=>[e.id,e])),tt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Tt=e=>typeof e=="string"&&/^#[0-9A-F]{6}$/.test(e);function Mn(e){return tt(e)&&Rr.every(t=>Tt(e[t]))}function ti(e){if(Mn(e))return{...e};if(!(!tt(e)||!Qs.every(t=>Tt(e[t]))))return{...e,...ke}}const ni=e=>({...e});function qe(e,t,n=Gn[e].appearance){const r=Gn[e];return{id:e,appearance:n,...r.colors?{colors:ni(t??r.colors)}:{}}}function he(e,t){const n=typeof e=="string"?e:tt(e)?e.id:void 0;if(typeof n=="string"&&Zs.includes(n)){const r=n;if(r!=="custom")return qe(r);const o=tt(e)?ti(e.colors)??$t:$t,s=tt(e)&&e.appearance==="light"?"light":"dark";return qe("custom",o,s)}return qe(t==="light"?"light":t==="dark"?"classic":"system")}const fe=(e,t)=>Number.parseInt(e.slice(t,t+2),16),Jn=e=>{const t=n=>{const r=n/255;return r<=.04045?r/12.92:((r+.055)/1.055)**2.4};return .2126*t(fe(e,1))+.7152*t(fe(e,3))+.0722*t(fe(e,5))};function kt(e,t){if(!Tt(e)||!Tt(t))return 0;const[n,r]=[Jn(e),Jn(t)].sort((o,s)=>s-o);return(n+.05)/(r+.05)}function Nr(e){if(!Mn(e))return!1;const t=[[e.textPrimary,e.surfaceBase],[e.textPrimary,e.surfaceSecondary],[e.textPrimary,e.surfaceMuted],[e.textMuted,e.surfaceBase],[e.textMuted,e.surfaceSecondary],[e.textMuted,e.surfaceMuted]],n=[e.accentPrimary,e.statusSuccess,e.statusWarning,e.statusError,e.userAccent,e.agentAccent,e.compactionAccent,e.yoloAccent],r=[e.surfaceBase,e.surfaceSecondary];return t.every(([o,s])=>kt(o,s)>=4.5)&&n.every(o=>r.every(s=>kt(o,s)>=3))}const pe=(e,t,n)=>`#${[1,3,5].map(o=>Math.round(fe(e,o)*n+fe(t,o)*(1-n))).map(o=>o.toString(16).padStart(2,"0")).join("").toUpperCase()}`,L=(e,t)=>`rgba(${fe(e,1)}, ${fe(e,3)}, ${fe(e,5)}, ${t})`,ri=e=>kt("#000000",e)>=kt("#FFFFFF",e)?"#000000":"#FFFFFF",oi=["--surface-base","--surface-primary","--surface-secondary","--surface-muted","--surface-code","--surface-hover","--border-base","--border-secondary","--border-muted","--border-strong","--border-critical","--text-primary","--text-secondary","--text-muted","--text-inverted","--text-on-accent","--accent-primary","--accent-hover","--focus-ring-color","--focus-ring-offset","--list-item-highlight-bg","--list-item-highlight-bg-solid","--list-item-highlight-border","--attachment-chip-bg","--attachment-chip-text","--attachment-chip-ring","--badge-neutral-bg","--badge-neutral-text","--env-vars-bg","--env-vars-border","--env-vars-text","--dropdown-highlight-bg","--selection-highlight-bg","--selection-highlight-strong-bg","--status-success","--status-warning","--status-error","--status-success-bg","--status-warning-bg","--status-error-bg","--status-success-ring","--status-warning-ring","--status-error-ring","--status-ready-fg","--status-ready-bg","--status-starting-fg","--status-starting-bg","--status-error-fg","--message-user-bg","--message-user-border","--message-assistant-border","--session-status-compacting-fg","--session-status-compacting-bg","--session-yolo-accent"];function si(e,t){const n=ri(e.accentPrimary);return{"--surface-base":e.surfaceBase,"--surface-primary":e.surfaceBase,"--surface-secondary":e.surfaceSecondary,"--surface-muted":e.surfaceMuted,"--surface-code":e.surfaceMuted,"--surface-hover":pe(e.textPrimary,e.surfaceSecondary,t?.12:.08),"--border-base":e.borderBase,"--border-secondary":pe(e.borderBase,e.surfaceSecondary,.72),"--border-muted":pe(e.borderBase,e.surfaceSecondary,.5),"--border-strong":pe(e.textPrimary,e.borderBase,.3),"--border-critical":e.statusError,"--text-primary":e.textPrimary,"--text-secondary":e.textMuted,"--text-muted":e.textMuted,"--text-inverted":n,"--text-on-accent":n,"--accent-primary":e.accentPrimary,"--accent-hover":pe(t?"#FFFFFF":"#000000",e.accentPrimary,t?.14:.18),"--focus-ring-color":e.accentPrimary,"--focus-ring-offset":e.surfaceBase,"--list-item-highlight-bg":L(e.accentPrimary,t?.2:.1),"--list-item-highlight-bg-solid":pe(e.accentPrimary,e.surfaceSecondary,t?.22:.1),"--list-item-highlight-border":L(e.accentPrimary,t?.4:.25),"--attachment-chip-bg":L(e.accentPrimary,.1),"--attachment-chip-text":e.accentPrimary,"--attachment-chip-ring":L(e.accentPrimary,t?.2:.1),"--badge-neutral-bg":L(e.accentPrimary,t?.15:.05),"--badge-neutral-text":e.accentPrimary,"--env-vars-bg":L(e.accentPrimary,t?.2:.1),"--env-vars-border":L(e.accentPrimary,t?.3:.2),"--env-vars-text":e.accentPrimary,"--dropdown-highlight-bg":L(e.accentPrimary,t?.2:.1),"--selection-highlight-bg":L(e.accentPrimary,t?.18:.12),"--selection-highlight-strong-bg":L(e.accentPrimary,t?.28:.18),"--status-success":e.statusSuccess,"--status-warning":e.statusWarning,"--status-error":e.statusError,"--status-success-bg":L(e.statusSuccess,.16),"--status-warning-bg":L(e.statusWarning,.16),"--status-error-bg":L(e.statusError,.16),"--status-success-ring":L(e.statusSuccess,.42),"--status-warning-ring":L(e.statusWarning,.42),"--status-error-ring":L(e.statusError,.42),"--status-ready-fg":e.statusSuccess,"--status-ready-bg":L(e.statusSuccess,.16),"--status-starting-fg":e.statusWarning,"--status-starting-bg":L(e.statusWarning,.16),"--status-error-fg":e.statusError,"--message-user-bg":pe(e.userAccent,e.surfaceSecondary,t?.1:.12),"--message-user-border":e.userAccent,"--message-assistant-border":e.agentAccent,"--session-status-compacting-fg":e.compactionAccent,"--session-status-compacting-bg":L(e.compactionAccent,t?.28:.18),"--session-yolo-accent":e.yoloAccent}}function ii(e,t={}){const n=e.appearance==="dark"||e.appearance==="system"&&!!t.systemDark,r=t.target??(typeof document>"u"?void 0:document.documentElement);if(!r)return n;for(const o of oi)r.style.removeProperty(o);if(r.dataset.colorScheme=e.id,e.appearance==="system"?r.removeAttribute("data-theme"):r.setAttribute("data-theme",n?"dark":"light"),e.colors&&e.id!=="classic")for(const[o,s]of Object.entries(si(e.colors,n)))r.style.setProperty(o,s);return n}const Br=50,qn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ai(e){if(!qn(e))return{};const t={};for(const[n,r]of Object.entries(e).slice(0,Br)){if(!n||n.length>128||!qn(r))continue;const o=typeof r.name=="string"?r.name.trim().slice(0,80):"",s=r.appearance==="light"?"light":r.appearance==="dark"?"dark":void 0;!o||!s||!Mn(r.colors)||!Nr(r.colors)||(t[n]={name:o,appearance:s,colors:{...r.colors}})}return t}function tu(e,t){var a;const n=e.trim()||"Custom",r=/^(.*?)(?:\s+(\d+))?$/.exec(n),o=((a=r==null?void 0:r[1])==null?void 0:a.trim())||n;let s=r!=null&&r[2]?Number(r[2])+1:2;const i=new Set(t.map(c=>c.trim().toLocaleLowerCase()));for(;i.has(`${o} ${s}`.toLocaleLowerCase());)s+=1;return`${o} ${s}`}function ci(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`palette-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Kt(e){if(!e||typeof e!="object"||Array.isArray(e))return{hiddenModelIds:[]};const t=e.hiddenModelIds;return Array.isArray(t)?{hiddenModelIds:Array.from(new Set(t.filter(n=>typeof n=="string"&&n.length>0)))}:{hiddenModelIds:[]}}function li(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))n&&(t[n]=Kt(r));return t}function nu(e,t){return!Kt(e).hiddenModelIds.includes(t)}function ru(e,t){return e&&t.some(n=>n.key===e.key)?e:void 0}const A=Oe("actions"),ui=20,di=5,fi=50,hi={preset:"balanced"},k={showThinkingBlocks:!1,showKeyboardShortcutHints:!1,thinkingBlocksExpansion:"collapsed",showMessageTimeline:!0,showTimelineTools:!1,holdLongAssistantReplies:!0,promptSubmitOnEnter:!0,followUpBehavior:"steer",showPromptVoiceInput:!0,diffViewMode:"split",toolOutputExpansion:"expanded",diagnosticsExpansion:"expanded",toolInputsVisibility:"collapsed",showUsageMetrics:!0,showProviderUsageCreditBalance:!1,autoCleanupBlankSessions:!0,keepUnseenSubagentIdleStatus:!0,osNotificationsEnabled:!1,osNotificationsAllowWhenVisible:!1,notifyOnNeedsInput:!0,notifyOnIdle:!0};function pn(e,t){return e==="expanded"||e==="collapsed"?e:t}function gi(e,t){return e==="hidden"||e==="expanded"||e==="collapsed"?e:t}function mi(e){return e==="minimal"||e==="balanced"||e==="detailed"||e==="everything"||e==="custom"?e:hi.preset}function pi(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))n&&(r==="hidden"||r==="expanded"||r==="collapsed")&&(t[n]=r);return t}function yi(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,r=pn(t.thinkingBlocksExpansion,"collapsed");return{preset:mi(n==null?void 0:n.preset),thinking:pn(n==null?void 0:n.thinking,r),tools:pi(n==null?void 0:n.tools)}}const $e={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function Ur(e){const t=e??{},n=yi(t.toolCallExpansionDefaults,t),r=n.preset==="minimal"||n.preset==="balanced"?"collapsed":"expanded";return{showThinkingBlocks:t.showThinkingBlocks??k.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??k.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??k.thinkingBlocksExpansion,showMessageTimeline:t.showMessageTimeline??k.showMessageTimeline,showTimelineTools:t.showTimelineTools??k.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??k.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??k.promptSubmitOnEnter,followUpBehavior:t.followUpBehavior==="queue"||t.followUpBehavior==="steer"?t.followUpBehavior:k.followUpBehavior,showPromptVoiceInput:t.showPromptVoiceInput??k.showPromptVoiceInput,locale:t.locale??k.locale,diffViewMode:t.diffViewMode??k.diffViewMode,toolCallExpansionDefaults:n,toolOutputExpansion:t.toolOutputExpansion??k.toolOutputExpansion,diagnosticsExpansion:gi(t.diagnosticsExpansion,k.diagnosticsExpansion),toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:k.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??k.showUsageMetrics,usageMetricsExpansion:pn(t.usageMetricsExpansion,r),showProviderUsageCreditBalance:t.showProviderUsageCreditBalance??k.showProviderUsageCreditBalance,autoCleanupBlankSessions:t.autoCleanupBlankSessions??k.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??k.keepUnseenSubagentIdleStatus,focusExistingWindowOnSecondLaunch:t.focusExistingWindowOnSecondLaunch===!0,modelVisibility:li(t.modelVisibility),osNotificationsEnabled:t.osNotificationsEnabled??k.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??k.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??k.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??k.notifyOnIdle}}function jr(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t}function bi(e){var o,s,i,a,c,u,l,d,f,g;const t=e??{},n=typeof t.sttModel=="string"&&t.sttModel.trim()?t.sttModel.trim():$e.sttModel,r=typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():$e.ttsModel;return{provider:t.provider==="openai-compatible"?t.provider:$e.provider,apiKey:typeof t.apiKey=="string"&&t.apiKey.trim()?t.apiKey.trim():void 0,hasApiKey:t.hasApiKey===!0||typeof t.apiKey=="string"&&t.apiKey.trim().length>0,baseUrl:typeof t.baseUrl=="string"&&t.baseUrl.trim()?t.baseUrl.trim():void 0,sttModel:n,ttsModel:r,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():$e.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:$e.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:$e.ttsFormat,separateProviders:t.separateProviders===!0,stt:{apiKey:typeof((o=t.stt)==null?void 0:o.apiKey)=="string"&&t.stt.apiKey.trim()?t.stt.apiKey.trim():void 0,hasApiKey:((s=t.stt)==null?void 0:s.hasApiKey)===!0||typeof((i=t.stt)==null?void 0:i.apiKey)=="string"&&t.stt.apiKey.trim().length>0,baseUrl:typeof((a=t.stt)==null?void 0:a.baseUrl)=="string"&&t.stt.baseUrl.trim()?t.stt.baseUrl.trim():void 0,model:typeof((c=t.stt)==null?void 0:c.model)=="string"&&t.stt.model.trim()?t.stt.model.trim():n},tts:{apiKey:typeof((u=t.tts)==null?void 0:u.apiKey)=="string"&&t.tts.apiKey.trim()?t.tts.apiKey.trim():void 0,hasApiKey:((l=t.tts)==null?void 0:l.hasApiKey)===!0||typeof((d=t.tts)==null?void 0:d.apiKey)=="string"&&t.tts.apiKey.trim().length>0,baseUrl:typeof((f=t.tts)==null?void 0:f.baseUrl)=="string"&&t.tts.baseUrl.trim()?t.tts.baseUrl.trim():void 0,model:typeof((g=t.tts)==null?void 0:g.model)=="string"&&t.tts.model.trim()?t.tts.model.trim():r}}}function Ye(e,t){if(!Array.isArray(e))return[];const n=[];for(const r of e){const o=t(r);o&&n.push(o)}return n}function wi(e){var n,r,o;const t=e??{};return{recentFolders:Ye(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed,c=s.projectName;if(typeof i!="string")return null;const u=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:u,...typeof c=="string"&&c.trim()?{projectName:c.trim()}:{}}}),opencodeBinaries:Ye(t.opencodeBinaries,s=>{if(!s||typeof s!="object")return null;const i=s.path;if(typeof i!="string")return null;const a=typeof s.lastUsed=="number"?s.lastUsed:Date.now(),c=typeof s.version=="string"?s.version:void 0,u=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:u,lastUsed:a}}),remoteServers:Ye(t.remoteServers,s=>{if(!s||typeof s!="object")return null;const i=typeof s.id=="string"?s.id.trim():"",a=typeof s.name=="string"?s.name.trim():"",c=typeof s.baseUrl=="string"?s.baseUrl.trim():"";if(!i||!a||!c)return null;const u=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),l=typeof s.updatedAt=="string"?s.updatedAt:u,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:u,updatedAt:l,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:Ye((n=t.models)==null?void 0:n.recents,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),favorites:Ye((r=t.models)==null?void 0:r.favorites,s=>{if(!s||typeof s!="object")return null;const i=s.providerId,a=s.modelId;return typeof i!="string"||typeof a!="string"?null:{providerId:i,modelId:a}}),thinkingSelections:jr((o=t.models)==null?void 0:o.thinkingSelections)}}}function Ci(e){const t=e??{},n=t.listeningMode==="all"?"all":"local",r=t.logLevel==="INFO"||t.logLevel==="WARN"||t.logLevel==="ERROR"||t.logLevel==="DEBUG"?t.logLevel:"DEBUG",o=typeof t.opencodeBinary=="string"&&t.opencodeBinary.trim()&&t.opencodeBinary!=="opencode"?t.opencodeBinary:"opencode2",s=jr(t.environmentVariables),i=Si(t.secureEnvVars),a=bi(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,secureEnvVars:i,speech:a}}function Si(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function _r(e){return`${e.providerId}/${e.modelId}`}function Wr(e,t,n){const r=new Set([e,n].filter(c=>!!c)),o=n?t.find(c=>c.path===n):void 0,s=t.find(c=>c.path===e),i=(o==null?void 0:o.projectName)??(s==null?void 0:s.projectName),a=t.filter(c=>!r.has(c.path));return a.unshift({path:e,lastAccessed:Date.now(),...i?{projectName:i}:{}}),a.slice(0,ui)}function Vr(e,t,n){if(e==="opencode"||e==="opencode2")return n;const r=Date.now(),o=n.find(i=>i.path===e);if(o){const i={...o,lastUsed:r,version:t??o.version},a=n.filter(c=>c.path!==e);return[i,...a]}return[t?{path:e,version:t,lastUsed:r}:{path:e,lastUsed:r},...n].slice(0,10)}function xi(e,t){const n=e.id?t.find(o=>o.id===e.id):void 0,r=new Date().toISOString();return{id:(n==null?void 0:n.id)??e.id??vi(),name:e.name.trim(),baseUrl:e.baseUrl.trim(),skipTlsVerify:!!e.skipTlsVerify,createdAt:(n==null?void 0:n.createdAt)??r,updatedAt:r,lastConnectedAt:n==null?void 0:n.lastConnectedAt}}function Kr(e,t){const n=t.filter(r=>r.id!==e.id);return[e,...n].sort((r,o)=>{const s=r.lastConnectedAt??r.updatedAt;return(o.lastConnectedAt??o.updatedAt).localeCompare(s)})}function vi(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[ut,Ft]=$({}),[Ai,It]=$({}),[He,Dt]=$({}),[zr,nt]=$(!1),Oi=F(()=>Ur(ut().settings)),Hr=F(()=>He().theme??ut().theme??"system"),Gr=F(()=>he(He().colorScheme??ut().colorScheme,Hr())),Ei=F(()=>{const e=He(),t=ut(),n=e.customColorScheme??t.customColorScheme??(Gr().id==="custom"?e.colorScheme??t.colorScheme:void 0),r=typeof n=="object"&&n!==null&&!Array.isArray(n)?{...n,id:"custom"}:{id:"custom"};return he(r)}),zt=F(()=>ai(He().colorSchemePresets)),Pi=F(()=>{const e=He().activeColorSchemePresetId;return typeof e=="string"&&zt()[e]?e:void 0}),Se=F(()=>Ci(Ai())),se=F(()=>wi(He())),j=Oi,dt=F(()=>se().recentFolders),Ht=F(()=>se().opencodeBinaries),We=F(()=>se().remoteServers);let Ct=null;async function Gt(){zr()||(Ct||(Ct=Promise.all([Q.loadConfigOwner("ui"),Q.loadConfigOwner("server"),Q.loadStateOwner("ui")]).then(([e,t,n])=>{Ft(e),It(t),Dt(n),nt(!0)}).catch(e=>{A.error("Failed to load settings",e),Ft({}),It({}),Dt({}),nt(!0)}).finally(()=>{Ct=null})),await Ct)}async function Y(e,t){await Gt();const n=await Q.patchConfigOwner(e,t);e==="ui"&&Ft(n),e==="server"&&It(n)}async function U(e,t){await Gt();const n=await Q.patchStateOwner(e,t);Dt(n)}function G(e){const t=ut(),n=Ur({...t.settings??{},...e}),r={settings:Object.fromEntries(Object.keys(e).map(o=>[o,n[o]]))};return Y("ui",r).then(()=>!0,o=>(A.error("Failed to patch ui settings",o),!1))}function Jr(e){return G(e)}const Xe=new Map;let Yn=Promise.resolve();const[Mi,on]=$(new Map),[$i,Xn]=$(new Set);function Ti(e){return Mi().get(e)??Kt(j().modelVisibility[e])}function ki(e){return $i().has(e)}async function Fi(e,t){if(!e)return;const n=Kt(t);on(s=>new Map(s).set(e,n)),Xn(s=>{const i=new Set(s);return i.delete(e),i});const o=Yn.catch(()=>{}).then(()=>Y("ui",{settings:{modelVisibility:{[e]:n}}}));Yn=o,Xe.set(e,o),o.then(()=>{Xe.get(e)===o&&(Xe.delete(e),on(s=>{const i=new Map(s);return i.delete(e),i}))},s=>{A.error("Failed to update provider model visibility",s),Xe.get(e)===o&&(Xe.delete(e),on(i=>{const a=new Map(i);return a.delete(e),a}),Xn(i=>new Set(i).add(e)))}),await o}function Ii(e){qr(he(e==="dark"?"classic":e))}let Ve=Promise.resolve();function qr(e){const t=he(e),r={theme:t.appearance==="system"?"system":t.appearance,colorScheme:t,...t.id==="custom"?{customColorScheme:t}:{},activeColorSchemePresetId:null},o=Ve.then(()=>U("ui",r));return Ve=o.then(()=>{},()=>{}),o.then(()=>{}).catch(s=>{throw A.error("Failed to set color scheme",s),s})}function Di(e){const t=zt()[e];if(!t)return Promise.resolve();const n=he({id:"custom",appearance:t.appearance,colors:t.colors}),r=Ve.then(()=>U("ui",{theme:t.appearance,colorScheme:n,customColorScheme:n,activeColorSchemePresetId:e}));return Ve=r.then(()=>{},()=>{}),r.then(()=>{})}function Li(e,t,n){const r=e.trim().slice(0,80);if(!r||!Nr(n))return Promise.reject(new Error("Invalid color scheme preset"));if(Object.keys(zt()).length>=Br)return Promise.reject(new Error("Color scheme preset limit reached"));const o=ci(),s=he({id:"custom",appearance:t,colors:n}),i=Ve.then(()=>U("ui",{theme:t,colorScheme:s,customColorScheme:s,colorSchemePresets:{[o]:{name:r,appearance:t,colors:{...n}}},activeColorSchemePresetId:o}));return Ve=i.then(()=>{},()=>{}),i.then(()=>o)}async function Ri(e){Se().listeningMode!==e&&await Y("server",{listeningMode:e})}function Yr(e){Y("server",{environmentVariables:e}).catch(t=>A.error("Failed to update environment variables",t))}function Ni(e,t,n=!0){const r=Se().environmentVariables;Yr({...r,[e]:t});const o=Se().secureEnvVars,s=e.toUpperCase(),i=o.some(a=>a.toUpperCase()===s);if(n){if(!i){const a=[...o,e];Y("server",{secureEnvVars:a}).catch(c=>A.error("Failed to add secure env var",c))}}else if(i){const a=o.filter(c=>c.toUpperCase()!==s);Y("server",{secureEnvVars:a}).catch(c=>A.error("Failed to remove secure env var",c))}}function Bi(e){Y("server",{environmentVariables:{[e]:null}}).catch(t=>A.error("Failed to remove environment variable",t))}function Ui(e){return Se().secureEnvVars.some(n=>n.toUpperCase()===e.toUpperCase())}function ji(e){const t=Se().secureEnvVars,n=e.toUpperCase(),o=t.some(s=>s.toUpperCase()===n)?t.filter(s=>s.toUpperCase()!==n):[...t,e];Y("server",{secureEnvVars:o}).catch(s=>A.error("Failed to update secure env vars",s))}function _i(e){const t=e&&e.trim().length>0?e:"opencode2";Y("server",{opencodeBinary:t}).catch(r=>A.error("Failed to set default binary",r));const n=Vr(t,void 0,Ht());U("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to update binary list",r))}function Wi(e){Y("server",{logLevel:e??"DEBUG"}).catch(n=>A.error("Failed to set log level",n))}async function Vi(e){const t=Xs(e);try{await Y("server",{speech:t})}catch(n){throw A.error("Failed to update speech settings",n),n}}function Ki(e,t){const n=Vr(e,t,Ht());U("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to add binary",r))}function zi(e){const t=Ht().filter(n=>n.path!==e);U("ui",{opencodeBinaries:t}).catch(n=>A.error("Failed to remove binary",n)),Se().opencodeBinary===e&&Y("server",{opencodeBinary:"opencode2"}).catch(n=>A.error("Failed to reset default binary",n))}function Hi(e){const t=Wr(e,dt());U("ui",{recentFolders:t}).catch(n=>A.error("Failed to add recent folder",n))}function Gi(e){const t=dt().filter(n=>n.path!==e);U("ui",{recentFolders:t}).catch(n=>A.error("Failed to remove recent folder",n))}async function Ji(e,t){const n=t.trim();if(!e||!n)return;const r=dt().map(o=>o.path===e?{...o,projectName:n}:o);try{await U("ui",{recentFolders:r})}catch(o){throw A.error("Failed to rename recent folder",o),o}}async function qi(e){const t=xi(e,We());return await U("ui",{remoteServers:Kr(t,We())}),t}async function Yi(e){const t=We().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await U("ui",{remoteServers:Kr(r,We())})}function Xi(e){const t=We().filter(n=>n.id!==e);U("ui",{remoteServers:t}).catch(n=>A.error("Failed to remove remote server",n))}function Zi(e,t){const n=Wr(e,dt(),t);U("ui",{recentFolders:n}).catch(r=>A.error("Failed to update ui state on launch",r))}function Qi(e){if(!e.providerId||!e.modelId)return;const n=se().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,di);U("ui",{models:{recents:r}}).catch(o=>A.error("Failed to update model recents",o))}function ea(e){return!e.providerId||!e.modelId?!1:se().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function ta(e){if(!e.providerId||!e.modelId)return;const t=se().models.favorites,r=t.some(o=>o.providerId===e.providerId&&o.modelId===e.modelId)?t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId):[e,...t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId)].slice(0,fi);U("ui",{models:{favorites:r}}).catch(o=>A.error("Failed to update model favorites",o))}function na(e){if(!(!e.providerId||!e.modelId))return se().models.thinkingSelections[_r(e)]}function ra(e,t){if(!e.providerId||!e.modelId)return;const n=_r(e);if(se().models.thinkingSelections[n]===t)return;const o={...se().models.thinkingSelections};t?o[n]=t:delete o[n],U("ui",{models:{thinkingSelections:o}}).catch(s=>A.error("Failed to update thinking selection",s))}function oa(e){j().diffViewMode!==e&&G({diffViewMode:e})}function sa(e){const t=j();t.toolCallExpansionDefaults.tools.other!==e&&G({toolOutputExpansion:e==="hidden"?t.toolOutputExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",tools:{...t.toolCallExpansionDefaults.tools,other:e}}})}function ia(e){j().diagnosticsExpansion!==e&&G({diagnosticsExpansion:e})}function aa(e){j().toolInputsVisibility!==e&&G({toolInputsVisibility:e})}function ca(e){const t=j();t.thinkingBlocksExpansion===e&&t.toolCallExpansionDefaults.thinking===e||G({thinkingBlocksExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",thinking:e}})}function la(){G({showThinkingBlocks:!j().showThinkingBlocks})}function ua(){Jr({showKeyboardShortcutHints:!j().showKeyboardShortcutHints})}function da(){G({showTimelineTools:!j().showTimelineTools})}function fa(){G({showMessageTimeline:!(j().showMessageTimeline??!0)})}function ha(){G({showUsageMetrics:!j().showUsageMetrics})}function ga(){G({promptSubmitOnEnter:!j().promptSubmitOnEnter})}function ma(){G({showPromptVoiceInput:!j().showPromptVoiceInput})}function pa(){const e=!j().autoCleanupBlankSessions;A.info("toggle auto cleanup",{value:e}),G({autoCleanupBlankSessions:e})}async function ya(e,t,n){!e||!t||!n.providerId||!n.modelId||(await Vt(e),await Ir(e,r=>{const o={...r.agentModelSelections??{}},s=o[t];s&&s.providerId===n.providerId&&s.modelId===n.modelId||(o[t]=n,r.agentModelSelections=o)}))}async function ba(e,t){return!e||!t?void 0:(await Vt(e),(Dr(e).agentModelSelections??{})[t])}Gt().catch(e=>{A.error("Failed to initialize settings",e)});const Xr=Ke(),wa={isLoaded:zr,preferences:j,updatePreferences:Jr,setProviderModelVisibility:Fi,getProviderModelVisibilityPreference:Ti,providerModelVisibilitySaveFailed:ki,themePreference:Hr,setThemePreference:Ii,colorSchemePreference:Gr,customColorSchemePreference:Ei,colorSchemePresets:zt,activeColorSchemePresetId:Pi,setColorSchemePreference:qr,selectColorSchemePreset:Di,saveColorSchemePreset:Li,serverSettings:Se,setListeningMode:Ri,updateEnvironmentVariables:Yr,addEnvironmentVariable:Ni,removeEnvironmentVariable:Bi,isSecureEnvVar:Ui,toggleSecureEnvVar:ji,updateLastUsedBinary:_i,updateLogLevel:Wi,updateSpeechSettings:Vi,recentFolders:dt,opencodeBinaries:Ht,remoteServers:We,uiState:se,addRecentFolder:Hi,removeRecentFolder:Gi,renameRecentFolderProject:Ji,addOpenCodeBinary:Ki,removeOpenCodeBinary:zi,saveRemoteServerProfile:qi,markRemoteServerConnected:Yi,removeRemoteServerProfile:Xi,recordWorkspaceLaunch:Zi,addRecentModelPreference:Qi,isFavoriteModelPreference:ea,toggleFavoriteModelPreference:ta,getModelThinkingSelection:na,setModelThinkingSelection:ra,toggleShowThinkingBlocks:la,toggleKeyboardShortcutHints:ua,toggleShowMessageTimeline:fa,toggleShowTimelineTools:da,toggleUsageMetrics:ha,toggleAutoCleanupBlankSessions:pa,togglePromptSubmitOnEnter:ga,toggleShowPromptVoiceInput:ma,setDiffViewMode:oa,setToolOutputExpansion:sa,setDiagnosticsExpansion:ia,setThinkingBlocksExpansion:ca,setToolInputsVisibility:aa,setAgentModelPreference:ya,getAgentModelPreference:ba},ou=e=>(jt(()=>{Gt().catch(o=>{A.error("Failed to initialize settings",o)});const t=Q.onConfigOwnerChanged("ui",o=>{Ft(o),nt(!0)}),n=Q.onConfigOwnerChanged("server",o=>{It(o),nt(!0),Ys(),qs(!0)}),r=Q.onStateOwnerChanged("ui",o=>{Dt(o),nt(!0)});return()=>{t(),n(),r()}}),de(Xr.Provider,{value:wa,get children(){return e.children}}));function Ca(){const e=ct(Xr);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function $n(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Sa(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&n[0].length===1&&(n=n.map(r=>r+r)),n?`rgb${n.length===4?"a":""}(${n.map((r,o)=>o<3?parseInt(r,16):Math.round(parseInt(r,16)/255*1e3)/1e3).join(", ")})`:""}function xe(e){if(typeof e!="string")return e;if(e.charAt(0)==="#")return xe(Sa(e));const t=e.indexOf("("),n=e.substring(0,t);if(["rgb","rgba","hsl","hsla","color"].indexOf(n)===-1)throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const r=e.substring(t+1,e.length-1);let o,s;if(n==="color"){if(o=r.split(" "),s=o.shift(),o.length===4&&o[3].charAt(0)==="/"&&(o[3]=o[3].substr(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(s)===-1)throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020. "+s)}else o=r.split(",");return{type:n,values:o.map(i=>parseFloat(i)),colorSpace:s}}function Jt(e){const{type:t,colorSpace:n}=e,{values:r}=e;let o;return t.indexOf("rgb")!==-1?o=r.map((s,i)=>i<3?parseInt(s.toString(),10):s).join(","):t.indexOf("hsl")!==-1&&(o=r.map((s,i)=>i===1||i===2?`${s}%`:s).join(",")),t.indexOf("color")!==-1?o=`${n} ${r.join(" ")}`:o=`${r.join(", ")}`,`${t}(${o})`}function xa(e){const t=xe(e),{values:n}=t,r=n[0],o=n[1]/100,s=n[2]/100,i=o*Math.min(s,1-s),a=(l,d=(l+r/30)%12)=>s-i*Math.max(Math.min(d-3,9-d,1),-1);let c="rgb";const u=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return t.type==="hsla"&&(c+="a",u.push(n[3])),Jt({type:c,values:u})}function Zn(e){const{type:t,values:n}=xe(e);let r=t==="hsl"?xe(xa(e)).values:n;return r=r.map(o=>(t!=="color"&&(o/=255),o<=.03928?o/12.92:((o+.055)/1.055)**2.4)),Number((.2126*r[0]+.7152*r[1]+.0722*r[2]).toFixed(3))}function va(e,t){const n=Zn(e),r=Zn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function su(e,t){let{type:n,values:r}=xe(e);return t=$n(t),(n==="rgb"||n==="hsl")&&(n+="a"),n==="color"?r[3]=`/${t}`:r[3]=t,Jt({type:n,values:r})}function Aa(e,t){const n=xe(e);if(t=$n(t),n.type.indexOf("hsl")!==-1)n.values[2]*=1-t;else if(n.type.indexOf("rgb")!==-1||n.type.indexOf("color")!==-1)for(let r=0;r<3;r+=1)n.values[r]*=1-t;return Jt(n)}function Oa(e,t){const n=xe(e);if(t=$n(t),n.type.indexOf("hsl")!==-1)n.values[2]+=(100-n.values[2])*t;else if(n.type.indexOf("rgb")!==-1)for(let r=0;r<3;r+=1)n.values[r]+=(255-n.values[r])*t;else if(n.type.indexOf("color")!==-1)for(let r=0;r<3;r+=1)n.values[r]+=(1-n.values[r])*t;return Jt(n)}const Ea={xs:0,sm:600,md:900,lg:1200,xl:1536};function Pa(e,t,n){const r=e.theme||{};if(Array.isArray(t)){const s=r.breakpoints;return t.reduce((i,a,c)=>(i={...i,...s.up(s.keys[c],n(t[c]))},i),{})}if(typeof t=="object"){const s=r.breakpoints;return Object.keys(t).reduce((a,c)=>{if(Object.keys(s.values||Ea).indexOf(c)!==-1)a={...a,...s.up(c,n(t[c],c))};else{const u=c;a[u]=t[u]}return a},{})}return n(t)}const Ma={cleanupStyles:!0},$a=Ke(Ma),ve={black:"#000",white:"#fff"},Ie={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},De={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Le={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Re={300:"#4fc3f7",400:"#29b6f6",700:"#0288d1",800:"#0277bd",900:"#01579b"},Ne={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},rt={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Ta={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function Qe(e){return e!==null&&typeof e=="object"&&e.constructor===Object}function ka(e,t){for(const n of t){const r=e[n];delete e[n],e[n]=r}}function Tn(e,t,n={clone:!0}){const r=n.clone?{...e}:e,o=n.sortKeys?[]:void 0;return Qe(e)&&Qe(t)&&(Object.keys(t).forEach(s=>{if(s==="__proto__")return;o&&o.push(s);let i,a;Qe(i=t[s])&&s in e&&Qe(a=e[s])?r[s]=Tn(a,i,n):i!==void 0&&(r[s]=i)}),o&&ka(r,o)),r}function yn(e){if(Array.isArray(e)){const t=[];for(const n of e)t.push(yn(n));return t}else if(Qe(e)){const t={};for(const n in e)n!=="__proto__"&&(t[n]=yn(e[n]));return t}else return e}function ft(e,...t){for(const n of t)Tn(e,yn(n),{clone:!1});return e}const Fa=()=>({text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:ve.white,default:ve.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}),Ia={primary:{main:Le[700],light:Le[400],dark:Le[800]},secondary:{main:De[500],light:De[300],dark:De[700]},error:{main:Ie[700],light:Ie[400],dark:Ie[800]},info:{main:Re[700],light:Re[800],dark:Re[900]},success:{main:Ne[800],light:Ne[500],dark:Ne[900]},warning:{main:"#ED6C02",light:rt[500],dark:rt[900]}},Da=()=>({text:{primary:ve.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:ve.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}),La={primary:{main:Le[200],light:Le[50],dark:Le[400]},secondary:{main:De[200],light:De[50],dark:De[400]},error:{main:Ie[500],light:Ie[300],dark:Ie[700]},info:{main:Re[400],light:Re[300],dark:Re[700]},success:{main:Ne[400],light:Ne[300],dark:Ne[700]},warning:{main:rt[400],light:rt[300],dark:rt[700]}},Ra={light:Fa,dark:Da};function Zr(e,t){return va(e,ve.white)>=t?ve.white:"rgba(0, 0, 0, 0.87)"}function Qn(e,t,n,r){const o=typeof r=="number"?r:r.light,s=typeof r=="number"?r*1.5:r.dark;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:t==="light"?e.light=Oa(e.main,o):t==="dark"&&(e.dark=Aa(e.main,s)))}function Na(e){const t={...e.color},n=e.mainShade??500;return!e.color.main&&e.color[n]&&(t.main=e.color[n]),Qn(t,"light",e.lightShade??300,e.tonalOffset),Qn(t,"dark",e.darkShade??700,e.tonalOffset),t.contrastText||(t.contrastText=Zr(t.main,e.contrastThreshold)),t}const Ba=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:Ta,common:ve});function Ua(e){const t=["error","info","primary","secondary","success","warning"],n=Ba(),r={...ft({},n,Ra[(e==null?void 0:e.mode)??n.mode](),e),isColorName(s){return t.includes(s)},getColorObject(s){return r[s]},getColor(s){return r.mode==="light"?r[s].light:r[s].dark},augmentColor(s){return Na({...s,tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold})},getContrastText(s){return Zr(s,r.contrastThreshold)}},o=s=>r.mode==="light"?Ia[s]:La[s];return r.primary=r.augmentColor({color:r.primary||o("primary")}),r.secondary=r.augmentColor({color:r.secondary||o("secondary"),mainShade:"A400",lightShade:"A200",darkShade:"A700"}),r.error=r.augmentColor({color:r.error||o("error")}),r.warning=r.augmentColor({color:r.warning||o("warning")}),r.info=r.augmentColor({color:r.info||o("info")}),r.success=r.augmentColor({color:r.success||o("success")}),r}const ja={};function _a(e){return{...ft({},ja,e??{})}}function Wa(e,t=void 0,n={}){return{toolbar:{minHeight:56,[`${e.up("xs")} and (orientation: landscape)`]:{minHeight:48},[e.up("sm")]:{minHeight:64}},...n}}const sn={},Va=.2,Ka=.14,za=.12;function M(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Va})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Ka})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${za})`].join(",")}const Ha=[()=>"none",()=>M(0,2,1,-1,0,1,1,0,0,1,3,0),()=>M(0,3,1,-2,0,2,2,0,0,1,5,0),()=>M(0,3,3,-2,0,3,4,0,0,1,8,0),()=>M(0,2,4,-1,0,4,5,0,0,1,10,0),()=>M(0,3,5,-1,0,5,8,0,0,1,14,0),()=>M(0,3,5,-1,0,6,10,0,0,1,18,0),()=>M(0,4,5,-2,0,7,10,1,0,2,16,1),()=>M(0,5,5,-3,0,8,10,1,0,3,14,2),()=>M(0,5,6,-3,0,9,12,1,0,3,16,2),()=>M(0,6,6,-3,0,10,14,1,0,4,18,3),()=>M(0,6,7,-4,0,11,15,1,0,4,20,3),()=>M(0,7,8,-4,0,12,17,2,0,5,22,4),()=>M(0,7,8,-4,0,13,19,2,0,5,24,4),()=>M(0,7,9,-4,0,14,21,2,0,5,26,4),()=>M(0,8,9,-5,0,15,22,2,0,6,28,5),()=>M(0,8,10,-5,0,16,24,2,0,6,30,5),()=>M(0,8,11,-5,0,17,26,2,0,6,32,5),()=>M(0,9,11,-5,0,18,28,2,0,7,34,6),()=>M(0,9,12,-6,0,19,29,2,0,7,36,6),()=>M(0,10,13,-6,0,20,31,3,0,8,38,7),()=>M(0,10,13,-6,0,21,33,3,0,8,40,7),()=>M(0,10,14,-6,0,22,35,3,0,8,42,7),()=>M(0,11,14,-7,0,23,36,3,0,9,44,8),()=>M(0,11,15,-7,0,24,38,3,0,9,46,8)];function Ga(){return new Proxy([],{get:(e,t)=>typeof t!="string"||isNaN(Number(t))?e[t]:t in sn?sn[t]:sn[t]=Ha[t]()})}const Ja={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},qa={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function er(e){return`${Math.round(e)}ms`}function Ya(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function Xa(e){const t={...Ja,...e.easing},n={...qa,...e.duration};return{getAutoHeightDuration:Ya,create:(o=["all"],s={})=>{const{duration:i=n.standard,easing:a=t.easeInOut,delay:c=0,...u}=s;return(Array.isArray(o)?o:[o]).map(l=>`${l} ${typeof i=="string"?i:er(i)} ${a} ${typeof c=="string"?c:er(c)}`).join(",")},...e,easing:t,duration:n}}const z={light:300,regular:400,medium:500},St={fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',fontSize:14,htmlFontSize:16,h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},subtitle1:{},subtitle2:{},body1:{},body2:{},button:{},caption:{},overline:{},fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:700};function Za(e){return Math.round(e*1e5)/1e5}function H(e,t,n,r,o,s){return{fontFamily:e.fontFamily,fontWeight:t,fontSize:e.pxToRem(n),lineHeight:`${r}`,letterSpacing:`${Za(o/n)}em`,...s?{textTransform:"uppercase"}:{}}}function Qa(e={}){const t={fontFamily:e.fontFamily??St.fontFamily,fontSize:e.fontSize??St.fontSize,htmlFontSize:(e==null?void 0:e.htmlFontSize)??St.htmlFontSize,pxToRem:n=>{const r=t.fontSize/14;return`${n/t.htmlFontSize*r}rem`}};return ft(St,t,{h1:H(t,z.light,96,1.167,-1.5),h2:H(t,z.light,60,1.2,-.5),h3:H(t,z.regular,48,1.167,0),h4:H(t,z.regular,34,1.235,.25),h5:H(t,z.regular,24,1.334,0),h6:H(t,z.medium,20,1.6,.15),subtitle1:H(t,z.regular,16,1.75,.15),subtitle2:H(t,z.medium,14,1.57,.1),body1:H(t,z.regular,16,1.5,.15),body2:H(t,z.regular,14,1.43,.15),button:H(t,z.medium,14,1.75,.4,!0),caption:H(t,z.regular,12,1.66,.4),overline:H(t,z.regular,12,2.66,1,!0)},e)}const ec={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function tc(e){return{...ft({},ec,e)}}function an(e,t,n="px"){let r;if(e==="up")r=`(min-width:${t}${n})`;else if(e==="down")r=`(max-width:${t}${n})`;else if(e==="between"){const[o,s]=t;r=`(max-width:${o}${n}) and (min-width:${s}${n})`}else throw new Error(`Invalid comparator: ${e}`);return`@media ${r}`}const nc={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function Qr(e){const t={...nc,...e??{},up:(n,r)=>{const o=an("up",t.resolve(n));return r?{[o]:r}:o},down:(n,r)=>{const o=an("down",t.resolve(n));return r?{[o]:r}:o},between:(n,r)=>{const o=an("between",[t.resolve(n[0]),t.resolve(n[1])]);return r?{[o]:r}:o},resolve:n=>typeof n=="number"?n:t.values[n]};return t}function eo(e){return typeof e=="function"?e:(...n)=>n.map(r=>typeof r=="number"?`${r*(e??8)}px`:r).join(" ")}const rc={borderRadius:4};function to(e){return{...ft({},rc,e)}}function no(e={}){const t={direction:"ltr",...e};function n(r,o){const s=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,...typeof s=="function"?{get:s}:{value:o({[r]:s})}})}return n("breakpoints",r=>Qr(r.breakpoints)),n("components",r=>_a(r.components)),n("palette",r=>Ua(r.palette)),n("shape",r=>to(r.shape)),n("spacing",r=>eo(r.spacing)),n("typography",r=>Qa(r.typography)),n("shadows",()=>Ga()),n("transitions",()=>Xa({})),n("zIndex",r=>tc(r.zIndex)),n("mixins",()=>Wa(t.breakpoints)),t}function ro(e){let t;return function(){return t||(t=e()),t}}const oc=ro(no);let oo;oo=Ke({});const qt=oo;function sc(e){return{direction:"ltr",shadows:void 0,transitions:void 0,components:void 0,palette:void 0,typography:void 0,zIndex:void 0,mixins:void 0,...e,breakpoints:Qr(e==null?void 0:e.breakpoints),shape:to(e==null?void 0:e.shape),spacing:eo(e==null?void 0:e.spacing)}}const ic=ro(sc);function ac(e){for(const t in e)return!1;return!0}function kn(e=ic,t=qt){const n=ct(t);if(typeof n=="function")return new Proxy({},{get:(r,o)=>n()[o]});if(ac(n)&&e)return typeof e=="function"?e():e;if(!n)throw new Error("Theme is not defined");return n}function so(e=oc){return kn(e,qt)}function cc(e){return kn(e,qt)}function lc(e){var s,i;const t=[],n=typeof e.propDefaults=="function"?e.propDefaults({set:a=>a,inProps:e.props}):e.propDefaults,o=(i=(s=cc().components)==null?void 0:s[e.name])==null?void 0:i.defaultProps;return n&&t.push(n),o&&t.push(o),t.length?hr(...t,e.props):e.props}function uc(e){return de(qt.Provider,{get value(){return e.theme},get children(){return e.children}})}function dc(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function fc(e,t){switch(typeof e){case"function":return Object.assign(e,{[Io]:!0}),ot(()=>e(t));case"string":const n=gr.has(e),r=R.context?yr():dc(e,n);return pr(r,t,n),r}}function io(e,t){const n=F(e);return F(()=>fc(n(),t))}function iu(e){const[t,n]=Ut(e,["$component"]);return io(()=>t.$component,n)}function hc(e){const t=e.reduce((n,r)=>("name"in r&&(n[`--${r.name}`]="0"),Tn(n,r,{clone:!1,sortKeys:!0}),n),{});return delete t.name,t}function ao(e){return e.startsWith("--")}function gc(e){return e.startsWith("__")}function co(e){return/[^a-z-]/i.test(e)&&!ao(e)}function lo(e){return e.startsWith("@global")}function bn(e){return e.startsWith("@media")}function uo(e){return e.startsWith("@keyframes")}function tr(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function nr(e,t,n=[],r={}){const o=e.split(",").map(s=>(s=s.trim(),s.includes("&")?s:`& ${s}`));return Lt(t,(n.length?n:[""]).flatMap(s=>o.map(i=>i.replace(/&/g,s).trim())),{...r})}function rr(e,t){if(!t)return tr(e);let n=t.get(e);return n||(t.set(e,n=tr(e)),n)}function Lt(e,t=[],n={}){const r=[],o=[];for(let i in e){const a=e[i];if(!gc(i))if(lo(i))for(const c in a)o.push(...nr(c,a[c],[],n));else if(bn(i))o.push(...Lt(a,t,{...n,sublevel:!0}).map(c=>`${i} {
2
2
  ${c}
3
3
  }`));else if(ao(i))a!=null&&r.push(`${i}: ${a};`);else if(uo(i)){const c=[];for(const u in a)c.push(...Lt(a[u],[/^\d+$/.test(u)?`${u}%`:u],{...n,sublevel:!0}));o.push(`${i} {
4
4
  ${c.join(`
@@ -24,4 +24,4 @@ ${a}
24
24
  `),after:r.join(`
25
25
  `)}}const Cl="0.52.2",Sn=`https://cdn.jsdelivr.net/npm/monaco-editor@${Cl}/min/vs`,Z="/monaco/vs";let xt=null;function Sl(e,t){return new Promise((n,r)=>{const o=setTimeout(()=>r(new Error("timeout")),t);e.then(s=>{clearTimeout(o),n(s)}).catch(s=>{clearTimeout(o),r(s)})})}async function xl(){if(typeof fetch>"u")return!1;try{const e=new AbortController,t=fetch(`${Sn}/loader.js`,{method:"HEAD",signal:e.signal}),n=await Sl(t,1200);return e.abort(),n.ok}catch{return!1}}function vl(){return typeof document>"u"||document.querySelector('script[data-monaco-loader="true"]')?Promise.resolve():new Promise((t,n)=>{const r=document.createElement("script");r.dataset.monacoLoader="true",r.src=`${Z}/loader.js`,r.async=!0,r.onload=()=>t(),r.onerror=()=>n(new Error("Failed to load Monaco AMD loader")),document.head.appendChild(r)})}function Al(){if(typeof document>"u"||document.querySelector('link[data-monaco-editor-css="true"]'))return;const t=document.createElement("link");t.rel="stylesheet",t.href=`${Z}/editor/editor.main.css`,t.dataset.monacoEditorCss="true",document.head.appendChild(t)}function Ol(){const e=globalThis,t=e.MonacoEnvironment??{},n="/monaco.worker.js";e.MonacoEnvironment={...t,getWorkerUrl(r,o){return n}}}function Oo(){const e=globalThis.require;if(!e)throw new Error("Monaco AMD loader is not available");return e}function El(){const t=Oo().config;if(!t)throw new Error("require.config is not available");return t}function xn(e){const t=Oo();return new Promise((n,r)=>{t(e,(...o)=>n(o),o=>r(o))})}function Pl(e){const t=String(e||"plaintext");return!t||t==="plaintext"?null:t==="typescript"||t==="javascript"?"vs/language/typescript/monaco.contribution":t==="json"?"vs/language/json/monaco.contribution":t==="css"||t==="scss"||t==="less"?"vs/language/css/monaco.contribution":t==="html"?"vs/language/html/monaco.contribution":t==="toml"?"vs/basic-languages/toml/toml":`vs/basic-languages/${t}/${t}`}const ur=new Set,ln=new Map;async function Eo(e){const t=Pl(e);if(!t||ur.has(t))return;const n=ln.get(t);if(n)return n;const r=(async()=>{let o=!1;try{await xn([t]),o=!0}catch{}finally{o&&ur.add(t),ln.delete(t)}})();return ln.set(t,r),r}async function Po(){return xt||(xt=(async()=>{await vl(),Ol(),Al();const e=await xl(),t=El(),n={vs:Z};e&&(n["vs/basic-languages"]=`${Sn}/basic-languages`,n["vs/language"]=`${Sn}/language`,n["vs/basic-languages/python"]=`${Z}/basic-languages/python`,n["vs/basic-languages/markdown"]=`${Z}/basic-languages/markdown`,n["vs/basic-languages/cpp"]=`${Z}/basic-languages/cpp`,n["vs/basic-languages/kotlin"]=`${Z}/basic-languages/kotlin`,n["vs/language/typescript"]=`${Z}/language/typescript`,n["vs/language/html"]=`${Z}/language/html`,n["vs/language/json"]=`${Z}/language/json`,n["vs/language/css"]=`${Z}/language/css`),t({paths:n,ignoreDuplicateModules:["vs/editor/editor.main"]});const[r]=await xn(["vs/editor/editor.main"]);return await xn(["vs/basic-languages/monaco.contribution"]).catch(()=>[]),globalThis.monaco??r})(),xt)}const Ml=5,ce=new Map;function $l(e,t){ce.delete(e),ce.set(e,t)}function Tl(){for(;ce.size>Ml;){const e=ce.keys().next().value;if(!e)return;const t=ce.get(e);ce.delete(e);try{t==null||t.model.dispose()}catch{}}}function vn(e){const t=ce.get(e.cacheKey);if(t)return $l(e.cacheKey,t),t.model.getValue()!==e.value&&t.model.setValue(e.value),t.model;const n=e.monaco.Uri.parse(`opencode://model/${encodeURIComponent(e.cacheKey)}`),r=e.monaco.editor.createModel(e.value,"plaintext",n),o={model:r};return ce.set(e.cacheKey,o),Tl(),r}let vt=null;function kl(e){var o;if(vt)return vt;const t=new Map,n=new Map,r=typeof((o=e==null?void 0:e.languages)==null?void 0:o.getLanguages)=="function"?e.languages.getLanguages():[];if(Array.isArray(r))for(const s of r){const i=typeof(s==null?void 0:s.id)=="string"?s.id:null;if(!i)continue;const a=Array.isArray(s==null?void 0:s.filenames)?s.filenames:[];for(const u of a)typeof u=="string"&&(t.has(u)||t.set(u,i));const c=Array.isArray(s==null?void 0:s.extensions)?s.extensions:[];for(const u of c)typeof u=="string"&&(n.has(u)||n.set(u,i))}return vt={fileNameToId:t,extToId:n},vt}function Fl(e){return e===".gitignore"||e===".gitattributes"||e===".gitmodules"||e==="Makefile"||e.startsWith("Makefile.")?"shell":null}function Mo(e,t){const n=String(t||"").trim(),r=n.split("/").pop()||n,o=Fl(r);if(o)return o;const s=kl(e),i=s.fileNameToId.get(r);if(i)return i;const a=r.lastIndexOf(".");if(a>0){const c=r.slice(a),u=s.extToId.get(c);if(u)return u}return"plaintext"}var Il=An("<div class=monaco-viewer>");function Dl(e){const{isDark:t}=Ao();let n,r=null,o=null;const[s,i]=$(!1),a=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},c=()=>{!r||!e.onSave||e.onSave(r.getValue())},u=l=>{if(!e.compactGutter)return 5;const d=l.split(/\r\n|\r|\n/).length;return Math.max(3,String(d).length+1)};return jt(()=>{let l=!1;(async()=>(o=await Po(),!l&&(!n||!o||(o.editor.setTheme(t()?"vs-dark":"vs"),r=o.editor.create(n,{value:"",language:"plaintext",readOnly:!1,automaticLayout:!0,lineNumbers:"on",lineNumbersMinChars:u(e.content),glyphMargin:!1,folding:!e.compactGutter,lineDecorationsWidth:e.compactGutter?8:10,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",renderWhitespace:"selection",fontSize:13}),r.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KeyS,c),r.onDidChangeModelContent(()=>{e.onContentChange&&e.onContentChange(r.getValue())}),i(!0)))))(),ue(()=>{l=!0,i(!1),a()})}),W(()=>{!s()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),W(()=>{!s()||!r||r.updateOptions({wordWrap:e.wordWrap==="on"?"on":"off"})}),W(()=>{!s()||!r||r.updateOptions({lineNumbersMinChars:u(e.content),folding:!e.compactGutter,lineDecorationsWidth:e.compactGutter?8:10})}),W(()=>{if(!s()||!o||!r)return;const l=Mo(o,e.path),d=`${e.scopeKey}:file:${e.path}`,f=vn({monaco:o,cacheKey:d,value:e.content});r.setModel(f),Eo(l).then(()=>{try{o.editor.setModelLanguage(f,l)}catch{}})}),(()=>{var l=Il(),d=n;return typeof d=="function"?On(d,l):n=l,l})()}const yu=Object.freeze(Object.defineProperty({__proto__:null,MonacoFileViewer:Dl},Symbol.toStringTag,{value:"Module"}));var Ll=An("<div class=monaco-viewer><div class=git-change-context-overlay>"),Rl=An("<div class=git-change-context-widget-host><button type=button class=git-change-context-widget>+");function Nt(e){return e?e.split(`
26
26
  `).length:1}function Bt(e){return String(Math.max(1,e)).length}function Nl(e){const t=Nt(e.before),n=Nt(e.after),r=Bt(t),o=Bt(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),u=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:6+i*2+u*2}}function Bl(e){const t=Nt(e.before),n=Nt(e.after),r=Bt(t),o=Bt(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),u=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:8+i*2+u}}function Ul(e){const{isDark:t}=Ao();let n,r=null,o=null,s=null;const[i,a]=$(!1),[c,u]=$(null),[l,d]=$(null),[f,g]=$(!1),[b,C]=$(null),S=F(()=>e.patch!==void 0&&e.patch!==null?wl(e.patch):{before:e.before??"",after:e.after??""}),I=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},y=()=>{n&&(n.style.removeProperty("--split-original-line-number-width"),n.style.removeProperty("--split-original-delete-sign-left"),n.style.removeProperty("--split-original-gutter-width"))},P=m=>{if(n){if(s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),m.viewMode!=="split"||typeof window>"u"){y();return}s=window.requestAnimationFrame(()=>{if(s=null,!n)return;const w=n.querySelector(".editor.original .line-numbers"),E=(w==null?void 0:w.getBoundingClientRect().width)??0,v=E>0?E:Math.max(12,m.originalLineNumbersMinChars*6);n.style.setProperty("--split-original-line-number-width",`${v}px`),n.style.setProperty("--split-original-delete-sign-left",`${v}px`),n.style.setProperty("--split-original-gutter-width",`${v+m.lineDecorationsWidth}px`)})}},N=()=>{var m;return((m=r==null?void 0:r.getModifiedEditor)==null?void 0:m.call(r))??null},ht=()=>{const m=l();if(m)return m;if(f()&&c())return{startLine:c(),endLine:c()};const w=c();return w?{startLine:w,endLine:w}:null},K=()=>{var v,O,T,x;const m=N(),w=n;if(!m||!w)return;const E=ht();if(!E){C(null);return}try{const D=(v=m.getDomNode)==null?void 0:v.call(m);if(!D){C(null);return}const _=D.querySelector(".margin"),X=D.querySelector(".monaco-scrollable-element.editor-scrollable"),ge=((O=m.getTopForLineNumber)==null?void 0:O.call(m,E.startLine))??0,Ee=((T=m.getScrollTop)==null?void 0:T.call(m))??0,gt=Number(((x=m.getOption)==null?void 0:x.call(m,o.editor.EditorOption.lineHeight))??18),Ge=D.getBoundingClientRect(),me=w.getBoundingClientRect(),mt=Ge.left-me.left+((_==null?void 0:_.offsetWidth)??(X==null?void 0:X.offsetLeft)??0),$o=Ge.top-me.top+(ge-Ee)+gt/2;C({top:$o,left:mt})}catch{C(null)}};return jt(()=>{let m=!1;(async()=>(o=await Po(),!m&&(!n||!o||(o.editor.setTheme(t()?"vs-dark":"vs"),r=o.editor.createDiffEditor(n,{readOnly:!0,automaticLayout:!0,renderSideBySide:!0,renderSideBySideInlineBreakpoint:0,renderMarginRevertIcon:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,renderWhitespace:"selection",fontSize:13,wordWrap:e.wordWrap==="on"?"on":"off",glyphMargin:!1,folding:!1,lineNumbersMinChars:4,lineDecorationsWidth:12,diffAlgorithm:"legacy",maxComputationTime:1e4}),a(!0),K()))))(),ue(()=>{m=!0,s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),y(),a(!1),I()})}),W(()=>{!i()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),W(()=>{n&&(n.dataset.viewMode=e.viewMode==="split"?"split":"unified")}),W(()=>{var E;if(!i()||!o||!r)return;const m=(E=r.getModifiedEditor)==null?void 0:E.call(r);if(!(m!=null&&m.onDidChangeCursorSelection))return;const w=m.onDidChangeCursorSelection(v=>{var T;const O=v==null?void 0:v.selection;if(!O||(T=O.isEmpty)!=null&&T.call(O)){d(null),K();return}d({startLine:Math.min(O.startLineNumber,O.endLineNumber),endLine:Math.max(O.startLineNumber,O.endLineNumber)}),K()});ue(()=>{var v;try{(v=w==null?void 0:w.dispose)==null||v.call(w)}catch{}})}),W(()=>{var O;if(!i()||!o||!r)return;const m=N();if(!(m!=null&&m.onMouseMove)||!(m!=null&&m.onMouseLeave)||!(m!=null&&m.onMouseDown))return;const w=m.onMouseMove(T=>{var D,_;const x=(_=(D=T==null?void 0:T.target)==null?void 0:D.position)==null?void 0:_.lineNumber;u(typeof x=="number"?x:null),K()}),E=m.onMouseLeave(()=>{f()||u(null),K()}),v=(O=m.onDidScrollChange)==null?void 0:O.call(m,()=>{K()});ue(()=>{var T,x,D;try{(T=w==null?void 0:w.dispose)==null||T.call(w),(x=E==null?void 0:E.dispose)==null||x.call(E),(D=v==null?void 0:v.dispose)==null||D.call(v)}catch{}})}),W(()=>{if(!i()||!o||!r)return;ht()||C(null),K()}),W(()=>{var ge,Ee,gt,Ge,me,mt;if(!i()||!o||!r)return;const m=e.viewMode==="unified"?"unified":"split",w=e.contextMode==="collapsed"?"collapsed":"expanded",E=e.wordWrap==="on"?"on":"off",{before:v,after:O}=S(),T=m==="unified"?Nl({before:v,after:O}):Bl({before:v,after:O}),{diffEditorLineNumbersMinChars:x,originalLineNumbersMinChars:D,modifiedLineNumbersMinChars:_,lineDecorationsWidth:X}=T;r.updateOptions({renderSideBySide:m==="split",renderSideBySideInlineBreakpoint:0,renderIndicators:!0,lineNumbersMinChars:x,lineDecorationsWidth:X,hideUnchangedRegions:w==="collapsed"?{enabled:!0}:{enabled:!1},wordWrap:E});try{(gt=(Ee=(ge=r.getOriginalEditor)==null?void 0:ge.call(r))==null?void 0:Ee.updateOptions)==null||gt.call(Ee,{wordWrap:E,lineNumbersMinChars:D,lineDecorationsWidth:X})}catch{}try{(mt=(me=(Ge=r.getModifiedEditor)==null?void 0:Ge.call(r))==null?void 0:me.updateOptions)==null||mt.call(me,{wordWrap:E,lineNumbersMinChars:_,lineDecorationsWidth:X})}catch{}P({viewMode:m,originalLineNumbersMinChars:D,lineDecorationsWidth:X})}),W(()=>{if(!i()||!o||!r)return;const m=Mo(o,e.path),{before:w,after:E}=S(),v=`${e.scopeKey}:diff:${e.path}:before`,O=`${e.scopeKey}:diff:${e.path}:after`,T=vn({monaco:o,cacheKey:v,value:w}),x=vn({monaco:o,cacheKey:O,value:E});r.setModel({original:T,modified:x}),Eo(m).then(()=>{try{o.editor.setModelLanguage(T,m),o.editor.setModelLanguage(x,m)}catch{}})}),(()=>{var m=Ll(),w=m.firstChild,E=n;return typeof E=="function"?On(E,m):n=m,Et(w,de(Ro,{get when(){return b()},children:v=>(()=>{var O=Rl(),T=O.firstChild;return O.addEventListener("mouseleave",()=>{g(!1),K()}),O.addEventListener("mouseenter",()=>{g(!0),K()}),T.$$click=x=>{var _;x.preventDefault(),x.stopPropagation();const D=ht();D&&((_=e.onRequestInsertContext)==null||_.call(e,D))},T.$$mousedown=x=>{x.preventDefault(),x.stopPropagation()},le(x=>{var D=`${v().top}px`,_=`${v().left}px`,X=e.insertContextLabel??"Add git change context to prompt",ge=e.insertContextLabel??"Add git change context to prompt";return D!==x.e&&Ln(O,"top",x.e=D),_!==x.t&&Ln(O,"left",x.t=_),X!==x.a&&it(T,"aria-label",x.a=X),ge!==x.o&&it(T,"title",x.o=ge),x},{e:void 0,t:void 0,a:void 0,o:void 0}),O})()})),m})()}mr(["mousedown","click"]);const bu=Object.freeze(Object.defineProperty({__proto__:null,MonacoDiffViewer:Ul},Symbol.toStringTag,{value:"Module"}));export{Jc as $,ne as A,ei as B,ql as C,zl as D,qs as E,zn as F,Se as G,ya as H,Qi as I,na as J,j as K,eu as L,Ns as M,Vt as N,Ql as O,Kl as P,Xl as Q,Zl as R,Ri as S,Q as T,ii as U,Vl as V,Yl as W,mu as X,ou as Y,Zo as Z,xo as _,Yo as a,gu as a0,su as a1,au as a2,fu as a3,Xc as a4,Co as a5,iu as a6,lu as a7,vc as a8,uu as a9,cu as aa,hu as ab,ds as ac,du as ad,Oa as ae,Aa as af,Dr as ag,Ir as ah,nu as ai,Ti as aj,ru as ak,ta as al,ra as am,ie as an,bl as ao,yu as ap,bu as aq,pr as b,Hl as c,it as d,mr as e,Ln as f,so as g,Oe as h,Et as i,Ca as j,Ao as k,$t as l,Ho as m,he as n,tu as o,Jl as p,pu as q,Xo as r,Qo as s,An as t,On as u,Nr as v,Gl as w,rn as x,ba as y,se as z};
27
- //# sourceMappingURL=monaco-viewer-Cc9bWg7I.js.map
27
+ //# sourceMappingURL=monaco-viewer-CpxDfB-6.js.map