@dyyz1993/codenomad 0.15.0 → 0.15.2

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 (49) hide show
  1. package/dist/auth/session-manager.js +28 -0
  2. package/dist/filesystem/__tests__/search-cache.test.js +5 -5
  3. package/dist/filesystem/search-cache.js +2 -2
  4. package/dist/filesystem/search.js +6 -6
  5. package/dist/index.js +14 -5
  6. package/dist/server/routes/auth-pages/login.html +30 -19
  7. package/dist/server/routes/events.js +26 -0
  8. package/dist/server/routes/settings.js +6 -6
  9. package/dist/server/routes/speech.js +1 -1
  10. package/dist/server/routes/workspaces.js +1 -1
  11. package/dist/settings/binaries.js +8 -8
  12. package/dist/settings/service.js +17 -17
  13. package/dist/settings/yaml-doc-store.js +24 -20
  14. package/dist/sidecars/manager.js +17 -13
  15. package/dist/speech/service.js +9 -9
  16. package/dist/workspaces/instance-events.js +11 -0
  17. package/dist/workspaces/manager.js +51 -11
  18. package/dist/workspaces/runtime.js +9 -5
  19. package/package.json +1 -1
  20. package/public/assets/{ChangesTab-BRNmSjeC.js → ChangesTab-Dt-TsQMo.js} +2 -2
  21. package/public/assets/{DiffToolbar-DPPgfx42.js → DiffToolbar-BD79zzZs.js} +1 -1
  22. package/public/assets/{FilesTab-sEeGPOoz.js → FilesTab-CgB87mzq.js} +2 -2
  23. package/public/assets/{GitChangesTab-tJ-TCq0c.js → GitChangesTab-x-snPvzz.js} +2 -2
  24. package/public/assets/{SplitFilePanel-CHqNLZvU.js → SplitFilePanel-CA0D92l1.js} +1 -1
  25. package/public/assets/{StatusTab-DMd0ByCA.js → StatusTab-DJdKuILW.js} +1 -1
  26. package/public/assets/{align-justify-BWapkGTe.js → align-justify-BnvEPTpu.js} +1 -1
  27. package/public/assets/{bundle-full-CXlKQh5B.js → bundle-full-DPp09th5.js} +1 -1
  28. package/public/assets/{diff-viewer-BFtW5J8P.js → diff-viewer-DYUu2t45.js} +1 -1
  29. package/public/assets/{index-Bdy3MTIn.js → index-4Era_AEC.js} +1 -1
  30. package/public/assets/{index-D6RMBXUk.js → index-BCGPLzO4.js} +2 -2
  31. package/public/assets/{index-Dty5bSHf.js → index-BDgGoLTZ.js} +1 -1
  32. package/public/assets/{index-D-NvysdX.js → index-CbKJK9y3.js} +1 -1
  33. package/public/assets/{index-Ctq8RqRf.js → index-CpWDdROQ.js} +1 -1
  34. package/public/assets/{index-DYWkPhKo.js → index-CtBkkWFK.js} +1 -1
  35. package/public/assets/{index-D_FDiI6a.js → index-D7V1TD3s.js} +1 -1
  36. package/public/assets/{index-H16e4Rqc.js → index-PHCXc0OA.js} +1 -1
  37. package/public/assets/{index-BvRe9GiS.js → index-nVoKL-cq.js} +1 -1
  38. package/public/assets/{loading-W2Y_wR0P.js → loading-B-F_vBbv.js} +1 -1
  39. package/public/assets/{main-Bala0YJ4.js → main-DBbZ3aZQ.js} +7 -7
  40. package/public/assets/{markdown-Db8cvZ4Z.js → markdown-B_Zj0Onk.js} +3 -3
  41. package/public/assets/{monaco-viewer-DWQqXKm3.js → monaco-viewer-YY9yfE-p.js} +8 -8
  42. package/public/assets/{tool-call-D0BYXlFe.js → tool-call-CwR9rE_d.js} +3 -3
  43. package/public/assets/{unified-picker-QgONWj_1.js → unified-picker-_n2WoeTG.js} +1 -1
  44. package/public/assets/{wrap-text-CEH9wOr_.js → wrap-text-B7hZaBx4.js} +1 -1
  45. package/public/index.html +3 -3
  46. package/public/loading.html +3 -3
  47. package/public/sw.js +1 -1
  48. package/dist/opencode-config/package-lock.json +0 -380
  49. package/dist/opencode-config/package.json +0 -9
@@ -1,4 +1,4 @@
1
- var to=Object.defineProperty;var no=(e,t,n)=>t in e?to(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ot=(e,t,n)=>no(e,typeof t!="symbol"?t+"":t,n);import{c as L,u as Ge,a as ce,s as kt,b as z,r as ro,d as E,e as Hn,o as le,g as pn,f as P,$ as U,h as Ae,i as ht,j as qe,k as Ne,l as Ye,m as Gn,n as ue,p as oo,q as so,t as $t,v as io,S as ao}from"./git-diff-vendor-CSgooKT_.js";import{g as co}from"./fast-diff-vendor-DgdwVvTQ.js";const lo=["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",...lo]),fo=new Set(["innerHTML","textContent","innerText","children"]),go=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ho=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 mo(e,t){const n=ho[e];return typeof n=="object"?n[t]?n.$:void 0:n}const po=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),qn=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"]),yo={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},bo=e=>L(()=>e());function wo(e,t,n){let r=n.length,o=t.length,s=r,i=0,a=0,c=t[o-1].nextSibling,l=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 u=s<r?a?n[a-1].nextSibling:n[s-a]:c;for(;a<s;)e.insertBefore(n[a++],u)}else if(s===a)for(;i<o;)(!l||!l.has(t[i]))&&t[i].remove(),i++;else if(t[i]===n[s-1]&&n[a]===t[o-1]){const u=t[--o].nextSibling;e.insertBefore(n[a++],t[i++].nextSibling),e.insertBefore(n[--s],u),t[o]=n[s]}else{if(!l){l=new Map;let d=a;for(;d<s;)l.set(n[d],d++)}const u=l.get(t[i]);if(u!=null)if(a<u&&u<s){let d=i,g=1,m;for(;++d<o&&d<s&&!((m=l.get(t[d]))==null||m!==u+g);)g++;if(g>u-a){const p=t[i];for(;a<u;)e.insertBefore(n[a++],p)}else e.replaceChild(n[a++],t[i++])}else i++;else t[i++].remove()}}}const yn="_$DX_DELEGATE";function Dc(e,t,n,r={}){let o;return Hn(s=>{o=s,t===document?e():mt(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function on(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?()=>Ge(()=>document.importNode(o||(o=s()),!0)):()=>(o||(o=s())).cloneNode(!0);return i.cloneNode=i,i}function Jn(e,t=window.document){const n=t[yn]||(t[yn]=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,Eo))}}function Je(e,t,n){we(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Co(e,t,n,r){we(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function So(e,t,n){we(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function xo(e,t){we(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Oo(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 vo(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]||(wn(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||(wn(e,a,!0),n[a]=c)}return n}function ko(e,t,n){if(!t)return n?Je(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 bn(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function Xn(e,t={},n,r){const o={};return r||ce(()=>o.children=Xe(e,t.children,o.children)),ce(()=>typeof t.ref=="function"&&sn(t.ref,e)),ce(()=>$o(e,t,n,!0,o,!0)),o}function sn(e,t,n){return Ge(()=>e(t,n))}function mt(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return Xe(e,t,r,n);ce(o=>Xe(e,t(),o,n),r)}function $o(e,t,n,r,o={},s=!1){t||(t={});for(const i in o)if(!(i in t)){if(i==="children")continue;o[i]=Cn(e,i,null,o[i],n,s,t)}for(const i in t){if(i==="children")continue;const a=t[i];o[i]=Cn(e,i,a,o[i],n,s,t)}}function Yn(e){let t,n;return!we()||!(t=P.registry.get(n=To()))?e():(P.completed&&P.completed.add(t),P.registry.delete(n),t)}function we(e){return!!P.context&&!P.done&&(!e||e.isConnected)}function Ao(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function wn(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 Cn(e,t,n,r,o,s,i){let a,c,l,u,d;if(t==="style")return ko(e,n,r);if(t==="classList")return vo(e,n,r);if(n===r)return r;if(t==="ref")s||n(e);else if(t.slice(0,3)==="on:"){const g=t.slice(3);r&&e.removeEventListener(g,r,typeof r!="function"&&r),n&&e.addEventListener(g,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const g=t.slice(10);r&&e.removeEventListener(g,r,!0),n&&e.addEventListener(g,n,!0)}else if(t.slice(0,2)==="on"){const g=t.slice(2).toLowerCase(),m=po.has(g);if(!m&&r){const p=Array.isArray(r)?r[0]:r;e.removeEventListener(g,p)}(m||n)&&(Oo(e,g,n,m),m&&Jn([g]))}else if(t.slice(0,5)==="attr:")Je(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")So(e,t.slice(5),n);else if((d=t.slice(0,5)==="prop:")||(l=fo.has(t))||!o&&((u=mo(t,e.tagName))||(c=uo.has(t)))||(a=e.nodeName.includes("-")||"is"in i)){if(d)t=t.slice(5),c=!0;else if(we(e))return n;t==="class"||t==="className"?xo(e,n):a&&!c&&!l?e[Ao(t)]=n:e[u||t]=n}else{const g=o&&t.indexOf(":")>-1&&yo[t.split(":")[0]];g?Co(e,g,t,n):Je(e,go[t]||t,n)}return n}function Eo(e){if(P.registry&&P.events&&P.events.find(([c,l])=>l===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 l=t[`${n}Data`];if(l!==void 0?c.call(t,l,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}}),P.registry&&!P.done&&(P.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();s(c[0]);for(let l=0;l<c.length-2&&(t=c[l],!!i());l++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();s(r)}function Xe(e,t,n,r,o){const s=we(e);if(s){!n&&(n=[...e.childNodes]);let c=[];for(let l=0;l<n.length;l++){const u=n[l];u.nodeType===8&&u.data.slice(0,2)==="!$"?u.remove():c.push(u)}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=Oe(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=Oe(e,n,r)}else{if(i==="function")return ce(()=>{let c=t();for(;typeof c=="function";)c=c();n=Xe(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],l=n&&Array.isArray(n);if(zt(c,t,n,o))return ce(()=>n=Xe(e,c,n,r,!0)),()=>n;if(s){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let u=c[0];if(u.parentNode!==e)return n;const d=[u];for(;(u=u.nextSibling)!==r;)d.push(u);return n=d}if(c.length===0){if(n=Oe(e,n,r),a)return n}else l?n.length===0?Sn(e,c,r):wo(e,n,c):(n&&Oe(e),Sn(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=Oe(e,n,r,t);Oe(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function zt(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],l;if(!(a==null||a===!0||a===!1))if((l=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=zt(e,a,c)||o;else if(l==="function")if(r){for(;typeof a=="function";)a=a();o=zt(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||o}else e.push(a),o=!0;else{const u=String(a);c&&c.nodeType===3&&c.data===u?e.push(c):e.push(document.createTextNode(u))}}return o}function Sn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Oe(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 To(){return P.getNextContextId()}const Mo="http://www.w3.org/2000/svg";function Zn(e,t=!1,n=void 0){return t?document.createElementNS(Mo,e):document.createElement(e,{is:n})}function Fc(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=pn();let s,i=!!P.context;return z(()=>{i&&(pn().user=i=!1),s||(s=ro(o,()=>L(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,l]=E(!1),u=()=>l(!0);Hn(d=>mt(a,()=>c()?d():s(),null)),le(u)}else{const c=Zn(e.isSVG?"g":"div",e.isSVG),l=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),mt(l,s),a.appendChild(c),e.ref&&e.ref(c),le(()=>a.removeChild(c))}},void 0,{render:!i}),n}function Io(e,t){const n=L(e);return L(()=>{const r=n();switch(typeof r){case"function":return Ge(()=>r(t));case"string":const o=qn.has(r),s=P.context?Yn():Zn(r,o,Ge(()=>t.is));return Xn(s,t,o),s}})}function Rc(e){const[,t]=kt(e,["component"]);return Io(()=>e.component,t)}const Le=Symbol("store-raw"),ne=Symbol("store-node"),K=Symbol("store-has"),Qn=Symbol("store-self");function er(e){let t=e[U];if(!t&&(Object.defineProperty(e,U,{value:t=new Proxy(e,Lo)}),!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 Z(e){let t;return e!=null&&typeof e=="object"&&(e[U]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function oe(e,t=new Set){let n,r,o,s;if(n=e!=null&&e[Le])return n;if(!Z(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=oe(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,l=i.length;c<l;c++)s=i[c],!a[s].get&&(o=e[s],(r=oe(o,t))!==o&&(e[s]=r))}return e}function De(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function pe(e,t,n){if(e[t])return e[t];const[r,o]=E(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function Po(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===U||t===ne||(delete n.value,delete n.writable,n.get=()=>e[U][t]),n}function an(e){qe()&&pe(De(e,ne),Qn)()}function tr(e){return an(e),Reflect.ownKeys(e)}const Lo={get(e,t,n){if(t===Le)return e;if(t===U)return n;if(t===ht)return an(e),n;const r=De(e,ne),o=r[t];let s=o?o():e[t];if(t===ne||t===K||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);qe()&&(typeof s!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(s=pe(r,t,s)())}return Z(s)?er(s):s},has(e,t){return t===Le||t===U||t===ht||t===ne||t===K||t==="__proto__"?!0:(qe()&&pe(De(e,K),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:tr,getOwnPropertyDescriptor:Po};function F(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[K]&&e[K][t]&&o!==void 0&&e[K][t].$()):(e[t]=n,e[K]&&e[K][t]&&o===void 0&&e[K][t].$());let i=De(e,ne),a;if((a=pe(i,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==s){for(let c=e.length;c<s;c++)(a=i[c])&&a.$();(a=pe(i,"length",s))&&a.$(e.length)}(a=i[Qn])&&a.$()}function nr(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];F(e,o,t[o])}}function Do(e,t){if(typeof t=="function"&&(t=t(e)),t=oe(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&&F(e,n,o)}F(e,"length",r)}else nr(e,t)}function Ve(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++)Ve(e,[r[c]].concat(t),n);return}else if(a&&i==="function"){for(let c=0;c<e.length;c++)r(e[c],c)&&Ve(e,[c].concat(t),n);return}else if(a&&i==="object"){const{from:c=0,to:l=e.length-1,by:u=1}=r;for(let d=c;d<=l;d+=u)Ve(e,[d].concat(t),n);return}else if(t.length>1){Ve(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=oe(s),r===void 0||Z(o)&&Z(s)&&!Array.isArray(s)?nr(o,s):F(e,r,s))}function Nc(...[e,t]){const n=oe(e||{}),r=Array.isArray(n),o=er(n);function s(...i){Ae(()=>{r&&i.length===1?Do(n,i[0]):Ve(n,i)})}return[o,s]}function Fo(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===U||t===ne||(delete n.value,delete n.writable,n.get=()=>e[U][t],n.set=r=>e[U][t]=r),n}const Ro={get(e,t,n){if(t===Le)return e;if(t===U)return n;if(t===ht)return an(e),n;const r=De(e,ne),o=r[t];let s=o?o():e[t];if(t===ne||t===K||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t),a=typeof s=="function";if(qe()&&(!a||e.hasOwnProperty(t))&&!(i&&i.get))s=pe(r,t,s)();else if(s!=null&&a&&s===Array.prototype[t])return(...c)=>Ae(()=>Array.prototype[t].apply(n,c))}return Z(s)?rr(s):s},has(e,t){return t===Le||t===U||t===ht||t===ne||t===K||t==="__proto__"?!0:(qe()&&pe(De(e,K),t)(),t in e)},set(e,t,n){return Ae(()=>F(e,t,oe(n))),!0},deleteProperty(e,t){return Ae(()=>F(e,t,void 0,!0)),!0},ownKeys:tr,getOwnPropertyDescriptor:Fo};function rr(e){let t=e[U];if(!t){Object.defineProperty(e,U,{value:t=new Proxy(e,Ro)});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 l=r[c].get.bind(t);Object.defineProperty(e,c,{get:l,configurable:!0})}if(r[c].set){const l=r[c].set;Object.defineProperty(e,c,{set:d=>Ae(()=>l.call(t,d)),configurable:!0})}}}}return t}function No(e,t){const n=oe(e||{});return rr(n)}const Kt=Symbol("store-root");function ke(e,t,n,r,o){const s=t[n];if(e===s)return;const i=Array.isArray(e);if(n!==Kt&&(!Z(e)||!Z(s)||i!==Array.isArray(s)||o&&e[o]!==s[o])){F(t,n,e);return}if(i){if(e.length&&s.length&&(!r||o&&e[0]&&e[0][o]!=null)){let l,u,d,g,m,p,C,b;for(d=0,g=Math.min(s.length,e.length);d<g&&(s[d]===e[d]||o&&s[d]&&e[d]&&s[d][o]&&s[d][o]===e[d][o]);d++)ke(e[d],s,d,r,o);const I=new Array(e.length),R=new Map;for(g=s.length-1,m=e.length-1;g>=d&&m>=d&&(s[g]===e[m]||o&&s[g]&&e[m]&&s[g][o]&&s[g][o]===e[m][o]);g--,m--)I[m]=s[g];if(d>m||d>g){for(u=d;u<=m;u++)F(s,u,e[u]);for(;u<e.length;u++)F(s,u,I[u]),ke(e[u],s,u,r,o);s.length>e.length&&F(s,"length",e.length);return}for(C=new Array(m+1),u=m;u>=d;u--)p=e[u],b=o&&p?p[o]:p,l=R.get(b),C[u]=l===void 0?-1:l,R.set(b,u);for(l=d;l<=g;l++)p=s[l],b=o&&p?p[o]:p,u=R.get(b),u!==void 0&&u!==-1&&(I[u]=s[l],u=C[u],R.set(b,u));for(u=d;u<e.length;u++)u in I?(F(s,u,I[u]),ke(e[u],s,u,r,o)):F(s,u,e[u])}else for(let l=0,u=e.length;l<u;l++)ke(e[l],s,l,r,o);s.length>e.length&&F(s,"length",e.length);return}const a=Object.keys(e);for(let l=0,u=a.length;l<u;l++)ke(e[a[l]],s,a[l],r,o);const c=Object.keys(s);for(let l=0,u=c.length;l<u;l++)e[c[l]]===void 0&&F(s,c[l],void 0)}function Uc(e,t={}){const{merge:n,key:r="id"}=t,o=oe(e);return s=>{if(!Z(s)||!Z(o))return o;const i=ke(o,{[Kt]:s},Kt,n,r);return i===void 0?s:i}}const pt=new WeakMap,or={get(e,t){if(t===Le)return e;const n=e[t];let r;return Z(n)?pt.get(n)||(pt.set(n,r=new Proxy(n,or)),r):n},set(e,t,n){return F(e,t,oe(n)),!0},deleteProperty(e,t){return F(e,t,void 0,!0),!0}};function Bc(e){return t=>{if(Z(t)){let n;(n=pt.get(t))||pt.set(t,n=new Proxy(t,or)),e(n)}return t}}function cn(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Uo(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 ye(e){if(typeof e!="string")return e;if(e.charAt(0)==="#")return ye(Uo(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 At(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 Bo(e){const t=ye(e),{values:n}=t,r=n[0],o=n[1]/100,s=n[2]/100,i=o*Math.min(s,1-s),a=(u,d=(u+r/30)%12)=>s-i*Math.max(Math.min(d-3,9-d,1),-1);let c="rgb";const l=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return t.type==="hsla"&&(c+="a",l.push(n[3])),At({type:c,values:l})}function xn(e){const{type:t,values:n}=ye(e);let r=t==="hsl"?ye(Bo(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 _o(e,t){const n=xn(e),r=xn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function _c(e,t){let{type:n,values:r}=ye(e);return t=cn(t),(n==="rgb"||n==="hsl")&&(n+="a"),n==="color"?r[3]=`/${t}`:r[3]=t,At({type:n,values:r})}function jo(e,t){const n=ye(e);if(t=cn(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 At(n)}function Vo(e,t){const n=ye(e);if(t=cn(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 At(n)}const Wo={xs:0,sm:600,md:900,lg:1200,xl:1536};function zo(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||Wo).indexOf(c)!==-1)a={...a,...s.up(c,n(t[c],c))};else{const l=c;a[l]=t[l]}return a},{})}return n(t)}const Ko={cleanupStyles:!0},Ho=Ne(Ko),be={black:"#000",white:"#fff"},Ee={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Te={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Me={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Ie={300:"#4fc3f7",400:"#29b6f6",700:"#0288d1",800:"#0277bd",900:"#01579b"},Pe={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},Ke={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Go={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 We(e){return e!==null&&typeof e=="object"&&e.constructor===Object}function qo(e,t){for(const n of t){const r=e[n];delete e[n],e[n]=r}}function ln(e,t,n={clone:!0}){const r=n.clone?{...e}:e,o=n.sortKeys?[]:void 0;return We(e)&&We(t)&&(Object.keys(t).forEach(s=>{if(s==="__proto__")return;o&&o.push(s);let i,a;We(i=t[s])&&s in e&&We(a=e[s])?r[s]=ln(a,i,n):i!==void 0&&(r[s]=i)}),o&&qo(r,o)),r}function Ht(e){if(Array.isArray(e)){const t=[];for(const n of e)t.push(Ht(n));return t}else if(We(e)){const t={};for(const n in e)n!=="__proto__"&&(t[n]=Ht(e[n]));return t}else return e}function Ze(e,...t){for(const n of t)ln(e,Ht(n),{clone:!1});return e}const Jo=()=>({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:be.white,default:be.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}}),Xo={primary:{main:Me[700],light:Me[400],dark:Me[800]},secondary:{main:Te[500],light:Te[300],dark:Te[700]},error:{main:Ee[700],light:Ee[400],dark:Ee[800]},info:{main:Ie[700],light:Ie[800],dark:Ie[900]},success:{main:Pe[800],light:Pe[500],dark:Pe[900]},warning:{main:"#ED6C02",light:Ke[500],dark:Ke[900]}},Yo=()=>({text:{primary:be.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:be.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}}),Zo={primary:{main:Me[200],light:Me[50],dark:Me[400]},secondary:{main:Te[200],light:Te[50],dark:Te[400]},error:{main:Ee[500],light:Ee[300],dark:Ee[700]},info:{main:Ie[400],light:Ie[300],dark:Ie[700]},success:{main:Pe[400],light:Pe[300],dark:Pe[700]},warning:{main:Ke[400],light:Ke[300],dark:Ke[700]}},Qo={light:Jo,dark:Yo};function sr(e,t){return _o(e,be.white)>=t?be.white:"rgba(0, 0, 0, 0.87)"}function On(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=Vo(e.main,o):t==="dark"&&(e.dark=jo(e.main,s)))}function es(e){const t={...e.color},n=e.mainShade??500;return!e.color.main&&e.color[n]&&(t.main=e.color[n]),On(t,"light",e.lightShade??300,e.tonalOffset),On(t,"dark",e.darkShade??700,e.tonalOffset),t.contrastText||(t.contrastText=sr(t.main,e.contrastThreshold)),t}const ts=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:Go,common:be});function ns(e){const t=["error","info","primary","secondary","success","warning"],n=ts(),r={...Ze({},n,Qo[(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 es({...s,tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold})},getContrastText(s){return sr(s,r.contrastThreshold)}},o=s=>r.mode==="light"?Xo[s]:Zo[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 rs={};function os(e){return{...Ze({},rs,e??{})}}function ss(e,t=void 0,n={}){return{toolbar:{minHeight:56,[`${e.up("xs")} and (orientation: landscape)`]:{minHeight:48},[e.up("sm")]:{minHeight:64}},...n}}const Ft={},is=.2,as=.14,cs=.12;function k(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${is})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${as})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${cs})`].join(",")}const ls=[()=>"none",()=>k(0,2,1,-1,0,1,1,0,0,1,3,0),()=>k(0,3,1,-2,0,2,2,0,0,1,5,0),()=>k(0,3,3,-2,0,3,4,0,0,1,8,0),()=>k(0,2,4,-1,0,4,5,0,0,1,10,0),()=>k(0,3,5,-1,0,5,8,0,0,1,14,0),()=>k(0,3,5,-1,0,6,10,0,0,1,18,0),()=>k(0,4,5,-2,0,7,10,1,0,2,16,1),()=>k(0,5,5,-3,0,8,10,1,0,3,14,2),()=>k(0,5,6,-3,0,9,12,1,0,3,16,2),()=>k(0,6,6,-3,0,10,14,1,0,4,18,3),()=>k(0,6,7,-4,0,11,15,1,0,4,20,3),()=>k(0,7,8,-4,0,12,17,2,0,5,22,4),()=>k(0,7,8,-4,0,13,19,2,0,5,24,4),()=>k(0,7,9,-4,0,14,21,2,0,5,26,4),()=>k(0,8,9,-5,0,15,22,2,0,6,28,5),()=>k(0,8,10,-5,0,16,24,2,0,6,30,5),()=>k(0,8,11,-5,0,17,26,2,0,6,32,5),()=>k(0,9,11,-5,0,18,28,2,0,7,34,6),()=>k(0,9,12,-6,0,19,29,2,0,7,36,6),()=>k(0,10,13,-6,0,20,31,3,0,8,38,7),()=>k(0,10,13,-6,0,21,33,3,0,8,40,7),()=>k(0,10,14,-6,0,22,35,3,0,8,42,7),()=>k(0,11,14,-7,0,23,36,3,0,9,44,8),()=>k(0,11,15,-7,0,24,38,3,0,9,46,8)];function us(){return new Proxy([],{get:(e,t)=>typeof t!="string"||isNaN(Number(t))?e[t]:t in Ft?Ft[t]:Ft[t]=ls[t]()})}const ds={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)"},fs={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function vn(e){return`${Math.round(e)}ms`}function gs(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function hs(e){const t={...ds,...e.easing},n={...fs,...e.duration};return{getAutoHeightDuration:gs,create:(o=["all"],s={})=>{const{duration:i=n.standard,easing:a=t.easeInOut,delay:c=0,...l}=s;return(Array.isArray(o)?o:[o]).map(u=>`${u} ${typeof i=="string"?i:vn(i)} ${a} ${typeof c=="string"?c:vn(c)}`).join(",")},...e,easing:t,duration:n}}const _={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 ms(e){return Math.round(e*1e5)/1e5}function j(e,t,n,r,o,s){return{fontFamily:e.fontFamily,fontWeight:t,fontSize:e.pxToRem(n),lineHeight:`${r}`,letterSpacing:`${ms(o/n)}em`,...s?{textTransform:"uppercase"}:{}}}function ps(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 Ze(st,t,{h1:j(t,_.light,96,1.167,-1.5),h2:j(t,_.light,60,1.2,-.5),h3:j(t,_.regular,48,1.167,0),h4:j(t,_.regular,34,1.235,.25),h5:j(t,_.regular,24,1.334,0),h6:j(t,_.medium,20,1.6,.15),subtitle1:j(t,_.regular,16,1.75,.15),subtitle2:j(t,_.medium,14,1.57,.1),body1:j(t,_.regular,16,1.5,.15),body2:j(t,_.regular,14,1.43,.15),button:j(t,_.medium,14,1.75,.4,!0),caption:j(t,_.regular,12,1.66,.4),overline:j(t,_.regular,12,2.66,1,!0)},e)}const ys={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function bs(e){return{...Ze({},ys,e)}}function Rt(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 ws={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function ir(e){const t={...ws,...e??{},up:(n,r)=>{const o=Rt("up",t.resolve(n));return r?{[o]:r}:o},down:(n,r)=>{const o=Rt("down",t.resolve(n));return r?{[o]:r}:o},between:(n,r)=>{const o=Rt("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 ar(e){return typeof e=="function"?e:(...n)=>n.map(r=>typeof r=="number"?`${r*(e??8)}px`:r).join(" ")}const Cs={borderRadius:4};function cr(e){return{...Ze({},Cs,e)}}function lr(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=>ir(r.breakpoints)),n("components",r=>os(r.components)),n("palette",r=>ns(r.palette)),n("shape",r=>cr(r.shape)),n("spacing",r=>ar(r.spacing)),n("typography",r=>ps(r.typography)),n("shadows",()=>us()),n("transitions",()=>hs({})),n("zIndex",r=>bs(r.zIndex)),n("mixins",()=>ss(t.breakpoints)),t}function ur(e){let t;return function(){return t||(t=e()),t}}const Ss=ur(lr);let dr;dr=Ne({});const Et=dr;function xs(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:ir(e==null?void 0:e.breakpoints),shape:cr(e==null?void 0:e.shape),spacing:ar(e==null?void 0:e.spacing)}}const Os=ur(xs);function vs(e){for(const t in e)return!1;return!0}function un(e=Os,t=Et){const n=Ye(t);if(typeof n=="function")return new Proxy({},{get:(r,o)=>n()[o]});if(vs(n)&&e)return typeof e=="function"?e():e;if(!n)throw new Error("Theme is not defined");return n}function fr(e=Ss){return un(e,Et)}function ks(e){return un(e,Et)}function $s(e){var s,i;const t=[],n=typeof e.propDefaults=="function"?e.propDefaults({set:a=>a,inProps:e.props}):e.propDefaults,o=(i=(s=ks().components)==null?void 0:s[e.name])==null?void 0:i.defaultProps;return n&&t.push(n),o&&t.push(o),t.length?Gn(...t,e.props):e.props}function As(e){return ue(Et.Provider,{get value(){return e.theme},get children(){return e.children}})}function Es(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function Ts(e,t){switch(typeof e){case"function":return Object.assign(e,{[oo]:!0}),Ge(()=>e(t));case"string":const n=qn.has(e),r=P.context?Yn():Es(e,n);return Xn(r,t,n),r}}function gr(e,t){const n=L(e);return L(()=>Ts(n(),t))}function jc(e){const[t,n]=kt(e,["$component"]);return gr(()=>t.$component,n)}function Ms(e){const t=e.reduce((n,r)=>("name"in r&&(n[`--${r.name}`]="0"),ln(n,r,{clone:!1,sortKeys:!0}),n),{});return delete t.name,t}function hr(e){return e.startsWith("--")}function Is(e){return e.startsWith("__")}function mr(e){return/[^a-z-]/i.test(e)&&!hr(e)}function pr(e){return e.startsWith("@global")}function Gt(e){return e.startsWith("@media")}function yr(e){return e.startsWith("@keyframes")}function kn(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function $n(e,t,n=[],r={}){const o=e.split(",").map(s=>(s=s.trim(),s.includes("&")?s:`& ${s}`));return yt(t,(n.length?n:[""]).flatMap(s=>o.map(i=>i.replace(/&/g,s).trim())),{...r})}function An(e,t){if(!t)return kn(e);let n=t.get(e);return n||(t.set(e,n=kn(e)),n)}function yt(e,t=[],n={}){const r=[],o=[];for(let i in e){const a=e[i];if(!Is(i))if(pr(i))for(const c in a)o.push(...$n(c,a[c],[],n));else if(Gt(i))o.push(...yt(a,t,{...n,sublevel:!0}).map(c=>`${i} {
1
+ var to=Object.defineProperty;var no=(e,t,n)=>t in e?to(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ot=(e,t,n)=>no(e,typeof t!="symbol"?t+"":t,n);import{c as L,u as Ge,a as ue,s as kt,b as z,r as ro,d as E,e as Hn,o as de,g as pn,f as P,$ as U,h as Ae,i as ht,j as qe,k as Ne,l as Ye,m as Gn,n as fe,p as oo,q as so,t as $t,v as io,S as ao}from"./git-diff-vendor-CSgooKT_.js";import{g as co}from"./fast-diff-vendor-DgdwVvTQ.js";const lo=["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",...lo]),fo=new Set(["innerHTML","textContent","innerText","children"]),go=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ho=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 mo(e,t){const n=ho[e];return typeof n=="object"?n[t]?n.$:void 0:n}const po=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),qn=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"]),yo={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},bo=e=>L(()=>e());function wo(e,t,n){let r=n.length,o=t.length,s=r,i=0,a=0,c=t[o-1].nextSibling,l=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 u=s<r?a?n[a-1].nextSibling:n[s-a]:c;for(;a<s;)e.insertBefore(n[a++],u)}else if(s===a)for(;i<o;)(!l||!l.has(t[i]))&&t[i].remove(),i++;else if(t[i]===n[s-1]&&n[a]===t[o-1]){const u=t[--o].nextSibling;e.insertBefore(n[a++],t[i++].nextSibling),e.insertBefore(n[--s],u),t[o]=n[s]}else{if(!l){l=new Map;let d=a;for(;d<s;)l.set(n[d],d++)}const u=l.get(t[i]);if(u!=null)if(a<u&&u<s){let d=i,g=1,m;for(;++d<o&&d<s&&!((m=l.get(t[d]))==null||m!==u+g);)g++;if(g>u-a){const p=t[i];for(;a<u;)e.insertBefore(n[a++],p)}else e.replaceChild(n[a++],t[i++])}else i++;else t[i++].remove()}}}const yn="_$DX_DELEGATE";function Rc(e,t,n,r={}){let o;return Hn(s=>{o=s,t===document?e():mt(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function on(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?()=>Ge(()=>document.importNode(o||(o=s()),!0)):()=>(o||(o=s())).cloneNode(!0);return i.cloneNode=i,i}function Jn(e,t=window.document){const n=t[yn]||(t[yn]=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,Eo))}}function Je(e,t,n){we(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Co(e,t,n,r){we(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function So(e,t,n){we(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function xo(e,t){we(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Oo(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 vo(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]||(wn(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||(wn(e,a,!0),n[a]=c)}return n}function ko(e,t,n){if(!t)return n?Je(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 bn(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function Xn(e,t={},n,r){const o={};return r||ue(()=>o.children=Xe(e,t.children,o.children)),ue(()=>typeof t.ref=="function"&&sn(t.ref,e)),ue(()=>$o(e,t,n,!0,o,!0)),o}function sn(e,t,n){return Ge(()=>e(t,n))}function mt(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return Xe(e,t,r,n);ue(o=>Xe(e,t(),o,n),r)}function $o(e,t,n,r,o={},s=!1){t||(t={});for(const i in o)if(!(i in t)){if(i==="children")continue;o[i]=Cn(e,i,null,o[i],n,s,t)}for(const i in t){if(i==="children")continue;const a=t[i];o[i]=Cn(e,i,a,o[i],n,s,t)}}function Yn(e){let t,n;return!we()||!(t=P.registry.get(n=To()))?e():(P.completed&&P.completed.add(t),P.registry.delete(n),t)}function we(e){return!!P.context&&!P.done&&(!e||e.isConnected)}function Ao(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function wn(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 Cn(e,t,n,r,o,s,i){let a,c,l,u,d;if(t==="style")return ko(e,n,r);if(t==="classList")return vo(e,n,r);if(n===r)return r;if(t==="ref")s||n(e);else if(t.slice(0,3)==="on:"){const g=t.slice(3);r&&e.removeEventListener(g,r,typeof r!="function"&&r),n&&e.addEventListener(g,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const g=t.slice(10);r&&e.removeEventListener(g,r,!0),n&&e.addEventListener(g,n,!0)}else if(t.slice(0,2)==="on"){const g=t.slice(2).toLowerCase(),m=po.has(g);if(!m&&r){const p=Array.isArray(r)?r[0]:r;e.removeEventListener(g,p)}(m||n)&&(Oo(e,g,n,m),m&&Jn([g]))}else if(t.slice(0,5)==="attr:")Je(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")So(e,t.slice(5),n);else if((d=t.slice(0,5)==="prop:")||(l=fo.has(t))||!o&&((u=mo(t,e.tagName))||(c=uo.has(t)))||(a=e.nodeName.includes("-")||"is"in i)){if(d)t=t.slice(5),c=!0;else if(we(e))return n;t==="class"||t==="className"?xo(e,n):a&&!c&&!l?e[Ao(t)]=n:e[u||t]=n}else{const g=o&&t.indexOf(":")>-1&&yo[t.split(":")[0]];g?Co(e,g,t,n):Je(e,go[t]||t,n)}return n}function Eo(e){if(P.registry&&P.events&&P.events.find(([c,l])=>l===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 l=t[`${n}Data`];if(l!==void 0?c.call(t,l,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}}),P.registry&&!P.done&&(P.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();s(c[0]);for(let l=0;l<c.length-2&&(t=c[l],!!i());l++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();s(r)}function Xe(e,t,n,r,o){const s=we(e);if(s){!n&&(n=[...e.childNodes]);let c=[];for(let l=0;l<n.length;l++){const u=n[l];u.nodeType===8&&u.data.slice(0,2)==="!$"?u.remove():c.push(u)}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=Oe(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=Oe(e,n,r)}else{if(i==="function")return ue(()=>{let c=t();for(;typeof c=="function";)c=c();n=Xe(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],l=n&&Array.isArray(n);if(zt(c,t,n,o))return ue(()=>n=Xe(e,c,n,r,!0)),()=>n;if(s){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let u=c[0];if(u.parentNode!==e)return n;const d=[u];for(;(u=u.nextSibling)!==r;)d.push(u);return n=d}if(c.length===0){if(n=Oe(e,n,r),a)return n}else l?n.length===0?Sn(e,c,r):wo(e,n,c):(n&&Oe(e),Sn(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=Oe(e,n,r,t);Oe(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function zt(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],l;if(!(a==null||a===!0||a===!1))if((l=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=zt(e,a,c)||o;else if(l==="function")if(r){for(;typeof a=="function";)a=a();o=zt(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||o}else e.push(a),o=!0;else{const u=String(a);c&&c.nodeType===3&&c.data===u?e.push(c):e.push(document.createTextNode(u))}}return o}function Sn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Oe(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 To(){return P.getNextContextId()}const Mo="http://www.w3.org/2000/svg";function Zn(e,t=!1,n=void 0){return t?document.createElementNS(Mo,e):document.createElement(e,{is:n})}function Nc(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=pn();let s,i=!!P.context;return z(()=>{i&&(pn().user=i=!1),s||(s=ro(o,()=>L(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,l]=E(!1),u=()=>l(!0);Hn(d=>mt(a,()=>c()?d():s(),null)),de(u)}else{const c=Zn(e.isSVG?"g":"div",e.isSVG),l=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),mt(l,s),a.appendChild(c),e.ref&&e.ref(c),de(()=>a.removeChild(c))}},void 0,{render:!i}),n}function Io(e,t){const n=L(e);return L(()=>{const r=n();switch(typeof r){case"function":return Ge(()=>r(t));case"string":const o=qn.has(r),s=P.context?Yn():Zn(r,o,Ge(()=>t.is));return Xn(s,t,o),s}})}function Uc(e){const[,t]=kt(e,["component"]);return Io(()=>e.component,t)}const Le=Symbol("store-raw"),ne=Symbol("store-node"),K=Symbol("store-has"),Qn=Symbol("store-self");function er(e){let t=e[U];if(!t&&(Object.defineProperty(e,U,{value:t=new Proxy(e,Lo)}),!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 Z(e){let t;return e!=null&&typeof e=="object"&&(e[U]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function se(e,t=new Set){let n,r,o,s;if(n=e!=null&&e[Le])return n;if(!Z(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=se(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,l=i.length;c<l;c++)s=i[c],!a[s].get&&(o=e[s],(r=se(o,t))!==o&&(e[s]=r))}return e}function De(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function pe(e,t,n){if(e[t])return e[t];const[r,o]=E(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function Po(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===U||t===ne||(delete n.value,delete n.writable,n.get=()=>e[U][t]),n}function an(e){qe()&&pe(De(e,ne),Qn)()}function tr(e){return an(e),Reflect.ownKeys(e)}const Lo={get(e,t,n){if(t===Le)return e;if(t===U)return n;if(t===ht)return an(e),n;const r=De(e,ne),o=r[t];let s=o?o():e[t];if(t===ne||t===K||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t);qe()&&(typeof s!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(s=pe(r,t,s)())}return Z(s)?er(s):s},has(e,t){return t===Le||t===U||t===ht||t===ne||t===K||t==="__proto__"?!0:(qe()&&pe(De(e,K),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:tr,getOwnPropertyDescriptor:Po};function F(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[K]&&e[K][t]&&o!==void 0&&e[K][t].$()):(e[t]=n,e[K]&&e[K][t]&&o===void 0&&e[K][t].$());let i=De(e,ne),a;if((a=pe(i,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==s){for(let c=e.length;c<s;c++)(a=i[c])&&a.$();(a=pe(i,"length",s))&&a.$(e.length)}(a=i[Qn])&&a.$()}function nr(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];F(e,o,t[o])}}function Do(e,t){if(typeof t=="function"&&(t=t(e)),t=se(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&&F(e,n,o)}F(e,"length",r)}else nr(e,t)}function Ve(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++)Ve(e,[r[c]].concat(t),n);return}else if(a&&i==="function"){for(let c=0;c<e.length;c++)r(e[c],c)&&Ve(e,[c].concat(t),n);return}else if(a&&i==="object"){const{from:c=0,to:l=e.length-1,by:u=1}=r;for(let d=c;d<=l;d+=u)Ve(e,[d].concat(t),n);return}else if(t.length>1){Ve(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=se(s),r===void 0||Z(o)&&Z(s)&&!Array.isArray(s)?nr(o,s):F(e,r,s))}function Bc(...[e,t]){const n=se(e||{}),r=Array.isArray(n),o=er(n);function s(...i){Ae(()=>{r&&i.length===1?Do(n,i[0]):Ve(n,i)})}return[o,s]}function Fo(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===U||t===ne||(delete n.value,delete n.writable,n.get=()=>e[U][t],n.set=r=>e[U][t]=r),n}const Ro={get(e,t,n){if(t===Le)return e;if(t===U)return n;if(t===ht)return an(e),n;const r=De(e,ne),o=r[t];let s=o?o():e[t];if(t===ne||t===K||t==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(e,t),a=typeof s=="function";if(qe()&&(!a||e.hasOwnProperty(t))&&!(i&&i.get))s=pe(r,t,s)();else if(s!=null&&a&&s===Array.prototype[t])return(...c)=>Ae(()=>Array.prototype[t].apply(n,c))}return Z(s)?rr(s):s},has(e,t){return t===Le||t===U||t===ht||t===ne||t===K||t==="__proto__"?!0:(qe()&&pe(De(e,K),t)(),t in e)},set(e,t,n){return Ae(()=>F(e,t,se(n))),!0},deleteProperty(e,t){return Ae(()=>F(e,t,void 0,!0)),!0},ownKeys:tr,getOwnPropertyDescriptor:Fo};function rr(e){let t=e[U];if(!t){Object.defineProperty(e,U,{value:t=new Proxy(e,Ro)});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 l=r[c].get.bind(t);Object.defineProperty(e,c,{get:l,configurable:!0})}if(r[c].set){const l=r[c].set;Object.defineProperty(e,c,{set:d=>Ae(()=>l.call(t,d)),configurable:!0})}}}}return t}function No(e,t){const n=se(e||{});return rr(n)}const Kt=Symbol("store-root");function ke(e,t,n,r,o){const s=t[n];if(e===s)return;const i=Array.isArray(e);if(n!==Kt&&(!Z(e)||!Z(s)||i!==Array.isArray(s)||o&&e[o]!==s[o])){F(t,n,e);return}if(i){if(e.length&&s.length&&(!r||o&&e[0]&&e[0][o]!=null)){let l,u,d,g,m,p,C,b;for(d=0,g=Math.min(s.length,e.length);d<g&&(s[d]===e[d]||o&&s[d]&&e[d]&&s[d][o]&&s[d][o]===e[d][o]);d++)ke(e[d],s,d,r,o);const I=new Array(e.length),R=new Map;for(g=s.length-1,m=e.length-1;g>=d&&m>=d&&(s[g]===e[m]||o&&s[g]&&e[m]&&s[g][o]&&s[g][o]===e[m][o]);g--,m--)I[m]=s[g];if(d>m||d>g){for(u=d;u<=m;u++)F(s,u,e[u]);for(;u<e.length;u++)F(s,u,I[u]),ke(e[u],s,u,r,o);s.length>e.length&&F(s,"length",e.length);return}for(C=new Array(m+1),u=m;u>=d;u--)p=e[u],b=o&&p?p[o]:p,l=R.get(b),C[u]=l===void 0?-1:l,R.set(b,u);for(l=d;l<=g;l++)p=s[l],b=o&&p?p[o]:p,u=R.get(b),u!==void 0&&u!==-1&&(I[u]=s[l],u=C[u],R.set(b,u));for(u=d;u<e.length;u++)u in I?(F(s,u,I[u]),ke(e[u],s,u,r,o)):F(s,u,e[u])}else for(let l=0,u=e.length;l<u;l++)ke(e[l],s,l,r,o);s.length>e.length&&F(s,"length",e.length);return}const a=Object.keys(e);for(let l=0,u=a.length;l<u;l++)ke(e[a[l]],s,a[l],r,o);const c=Object.keys(s);for(let l=0,u=c.length;l<u;l++)e[c[l]]===void 0&&F(s,c[l],void 0)}function _c(e,t={}){const{merge:n,key:r="id"}=t,o=se(e);return s=>{if(!Z(s)||!Z(o))return o;const i=ke(o,{[Kt]:s},Kt,n,r);return i===void 0?s:i}}const pt=new WeakMap,or={get(e,t){if(t===Le)return e;const n=e[t];let r;return Z(n)?pt.get(n)||(pt.set(n,r=new Proxy(n,or)),r):n},set(e,t,n){return F(e,t,se(n)),!0},deleteProperty(e,t){return F(e,t,void 0,!0),!0}};function jc(e){return t=>{if(Z(t)){let n;(n=pt.get(t))||pt.set(t,n=new Proxy(t,or)),e(n)}return t}}function cn(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Uo(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 ye(e){if(typeof e!="string")return e;if(e.charAt(0)==="#")return ye(Uo(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 At(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 Bo(e){const t=ye(e),{values:n}=t,r=n[0],o=n[1]/100,s=n[2]/100,i=o*Math.min(s,1-s),a=(u,d=(u+r/30)%12)=>s-i*Math.max(Math.min(d-3,9-d,1),-1);let c="rgb";const l=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return t.type==="hsla"&&(c+="a",l.push(n[3])),At({type:c,values:l})}function xn(e){const{type:t,values:n}=ye(e);let r=t==="hsl"?ye(Bo(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 _o(e,t){const n=xn(e),r=xn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Vc(e,t){let{type:n,values:r}=ye(e);return t=cn(t),(n==="rgb"||n==="hsl")&&(n+="a"),n==="color"?r[3]=`/${t}`:r[3]=t,At({type:n,values:r})}function jo(e,t){const n=ye(e);if(t=cn(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 At(n)}function Vo(e,t){const n=ye(e);if(t=cn(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 At(n)}const Wo={xs:0,sm:600,md:900,lg:1200,xl:1536};function zo(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||Wo).indexOf(c)!==-1)a={...a,...s.up(c,n(t[c],c))};else{const l=c;a[l]=t[l]}return a},{})}return n(t)}const Ko={cleanupStyles:!0},Ho=Ne(Ko),be={black:"#000",white:"#fff"},Ee={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Te={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Me={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Ie={300:"#4fc3f7",400:"#29b6f6",700:"#0288d1",800:"#0277bd",900:"#01579b"},Pe={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},Ke={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Go={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 We(e){return e!==null&&typeof e=="object"&&e.constructor===Object}function qo(e,t){for(const n of t){const r=e[n];delete e[n],e[n]=r}}function ln(e,t,n={clone:!0}){const r=n.clone?{...e}:e,o=n.sortKeys?[]:void 0;return We(e)&&We(t)&&(Object.keys(t).forEach(s=>{if(s==="__proto__")return;o&&o.push(s);let i,a;We(i=t[s])&&s in e&&We(a=e[s])?r[s]=ln(a,i,n):i!==void 0&&(r[s]=i)}),o&&qo(r,o)),r}function Ht(e){if(Array.isArray(e)){const t=[];for(const n of e)t.push(Ht(n));return t}else if(We(e)){const t={};for(const n in e)n!=="__proto__"&&(t[n]=Ht(e[n]));return t}else return e}function Ze(e,...t){for(const n of t)ln(e,Ht(n),{clone:!1});return e}const Jo=()=>({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:be.white,default:be.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}}),Xo={primary:{main:Me[700],light:Me[400],dark:Me[800]},secondary:{main:Te[500],light:Te[300],dark:Te[700]},error:{main:Ee[700],light:Ee[400],dark:Ee[800]},info:{main:Ie[700],light:Ie[800],dark:Ie[900]},success:{main:Pe[800],light:Pe[500],dark:Pe[900]},warning:{main:"#ED6C02",light:Ke[500],dark:Ke[900]}},Yo=()=>({text:{primary:be.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:be.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}}),Zo={primary:{main:Me[200],light:Me[50],dark:Me[400]},secondary:{main:Te[200],light:Te[50],dark:Te[400]},error:{main:Ee[500],light:Ee[300],dark:Ee[700]},info:{main:Ie[400],light:Ie[300],dark:Ie[700]},success:{main:Pe[400],light:Pe[300],dark:Pe[700]},warning:{main:Ke[400],light:Ke[300],dark:Ke[700]}},Qo={light:Jo,dark:Yo};function sr(e,t){return _o(e,be.white)>=t?be.white:"rgba(0, 0, 0, 0.87)"}function On(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=Vo(e.main,o):t==="dark"&&(e.dark=jo(e.main,s)))}function es(e){const t={...e.color},n=e.mainShade??500;return!e.color.main&&e.color[n]&&(t.main=e.color[n]),On(t,"light",e.lightShade??300,e.tonalOffset),On(t,"dark",e.darkShade??700,e.tonalOffset),t.contrastText||(t.contrastText=sr(t.main,e.contrastThreshold)),t}const ts=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:Go,common:be});function ns(e){const t=["error","info","primary","secondary","success","warning"],n=ts(),r={...Ze({},n,Qo[(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 es({...s,tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold})},getContrastText(s){return sr(s,r.contrastThreshold)}},o=s=>r.mode==="light"?Xo[s]:Zo[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 rs={};function os(e){return{...Ze({},rs,e??{})}}function ss(e,t=void 0,n={}){return{toolbar:{minHeight:56,[`${e.up("xs")} and (orientation: landscape)`]:{minHeight:48},[e.up("sm")]:{minHeight:64}},...n}}const Ft={},is=.2,as=.14,cs=.12;function k(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${is})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${as})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${cs})`].join(",")}const ls=[()=>"none",()=>k(0,2,1,-1,0,1,1,0,0,1,3,0),()=>k(0,3,1,-2,0,2,2,0,0,1,5,0),()=>k(0,3,3,-2,0,3,4,0,0,1,8,0),()=>k(0,2,4,-1,0,4,5,0,0,1,10,0),()=>k(0,3,5,-1,0,5,8,0,0,1,14,0),()=>k(0,3,5,-1,0,6,10,0,0,1,18,0),()=>k(0,4,5,-2,0,7,10,1,0,2,16,1),()=>k(0,5,5,-3,0,8,10,1,0,3,14,2),()=>k(0,5,6,-3,0,9,12,1,0,3,16,2),()=>k(0,6,6,-3,0,10,14,1,0,4,18,3),()=>k(0,6,7,-4,0,11,15,1,0,4,20,3),()=>k(0,7,8,-4,0,12,17,2,0,5,22,4),()=>k(0,7,8,-4,0,13,19,2,0,5,24,4),()=>k(0,7,9,-4,0,14,21,2,0,5,26,4),()=>k(0,8,9,-5,0,15,22,2,0,6,28,5),()=>k(0,8,10,-5,0,16,24,2,0,6,30,5),()=>k(0,8,11,-5,0,17,26,2,0,6,32,5),()=>k(0,9,11,-5,0,18,28,2,0,7,34,6),()=>k(0,9,12,-6,0,19,29,2,0,7,36,6),()=>k(0,10,13,-6,0,20,31,3,0,8,38,7),()=>k(0,10,13,-6,0,21,33,3,0,8,40,7),()=>k(0,10,14,-6,0,22,35,3,0,8,42,7),()=>k(0,11,14,-7,0,23,36,3,0,9,44,8),()=>k(0,11,15,-7,0,24,38,3,0,9,46,8)];function us(){return new Proxy([],{get:(e,t)=>typeof t!="string"||isNaN(Number(t))?e[t]:t in Ft?Ft[t]:Ft[t]=ls[t]()})}const ds={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)"},fs={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function vn(e){return`${Math.round(e)}ms`}function gs(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function hs(e){const t={...ds,...e.easing},n={...fs,...e.duration};return{getAutoHeightDuration:gs,create:(o=["all"],s={})=>{const{duration:i=n.standard,easing:a=t.easeInOut,delay:c=0,...l}=s;return(Array.isArray(o)?o:[o]).map(u=>`${u} ${typeof i=="string"?i:vn(i)} ${a} ${typeof c=="string"?c:vn(c)}`).join(",")},...e,easing:t,duration:n}}const _={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 ms(e){return Math.round(e*1e5)/1e5}function j(e,t,n,r,o,s){return{fontFamily:e.fontFamily,fontWeight:t,fontSize:e.pxToRem(n),lineHeight:`${r}`,letterSpacing:`${ms(o/n)}em`,...s?{textTransform:"uppercase"}:{}}}function ps(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 Ze(st,t,{h1:j(t,_.light,96,1.167,-1.5),h2:j(t,_.light,60,1.2,-.5),h3:j(t,_.regular,48,1.167,0),h4:j(t,_.regular,34,1.235,.25),h5:j(t,_.regular,24,1.334,0),h6:j(t,_.medium,20,1.6,.15),subtitle1:j(t,_.regular,16,1.75,.15),subtitle2:j(t,_.medium,14,1.57,.1),body1:j(t,_.regular,16,1.5,.15),body2:j(t,_.regular,14,1.43,.15),button:j(t,_.medium,14,1.75,.4,!0),caption:j(t,_.regular,12,1.66,.4),overline:j(t,_.regular,12,2.66,1,!0)},e)}const ys={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function bs(e){return{...Ze({},ys,e)}}function Rt(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 ws={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function ir(e){const t={...ws,...e??{},up:(n,r)=>{const o=Rt("up",t.resolve(n));return r?{[o]:r}:o},down:(n,r)=>{const o=Rt("down",t.resolve(n));return r?{[o]:r}:o},between:(n,r)=>{const o=Rt("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 ar(e){return typeof e=="function"?e:(...n)=>n.map(r=>typeof r=="number"?`${r*(e??8)}px`:r).join(" ")}const Cs={borderRadius:4};function cr(e){return{...Ze({},Cs,e)}}function lr(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=>ir(r.breakpoints)),n("components",r=>os(r.components)),n("palette",r=>ns(r.palette)),n("shape",r=>cr(r.shape)),n("spacing",r=>ar(r.spacing)),n("typography",r=>ps(r.typography)),n("shadows",()=>us()),n("transitions",()=>hs({})),n("zIndex",r=>bs(r.zIndex)),n("mixins",()=>ss(t.breakpoints)),t}function ur(e){let t;return function(){return t||(t=e()),t}}const Ss=ur(lr);let dr;dr=Ne({});const Et=dr;function xs(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:ir(e==null?void 0:e.breakpoints),shape:cr(e==null?void 0:e.shape),spacing:ar(e==null?void 0:e.spacing)}}const Os=ur(xs);function vs(e){for(const t in e)return!1;return!0}function un(e=Os,t=Et){const n=Ye(t);if(typeof n=="function")return new Proxy({},{get:(r,o)=>n()[o]});if(vs(n)&&e)return typeof e=="function"?e():e;if(!n)throw new Error("Theme is not defined");return n}function fr(e=Ss){return un(e,Et)}function ks(e){return un(e,Et)}function $s(e){var s,i;const t=[],n=typeof e.propDefaults=="function"?e.propDefaults({set:a=>a,inProps:e.props}):e.propDefaults,o=(i=(s=ks().components)==null?void 0:s[e.name])==null?void 0:i.defaultProps;return n&&t.push(n),o&&t.push(o),t.length?Gn(...t,e.props):e.props}function As(e){return fe(Et.Provider,{get value(){return e.theme},get children(){return e.children}})}function Es(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function Ts(e,t){switch(typeof e){case"function":return Object.assign(e,{[oo]:!0}),Ge(()=>e(t));case"string":const n=qn.has(e),r=P.context?Yn():Es(e,n);return Xn(r,t,n),r}}function gr(e,t){const n=L(e);return L(()=>Ts(n(),t))}function Wc(e){const[t,n]=kt(e,["$component"]);return gr(()=>t.$component,n)}function Ms(e){const t=e.reduce((n,r)=>("name"in r&&(n[`--${r.name}`]="0"),ln(n,r,{clone:!1,sortKeys:!0}),n),{});return delete t.name,t}function hr(e){return e.startsWith("--")}function Is(e){return e.startsWith("__")}function mr(e){return/[^a-z-]/i.test(e)&&!hr(e)}function pr(e){return e.startsWith("@global")}function Gt(e){return e.startsWith("@media")}function yr(e){return e.startsWith("@keyframes")}function kn(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function $n(e,t,n=[],r={}){const o=e.split(",").map(s=>(s=s.trim(),s.includes("&")?s:`& ${s}`));return yt(t,(n.length?n:[""]).flatMap(s=>o.map(i=>i.replace(/&/g,s).trim())),{...r})}function An(e,t){if(!t)return kn(e);let n=t.get(e);return n||(t.set(e,n=kn(e)),n)}function yt(e,t=[],n={}){const r=[],o=[];for(let i in e){const a=e[i];if(!Is(i))if(pr(i))for(const c in a)o.push(...$n(c,a[c],[],n));else if(Gt(i))o.push(...yt(a,t,{...n,sublevel:!0}).map(c=>`${i} {
2
2
  ${c}
3
3
  }`));else if(hr(i))a!=null&&r.push(`${i}: ${a};`);else if(yr(i)){const c=[];for(const l in a)c.push(...yt(a[l],[/^\d+$/.test(l)?`${l}%`:l],{...n,sublevel:!0}));o.push(`${i} {
4
4
  ${c.join(`
@@ -12,15 +12,15 @@ ${a}
12
12
  }`:yt(a,[`.${t}`],{extraProperties:e.extraProperties,propertyNameCache:r}).join(`
13
13
  `)).join(`
14
14
  `);return((i=e.cache)==null?void 0:i.create(e.name,o,e.componentId))||br(e.name,o,e.componentId)}function wr(e,t){"styleSheet"in e?e.styleSheet.cssText=t:(e.innerText="",e.appendChild(document.createTextNode(t)))}function Rs(e,t){for(const n in t){const r=t[n];r!==void 0&&(r===null?e.removeAttribute(n):e.setAttribute(n,r))}}function Ns(e,t){const n=document.createElement("style");return n.type="text/css",t&&Rs(n,t),wr(n,e),n}function qt(e){let t=Number(e.getAttribute("data-uses"));t++,e.setAttribute("data-uses",t.toString())}const En="suid-injectFirst";function Us(e,t,n){Array.isArray(e)&&(e=e.join(`
15
- `));const r=t==null?void 0:t.id,o=document.head||document.getElementsByTagName("head")[0],s=r&&document.getElementById(r);if(s&&s instanceof HTMLStyleElement)return wr(s,e),qt(s),s;{s&&s.remove();const i=Ns(e,t);if(qt(i),n){let a=o.querySelector(`#${En}`);a||(a=document.createElement("style"),a.setAttribute("id",En),o.prepend(a)),o.insertBefore(i,a)}else o.appendChild(i);return i}}function Bs(e,t="css-"){if(typeof e=="string")return document.getElementById(e);const n=[...e.classList].find(r=>r.startsWith(t));if(n)return document.getElementById(n.slice(t.length))}function Tn(e,t=!0){let n=Number(e.getAttribute("data-uses"));n--,n<=0?t?e.remove():e.setAttribute("data-uses","0"):e.setAttribute("data-uses",n.toString())}function Vc(e){if(typeof e!="string")throw new Error("MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}function Wc(e,t=166){let n;function r(...o){const s=()=>{e.apply(null,o)};clearTimeout(n),n=setTimeout(s,t)}return r.clear=()=>{clearTimeout(n)},r}function zc(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function _s(e){return e&&e.ownerDocument||document}function Kc(e){return _s(e).defaultView||window}function Cr(){return Math.random().toString(36).substring(2,15).slice(0,8)}let Tt=!0,Jt=!1,Mn;const js={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function Vs(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&js[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Ws(e){e.metaKey||e.altKey||e.ctrlKey||(Tt=!0)}function Nt(){Tt=!1}function zs(){this.visibilityState==="hidden"&&Jt&&(Tt=!0)}function Ks(e){e.addEventListener("keydown",Ws,!0),e.addEventListener("mousedown",Nt,!0),e.addEventListener("pointerdown",Nt,!0),e.addEventListener("touchstart",Nt,!0),e.addEventListener("visibilitychange",zs,!0)}function Hs(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return Tt||Vs(t)}function Hc(){const e=s=>{s!=null&&Ks(s.ownerDocument)},[t,n]=E(!1);function r(){return t()?(Jt=!0,window.clearTimeout(Mn),Mn=window.setTimeout(()=>{Jt=!1},100),n(!1),!0):!1}function o(s){return Hs(s)?(n(!0),!0):!1}return{isFocusVisibleRef:{get current(){return t()}},onFocus:o,onBlur:r,ref:e}}const Gs=new Ds;function qs(e){return e?Array.isArray(e)?e.flat(1/0).filter(t=>!!t):[e]:[]}function Js(){if(!P.context)return Cr();const e=so().replaceAll("-",""),t=9,n=Math.ceil(e.length/t),r=[];for(let o=1;o<=n;++o){const s=(o-1)*t,i=Number(e.slice(s,s+t));r.push(i.toString(32))}return r.join("-")}function Sr(e){const t=Ye(Ho),[n,r]=E(""),o=Js();let s,i=!1;return ce(a=>{var u;const c=e();let l;if(c){const d=Ms(qs(c));i="@global"in d,l=Fs({name:"css",props:d,cache:Gs,componentId:o}),s=Bs(l.id),s?qt(s):s=Us(l.rules,{id:l.id,nonce:(u=t.cache)==null?void 0:u.nonce},t.injectFirst),a!=null&&a.styleElement&&Tn(a.styleElement)}return typeof(l==null?void 0:l.className)=="string"?r(l.className):r(""),{className:l==null?void 0:l.className,styleElement:s}},void 0),le(()=>{s&&Tn(s,t.cleanupStyles??i)}),n}function $e(e,t,n={}){for(const r in e){const o=e[r];if(pr(r))n[r]=$e(o,t);else if(Gt(r))n[r]=$e(o,t);else if(yr(r)){n[r]={};for(const s in o)n[r][s]=$e(o[s],t)}else if(mr(r))n[r]=$e(o,t);else{const s=t(r,o);if(s)for(const i in s)n[i]=Gt(i)?{...n[i],...s[i]}:s[i];else n[r]=o}}return n}const Xs=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","fontWeight","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","WebkitLineClamp","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function xr(e,t){if(typeof t=="number")return{[e]:Xs.has(e)?t.toString():`${t}px`}}function In(e,t={}){return $e(e,xr,t)}function bt(e,t,n){if(typeof n!="string")return n;const r=n.split(".");let o=e[t];for(let s=0;s<r.length&&(o=o==null?void 0:o[r[s]],!!o);s++);return o??n}function Ys(e,t){return t.split(".").reduce((n,r)=>n&&n[r]?n[r]:null,e)}function Zs(e,t,n,r){const o=Ys(e,t)||n;return typeof o=="number"?s=>typeof s=="string"?s:o*s:Array.isArray(o)?s=>typeof s=="string"?s:o[s]:typeof o=="function"?o:()=>{}}const ie={x:["Left","Right"],y:["Top","Bottom"]};function Or(e){return typeof e=="number"?`${e}px`:e}function vr(e,t){return(n,r)=>t(e,n,r)}function f(e,t){return t?(n,r)=>({[e]:t(e,n,r)}):n=>({[e]:n})}function ze(e){return f(e,(t,n)=>Or(n))}function W(e,t,n){const r=t.map(o=>`${e}${o}`);return n?(o,s)=>r.reduce((i,a)=>(i[a]=n(a,o,s),i),{}):o=>r.reduce((s,i)=>(s[i]=o,s),{})}function Qs(){return{...ei(),...ti(),...ni(),...ri(),...oi(),...si(),...ii(),...ci(),...ai()}}function ei(){return{displayPrint:vr("displayPrint",(e,t)=>({"@media print":{display:t}})),displayRaw:f("display"),overflow:f("overflow"),textOverflow:f("textOverflow"),visibility:f("visibility"),whiteSpace:f("whiteSpace")}}function ti(){return{flexBasis:f("flexBasis"),flexDirection:f("flexDirection"),flexWrap:f("flexWrap"),justifyContent:f("justifyContent"),alignItems:f("alignItems"),alignContent:f("alignContent"),order:f("order"),flex:f("flex"),flexGrow:f("flexGrow"),flexShrink:f("flexShrink"),alignSelf:f("alignSelf"),justifyItems:f("justifyItems"),justifySelf:f("justifySelf")}}function ni(){const e=(t,n,r)=>Zs(r,"spacing",8)(n);return{gap:f("gap",e),columnGap:f("columnGap",e),rowGap:f("rowGap",e),gridColumn:f("gridColumn"),gridRow:f("gridRow"),gridAutoFlow:f("gridAutoFlow"),gridAutoColumns:f("gridAutoColumns"),gridAutoRows:f("gridAutoRows"),gridTemplateColumns:f("gridTemplateColumns"),gridTemplateRows:f("gridTemplateRows"),gridTemplateAreas:f("gridTemplateAreas"),gridArea:f("gridArea")}}function ri(){return{position:f("position"),zIndex:f("zIndex",(e,t,n)=>{var r;return((r=n.zIndex)==null?void 0:r[e])??t}),top:ze("top"),right:ze("right"),bottom:ze("bottom"),left:ze("left")}}function oi(){const e=(t,n,r)=>bt(r,"palette",n);return{color:f("color",e),bgcolor:f("backgroundColor",e),backgroundColor:f("backgroundColor",e)}}function si(){const e=(t,n,r)=>(t==="maxWidth"&&(n=r.breakpoints.values[t]??n),typeof n=="number"&&(n=n>0&&n<=1?`${n*100}%`:`${n}px`),n);return{width:f("width",e),maxWidth:f("maxWidth",e),minWidth:f("minWidth",e),height:f("height",e),maxHeight:f("maxHeight",e),minHeight:f("minHeight",e),boxSizing:f("boxSizing",e)}}function ii(){const e=(n,r)=>typeof r=="number"?`${r}px solid`:r,t=(n,r,o)=>bt(o,"palette",r);return{border:f("border",e),borderTop:f("borderTop",e),borderRight:f("borderRight",e),borderBottom:f("borderBottom",e),borderLeft:f("borderLeft",e),borderColor:f("borderColor",t),borderTopColor:f("borderTopColor",t),borderRightColor:f("borderRightColor",t),borderBottomColor:f("borderBottomColor",t),borderLeftColor:f("borderLeftColor",t),borderRadius:f("borderRadius",(n,r,o)=>typeof r=="number"?`${o.shape.borderRadius*r}px`:r)}}function ai(){const e=(t,n,r)=>bt(r,"typography",n);return{typography:vr("typography",(t,n,r)=>bt(r,"typography",n)),fontFamily:f("fontFamily",e),fontSize:f("fontSize",(t,n,r)=>Or(e(t,n,r))),fontStyle:f("fontStyle",e),fontWeight:f("fontWeight",e),letterSpacing:ze("letterSpacing"),lineHeight:f("lineHeight"),textAlign:f("textAlign"),textTransform:f("textTransform")}}function ci(){const e=(r,o,s)=>s.spacing(o),t="margin",n="padding";return{m:f(t,e),mt:f("marginTop",e),mr:f("marginRight",e),mb:f("marginBottom",e),ml:f("marginLeft",e),mx:W(t,ie.x,e),my:W(t,ie.y,e),margin:f(t,e),marginTop:f("marginTop",e),marginRight:f("marginRight",e),marginBottom:f("marginBottom",e),marginLeft:f("marginLeft",e),marginX:W(t,ie.x,e),marginY:W(t,ie.y,e),marginInline:W(t,["Inline","InlineStart"],e),marginInlineStart:f("marginInlineStart",e),marginInlineEnd:f("marginInlineEnd",e),marginBlock:W(t,["BlockStart","BlockEnd"],e),marginBlockStart:f("marginBlockStart",e),marginBlockEnd:f("marginBlockEnd",e),p:f(n,e),pt:f("paddingTop",e),pr:f("paddingRight",e),pb:f("paddingBottom",e),pl:f("paddingLeft",e),px:W(n,ie.x,e),py:W(n,ie.y,e),padding:f(n,e),paddingTop:f("paddingTop",e),paddingRight:f("paddingRight",e),paddingBottom:f("paddingBottom",e),paddingLeft:f("paddingLeft",e),paddingX:W(n,ie.x,e),paddingY:W(n,ie.y,e),paddingInline:W(n,["Inline","InlineStart"],e),paddingInlineStart:f("paddingInlineStart",e),paddingInlineEnd:f("paddingInlineEnd",e),paddingBlock:W(n,["BlockStart","BlockEnd"],e),paddingBlockStart:f("paddingBlockStart",e),paddingBlockEnd:f("paddingBlockEnd",e)}}const dn=Qs(),Gc=Object.keys(dn);function li(e,t,n){return dn[e](t,n)}function Pn(e,t,n){return e in dn?li(e,t,n):xr(e,t)}function ui(e,t){return $e(e,(n,r)=>{if(typeof r=="function"&&(r=r(t)),r==null)return r;if(typeof r=="object"){const o={};for(const s of t.breakpoints.keys)o[t.breakpoints.up(s)]={};return Object.assign(o,zo({theme:t},r,s=>Pn(n,s,t)??{[n]:s}))}else return Pn(n,r,t)})}function kr(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=kr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function di(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=kr(e))&&(r&&(r+=" "),r+=t);return r}const $r=["ownerState","theme","sx","as"];function fi(e,t){var n,r;return(r=(n=t.components)==null?void 0:n[e])==null?void 0:r.styleOverrides}function gi(e,t,n,r,o={}){return L(()=>{const s=e(),i=fi(o.name,s),a=r.ownerState,c=n.reduce((u,d)=>{let g;return typeof d=="function"?g=d({ownerState:a,theme:s,get sx(){return r.sx},get as(){return r.as},props:r}):d&&(g=d),g&&u.push(In(g,{name:t,__resolved:!0})),u},[]);let l=[];return o.overridesResolver&&typeof o.overridesResolver=="function"&&i&&(l=o.overridesResolver(r,i).map(u=>u?In(u,{}):null).filter(Boolean)),c.concat(l)})}function Ar(e,t){e.__suid=t}function Ln(e){if(typeof e=="function")return e.__suid}function hi(e){return function(n,r={}){let o,s;if(r.name){const a=r.slot||"Root";s=o=`${r.name}-${a.slice(0,1).toLowerCase()+a.slice(1)}`}else s=`styled-${Cr()}`,o="css";const i=Ln(n);return function(...a){function c(l){let u;const d=()=>{const D=l.theme;return D||u||(u=e&&e.onUseTheme?e.onUseTheme():un())},[,g]=kt(l,r.skipProps||$r),m=gi(d,o,a,l,r),p=()=>{const D=l.sx;return D?Array.isArray(D)?D:[D]:[]},C=()=>{if(i)return n;const D=l.as;return D||n},b=i?()=>i:L(()=>Ln(C())),I=r.skipSx?()=>m():()=>{const D=d();return[...m(),...p().map(q=>q.__resolved?q:ui(q,D))]},R=Sr(()=>b()?void 0:I());return gr(C,Gn(g,{get children(){return l.children},get component(){return b()?l.component:null},get as(){return i?l.as:void 0},get sx(){return b()?I():void 0},get ownerState(){return b()==="system"?l.ownerState:void 0},get class(){return di([...new Set([l.class,s,R()])])}}))}return Ar(c,"system"),s&&(c.toString=()=>`.${s}`),c}}}const qc=[...$r,"classes"],Jc=hi({onUseTheme:()=>fr()}),mi="codenomad.client-id",pi="codenomad.connection-id";let it=null,at=null;function Xt(){return{clientId:yi(),connectionId:bi()}}function yi(){return it||(it=Er(mi,window.localStorage),it)}function bi(){return at||(at=Er(pi,window.sessionStorage),at)}function Er(e,t){if(typeof window>"u")return Ut();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Ut()}const n=Ut();try{t.setItem(e,n)}catch{}return n}function Ut(){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 Yt={exports:{}},Bt,Dn;function wi(){if(Dn)return Bt;Dn=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;Bt=function(u,d){d=d||{};var g=typeof u;if(g==="string"&&u.length>0)return i(u);if(g==="number"&&isFinite(u))return d.long?c(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.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(u);if(d){var g=parseFloat(d[1]),m=(d[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return g*s;case"weeks":case"week":case"w":return g*o;case"days":case"day":case"d":return g*r;case"hours":case"hour":case"hrs":case"hr":case"h":return g*n;case"minutes":case"minute":case"mins":case"min":case"m":return g*t;case"seconds":case"second":case"secs":case"sec":case"s":return g*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function a(u){var d=Math.abs(u);return d>=r?Math.round(u/r)+"d":d>=n?Math.round(u/n)+"h":d>=t?Math.round(u/t)+"m":d>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var d=Math.abs(u);return d>=r?l(u,d,r,"day"):d>=n?l(u,d,n,"hour"):d>=t?l(u,d,t,"minute"):d>=e?l(u,d,e,"second"):u+" ms"}function l(u,d,g,m){var p=d>=g*1.5;return Math.round(u/g)+" "+m+(p?"s":"")}return Bt}function Ci(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=wi(),n.destroy=l,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let d=0;for(let g=0;g<u.length;g++)d=(d<<5)-d+u.charCodeAt(g),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(u){let d,g=null,m,p;function C(...b){if(!C.enabled)return;const I=C,R=Number(new Date),D=R-(d||R);I.diff=D,I.prev=d,I.curr=R,d=R,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let q=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(B,h)=>{if(B==="%%")return"%";q++;const w=n.formatters[h];if(typeof w=="function"){const v=b[q];B=w.call(I,v),b.splice(q,1),q--}return B}),n.formatArgs.call(I,b),(I.log||n.log).apply(I,b)}return C.namespace=u,C.useColors=n.useColors(),C.color=n.selectColor(u),C.extend=r,C.destroy=n.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(m!==n.namespaces&&(m=n.namespaces,p=n.enabled(u)),p),set:b=>{g=b}}),typeof n.init=="function"&&n.init(C),C}function r(u,d){const g=n(this.namespace+(typeof d>"u"?":":d)+u);return g.log=this.log,g}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];const d=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const g of d)g[0]==="-"?n.skips.push(g.slice(1)):n.names.push(g)}function s(u,d){let g=0,m=0,p=-1,C=0;for(;g<u.length;)if(m<d.length&&(d[m]===u[g]||d[m]==="*"))d[m]==="*"?(p=m,C=g,m++):(g++,m++);else if(p!==-1)m=p+1,C++,g=C;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function i(){const u=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),u}function a(u){for(const d of n.skips)if(s(u,d))return!1;for(const d of n.names)if(s(u,d))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){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 Si=Ci;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let l=!1;return()=>{l||(l=!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 l;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&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let d=0,g=0;l[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(g=d))}),l.splice(g,0,u)}t.log=console.debug||console.log||(()=>{});function s(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function i(){let l;try{l=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function a(){try{return localStorage}catch{}}e.exports=Si(t);const{formatters:c}=e.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Yt,Yt.exports);var xi=Yt.exports;const Zt=co(xi),Ue=["sse","api","session","actions"],Tr="opencode:logger:namespaces",_t=new Map,Q=new Set,te=typeof globalThis<"u"?globalThis.console:void 0;function Qe(){Q.size===0?Zt.disable():Zt.enable(Array.from(Q).join(","))}function Mt(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Tr,JSON.stringify(Array.from(Q)))}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to persist logger namespaces",t)}}function Oi(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Tr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)Ue.includes(r)&&Q.add(r)}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to hydrate logger namespaces",t)}}Oi();Qe();function vi(e){const n=Zt(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 Ce(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return _t.has(e)||_t.set(e,vi(e)),_t.get(e)}function ki(){return Ue.map(e=>({name:e,enabled:Q.has(e)}))}function $i(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)||(Q.add(e),Mt(),Qe())}function Ai(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)&&(Q.delete(e),Mt(),Qe())}function Ei(){Q.clear(),Mt(),Qe()}function Ti(){Ue.forEach(e=>Q.add(e)),Mt(),Qe()}const Mi={listLoggerNamespaces:ki,enableLogger:$i,disableLogger:Ai,enableAllLoggers:Ti,disableAllLoggers:Ei};function Ii(){typeof window>"u"||(window.codenomadLogger=Mi)}Ii();function Pi(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)}})}var Kn;const Li=typeof window<"u"?(Kn=window.location)==null?void 0:Kn.origin:void 0,Di=typeof window<"u"?window.__CODENOMAD_API_BASE__??Li:void 0,Fi=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",de=Di,jt=Ri(de,Fi),Xc=de;function Yc(e,t){const n=encodeURIComponent(e),r=encodeURIComponent(t);return Ni(`/workspaces/${n}/plugin/background-processes/${r}/stream`)}function Ri(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(e){const n=t.startsWith("/")?t:`/${t}`;return`${e}${n}`}return t}function Ni(e){if(e.startsWith("http://")||e.startsWith("https://")||!de)return e;const t=e.startsWith("/")?e:`/${e}`;return`${de}${t}`}const Fn=Ce("api"),Rn=Ce("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 me(e,t){if(t){Fn.info(e,t);return}Fn.info(e)}async function Ir(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 y(e,t){const n=de?new URL(e,de).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();me(`${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 Ir(i);throw me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:c}),new Error(c||`Request failed with ${i.status}`)}const a=Date.now()-s;return me(`${o} ${e} -> ${i.status}`,{durationMs:a}),i.status===204?void 0:await i.json()}catch(i){throw me(`${o} ${e} failed`,{durationMs:Date.now()-s,error:i}),i}}async function Ui(e,t){const n=de?new URL(e,de).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();me(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await Ir(i);throw me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return me(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const ee={fetchWorkspaces(){return y("/api/workspaces")},fetchWorktrees(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees`)},createWorktree(e,t){return y(`/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 y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}${o}`,{method:"DELETE"})},readWorktreeMap(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`)},writeWorktreeMap(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`,{method:"PUT",body:JSON.stringify(t)})},createWorkspace(e){return y("/api/workspaces",{method:"POST",body:JSON.stringify(e)})},fetchSidecars(){return y("/api/sidecars")},createSidecar(e){return y("/api/sidecars",{method:"POST",body:JSON.stringify(e)})},updateSidecar(e,t){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteSidecar(e){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchServerMeta(){return y("/api/meta")},probeRemoteServer(e){return y("/api/remote-servers/probe",{method:"POST",body:JSON.stringify(e)})},createRemoteProxySession(e){return y("/api/remote-proxy/sessions",{method:"POST",body:JSON.stringify(e)})},deleteRemoteProxySession(e){return y(`/api/remote-proxy/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchAuthStatus(){return y("/api/auth/status")},setServerPassword(e){return y("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return y(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},listWorkspaceFiles(e,t="."){const n=new URLSearchParams({path:t});return y(`/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),y(`/api/workspaces/${encodeURIComponent(e)}/files/search?${o.toString()}`)},readWorkspaceFile(e,t){const n=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${n.toString()}`)},writeWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`,{method:"PUT",body:JSON.stringify({contents:n})})},fetchWorktreeGitStatus(e,t){return y(`/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),y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-diff?${r.toString()}`)},stageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-stage`,{method:"POST",body:JSON.stringify(n)})},unstageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-unstage`,{method:"POST",body:JSON.stringify(n)})},commitWorktreeGitChanges(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-commit`,{method:"POST",body:JSON.stringify(n)})},fetchConfigOwner(e){return y(`/api/storage/config/${encodeURIComponent(e)}`)},patchConfigOwner(e,t){return y(`/api/storage/config/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},fetchStateOwner(e){return y(`/api/storage/state/${encodeURIComponent(e)}`)},patchStateOwner(e,t){return y(`/api/storage/state/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},validateBinary(e){return y("/api/storage/binaries/validate",{method:"POST",body:JSON.stringify({path:e})})},fetchSpeechCapabilities(){return y("/api/speech/capabilities")},transcribeAudio(e){return y("/api/speech/transcribe",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeech(e){return y("/api/speech/synthesize",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeechStream(e,t){return Ui("/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 y(r?`/api/filesystem?${r}`:"/api/filesystem")},createFileSystemFolder(e,t){return y("/api/filesystem/folders",{method:"POST",body:JSON.stringify({parentPath:e,name:t})})},readInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`)},writeInstanceData(e,t){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"DELETE"})},listBackgroundProcesses(e){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes`)},stopBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/stop`,{method:"POST"})},terminateBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/terminate`,{method:"POST"})},updateVoiceMode(e,t){const n=Xt();return y(`/workspaces/${encodeURIComponent(e)}/plugin/voice-mode`,{method:"POST",body:JSON.stringify({...n,enabled:t})})},sendClientConnectionPong(e){return y("/api/client-connections/pong",{method:"POST",body:JSON.stringify(e)})},fetchBackgroundProcessOutput(e,t,n){const r=new URLSearchParams;n!=null&&n.method&&r.set("method",n.method),n!=null&&n.pattern&&r.set("pattern",n.pattern),n!=null&&n.lines&&r.set("lines",String(n.lines)),(n==null?void 0:n.maxBytes)!==void 0&&r.set("maxBytes",String(n.maxBytes));const o=r.toString(),s=o?`?${o}`:"";return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/output${s}`)},connectEvents(e,t,n){const r=Xt(),o=Bi(r);Rn.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return Pi(s,{onEvent:e,onError:t,onPing:n,logger:Rn}),s}};function Bi(e){const t=new URL(jt,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),jt.startsWith("http://")||jt.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}const Nn=1e3,_i=1e4,Qt=Ce("sse");function ct(e,t){if(t){Qt.info(e,t);return}Qt.info(e)}class ji{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.source=null,this.retryDelay=Nn,this.reconnectTimer=null,this.connect()}connect(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.source&&this.source.close(),ct("Connecting to backend events stream"),this.source=ee.connectEvents(t=>this.dispatch(t),()=>this.scheduleReconnect(),t=>{ee.sendClientConnectionPong({...Xt(),pingTs:t.ts}).catch(n=>{Qt.error("Failed to send client connection pong",n)})}),this.source.onopen=()=>{ct("Events stream connected"),this.retryDelay=Nn,this.openHandlers.forEach(t=>t())}}scheduleReconnect(){if(this.reconnectTimer!==null)return;const t=this.source;this.source=null,ct("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryDelay=Math.min(this.retryDelay*2,_i),this.connect()},this.retryDelay),t==null||t.close()}dispatch(t){var n,r;ct(`event ${t.type}`),(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(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)}}const Vt=new ji,Vi=Ce("actions"),Un={messageHistory:[],agentModelSelections:{}};function Bn(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){Vi.warn("Failed to compare config objects",n)}return!1}class Wi{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,Vt.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),Vt.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),Vt.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=ee.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)}async patchConfigOwner(t,n){const r=await ee.patchConfigOwner(t,n);return 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=ee.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)}async patchStateOwner(t,n){const r=await ee.patchStateOwner(t,n);return 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=ee.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)}async saveInstanceData(t,n){const r=this.normalizeInstanceData(n);await ee.writeInstanceData(t,r),this.setInstanceDataCache(t,r)}async deleteInstanceData(t){await ee.deleteInstanceData(t),this.setInstanceDataCache(t,Un)}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&&Bn(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)}normalizeInstanceData(t){const n=t??Un,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&&Bn(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 Y=new Wi,Pr=Ce("api"),It={messageHistory:[],agentModelSelections:{}},[fn,Lr]=E(new Map),lt=new Map,Fe=new Map;function Dr(e){const t=e??It;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function _n(e){if(Fe.has(e))return;const t=Y.onInstanceDataChanged(e,n=>{wt(e,n)});Fe.set(e,t)}function zi(e){const t=Fe.get(e);t&&(t(),Fe.delete(e))}function wt(e,t){Lr(n=>{const r=new Map(n);return r.set(e,Dr(t)),r})}async function Pt(e){if(!e||fn().has(e))return;if(lt.has(e)){await lt.get(e);return}const t=Y.loadInstanceData(e).then(n=>{wt(e,n),_n(e)}).catch(n=>{Pr.warn("Failed to load instance data",n),wt(e,It),_n(e)}).finally(()=>{lt.delete(e)});lt.set(e,t),await t}async function Fr(e,t){if(!e)return;await Pt(e);const n=fn().get(e)??It,r=Dr(n);t(r);try{await Y.saveInstanceData(e,r)}catch(o){Pr.warn("Failed to persist instance data",o)}wt(e,r)}function Rr(e){return fn().get(e)??It}function Ki(e){Lr(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),zi(e)}const Hi=Ne(),Gi={getInstanceConfig:Rr,ensureInstanceConfig:Pt,updateInstanceConfig:Fr,clearInstanceConfig:Ki},Zc=e=>(le(()=>{for(const t of Fe.values())t();Fe.clear()}),ue(Hi.Provider,{value:Gi,get children(){return e.children}})),qi=Ce("api"),[jn,en]=E(null),[Qc,Vn]=E(!1),[el,gt]=E(null);let _e=null;async function Ji(e=!1){return!e&&jn()?jn():_e||(Vn(!0),gt(null),_e=ee.fetchSpeechCapabilities().then(t=>(en(t),gt(null),t)).catch(t=>(qi.error("Failed to load speech capabilities",t),en(null),gt(t instanceof Error?t.message:String(t)),null)).finally(()=>{Vn(!1),_e=null}),_e)}function Xi(){en(null),gt(null)}const A=Ce("actions"),Yi=20,Zi=5,Qi=50,M={showThinkingBlocks:!1,showKeyboardShortcutHints:!0,thinkingBlocksExpansion:"expanded",showTimelineTools:!0,holdLongAssistantReplies:!0,promptSubmitOnEnter:!1,showPromptVoiceInput:!0,diffViewMode:"split",toolOutputExpansion:"expanded",diagnosticsExpansion:"expanded",toolInputsVisibility:"collapsed",showUsageMetrics:!0,autoCleanupBlankSessions:!0,keepUnseenSubagentIdleStatus:!1,osNotificationsEnabled:!1,osNotificationsAllowWhenVisible:!1,notifyOnNeedsInput:!0,notifyOnIdle:!0},ve={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function Nr(e){const t=e??{};return{showThinkingBlocks:t.showThinkingBlocks??M.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??M.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??M.thinkingBlocksExpansion,showTimelineTools:t.showTimelineTools??M.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??M.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??M.promptSubmitOnEnter,showPromptVoiceInput:t.showPromptVoiceInput??M.showPromptVoiceInput,locale:t.locale??M.locale,diffViewMode:t.diffViewMode??M.diffViewMode,toolOutputExpansion:t.toolOutputExpansion??M.toolOutputExpansion,diagnosticsExpansion:t.diagnosticsExpansion??M.diagnosticsExpansion,toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:M.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??M.showUsageMetrics,autoCleanupBlankSessions:t.autoCleanupBlankSessions??M.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??M.keepUnseenSubagentIdleStatus,osNotificationsEnabled:t.osNotificationsEnabled??M.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??M.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??M.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??M.notifyOnIdle}}function Ur(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 Br(e){const t=e??{};return{provider:t.provider==="openai-compatible"?t.provider:ve.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:typeof t.sttModel=="string"&&t.sttModel.trim()?t.sttModel.trim():ve.sttModel,ttsModel:typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():ve.ttsModel,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():ve.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:ve.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:ve.ttsFormat}}function je(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 ea(e){var n,r,o;const t=e??{};return{recentFolders:je(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed;if(typeof i!="string")return null;const c=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:c}}),opencodeBinaries:je(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,l=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:l,lastUsed:a}}),remoteServers:je(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 l=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),u=typeof s.updatedAt=="string"?s.updatedAt:l,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:l,updatedAt:u,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:je((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:je((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:Ur((o=t.models)==null?void 0:o.thinkingSelections)}}}function ta(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",s=Ur(t.environmentVariables),i=Br(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,speech:i}}function _r(e){return`${e.providerId}/${e.modelId}`}function jr(e,t){const n=t.filter(r=>r.path!==e);return n.unshift({path:e,lastAccessed:Date.now()}),n.slice(0,Yi)}function gn(e,t,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 na(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??ra(),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 Vr(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 ra(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[hn,Ct]=E({}),[oa,St]=E({}),[sa,xt]=E({}),[Wr,He]=E(!1),ia=L(()=>Nr(hn().settings)),zr=L(()=>hn().theme??"system"),Se=L(()=>ta(oa())),re=L(()=>ea(sa())),V=ia,Lt=L(()=>re().recentFolders),et=L(()=>re().opencodeBinaries),Re=L(()=>re().remoteServers);let ut=null;async function Dt(){Wr()||(ut||(ut=Promise.all([Y.loadConfigOwner("ui"),Y.loadConfigOwner("server"),Y.loadStateOwner("ui")]).then(([e,t,n])=>{Ct(e),St(t),xt(n),He(!0)}).catch(e=>{A.error("Failed to load settings",e),Ct({}),St({}),xt({}),He(!0)}).finally(()=>{ut=null})),await ut)}async function se(e,t){await Dt();const n=await Y.patchConfigOwner(e,t);e==="ui"&&Ct(n),e==="server"&&St(n)}async function H(e,t){await Dt();const n=await Y.patchStateOwner(e,t);xt(n)}function G(e){const t=hn(),r={settings:Nr({...t.settings??{},...e})};se("ui",r).catch(o=>A.error("Failed to patch ui settings",o))}function Kr(e){G(e)}function aa(e){zr()!==e&&se("ui",{theme:e}).catch(t=>A.error("Failed to set theme",t))}async function ca(e){Se().listeningMode!==e&&await se("server",{listeningMode:e})}function mn(e){se("server",{environmentVariables:e}).catch(t=>A.error("Failed to update environment variables",t))}function la(e,t){const n=Se().environmentVariables;mn({...n,[e]:t})}function ua(e){const t=Se().environmentVariables,{[e]:n,...r}=t;mn(r)}function da(e){const t=e&&e.trim().length>0?e:"opencode";se("server",{opencodeBinary:t}).catch(r=>A.error("Failed to set default binary",r));const n=gn(t,void 0,et());H("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to update binary list",r))}function fa(e){se("server",{logLevel:e??"DEBUG"}).catch(n=>A.error("Failed to set log level",n))}async function ga(e){const t=e.apiKey,{apiKey:n,...r}=e,o=Br({...Se().speech,...r,...t===null?{}:{apiKey:t}}),{hasApiKey:s,...i}=o,a={...i,...t===null?{apiKey:null}:{}};try{await se("server",{speech:a})}catch(c){throw A.error("Failed to update speech settings",c),c}}function ha(e,t){const n=gn(e,t,et());H("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to add binary",r))}function ma(e){const t=et().filter(n=>n.path!==e);H("ui",{opencodeBinaries:t}).catch(n=>A.error("Failed to remove binary",n)),Se().opencodeBinary===e&&se("server",{opencodeBinary:"opencode"}).catch(n=>A.error("Failed to reset default binary",n))}function pa(e){const t=jr(e,Lt());H("ui",{recentFolders:t}).catch(n=>A.error("Failed to add recent folder",n))}function ya(e){const t=Lt().filter(n=>n.path!==e);H("ui",{recentFolders:t}).catch(n=>A.error("Failed to remove recent folder",n))}async function ba(e){const t=na(e,Re());return await H("ui",{remoteServers:Vr(t,Re())}),t}async function wa(e){const t=Re().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await H("ui",{remoteServers:Vr(r,Re())})}function Ca(e){const t=Re().filter(n=>n.id!==e);H("ui",{remoteServers:t}).catch(n=>A.error("Failed to remove remote server",n))}function Sa(e,t){const n=t&&t.trim().length>0?t:Se().opencodeBinary,r=jr(e,Lt()),o=gn(n,void 0,et());H("ui",{recentFolders:r,opencodeBinaries:o}).catch(s=>A.error("Failed to update ui state on launch",s)),se("server",{opencodeBinary:n}).catch(s=>A.error("Failed to persist selected binary",s))}function xa(e){if(!e.providerId||!e.modelId)return;const n=re().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,Zi);H("ui",{models:{recents:r}}).catch(o=>A.error("Failed to update model recents",o))}function Oa(e){return!e.providerId||!e.modelId?!1:re().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function va(e){if(!e.providerId||!e.modelId)return;const t=re().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,Qi);H("ui",{models:{favorites:r}}).catch(o=>A.error("Failed to update model favorites",o))}function ka(e){if(!(!e.providerId||!e.modelId))return re().models.thinkingSelections[_r(e)]}function $a(e,t){if(!e.providerId||!e.modelId)return;const n=_r(e);if(re().models.thinkingSelections[n]===t)return;const o={...re().models.thinkingSelections};t?o[n]=t:delete o[n],H("ui",{models:{thinkingSelections:o}}).catch(s=>A.error("Failed to update thinking selection",s))}function Aa(e){V().diffViewMode!==e&&G({diffViewMode:e})}function Ea(e){V().toolOutputExpansion!==e&&G({toolOutputExpansion:e})}function Ta(e){V().diagnosticsExpansion!==e&&G({diagnosticsExpansion:e})}function Ma(e){V().toolInputsVisibility!==e&&G({toolInputsVisibility:e})}function Ia(e){V().thinkingBlocksExpansion!==e&&G({thinkingBlocksExpansion:e})}function Pa(){G({showThinkingBlocks:!V().showThinkingBlocks})}function La(){Kr({showKeyboardShortcutHints:!V().showKeyboardShortcutHints})}function Da(){G({showTimelineTools:!V().showTimelineTools})}function Fa(){G({showUsageMetrics:!V().showUsageMetrics})}function Ra(){G({promptSubmitOnEnter:!V().promptSubmitOnEnter})}function Na(){G({showPromptVoiceInput:!V().showPromptVoiceInput})}function Ua(){const e=!V().autoCleanupBlankSessions;A.info("toggle auto cleanup",{value:e}),G({autoCleanupBlankSessions:e})}async function Ba(e,t,n){!e||!t||!n.providerId||!n.modelId||(await Pt(e),await Fr(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 _a(e,t){return!e||!t?void 0:(await Pt(e),(Rr(e).agentModelSelections??{})[t])}Dt().catch(e=>{A.error("Failed to initialize settings",e)});const Hr=Ne(),ja={isLoaded:Wr,preferences:V,updatePreferences:Kr,themePreference:zr,setThemePreference:aa,serverSettings:Se,setListeningMode:ca,updateEnvironmentVariables:mn,addEnvironmentVariable:la,removeEnvironmentVariable:ua,updateLastUsedBinary:da,updateLogLevel:fa,updateSpeechSettings:ga,recentFolders:Lt,opencodeBinaries:et,remoteServers:Re,uiState:re,addRecentFolder:pa,removeRecentFolder:ya,addOpenCodeBinary:ha,removeOpenCodeBinary:ma,saveRemoteServerProfile:ba,markRemoteServerConnected:wa,removeRemoteServerProfile:Ca,recordWorkspaceLaunch:Sa,addRecentModelPreference:xa,isFavoriteModelPreference:Oa,toggleFavoriteModelPreference:va,getModelThinkingSelection:ka,setModelThinkingSelection:$a,toggleShowThinkingBlocks:Pa,toggleKeyboardShortcutHints:La,toggleShowTimelineTools:Da,toggleUsageMetrics:Fa,toggleAutoCleanupBlankSessions:Ua,togglePromptSubmitOnEnter:Ra,toggleShowPromptVoiceInput:Na,setDiffViewMode:Aa,setToolOutputExpansion:Ea,setDiagnosticsExpansion:Ta,setThinkingBlocksExpansion:Ia,setToolInputsVisibility:Ma,setAgentModelPreference:Ba,getAgentModelPreference:_a},tl=e=>($t(()=>{Dt().catch(o=>{A.error("Failed to initialize settings",o)});const t=Y.onConfigOwnerChanged("ui",o=>{Ct(o),He(!0)}),n=Y.onConfigOwnerChanged("server",o=>{St(o),He(!0),Xi(),Ji(!0)}),r=Y.onStateOwnerChanged("ui",o=>{xt(o),He(!0)});return()=>{t(),n(),r()}}),ue(Hr.Provider,{value:ja,get children(){return e.children}}));function Va(){const e=Ye(Hr);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function Wa(e,t,n){const r={};return Object.keys(e).forEach(o=>{r[o]=e[o].reduce((s,i)=>(i&&(n&&n[i]&&s.push(n[i]),s.push(t(i))),s),[]).join(" ")}),r}const za=Symbol("solid-inspect"),Ka=Ne();function Ha(e){function t(n){var r;return(r=Ye(Ka))!=null&&r.enabled?{Component:t,props:n,$INSPECT:za}:e(n)}return Object.defineProperty(t,"name",{value:e.name}),t.toString=e.toString,t}function Gr(){return function(e){function t(a){const c=!!e.slotClasses,l=()=>{if(!e.slotClasses)throw new Error("'slotClasses' option is not defined");if(!e.utilityClass)throw new Error("'utilityClass' option is not defined");return Wa(e.slotClasses(a),e.utilityClass,a.classes??"")},u=No({});return c&&io(()=>{const d=l();Ae(()=>{for(const g in d)u[g]=d[g]})}),u}function n(a){const[c,l]=kt(a,e.selfPropNames);return{allProps:a,props:c,otherProps:l}}function r(a){return $s({propDefaults:a.propDefaults||e.propDefaults,props:a.props,name:e.name})}function o(a){const c=r({props:a});return n(c)}function s(a,c=!0){return a=Ha(a),a.toString=()=>`.${e.name}-root`,c&&Ar(a,"base"),a}function i(a){const c=s(function(u){const{allProps:d,otherProps:g,props:m}=o(u),p=e.autoCallUseClasses??!0?t(d):{};return a({allProps:d,otherProps:g,props:m,classes:p})});return Object.defineProperty(c,"name",{value:a.name}),c}return{name:e.name,selfPropNames:e.selfPropNames,component:i,defineComponent:s,useClasses:t,useThemeProps:r,useProps:o,splitInProps:n}}}const Ga=Gr()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),qa=Ga.component(function({props:t}){return Sr(()=>({"@global":t.styles||{}})),[]}),Ja=Gr()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:e})=>e({enableColorScheme:!1})}),Xa=(e,t)=>({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",...t&&{colorScheme:e.palette.mode}}),Ya=e=>({color:e.palette.text.primary,...e.typography.body1,backgroundColor:e.palette.background.default,"@media print":{backgroundColor:e.palette.common.white}}),Za=(e,t=!1)=>({html:Xa(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...Ya(e),"&::backdrop":{backgroundColor:e.palette.background.default}}}),Qa=Ja.component(function({props:t}){const n=fr();return ue(qa,{get styles(){return Za(n,t.enableColorScheme)}})}),qr=Ne();function Wn(e){if(!(typeof document>"u")){if(e==="system"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}const ec={backgroundDefault:"#ffffff",backgroundPaper:"#f5f5f5",primary:"#0066ff",primaryContrast:"#ffffff",textPrimary:"#1a1a1a",textSecondary:"#666666",divider:"#e0e0e0"},tc={backgroundDefault:"#1a1a1a",backgroundPaper:"#2a2a2a",primary:"#0080ff",primaryContrast:"#1a1a1a",textPrimary:"#cfd4dc",textSecondary:"#999999",divider:"#3a3a3a"},he=(e,t,n)=>{if(!n)return t;const r=n.getPropertyValue(e);return r&&r.trim()||t},nc=e=>{const t=e?tc:ec,n=typeof window<"u"?getComputedStyle(document.documentElement):null;return{backgroundDefault:he("--surface-base",t.backgroundDefault,n),backgroundPaper:he("--surface-secondary",t.backgroundPaper,n),primary:he("--accent-primary",t.primary,n),primaryContrast:he("--text-inverted",t.primaryContrast,n),textPrimary:he("--text-primary",t.textPrimary,n),textSecondary:he("--text-secondary",t.textSecondary,n),divider:he("--border-base",t.divider,n)}};function nl(e){const t=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,{themePreference:n,setThemePreference:r}=Va(),[o,s]=E(!0),[i,a]=E(0),c=()=>n(),l=()=>{const p=c();return p==="dark"?!0:p==="light"?!1:(t==null?void 0:t.matches)??!1},u=()=>{const p=c(),C=l();Wn(p==="system"?"system":p),s(C),typeof window<"u"?requestAnimationFrame(()=>a(b=>b+1)):a(b=>b+1)};z(()=>{u()}),$t(()=>{if(!t)return;const p=()=>{u()};return t.addEventListener("change",p),()=>{t.removeEventListener("change",p)}});const d=p=>{r(p)},g=()=>{const p=c();d(p==="system"?"light":p==="light"?"dark":"system")},m=L(()=>{i();const p=nc(o());return lr({palette:{mode:o()?"dark":"light",primary:{main:p.primary,contrastText:p.primaryContrast},secondary:{main:p.primary},background:{default:p.backgroundDefault,paper:p.backgroundPaper},text:{primary:p.textPrimary,secondary:p.textSecondary},divider:p.divider},typography:{fontFamily:"var(--font-family-sans)"},shape:{borderRadius:8},components:{MuiIconButton:{styleOverrides:{root:{color:"inherit","&.Mui-disabled":{color:"var(--text-muted)",opacity:.55}}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)"}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)",boxShadow:"none",borderBottom:"1px solid var(--border-base)",zIndex:10}}},MuiToolbar:{styleOverrides:{root:{minHeight:"56px"}}}}})});return ue(qr.Provider,{value:{isDark:o,themeMode:c,setThemeMode:d,cycleThemeMode:g},get children(){return ue(As,{get theme(){return m()},get children(){return[ue(Qa,{}),bo(()=>e.children)]}})}})}function Jr(){const e=Ye(qr);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const rc=/(^|\n)@@/m,oc=/(^|\n)(diff --git |--- |\+\+\+)/,sc=/^\*\*\* (Begin|End) Patch/,ic=/^\*\*\* Update File: (.+)$/,ac=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function cc(e){const t=e.trim();if(!t.startsWith("```"))return t;const n=t.split(`
15
+ `));const r=t==null?void 0:t.id,o=document.head||document.getElementsByTagName("head")[0],s=r&&document.getElementById(r);if(s&&s instanceof HTMLStyleElement)return wr(s,e),qt(s),s;{s&&s.remove();const i=Ns(e,t);if(qt(i),n){let a=o.querySelector(`#${En}`);a||(a=document.createElement("style"),a.setAttribute("id",En),o.prepend(a)),o.insertBefore(i,a)}else o.appendChild(i);return i}}function Bs(e,t="css-"){if(typeof e=="string")return document.getElementById(e);const n=[...e.classList].find(r=>r.startsWith(t));if(n)return document.getElementById(n.slice(t.length))}function Tn(e,t=!0){let n=Number(e.getAttribute("data-uses"));n--,n<=0?t?e.remove():e.setAttribute("data-uses","0"):e.setAttribute("data-uses",n.toString())}function zc(e){if(typeof e!="string")throw new Error("MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}function Kc(e,t=166){let n;function r(...o){const s=()=>{e.apply(null,o)};clearTimeout(n),n=setTimeout(s,t)}return r.clear=()=>{clearTimeout(n)},r}function Hc(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function _s(e){return e&&e.ownerDocument||document}function Gc(e){return _s(e).defaultView||window}function Cr(){return Math.random().toString(36).substring(2,15).slice(0,8)}let Tt=!0,Jt=!1,Mn;const js={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function Vs(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&js[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Ws(e){e.metaKey||e.altKey||e.ctrlKey||(Tt=!0)}function Nt(){Tt=!1}function zs(){this.visibilityState==="hidden"&&Jt&&(Tt=!0)}function Ks(e){e.addEventListener("keydown",Ws,!0),e.addEventListener("mousedown",Nt,!0),e.addEventListener("pointerdown",Nt,!0),e.addEventListener("touchstart",Nt,!0),e.addEventListener("visibilitychange",zs,!0)}function Hs(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return Tt||Vs(t)}function qc(){const e=s=>{s!=null&&Ks(s.ownerDocument)},[t,n]=E(!1);function r(){return t()?(Jt=!0,window.clearTimeout(Mn),Mn=window.setTimeout(()=>{Jt=!1},100),n(!1),!0):!1}function o(s){return Hs(s)?(n(!0),!0):!1}return{isFocusVisibleRef:{get current(){return t()}},onFocus:o,onBlur:r,ref:e}}const Gs=new Ds;function qs(e){return e?Array.isArray(e)?e.flat(1/0).filter(t=>!!t):[e]:[]}function Js(){if(!P.context)return Cr();const e=so().replaceAll("-",""),t=9,n=Math.ceil(e.length/t),r=[];for(let o=1;o<=n;++o){const s=(o-1)*t,i=Number(e.slice(s,s+t));r.push(i.toString(32))}return r.join("-")}function Sr(e){const t=Ye(Ho),[n,r]=E(""),o=Js();let s,i=!1;return ue(a=>{var u;const c=e();let l;if(c){const d=Ms(qs(c));i="@global"in d,l=Fs({name:"css",props:d,cache:Gs,componentId:o}),s=Bs(l.id),s?qt(s):s=Us(l.rules,{id:l.id,nonce:(u=t.cache)==null?void 0:u.nonce},t.injectFirst),a!=null&&a.styleElement&&Tn(a.styleElement)}return typeof(l==null?void 0:l.className)=="string"?r(l.className):r(""),{className:l==null?void 0:l.className,styleElement:s}},void 0),de(()=>{s&&Tn(s,t.cleanupStyles??i)}),n}function $e(e,t,n={}){for(const r in e){const o=e[r];if(pr(r))n[r]=$e(o,t);else if(Gt(r))n[r]=$e(o,t);else if(yr(r)){n[r]={};for(const s in o)n[r][s]=$e(o[s],t)}else if(mr(r))n[r]=$e(o,t);else{const s=t(r,o);if(s)for(const i in s)n[i]=Gt(i)?{...n[i],...s[i]}:s[i];else n[r]=o}}return n}const Xs=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","fontWeight","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","WebkitLineClamp","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function xr(e,t){if(typeof t=="number")return{[e]:Xs.has(e)?t.toString():`${t}px`}}function In(e,t={}){return $e(e,xr,t)}function bt(e,t,n){if(typeof n!="string")return n;const r=n.split(".");let o=e[t];for(let s=0;s<r.length&&(o=o==null?void 0:o[r[s]],!!o);s++);return o??n}function Ys(e,t){return t.split(".").reduce((n,r)=>n&&n[r]?n[r]:null,e)}function Zs(e,t,n,r){const o=Ys(e,t)||n;return typeof o=="number"?s=>typeof s=="string"?s:o*s:Array.isArray(o)?s=>typeof s=="string"?s:o[s]:typeof o=="function"?o:()=>{}}const ae={x:["Left","Right"],y:["Top","Bottom"]};function Or(e){return typeof e=="number"?`${e}px`:e}function vr(e,t){return(n,r)=>t(e,n,r)}function f(e,t){return t?(n,r)=>({[e]:t(e,n,r)}):n=>({[e]:n})}function ze(e){return f(e,(t,n)=>Or(n))}function W(e,t,n){const r=t.map(o=>`${e}${o}`);return n?(o,s)=>r.reduce((i,a)=>(i[a]=n(a,o,s),i),{}):o=>r.reduce((s,i)=>(s[i]=o,s),{})}function Qs(){return{...ei(),...ti(),...ni(),...ri(),...oi(),...si(),...ii(),...ci(),...ai()}}function ei(){return{displayPrint:vr("displayPrint",(e,t)=>({"@media print":{display:t}})),displayRaw:f("display"),overflow:f("overflow"),textOverflow:f("textOverflow"),visibility:f("visibility"),whiteSpace:f("whiteSpace")}}function ti(){return{flexBasis:f("flexBasis"),flexDirection:f("flexDirection"),flexWrap:f("flexWrap"),justifyContent:f("justifyContent"),alignItems:f("alignItems"),alignContent:f("alignContent"),order:f("order"),flex:f("flex"),flexGrow:f("flexGrow"),flexShrink:f("flexShrink"),alignSelf:f("alignSelf"),justifyItems:f("justifyItems"),justifySelf:f("justifySelf")}}function ni(){const e=(t,n,r)=>Zs(r,"spacing",8)(n);return{gap:f("gap",e),columnGap:f("columnGap",e),rowGap:f("rowGap",e),gridColumn:f("gridColumn"),gridRow:f("gridRow"),gridAutoFlow:f("gridAutoFlow"),gridAutoColumns:f("gridAutoColumns"),gridAutoRows:f("gridAutoRows"),gridTemplateColumns:f("gridTemplateColumns"),gridTemplateRows:f("gridTemplateRows"),gridTemplateAreas:f("gridTemplateAreas"),gridArea:f("gridArea")}}function ri(){return{position:f("position"),zIndex:f("zIndex",(e,t,n)=>{var r;return((r=n.zIndex)==null?void 0:r[e])??t}),top:ze("top"),right:ze("right"),bottom:ze("bottom"),left:ze("left")}}function oi(){const e=(t,n,r)=>bt(r,"palette",n);return{color:f("color",e),bgcolor:f("backgroundColor",e),backgroundColor:f("backgroundColor",e)}}function si(){const e=(t,n,r)=>(t==="maxWidth"&&(n=r.breakpoints.values[t]??n),typeof n=="number"&&(n=n>0&&n<=1?`${n*100}%`:`${n}px`),n);return{width:f("width",e),maxWidth:f("maxWidth",e),minWidth:f("minWidth",e),height:f("height",e),maxHeight:f("maxHeight",e),minHeight:f("minHeight",e),boxSizing:f("boxSizing",e)}}function ii(){const e=(n,r)=>typeof r=="number"?`${r}px solid`:r,t=(n,r,o)=>bt(o,"palette",r);return{border:f("border",e),borderTop:f("borderTop",e),borderRight:f("borderRight",e),borderBottom:f("borderBottom",e),borderLeft:f("borderLeft",e),borderColor:f("borderColor",t),borderTopColor:f("borderTopColor",t),borderRightColor:f("borderRightColor",t),borderBottomColor:f("borderBottomColor",t),borderLeftColor:f("borderLeftColor",t),borderRadius:f("borderRadius",(n,r,o)=>typeof r=="number"?`${o.shape.borderRadius*r}px`:r)}}function ai(){const e=(t,n,r)=>bt(r,"typography",n);return{typography:vr("typography",(t,n,r)=>bt(r,"typography",n)),fontFamily:f("fontFamily",e),fontSize:f("fontSize",(t,n,r)=>Or(e(t,n,r))),fontStyle:f("fontStyle",e),fontWeight:f("fontWeight",e),letterSpacing:ze("letterSpacing"),lineHeight:f("lineHeight"),textAlign:f("textAlign"),textTransform:f("textTransform")}}function ci(){const e=(r,o,s)=>s.spacing(o),t="margin",n="padding";return{m:f(t,e),mt:f("marginTop",e),mr:f("marginRight",e),mb:f("marginBottom",e),ml:f("marginLeft",e),mx:W(t,ae.x,e),my:W(t,ae.y,e),margin:f(t,e),marginTop:f("marginTop",e),marginRight:f("marginRight",e),marginBottom:f("marginBottom",e),marginLeft:f("marginLeft",e),marginX:W(t,ae.x,e),marginY:W(t,ae.y,e),marginInline:W(t,["Inline","InlineStart"],e),marginInlineStart:f("marginInlineStart",e),marginInlineEnd:f("marginInlineEnd",e),marginBlock:W(t,["BlockStart","BlockEnd"],e),marginBlockStart:f("marginBlockStart",e),marginBlockEnd:f("marginBlockEnd",e),p:f(n,e),pt:f("paddingTop",e),pr:f("paddingRight",e),pb:f("paddingBottom",e),pl:f("paddingLeft",e),px:W(n,ae.x,e),py:W(n,ae.y,e),padding:f(n,e),paddingTop:f("paddingTop",e),paddingRight:f("paddingRight",e),paddingBottom:f("paddingBottom",e),paddingLeft:f("paddingLeft",e),paddingX:W(n,ae.x,e),paddingY:W(n,ae.y,e),paddingInline:W(n,["Inline","InlineStart"],e),paddingInlineStart:f("paddingInlineStart",e),paddingInlineEnd:f("paddingInlineEnd",e),paddingBlock:W(n,["BlockStart","BlockEnd"],e),paddingBlockStart:f("paddingBlockStart",e),paddingBlockEnd:f("paddingBlockEnd",e)}}const dn=Qs(),Jc=Object.keys(dn);function li(e,t,n){return dn[e](t,n)}function Pn(e,t,n){return e in dn?li(e,t,n):xr(e,t)}function ui(e,t){return $e(e,(n,r)=>{if(typeof r=="function"&&(r=r(t)),r==null)return r;if(typeof r=="object"){const o={};for(const s of t.breakpoints.keys)o[t.breakpoints.up(s)]={};return Object.assign(o,zo({theme:t},r,s=>Pn(n,s,t)??{[n]:s}))}else return Pn(n,r,t)})}function kr(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=kr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function di(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=kr(e))&&(r&&(r+=" "),r+=t);return r}const $r=["ownerState","theme","sx","as"];function fi(e,t){var n,r;return(r=(n=t.components)==null?void 0:n[e])==null?void 0:r.styleOverrides}function gi(e,t,n,r,o={}){return L(()=>{const s=e(),i=fi(o.name,s),a=r.ownerState,c=n.reduce((u,d)=>{let g;return typeof d=="function"?g=d({ownerState:a,theme:s,get sx(){return r.sx},get as(){return r.as},props:r}):d&&(g=d),g&&u.push(In(g,{name:t,__resolved:!0})),u},[]);let l=[];return o.overridesResolver&&typeof o.overridesResolver=="function"&&i&&(l=o.overridesResolver(r,i).map(u=>u?In(u,{}):null).filter(Boolean)),c.concat(l)})}function Ar(e,t){e.__suid=t}function Ln(e){if(typeof e=="function")return e.__suid}function hi(e){return function(n,r={}){let o,s;if(r.name){const a=r.slot||"Root";s=o=`${r.name}-${a.slice(0,1).toLowerCase()+a.slice(1)}`}else s=`styled-${Cr()}`,o="css";const i=Ln(n);return function(...a){function c(l){let u;const d=()=>{const D=l.theme;return D||u||(u=e&&e.onUseTheme?e.onUseTheme():un())},[,g]=kt(l,r.skipProps||$r),m=gi(d,o,a,l,r),p=()=>{const D=l.sx;return D?Array.isArray(D)?D:[D]:[]},C=()=>{if(i)return n;const D=l.as;return D||n},b=i?()=>i:L(()=>Ln(C())),I=r.skipSx?()=>m():()=>{const D=d();return[...m(),...p().map(q=>q.__resolved?q:ui(q,D))]},R=Sr(()=>b()?void 0:I());return gr(C,Gn(g,{get children(){return l.children},get component(){return b()?l.component:null},get as(){return i?l.as:void 0},get sx(){return b()?I():void 0},get ownerState(){return b()==="system"?l.ownerState:void 0},get class(){return di([...new Set([l.class,s,R()])])}}))}return Ar(c,"system"),s&&(c.toString=()=>`.${s}`),c}}}const Xc=[...$r,"classes"],Yc=hi({onUseTheme:()=>fr()}),mi="codenomad.client-id",pi="codenomad.connection-id";let it=null,at=null;function Xt(){return{clientId:yi(),connectionId:bi()}}function yi(){return it||(it=Er(mi,window.localStorage),it)}function bi(){return at||(at=Er(pi,window.sessionStorage),at)}function Er(e,t){if(typeof window>"u")return Ut();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return Ut()}const n=Ut();try{t.setItem(e,n)}catch{}return n}function Ut(){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 Yt={exports:{}},Bt,Dn;function wi(){if(Dn)return Bt;Dn=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,s=r*365.25;Bt=function(u,d){d=d||{};var g=typeof u;if(g==="string"&&u.length>0)return i(u);if(g==="number"&&isFinite(u))return d.long?c(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.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(u);if(d){var g=parseFloat(d[1]),m=(d[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return g*s;case"weeks":case"week":case"w":return g*o;case"days":case"day":case"d":return g*r;case"hours":case"hour":case"hrs":case"hr":case"h":return g*n;case"minutes":case"minute":case"mins":case"min":case"m":return g*t;case"seconds":case"second":case"secs":case"sec":case"s":return g*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function a(u){var d=Math.abs(u);return d>=r?Math.round(u/r)+"d":d>=n?Math.round(u/n)+"h":d>=t?Math.round(u/t)+"m":d>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var d=Math.abs(u);return d>=r?l(u,d,r,"day"):d>=n?l(u,d,n,"hour"):d>=t?l(u,d,t,"minute"):d>=e?l(u,d,e,"second"):u+" ms"}function l(u,d,g,m){var p=d>=g*1.5;return Math.round(u/g)+" "+m+(p?"s":"")}return Bt}function Ci(e){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=wi(),n.destroy=l,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let d=0;for(let g=0;g<u.length;g++)d=(d<<5)-d+u.charCodeAt(g),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(u){let d,g=null,m,p;function C(...b){if(!C.enabled)return;const I=C,R=Number(new Date),D=R-(d||R);I.diff=D,I.prev=d,I.curr=R,d=R,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let q=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(B,h)=>{if(B==="%%")return"%";q++;const w=n.formatters[h];if(typeof w=="function"){const v=b[q];B=w.call(I,v),b.splice(q,1),q--}return B}),n.formatArgs.call(I,b),(I.log||n.log).apply(I,b)}return C.namespace=u,C.useColors=n.useColors(),C.color=n.selectColor(u),C.extend=r,C.destroy=n.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(m!==n.namespaces&&(m=n.namespaces,p=n.enabled(u)),p),set:b=>{g=b}}),typeof n.init=="function"&&n.init(C),C}function r(u,d){const g=n(this.namespace+(typeof d>"u"?":":d)+u);return g.log=this.log,g}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];const d=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const g of d)g[0]==="-"?n.skips.push(g.slice(1)):n.names.push(g)}function s(u,d){let g=0,m=0,p=-1,C=0;for(;g<u.length;)if(m<d.length&&(d[m]===u[g]||d[m]==="*"))d[m]==="*"?(p=m,C=g,m++):(g++,m++);else if(p!==-1)m=p+1,C++,g=C;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function i(){const u=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),u}function a(u){for(const d of n.skips)if(s(u,d))return!1;for(const d of n.names)if(s(u,d))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){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 Si=Ci;(function(e,t){var n={};t.formatArgs=o,t.save=s,t.load=i,t.useColors=r,t.storage=a(),t.destroy=(()=>{let l=!1;return()=>{l||(l=!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 l;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&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let d=0,g=0;l[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(g=d))}),l.splice(g,0,u)}t.log=console.debug||console.log||(()=>{});function s(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function i(){let l;try{l=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function a(){try{return localStorage}catch{}}e.exports=Si(t);const{formatters:c}=e.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Yt,Yt.exports);var xi=Yt.exports;const Zt=co(xi),Ue=["sse","api","session","actions"],Tr="opencode:logger:namespaces",_t=new Map,Q=new Set,te=typeof globalThis<"u"?globalThis.console:void 0;function Qe(){Q.size===0?Zt.disable():Zt.enable(Array.from(Q).join(","))}function Mt(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(Tr,JSON.stringify(Array.from(Q)))}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to persist logger namespaces",t)}}function Oi(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(Tr);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)Ue.includes(r)&&Q.add(r)}catch(t){(e=te==null?void 0:te.warn)==null||e.call(te,"Failed to hydrate logger namespaces",t)}}Oi();Qe();function vi(e){const n=Zt(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 Ce(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return _t.has(e)||_t.set(e,vi(e)),_t.get(e)}function ki(){return Ue.map(e=>({name:e,enabled:Q.has(e)}))}function $i(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)||(Q.add(e),Mt(),Qe())}function Ai(e){if(!Ue.includes(e))throw new Error(`Unknown logger namespace: ${e}`);Q.has(e)&&(Q.delete(e),Mt(),Qe())}function Ei(){Q.clear(),Mt(),Qe()}function Ti(){Ue.forEach(e=>Q.add(e)),Mt(),Qe()}const Mi={listLoggerNamespaces:ki,enableLogger:$i,disableLogger:Ai,enableAllLoggers:Ti,disableAllLoggers:Ei};function Ii(){typeof window>"u"||(window.codenomadLogger=Mi)}Ii();function Pi(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)}})}var Kn;const Li=typeof window<"u"?(Kn=window.location)==null?void 0:Kn.origin:void 0,Di=typeof window<"u"?window.__CODENOMAD_API_BASE__??Li:void 0,Fi=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",oe=Di,jt=Ri(oe,Fi),Zc=oe;function Qc(e,t){const n=encodeURIComponent(e),r=encodeURIComponent(t);return Ni(`/workspaces/${n}/plugin/background-processes/${r}/stream`)}function Ri(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(e){const n=t.startsWith("/")?t:`/${t}`;return`${e}${n}`}return t}function Ni(e){if(e.startsWith("http://")||e.startsWith("https://")||!oe)return e;const t=e.startsWith("/")?e:`/${e}`;return`${oe}${t}`}const Fn=Ce("api"),Rn=Ce("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 ce(e,t){if(t){Fn.info(e,t);return}Fn.info(e)}async function Ir(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}const Ui=[9898,9899,3e3];async function Bi(e,t){var r;const n=typeof window<"u"?(r=window.location)==null?void 0:r.origin:void 0;if(n&&n!==t)try{const o=new URL(e,n).toString(),s=await fetch(o,{method:"HEAD",credentials:"include"});if(s.ok||s.status<500)return n}catch{}for(const o of Ui){const s=`http://127.0.0.1:${o}`;if(!(s===t||s===n))try{const i=new URL(e,s).toString(),a=await fetch(i,{method:"HEAD",credentials:"include"});if(a.ok||a.status<500)return s}catch{}}return null}async function y(e,t){var i;const n=oe?new URL(e,oe).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();ce(`${o} ${e}`);try{const a=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!a.ok){const l=await Ir(a);throw ce(`${o} ${e} -> ${a.status}`,{durationMs:Date.now()-s,error:l}),new Error(l||`Request failed with ${a.status}`)}const c=Date.now()-s;return ce(`${o} ${e} -> ${a.status}`,{durationMs:c}),a.status===204?void 0:await a.json()}catch(a){if(a instanceof TypeError&&((i=a.message)!=null&&i.includes("fetch"))){const c=await Bi(e,oe);if(c){ce(`${o} ${e} retrying on fallback ${c}`);const l=new URL(e,c).toString(),u=await fetch(l,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(u.ok)return u.status===204?void 0:await u.json()}}throw ce(`${o} ${e} failed`,{durationMs:Date.now()-s,error:a}),a}}async function _i(e,t){const n=oe?new URL(e,oe).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();ce(`${o} ${e}`);const i=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!i.ok){const a=await Ir(i);throw ce(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s,error:a}),new Error(a||`Request failed with ${i.status}`)}return ce(`${o} ${e} -> ${i.status}`,{durationMs:Date.now()-s}),i}const ee={fetchWorkspaces(){return y("/api/workspaces")},fetchWorktrees(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees`)},createWorktree(e,t){return y(`/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 y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}${o}`,{method:"DELETE"})},readWorktreeMap(e){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`)},writeWorktreeMap(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/map`,{method:"PUT",body:JSON.stringify(t)})},createWorkspace(e){return y("/api/workspaces",{method:"POST",body:JSON.stringify(e)})},fetchSidecars(){return y("/api/sidecars")},createSidecar(e){return y("/api/sidecars",{method:"POST",body:JSON.stringify(e)})},updateSidecar(e,t){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteSidecar(e){return y(`/api/sidecars/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchServerMeta(){return y("/api/meta")},probeRemoteServer(e){return y("/api/remote-servers/probe",{method:"POST",body:JSON.stringify(e)})},createRemoteProxySession(e){return y("/api/remote-proxy/sessions",{method:"POST",body:JSON.stringify(e)})},deleteRemoteProxySession(e){return y(`/api/remote-proxy/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},fetchAuthStatus(){return y("/api/auth/status")},setServerPassword(e){return y("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return y(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},listWorkspaceFiles(e,t="."){const n=new URLSearchParams({path:t});return y(`/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),y(`/api/workspaces/${encodeURIComponent(e)}/files/search?${o.toString()}`)},readWorkspaceFile(e,t){const n=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${n.toString()}`)},writeWorkspaceFile(e,t,n){const r=new URLSearchParams({path:t});return y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`,{method:"PUT",body:JSON.stringify({contents:n})})},fetchWorktreeGitStatus(e,t){return y(`/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),y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-diff?${r.toString()}`)},stageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-stage`,{method:"POST",body:JSON.stringify(n)})},unstageWorktreeGitPaths(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-unstage`,{method:"POST",body:JSON.stringify(n)})},commitWorktreeGitChanges(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/${encodeURIComponent(t)}/git-commit`,{method:"POST",body:JSON.stringify(n)})},fetchConfigOwner(e){return y(`/api/storage/config/${encodeURIComponent(e)}`)},patchConfigOwner(e,t){return y(`/api/storage/config/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},fetchStateOwner(e){return y(`/api/storage/state/${encodeURIComponent(e)}`)},patchStateOwner(e,t){return y(`/api/storage/state/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t??{})})},validateBinary(e){return y("/api/storage/binaries/validate",{method:"POST",body:JSON.stringify({path:e})})},fetchSpeechCapabilities(){return y("/api/speech/capabilities")},transcribeAudio(e){return y("/api/speech/transcribe",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeech(e){return y("/api/speech/synthesize",{method:"POST",body:JSON.stringify(e)})},synthesizeSpeechStream(e,t){return _i("/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 y(r?`/api/filesystem?${r}`:"/api/filesystem")},createFileSystemFolder(e,t){return y("/api/filesystem/folders",{method:"POST",body:JSON.stringify({parentPath:e,name:t})})},readInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`)},writeInstanceData(e,t){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})},deleteInstanceData(e){return y(`/api/storage/instances/${encodeURIComponent(e)}`,{method:"DELETE"})},listBackgroundProcesses(e){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes`)},stopBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/stop`,{method:"POST"})},terminateBackgroundProcess(e,t){return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/terminate`,{method:"POST"})},updateVoiceMode(e,t){const n=Xt();return y(`/workspaces/${encodeURIComponent(e)}/plugin/voice-mode`,{method:"POST",body:JSON.stringify({...n,enabled:t})})},sendClientConnectionPong(e){return y("/api/client-connections/pong",{method:"POST",body:JSON.stringify(e)})},fetchBackgroundProcessOutput(e,t,n){const r=new URLSearchParams;n!=null&&n.method&&r.set("method",n.method),n!=null&&n.pattern&&r.set("pattern",n.pattern),n!=null&&n.lines&&r.set("lines",String(n.lines)),(n==null?void 0:n.maxBytes)!==void 0&&r.set("maxBytes",String(n.maxBytes));const o=r.toString(),s=o?`?${o}`:"";return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/output${s}`)},connectEvents(e,t,n){const r=Xt(),o=ji(r);Rn.info(`Connecting to ${o}`);const s=new EventSource(o,{withCredentials:!0});return Pi(s,{onEvent:e,onError:t,onPing:n,logger:Rn}),s}};function ji(e){const t=new URL(jt,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),jt.startsWith("http://")||jt.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}const Nn=1e3,Vi=1e4,Qt=Ce("sse");function ct(e,t){if(t){Qt.info(e,t);return}Qt.info(e)}class Wi{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.source=null,this.retryDelay=Nn,this.reconnectTimer=null,this.connect()}connect(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.source&&this.source.close(),ct("Connecting to backend events stream"),this.source=ee.connectEvents(t=>this.dispatch(t),()=>this.scheduleReconnect(),t=>{ee.sendClientConnectionPong({...Xt(),pingTs:t.ts}).catch(n=>{Qt.error("Failed to send client connection pong",n)})}),this.source.onopen=()=>{ct("Events stream connected"),this.retryDelay=Nn,this.openHandlers.forEach(t=>t())}}scheduleReconnect(){if(this.reconnectTimer!==null)return;const t=this.source;this.source=null,ct("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryDelay=Math.min(this.retryDelay*2,Vi),this.connect()},this.retryDelay),t==null||t.close()}dispatch(t){var n,r;ct(`event ${t.type}`),(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(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)}}const Vt=new Wi,zi=Ce("actions"),Un={messageHistory:[],agentModelSelections:{}};function Bn(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){zi.warn("Failed to compare config objects",n)}return!1}class Ki{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,Vt.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),Vt.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),Vt.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=ee.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)}async patchConfigOwner(t,n){const r=await ee.patchConfigOwner(t,n);return 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=ee.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)}async patchStateOwner(t,n){const r=await ee.patchStateOwner(t,n);return 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=ee.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)}async saveInstanceData(t,n){const r=this.normalizeInstanceData(n);await ee.writeInstanceData(t,r),this.setInstanceDataCache(t,r)}async deleteInstanceData(t){await ee.deleteInstanceData(t),this.setInstanceDataCache(t,Un)}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&&Bn(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)}normalizeInstanceData(t){const n=t??Un,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&&Bn(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 Y=new Ki,Pr=Ce("api"),It={messageHistory:[],agentModelSelections:{}},[fn,Lr]=E(new Map),lt=new Map,Fe=new Map;function Dr(e){const t=e??It;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function _n(e){if(Fe.has(e))return;const t=Y.onInstanceDataChanged(e,n=>{wt(e,n)});Fe.set(e,t)}function Hi(e){const t=Fe.get(e);t&&(t(),Fe.delete(e))}function wt(e,t){Lr(n=>{const r=new Map(n);return r.set(e,Dr(t)),r})}async function Pt(e){if(!e||fn().has(e))return;if(lt.has(e)){await lt.get(e);return}const t=Y.loadInstanceData(e).then(n=>{wt(e,n),_n(e)}).catch(n=>{Pr.warn("Failed to load instance data",n),wt(e,It),_n(e)}).finally(()=>{lt.delete(e)});lt.set(e,t),await t}async function Fr(e,t){if(!e)return;await Pt(e);const n=fn().get(e)??It,r=Dr(n);t(r);try{await Y.saveInstanceData(e,r)}catch(o){Pr.warn("Failed to persist instance data",o)}wt(e,r)}function Rr(e){return fn().get(e)??It}function Gi(e){Lr(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),Hi(e)}const qi=Ne(),Ji={getInstanceConfig:Rr,ensureInstanceConfig:Pt,updateInstanceConfig:Fr,clearInstanceConfig:Gi},el=e=>(de(()=>{for(const t of Fe.values())t();Fe.clear()}),fe(qi.Provider,{value:Ji,get children(){return e.children}})),Xi=Ce("api"),[jn,en]=E(null),[tl,Vn]=E(!1),[nl,gt]=E(null);let _e=null;async function Yi(e=!1){return!e&&jn()?jn():_e||(Vn(!0),gt(null),_e=ee.fetchSpeechCapabilities().then(t=>(en(t),gt(null),t)).catch(t=>(Xi.error("Failed to load speech capabilities",t),en(null),gt(t instanceof Error?t.message:String(t)),null)).finally(()=>{Vn(!1),_e=null}),_e)}function Zi(){en(null),gt(null)}const A=Ce("actions"),Qi=20,ea=5,ta=50,M={showThinkingBlocks:!1,showKeyboardShortcutHints:!0,thinkingBlocksExpansion:"expanded",showTimelineTools:!0,holdLongAssistantReplies:!0,promptSubmitOnEnter:!1,showPromptVoiceInput:!0,diffViewMode:"split",toolOutputExpansion:"expanded",diagnosticsExpansion:"expanded",toolInputsVisibility:"collapsed",showUsageMetrics:!0,autoCleanupBlankSessions:!0,keepUnseenSubagentIdleStatus:!1,osNotificationsEnabled:!1,osNotificationsAllowWhenVisible:!1,notifyOnNeedsInput:!0,notifyOnIdle:!0},ve={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function Nr(e){const t=e??{};return{showThinkingBlocks:t.showThinkingBlocks??M.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??M.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??M.thinkingBlocksExpansion,showTimelineTools:t.showTimelineTools??M.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??M.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??M.promptSubmitOnEnter,showPromptVoiceInput:t.showPromptVoiceInput??M.showPromptVoiceInput,locale:t.locale??M.locale,diffViewMode:t.diffViewMode??M.diffViewMode,toolOutputExpansion:t.toolOutputExpansion??M.toolOutputExpansion,diagnosticsExpansion:t.diagnosticsExpansion??M.diagnosticsExpansion,toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:M.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??M.showUsageMetrics,autoCleanupBlankSessions:t.autoCleanupBlankSessions??M.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??M.keepUnseenSubagentIdleStatus,osNotificationsEnabled:t.osNotificationsEnabled??M.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??M.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??M.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??M.notifyOnIdle}}function Ur(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 Br(e){const t=e??{};return{provider:t.provider==="openai-compatible"?t.provider:ve.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:typeof t.sttModel=="string"&&t.sttModel.trim()?t.sttModel.trim():ve.sttModel,ttsModel:typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():ve.ttsModel,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():ve.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:ve.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:ve.ttsFormat}}function je(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 na(e){var n,r,o;const t=e??{};return{recentFolders:je(t.recentFolders,s=>{if(!s||typeof s!="object")return null;const i=s.path,a=s.lastAccessed;if(typeof i!="string")return null;const c=typeof a=="number"?a:Date.now();return{path:i,lastAccessed:c}}),opencodeBinaries:je(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,l=typeof s.label=="string"?s.label:void 0;return{path:i,version:c,label:l,lastUsed:a}}),remoteServers:je(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 l=typeof s.createdAt=="string"?s.createdAt:new Date().toISOString(),u=typeof s.updatedAt=="string"?s.updatedAt:l,d=typeof s.lastConnectedAt=="string"?s.lastConnectedAt:void 0;return{id:i,name:a,baseUrl:c,skipTlsVerify:!!s.skipTlsVerify,createdAt:l,updatedAt:u,lastConnectedAt:d}}).sort((s,i)=>{const a=s.lastConnectedAt??s.updatedAt;return(i.lastConnectedAt??i.updatedAt).localeCompare(a)}),models:{recents:je((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:je((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:Ur((o=t.models)==null?void 0:o.thinkingSelections)}}}function ra(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",s=Ur(t.environmentVariables),i=Br(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:s,speech:i}}function _r(e){return`${e.providerId}/${e.modelId}`}function jr(e,t){const n=t.filter(r=>r.path!==e);return n.unshift({path:e,lastAccessed:Date.now()}),n.slice(0,Qi)}function gn(e,t,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 oa(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??sa(),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 Vr(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 sa(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[hn,Ct]=E({}),[ia,St]=E({}),[aa,xt]=E({}),[Wr,He]=E(!1),ca=L(()=>Nr(hn().settings)),zr=L(()=>hn().theme??"system"),Se=L(()=>ra(ia())),re=L(()=>na(aa())),V=ca,Lt=L(()=>re().recentFolders),et=L(()=>re().opencodeBinaries),Re=L(()=>re().remoteServers);let ut=null;async function Dt(){Wr()||(ut||(ut=Promise.all([Y.loadConfigOwner("ui"),Y.loadConfigOwner("server"),Y.loadStateOwner("ui")]).then(([e,t,n])=>{Ct(e),St(t),xt(n),He(!0)}).catch(e=>{A.error("Failed to load settings",e),Ct({}),St({}),xt({}),He(!0)}).finally(()=>{ut=null})),await ut)}async function ie(e,t){await Dt();const n=await Y.patchConfigOwner(e,t);e==="ui"&&Ct(n),e==="server"&&St(n)}async function H(e,t){await Dt();const n=await Y.patchStateOwner(e,t);xt(n)}function G(e){const t=hn(),r={settings:Nr({...t.settings??{},...e})};ie("ui",r).catch(o=>A.error("Failed to patch ui settings",o))}function Kr(e){G(e)}function la(e){zr()!==e&&ie("ui",{theme:e}).catch(t=>A.error("Failed to set theme",t))}async function ua(e){Se().listeningMode!==e&&await ie("server",{listeningMode:e})}function mn(e){ie("server",{environmentVariables:e}).catch(t=>A.error("Failed to update environment variables",t))}function da(e,t){const n=Se().environmentVariables;mn({...n,[e]:t})}function fa(e){const t=Se().environmentVariables,{[e]:n,...r}=t;mn(r)}function ga(e){const t=e&&e.trim().length>0?e:"opencode";ie("server",{opencodeBinary:t}).catch(r=>A.error("Failed to set default binary",r));const n=gn(t,void 0,et());H("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to update binary list",r))}function ha(e){ie("server",{logLevel:e??"DEBUG"}).catch(n=>A.error("Failed to set log level",n))}async function ma(e){const t=e.apiKey,{apiKey:n,...r}=e,o=Br({...Se().speech,...r,...t===null?{}:{apiKey:t}}),{hasApiKey:s,...i}=o,a={...i,...t===null?{apiKey:null}:{}};try{await ie("server",{speech:a})}catch(c){throw A.error("Failed to update speech settings",c),c}}function pa(e,t){const n=gn(e,t,et());H("ui",{opencodeBinaries:n}).catch(r=>A.error("Failed to add binary",r))}function ya(e){const t=et().filter(n=>n.path!==e);H("ui",{opencodeBinaries:t}).catch(n=>A.error("Failed to remove binary",n)),Se().opencodeBinary===e&&ie("server",{opencodeBinary:"opencode"}).catch(n=>A.error("Failed to reset default binary",n))}function ba(e){const t=jr(e,Lt());H("ui",{recentFolders:t}).catch(n=>A.error("Failed to add recent folder",n))}function wa(e){const t=Lt().filter(n=>n.path!==e);H("ui",{recentFolders:t}).catch(n=>A.error("Failed to remove recent folder",n))}async function Ca(e){const t=oa(e,Re());return await H("ui",{remoteServers:Vr(t,Re())}),t}async function Sa(e){const t=Re().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await H("ui",{remoteServers:Vr(r,Re())})}function xa(e){const t=Re().filter(n=>n.id!==e);H("ui",{remoteServers:t}).catch(n=>A.error("Failed to remove remote server",n))}function Oa(e,t){const n=t&&t.trim().length>0?t:Se().opencodeBinary,r=jr(e,Lt()),o=gn(n,void 0,et());H("ui",{recentFolders:r,opencodeBinaries:o}).catch(s=>A.error("Failed to update ui state on launch",s)),ie("server",{opencodeBinary:n}).catch(s=>A.error("Failed to persist selected binary",s))}function va(e){if(!e.providerId||!e.modelId)return;const n=re().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,ea);H("ui",{models:{recents:r}}).catch(o=>A.error("Failed to update model recents",o))}function ka(e){return!e.providerId||!e.modelId?!1:re().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function $a(e){if(!e.providerId||!e.modelId)return;const t=re().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,ta);H("ui",{models:{favorites:r}}).catch(o=>A.error("Failed to update model favorites",o))}function Aa(e){if(!(!e.providerId||!e.modelId))return re().models.thinkingSelections[_r(e)]}function Ea(e,t){if(!e.providerId||!e.modelId)return;const n=_r(e);if(re().models.thinkingSelections[n]===t)return;const o={...re().models.thinkingSelections};t?o[n]=t:delete o[n],H("ui",{models:{thinkingSelections:o}}).catch(s=>A.error("Failed to update thinking selection",s))}function Ta(e){V().diffViewMode!==e&&G({diffViewMode:e})}function Ma(e){V().toolOutputExpansion!==e&&G({toolOutputExpansion:e})}function Ia(e){V().diagnosticsExpansion!==e&&G({diagnosticsExpansion:e})}function Pa(e){V().toolInputsVisibility!==e&&G({toolInputsVisibility:e})}function La(e){V().thinkingBlocksExpansion!==e&&G({thinkingBlocksExpansion:e})}function Da(){G({showThinkingBlocks:!V().showThinkingBlocks})}function Fa(){Kr({showKeyboardShortcutHints:!V().showKeyboardShortcutHints})}function Ra(){G({showTimelineTools:!V().showTimelineTools})}function Na(){G({showUsageMetrics:!V().showUsageMetrics})}function Ua(){G({promptSubmitOnEnter:!V().promptSubmitOnEnter})}function Ba(){G({showPromptVoiceInput:!V().showPromptVoiceInput})}function _a(){const e=!V().autoCleanupBlankSessions;A.info("toggle auto cleanup",{value:e}),G({autoCleanupBlankSessions:e})}async function ja(e,t,n){!e||!t||!n.providerId||!n.modelId||(await Pt(e),await Fr(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 Va(e,t){return!e||!t?void 0:(await Pt(e),(Rr(e).agentModelSelections??{})[t])}Dt().catch(e=>{A.error("Failed to initialize settings",e)});const Hr=Ne(),Wa={isLoaded:Wr,preferences:V,updatePreferences:Kr,themePreference:zr,setThemePreference:la,serverSettings:Se,setListeningMode:ua,updateEnvironmentVariables:mn,addEnvironmentVariable:da,removeEnvironmentVariable:fa,updateLastUsedBinary:ga,updateLogLevel:ha,updateSpeechSettings:ma,recentFolders:Lt,opencodeBinaries:et,remoteServers:Re,uiState:re,addRecentFolder:ba,removeRecentFolder:wa,addOpenCodeBinary:pa,removeOpenCodeBinary:ya,saveRemoteServerProfile:Ca,markRemoteServerConnected:Sa,removeRemoteServerProfile:xa,recordWorkspaceLaunch:Oa,addRecentModelPreference:va,isFavoriteModelPreference:ka,toggleFavoriteModelPreference:$a,getModelThinkingSelection:Aa,setModelThinkingSelection:Ea,toggleShowThinkingBlocks:Da,toggleKeyboardShortcutHints:Fa,toggleShowTimelineTools:Ra,toggleUsageMetrics:Na,toggleAutoCleanupBlankSessions:_a,togglePromptSubmitOnEnter:Ua,toggleShowPromptVoiceInput:Ba,setDiffViewMode:Ta,setToolOutputExpansion:Ma,setDiagnosticsExpansion:Ia,setThinkingBlocksExpansion:La,setToolInputsVisibility:Pa,setAgentModelPreference:ja,getAgentModelPreference:Va},rl=e=>($t(()=>{Dt().catch(o=>{A.error("Failed to initialize settings",o)});const t=Y.onConfigOwnerChanged("ui",o=>{Ct(o),He(!0)}),n=Y.onConfigOwnerChanged("server",o=>{St(o),He(!0),Zi(),Yi(!0)}),r=Y.onStateOwnerChanged("ui",o=>{xt(o),He(!0)});return()=>{t(),n(),r()}}),fe(Hr.Provider,{value:Wa,get children(){return e.children}}));function za(){const e=Ye(Hr);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function Ka(e,t,n){const r={};return Object.keys(e).forEach(o=>{r[o]=e[o].reduce((s,i)=>(i&&(n&&n[i]&&s.push(n[i]),s.push(t(i))),s),[]).join(" ")}),r}const Ha=Symbol("solid-inspect"),Ga=Ne();function qa(e){function t(n){var r;return(r=Ye(Ga))!=null&&r.enabled?{Component:t,props:n,$INSPECT:Ha}:e(n)}return Object.defineProperty(t,"name",{value:e.name}),t.toString=e.toString,t}function Gr(){return function(e){function t(a){const c=!!e.slotClasses,l=()=>{if(!e.slotClasses)throw new Error("'slotClasses' option is not defined");if(!e.utilityClass)throw new Error("'utilityClass' option is not defined");return Ka(e.slotClasses(a),e.utilityClass,a.classes??"")},u=No({});return c&&io(()=>{const d=l();Ae(()=>{for(const g in d)u[g]=d[g]})}),u}function n(a){const[c,l]=kt(a,e.selfPropNames);return{allProps:a,props:c,otherProps:l}}function r(a){return $s({propDefaults:a.propDefaults||e.propDefaults,props:a.props,name:e.name})}function o(a){const c=r({props:a});return n(c)}function s(a,c=!0){return a=qa(a),a.toString=()=>`.${e.name}-root`,c&&Ar(a,"base"),a}function i(a){const c=s(function(u){const{allProps:d,otherProps:g,props:m}=o(u),p=e.autoCallUseClasses??!0?t(d):{};return a({allProps:d,otherProps:g,props:m,classes:p})});return Object.defineProperty(c,"name",{value:a.name}),c}return{name:e.name,selfPropNames:e.selfPropNames,component:i,defineComponent:s,useClasses:t,useThemeProps:r,useProps:o,splitInProps:n}}}const Ja=Gr()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),Xa=Ja.component(function({props:t}){return Sr(()=>({"@global":t.styles||{}})),[]}),Ya=Gr()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:e})=>e({enableColorScheme:!1})}),Za=(e,t)=>({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",...t&&{colorScheme:e.palette.mode}}),Qa=e=>({color:e.palette.text.primary,...e.typography.body1,backgroundColor:e.palette.background.default,"@media print":{backgroundColor:e.palette.common.white}}),ec=(e,t=!1)=>({html:Za(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...Qa(e),"&::backdrop":{backgroundColor:e.palette.background.default}}}),tc=Ya.component(function({props:t}){const n=fr();return fe(Xa,{get styles(){return ec(n,t.enableColorScheme)}})}),qr=Ne();function Wn(e){if(!(typeof document>"u")){if(e==="system"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}const nc={backgroundDefault:"#ffffff",backgroundPaper:"#f5f5f5",primary:"#0066ff",primaryContrast:"#ffffff",textPrimary:"#1a1a1a",textSecondary:"#666666",divider:"#e0e0e0"},rc={backgroundDefault:"#1a1a1a",backgroundPaper:"#2a2a2a",primary:"#0080ff",primaryContrast:"#1a1a1a",textPrimary:"#cfd4dc",textSecondary:"#999999",divider:"#3a3a3a"},me=(e,t,n)=>{if(!n)return t;const r=n.getPropertyValue(e);return r&&r.trim()||t},oc=e=>{const t=e?rc:nc,n=typeof window<"u"?getComputedStyle(document.documentElement):null;return{backgroundDefault:me("--surface-base",t.backgroundDefault,n),backgroundPaper:me("--surface-secondary",t.backgroundPaper,n),primary:me("--accent-primary",t.primary,n),primaryContrast:me("--text-inverted",t.primaryContrast,n),textPrimary:me("--text-primary",t.textPrimary,n),textSecondary:me("--text-secondary",t.textSecondary,n),divider:me("--border-base",t.divider,n)}};function ol(e){const t=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,{themePreference:n,setThemePreference:r}=za(),[o,s]=E(!0),[i,a]=E(0),c=()=>n(),l=()=>{const p=c();return p==="dark"?!0:p==="light"?!1:(t==null?void 0:t.matches)??!1},u=()=>{const p=c(),C=l();Wn(p==="system"?"system":p),s(C),typeof window<"u"?requestAnimationFrame(()=>a(b=>b+1)):a(b=>b+1)};z(()=>{u()}),$t(()=>{if(!t)return;const p=()=>{u()};return t.addEventListener("change",p),()=>{t.removeEventListener("change",p)}});const d=p=>{r(p)},g=()=>{const p=c();d(p==="system"?"light":p==="light"?"dark":"system")},m=L(()=>{i();const p=oc(o());return lr({palette:{mode:o()?"dark":"light",primary:{main:p.primary,contrastText:p.primaryContrast},secondary:{main:p.primary},background:{default:p.backgroundDefault,paper:p.backgroundPaper},text:{primary:p.textPrimary,secondary:p.textSecondary},divider:p.divider},typography:{fontFamily:"var(--font-family-sans)"},shape:{borderRadius:8},components:{MuiIconButton:{styleOverrides:{root:{color:"inherit","&.Mui-disabled":{color:"var(--text-muted)",opacity:.55}}}},MuiDrawer:{styleOverrides:{paper:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)"}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:"var(--surface-secondary)",color:"var(--text-primary)",boxShadow:"none",borderBottom:"1px solid var(--border-base)",zIndex:10}}},MuiToolbar:{styleOverrides:{root:{minHeight:"56px"}}}}})});return fe(qr.Provider,{value:{isDark:o,themeMode:c,setThemeMode:d,cycleThemeMode:g},get children(){return fe(As,{get theme(){return m()},get children(){return[fe(tc,{}),bo(()=>e.children)]}})}})}function Jr(){const e=Ye(qr);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const sc=/(^|\n)@@/m,ic=/(^|\n)(diff --git |--- |\+\+\+)/,ac=/^\*\*\* (Begin|End) Patch/,cc=/^\*\*\* Update File: (.+)$/,lc=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function uc(e){const t=e.trim();if(!t.startsWith("```"))return t;const n=t.split(`
16
16
  `);return n.length<2?"":n[n.length-1].startsWith("```")?n.slice(1,-1).join(`
17
- `):t}function lc(e){var s;if(!e)return"";const n=cc(e.replace(/\r\n/g,`
17
+ `):t}function dc(e){var s;if(!e)return"";const n=uc(e.replace(/\r\n/g,`
18
18
  `)).split(`
19
- `).map(i=>i.replace(/\s+$/u,""));let r=null;const o=[];for(const i of n){if(!i||sc.test(i))continue;const a=i.match(ic);if(a){r=((s=a[1])==null?void 0:s.trim())||null;continue}o.push(i)}return r&&!oc.test(o.join(`
19
+ `).map(i=>i.replace(/\s+$/u,""));let r=null;const o=[];for(const i of n){if(!i||ac.test(i))continue;const a=i.match(cc);if(a){r=((s=a[1])==null?void 0:s.trim())||null;continue}o.push(i)}return r&&!ic.test(o.join(`
20
20
  `))&&(o.unshift(`+++ b/${r}`),o.unshift(`--- a/${r}`)),o.join(`
21
- `).trim()}function rl(e){if(!e)return!1;const t=lc(e);return t?rc.test(t):!1}function uc(e){if(!e||e.trim().length===0)return{before:"",after:""};const t=e.replace(/\r\n/g,`
21
+ `).trim()}function sl(e){if(!e)return!1;const t=dc(e);return t?sc.test(t):!1}function fc(e){if(!e||e.trim().length===0)return{before:"",after:""};const t=e.replace(/\r\n/g,`
22
22
  `).split(`
23
- `),n=[],r=[];for(const o of t)o.startsWith("---")||o.startsWith("+++")||o.startsWith("diff --git")||ac.test(o)||(o.startsWith("-")&&!o.startsWith("---")?n.push(o.slice(1)):o.startsWith("+")&&!o.startsWith("+++")?r.push(o.slice(1)):o.startsWith(" ")?(n.push(o.slice(1)),r.push(o.slice(1))):o===""?(n.push(""),r.push("")):(n.push(o),r.push(o)));for(;n.length>0&&n[n.length-1]==="";)n.pop();for(;r.length>0&&r[r.length-1]==="";)r.pop();return{before:n.join(`
23
+ `),n=[],r=[];for(const o of t)o.startsWith("---")||o.startsWith("+++")||o.startsWith("diff --git")||lc.test(o)||(o.startsWith("-")&&!o.startsWith("---")?n.push(o.slice(1)):o.startsWith("+")&&!o.startsWith("+++")?r.push(o.slice(1)):o.startsWith(" ")?(n.push(o.slice(1)),r.push(o.slice(1))):o===""?(n.push(""),r.push("")):(n.push(o),r.push(o)));for(;n.length>0&&n[n.length-1]==="";)n.pop();for(;r.length>0&&r[r.length-1]==="";)r.pop();return{before:n.join(`
24
24
  `),after:r.join(`
25
- `)}}const dc="0.52.2",tn=`https://cdn.jsdelivr.net/npm/monaco-editor@${dc}/min/vs`,X="/monaco/vs";let dt=null;function fc(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 gc(){if(typeof fetch>"u")return!1;try{const e=new AbortController,t=fetch(`${tn}/loader.js`,{method:"HEAD",signal:e.signal}),n=await fc(t,1200);return e.abort(),n.ok}catch{return!1}}function hc(){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=`${X}/loader.js`,r.async=!0,r.onload=()=>t(),r.onerror=()=>n(new Error("Failed to load Monaco AMD loader")),document.head.appendChild(r)})}function mc(){if(typeof document>"u"||document.querySelector('link[data-monaco-editor-css="true"]'))return;const t=document.createElement("link");t.rel="stylesheet",t.href=`${X}/editor/editor.main.css`,t.dataset.monacoEditorCss="true",document.head.appendChild(t)}function pc(){const e=globalThis,t=e.MonacoEnvironment??{},n="/monaco.worker.js";e.MonacoEnvironment={...t,getWorkerUrl(r,o){return n}}}function Xr(){const e=globalThis.require;if(!e)throw new Error("Monaco AMD loader is not available");return e}function yc(){const t=Xr().config;if(!t)throw new Error("require.config is not available");return t}function nn(e){const t=Xr();return new Promise((n,r)=>{t(e,(...o)=>n(o),o=>r(o))})}function bc(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 zn=new Set,Wt=new Map;async function Yr(e){const t=bc(e);if(!t||zn.has(t))return;const n=Wt.get(t);if(n)return n;const r=(async()=>{let o=!1;try{await nn([t]),o=!0}catch{}finally{o&&zn.add(t),Wt.delete(t)}})();return Wt.set(t,r),r}async function Zr(){return dt||(dt=(async()=>{await hc(),pc(),mc();const e=await gc(),t=yc(),n={vs:X};e&&(n["vs/basic-languages"]=`${tn}/basic-languages`,n["vs/language"]=`${tn}/language`,n["vs/basic-languages/python"]=`${X}/basic-languages/python`,n["vs/basic-languages/markdown"]=`${X}/basic-languages/markdown`,n["vs/basic-languages/cpp"]=`${X}/basic-languages/cpp`,n["vs/basic-languages/kotlin"]=`${X}/basic-languages/kotlin`,n["vs/language/typescript"]=`${X}/language/typescript`,n["vs/language/html"]=`${X}/language/html`,n["vs/language/json"]=`${X}/language/json`,n["vs/language/css"]=`${X}/language/css`),t({paths:n,ignoreDuplicateModules:["vs/editor/editor.main"]});const[r]=await nn(["vs/editor/editor.main"]);return await nn(["vs/basic-languages/monaco.contribution"]).catch(()=>[]),globalThis.monaco??r})(),dt)}const wc=5,ae=new Map;function Cc(e,t){ae.delete(e),ae.set(e,t)}function Sc(){for(;ae.size>wc;){const e=ae.keys().next().value;if(!e)return;const t=ae.get(e);ae.delete(e);try{t==null||t.model.dispose()}catch{}}}function rn(e){const t=ae.get(e.cacheKey);if(t)return Cc(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 ae.set(e.cacheKey,o),Sc(),r}let ft=null;function xc(e){var o;if(ft)return ft;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 l of a)typeof l=="string"&&(t.has(l)||t.set(l,i));const c=Array.isArray(s==null?void 0:s.extensions)?s.extensions:[];for(const l of c)typeof l=="string"&&(n.has(l)||n.set(l,i))}return ft={fileNameToId:t,extToId:n},ft}function Oc(e){return e===".gitignore"||e===".gitattributes"||e===".gitmodules"||e==="Makefile"||e.startsWith("Makefile.")?"shell":null}function Qr(e,t){const n=String(t||"").trim(),r=n.split("/").pop()||n,o=Oc(r);if(o)return o;const s=xc(e),i=s.fileNameToId.get(r);if(i)return i;const a=r.lastIndexOf(".");if(a>0){const c=r.slice(a),l=s.extToId.get(c);if(l)return l}return"plaintext"}var vc=on("<div class=monaco-viewer><div class=git-change-context-overlay>"),kc=on("<div class=git-change-context-widget-host><button type=button class=git-change-context-widget>+");function Ot(e){return e?e.split(`
26
- `).length:1}function vt(e){return String(Math.max(1,e)).length}function $c(e){const t=Ot(e.before),n=Ot(e.after),r=vt(t),o=vt(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),l=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:6+i*2+l*2}}function Ac(e){const t=Ot(e.before),n=Ot(e.after),r=vt(t),o=vt(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),l=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:8+i*2+l}}function Ec(e){const{isDark:t}=Jr();let n,r=null,o=null,s=null;const[i,a]=E(!1),[c,l]=E(null),[u,d]=E(null),[g,m]=E(!1),[p,C]=E(null),b=L(()=>e.patch!==void 0&&e.patch!==null?uc(e.patch):{before:e.before??"",after:e.after??""}),I=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},R=()=>{n&&(n.style.removeProperty("--split-original-line-number-width"),n.style.removeProperty("--split-original-delete-sign-left"),n.style.removeProperty("--split-original-gutter-width"))},D=h=>{if(n){if(s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),h.viewMode!=="split"||typeof window>"u"){R();return}s=window.requestAnimationFrame(()=>{if(s=null,!n)return;const w=n.querySelector(".editor.original .line-numbers"),v=(w==null?void 0:w.getBoundingClientRect().width)??0,x=v>0?v:Math.max(12,h.originalLineNumbersMinChars*6);n.style.setProperty("--split-original-line-number-width",`${x}px`),n.style.setProperty("--split-original-delete-sign-left",`${x}px`),n.style.setProperty("--split-original-gutter-width",`${x+h.lineDecorationsWidth}px`)})}},q=()=>{var h;return((h=r==null?void 0:r.getModifiedEditor)==null?void 0:h.call(r))??null},tt=()=>{const h=u();if(h)return h;if(g()&&c())return{startLine:c(),endLine:c()};const w=c();return w?{startLine:w,endLine:w}:null},B=()=>{var x,O,$,S;const h=q(),w=n;if(!h||!w)return;const v=tt();if(!v){C(null);return}try{const T=(x=h.getDomNode)==null?void 0:x.call(h);if(!T){C(null);return}const N=T.querySelector(".margin"),J=T.querySelector(".monaco-scrollable-element.editor-scrollable"),fe=((O=h.getTopForLineNumber)==null?void 0:O.call(h,v.startLine))??0,xe=(($=h.getScrollTop)==null?void 0:$.call(h))??0,nt=Number(((S=h.getOption)==null?void 0:S.call(h,o.editor.EditorOption.lineHeight))??18),Be=T.getBoundingClientRect(),ge=w.getBoundingClientRect(),rt=Be.left-ge.left+((N==null?void 0:N.offsetWidth)??(J==null?void 0:J.offsetLeft)??0),eo=Be.top-ge.top+(fe-xe)+nt/2;C({top:eo,left:rt})}catch{C(null)}};return $t(()=>{let h=!1;(async()=>(o=await Zr(),!h&&(!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),B()))))(),le(()=>{h=!0,s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),R(),a(!1),I()})}),z(()=>{!i()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),z(()=>{n&&(n.dataset.viewMode=e.viewMode==="split"?"split":"unified")}),z(()=>{var v;if(!i()||!o||!r)return;const h=(v=r.getModifiedEditor)==null?void 0:v.call(r);if(!(h!=null&&h.onDidChangeCursorSelection))return;const w=h.onDidChangeCursorSelection(x=>{var $;const O=x==null?void 0:x.selection;if(!O||($=O.isEmpty)!=null&&$.call(O)){d(null),B();return}d({startLine:Math.min(O.startLineNumber,O.endLineNumber),endLine:Math.max(O.startLineNumber,O.endLineNumber)}),B()});le(()=>{var x;try{(x=w==null?void 0:w.dispose)==null||x.call(w)}catch{}})}),z(()=>{var O;if(!i()||!o||!r)return;const h=q();if(!(h!=null&&h.onMouseMove)||!(h!=null&&h.onMouseLeave)||!(h!=null&&h.onMouseDown))return;const w=h.onMouseMove($=>{var T,N;const S=(N=(T=$==null?void 0:$.target)==null?void 0:T.position)==null?void 0:N.lineNumber;l(typeof S=="number"?S:null),B()}),v=h.onMouseLeave(()=>{g()||l(null),B()}),x=(O=h.onDidScrollChange)==null?void 0:O.call(h,()=>{B()});le(()=>{var $,S,T;try{($=w==null?void 0:w.dispose)==null||$.call(w),(S=v==null?void 0:v.dispose)==null||S.call(v),(T=x==null?void 0:x.dispose)==null||T.call(x)}catch{}})}),z(()=>{if(!i()||!o||!r)return;tt()||C(null),B()}),z(()=>{var fe,xe,nt,Be,ge,rt;if(!i()||!o||!r)return;const h=e.viewMode==="unified"?"unified":"split",w=e.contextMode==="collapsed"?"collapsed":"expanded",v=e.wordWrap==="on"?"on":"off",{before:x,after:O}=b(),$=h==="unified"?$c({before:x,after:O}):Ac({before:x,after:O}),{diffEditorLineNumbersMinChars:S,originalLineNumbersMinChars:T,modifiedLineNumbersMinChars:N,lineDecorationsWidth:J}=$;r.updateOptions({renderSideBySide:h==="split",renderSideBySideInlineBreakpoint:0,renderIndicators:!0,lineNumbersMinChars:S,lineDecorationsWidth:J,hideUnchangedRegions:w==="collapsed"?{enabled:!0}:{enabled:!1},wordWrap:v});try{(nt=(xe=(fe=r.getOriginalEditor)==null?void 0:fe.call(r))==null?void 0:xe.updateOptions)==null||nt.call(xe,{wordWrap:v,lineNumbersMinChars:T,lineDecorationsWidth:J})}catch{}try{(rt=(ge=(Be=r.getModifiedEditor)==null?void 0:Be.call(r))==null?void 0:ge.updateOptions)==null||rt.call(ge,{wordWrap:v,lineNumbersMinChars:N,lineDecorationsWidth:J})}catch{}D({viewMode:h,originalLineNumbersMinChars:T,lineDecorationsWidth:J})}),z(()=>{if(!i()||!o||!r)return;const h=Qr(o,e.path),{before:w,after:v}=b(),x=`${e.scopeKey}:diff:${e.path}:before`,O=`${e.scopeKey}:diff:${e.path}:after`,$=rn({monaco:o,cacheKey:x,value:w}),S=rn({monaco:o,cacheKey:O,value:v});r.setModel({original:$,modified:S}),Yr(h).then(()=>{try{o.editor.setModelLanguage($,h),o.editor.setModelLanguage(S,h)}catch{}})}),(()=>{var h=vc(),w=h.firstChild,v=n;return typeof v=="function"?sn(v,h):n=h,mt(w,ue(ao,{get when(){return p()},children:x=>(()=>{var O=kc(),$=O.firstChild;return O.addEventListener("mouseleave",()=>{m(!1),B()}),O.addEventListener("mouseenter",()=>{m(!0),B()}),$.$$click=S=>{var N;S.preventDefault(),S.stopPropagation();const T=tt();T&&((N=e.onRequestInsertContext)==null||N.call(e,T))},$.$$mousedown=S=>{S.preventDefault(),S.stopPropagation()},ce(S=>{var T=`${x().top}px`,N=`${x().left}px`,J=e.insertContextLabel??"Add git change context to prompt",fe=e.insertContextLabel??"Add git change context to prompt";return T!==S.e&&bn(O,"top",S.e=T),N!==S.t&&bn(O,"left",S.t=N),J!==S.a&&Je($,"aria-label",S.a=J),fe!==S.o&&Je($,"title",S.o=fe),S},{e:void 0,t:void 0,a:void 0,o:void 0}),O})()})),h})()}Jn(["mousedown","click"]);const ol=Object.freeze(Object.defineProperty({__proto__:null,MonacoDiffViewer:Ec},Symbol.toStringTag,{value:"Module"}));var Tc=on("<div class=monaco-viewer>");function Mc(e){const{isDark:t}=Jr();let n,r=null,o=null;const[s,i]=E(!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())};return $t(()=>{let l=!1;(async()=>(o=await Zr(),!l&&(!n||!o||(o.editor.setTheme(t()?"vs-dark":"vs"),r=o.editor.create(n,{value:"",language:"plaintext",readOnly:!1,automaticLayout:!0,lineNumbers:"on",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)))))(),le(()=>{l=!0,i(!1),a()})}),z(()=>{!s()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),z(()=>{!s()||!r||r.updateOptions({wordWrap:e.wordWrap==="on"?"on":"off"})}),z(()=>{if(!s()||!o||!r)return;const l=Qr(o,e.path),u=`${e.scopeKey}:file:${e.path}`,d=rn({monaco:o,cacheKey:u,value:e.content});r.setModel(d),Yr(l).then(()=>{try{o.editor.setModelLanguage(d,l)}catch{}})}),(()=>{var l=Tc(),u=n;return typeof u=="function"?sn(u,l):n=l,l})()}const sl=Object.freeze(Object.defineProperty({__proto__:null,MonacoFileViewer:Mc},Symbol.toStringTag,{value:"Module"}));export{Rr as $,xa as A,ka as B,Xc as C,Rc as D,V as E,Pt as F,Jc as G,_c as H,Gr as I,di as J,Vc as K,Gc as L,hi as M,$r as N,jc as O,Fc as P,zc as Q,_s as R,Kc as S,Wc as T,qc as U,No as V,Hc as W,Vo as X,jo as Y,Jr as Z,rl as _,xo as a,Fr as a0,Yc as a1,va as a2,$a as a3,ca as a4,Qc as a5,el as a6,Y as a7,Dc as a8,Zc as a9,nl as aa,tl as ab,lc as ac,ol as ad,sl as ae,Xn as b,Nc as c,Je as d,fr as e,Jn as f,bn as g,Oo as h,mt as i,ee as j,Ce as k,Va as l,bo as m,vo as n,Vt as o,Bc as p,_a as q,re as r,ko as s,on as t,sn as u,Uc as v,Ji as w,jn as x,Se as y,Ba as z};
25
+ `)}}const gc="0.52.2",tn=`https://cdn.jsdelivr.net/npm/monaco-editor@${gc}/min/vs`,X="/monaco/vs";let dt=null;function hc(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 mc(){if(typeof fetch>"u")return!1;try{const e=new AbortController,t=fetch(`${tn}/loader.js`,{method:"HEAD",signal:e.signal}),n=await hc(t,1200);return e.abort(),n.ok}catch{return!1}}function pc(){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=`${X}/loader.js`,r.async=!0,r.onload=()=>t(),r.onerror=()=>n(new Error("Failed to load Monaco AMD loader")),document.head.appendChild(r)})}function yc(){if(typeof document>"u"||document.querySelector('link[data-monaco-editor-css="true"]'))return;const t=document.createElement("link");t.rel="stylesheet",t.href=`${X}/editor/editor.main.css`,t.dataset.monacoEditorCss="true",document.head.appendChild(t)}function bc(){const e=globalThis,t=e.MonacoEnvironment??{},n="/monaco.worker.js";e.MonacoEnvironment={...t,getWorkerUrl(r,o){return n}}}function Xr(){const e=globalThis.require;if(!e)throw new Error("Monaco AMD loader is not available");return e}function wc(){const t=Xr().config;if(!t)throw new Error("require.config is not available");return t}function nn(e){const t=Xr();return new Promise((n,r)=>{t(e,(...o)=>n(o),o=>r(o))})}function Cc(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 zn=new Set,Wt=new Map;async function Yr(e){const t=Cc(e);if(!t||zn.has(t))return;const n=Wt.get(t);if(n)return n;const r=(async()=>{let o=!1;try{await nn([t]),o=!0}catch{}finally{o&&zn.add(t),Wt.delete(t)}})();return Wt.set(t,r),r}async function Zr(){return dt||(dt=(async()=>{await pc(),bc(),yc();const e=await mc(),t=wc(),n={vs:X};e&&(n["vs/basic-languages"]=`${tn}/basic-languages`,n["vs/language"]=`${tn}/language`,n["vs/basic-languages/python"]=`${X}/basic-languages/python`,n["vs/basic-languages/markdown"]=`${X}/basic-languages/markdown`,n["vs/basic-languages/cpp"]=`${X}/basic-languages/cpp`,n["vs/basic-languages/kotlin"]=`${X}/basic-languages/kotlin`,n["vs/language/typescript"]=`${X}/language/typescript`,n["vs/language/html"]=`${X}/language/html`,n["vs/language/json"]=`${X}/language/json`,n["vs/language/css"]=`${X}/language/css`),t({paths:n,ignoreDuplicateModules:["vs/editor/editor.main"]});const[r]=await nn(["vs/editor/editor.main"]);return await nn(["vs/basic-languages/monaco.contribution"]).catch(()=>[]),globalThis.monaco??r})(),dt)}const Sc=5,le=new Map;function xc(e,t){le.delete(e),le.set(e,t)}function Oc(){for(;le.size>Sc;){const e=le.keys().next().value;if(!e)return;const t=le.get(e);le.delete(e);try{t==null||t.model.dispose()}catch{}}}function rn(e){const t=le.get(e.cacheKey);if(t)return xc(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 le.set(e.cacheKey,o),Oc(),r}let ft=null;function vc(e){var o;if(ft)return ft;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 l of a)typeof l=="string"&&(t.has(l)||t.set(l,i));const c=Array.isArray(s==null?void 0:s.extensions)?s.extensions:[];for(const l of c)typeof l=="string"&&(n.has(l)||n.set(l,i))}return ft={fileNameToId:t,extToId:n},ft}function kc(e){return e===".gitignore"||e===".gitattributes"||e===".gitmodules"||e==="Makefile"||e.startsWith("Makefile.")?"shell":null}function Qr(e,t){const n=String(t||"").trim(),r=n.split("/").pop()||n,o=kc(r);if(o)return o;const s=vc(e),i=s.fileNameToId.get(r);if(i)return i;const a=r.lastIndexOf(".");if(a>0){const c=r.slice(a),l=s.extToId.get(c);if(l)return l}return"plaintext"}var $c=on("<div class=monaco-viewer><div class=git-change-context-overlay>"),Ac=on("<div class=git-change-context-widget-host><button type=button class=git-change-context-widget>+");function Ot(e){return e?e.split(`
26
+ `).length:1}function vt(e){return String(Math.max(1,e)).length}function Ec(e){const t=Ot(e.before),n=Ot(e.after),r=vt(t),o=vt(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),l=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:6+i*2+l*2}}function Tc(e){const t=Ot(e.before),n=Ot(e.after),r=vt(t),o=vt(n),s=Math.max(r,o),i=Math.max(0,s-2),a=Math.max(2,r),c=Math.max(2,o),l=Math.max(0,s-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:8+i*2+l}}function Mc(e){const{isDark:t}=Jr();let n,r=null,o=null,s=null;const[i,a]=E(!1),[c,l]=E(null),[u,d]=E(null),[g,m]=E(!1),[p,C]=E(null),b=L(()=>e.patch!==void 0&&e.patch!==null?fc(e.patch):{before:e.before??"",after:e.after??""}),I=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},R=()=>{n&&(n.style.removeProperty("--split-original-line-number-width"),n.style.removeProperty("--split-original-delete-sign-left"),n.style.removeProperty("--split-original-gutter-width"))},D=h=>{if(n){if(s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),h.viewMode!=="split"||typeof window>"u"){R();return}s=window.requestAnimationFrame(()=>{if(s=null,!n)return;const w=n.querySelector(".editor.original .line-numbers"),v=(w==null?void 0:w.getBoundingClientRect().width)??0,x=v>0?v:Math.max(12,h.originalLineNumbersMinChars*6);n.style.setProperty("--split-original-line-number-width",`${x}px`),n.style.setProperty("--split-original-delete-sign-left",`${x}px`),n.style.setProperty("--split-original-gutter-width",`${x+h.lineDecorationsWidth}px`)})}},q=()=>{var h;return((h=r==null?void 0:r.getModifiedEditor)==null?void 0:h.call(r))??null},tt=()=>{const h=u();if(h)return h;if(g()&&c())return{startLine:c(),endLine:c()};const w=c();return w?{startLine:w,endLine:w}:null},B=()=>{var x,O,$,S;const h=q(),w=n;if(!h||!w)return;const v=tt();if(!v){C(null);return}try{const T=(x=h.getDomNode)==null?void 0:x.call(h);if(!T){C(null);return}const N=T.querySelector(".margin"),J=T.querySelector(".monaco-scrollable-element.editor-scrollable"),ge=((O=h.getTopForLineNumber)==null?void 0:O.call(h,v.startLine))??0,xe=(($=h.getScrollTop)==null?void 0:$.call(h))??0,nt=Number(((S=h.getOption)==null?void 0:S.call(h,o.editor.EditorOption.lineHeight))??18),Be=T.getBoundingClientRect(),he=w.getBoundingClientRect(),rt=Be.left-he.left+((N==null?void 0:N.offsetWidth)??(J==null?void 0:J.offsetLeft)??0),eo=Be.top-he.top+(ge-xe)+nt/2;C({top:eo,left:rt})}catch{C(null)}};return $t(()=>{let h=!1;(async()=>(o=await Zr(),!h&&(!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),B()))))(),de(()=>{h=!0,s!==null&&typeof window<"u"&&(window.cancelAnimationFrame(s),s=null),R(),a(!1),I()})}),z(()=>{!i()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),z(()=>{n&&(n.dataset.viewMode=e.viewMode==="split"?"split":"unified")}),z(()=>{var v;if(!i()||!o||!r)return;const h=(v=r.getModifiedEditor)==null?void 0:v.call(r);if(!(h!=null&&h.onDidChangeCursorSelection))return;const w=h.onDidChangeCursorSelection(x=>{var $;const O=x==null?void 0:x.selection;if(!O||($=O.isEmpty)!=null&&$.call(O)){d(null),B();return}d({startLine:Math.min(O.startLineNumber,O.endLineNumber),endLine:Math.max(O.startLineNumber,O.endLineNumber)}),B()});de(()=>{var x;try{(x=w==null?void 0:w.dispose)==null||x.call(w)}catch{}})}),z(()=>{var O;if(!i()||!o||!r)return;const h=q();if(!(h!=null&&h.onMouseMove)||!(h!=null&&h.onMouseLeave)||!(h!=null&&h.onMouseDown))return;const w=h.onMouseMove($=>{var T,N;const S=(N=(T=$==null?void 0:$.target)==null?void 0:T.position)==null?void 0:N.lineNumber;l(typeof S=="number"?S:null),B()}),v=h.onMouseLeave(()=>{g()||l(null),B()}),x=(O=h.onDidScrollChange)==null?void 0:O.call(h,()=>{B()});de(()=>{var $,S,T;try{($=w==null?void 0:w.dispose)==null||$.call(w),(S=v==null?void 0:v.dispose)==null||S.call(v),(T=x==null?void 0:x.dispose)==null||T.call(x)}catch{}})}),z(()=>{if(!i()||!o||!r)return;tt()||C(null),B()}),z(()=>{var ge,xe,nt,Be,he,rt;if(!i()||!o||!r)return;const h=e.viewMode==="unified"?"unified":"split",w=e.contextMode==="collapsed"?"collapsed":"expanded",v=e.wordWrap==="on"?"on":"off",{before:x,after:O}=b(),$=h==="unified"?Ec({before:x,after:O}):Tc({before:x,after:O}),{diffEditorLineNumbersMinChars:S,originalLineNumbersMinChars:T,modifiedLineNumbersMinChars:N,lineDecorationsWidth:J}=$;r.updateOptions({renderSideBySide:h==="split",renderSideBySideInlineBreakpoint:0,renderIndicators:!0,lineNumbersMinChars:S,lineDecorationsWidth:J,hideUnchangedRegions:w==="collapsed"?{enabled:!0}:{enabled:!1},wordWrap:v});try{(nt=(xe=(ge=r.getOriginalEditor)==null?void 0:ge.call(r))==null?void 0:xe.updateOptions)==null||nt.call(xe,{wordWrap:v,lineNumbersMinChars:T,lineDecorationsWidth:J})}catch{}try{(rt=(he=(Be=r.getModifiedEditor)==null?void 0:Be.call(r))==null?void 0:he.updateOptions)==null||rt.call(he,{wordWrap:v,lineNumbersMinChars:N,lineDecorationsWidth:J})}catch{}D({viewMode:h,originalLineNumbersMinChars:T,lineDecorationsWidth:J})}),z(()=>{if(!i()||!o||!r)return;const h=Qr(o,e.path),{before:w,after:v}=b(),x=`${e.scopeKey}:diff:${e.path}:before`,O=`${e.scopeKey}:diff:${e.path}:after`,$=rn({monaco:o,cacheKey:x,value:w}),S=rn({monaco:o,cacheKey:O,value:v});r.setModel({original:$,modified:S}),Yr(h).then(()=>{try{o.editor.setModelLanguage($,h),o.editor.setModelLanguage(S,h)}catch{}})}),(()=>{var h=$c(),w=h.firstChild,v=n;return typeof v=="function"?sn(v,h):n=h,mt(w,fe(ao,{get when(){return p()},children:x=>(()=>{var O=Ac(),$=O.firstChild;return O.addEventListener("mouseleave",()=>{m(!1),B()}),O.addEventListener("mouseenter",()=>{m(!0),B()}),$.$$click=S=>{var N;S.preventDefault(),S.stopPropagation();const T=tt();T&&((N=e.onRequestInsertContext)==null||N.call(e,T))},$.$$mousedown=S=>{S.preventDefault(),S.stopPropagation()},ue(S=>{var T=`${x().top}px`,N=`${x().left}px`,J=e.insertContextLabel??"Add git change context to prompt",ge=e.insertContextLabel??"Add git change context to prompt";return T!==S.e&&bn(O,"top",S.e=T),N!==S.t&&bn(O,"left",S.t=N),J!==S.a&&Je($,"aria-label",S.a=J),ge!==S.o&&Je($,"title",S.o=ge),S},{e:void 0,t:void 0,a:void 0,o:void 0}),O})()})),h})()}Jn(["mousedown","click"]);const il=Object.freeze(Object.defineProperty({__proto__:null,MonacoDiffViewer:Mc},Symbol.toStringTag,{value:"Module"}));var Ic=on("<div class=monaco-viewer>");function Pc(e){const{isDark:t}=Jr();let n,r=null,o=null;const[s,i]=E(!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())};return $t(()=>{let l=!1;(async()=>(o=await Zr(),!l&&(!n||!o||(o.editor.setTheme(t()?"vs-dark":"vs"),r=o.editor.create(n,{value:"",language:"plaintext",readOnly:!1,automaticLayout:!0,lineNumbers:"on",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)))))(),de(()=>{l=!0,i(!1),a()})}),z(()=>{!s()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),z(()=>{!s()||!r||r.updateOptions({wordWrap:e.wordWrap==="on"?"on":"off"})}),z(()=>{if(!s()||!o||!r)return;const l=Qr(o,e.path),u=`${e.scopeKey}:file:${e.path}`,d=rn({monaco:o,cacheKey:u,value:e.content});r.setModel(d),Yr(l).then(()=>{try{o.editor.setModelLanguage(d,l)}catch{}})}),(()=>{var l=Ic(),u=n;return typeof u=="function"?sn(u,l):n=l,l})()}const al=Object.freeze(Object.defineProperty({__proto__:null,MonacoFileViewer:Pc},Symbol.toStringTag,{value:"Module"}));export{Rr as $,va as A,Aa as B,Zc as C,Uc as D,V as E,Pt as F,Yc as G,Vc as H,Gr as I,di as J,zc as K,Jc as L,hi as M,$r as N,Wc as O,Nc as P,Hc as Q,_s as R,Gc as S,Kc as T,Xc as U,No as V,qc as W,Vo as X,jo as Y,Jr as Z,sl as _,xo as a,Fr as a0,Qc as a1,$a as a2,Ea as a3,ua as a4,tl as a5,nl as a6,Y as a7,Rc as a8,el as a9,ol as aa,rl as ab,dc as ac,il as ad,al as ae,Xn as b,Bc as c,Je as d,fr as e,Jn as f,bn as g,Oo as h,mt as i,ee as j,Ce as k,za as l,bo as m,vo as n,Vt as o,jc as p,Va as q,re as r,ko as s,on as t,sn as u,_c as v,Yi as w,jn as x,Se as y,ja as z};