@neuralnomads/codenomad-dev 0.18.0-dev-20260809-67cb394e → 0.19.0-dev-20260813-ac153312

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 (53) hide show
  1. package/dist/opencode-plugin/codenomad-opencode-plugin.tgz +0 -0
  2. package/dist/settings/service.js +17 -5
  3. package/dist/settings/service.test.js +51 -0
  4. package/dist/settings/yaml-doc-store.js +55 -4
  5. package/dist/settings/yaml-doc-store.test.js +78 -0
  6. package/dist/sidecars/manager.js +26 -3
  7. package/dist/sidecars/manager.test.js +42 -0
  8. package/package.json +1 -1
  9. package/public/assets/FilesTab-BFPVTSho.js +2 -0
  10. package/public/assets/{GitChangesTab-Tw90ns02.js → GitChangesTab-CKBFVNI8.js} +2 -2
  11. package/public/assets/{SplitFilePanel-Cd76S2b9.js → SplitFilePanel-CaD8pox4.js} +1 -1
  12. package/public/assets/StatusTab-C7OAyimT.js +1 -0
  13. package/public/assets/{align-justify-DYMhLgIY.js → align-justify-BiSxVeYp.js} +1 -1
  14. package/public/assets/{bundle-full-yMAV5vbj.js → bundle-full-CEFzES5w.js} +1 -1
  15. package/public/assets/{diff-viewer-cbFMYFnG.js → diff-viewer-D5fGlZEl.js} +1 -1
  16. package/public/assets/index--I9sbcs5.css +1 -0
  17. package/public/assets/index-B2O4H5Qa.js +1 -0
  18. package/public/assets/{index-COh163c2.js → index-B81f0aWL.js} +1 -1
  19. package/public/assets/index-C1DHYMgf.js +1 -0
  20. package/public/assets/index-CKjfzBbg.js +1 -0
  21. package/public/assets/index-CuF7nIit.js +1 -0
  22. package/public/assets/index-Cy4pOSir.js +1 -0
  23. package/public/assets/index-DLsqhfb5.js +1 -0
  24. package/public/assets/index-DYdKQoFg.js +1 -0
  25. package/public/assets/index-DaQdDlze.js +1 -0
  26. package/public/assets/index-RnXDcFsv.js +2 -0
  27. package/public/assets/{index-Glx2xi1x.js → index-lORR8OnW.js} +1 -1
  28. package/public/assets/{loading-CLR16KdT.js → loading-BpZBMbqV.js} +1 -1
  29. package/public/assets/main-BnwG4srg.js +69 -0
  30. package/public/assets/{markdown-Cn1rfx2F.js → markdown-CFb0Suko.js} +3 -3
  31. package/public/assets/monaco-viewer-NKl8kwH2.js +26 -0
  32. package/public/assets/terminal-square-QNfjv56N.js +1 -0
  33. package/public/assets/{tool-call-D3ADKESH.js → tool-call-BKkxYXma.js} +3 -3
  34. package/public/assets/{unified-picker-BvrsMVs5.js → unified-picker-CXQhDzIV.js} +1 -1
  35. package/public/assets/{wrap-text-CusvDWcP.js → wrap-text-CUOAN4GW.js} +1 -1
  36. package/public/index.html +4 -4
  37. package/public/loading.html +4 -4
  38. package/public/sw.js +1 -1
  39. package/public/ui-version.json +1 -1
  40. package/public/assets/FilesTab-Ch4jXstC.js +0 -2
  41. package/public/assets/StatusTab-B_nwxUsE.js +0 -1
  42. package/public/assets/index-B65LjlYB.js +0 -1
  43. package/public/assets/index-B7bZsUV8.css +0 -1
  44. package/public/assets/index-BSA3SyyP.js +0 -2
  45. package/public/assets/index-Bl7UvYP-.js +0 -1
  46. package/public/assets/index-Bo71H1mG.js +0 -1
  47. package/public/assets/index-D5sicp6K.js +0 -1
  48. package/public/assets/index-Db4ROxbH.js +0 -1
  49. package/public/assets/index-DiEt035Z.js +0 -1
  50. package/public/assets/index-QXzSNJqc.js +0 -1
  51. package/public/assets/index-nuiLUXEP.js +0 -1
  52. package/public/assets/main-DxKSa1-Y.js +0 -69
  53. package/public/assets/monaco-viewer-BSlOM5Le.js +0 -26
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundle-full-yMAV5vbj.js","assets/monaco-viewer-BSlOM5Le.js","assets/git-diff-vendor-CYS3ApzA.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
- var s1=Object.defineProperty;var jr=a=>{throw TypeError(a)};var l1=(a,e,t)=>e in a?s1(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var j=(a,e,t)=>l1(a,typeof e!="symbol"?e+"":e,t),o1=(a,e,t)=>e.has(a)||jr("Cannot "+t);var Zr=(a,e,t)=>e.has(a)?jr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t);var Fe=(a,e,t)=>(o1(a,e,"access private method"),t);import{k as u1,_ as h1}from"./monaco-viewer-BSlOM5Le.js";import{t as Kr}from"./index-BSA3SyyP.js";import{aB as nt,aC as w0}from"./main-DxKSa1-Y.js";import"./git-diff-vendor-CYS3ApzA.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";function fr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ne=fr();function Ha(a){ne=a}const Oa=/[&<>"']/,c1=new RegExp(Oa.source,"g"),$a=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,m1=new RegExp($a.source,"g"),d1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Qr=a=>d1[a];function v0(a,e){if(e){if(Oa.test(a))return a.replace(c1,Qr)}else if($a.test(a))return a.replace(m1,Qr);return a}const f1=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function p1(a){return a.replace(f1,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const v1=/(^|[^\[])\^/g;function X(a,e){let t=typeof a=="string"?a:a.source;e=e||"";const r={replace:(n,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(v1,"$1"),t=t.replace(n,s),r},getRegex:()=>new RegExp(t,e)};return r}function Jr(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}const ke={exec:()=>null};function _r(a,e){const t=a.replace(/\|/g,(i,s,u)=>{let h=!1,d=s;for(;--d>=0&&u[d]==="\\";)h=!h;return h?"|":" |"}),r=t.split(/ \|/);let n=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r}function Pe(a,e,t){const r=a.length;if(r===0)return"";let n=0;for(;n<r&&a.charAt(r-n-1)===e;)n++;return a.slice(0,r-n)}function g1(a,e){if(a.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<a.length;r++)if(a[r]==="\\")r++;else if(a[r]===e[0])t++;else if(a[r]===e[1]&&(t--,t<0))return r;return-1}function ea(a,e,t,r){const n=e.href,i=e.title?v0(e.title):null,s=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){r.state.inLink=!0;const u={type:"link",raw:t,href:n,title:i,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,u}return{type:"image",raw:t,href:n,title:i,text:v0(s)}}function b1(a,e){const t=a.match(/^(\s+)(?:```)/);if(t===null)return e;const r=t[1];return e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/bundle-full-CEFzES5w.js","assets/monaco-viewer-NKl8kwH2.js","assets/git-diff-vendor-CYS3ApzA.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
+ var s1=Object.defineProperty;var jr=a=>{throw TypeError(a)};var l1=(a,e,t)=>e in a?s1(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var j=(a,e,t)=>l1(a,typeof e!="symbol"?e+"":e,t),o1=(a,e,t)=>e.has(a)||jr("Cannot "+t);var Zr=(a,e,t)=>e.has(a)?jr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t);var Fe=(a,e,t)=>(o1(a,e,"access private method"),t);import{k as u1,_ as h1}from"./monaco-viewer-NKl8kwH2.js";import{t as Kr}from"./index-RnXDcFsv.js";import{aF as nt,aG as w0}from"./main-BnwG4srg.js";import"./git-diff-vendor-CYS3ApzA.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";function fr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ne=fr();function Ha(a){ne=a}const Oa=/[&<>"']/,c1=new RegExp(Oa.source,"g"),$a=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,m1=new RegExp($a.source,"g"),d1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Qr=a=>d1[a];function v0(a,e){if(e){if(Oa.test(a))return a.replace(c1,Qr)}else if($a.test(a))return a.replace(m1,Qr);return a}const f1=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function p1(a){return a.replace(f1,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const v1=/(^|[^\[])\^/g;function X(a,e){let t=typeof a=="string"?a:a.source;e=e||"";const r={replace:(n,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(v1,"$1"),t=t.replace(n,s),r},getRegex:()=>new RegExp(t,e)};return r}function Jr(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}const ke={exec:()=>null};function _r(a,e){const t=a.replace(/\|/g,(i,s,u)=>{let h=!1,d=s;for(;--d>=0&&u[d]==="\\";)h=!h;return h?"|":" |"}),r=t.split(/ \|/);let n=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r}function Pe(a,e,t){const r=a.length;if(r===0)return"";let n=0;for(;n<r&&a.charAt(r-n-1)===e;)n++;return a.slice(0,r-n)}function g1(a,e){if(a.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<a.length;r++)if(a[r]==="\\")r++;else if(a[r]===e[0])t++;else if(a[r]===e[1]&&(t--,t<0))return r;return-1}function ea(a,e,t,r){const n=e.href,i=e.title?v0(e.title):null,s=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){r.state.inLink=!0;const u={type:"link",raw:t,href:n,title:i,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,u}return{type:"image",raw:t,href:n,title:i,text:v0(s)}}function b1(a,e){const t=a.match(/^(\s+)(?:```)/);if(t===null)return e;const r=t[1];return e.split(`
3
3
  `).map(n=>{const i=n.match(/^\s+/);if(i===null)return n;const[s]=i;return s.length>=r.length?n.slice(r.length):n}).join(`
4
4
  `)}class it{constructor(e){j(this,"options");j(this,"rules");j(this,"lexer");this.options=e||ne}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const r=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Pe(r,`
5
5
  `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const r=t[0],n=b1(r,t[3]||"");return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(/#$/.test(r)){const n=Pe(r,"#");(this.options.pedantic||!n||/ $/.test(n))&&(r=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let r=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
@@ -302,7 +302,7 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
302
302
  `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new g0(n,new p0(this,t,this.tokenRegex.lastIndex))}}class Ts{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new z("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,r){if(r===void 0&&(r=!1),r){for(var n=0;n<this.undefStack.length;n++)delete this.undefStack[n][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var As=Bn;m("\\noexpand",function(a){var e=a.popToken();return a.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});m("\\expandafter",function(a){var e=a.popToken();return a.expandOnce(!0),{tokens:[e],numArgs:0}});m("\\@firstoftwo",function(a){var e=a.consumeArgs(2);return{tokens:e[0],numArgs:0}});m("\\@secondoftwo",function(a){var e=a.consumeArgs(2);return{tokens:e[1],numArgs:0}});m("\\@ifnextchar",function(a){var e=a.consumeArgs(3);a.consumeSpaces();var t=a.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});m("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");m("\\TextOrMath",function(a){var e=a.consumeArgs(2);return a.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var Da={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};m("\\char",function(a){var e=a.popToken(),t,r=0;if(e.text==="'")t=8,e=a.popToken();else if(e.text==='"')t=16,e=a.popToken();else if(e.text==="`")if(e=a.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new z("\\char` missing argument");r=e.text.charCodeAt(0)}else t=10;if(t){if(r=Da[e.text],r==null||r>=t)throw new z("Invalid base-"+t+" digit "+e.text);for(var n;(n=Da[a.future().text])!=null&&n<t;)r*=t,r+=n,a.popToken()}return"\\@char{"+r+"}"});var Er=(a,e,t,r)=>{var n=a.consumeArg().tokens;if(n.length!==1)throw new z("\\newcommand's first argument must be a macro name");var i=n[0].text,s=a.isDefined(i);if(s&&!e)throw new z("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!s&&!t)throw new z("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var u=0;if(n=a.consumeArg().tokens,n.length===1&&n[0].text==="["){for(var h="",d=a.expandNextToken();d.text!=="]"&&d.text!=="EOF";)h+=d.text,d=a.expandNextToken();if(!h.match(/^\s*[0-9]+\s*$/))throw new z("Invalid number of arguments: "+h);u=parseInt(h),n=a.consumeArg().tokens}return s&&r||a.macros.set(i,{tokens:n,numArgs:u}),""};m("\\newcommand",a=>Er(a,!1,!0,!1));m("\\renewcommand",a=>Er(a,!0,!1,!1));m("\\providecommand",a=>Er(a,!0,!0,!0));m("\\message",a=>{var e=a.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});m("\\errmessage",a=>{var e=a.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});m("\\show",a=>{var e=a.popToken(),t=e.text;return console.log(e,a.macros.get(t),X0[t],K.math[t],K.text[t]),""});m("\\bgroup","{");m("\\egroup","}");m("~","\\nobreakspace");m("\\lq","`");m("\\rq","'");m("\\aa","\\r a");m("\\AA","\\r A");m("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");m("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");m("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");m("ℬ","\\mathscr{B}");m("ℰ","\\mathscr{E}");m("ℱ","\\mathscr{F}");m("ℋ","\\mathscr{H}");m("ℐ","\\mathscr{I}");m("ℒ","\\mathscr{L}");m("ℳ","\\mathscr{M}");m("ℛ","\\mathscr{R}");m("ℭ","\\mathfrak{C}");m("ℌ","\\mathfrak{H}");m("ℨ","\\mathfrak{Z}");m("\\Bbbk","\\Bbb{k}");m("\\llap","\\mathllap{\\textrm{#1}}");m("\\rlap","\\mathrlap{\\textrm{#1}}");m("\\clap","\\mathclap{\\textrm{#1}}");m("\\mathstrut","\\vphantom{(}");m("\\underbar","\\underline{\\text{#1}}");m("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');m("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");m("\\ne","\\neq");m("≠","\\neq");m("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");m("∉","\\notin");m("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");m("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");m("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");m("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");m("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");m("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");m("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");m("⟂","\\perp");m("‼","\\mathclose{!\\mkern-0.8mu!}");m("∌","\\notni");m("⌜","\\ulcorner");m("⌝","\\urcorner");m("⌞","\\llcorner");m("⌟","\\lrcorner");m("©","\\copyright");m("®","\\textregistered");m("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');m("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');m("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');m("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');m("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");m("⋮","\\vdots");m("\\varGamma","\\mathit{\\Gamma}");m("\\varDelta","\\mathit{\\Delta}");m("\\varTheta","\\mathit{\\Theta}");m("\\varLambda","\\mathit{\\Lambda}");m("\\varXi","\\mathit{\\Xi}");m("\\varPi","\\mathit{\\Pi}");m("\\varSigma","\\mathit{\\Sigma}");m("\\varUpsilon","\\mathit{\\Upsilon}");m("\\varPhi","\\mathit{\\Phi}");m("\\varPsi","\\mathit{\\Psi}");m("\\varOmega","\\mathit{\\Omega}");m("\\substack","\\begin{subarray}{c}#1\\end{subarray}");m("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");m("\\boxed","\\fbox{$\\displaystyle{#1}$}");m("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");m("\\implies","\\DOTSB\\;\\Longrightarrow\\;");m("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");m("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");m("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Ra={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Ms=new Set(["bin","rel"]);m("\\dots",function(a){var e="\\dotso",t=a.expandAfterFuture().text;return t in Ra?e=Ra[t]:(t.slice(0,4)==="\\not"||t in K.math&&Ms.has(K.math[t].group))&&(e="\\dotsb"),e});var Ir={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};m("\\dotso",function(a){var e=a.future().text;return e in Ir?"\\ldots\\,":"\\ldots"});m("\\dotsc",function(a){var e=a.future().text;return e in Ir&&e!==","?"\\ldots\\,":"\\ldots"});m("\\cdots",function(a){var e=a.future().text;return e in Ir?"\\@cdots\\,":"\\@cdots"});m("\\dotsb","\\cdots");m("\\dotsm","\\cdots");m("\\dotsi","\\!\\cdots");m("\\dotsx","\\ldots\\,");m("\\DOTSI","\\relax");m("\\DOTSB","\\relax");m("\\DOTSX","\\relax");m("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");m("\\,","\\tmspace+{3mu}{.1667em}");m("\\thinspace","\\,");m("\\>","\\mskip{4mu}");m("\\:","\\tmspace+{4mu}{.2222em}");m("\\medspace","\\:");m("\\;","\\tmspace+{5mu}{.2777em}");m("\\thickspace","\\;");m("\\!","\\tmspace-{3mu}{.1667em}");m("\\negthinspace","\\!");m("\\negmedspace","\\tmspace-{4mu}{.2222em}");m("\\negthickspace","\\tmspace-{5mu}{.277em}");m("\\enspace","\\kern.5em ");m("\\enskip","\\hskip.5em\\relax");m("\\quad","\\hskip1em\\relax");m("\\qquad","\\hskip2em\\relax");m("\\tag","\\@ifstar\\tag@literal\\tag@paren");m("\\tag@paren","\\tag@literal{({#1})}");m("\\tag@literal",a=>{if(a.macros.get("\\df@tag"))throw new z("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});m("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");m("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");m("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");m("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");m("\\newline","\\\\\\relax");m("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Fn=M(C0["Main-Regular"][84][1]-.7*C0["Main-Regular"][65][1]);m("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Fn+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");m("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Fn+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");m("\\hspace","\\@ifstar\\@hspacer\\@hspace");m("\\@hspace","\\hskip #1\\relax");m("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");m("\\ordinarycolon",":");m("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");m("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');m("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');m("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');m("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');m("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');m("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');m("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');m("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');m("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');m("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');m("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');m("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');m("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');m("∷","\\dblcolon");m("∹","\\eqcolon");m("≔","\\coloneqq");m("≕","\\eqqcolon");m("⩴","\\Coloneqq");m("\\ratio","\\vcentcolon");m("\\coloncolon","\\dblcolon");m("\\colonequals","\\coloneqq");m("\\coloncolonequals","\\Coloneqq");m("\\equalscolon","\\eqqcolon");m("\\equalscoloncolon","\\Eqqcolon");m("\\colonminus","\\coloneq");m("\\coloncolonminus","\\Coloneq");m("\\minuscolon","\\eqcolon");m("\\minuscoloncolon","\\Eqcolon");m("\\coloncolonapprox","\\Colonapprox");m("\\coloncolonsim","\\Colonsim");m("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");m("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");m("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");m("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");m("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");m("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");m("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");m("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");m("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");m("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");m("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");m("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");m("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");m("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");m("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");m("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");m("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");m("\\nleqq","\\html@mathml{\\@nleqq}{≰}");m("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");m("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");m("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");m("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");m("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");m("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");m("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");m("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");m("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");m("\\imath","\\html@mathml{\\@imath}{ı}");m("\\jmath","\\html@mathml{\\@jmath}{ȷ}");m("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");m("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");m("⟦","\\llbracket");m("⟧","\\rrbracket");m("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");m("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");m("⦃","\\lBrace");m("⦄","\\rBrace");m("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");m("⦵","\\minuso");m("\\darr","\\downarrow");m("\\dArr","\\Downarrow");m("\\Darr","\\Downarrow");m("\\lang","\\langle");m("\\rang","\\rangle");m("\\uarr","\\uparrow");m("\\uArr","\\Uparrow");m("\\Uarr","\\Uparrow");m("\\N","\\mathbb{N}");m("\\R","\\mathbb{R}");m("\\Z","\\mathbb{Z}");m("\\alef","\\aleph");m("\\alefsym","\\aleph");m("\\Alpha","\\mathrm{A}");m("\\Beta","\\mathrm{B}");m("\\bull","\\bullet");m("\\Chi","\\mathrm{X}");m("\\clubs","\\clubsuit");m("\\cnums","\\mathbb{C}");m("\\Complex","\\mathbb{C}");m("\\Dagger","\\ddagger");m("\\diamonds","\\diamondsuit");m("\\empty","\\emptyset");m("\\Epsilon","\\mathrm{E}");m("\\Eta","\\mathrm{H}");m("\\exist","\\exists");m("\\harr","\\leftrightarrow");m("\\hArr","\\Leftrightarrow");m("\\Harr","\\Leftrightarrow");m("\\hearts","\\heartsuit");m("\\image","\\Im");m("\\infin","\\infty");m("\\Iota","\\mathrm{I}");m("\\isin","\\in");m("\\Kappa","\\mathrm{K}");m("\\larr","\\leftarrow");m("\\lArr","\\Leftarrow");m("\\Larr","\\Leftarrow");m("\\lrarr","\\leftrightarrow");m("\\lrArr","\\Leftrightarrow");m("\\Lrarr","\\Leftrightarrow");m("\\Mu","\\mathrm{M}");m("\\natnums","\\mathbb{N}");m("\\Nu","\\mathrm{N}");m("\\Omicron","\\mathrm{O}");m("\\plusmn","\\pm");m("\\rarr","\\rightarrow");m("\\rArr","\\Rightarrow");m("\\Rarr","\\Rightarrow");m("\\real","\\Re");m("\\reals","\\mathbb{R}");m("\\Reals","\\mathbb{R}");m("\\Rho","\\mathrm{P}");m("\\sdot","\\cdot");m("\\sect","\\S");m("\\spades","\\spadesuit");m("\\sub","\\subset");m("\\sube","\\subseteq");m("\\supe","\\supseteq");m("\\Tau","\\mathrm{T}");m("\\thetasym","\\vartheta");m("\\weierp","\\wp");m("\\Zeta","\\mathrm{Z}");m("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");m("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");m("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");m("\\bra","\\mathinner{\\langle{#1}|}");m("\\ket","\\mathinner{|{#1}\\rangle}");m("\\braket","\\mathinner{\\langle{#1}\\rangle}");m("\\Bra","\\left\\langle#1\\right|");m("\\Ket","\\left|#1\\right\\rangle");var Pn=a=>e=>{var t=e.consumeArg().tokens,r=e.consumeArg().tokens,n=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.macros.get("|"),u=e.macros.get("\\|");e.macros.beginGroup();var h=b=>y=>{a&&(y.macros.set("|",s),n.length&&y.macros.set("\\|",u));var x=b;if(!b&&n.length){var S=y.future();S.text==="|"&&(y.popToken(),x=!0)}return{tokens:x?n:r,numArgs:0}};e.macros.set("|",h(!1)),n.length&&e.macros.set("\\|",h(!0));var d=e.consumeArg().tokens,f=e.expandTokens([...i,...d,...t]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};m("\\bra@ket",Pn(!1));m("\\bra@set",Pn(!0));m("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");m("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");m("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");m("\\angln","{\\angl n}");m("\\blue","\\textcolor{##6495ed}{#1}");m("\\orange","\\textcolor{##ffa500}{#1}");m("\\pink","\\textcolor{##ff00af}{#1}");m("\\red","\\textcolor{##df0030}{#1}");m("\\green","\\textcolor{##28ae7b}{#1}");m("\\gray","\\textcolor{gray}{#1}");m("\\purple","\\textcolor{##9d38bd}{#1}");m("\\blueA","\\textcolor{##ccfaff}{#1}");m("\\blueB","\\textcolor{##80f6ff}{#1}");m("\\blueC","\\textcolor{##63d9ea}{#1}");m("\\blueD","\\textcolor{##11accd}{#1}");m("\\blueE","\\textcolor{##0c7f99}{#1}");m("\\tealA","\\textcolor{##94fff5}{#1}");m("\\tealB","\\textcolor{##26edd5}{#1}");m("\\tealC","\\textcolor{##01d1c1}{#1}");m("\\tealD","\\textcolor{##01a995}{#1}");m("\\tealE","\\textcolor{##208170}{#1}");m("\\greenA","\\textcolor{##b6ffb0}{#1}");m("\\greenB","\\textcolor{##8af281}{#1}");m("\\greenC","\\textcolor{##74cf70}{#1}");m("\\greenD","\\textcolor{##1fab54}{#1}");m("\\greenE","\\textcolor{##0d923f}{#1}");m("\\goldA","\\textcolor{##ffd0a9}{#1}");m("\\goldB","\\textcolor{##ffbb71}{#1}");m("\\goldC","\\textcolor{##ff9c39}{#1}");m("\\goldD","\\textcolor{##e07d10}{#1}");m("\\goldE","\\textcolor{##a75a05}{#1}");m("\\redA","\\textcolor{##fca9a9}{#1}");m("\\redB","\\textcolor{##ff8482}{#1}");m("\\redC","\\textcolor{##f9685d}{#1}");m("\\redD","\\textcolor{##e84d39}{#1}");m("\\redE","\\textcolor{##bc2612}{#1}");m("\\maroonA","\\textcolor{##ffbde0}{#1}");m("\\maroonB","\\textcolor{##ff92c6}{#1}");m("\\maroonC","\\textcolor{##ed5fa6}{#1}");m("\\maroonD","\\textcolor{##ca337c}{#1}");m("\\maroonE","\\textcolor{##9e034e}{#1}");m("\\purpleA","\\textcolor{##ddd7ff}{#1}");m("\\purpleB","\\textcolor{##c6b9fc}{#1}");m("\\purpleC","\\textcolor{##aa87ff}{#1}");m("\\purpleD","\\textcolor{##7854ab}{#1}");m("\\purpleE","\\textcolor{##543b78}{#1}");m("\\mintA","\\textcolor{##f5f9e8}{#1}");m("\\mintB","\\textcolor{##edf2df}{#1}");m("\\mintC","\\textcolor{##e0e5cc}{#1}");m("\\grayA","\\textcolor{##f6f7f7}{#1}");m("\\grayB","\\textcolor{##f0f1f2}{#1}");m("\\grayC","\\textcolor{##e3e5e6}{#1}");m("\\grayD","\\textcolor{##d6d8da}{#1}");m("\\grayE","\\textcolor{##babec2}{#1}");m("\\grayF","\\textcolor{##888d93}{#1}");m("\\grayG","\\textcolor{##626569}{#1}");m("\\grayH","\\textcolor{##3b3e40}{#1}");m("\\grayI","\\textcolor{##21242c}{#1}");m("\\kaBlue","\\textcolor{##314453}{#1}");m("\\kaGreen","\\textcolor{##71B307}{#1}");var Gn={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Bs{constructor(e,t,r){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Ts(As,t.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Ca(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,r,n;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:n,end:r}=this.consumeArg(["]"])}else({tokens:n,start:t,end:r}=this.consumeArg());return this.pushToken(new g0("EOF",r.loc)),this.pushTokens(n),new g0("",p0.range(t,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],r=e&&e.length>0;r||this.consumeSpaces();var n=this.future(),i,s=0,u=0;do{if(i=this.popToken(),t.push(i),i.text==="{")++s;else if(i.text==="}"){if(--s,s===-1)throw new z("Extra }",i)}else if(i.text==="EOF")throw new z("Unexpected end of input in a macro argument, expected '"+(e&&r?e[u]:"}")+"'",i);if(e&&r)if((s===0||s===1&&e[u]==="{")&&i.text===e[u]){if(++u,u===e.length){t.splice(-u,u);break}}else u=0}while(s!==0||r);return n.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:n,end:i}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new z("The length of delimiters doesn't match the number of args!");for(var r=t[0],n=0;n<r.length;n++){var i=this.popToken();if(r[n]!==i.text)throw new z("Use of the macro doesn't match its definition",i)}}for(var s=[],u=0;u<e;u++)s.push(this.consumeArg(t&&t[u+1]).tokens);return s}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new z("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),r=t.text,n=t.noexpand?null:this._getExpansion(r);if(n==null||e&&n.unexpandable){if(e&&n==null&&r[0]==="\\"&&!this.isDefined(r))throw new z("Undefined control sequence: "+r);return this.pushToken(t),!1}this.countExpansion(1);var i=n.tokens,s=this.consumeArgs(n.numArgs,n.delimiters);if(n.numArgs){i=i.slice();for(var u=i.length-1;u>=0;--u){var h=i[u];if(h.text==="#"){if(u===0)throw new z("Incomplete placeholder at end of macro body",h);if(h=i[--u],h.text==="#")i.splice(u+1,1);else if(/^[1-9]$/.test(h.text))i.splice(u,2,...s[+h.text-1]);else throw new z("Not a valid argument number",h)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new g0(e)]):void 0}expandTokens(e){var t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var n=this.stack.pop();n.treatAsRelax&&(n.noexpand=!1,n.treatAsRelax=!1),t.push(n)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(r=>r.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var n=typeof t=="function"?t(this):t;if(typeof n=="string"){var i=0;if(n.includes("#"))for(var s=n.replace(/##/g,"");s.includes("#"+(i+1));)++i;for(var u=new Ca(n,this.settings),h=[],d=u.lex();d.text!=="EOF";)h.push(d),d=u.lex();h.reverse();var f={tokens:h,numArgs:i};return f}return n}isDefined(e){return this.macros.has(e)||X0.hasOwnProperty(e)||K.math.hasOwnProperty(e)||K.text.hasOwnProperty(e)||Gn.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:X0.hasOwnProperty(e)&&!X0[e].primitive}}var qa=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Qe=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Yt={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Ea={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Bt{constructor(e,t){this.mode="math",this.gullet=new Bs(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new z("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new g0("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(e,t){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var n=this.fetch();if(Bt.endOfExpression.has(n.text)||t&&n.text===t||e&&X0[n.text]&&X0[n.text].infix)break;var i=this.parseAtom(t);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var t=-1,r,n=0;n<e.length;n++){var i=e[n];if(i.type==="infix"){if(t!==-1)throw new z("only one infix operator per group",i.token);t=n,r=i.replaceWith}}if(t!==-1&&r){var s,u,h=e.slice(0,t),d=e.slice(t+1);h.length===1&&h[0].type==="ordgroup"?s=h[0]:s={type:"ordgroup",mode:this.mode,body:h},d.length===1&&d[0].type==="ordgroup"?u=d[0]:u={type:"ordgroup",mode:this.mode,body:d};var f;return r==="\\\\abovefrac"?f=this.callFunction(r,[s,e[t],u],[]):f=this.callFunction(r,[s,u],[]),[f]}else return e}handleSupSubscript(e){var t=this.fetch(),r=t.text;this.consume(),this.consumeSpaces();var n;do{var i;n=this.parseGroup(e)}while(((i=n)==null?void 0:i.type)==="internal");if(!n)throw new z("Expected group after '"+r+"'",t);return n}formatUnsupportedCmd(e){for(var t=[],r=0;r<e.length;r++)t.push({type:"textord",mode:"text",text:e[r]});var n={type:"text",mode:this.mode,body:t},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[n]};return i}parseAtom(e){var t=this.parseGroup("atom",e);if((t==null?void 0:t.type)==="internal"||this.mode==="text")return t;for(var r,n;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(t&&t.type==="op"){var s=i.text==="\\limits";t.limits=s,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=i.text==="\\limits");else throw new z("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new z("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(n)throw new z("Double subscript",i);n=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new z("Double superscript",i);var u={type:"textord",mode:this.mode,text:"\\prime"},h=[u];for(this.consume();this.fetch().text==="'";)h.push(u),this.consume();this.fetch().text==="^"&&h.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:h}}else if(Qe[i.text]){var d=qa.test(i.text),f=[];for(f.push(new g0(Qe[i.text])),this.consume();;){var b=this.fetch().text;if(!Qe[b]||qa.test(b)!==d)break;f.unshift(new g0(Qe[b])),this.consume()}var y=this.subparse(f);d?n={type:"ordgroup",mode:"math",body:y}:r={type:"ordgroup",mode:"math",body:y}}else break}return r||n?{type:"supsub",mode:this.mode,base:t,sup:r,sub:n}:t}parseFunction(e,t){var r=this.fetch(),n=r.text,i=X0[n];if(!i)return null;if(this.consume(),t&&t!=="atom"&&!i.allowedInArgument)throw new z("Got function '"+n+"' with no arguments"+(t?" as "+t:""),r);if(this.mode==="text"&&!i.allowedInText)throw new z("Can't use function '"+n+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new z("Can't use function '"+n+"' in math mode",r);var{args:s,optArgs:u}=this.parseArguments(n,i);return this.callFunction(n,s,u,r,e)}callFunction(e,t,r,n,i){var s={funcName:e,parser:this,token:n,breakOnTokenText:i},u=X0[e];if(u&&u.handler)return u.handler(s,t,r);throw new z("No function handler for "+e)}parseArguments(e,t){var r=t.numArgs+t.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var n=[],i=[],s=0;s<r;s++){var u=t.argTypes&&t.argTypes[s],h=s<t.numOptionalArgs;("primitive"in t&&t.primitive&&u==null||t.type==="sqrt"&&s===1&&i[0]==null)&&(u="primitive");var d=this.parseGroupOfType("argument to '"+e+"'",u,h);if(h)i.push(d);else if(d!=null)n.push(d);else throw new z("Null argument, please report this as a bug")}return{args:n,optArgs:i}}parseGroupOfType(e,t,r){switch(t){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,t);case"hbox":{var n=this.parseArgumentGroup(r,"text");return n!=null?{type:"styling",mode:n.mode,body:[n],style:"text"}:null}case"raw":{var i=this.parseStringGroup("raw",r);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(r)throw new z("A primitive argument cannot be optional");var s=this.parseGroup(e);if(s==null)throw new z("Expected group as "+e,this.fetch());return s}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new z("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var r=this.gullet.scanArgument(t);if(r==null)return null;for(var n="",i;(i=this.fetch()).text!=="EOF";)n+=i.text,this.consume();return this.consume(),r.text=n,r}parseRegexGroup(e,t){for(var r=this.fetch(),n=r,i="",s;(s=this.fetch()).text!=="EOF"&&e.test(i+s.text);)n=s,i+=n.text,this.consume();if(i==="")throw new z("Invalid "+t+": '"+r.text+"'",r);return r.range(n,i)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!r)throw new z("Invalid color: '"+t.text+"'",t);var n=r[0];return/^[0-9a-f]{6}$/i.test(n)&&(n="#"+n),{type:"color-token",mode:this.mode,color:n}}parseSizeGroup(e){var t,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",r=!0);var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!n)throw new z("Invalid size: '"+t.text+"'",t);var i={number:+(n[1]+n[2]),unit:n[3]};if(!Za(i))throw new z("Invalid unit: '"+i.unit+"'",t);return{type:"size",mode:this.mode,value:i,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,t){var r=this.gullet.scanArgument(e);if(r==null)return null;var n=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var s={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return t&&this.switchMode(n),s}parseGroup(e,t){var r=this.fetch(),n=r.text,i;if(n==="{"||n==="\\begingroup"){this.consume();var s=n==="{"?"}":"\\endgroup";this.gullet.beginGroup();var u=this.parseExpression(!1,s),h=this.fetch();this.expect(s),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:p0.range(r,h),body:u,semisimple:n==="\\begingroup"||void 0}}else if(i=this.parseFunction(t,e)||this.parseSymbol(),i==null&&n[0]==="\\"&&!Gn.hasOwnProperty(n)){if(this.settings.throwOnError)throw new z("Undefined control sequence: "+n,r);i=this.formatUnsupportedCmd(n),this.consume()}return i}formLigatures(e){for(var t=e.length-1,r=0;r<t;++r){var n=e[r];if(n.type==="textord"){var i=n.text,s=e[r+1];if(!(!s||s.type!=="textord")){if(i==="-"&&s.text==="-"){var u=e[r+2];r+1<t&&u&&u.type==="textord"&&u.text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:p0.range(n,u),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:p0.range(n,s),text:"--"}),t-=1)}(i==="'"||i==="`")&&s.text===i&&(e.splice(r,2,{type:"textord",mode:"text",loc:p0.range(n,s),text:i+i}),t-=1)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var r=t.slice(5),n=r.charAt(0)==="*";if(n&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new z(`\\verb assertion failed --
303
303
  please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:n}}Ea.hasOwnProperty(t[0])&&!K[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Ea[t[0]]+t.slice(1));var i=Ss.exec(t);i&&(t=t.substring(0,i.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var s;if(K[this.mode][t]){this.settings.strict&&this.mode==="math"&&rr.includes(t)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var u=K[this.mode][t].group,h=p0.range(e),d;if(zi.hasOwnProperty(u)){var f=u;d={type:"atom",mode:this.mode,family:f,loc:h,text:t}}else d={type:u,mode:this.mode,loc:h,text:t};s=d}else if(t.charCodeAt(0)>=128)this.settings.strict&&(ja(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),s={type:"textord",mode:"text",loc:p0.range(e),text:t};else return null;if(this.consume(),i)for(var b=0;b<i[0].length;b++){var y=i[0][b];if(!Yt[y])throw new z("Unknown accent ' "+y+"'",e);var x=Yt[y][this.mode]||Yt[y].text;if(!x)throw new z("Accent "+y+" unsupported in "+this.mode+" mode",e);s={type:"accent",mode:this.mode,loc:p0.range(e),label:x,isStretchy:!1,isShifty:!0,base:s}}return s}}Bt.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Nr=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Bt(e,t);delete r.gullet.macros.current["\\df@tag"];var n=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new z("\\tag works only in display equations");n=[{type:"tag",mode:"text",body:n,tag:r.subparse([new g0("\\df@tag")])}]}return n},Un=function(e,t,r){t.textContent="";var n=Lr(e,r).toNode();t.appendChild(n)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Un=function(){throw new z("KaTeX doesn't work in quirks mode.")});var Cs=function(e,t){var r=Lr(e,t).toMarkup();return r},Ds=function(e,t){var r=new kr(t);return Nr(e,r)},Wn=function(e,t,r){if(r.throwOnError||!(e instanceof z))throw e;var n=k(["katex-error"],[new b0(t)]);return n.setAttribute("title",e.toString()),n.setAttribute("style","color:"+r.errorColor),n},Lr=function(e,t){var r=new kr(t);try{var n=Nr(e,r);return Fi(n,e,r)}catch(i){return Wn(i,e,r)}},Rs=function(e,t){var r=new kr(t);try{var n=Nr(e,r);return Pi(n,e,r)}catch(i){return Wn(i,e,r)}},qs="0.16.45",Es={Span:ve,Anchor:vt,SymbolNode:b0,SvgNode:H0,PathNode:j0,LineNode:tr},mr={version:qs,render:Un,renderToString:Cs,ParseError:z,SETTINGS_SCHEMA:Jt,__parse:Ds,__renderToDomTree:Lr,__renderToHTMLTree:Rs,__setFontMetrics:ki,__defineSymbol:l,__defineFunction:D,__defineMacro:m,__domTree:Es};const Is=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1(?=[\s?!\.,:?!。,:]|$)/,Ns=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1/,Ls=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function Hs(a={}){return{extensions:[Os(a,Ia(a,!1)),$s(a,Ia(a,!0))]}}function Ia(a,e){return t=>mr.renderToString(t.text,{...a,displayMode:t.displayMode})+(e?`
304
304
  `:"")}function Os(a,e){const t=a&&a.nonStandard,r=t?Ns:Is;return{name:"inlineKatex",level:"inline",start(n){let i,s=n;for(;s;){if(i=s.indexOf("$"),i===-1)return;if((t?i>-1:i===0||s.charAt(i-1)===" ")&&s.substring(i).match(r))return i;s=s.substring(i+1).replace(/^\$+/,"")}},tokenizer(n,i){const s=n.match(r);if(s)return{type:"inlineKatex",raw:s[0],text:s[2].trim(),displayMode:s[1].length===2}},renderer:e}}function $s(a,e){return{name:"blockKatex",level:"block",tokenizer(t,r){const n=t.match(Ls);if(n)return{type:"blockKatex",raw:n[0],text:n[2].trim(),displayMode:n[1].length===2}},renderer:e}}const Vn=u1("actions");let N0=null,te=null,dt="light",ft=!1,Te=!1,et=!1,tt=!0,Na=!1,jt=null,Xn=null;const dr=new Map,Yn=/^\\\[([\s\S]+?)\\\]/;function Fs(a){const e=F.Lexer.rules.inline.gfm.code;let t=0;for(;t<a.length;){const r=e.exec(a.slice(t));let n=0;for(let s=t-1;a[s]==="\\";s--)n++;if((r==null?void 0:r.index)===0&&n%2===0){t+=r[0].length;continue}const i=Yn.exec(a.slice(t));if((t===0||a[t-1]===`
305
- `)&&(i!=null&&i[1].trim()))return t;t++}return-1}const Ps=new Set(["a","blockquote","br","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","img","kbd","li","ol","p","pre","span","strong","sub","summary","sup","table","tbody","td","th","thead","tr","ul"]),Gs=new Set(["script","style","iframe","object","embed","meta","link"]);function Us(a,e,t){const r=t.trim();return r?e==="src"&&a==="img"?/^(https?:|data:image\/|\/|\.\/|\.\.\/|#)/i.test(r)?r:null:e==="href"&&a==="a"&&/^(https?:|mailto:|\/|\.\/|\.\.\/|#)/i.test(r)?r:null:null}function Ws(a){const e=nt(a);if(typeof document>"u")return w0(e);const t=document.createElement("template");t.innerHTML=e;const r=s=>{const u=s.tagName.toLowerCase();if(Gs.has(u)){s.remove();return}if(!Ps.has(u)){s.replaceWith(...Array.from(s.childNodes));return}for(const h of Array.from(s.attributes)){const d=h.name.toLowerCase();if(d.startsWith("on")||d==="style"){s.removeAttribute(h.name);continue}if(d==="href"||d==="src"){const f=Us(u,d,h.value);if(f){s.setAttribute(h.name,f);continue}s.removeAttribute(h.name);continue}d==="alt"||d==="title"||d==="width"||d==="height"||d==="open"||d==="id"||d==="class"||d==="name"||d.startsWith("aria-")||d.startsWith("data-")||s.removeAttribute(h.name)}u==="a"&&(s.setAttribute("target","_blank"),s.setAttribute("rel","noopener noreferrer"))},n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT),i=[];for(;n.nextNode();)i.push(n.currentNode);for(const s of i.reverse())r(s);return t.innerHTML}function Vs(a){let e=2166136261;for(let t=0;t<a.length;t++)e^=a.charCodeAt(t),e=Math.imul(e,16777619);return(e>>>0).toString(16)}function La(){dr.clear()}const Ae=new Set,Zt=new Set,Me=[];let rt=!1;const at=[];function rl(a){return at.push(a),()=>{const e=at.indexOf(a);e>-1&&at.splice(e,1)}}function Xs(){for(const a of at)try{a()}catch(e){Vn.error("Error in language listener",e)}}async function Ct(){return N0||te||(te=(async()=>(await jn()).createHighlighter({themes:["github-light","github-light-high-contrast","github-dark"],langs:[]}))().catch(a=>{throw te=null,a}),N0=await te,te=null,N0)}async function jn(){return jt||(jt=h1(()=>import("./bundle-full-yMAV5vbj.js"),__vite__mapDeps([0,1,2,3,4,5])).then(a=>(Xn=a.bundledLanguages,a))),jt}function Zn(){N0||te||Ct().catch(a=>{Vn.warn("Failed to initialize markdown highlighter",a)})}function Hr(a){return a.trim().toLowerCase()}function Or(a){const e=Hr(a),t=Xn;if(!t)return{canonical:null,raw:e};if(e in t)return{canonical:e,raw:e};for(const[r,n]of Object.entries(t)){const i=n.aliases;if(i!=null&&i.includes(e))return{canonical:r,raw:e}}return{canonical:null,raw:e}}function Kn(a){const e=new Set;try{const t=F.lexer(a);F.walkTokens(t,r=>{if((r==null?void 0:r.type)!=="code")return;const n=typeof r.lang=="string"?r.lang:"";n.trim()&&e.add(n.trim())})}catch{return[]}return[...e]}function al(a){const e=Kn(a);for(const t of e){const r=Hr(t);if(!r||r==="text")continue;const{canonical:n,raw:i}=Or(t),s=n||i;if(!(s==="text"||i==="text")&&(!N0||!Ae.has(s)))return!0}return!1}async function Ys(a){if(Te)return;const e=Kn(a);for(const t of e){const r=Hr(t);r&&r!=="text"&&(Ae.has(r)||Zt.has(r)||(Zt.add(r),Me.push(async()=>{try{await jn();const{canonical:n,raw:i}=Or(t),s=n||i;if(s==="text"||i==="text")return;await(await Ct()).loadLanguage(s),Ae.add(s),Ae.add(i),Xs()}catch{}finally{Zt.delete(r)}})))}Me.length>0&&!rt&&js()}async function js(){if(!(rt||Me.length===0)){for(rt=!0;Me.length>0;){const a=Me.shift();a&&await a()}rt=!1}}function Qn(a){if(dt=a?"dark":"light",Na)return;F.setOptions({breaks:!0,gfm:!0}),F.use(Hs({throwOnError:!1,nonStandard:!0,strict:"ignore"})),F.use({extensions:[{name:"inlineBracketMath",level:"inline",start(t){return t.search(new RegExp("(?<!\\\\)\\\\\\("))},tokenizer(t){const r=/^\\\\\(([^\n]+?)\\\)/.exec(t);if(r)return{type:"inlineBracketMath",raw:r[0],text:r[0],escaped:!0};const n=/^\\\(([^\n]+?)\\\)/.exec(t);if(n)return{type:"inlineBracketMath",raw:n[0],text:n[1]}},renderer(t){return t.escaped?w0(t.raw):mr.renderToString(t.text,{throwOnError:!1,strict:"ignore",displayMode:!1})}},{name:"blockBracketMath",level:"block",tokenizer(t){const r=Yn.exec(t);if(!(!r||!r[1].trim()))return{type:"blockBracketMath",raw:r[0],text:r[1]}},renderer(t){return mr.renderToString(t.text,{throwOnError:!1,strict:"ignore",displayMode:!0})}}],tokenizer:{paragraph(t){const r=this.rules.block.paragraph.exec(t);if(!r)return!1;const n=Fs(r[0]);if(n<=0)return!1;const i=r[0].slice(0,n),s=i.endsWith(`
305
+ `)&&(i!=null&&i[1].trim()))return t;t++}return-1}const Ps=new Set(["a","blockquote","br","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","img","kbd","li","ol","p","pre","span","strong","sub","summary","sup","table","tbody","td","th","thead","tr","ul"]),Gs=new Set(["script","style","iframe","object","embed","meta","link"]);function Us(a,e,t){const r=t.trim();return r?e==="src"&&a==="img"?/^(https?:|data:image\/|\/|\.\/|\.\.\/|#)/i.test(r)?r:null:e==="href"&&a==="a"&&/^(https?:|mailto:|\/|\.\/|\.\.\/|#)/i.test(r)?r:null:null}function Ws(a){const e=nt(a);if(typeof document>"u")return w0(e);const t=document.createElement("template");t.innerHTML=e;const r=s=>{const u=s.tagName.toLowerCase();if(Gs.has(u)){s.remove();return}if(!Ps.has(u)){s.replaceWith(...Array.from(s.childNodes));return}for(const h of Array.from(s.attributes)){const d=h.name.toLowerCase();if(d.startsWith("on")||d==="style"){s.removeAttribute(h.name);continue}if(d==="href"||d==="src"){const f=Us(u,d,h.value);if(f){s.setAttribute(h.name,f);continue}s.removeAttribute(h.name);continue}d==="alt"||d==="title"||d==="width"||d==="height"||d==="open"||d==="id"||d==="class"||d==="name"||d.startsWith("aria-")||d.startsWith("data-")||s.removeAttribute(h.name)}u==="a"&&(s.setAttribute("target","_blank"),s.setAttribute("rel","noopener noreferrer"))},n=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT),i=[];for(;n.nextNode();)i.push(n.currentNode);for(const s of i.reverse())r(s);return t.innerHTML}function Vs(a){let e=2166136261;for(let t=0;t<a.length;t++)e^=a.charCodeAt(t),e=Math.imul(e,16777619);return(e>>>0).toString(16)}function La(){dr.clear()}const Ae=new Set,Zt=new Set,Me=[];let rt=!1;const at=[];function rl(a){return at.push(a),()=>{const e=at.indexOf(a);e>-1&&at.splice(e,1)}}function Xs(){for(const a of at)try{a()}catch(e){Vn.error("Error in language listener",e)}}async function Ct(){return N0||te||(te=(async()=>(await jn()).createHighlighter({themes:["github-light","github-light-high-contrast","github-dark"],langs:[]}))().catch(a=>{throw te=null,a}),N0=await te,te=null,N0)}async function jn(){return jt||(jt=h1(()=>import("./bundle-full-CEFzES5w.js"),__vite__mapDeps([0,1,2,3,4,5])).then(a=>(Xn=a.bundledLanguages,a))),jt}function Zn(){N0||te||Ct().catch(a=>{Vn.warn("Failed to initialize markdown highlighter",a)})}function Hr(a){return a.trim().toLowerCase()}function Or(a){const e=Hr(a),t=Xn;if(!t)return{canonical:null,raw:e};if(e in t)return{canonical:e,raw:e};for(const[r,n]of Object.entries(t)){const i=n.aliases;if(i!=null&&i.includes(e))return{canonical:r,raw:e}}return{canonical:null,raw:e}}function Kn(a){const e=new Set;try{const t=F.lexer(a);F.walkTokens(t,r=>{if((r==null?void 0:r.type)!=="code")return;const n=typeof r.lang=="string"?r.lang:"";n.trim()&&e.add(n.trim())})}catch{return[]}return[...e]}function al(a){const e=Kn(a);for(const t of e){const r=Hr(t);if(!r||r==="text")continue;const{canonical:n,raw:i}=Or(t),s=n||i;if(!(s==="text"||i==="text")&&(!N0||!Ae.has(s)))return!0}return!1}async function Ys(a){if(Te)return;const e=Kn(a);for(const t of e){const r=Hr(t);r&&r!=="text"&&(Ae.has(r)||Zt.has(r)||(Zt.add(r),Me.push(async()=>{try{await jn();const{canonical:n,raw:i}=Or(t),s=n||i;if(s==="text"||i==="text")return;await(await Ct()).loadLanguage(s),Ae.add(s),Ae.add(i),Xs()}catch{}finally{Zt.delete(r)}})))}Me.length>0&&!rt&&js()}async function js(){if(!(rt||Me.length===0)){for(rt=!0;Me.length>0;){const a=Me.shift();a&&await a()}rt=!1}}function Qn(a){if(dt=a?"dark":"light",Na)return;F.setOptions({breaks:!0,gfm:!0}),F.use(Hs({throwOnError:!1,nonStandard:!0,strict:"ignore"})),F.use({extensions:[{name:"inlineBracketMath",level:"inline",start(t){return t.search(new RegExp("(?<!\\\\)\\\\\\("))},tokenizer(t){const r=/^\\\\\(([^\n]+?)\\\)/.exec(t);if(r)return{type:"inlineBracketMath",raw:r[0],text:r[0],escaped:!0};const n=/^\\\(([^\n]+?)\\\)/.exec(t);if(n)return{type:"inlineBracketMath",raw:n[0],text:n[1]}},renderer(t){return t.escaped?w0(t.raw):mr.renderToString(t.text,{throwOnError:!1,strict:"ignore",displayMode:!1})}},{name:"blockBracketMath",level:"block",tokenizer(t){const r=Yn.exec(t);if(!(!r||!r[1].trim()))return{type:"blockBracketMath",raw:r[0],text:r[1]}},renderer(t){return mr.renderToString(t.text,{throwOnError:!1,strict:"ignore",displayMode:!0})}}],tokenizer:{paragraph(t){const r=this.rules.block.paragraph.exec(t);if(!r)return!1;const n=Fs(r[0]);if(n<=0)return!1;const i=r[0].slice(0,n),s=i.endsWith(`
306
306
  `)?i.slice(0,-1):i;return{type:"paragraph",raw:i,text:s,tokens:this.lexer.inline(s)}}}});const e=new F.Renderer;e.code=(t,r)=>{const n=nt(t),i=encodeURIComponent(n),s=r&&r.trim()?r.trim():"text",u=`${s}\0${n}`,h=dr.get(u)??0;dr.set(u,h+1);const d=Vs(`${u}\0${h}`),f=w0(s),b=w0(Kr("markdown.copy")),y=tt,x=w0(Kr(y?"markdown.codeBlock.wrap.disable":"markdown.codeBlock.wrap.enable")),B=`
307
307
  <div class="code-block-header">
308
308
  <span class="code-block-language">${f}</span>
@@ -0,0 +1,26 @@
1
+ var Do=Object.defineProperty;var Lo=(e,t,n)=>t in e?Do(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pt=(e,t,n)=>Lo(e,typeof t!="symbol"?t+"":t,n);import{c as L,a as de,u as ot,s as Ut,b as K,r as No,d as k,e as pr,o as fe,g as Nn,f as D,$ as B,h as ve,i as kt,j as it,k as Ke,l as ct,m as yr,n as he,p as Ro,q as Fo,t as Bt,v as _o,S as Uo}from"./git-diff-vendor-CYS3ApzA.js";import{g as Bo}from"./fast-diff-vendor-DgdwVvTQ.js";const Wo=["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"],Vo=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...Wo]),jo=new Set(["innerHTML","textContent","innerText","children"]),zo=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Ko=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 Go(e,t){const n=Ko[e];return typeof n=="object"?n[t]?n.$:void 0:n}const Ho=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),wr=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"]),Jo={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},qo=e=>L(()=>e());function Yo(e,t,n){let r=n.length,o=t.length,i=r,s=0,a=0,c=t[o-1].nextSibling,u=null;for(;s<o||a<i;){if(t[s]===n[a]){s++,a++;continue}for(;t[o-1]===n[i-1];)o--,i--;if(o===s){const l=i<r?a?n[a-1].nextSibling:n[i-a]:c;for(;a<i;)e.insertBefore(n[a++],l)}else if(i===a)for(;s<o;)(!u||!u.has(t[s]))&&t[s].remove(),s++;else if(t[s]===n[i-1]&&n[a]===t[o-1]){const l=t[--o].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--i],l),t[o]=n[i]}else{if(!u){u=new Map;let d=a;for(;d<i;)u.set(n[d],d++)}const l=u.get(t[s]);if(l!=null)if(a<l&&l<i){let d=s,f=1,m;for(;++d<o&&d<i&&!((m=u.get(t[d]))==null||m!==l+f);)f++;if(f>l-a){const w=t[s];for(;a<l;)e.insertBefore(n[a++],w)}else e.replaceChild(n[a++],t[s++])}else s++;else t[s++].remove()}}}const Rn="_$DX_DELEGATE";function eu(e,t,n,r={}){let o;return pr(i=>{o=i,t===document?e():Mt(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function En(e,t,n,r){let o;const i=()=>{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},s=t?()=>ot(()=>document.importNode(o||(o=i()),!0)):()=>(o||(o=i())).cloneNode(!0);return s.cloneNode=s,s}function br(e,t=window.document){const n=t[Rn]||(t[Rn]=new Set);for(let r=0,o=e.length;r<o;r++){const i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,ii))}}function st(e,t,n){Ae(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Xo(e,t,n,r){Ae(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function Zo(e,t,n){Ae(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function Qo(e,t){Ae(e)||(t==null?e.removeAttribute("class"):e.className=t)}function ei(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]=i=>o.call(e,n[1],i))}else e.addEventListener(t,n,typeof n!="function"&&n)}function ti(e,t,n={}){const r=Object.keys(t||{}),o=Object.keys(n);let i,s;for(i=0,s=o.length;i<s;i++){const a=o[i];!a||a==="undefined"||t[a]||(_n(e,a,!1),delete n[a])}for(i=0,s=r.length;i<s;i++){const a=r[i],c=!!t[a];!a||a==="undefined"||n[a]===c||!c||(_n(e,a,!0),n[a]=c)}return n}function ni(e,t,n){if(!t)return n?st(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,i;for(i in n)t[i]==null&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}function Fn(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function Cr(e,t={},n,r){const o={};return r||de(()=>o.children=at(e,t.children,o.children)),de(()=>typeof t.ref=="function"&&An(t.ref,e)),de(()=>ri(e,t,n,!0,o,!0)),o}function An(e,t,n){return ot(()=>e(t,n))}function Mt(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return at(e,t,r,n);de(o=>at(e,t(),o,n),r)}function ri(e,t,n,r,o={},i=!1){t||(t={});for(const s in o)if(!(s in t)){if(s==="children")continue;o[s]=Un(e,s,null,o[s],n,i,t)}for(const s in t){if(s==="children")continue;const a=t[s];o[s]=Un(e,s,a,o[s],n,i,t)}}function Sr(e){let t,n;return!Ae()||!(t=D.registry.get(n=si()))?e():(D.completed&&D.completed.add(t),D.registry.delete(n),t)}function Ae(e){return!!D.context&&!D.done&&(!e||e.isConnected)}function oi(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function _n(e,t,n){const r=t.trim().split(/\s+/);for(let o=0,i=r.length;o<i;o++)e.classList.toggle(r[o],n)}function Un(e,t,n,r,o,i,s){let a,c,u,l,d;if(t==="style")return ni(e,n,r);if(t==="classList")return ti(e,n,r);if(n===r)return r;if(t==="ref")i||n(e);else if(t.slice(0,3)==="on:"){const f=t.slice(3);r&&e.removeEventListener(f,r,typeof r!="function"&&r),n&&e.addEventListener(f,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const f=t.slice(10);r&&e.removeEventListener(f,r,!0),n&&e.addEventListener(f,n,!0)}else if(t.slice(0,2)==="on"){const f=t.slice(2).toLowerCase(),m=Ho.has(f);if(!m&&r){const w=Array.isArray(r)?r[0]:r;e.removeEventListener(f,w)}(m||n)&&(ei(e,f,n,m),m&&br([f]))}else if(t.slice(0,5)==="attr:")st(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")Zo(e,t.slice(5),n);else if((d=t.slice(0,5)==="prop:")||(u=jo.has(t))||!o&&((l=Go(t,e.tagName))||(c=Vo.has(t)))||(a=e.nodeName.includes("-")||"is"in s)){if(d)t=t.slice(5),c=!0;else if(Ae(e))return n;t==="class"||t==="className"?Qo(e,n):a&&!c&&!u?e[oi(t)]=n:e[l||t]=n}else{const f=o&&t.indexOf(":")>-1&&Jo[t.split(":")[0]];f?Xo(e,f,t,n):st(e,zo[t]||t,n)}return n}function ii(e){if(D.registry&&D.events&&D.events.find(([c,u])=>u===e))return;let t=e.target;const n=`$$${e.type}`,r=e.target,o=e.currentTarget,i=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),s=()=>{const c=t[n];if(c&&!t.disabled){const u=t[`${n}Data`];if(u!==void 0?c.call(t,u,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},a=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),D.registry&&!D.done&&(D.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();i(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!s());u++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();i(r)}function at(e,t,n,r,o){const i=Ae(e);if(i){!n&&(n=[...e.childNodes]);let c=[];for(let u=0;u<n.length;u++){const l=n[u];l.nodeType===8&&l.data.slice(0,2)==="!$"?l.remove():c.push(l)}n=c}for(;typeof n=="function";)n=n();if(t===n)return n;const s=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,s==="string"||s==="number"){if(i||s==="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=ke(e,n,r,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||s==="boolean"){if(i)return n;n=ke(e,n,r)}else{if(s==="function")return de(()=>{let c=t();for(;typeof c=="function";)c=c();n=at(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],u=n&&Array.isArray(n);if(un(c,t,n,o))return de(()=>n=at(e,c,n,r,!0)),()=>n;if(i){if(!c.length)return n;if(r===void 0)return n=[...e.childNodes];let l=c[0];if(l.parentNode!==e)return n;const d=[l];for(;(l=l.nextSibling)!==r;)d.push(l);return n=d}if(c.length===0){if(n=ke(e,n,r),a)return n}else u?n.length===0?Bn(e,c,r):Yo(e,n,c):(n&&ke(e),Bn(e,c));n=c}else if(t.nodeType){if(i&&t.parentNode)return n=a?[t]:t;if(Array.isArray(n)){if(a)return n=ke(e,n,r,t);ke(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function un(e,t,n,r){let o=!1;for(let i=0,s=t.length;i<s;i++){let a=t[i],c=n&&n[e.length],u;if(!(a==null||a===!0||a===!1))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=un(e,a,c)||o;else if(u==="function")if(r){for(;typeof a=="function";)a=a();o=un(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||o}else e.push(a),o=!0;else{const l=String(a);c&&c.nodeType===3&&c.data===l?e.push(c):e.push(document.createTextNode(l))}}return o}function Bn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function ke(e,t,n,r){if(n===void 0)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let i=!1;for(let s=t.length-1;s>=0;s--){const a=t[s];if(o!==a){const c=a.parentNode===e;!i&&!s?c?e.replaceChild(o,a):e.insertBefore(o,n):c&&a.remove()}else i=!0}}else e.insertBefore(o,n);return[o]}function si(){return D.getNextContextId()}const ai="http://www.w3.org/2000/svg";function vr(e,t=!1,n=void 0){return t?document.createElementNS(ai,e):document.createElement(e,{is:n})}function tu(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=Nn();let i,s=!!D.context;return K(()=>{s&&(Nn().user=s=!1),i||(i=No(o,()=>L(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,u]=k(!1),l=()=>u(!0);pr(d=>Mt(a,()=>c()?d():i(),null)),fe(l)}else{const c=vr(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),Mt(u,i),a.appendChild(c),e.ref&&e.ref(c),fe(()=>a.removeChild(c))}},void 0,{render:!s}),n}function ci(e,t){const n=L(e);return L(()=>{const r=n();switch(typeof r){case"function":return ot(()=>r(t));case"string":const o=wr.has(r),i=D.context?Sr():vr(r,o,ot(()=>t.is));return Cr(i,t,o),i}})}function nu(e){const[,t]=Ut(e,["component"]);return ci(()=>e.component,t)}const Be=Symbol("store-raw"),ie=Symbol("store-node"),Y=Symbol("store-has"),xr=Symbol("store-self");function Or(e){let t=e[B];if(!t&&(Object.defineProperty(e,B,{value:t=new Proxy(e,ui)}),!Array.isArray(e))){const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let o=0,i=n.length;o<i;o++){const s=n[o];r[s].get&&Object.defineProperty(e,s,{enumerable:r[s].enumerable,get:r[s].get.bind(t)})}}return t}function te(e){let t;return e!=null&&typeof e=="object"&&(e[B]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function ce(e,t=new Set){let n,r,o,i;if(n=e!=null&&e[Be])return n;if(!te(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let s=0,a=e.length;s<a;s++)o=e[s],(r=ce(o,t))!==o&&(e[s]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const s=Object.keys(e),a=Object.getOwnPropertyDescriptors(e);for(let c=0,u=s.length;c<u;c++)i=s[c],!a[i].get&&(o=e[i],(r=ce(o,t))!==o&&(e[i]=r))}return e}function We(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function xe(e,t,n){if(e[t])return e[t];const[r,o]=k(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function li(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===B||t===ie||(delete n.value,delete n.writable,n.get=()=>e[B][t]),n}function Tn(e){it()&&xe(We(e,ie),xr)()}function Er(e){return Tn(e),Reflect.ownKeys(e)}const ui={get(e,t,n){if(t===Be)return e;if(t===B)return n;if(t===kt)return Tn(e),n;const r=We(e,ie),o=r[t];let i=o?o():e[t];if(t===ie||t===Y||t==="__proto__")return i;if(!o){const s=Object.getOwnPropertyDescriptor(e,t);it()&&(typeof i!="function"||e.hasOwnProperty(t))&&!(s&&s.get)&&(i=xe(r,t,i)())}return te(i)?Or(i):i},has(e,t){return t===Be||t===B||t===kt||t===ie||t===Y||t==="__proto__"?!0:(it()&&xe(We(e,Y),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Er,getOwnPropertyDescriptor:li};function F(e,t,n,r=!1){if(!r&&e[t]===n)return;const o=e[t],i=e.length;n===void 0?(delete e[t],e[Y]&&e[Y][t]&&o!==void 0&&e[Y][t].$()):(e[t]=n,e[Y]&&e[Y][t]&&o===void 0&&e[Y][t].$());let s=We(e,ie),a;if((a=xe(s,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==i){for(let c=e.length;c<i;c++)(a=s[c])&&a.$();(a=xe(s,"length",i))&&a.$(e.length)}(a=s[xr])&&a.$()}function Ar(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 di(e,t){if(typeof t=="function"&&(t=t(e)),t=ce(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 Ar(e,t)}function Qe(e,t,n=[]){let r,o=e;if(t.length>1){r=t.shift();const s=typeof r,a=Array.isArray(e);if(Array.isArray(r)){for(let c=0;c<r.length;c++)Qe(e,[r[c]].concat(t),n);return}else if(a&&s==="function"){for(let c=0;c<e.length;c++)r(e[c],c)&&Qe(e,[c].concat(t),n);return}else if(a&&s==="object"){const{from:c=0,to:u=e.length-1,by:l=1}=r;for(let d=c;d<=u;d+=l)Qe(e,[d].concat(t),n);return}else if(t.length>1){Qe(e[r],t,[r].concat(n));return}o=e[r],n=[r].concat(n)}let i=t[0];typeof i=="function"&&(i=i(o,n),i===o)||r===void 0&&i==null||(i=ce(i),r===void 0||te(o)&&te(i)&&!Array.isArray(i)?Ar(o,i):F(e,r,i))}function ru(...[e,t]){const n=ce(e||{}),r=Array.isArray(n),o=Or(n);function i(...s){ve(()=>{r&&s.length===1?di(n,s[0]):Qe(n,s)})}return[o,i]}function fi(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===B||t===ie||(delete n.value,delete n.writable,n.get=()=>e[B][t],n.set=r=>e[B][t]=r),n}const hi={get(e,t,n){if(t===Be)return e;if(t===B)return n;if(t===kt)return Tn(e),n;const r=We(e,ie),o=r[t];let i=o?o():e[t];if(t===ie||t===Y||t==="__proto__")return i;if(!o){const s=Object.getOwnPropertyDescriptor(e,t),a=typeof i=="function";if(it()&&(!a||e.hasOwnProperty(t))&&!(s&&s.get))i=xe(r,t,i)();else if(i!=null&&a&&i===Array.prototype[t])return(...c)=>ve(()=>Array.prototype[t].apply(n,c))}return te(i)?Tr(i):i},has(e,t){return t===Be||t===B||t===kt||t===ie||t===Y||t==="__proto__"?!0:(it()&&xe(We(e,Y),t)(),t in e)},set(e,t,n){return ve(()=>F(e,t,ce(n))),!0},deleteProperty(e,t){return ve(()=>F(e,t,void 0,!0)),!0},ownKeys:Er,getOwnPropertyDescriptor:fi};function Tr(e){let t=e[B];if(!t){Object.defineProperty(e,B,{value:t=new Proxy(e,hi)});const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),o=Object.getPrototypeOf(e),i=o!==null&&e!==null&&typeof e=="object"&&!Array.isArray(e)&&o!==Object.prototype;if(i){let s=o;for(;s!=null;){const a=Object.getOwnPropertyDescriptors(s);n.push(...Object.keys(a)),Object.assign(r,a),s=Object.getPrototypeOf(s)}}for(let s=0,a=n.length;s<a;s++){const c=n[s];if(!(i&&c==="constructor")){if(r[c].get){const u=r[c].get.bind(t);Object.defineProperty(e,c,{get:u,configurable:!0})}if(r[c].set){const u=r[c].set;Object.defineProperty(e,c,{set:d=>ve(()=>u.call(t,d)),configurable:!0})}}}}return t}function gi(e,t){const n=ce(e||{});return Tr(n)}const dn=Symbol("store-root");function De(e,t,n,r,o){const i=t[n];if(e===i)return;const s=Array.isArray(e);if(n!==dn&&(!te(e)||!te(i)||s!==Array.isArray(i)||o&&e[o]!==i[o])){F(t,n,e);return}if(s){if(e.length&&i.length&&(!r||o&&e[0]&&e[0][o]!=null)){let u,l,d,f,m,w,g,b;for(d=0,f=Math.min(i.length,e.length);d<f&&(i[d]===e[d]||o&&i[d]&&e[d]&&i[d][o]&&i[d][o]===e[d][o]);d++)De(e[d],i,d,r,o);const A=new Array(e.length),I=new Map;for(f=i.length-1,m=e.length-1;f>=d&&m>=d&&(i[f]===e[m]||o&&i[f]&&e[m]&&i[f][o]&&i[f][o]===e[m][o]);f--,m--)A[m]=i[f];if(d>m||d>f){for(l=d;l<=m;l++)F(i,l,e[l]);for(;l<e.length;l++)F(i,l,A[l]),De(e[l],i,l,r,o);i.length>e.length&&F(i,"length",e.length);return}for(g=new Array(m+1),l=m;l>=d;l--)w=e[l],b=o&&w?w[o]:w,u=I.get(b),g[l]=u===void 0?-1:u,I.set(b,l);for(u=d;u<=f;u++)w=i[u],b=o&&w?w[o]:w,l=I.get(b),l!==void 0&&l!==-1&&(A[l]=i[u],l=g[l],I.set(b,l));for(l=d;l<e.length;l++)l in A?(F(i,l,A[l]),De(e[l],i,l,r,o)):F(i,l,e[l])}else for(let u=0,l=e.length;u<l;u++)De(e[u],i,u,r,o);i.length>e.length&&F(i,"length",e.length);return}const a=Object.keys(e);for(let u=0,l=a.length;u<l;u++)De(e[a[u]],i,a[u],r,o);const c=Object.keys(i);for(let u=0,l=c.length;u<l;u++)e[c[u]]===void 0&&F(i,c[u],void 0)}function ou(e,t={}){const{merge:n,key:r="id"}=t,o=ce(e);return i=>{if(!te(i)||!te(o))return o;const s=De(o,{[dn]:i},dn,n,r);return s===void 0?i:s}}const Pt=new WeakMap,kr={get(e,t){if(t===Be)return e;const n=e[t];let r;return te(n)?Pt.get(n)||(Pt.set(n,r=new Proxy(n,kr)),r):n},set(e,t,n){return F(e,t,ce(n)),!0},deleteProperty(e,t){return F(e,t,void 0,!0),!0}};function iu(e){return t=>{if(te(t)){let n;(n=Pt.get(t))||Pt.set(t,n=new Proxy(t,kr)),e(n)}return t}}function kn(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function mi(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 Oe(e){if(typeof e!="string")return e;if(e.charAt(0)==="#")return Oe(mi(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,i;if(n==="color"){if(o=r.split(" "),i=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(i)===-1)throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020. "+i)}else o=r.split(",");return{type:n,values:o.map(s=>parseFloat(s)),colorSpace:i}}function Wt(e){const{type:t,colorSpace:n}=e,{values:r}=e;let o;return t.indexOf("rgb")!==-1?o=r.map((i,s)=>s<3?parseInt(i.toString(),10):i).join(","):t.indexOf("hsl")!==-1&&(o=r.map((i,s)=>s===1||s===2?`${i}%`:i).join(",")),t.indexOf("color")!==-1?o=`${n} ${r.join(" ")}`:o=`${r.join(", ")}`,`${t}(${o})`}function pi(e){const t=Oe(e),{values:n}=t,r=n[0],o=n[1]/100,i=n[2]/100,s=o*Math.min(i,1-i),a=(l,d=(l+r/30)%12)=>i-s*Math.max(Math.min(d-3,9-d,1),-1);let c="rgb";const u=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return t.type==="hsla"&&(c+="a",u.push(n[3])),Wt({type:c,values:u})}function Wn(e){const{type:t,values:n}=Oe(e);let r=t==="hsl"?Oe(pi(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 yi(e,t){const n=Wn(e),r=Wn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function su(e,t){let{type:n,values:r}=Oe(e);return t=kn(t),(n==="rgb"||n==="hsl")&&(n+="a"),n==="color"?r[3]=`/${t}`:r[3]=t,Wt({type:n,values:r})}function wi(e,t){const n=Oe(e);if(t=kn(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 Wt(n)}function bi(e,t){const n=Oe(e);if(t=kn(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 Wt(n)}const Ci={xs:0,sm:600,md:900,lg:1200,xl:1536};function Si(e,t,n){const r=e.theme||{};if(Array.isArray(t)){const i=r.breakpoints;return t.reduce((s,a,c)=>(s={...s,...i.up(i.keys[c],n(t[c]))},s),{})}if(typeof t=="object"){const i=r.breakpoints;return Object.keys(t).reduce((a,c)=>{if(Object.keys(i.values||Ci).indexOf(c)!==-1)a={...a,...i.up(c,n(t[c],c))};else{const u=c;a[u]=t[u]}return a},{})}return n(t)}const vi={cleanupStyles:!0},xi=Ke(vi),Ee={black:"#000",white:"#fff"},Ne={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Re={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Fe={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},_e={300:"#4fc3f7",400:"#29b6f6",700:"#0288d1",800:"#0277bd",900:"#01579b"},Ue={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},nt={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Oi={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 et(e){return e!==null&&typeof e=="object"&&e.constructor===Object}function Ei(e,t){for(const n of t){const r=e[n];delete e[n],e[n]=r}}function Mn(e,t,n={clone:!0}){const r=n.clone?{...e}:e,o=n.sortKeys?[]:void 0;return et(e)&&et(t)&&(Object.keys(t).forEach(i=>{if(i==="__proto__")return;o&&o.push(i);let s,a;et(s=t[i])&&i in e&&et(a=e[i])?r[i]=Mn(a,s,n):s!==void 0&&(r[i]=s)}),o&&Ei(r,o)),r}function fn(e){if(Array.isArray(e)){const t=[];for(const n of e)t.push(fn(n));return t}else if(et(e)){const t={};for(const n in e)n!=="__proto__"&&(t[n]=fn(e[n]));return t}else return e}function lt(e,...t){for(const n of t)Mn(e,fn(n),{clone:!1});return e}const Ai=()=>({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:Ee.white,default:Ee.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}}),Ti={primary:{main:Fe[700],light:Fe[400],dark:Fe[800]},secondary:{main:Re[500],light:Re[300],dark:Re[700]},error:{main:Ne[700],light:Ne[400],dark:Ne[800]},info:{main:_e[700],light:_e[800],dark:_e[900]},success:{main:Ue[800],light:Ue[500],dark:Ue[900]},warning:{main:"#ED6C02",light:nt[500],dark:nt[900]}},ki=()=>({text:{primary:Ee.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:Ee.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}}),Mi={primary:{main:Fe[200],light:Fe[50],dark:Fe[400]},secondary:{main:Re[200],light:Re[50],dark:Re[400]},error:{main:Ne[500],light:Ne[300],dark:Ne[700]},info:{main:_e[400],light:_e[300],dark:_e[700]},success:{main:Ue[400],light:Ue[300],dark:Ue[700]},warning:{main:nt[400],light:nt[300],dark:nt[700]}},Pi={light:Ai,dark:ki};function Mr(e,t){return yi(e,Ee.white)>=t?Ee.white:"rgba(0, 0, 0, 0.87)"}function Vn(e,t,n,r){const o=typeof r=="number"?r:r.light,i=typeof r=="number"?r*1.5:r.dark;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:t==="light"?e.light=bi(e.main,o):t==="dark"&&(e.dark=wi(e.main,i)))}function $i(e){const t={...e.color},n=e.mainShade??500;return!e.color.main&&e.color[n]&&(t.main=e.color[n]),Vn(t,"light",e.lightShade??300,e.tonalOffset),Vn(t,"dark",e.darkShade??700,e.tonalOffset),t.contrastText||(t.contrastText=Mr(t.main,e.contrastThreshold)),t}const Ii=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:Oi,common:Ee});function Di(e){const t=["error","info","primary","secondary","success","warning"],n=Ii(),r={...lt({},n,Pi[(e==null?void 0:e.mode)??n.mode](),e),isColorName(i){return t.includes(i)},getColorObject(i){return r[i]},getColor(i){return r.mode==="light"?r[i].light:r[i].dark},augmentColor(i){return $i({...i,tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold})},getContrastText(i){return Mr(i,r.contrastThreshold)}},o=i=>r.mode==="light"?Ti[i]:Mi[i];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 Li={};function Ni(e){return{...lt({},Li,e??{})}}function Ri(e,t=void 0,n={}){return{toolbar:{minHeight:56,[`${e.up("xs")} and (orientation: landscape)`]:{minHeight:48},[e.up("sm")]:{minHeight:64}},...n}}const Zt={},Fi=.2,_i=.14,Ui=.12;function T(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Fi})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${_i})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Ui})`].join(",")}const Bi=[()=>"none",()=>T(0,2,1,-1,0,1,1,0,0,1,3,0),()=>T(0,3,1,-2,0,2,2,0,0,1,5,0),()=>T(0,3,3,-2,0,3,4,0,0,1,8,0),()=>T(0,2,4,-1,0,4,5,0,0,1,10,0),()=>T(0,3,5,-1,0,5,8,0,0,1,14,0),()=>T(0,3,5,-1,0,6,10,0,0,1,18,0),()=>T(0,4,5,-2,0,7,10,1,0,2,16,1),()=>T(0,5,5,-3,0,8,10,1,0,3,14,2),()=>T(0,5,6,-3,0,9,12,1,0,3,16,2),()=>T(0,6,6,-3,0,10,14,1,0,4,18,3),()=>T(0,6,7,-4,0,11,15,1,0,4,20,3),()=>T(0,7,8,-4,0,12,17,2,0,5,22,4),()=>T(0,7,8,-4,0,13,19,2,0,5,24,4),()=>T(0,7,9,-4,0,14,21,2,0,5,26,4),()=>T(0,8,9,-5,0,15,22,2,0,6,28,5),()=>T(0,8,10,-5,0,16,24,2,0,6,30,5),()=>T(0,8,11,-5,0,17,26,2,0,6,32,5),()=>T(0,9,11,-5,0,18,28,2,0,7,34,6),()=>T(0,9,12,-6,0,19,29,2,0,7,36,6),()=>T(0,10,13,-6,0,20,31,3,0,8,38,7),()=>T(0,10,13,-6,0,21,33,3,0,8,40,7),()=>T(0,10,14,-6,0,22,35,3,0,8,42,7),()=>T(0,11,14,-7,0,23,36,3,0,9,44,8),()=>T(0,11,15,-7,0,24,38,3,0,9,46,8)];function Wi(){return new Proxy([],{get:(e,t)=>typeof t!="string"||isNaN(Number(t))?e[t]:t in Zt?Zt[t]:Zt[t]=Bi[t]()})}const Vi={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)"},ji={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function jn(e){return`${Math.round(e)}ms`}function zi(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function Ki(e){const t={...Vi,...e.easing},n={...ji,...e.duration};return{getAutoHeightDuration:zi,create:(o=["all"],i={})=>{const{duration:s=n.standard,easing:a=t.easeInOut,delay:c=0,...u}=i;return(Array.isArray(o)?o:[o]).map(l=>`${l} ${typeof s=="string"?s:jn(s)} ${a} ${typeof c=="string"?c:jn(c)}`).join(",")},...e,easing:t,duration:n}}const j={light:300,regular:400,medium:500},yt={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 Gi(e){return Math.round(e*1e5)/1e5}function z(e,t,n,r,o,i){return{fontFamily:e.fontFamily,fontWeight:t,fontSize:e.pxToRem(n),lineHeight:`${r}`,letterSpacing:`${Gi(o/n)}em`,...i?{textTransform:"uppercase"}:{}}}function Hi(e={}){const t={fontFamily:e.fontFamily??yt.fontFamily,fontSize:e.fontSize??yt.fontSize,htmlFontSize:(e==null?void 0:e.htmlFontSize)??yt.htmlFontSize,pxToRem:n=>{const r=t.fontSize/14;return`${n/t.htmlFontSize*r}rem`}};return lt(yt,t,{h1:z(t,j.light,96,1.167,-1.5),h2:z(t,j.light,60,1.2,-.5),h3:z(t,j.regular,48,1.167,0),h4:z(t,j.regular,34,1.235,.25),h5:z(t,j.regular,24,1.334,0),h6:z(t,j.medium,20,1.6,.15),subtitle1:z(t,j.regular,16,1.75,.15),subtitle2:z(t,j.medium,14,1.57,.1),body1:z(t,j.regular,16,1.5,.15),body2:z(t,j.regular,14,1.43,.15),button:z(t,j.medium,14,1.75,.4,!0),caption:z(t,j.regular,12,1.66,.4),overline:z(t,j.regular,12,2.66,1,!0)},e)}const Ji={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function qi(e){return{...lt({},Ji,e)}}function Qt(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,i]=t;r=`(max-width:${o}${n}) and (min-width:${i}${n})`}else throw new Error(`Invalid comparator: ${e}`);return`@media ${r}`}const Yi={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function Pr(e){const t={...Yi,...e??{},up:(n,r)=>{const o=Qt("up",t.resolve(n));return r?{[o]:r}:o},down:(n,r)=>{const o=Qt("down",t.resolve(n));return r?{[o]:r}:o},between:(n,r)=>{const o=Qt("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 $r(e){return typeof e=="function"?e:(...n)=>n.map(r=>typeof r=="number"?`${r*(e??8)}px`:r).join(" ")}const Xi={borderRadius:4};function Ir(e){return{...lt({},Xi,e)}}function Dr(e={}){const t={direction:"ltr",...e};function n(r,o){const i=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,...typeof i=="function"?{get:i}:{value:o({[r]:i})}})}return n("breakpoints",r=>Pr(r.breakpoints)),n("components",r=>Ni(r.components)),n("palette",r=>Di(r.palette)),n("shape",r=>Ir(r.shape)),n("spacing",r=>$r(r.spacing)),n("typography",r=>Hi(r.typography)),n("shadows",()=>Wi()),n("transitions",()=>Ki({})),n("zIndex",r=>qi(r.zIndex)),n("mixins",()=>Ri(t.breakpoints)),t}function Lr(e){let t;return function(){return t||(t=e()),t}}const Zi=Lr(Dr);let Nr;Nr=Ke({});const Vt=Nr;function Qi(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:Pr(e==null?void 0:e.breakpoints),shape:Ir(e==null?void 0:e.shape),spacing:$r(e==null?void 0:e.spacing)}}const es=Lr(Qi);function ts(e){for(const t in e)return!1;return!0}function Pn(e=es,t=Vt){const n=ct(t);if(typeof n=="function")return new Proxy({},{get:(r,o)=>n()[o]});if(ts(n)&&e)return typeof e=="function"?e():e;if(!n)throw new Error("Theme is not defined");return n}function Rr(e=Zi){return Pn(e,Vt)}function ns(e){return Pn(e,Vt)}function rs(e){var i,s;const t=[],n=typeof e.propDefaults=="function"?e.propDefaults({set:a=>a,inProps:e.props}):e.propDefaults,o=(s=(i=ns().components)==null?void 0:i[e.name])==null?void 0:s.defaultProps;return n&&t.push(n),o&&t.push(o),t.length?yr(...t,e.props):e.props}function os(e){return he(Vt.Provider,{get value(){return e.theme},get children(){return e.children}})}function is(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function ss(e,t){switch(typeof e){case"function":return Object.assign(e,{[Ro]:!0}),ot(()=>e(t));case"string":const n=wr.has(e),r=D.context?Sr():is(e,n);return Cr(r,t,n),r}}function Fr(e,t){const n=L(e);return L(()=>ss(n(),t))}function au(e){const[t,n]=Ut(e,["$component"]);return Fr(()=>t.$component,n)}function as(e){const t=e.reduce((n,r)=>("name"in r&&(n[`--${r.name}`]="0"),Mn(n,r,{clone:!1,sortKeys:!0}),n),{});return delete t.name,t}function _r(e){return e.startsWith("--")}function cs(e){return e.startsWith("__")}function Ur(e){return/[^a-z-]/i.test(e)&&!_r(e)}function Br(e){return e.startsWith("@global")}function hn(e){return e.startsWith("@media")}function Wr(e){return e.startsWith("@keyframes")}function zn(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Kn(e,t,n=[],r={}){const o=e.split(",").map(i=>(i=i.trim(),i.includes("&")?i:`& ${i}`));return $t(t,(n.length?n:[""]).flatMap(i=>o.map(s=>s.replace(/&/g,i).trim())),{...r})}function Gn(e,t){if(!t)return zn(e);let n=t.get(e);return n||(t.set(e,n=zn(e)),n)}function $t(e,t=[],n={}){const r=[],o=[];for(let s in e){const a=e[s];if(!cs(s))if(Br(s))for(const c in a)o.push(...Kn(c,a[c],[],n));else if(hn(s))o.push(...$t(a,t,{...n,sublevel:!0}).map(c=>`${s} {
2
+ ${c}
3
+ }`));else if(_r(s))a!=null&&r.push(`${s}: ${a};`);else if(Wr(s)){const c=[];for(const u in a)c.push(...$t(a[u],[/^\d+$/.test(u)?`${u}%`:u],{...n,sublevel:!0}));o.push(`${s} {
4
+ ${c.join(`
5
+ `)}
6
+ }`)}else if(Ur(s))o.push(...Kn(s,a,t,n));else if(n.extraProperties&&s in n.extraProperties){const c=n.extraProperties[s](a);for(const u in c){const l=c[u],d=n.onPropertyValue?n.onPropertyValue(u,l):l;d!=null&&r.push(`${Gn(u,n.propertyNameCache)}: ${d};`)}}else{s=Gn(s,n.propertyNameCache);const c=n.onPropertyValue?n.onPropertyValue(s,a):a;c!=null&&r.push(`${s}: ${c};`)}}const i=s=>{const a=" ".repeat(s);return`${a}${r.join(`
7
+ ${a}`)}`};if(t.length){const s=n.sublevel?" ":"",a=s+t.join(`,
8
+ ${s}`);return[...r.length?[`${a} {
9
+ ${i(n.sublevel?2:1)}
10
+ ${s}}`]:[],...o]}else return[...r.length?[i(0)]:[],...o]}function ls(e){return e?Array.isArray(e)?e:[e]:[]}function us(e){return typeof e=="function"&&(e=e()),e}class ds{constructor(){pt(this,"ids",new Map);pt(this,"rules",new Map);pt(this,"propertyNames",new Map)}create(t,n,r){let o=this.rules.get(n);if(o)return o;let i=this.ids.get(r);return typeof i=="number"&&(this.ids.set(r,++i),r+=`_${i}`),o=Vr(t,n,r),this.save(o,n),o}save(t,n){this.ids.set(t.id,0),this.rules.set(n,t)}delete(t){this.ids.delete(t.id),this.rules.delete(t.rules)}}function Vr(e,t,n){return{id:n,name:e,className:`${e}-${n}`,rules:t.replaceAll("$id",`${n}`)}}function fs(e){var i,s;const t=`${e.name}-$id`,n=ls(us(e.props)),r=(i=e.cache)==null?void 0:i.propertyNames,o=n.map(a=>typeof a=="string"?`.${t} {
11
+ ${a}
12
+ }`:$t(a,[`.${t}`],{extraProperties:e.extraProperties,propertyNameCache:r}).join(`
13
+ `)).join(`
14
+ `);return((s=e.cache)==null?void 0:s.create(e.name,o,e.componentId))||Vr(e.name,o,e.componentId)}function jr(e,t){"styleSheet"in e?e.styleSheet.cssText=t:(e.innerText="",e.appendChild(document.createTextNode(t)))}function hs(e,t){for(const n in t){const r=t[n];r!==void 0&&(r===null?e.removeAttribute(n):e.setAttribute(n,r))}}function gs(e,t){const n=document.createElement("style");return n.type="text/css",t&&hs(n,t),jr(n,e),n}function gn(e){let t=Number(e.getAttribute("data-uses"));t++,e.setAttribute("data-uses",t.toString())}const Hn="suid-injectFirst";function ms(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],i=r&&document.getElementById(r);if(i&&i instanceof HTMLStyleElement)return jr(i,e),gn(i),i;{i&&i.remove();const s=gs(e,t);if(gn(s),n){let a=o.querySelector(`#${Hn}`);a||(a=document.createElement("style"),a.setAttribute("id",Hn),o.prepend(a)),o.insertBefore(s,a)}else o.appendChild(s);return s}}function ps(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 Jn(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 cu(e){if(typeof e!="string")throw new Error("MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}function lu(e,t=166){let n;function r(...o){const i=()=>{e.apply(null,o)};clearTimeout(n),n=setTimeout(i,t)}return r.clear=()=>{clearTimeout(n)},r}function uu(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function ys(e){return e&&e.ownerDocument||document}function du(e){return ys(e).defaultView||window}function zr(){return Math.random().toString(36).substring(2,15).slice(0,8)}let jt=!0,mn=!1,qn;const ws={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 bs(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&ws[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Cs(e){e.metaKey||e.altKey||e.ctrlKey||(jt=!0)}function en(){jt=!1}function Ss(){this.visibilityState==="hidden"&&mn&&(jt=!0)}function vs(e){e.addEventListener("keydown",Cs,!0),e.addEventListener("mousedown",en,!0),e.addEventListener("pointerdown",en,!0),e.addEventListener("touchstart",en,!0),e.addEventListener("visibilitychange",Ss,!0)}function xs(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return jt||bs(t)}function fu(){const e=i=>{i!=null&&vs(i.ownerDocument)},[t,n]=k(!1);function r(){return t()?(mn=!0,window.clearTimeout(qn),qn=window.setTimeout(()=>{mn=!1},100),n(!1),!0):!1}function o(i){return xs(i)?(n(!0),!0):!1}return{isFocusVisibleRef:{get current(){return t()}},onFocus:o,onBlur:r,ref:e}}const Os=new ds;function Es(e){return e?Array.isArray(e)?e.flat(1/0).filter(t=>!!t):[e]:[]}function As(){if(!D.context)return zr();const e=Fo().replaceAll("-",""),t=9,n=Math.ceil(e.length/t),r=[];for(let o=1;o<=n;++o){const i=(o-1)*t,s=Number(e.slice(i,i+t));r.push(s.toString(32))}return r.join("-")}function Kr(e){const t=ct(xi),[n,r]=k(""),o=As();let i,s=!1;return de(a=>{var l;const c=e();let u;if(c){const d=as(Es(c));s="@global"in d,u=fs({name:"css",props:d,cache:Os,componentId:o}),i=ps(u.id),i?gn(i):i=ms(u.rules,{id:u.id,nonce:(l=t.cache)==null?void 0:l.nonce},t.injectFirst),a!=null&&a.styleElement&&Jn(a.styleElement)}return typeof(u==null?void 0:u.className)=="string"?r(u.className):r(""),{className:u==null?void 0:u.className,styleElement:i}},void 0),fe(()=>{i&&Jn(i,t.cleanupStyles??s)}),n}function Le(e,t,n={}){for(const r in e){const o=e[r];if(Br(r))n[r]=Le(o,t);else if(hn(r))n[r]=Le(o,t);else if(Wr(r)){n[r]={};for(const i in o)n[r][i]=Le(o[i],t)}else if(Ur(r))n[r]=Le(o,t);else{const i=t(r,o);if(i)for(const s in i)n[s]=hn(s)?{...n[s],...i[s]}:i[s];else n[r]=o}}return n}const Ts=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 Gr(e,t){if(typeof t=="number")return{[e]:Ts.has(e)?t.toString():`${t}px`}}function Yn(e,t={}){return Le(e,Gr,t)}function It(e,t,n){if(typeof n!="string")return n;const r=n.split(".");let o=e[t];for(let i=0;i<r.length&&(o=o==null?void 0:o[r[i]],!!o);i++);return o??n}function ks(e,t){return t.split(".").reduce((n,r)=>n&&n[r]?n[r]:null,e)}function Ms(e,t,n,r){const o=ks(e,t)||n;return typeof o=="number"?i=>typeof i=="string"?i:o*i:Array.isArray(o)?i=>typeof i=="string"?i:o[i]:typeof o=="function"?o:()=>{}}const le={x:["Left","Right"],y:["Top","Bottom"]};function Hr(e){return typeof e=="number"?`${e}px`:e}function Jr(e,t){return(n,r)=>t(e,n,r)}function h(e,t){return t?(n,r)=>({[e]:t(e,n,r)}):n=>({[e]:n})}function tt(e){return h(e,(t,n)=>Hr(n))}function J(e,t,n){const r=t.map(o=>`${e}${o}`);return n?(o,i)=>r.reduce((s,a)=>(s[a]=n(a,o,i),s),{}):o=>r.reduce((i,s)=>(i[s]=o,i),{})}function Ps(){return{...$s(),...Is(),...Ds(),...Ls(),...Ns(),...Rs(),...Fs(),...Us(),..._s()}}function $s(){return{displayPrint:Jr("displayPrint",(e,t)=>({"@media print":{display:t}})),displayRaw:h("display"),overflow:h("overflow"),textOverflow:h("textOverflow"),visibility:h("visibility"),whiteSpace:h("whiteSpace")}}function Is(){return{flexBasis:h("flexBasis"),flexDirection:h("flexDirection"),flexWrap:h("flexWrap"),justifyContent:h("justifyContent"),alignItems:h("alignItems"),alignContent:h("alignContent"),order:h("order"),flex:h("flex"),flexGrow:h("flexGrow"),flexShrink:h("flexShrink"),alignSelf:h("alignSelf"),justifyItems:h("justifyItems"),justifySelf:h("justifySelf")}}function Ds(){const e=(t,n,r)=>Ms(r,"spacing",8)(n);return{gap:h("gap",e),columnGap:h("columnGap",e),rowGap:h("rowGap",e),gridColumn:h("gridColumn"),gridRow:h("gridRow"),gridAutoFlow:h("gridAutoFlow"),gridAutoColumns:h("gridAutoColumns"),gridAutoRows:h("gridAutoRows"),gridTemplateColumns:h("gridTemplateColumns"),gridTemplateRows:h("gridTemplateRows"),gridTemplateAreas:h("gridTemplateAreas"),gridArea:h("gridArea")}}function Ls(){return{position:h("position"),zIndex:h("zIndex",(e,t,n)=>{var r;return((r=n.zIndex)==null?void 0:r[e])??t}),top:tt("top"),right:tt("right"),bottom:tt("bottom"),left:tt("left")}}function Ns(){const e=(t,n,r)=>It(r,"palette",n);return{color:h("color",e),bgcolor:h("backgroundColor",e),backgroundColor:h("backgroundColor",e)}}function Rs(){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:h("width",e),maxWidth:h("maxWidth",e),minWidth:h("minWidth",e),height:h("height",e),maxHeight:h("maxHeight",e),minHeight:h("minHeight",e),boxSizing:h("boxSizing",e)}}function Fs(){const e=(n,r)=>typeof r=="number"?`${r}px solid`:r,t=(n,r,o)=>It(o,"palette",r);return{border:h("border",e),borderTop:h("borderTop",e),borderRight:h("borderRight",e),borderBottom:h("borderBottom",e),borderLeft:h("borderLeft",e),borderColor:h("borderColor",t),borderTopColor:h("borderTopColor",t),borderRightColor:h("borderRightColor",t),borderBottomColor:h("borderBottomColor",t),borderLeftColor:h("borderLeftColor",t),borderRadius:h("borderRadius",(n,r,o)=>typeof r=="number"?`${o.shape.borderRadius*r}px`:r)}}function _s(){const e=(t,n,r)=>It(r,"typography",n);return{typography:Jr("typography",(t,n,r)=>It(r,"typography",n)),fontFamily:h("fontFamily",e),fontSize:h("fontSize",(t,n,r)=>Hr(e(t,n,r))),fontStyle:h("fontStyle",e),fontWeight:h("fontWeight",e),letterSpacing:tt("letterSpacing"),lineHeight:h("lineHeight"),textAlign:h("textAlign"),textTransform:h("textTransform")}}function Us(){const e=(r,o,i)=>i.spacing(o),t="margin",n="padding";return{m:h(t,e),mt:h("marginTop",e),mr:h("marginRight",e),mb:h("marginBottom",e),ml:h("marginLeft",e),mx:J(t,le.x,e),my:J(t,le.y,e),margin:h(t,e),marginTop:h("marginTop",e),marginRight:h("marginRight",e),marginBottom:h("marginBottom",e),marginLeft:h("marginLeft",e),marginX:J(t,le.x,e),marginY:J(t,le.y,e),marginInline:J(t,["Inline","InlineStart"],e),marginInlineStart:h("marginInlineStart",e),marginInlineEnd:h("marginInlineEnd",e),marginBlock:J(t,["BlockStart","BlockEnd"],e),marginBlockStart:h("marginBlockStart",e),marginBlockEnd:h("marginBlockEnd",e),p:h(n,e),pt:h("paddingTop",e),pr:h("paddingRight",e),pb:h("paddingBottom",e),pl:h("paddingLeft",e),px:J(n,le.x,e),py:J(n,le.y,e),padding:h(n,e),paddingTop:h("paddingTop",e),paddingRight:h("paddingRight",e),paddingBottom:h("paddingBottom",e),paddingLeft:h("paddingLeft",e),paddingX:J(n,le.x,e),paddingY:J(n,le.y,e),paddingInline:J(n,["Inline","InlineStart"],e),paddingInlineStart:h("paddingInlineStart",e),paddingInlineEnd:h("paddingInlineEnd",e),paddingBlock:J(n,["BlockStart","BlockEnd"],e),paddingBlockStart:h("paddingBlockStart",e),paddingBlockEnd:h("paddingBlockEnd",e)}}const $n=Ps(),hu=Object.keys($n);function Bs(e,t,n){return $n[e](t,n)}function Xn(e,t,n){return e in $n?Bs(e,t,n):Gr(e,t)}function Ws(e,t){return Le(e,(n,r)=>{if(typeof r=="function"&&(r=r(t)),r==null)return r;if(typeof r=="object"){const o={};for(const i of t.breakpoints.keys)o[t.breakpoints.up(i)]={};return Object.assign(o,Si({theme:t},r,i=>Xn(n,i,t)??{[n]:i}))}else return Xn(n,r,t)})}function qr(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=qr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Vs(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=qr(e))&&(r&&(r+=" "),r+=t);return r}const Yr=["ownerState","theme","sx","as"];function js(e,t){var n,r;return(r=(n=t.components)==null?void 0:n[e])==null?void 0:r.styleOverrides}function zs(e,t,n,r,o={}){return L(()=>{const i=e(),s=js(o.name,i),a=r.ownerState,c=n.reduce((l,d)=>{let f;return typeof d=="function"?f=d({ownerState:a,theme:i,get sx(){return r.sx},get as(){return r.as},props:r}):d&&(f=d),f&&l.push(Yn(f,{name:t,__resolved:!0})),l},[]);let u=[];return o.overridesResolver&&typeof o.overridesResolver=="function"&&s&&(u=o.overridesResolver(r,s).map(l=>l?Yn(l,{}):null).filter(Boolean)),c.concat(u)})}function Xr(e,t){e.__suid=t}function Zn(e){if(typeof e=="function")return e.__suid}function Ks(e){return function(n,r={}){let o,i;if(r.name){const a=r.slot||"Root";i=o=`${r.name}-${a.slice(0,1).toLowerCase()+a.slice(1)}`}else i=`styled-${zr()}`,o="css";const s=Zn(n);return function(...a){function c(u){let l;const d=()=>{const N=u.theme;return N||l||(l=e&&e.onUseTheme?e.onUseTheme():Pn())},[,f]=Ut(u,r.skipProps||Yr),m=zs(d,o,a,u,r),w=()=>{const N=u.sx;return N?Array.isArray(N)?N:[N]:[]},g=()=>{if(s)return n;const N=u.as;return N||n},b=s?()=>s:L(()=>Zn(g())),A=r.skipSx?()=>m():()=>{const N=d();return[...m(),...w().map(X=>X.__resolved?X:Ws(X,N))]},I=Kr(()=>b()?void 0:A());return Fr(g,yr(f,{get children(){return u.children},get component(){return b()?u.component:null},get as(){return s?u.as:void 0},get sx(){return b()?A():void 0},get ownerState(){return b()==="system"?u.ownerState:void 0},get class(){return Vs([...new Set([u.class,i,I()])])}}))}return Xr(c,"system"),i&&(c.toString=()=>`.${i}`),c}}}const gu=[...Yr,"classes"],mu=Ks({onUseTheme:()=>Rr()}),Gs="modulepreload",Hs=function(e){return"/"+e},Qn={},Js=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));o=Promise.allSettled(n.map(c=>{if(c=Hs(c),c in Qn)return;Qn[c]=!0;const u=c.endsWith(".css"),l=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${l}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":Gs,u||(d.as="script"),d.crossOrigin="",d.href=c,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return o.then(s=>{for(const a of s||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},Zr="codenomad-use-tauri-native-event-transport";function Qr(){var e;if(typeof window>"u")return!0;try{return((e=window.localStorage)==null?void 0:e.getItem(Zr))!=="0"}catch{return!0}}function qs(e){var t;if(!(typeof window>"u"))try{(t=window.localStorage)==null||t.setItem(Zr,e?"1":"0")}catch{}}const Ys="codenomad.client-id",Xs="codenomad.connection-id";let wt=null,bt=null;function pn(){return{clientId:Zs(),connectionId:Qs()}}function Zs(){return wt||(wt=eo(Ys,window.localStorage),wt)}function Qs(){return bt||(bt=eo(Xs,window.sessionStorage),bt)}function eo(e,t){if(typeof window>"u")return tn();try{const r=t.getItem(e);if(r&&r.trim())return r.trim()}catch{return tn()}const n=tn();try{t.setItem(e,n)}catch{}return n}function tn(){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 yn={exports:{}},nn,er;function ea(){if(er)return nn;er=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,i=r*365.25;nn=function(l,d){d=d||{};var f=typeof l;if(f==="string"&&l.length>0)return s(l);if(f==="number"&&isFinite(l))return d.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function s(l){if(l=String(l),!(l.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(d){var f=parseFloat(d[1]),m=(d[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return f*i;case"weeks":case"week":case"w":return f*o;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(l){var d=Math.abs(l);return d>=r?Math.round(l/r)+"d":d>=n?Math.round(l/n)+"h":d>=t?Math.round(l/t)+"m":d>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var d=Math.abs(l);return d>=r?u(l,d,r,"day"):d>=n?u(l,d,n,"hour"):d>=t?u(l,d,t,"minute"):d>=e?u(l,d,e,"second"):l+" ms"}function u(l,d,f,m){var w=d>=f*1.5;return Math.round(l/f)+" "+m+(w?"s":"")}return nn}function ta(e){n.debug=n,n.default=n,n.coerce=c,n.disable=s,n.enable=o,n.enabled=a,n.humanize=ea(),n.destroy=u,Object.keys(e).forEach(l=>{n[l]=e[l]}),n.names=[],n.skips=[],n.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(l){let d,f=null,m,w;function g(...b){if(!g.enabled)return;const A=g,I=Number(new Date),N=I-(d||I);A.diff=N,A.prev=d,A.curr=I,d=I,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let X=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(V,p)=>{if(V==="%%")return"%";X++;const C=n.formatters[p];if(typeof C=="function"){const E=b[X];V=C.call(A,E),b.splice(X,1),X--}return V}),n.formatArgs.call(A,b),(A.log||n.log).apply(A,b)}return g.namespace=l,g.useColors=n.useColors(),g.color=n.selectColor(l),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==n.namespaces&&(m=n.namespaces,w=n.enabled(l)),w),set:b=>{f=b}}),typeof n.init=="function"&&n.init(g),g}function r(l,d){const f=n(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function o(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const d=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const f of d)f[0]==="-"?n.skips.push(f.slice(1)):n.names.push(f)}function i(l,d){let f=0,m=0,w=-1,g=0;for(;f<l.length;)if(m<d.length&&(d[m]===l[f]||d[m]==="*"))d[m]==="*"?(w=m,g=f,m++):(f++,m++);else if(w!==-1)m=w+1,g++,f=g;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function s(){const l=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),l}function a(l){for(const d of n.skips)if(i(l,d))return!1;for(const d of n.names)if(i(l,d))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var na=ta;(function(e,t){var n={};t.formatArgs=o,t.save=i,t.load=s,t.useColors=r,t.storage=a(),t.destroy=(()=>{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let u;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(u=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(u[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;u.splice(1,0,l,"color: inherit");let d=0,f=0;u[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(f=d))}),u.splice(f,0,l)}t.log=console.debug||console.log||(()=>{});function i(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function s(){let u;try{u=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=n.DEBUG),u}function a(){try{return localStorage}catch{}}e.exports=na(t);const{formatters:c}=e.exports;c.j=function(u){try{return JSON.stringify(u)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(yn,yn.exports);var ra=yn.exports;const wn=Bo(ra),Ge=["sse","api","session","actions","foreground-refresh"],to="opencode:logger:namespaces",rn=new Map,ne=new Set,oe=typeof globalThis<"u"?globalThis.console:void 0;function ut(){ne.size===0?wn.disable():wn.enable(Array.from(ne).join(","))}function zt(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{window.localStorage.setItem(to,JSON.stringify(Array.from(ne)))}catch(t){(e=oe==null?void 0:oe.warn)==null||e.call(oe,"Failed to persist logger namespaces",t)}}function oa(){var e;if(!(typeof window>"u"||!(window!=null&&window.localStorage)))try{const t=window.localStorage.getItem(to);if(!t)return;const n=JSON.parse(t);if(!Array.isArray(n))return;for(const r of n)Ge.includes(r)&&ne.add(r)}catch(t){(e=oe==null?void 0:oe.warn)==null||e.call(oe,"Failed to hydrate logger namespaces",t)}}oa();ut();function ia(e){const n=wn(e),r=(o,i)=>{n(o,...i)};return{log:(...o)=>n(...o),info:(...o)=>n(...o),warn:(...o)=>r("[warn]",o),error:(...o)=>r("[error]",o)}}function ae(e){if(!Ge.includes(e))throw new Error(`Unknown logger namespace: ${e}`);return rn.has(e)||rn.set(e,ia(e)),rn.get(e)}function sa(){return Ge.map(e=>({name:e,enabled:ne.has(e)}))}function aa(e){if(!Ge.includes(e))throw new Error(`Unknown logger namespace: ${e}`);ne.has(e)||(ne.add(e),zt(),ut())}function ca(e){if(!Ge.includes(e))throw new Error(`Unknown logger namespace: ${e}`);ne.has(e)&&(ne.delete(e),zt(),ut())}function la(){ne.clear(),zt(),ut()}function ua(){Ge.forEach(e=>ne.add(e)),zt(),ut()}const da={listLoggerNamespaces:sa,enableLogger:aa,disableLogger:ca,enableAllLoggers:ua,disableAllLoggers:la};function fa(){typeof window>"u"||(window.codenomadLogger=da)}fa();function ha(e,t){let n=!1;e.onmessage=o=>{try{const i=JSON.parse(o.data);t.onEvent(i)}catch(i){t.logger.error("Failed to parse event",i)}};const r=o=>{var i;n||(n=!0,t.logger.warn(o),(i=t.onError)==null||i.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 i;try{const s=o.data?JSON.parse(o.data):{};(i=t.onPing)==null||i.call(t,s)}catch(s){t.logger.error("Failed to parse ping event",s)}})}const on={};var mr;const ga=typeof window<"u"?(mr=window.location)==null?void 0:mr.origin:void 0,ma=typeof window<"u"?window.__CODENOMAD_API_BASE__??ga:void 0,pa=typeof window<"u"?window.__CODENOMAD_EVENTS_URL__??"/api/events":"/api/events",ge=(on==null?void 0:on.VITE_CODENOMAD_API_BASE)??ma,sn=ya(ge,pa),pu=ge;function yu(e,t){const n=encodeURIComponent(e),r=encodeURIComponent(t);return wa(`/workspaces/${n}/plugin/background-processes/${r}/stream`)}function ya(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 wa(e){if(e.startsWith("http://")||e.startsWith("https://")||!ge)return e;const t=e.startsWith("/")?e:`/${e}`;return`${ge}${t}`}const tr=ae("api"),nr=ae("sse");function no(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 Se(e,t){if(t){tr.info(e,t);return}tr.info(e)}async function ro(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=ge?new URL(e,ge).toString():e,r=no(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(),i=Date.now();Se(`${o} ${e}`);try{const s=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!s.ok){const c=await ro(s);throw Se(`${o} ${e} -> ${s.status}`,{durationMs:Date.now()-i,error:c}),new Error(c||`Request failed with ${s.status}`)}const a=Date.now()-i;return Se(`${o} ${e} -> ${s.status}`,{durationMs:a}),s.status===204?void 0:await s.json()}catch(s){throw Se(`${o} ${e} failed`,{durationMs:Date.now()-i,error:s}),s}}async function ba(e,t){const n=ge?new URL(e,ge).toString():e,r=no(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(),i=Date.now();Se(`${o} ${e}`);const s=await fetch(n,{...t,headers:r,credentials:(t==null?void 0:t.credentials)??"include"});if(!s.ok){const a=await ro(s);throw Se(`${o} ${e} -> ${s.status}`,{durationMs:Date.now()-i,error:a}),new Error(a||`Request failed with ${s.status}`)}return Se(`${o} ${e} -> ${s.status}`,{durationMs:Date.now()-i}),s}const re={fetchWorkspaces(){return y("/api/workspaces")},fetchProviderUsage(e,t){const n=new URLSearchParams;t&&n.set("modelId",t);const r=n.toString();return y(`/api/usage/${encodeURIComponent(e)}${r?`?${r}`:""}`)},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,t){return y("/api/workspaces",{method:"POST",body:JSON.stringify(e),signal:t==null?void 0:t.signal})},cancelWorkspaceCreation(e){return y("/api/workspaces/creation/cancel",{method:"POST",body:JSON.stringify({requestId:e})})},releaseWorkspaceCreation(e,t){return y(`/api/workspaces/${encodeURIComponent(e)}/creation/release`,{method:"POST",body:JSON.stringify({requestId:t})})},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"})},createPreview(e){return y("/api/previews",{method:"POST",body:JSON.stringify(e)})},deletePreview(e){return y(`/api/previews/${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")},listConfigFiles(){return y("/api/config-files")},readConfigFile(e){return y(`/api/config-files/${encodeURIComponent(e)}/content`)},writeConfigFile(e,t){const n={contents:t};return y(`/api/config-files/${encodeURIComponent(e)}/content`,{method:"PUT",body:JSON.stringify(n)})},setServerPassword(e){return y("/api/auth/password",{method:"POST",body:JSON.stringify({password:e})})},deleteWorkspace(e){return y(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})},cloneWorkspaceRepository(e){return y("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})},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,n){const r=new URLSearchParams({path:t});return n!=null&&n.encoding&&r.set("encoding",n.encoding),y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${r.toString()}`)},writeWorkspaceFile(e,t,n,r){const o=new URLSearchParams({path:t});return r!=null&&r.worktree&&r.worktree!=="root"&&o.set("worktree",r.worktree),y(`/api/workspaces/${encodeURIComponent(e)}/files/content?${o.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})})},fetchOpenCodeUpdateStatus(){return y("/api/opencode/update")},updateOpenCode(){return y("/api/opencode/update",{method:"POST"})},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 ba("/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})})},readFileSystemFile(e,t){const n=new URLSearchParams({path:e});return t!=null&&t.encoding&&n.set("encoding",t.encoding),y(`/api/filesystem/files/content?${n.toString()}`)},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=pn();return y(`/workspaces/${encodeURIComponent(e)}/plugin/voice-mode`,{method:"POST",body:JSON.stringify({...n,enabled:t})})},getYoloState(e,t){return y(`/workspaces/${encodeURIComponent(e)}/yolo/sessions/${encodeURIComponent(t)}`)},toggleYolo(e,t){return y(`/workspaces/${encodeURIComponent(e)}/yolo/sessions/${encodeURIComponent(t)}/toggle`,{method:"POST"})},setSessionWorktreeSlug(e,t,n){return y(`/api/workspaces/${encodeURIComponent(e)}/worktrees/sessions/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({worktreeSlug:n})})},sendClientConnectionPong(e,t){const n={method:"POST",body:JSON.stringify(e)};return t&&(n.signal=t),y("/api/client-connections/pong",n)},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(),i=o?`?${o}`:"";return y(`/workspaces/${encodeURIComponent(e)}/plugin/background-processes/${encodeURIComponent(t)}/output${i}`)},connectEvents(e,t,n){const r=pn(),o=Ca(r);nr.info(`Connecting to ${o}`);const i=new EventSource(o,{withCredentials:!0});return ha(i,{onEvent:e,onError:t,onPing:n,logger:nr}),i}};function Ca(e){const t=new URL(sn,typeof window<"u"?window.location.origin:"http://localhost");return t.searchParams.set("clientId",e.clientId),t.searchParams.set("connectionId",e.connectionId),sn.startsWith("http://")||sn.startsWith("https://")?t.toString():`${t.pathname}${t.search}`}const Sa={initialDelayMs:1e3,maxDelayMs:1e4,multiplier:2};function va(e){return{reconnect:{...Sa,...e==null?void 0:e.reconnect}}}function oo(){if(typeof window>"u"||window.__CODENOMAD_WINDOW_CONTEXT__==="remote")return"remote";if(window.__CODENOMAD_WINDOW_CONTEXT__==="local")return"local";const e=window;return typeof e.electronAPI<"u"||typeof e.__TAURI__<"u"||typeof navigator<"u"&&/tauri/i.test(navigator.userAgent)?"local":"remote"}function Kt(){if(typeof window>"u")return"web";const e=window.__CODENOMAD_RUNTIME_HOST__;if(e)return e;const t=window;return typeof t.electronAPI<"u"?"electron":typeof t.__TAURI__<"u"||typeof navigator<"u"&&/tauri/i.test(navigator.userAgent)?"tauri":"web"}function xa(){if(typeof navigator>"u")return"desktop";const e=navigator.userAgentData;if(e!=null&&e.mobile)return"mobile";const t=navigator.userAgent.toLowerCase();return/android|iphone|ipad|ipod|blackberry|mini|windows phone|mobile|silk/.test(t)?"mobile":"desktop"}const Oa=ae("actions");let we=null;function io(){return we||(we={host:Kt(),platform:xa(),windowContext:oo()},typeof window<"u"&&Oa.info(`[runtime] host=${we.host} platform=${we.platform} context=${we.windowContext}`),we)}const Me=io(),Ea=()=>Kt()==="electron",Aa=()=>Kt()==="tauri",wu=()=>Kt()==="web",bu=(e=io())=>e.host==="tauri"&&e.windowContext==="local",Gt=()=>Ea()||Aa(),Ht=()=>oo()==="local",Cu=()=>Gt()&&Ht(),Su=()=>Gt()&&Ht(),vu=()=>Gt()&&Ht(),xu=()=>Gt()&&Ht();function R(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function Je(e,t,n,r,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var be,q,Pe,Ct;const rr="__TAURI_TO_IPC_KEY__";function so(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class Ta{constructor(t){be.set(this,void 0),q.set(this,0),Pe.set(this,[]),Ct.set(this,void 0),Je(this,be,t||(()=>{})),this.id=so(n=>{const r=n.index;if("end"in n){r==R(this,q,"f")?this.cleanupCallback():Je(this,Ct,r);return}const o=n.message;if(r==R(this,q,"f")){for(R(this,be,"f").call(this,o),Je(this,q,R(this,q,"f")+1);R(this,q,"f")in R(this,Pe,"f");){const i=R(this,Pe,"f")[R(this,q,"f")];R(this,be,"f").call(this,i),delete R(this,Pe,"f")[R(this,q,"f")],Je(this,q,R(this,q,"f")+1)}R(this,q,"f")===R(this,Ct,"f")&&this.cleanupCallback()}else R(this,Pe,"f")[r]=o})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){Je(this,be,t)}get onmessage(){return R(this,be,"f")}[(be=new WeakMap,q=new WeakMap,Pe=new WeakMap,Ct=new WeakMap,rr)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[rr]()}}class or{constructor(t,n,r){this.plugin=t,this.event=n,this.channelId=r}async unregister(){return Ve(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function Ou(e,t,n){const r=new Ta(n);try{return await Ve(`plugin:${e}|register_listener`,{event:t,handler:r}),new or(e,t,r.id)}catch{return await Ve(`plugin:${e}|registerListener`,{event:t,handler:r}),new or(e,t,r.id)}}async function Ve(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}var ir;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(ir||(ir={}));async function ka(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await Ve("plugin:event|unlisten",{event:e,eventId:t})}async function Ma(e,t,n){var r;const o=typeof(n==null?void 0:n.target)=="string"?{kind:"AnyLabel",label:n.target}:(r=n==null?void 0:n.target)!==null&&r!==void 0?r:{kind:"Any"};return Ve("plugin:event|listen",{event:e,target:o,handler:so(t)}).then(i=>async()=>ka(e,i))}const St=ae("sse"),Pa={invoke:Ve,listen:Ma};function $a(e){let t=!1;return()=>{var n;t||(t=!0,(n=e.onError)==null||n.call(e))}}function Ia(e){return e==="connected"?"connected":e==="connecting"?"connecting":"disconnected"}async function Da(e,t,n=Pa){let r=!1,o=!1,i=null;const s=$a(e),a=[],c=[],u=g=>i===g,l=g=>{var A,I;if(!g||!u(g.generation))return;o||(o=!0,(A=e.onStatus)==null||A.call(e,"connected"),(I=e.onOpen)==null||I.call(e));const b=g.events??[];b.length!==0&&e.onBatch(b)},d=g=>{var b,A;if(!(!g||!u(g.generation))){if((b=e.onStatus)==null||b.call(e,Ia(g.state)),g.state==="connected"&&!o&&(o=!0,(A=e.onOpen)==null||A.call(e)),g.state==="unauthorized"?St.warn("Native desktop event transport is waiting for authentication",{reason:g.reason,reconnectAttempt:g.reconnectAttempt,nextDelayMs:g.nextDelayMs,stats:g.stats}):g.state==="error"?St.warn("Native desktop event transport reported an error",{reason:g.reason,reconnectAttempt:g.reconnectAttempt,nextDelayMs:g.nextDelayMs,statusCode:g.statusCode,stats:g.stats}):(g.state==="disconnected"||g.state==="stopped")&&g.stats&&St.info("Native desktop event transport stats",{state:g.state,reconnectAttempt:g.reconnectAttempt,stats:g.stats}),g.state==="stopped"){s();return}g.terminal&&s()}},f=()=>{if(i!==null){for(const g of c.splice(0,c.length))d(g);for(const g of a.splice(0,a.length))l(g)}},m=await n.listen("desktop:event-batch",g=>{if(r)return;const b=g.payload;if(b){if(i===null){a.push(b);return}l(b)}}),w=await n.listen("desktop:event-stream-status",g=>{if(r)return;const b=g.payload;if(b){if(i===null){c.push(b);return}d(b)}});try{const g=await n.invoke("desktop_events_start",{request:t});if(!(g!=null&&g.started))throw new Error((g==null?void 0:g.reason)??"desktop event transport unavailable");i=g.generation??null,f()}catch(g){throw m(),w(),g}return{disconnect(){r||(r=!0,m(),w(),n.invoke("desktop_events_stop").catch(g=>{St.warn("Failed to stop native desktop event transport",g)}))}}}const qe=ae("sse");async function La(e){const t=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"disconnected"),(o=e.onError)==null||o.call(e)},n=re.connectEvents(r=>{e.onBatch([r])},t,e.onPing);return n.onopen=()=>{var r,o;(r=e.onStatus)==null||r.call(e,"connected"),(o=e.onOpen)==null||o.call(e)},{disconnect(){n.close()}}}async function Na(e,t){const n=Qr();if(Me.host==="tauri"&&Me.windowContext==="local"&&n)try{const r=await Da(e,va(t));return qe.info("Event transport: rust-native (desktop_event_transport)"),r}catch(r){qe.warn("Failed to start native desktop event transport, falling back to browser EventSource",r)}else Me.host==="tauri"&&Me.windowContext==="remote"?qe.info("Event transport: browser-eventsource forced for remote Tauri window"):Me.host==="tauri"&&qe.info("Event transport: browser-eventsource forced by settings");return qe.info(`Event transport: browser-eventsource (host=${Me.host})`),La(e)}async function Ra(e,t={}){const{maxAttempts:n=3,initialDelayMs:r=100,maxDelayMs:o=5e3,backoffMultiplier:i=2,timeoutMs:s,shouldRetry:a=()=>!0,wait:c=d=>new Promise(f=>setTimeout(f,d))}=t;let u=null,l=r;for(let d=1;d<=n;d++)try{if(s){const f=new AbortController,m=setTimeout(()=>f.abort(),s);try{const w=await e(f.signal);return clearTimeout(m),w}catch(w){throw clearTimeout(m),w}}return await e()}catch(f){const m=f instanceof Error?f:new Error(String(f));if(u=m,d<n&&a(m,d))await c(l),l=Math.min(l*i,o);else throw m}throw u||new Error("Failed after retries")}function Fa(e){return!!(e.name==="AbortError"||e.name==="TimeoutError"||e.message.includes("Failed to fetch")||e.message.includes("NetworkError")||e.message.includes("timeout"))}const an=1e3,_a=1e4,bn=ae("sse");function $e(e,t){if(t){bn.info(e,t);return}bn.info(e)}class Ua{constructor(){this.handlers=new Map,this.openHandlers=new Set,this.statusHandlers=new Set,this.connection=null,this.connectGeneration=0,this.retryDelay=an,this.retryTimer=null,this.connect()}async connect(){const t=++this.connectGeneration;this.clearReconnectTimer(),this.connection&&(this.emitTransportStatus("disconnected"),this.connection.disconnect(),this.connection=null),$e("Connecting to backend events stream");try{const n=await Na({onBatch:r=>{t===this.connectGeneration&&this.dispatchBatch(r)},onError:()=>{t===this.connectGeneration&&this.scheduleReconnect()},onStatus:r=>{t===this.connectGeneration&&this.emitTransportStatus(r)},onOpen:()=>{t===this.connectGeneration&&($e("Events stream connected"),this.retryDelay=an,this.openHandlers.forEach(r=>r()))},onPing:r=>{if(t!==this.connectGeneration)return;const i={...pn(),pingTs:r.ts};Ra(s=>re.sendClientConnectionPong(i,s),{maxAttempts:3,initialDelayMs:100,maxDelayMs:2e3,timeoutMs:1e4,shouldRetry:s=>Fa(s)}).catch(s=>{bn.warn("Failed to send client connection pong after retries",s)})}});if(t!==this.connectGeneration){n.disconnect();return}this.connection=n}catch(n){if(t!==this.connectGeneration)return;$e("Events stream failed to connect, scheduling reconnect",{error:n instanceof Error?n.message:String(n)}),this.scheduleReconnect()}}scheduleReconnect(){this.retryTimer||(this.connectGeneration+=1,this.connection&&(this.connection.disconnect(),this.connection=null),this.emitTransportStatus("disconnected"),$e("Events stream disconnected, scheduling reconnect",{delayMs:this.retryDelay}),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.retryDelay=Math.min(this.retryDelay*2,_a),this.connect()},this.retryDelay))}clearReconnectTimer(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}dispatch(t){var n,r;(n=this.handlers.get("*"))==null||n.forEach(o=>o(t)),(r=this.handlers.get(t.type))==null||r.forEach(o=>o(t))}dispatchBatch(t){t.length!==0&&($e("event batch",{size:t.length}),ve(()=>{for(const n of t)this.dispatch(n)}))}emitTransportStatus(t){this.statusHandlers.forEach(n=>n(t))}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set);const r=this.handlers.get(t);return r.add(n),()=>r.delete(n)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}onTransportStatus(t){return this.statusHandlers.add(t),()=>this.statusHandlers.delete(t)}restart(t="manual restart"){this.retryDelay=an,this.clearReconnectTimer(),this.connection&&(this.emitTransportStatus("disconnected"),this.connection.disconnect(),this.connection=null),$e("Restarting backend events stream",{reason:t}),this.connect()}}const At=new Ua,Ba=Object.freeze(Object.defineProperty({__proto__:null,serverEvents:At},Symbol.toStringTag,{value:"Module"})),Wa=ae("actions"),sr={messageHistory:[],agentModelSelections:{}};function ar(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){Wa.warn("Failed to compare config objects",n)}return!1}class Va{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,At.on("storage.configChanged",t=>{t.type==="storage.configChanged"&&this.setOwnerCache("config",t.owner,t.value)}),At.on("storage.stateChanged",t=>{t.type==="storage.stateChanged"&&this.setOwnerCache("state",t.owner,t.value)}),At.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=re.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 re.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=re.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 re.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=re.readInstanceData(t).then(o=>{const i=this.normalizeInstanceData(o);return this.setInstanceDataCache(t,i),i}).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 re.writeInstanceData(t,r),this.setInstanceDataCache(t,r)}async deleteInstanceData(t){await re.deleteInstanceData(t),this.setInstanceDataCache(t,sr)}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,i=t==="config"?this.configOwnerListeners:this.stateOwnerListeners,s=o.get(n);if(s&&ar(s,r)){o.set(n,r);return}o.set(n,r);const a=i.get(n);if(a)for(const c of a)c(r)}normalizeInstanceData(t){const n=t??sr,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&&ar(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 ee=new Va,ao=ae("api"),Jt={messageHistory:[],agentModelSelections:{}},[In,co]=k(new Map),vt=new Map,je=new Map;function lo(e){const t=e??Jt;return{...t,messageHistory:Array.isArray(t.messageHistory)?[...t.messageHistory]:[],agentModelSelections:{...t.agentModelSelections??{}}}}function cr(e){if(je.has(e))return;const t=ee.onInstanceDataChanged(e,n=>{Dt(e,n)});je.set(e,t)}function ja(e){const t=je.get(e);t&&(t(),je.delete(e))}function Dt(e,t){co(n=>{const r=new Map(n);return r.set(e,lo(t)),r})}async function qt(e){if(!e||In().has(e))return;if(vt.has(e)){await vt.get(e);return}const t=ee.loadInstanceData(e).then(n=>{Dt(e,n),cr(e)}).catch(n=>{ao.warn("Failed to load instance data",n),Dt(e,Jt),cr(e)}).finally(()=>{vt.delete(e)});vt.set(e,t),await t}async function uo(e,t){if(!e)return;await qt(e);const n=In().get(e)??Jt,r=lo(n);t(r);try{await ee.saveInstanceData(e,r)}catch(o){ao.warn("Failed to persist instance data",o)}Dt(e,r)}function fo(e){return In().get(e)??Jt}function za(e){co(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),ja(e)}const Ka=Ke(),Ga={getInstanceConfig:fo,ensureInstanceConfig:qt,updateInstanceConfig:uo,clearInstanceConfig:za},Eu=e=>(fe(()=>{for(const t of je.values())t();je.clear()}),he(Ka.Provider,{value:Ga,get children(){return e.children}})),Ha=ae("api");function Ja(e){const t=e;return t.sttConfigured===void 0&&(t.sttConfigured=t.configured),t.ttsConfigured===void 0&&(t.ttsConfigured=t.configured),t.separateProviders===void 0&&(t.separateProviders=!1),t}const[lr,Cn]=k(null),[Au,ur]=k(!1),[Tu,Tt]=k(null),[ku,ho]=k(!1);let Ye=null;async function qa(e=!1){return!e&&lr()?lr():Ye||(ur(!0),Tt(null),Ye=re.fetchSpeechCapabilities().then(t=>{ho("separateProviders"in t);const r=Ja(t);return Cn(r),Tt(null),r}).catch(t=>(Ha.error("Failed to load speech capabilities",t),Cn(null),Tt(t instanceof Error?t.message:String(t)),null)).finally(()=>{ur(!1),Ye=null}),Ye)}function Ya(){Cn(null),Tt(null),ho(!1)}function Xa(e){var n,r,o,i,s,a;const t={};e.separateProviders!==void 0&&(t.separateProviders=e.separateProviders),e.apiKey!==void 0&&(t.apiKey=e.apiKey),e.baseUrl!==void 0&&(t.baseUrl=((n=e.baseUrl)==null?void 0:n.trim())||null),e.sttModel!==void 0&&(t.sttModel=((r=e.sttModel)==null?void 0:r.trim())||null),e.ttsModel!==void 0&&(t.ttsModel=((o=e.ttsModel)==null?void 0:o.trim())||null),e.ttsVoice!==void 0&&(t.ttsVoice=((i=e.ttsVoice)==null?void 0:i.trim())||null),e.playbackMode!==void 0&&(t.playbackMode=e.playbackMode),e.ttsFormat!==void 0&&(t.ttsFormat=e.ttsFormat);for(const c of["stt","tts"]){const u=e[c];if(u){const l={};u.apiKey!==void 0&&(l.apiKey=u.apiKey),u.baseUrl!==void 0&&(l.baseUrl=((s=u.baseUrl)==null?void 0:s.trim())||null),u.model!==void 0&&(l.model=((a=u.model)==null?void 0:a.trim())||null),Object.keys(l).length>0&&(t[c]=l)}}return t}function Yt(e){if(!e||typeof e!="object"||Array.isArray(e))return{hiddenModelIds:[]};const t=e.hiddenModelIds;return Array.isArray(t)?{hiddenModelIds:Array.from(new Set(t.filter(n=>typeof n=="string"&&n.length>0)))}:{hiddenModelIds:[]}}function Za(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))n&&(t[n]=Yt(r));return t}function Mu(e,t){return!Yt(e).hiddenModelIds.includes(t)}function Pu(e,t){return e&&t.some(n=>n.key===e.key)?e:void 0}const v=ae("actions"),Qa=20,ec=5,tc=50,nc={preset:"balanced"},P={showThinkingBlocks:!1,showKeyboardShortcutHints:!0,thinkingBlocksExpansion:"collapsed",showMessageTimeline:!0,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};function Sn(e,t){return e==="expanded"||e==="collapsed"?e:t}function rc(e,t){return e==="hidden"||e==="expanded"||e==="collapsed"?e:t}function oc(e){return e==="minimal"||e==="balanced"||e==="detailed"||e==="everything"||e==="custom"?e:nc.preset}function ic(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e))n&&(r==="hidden"||r==="expanded"||r==="collapsed")&&(t[n]=r);return t}function sc(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,r=Sn(t.thinkingBlocksExpansion,"collapsed");return{preset:oc(n==null?void 0:n.preset),thinking:Sn(n==null?void 0:n.thinking,r),tools:ic(n==null?void 0:n.tools)}}const Ie={provider:"openai-compatible",sttModel:"gpt-4o-mini-transcribe",ttsModel:"gpt-4o-mini-tts",ttsVoice:"alloy",playbackMode:"streaming",ttsFormat:"mp3"};function go(e){const t=e??{},n=sc(t.toolCallExpansionDefaults,t),r=n.preset==="minimal"||n.preset==="balanced"?"collapsed":"expanded";return{showThinkingBlocks:t.showThinkingBlocks??P.showThinkingBlocks,showKeyboardShortcutHints:t.showKeyboardShortcutHints??P.showKeyboardShortcutHints,thinkingBlocksExpansion:t.thinkingBlocksExpansion??P.thinkingBlocksExpansion,showMessageTimeline:t.showMessageTimeline??P.showMessageTimeline,showTimelineTools:t.showTimelineTools??P.showTimelineTools,holdLongAssistantReplies:t.holdLongAssistantReplies??P.holdLongAssistantReplies,promptSubmitOnEnter:t.promptSubmitOnEnter??P.promptSubmitOnEnter,showPromptVoiceInput:t.showPromptVoiceInput??P.showPromptVoiceInput,locale:t.locale??P.locale,diffViewMode:t.diffViewMode??P.diffViewMode,toolCallExpansionDefaults:n,toolOutputExpansion:t.toolOutputExpansion??P.toolOutputExpansion,diagnosticsExpansion:rc(t.diagnosticsExpansion,P.diagnosticsExpansion),toolInputsVisibility:t.toolInputsVisibility==="hidden"||t.toolInputsVisibility==="collapsed"||t.toolInputsVisibility==="expanded"?t.toolInputsVisibility:P.toolInputsVisibility,showUsageMetrics:t.showUsageMetrics??P.showUsageMetrics,usageMetricsExpansion:Sn(t.usageMetricsExpansion,r),autoCleanupBlankSessions:t.autoCleanupBlankSessions??P.autoCleanupBlankSessions,keepUnseenSubagentIdleStatus:t.keepUnseenSubagentIdleStatus??P.keepUnseenSubagentIdleStatus,modelVisibility:Za(t.modelVisibility),osNotificationsEnabled:t.osNotificationsEnabled??P.osNotificationsEnabled,osNotificationsAllowWhenVisible:t.osNotificationsAllowWhenVisible??P.osNotificationsAllowWhenVisible,notifyOnNeedsInput:t.notifyOnNeedsInput??P.notifyOnNeedsInput,notifyOnIdle:t.notifyOnIdle??P.notifyOnIdle}}function mo(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 ac(e){var o,i,s,a,c,u,l,d,f,m;const t=e??{},n=typeof t.sttModel=="string"&&t.sttModel.trim()?t.sttModel.trim():Ie.sttModel,r=typeof t.ttsModel=="string"&&t.ttsModel.trim()?t.ttsModel.trim():Ie.ttsModel;return{provider:t.provider==="openai-compatible"?t.provider:Ie.provider,apiKey:typeof t.apiKey=="string"&&t.apiKey.trim()?t.apiKey.trim():void 0,hasApiKey:t.hasApiKey===!0||typeof t.apiKey=="string"&&t.apiKey.trim().length>0,baseUrl:typeof t.baseUrl=="string"&&t.baseUrl.trim()?t.baseUrl.trim():void 0,sttModel:n,ttsModel:r,ttsVoice:typeof t.ttsVoice=="string"&&t.ttsVoice.trim()?t.ttsVoice.trim():Ie.ttsVoice,playbackMode:t.playbackMode==="buffered"||t.playbackMode==="streaming"?t.playbackMode:Ie.playbackMode,ttsFormat:t.ttsFormat==="wav"||t.ttsFormat==="opus"||t.ttsFormat==="aac"||t.ttsFormat==="mp3"?t.ttsFormat:Ie.ttsFormat,separateProviders:t.separateProviders===!0,stt:{apiKey:typeof((o=t.stt)==null?void 0:o.apiKey)=="string"&&t.stt.apiKey.trim()?t.stt.apiKey.trim():void 0,hasApiKey:((i=t.stt)==null?void 0:i.hasApiKey)===!0||typeof((s=t.stt)==null?void 0:s.apiKey)=="string"&&t.stt.apiKey.trim().length>0,baseUrl:typeof((a=t.stt)==null?void 0:a.baseUrl)=="string"&&t.stt.baseUrl.trim()?t.stt.baseUrl.trim():void 0,model:typeof((c=t.stt)==null?void 0:c.model)=="string"&&t.stt.model.trim()?t.stt.model.trim():n},tts:{apiKey:typeof((u=t.tts)==null?void 0:u.apiKey)=="string"&&t.tts.apiKey.trim()?t.tts.apiKey.trim():void 0,hasApiKey:((l=t.tts)==null?void 0:l.hasApiKey)===!0||typeof((d=t.tts)==null?void 0:d.apiKey)=="string"&&t.tts.apiKey.trim().length>0,baseUrl:typeof((f=t.tts)==null?void 0:f.baseUrl)=="string"&&t.tts.baseUrl.trim()?t.tts.baseUrl.trim():void 0,model:typeof((m=t.tts)==null?void 0:m.model)=="string"&&t.tts.model.trim()?t.tts.model.trim():r}}}function Xe(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 cc(e){var n,r,o;const t=e??{};return{recentFolders:Xe(t.recentFolders,i=>{if(!i||typeof i!="object")return null;const s=i.path,a=i.lastAccessed,c=i.projectName;if(typeof s!="string")return null;const u=typeof a=="number"?a:Date.now();return{path:s,lastAccessed:u,...typeof c=="string"&&c.trim()?{projectName:c.trim()}:{}}}),opencodeBinaries:Xe(t.opencodeBinaries,i=>{if(!i||typeof i!="object")return null;const s=i.path;if(typeof s!="string")return null;const a=typeof i.lastUsed=="number"?i.lastUsed:Date.now(),c=typeof i.version=="string"?i.version:void 0,u=typeof i.label=="string"?i.label:void 0;return{path:s,version:c,label:u,lastUsed:a}}),remoteServers:Xe(t.remoteServers,i=>{if(!i||typeof i!="object")return null;const s=typeof i.id=="string"?i.id.trim():"",a=typeof i.name=="string"?i.name.trim():"",c=typeof i.baseUrl=="string"?i.baseUrl.trim():"";if(!s||!a||!c)return null;const u=typeof i.createdAt=="string"?i.createdAt:new Date().toISOString(),l=typeof i.updatedAt=="string"?i.updatedAt:u,d=typeof i.lastConnectedAt=="string"?i.lastConnectedAt:void 0;return{id:s,name:a,baseUrl:c,skipTlsVerify:!!i.skipTlsVerify,createdAt:u,updatedAt:l,lastConnectedAt:d}}).sort((i,s)=>{const a=i.lastConnectedAt??i.updatedAt;return(s.lastConnectedAt??s.updatedAt).localeCompare(a)}),models:{recents:Xe((n=t.models)==null?void 0:n.recents,i=>{if(!i||typeof i!="object")return null;const s=i.providerId,a=i.modelId;return typeof s!="string"||typeof a!="string"?null:{providerId:s,modelId:a}}),favorites:Xe((r=t.models)==null?void 0:r.favorites,i=>{if(!i||typeof i!="object")return null;const s=i.providerId,a=i.modelId;return typeof s!="string"||typeof a!="string"?null:{providerId:s,modelId:a}}),thinkingSelections:mo((o=t.models)==null?void 0:o.thinkingSelections)}}}function lc(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",i=mo(t.environmentVariables),s=uc(t.secureEnvVars),a=ac(t.speech);return{listeningMode:n,logLevel:r,opencodeBinary:o,environmentVariables:i,secureEnvVars:s,speech:a}}function uc(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function po(e){return`${e.providerId}/${e.modelId}`}function yo(e,t,n){const r=new Set([e,n].filter(c=>!!c)),o=n?t.find(c=>c.path===n):void 0,i=t.find(c=>c.path===e),s=(o==null?void 0:o.projectName)??(i==null?void 0:i.projectName),a=t.filter(c=>!r.has(c.path));return a.unshift({path:e,lastAccessed:Date.now(),...s?{projectName:s}:{}}),a.slice(0,Qa)}function Dn(e,t,n){const r=Date.now(),o=n.find(s=>s.path===e);if(o){const s={...o,lastUsed:r,version:t??o.version},a=n.filter(c=>c.path!==e);return[s,...a]}return[t?{path:e,version:t,lastUsed:r}:{path:e,lastUsed:r},...n].slice(0,10)}function dc(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??fc(),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 wo(e,t){const n=t.filter(r=>r.id!==e.id);return[e,...n].sort((r,o)=>{const i=r.lastConnectedAt??r.updatedAt;return(o.lastConnectedAt??o.updatedAt).localeCompare(i)})}function fc(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`remote-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}const[Ln,Lt]=k({}),[hc,Nt]=k({}),[gc,Rt]=k({}),[bo,rt]=k(!1),[Co,mc]=k(Qr()),pc=L(()=>go(Ln().settings)),So=L(()=>Ln().theme??"system"),me=L(()=>lc(hc())),se=L(()=>cc(gc())),_=pc,dt=L(()=>se().recentFolders),ft=L(()=>se().opencodeBinaries),ze=L(()=>se().remoteServers);let xt=null;async function Xt(){bo()||(xt||(xt=Promise.all([ee.loadConfigOwner("ui"),ee.loadConfigOwner("server"),ee.loadStateOwner("ui")]).then(([e,t,n])=>{Lt(e),Nt(t),Rt(n),rt(!0)}).catch(e=>{v.error("Failed to load settings",e),Lt({}),Nt({}),Rt({}),rt(!0)}).finally(()=>{xt=null})),await xt)}async function W(e,t){await Xt();const n=await ee.patchConfigOwner(e,t);e==="ui"&&Lt(n),e==="server"&&Nt(n)}function yc(e){Co()!==e&&(mc(e),qs(e),Js(async()=>{const{serverEvents:t}=await Promise.resolve().then(()=>Ba);return{serverEvents:t}},void 0).then(({serverEvents:t})=>{t.restart("desktop transport preference changed")}).catch(t=>{v.error("Failed to restart backend events stream after desktop transport preference change",t)}))}async function G(e,t){await Xt();const n=await ee.patchStateOwner(e,t);Rt(n)}function H(e){const t=Ln(),n=go({...t.settings??{},...e}),r={settings:Object.fromEntries(Object.keys(e).map(o=>[o,n[o]]))};W("ui",r).catch(o=>v.error("Failed to patch ui settings",o))}function vo(e){H(e)}const Ze=new Map;let dr=Promise.resolve();const[wc,cn]=k(new Map),[bc,fr]=k(new Set);function Cc(e){return wc().get(e)??Yt(_().modelVisibility[e])}function Sc(e){return bc().has(e)}async function vc(e,t){if(!e)return;const n=Yt(t);cn(i=>new Map(i).set(e,n)),fr(i=>{const s=new Set(i);return s.delete(e),s});const o=dr.catch(()=>{}).then(()=>W("ui",{settings:{modelVisibility:{[e]:n}}}));dr=o,Ze.set(e,o),o.then(()=>{Ze.get(e)===o&&(Ze.delete(e),cn(i=>{const s=new Map(i);return s.delete(e),s}))},i=>{v.error("Failed to update provider model visibility",i),Ze.get(e)===o&&(Ze.delete(e),cn(s=>{const a=new Map(s);return a.delete(e),a}),fr(s=>new Set(s).add(e)))}),await o}function xc(e){So()!==e&&W("ui",{theme:e}).catch(t=>v.error("Failed to set theme",t))}async function Oc(e){me().listeningMode!==e&&await W("server",{listeningMode:e})}function xo(e){W("server",{environmentVariables:e}).catch(t=>v.error("Failed to update environment variables",t))}function Ec(e,t,n=!0){const r=me().environmentVariables;xo({...r,[e]:t});const o=me().secureEnvVars,i=e.toUpperCase(),s=o.some(a=>a.toUpperCase()===i);if(n){if(!s){const a=[...o,e];W("server",{secureEnvVars:a}).catch(c=>v.error("Failed to add secure env var",c))}}else if(s){const a=o.filter(c=>c.toUpperCase()!==i);W("server",{secureEnvVars:a}).catch(c=>v.error("Failed to remove secure env var",c))}}function Ac(e){W("server",{environmentVariables:{[e]:null}}).catch(t=>v.error("Failed to remove environment variable",t))}function Tc(e){return me().secureEnvVars.some(n=>n.toUpperCase()===e.toUpperCase())}function kc(e){const t=me().secureEnvVars,n=e.toUpperCase(),o=t.some(i=>i.toUpperCase()===n)?t.filter(i=>i.toUpperCase()!==n):[...t,e];W("server",{secureEnvVars:o}).catch(i=>v.error("Failed to update secure env vars",i))}function Mc(e){const t=e&&e.trim().length>0?e:"opencode";W("server",{opencodeBinary:t}).catch(r=>v.error("Failed to set default binary",r));const n=Dn(t,void 0,ft());G("ui",{opencodeBinaries:n}).catch(r=>v.error("Failed to update binary list",r))}function Pc(e){W("server",{logLevel:e??"DEBUG"}).catch(n=>v.error("Failed to set log level",n))}async function $c(e){const t=Xa(e);try{await W("server",{speech:t})}catch(n){throw v.error("Failed to update speech settings",n),n}}function Ic(e,t){const n=Dn(e,t,ft());G("ui",{opencodeBinaries:n}).catch(r=>v.error("Failed to add binary",r))}function Dc(e){const t=ft().filter(n=>n.path!==e);G("ui",{opencodeBinaries:t}).catch(n=>v.error("Failed to remove binary",n)),me().opencodeBinary===e&&W("server",{opencodeBinary:"opencode"}).catch(n=>v.error("Failed to reset default binary",n))}function Lc(e){const t=yo(e,dt());G("ui",{recentFolders:t}).catch(n=>v.error("Failed to add recent folder",n))}function Nc(e){const t=dt().filter(n=>n.path!==e);G("ui",{recentFolders:t}).catch(n=>v.error("Failed to remove recent folder",n))}async function Rc(e,t){const n=t.trim();if(!e||!n)return;const r=dt().map(o=>o.path===e?{...o,projectName:n}:o);try{await G("ui",{recentFolders:r})}catch(o){throw v.error("Failed to rename recent folder",o),o}}async function Fc(e){const t=dc(e,ze());return await G("ui",{remoteServers:wo(t,ze())}),t}async function _c(e){const t=ze().find(o=>o.id===e);if(!t)return;const n=new Date().toISOString(),r={...t,updatedAt:n,lastConnectedAt:n};await G("ui",{remoteServers:wo(r,ze())})}function Uc(e){const t=ze().filter(n=>n.id!==e);G("ui",{remoteServers:t}).catch(n=>v.error("Failed to remove remote server",n))}function Bc(e,t,n){const r=t&&t.trim().length>0?t:me().opencodeBinary,o=yo(e,dt(),n),i=Dn(r,void 0,ft());G("ui",{recentFolders:o,opencodeBinaries:i}).catch(s=>v.error("Failed to update ui state on launch",s)),W("server",{opencodeBinary:r}).catch(s=>v.error("Failed to persist selected binary",s))}function Wc(e){if(!e.providerId||!e.modelId)return;const n=se().models.recents.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId),r=[e,...n].slice(0,ec);G("ui",{models:{recents:r}}).catch(o=>v.error("Failed to update model recents",o))}function Vc(e){return!e.providerId||!e.modelId?!1:se().models.favorites.some(t=>t.providerId===e.providerId&&t.modelId===e.modelId)}function jc(e){if(!e.providerId||!e.modelId)return;const t=se().models.favorites,r=t.some(o=>o.providerId===e.providerId&&o.modelId===e.modelId)?t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId):[e,...t.filter(o=>o.providerId!==e.providerId||o.modelId!==e.modelId)].slice(0,tc);G("ui",{models:{favorites:r}}).catch(o=>v.error("Failed to update model favorites",o))}function zc(e){if(!(!e.providerId||!e.modelId))return se().models.thinkingSelections[po(e)]}function Kc(e,t){if(!e.providerId||!e.modelId)return;const n=po(e);if(se().models.thinkingSelections[n]===t)return;const o={...se().models.thinkingSelections};t?o[n]=t:delete o[n],G("ui",{models:{thinkingSelections:o}}).catch(i=>v.error("Failed to update thinking selection",i))}function Gc(e){_().diffViewMode!==e&&H({diffViewMode:e})}function Hc(e){const t=_();t.toolCallExpansionDefaults.tools.other!==e&&H({toolOutputExpansion:e==="hidden"?t.toolOutputExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",tools:{...t.toolCallExpansionDefaults.tools,other:e}}})}function Jc(e){_().diagnosticsExpansion!==e&&H({diagnosticsExpansion:e})}function qc(e){_().toolInputsVisibility!==e&&H({toolInputsVisibility:e})}function Yc(e){const t=_();t.thinkingBlocksExpansion===e&&t.toolCallExpansionDefaults.thinking===e||H({thinkingBlocksExpansion:e,toolCallExpansionDefaults:{...t.toolCallExpansionDefaults,preset:"custom",thinking:e}})}function Xc(){H({showThinkingBlocks:!_().showThinkingBlocks})}function Zc(){vo({showKeyboardShortcutHints:!_().showKeyboardShortcutHints})}function Qc(){H({showTimelineTools:!_().showTimelineTools})}function el(){H({showMessageTimeline:!(_().showMessageTimeline??!0)})}function tl(){H({showUsageMetrics:!_().showUsageMetrics})}function nl(){H({promptSubmitOnEnter:!_().promptSubmitOnEnter})}function rl(){H({showPromptVoiceInput:!_().showPromptVoiceInput})}function ol(){const e=!_().autoCleanupBlankSessions;v.info("toggle auto cleanup",{value:e}),H({autoCleanupBlankSessions:e})}async function il(e,t,n){!e||!t||!n.providerId||!n.modelId||(await qt(e),await uo(e,r=>{const o={...r.agentModelSelections??{}},i=o[t];i&&i.providerId===n.providerId&&i.modelId===n.modelId||(o[t]=n,r.agentModelSelections=o)}))}async function sl(e,t){return!e||!t?void 0:(await qt(e),(fo(e).agentModelSelections??{})[t])}Xt().catch(e=>{v.error("Failed to initialize settings",e)});const Oo=Ke(),al={isLoaded:bo,preferences:_,useTauriNativeEventTransport:Co,setUseTauriNativeEventTransport:yc,updatePreferences:vo,setProviderModelVisibility:vc,getProviderModelVisibilityPreference:Cc,providerModelVisibilitySaveFailed:Sc,themePreference:So,setThemePreference:xc,serverSettings:me,setListeningMode:Oc,updateEnvironmentVariables:xo,addEnvironmentVariable:Ec,removeEnvironmentVariable:Ac,isSecureEnvVar:Tc,toggleSecureEnvVar:kc,updateLastUsedBinary:Mc,updateLogLevel:Pc,updateSpeechSettings:$c,recentFolders:dt,opencodeBinaries:ft,remoteServers:ze,uiState:se,addRecentFolder:Lc,removeRecentFolder:Nc,renameRecentFolderProject:Rc,addOpenCodeBinary:Ic,removeOpenCodeBinary:Dc,saveRemoteServerProfile:Fc,markRemoteServerConnected:_c,removeRemoteServerProfile:Uc,recordWorkspaceLaunch:Bc,addRecentModelPreference:Wc,isFavoriteModelPreference:Vc,toggleFavoriteModelPreference:jc,getModelThinkingSelection:zc,setModelThinkingSelection:Kc,toggleShowThinkingBlocks:Xc,toggleKeyboardShortcutHints:Zc,toggleShowMessageTimeline:el,toggleShowTimelineTools:Qc,toggleUsageMetrics:tl,toggleAutoCleanupBlankSessions:ol,togglePromptSubmitOnEnter:nl,toggleShowPromptVoiceInput:rl,setDiffViewMode:Gc,setToolOutputExpansion:Hc,setDiagnosticsExpansion:Jc,setThinkingBlocksExpansion:Yc,setToolInputsVisibility:qc,setAgentModelPreference:il,getAgentModelPreference:sl},$u=e=>(Bt(()=>{Xt().catch(o=>{v.error("Failed to initialize settings",o)});const t=ee.onConfigOwnerChanged("ui",o=>{Lt(o),rt(!0)}),n=ee.onConfigOwnerChanged("server",o=>{Nt(o),rt(!0),Ya(),qa(!0)}),r=ee.onStateOwnerChanged("ui",o=>{Rt(o),rt(!0)});return()=>{t(),n(),r()}}),he(Oo.Provider,{value:al,get children(){return e.children}}));function cl(){const e=ct(Oo);if(!e)throw new Error("useConfig must be used within ConfigProvider");return e}function ll(e,t,n){const r={};return Object.keys(e).forEach(o=>{r[o]=e[o].reduce((i,s)=>(s&&(n&&n[s]&&i.push(n[s]),i.push(t(s))),i),[]).join(" ")}),r}const ul=Symbol("solid-inspect"),dl=Ke();function fl(e){function t(n){var r;return(r=ct(dl))!=null&&r.enabled?{Component:t,props:n,$INSPECT:ul}:e(n)}return Object.defineProperty(t,"name",{value:e.name}),t.toString=e.toString,t}function Eo(){return function(e){function t(a){const c=!!e.slotClasses,u=()=>{if(!e.slotClasses)throw new Error("'slotClasses' option is not defined");if(!e.utilityClass)throw new Error("'utilityClass' option is not defined");return ll(e.slotClasses(a),e.utilityClass,a.classes??"")},l=gi({});return c&&_o(()=>{const d=u();ve(()=>{for(const f in d)l[f]=d[f]})}),l}function n(a){const[c,u]=Ut(a,e.selfPropNames);return{allProps:a,props:c,otherProps:u}}function r(a){return rs({propDefaults:a.propDefaults||e.propDefaults,props:a.props,name:e.name})}function o(a){const c=r({props:a});return n(c)}function i(a,c=!0){return a=fl(a),a.toString=()=>`.${e.name}-root`,c&&Xr(a,"base"),a}function s(a){const c=i(function(l){const{allProps:d,otherProps:f,props:m}=o(l),w=e.autoCallUseClasses??!0?t(d):{};return a({allProps:d,otherProps:f,props:m,classes:w})});return Object.defineProperty(c,"name",{value:a.name}),c}return{name:e.name,selfPropNames:e.selfPropNames,component:s,defineComponent:i,useClasses:t,useThemeProps:r,useProps:o,splitInProps:n}}}const hl=Eo()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),gl=hl.component(function({props:t}){return Kr(()=>({"@global":t.styles||{}})),[]}),ml=Eo()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:e})=>e({enableColorScheme:!1})}),pl=(e,t)=>({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%",...t&&{colorScheme:e.palette.mode}}),yl=e=>({color:e.palette.text.primary,...e.typography.body1,backgroundColor:e.palette.background.default,"@media print":{backgroundColor:e.palette.common.white}}),wl=(e,t=!1)=>({html:pl(e,t),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...yl(e),"&::backdrop":{backgroundColor:e.palette.background.default}}}),bl=ml.component(function({props:t}){const n=Rr();return he(gl,{get styles(){return wl(n,t.enableColorScheme)}})}),Ao=Ke();function hr(e){if(!(typeof document>"u")){if(e==="system"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}const Cl={backgroundDefault:"#ffffff",backgroundPaper:"#f5f5f5",primary:"#0066ff",primaryContrast:"#ffffff",textPrimary:"#1a1a1a",textSecondary:"#666666",divider:"#e0e0e0"},Sl={backgroundDefault:"#1a1a1a",backgroundPaper:"#2a2a2a",primary:"#0080ff",primaryContrast:"#1a1a1a",textPrimary:"#cfd4dc",textSecondary:"#999999",divider:"#3a3a3a"},Ce=(e,t,n)=>{if(!n)return t;const r=n.getPropertyValue(e);return r&&r.trim()||t},vl=e=>{const t=e?Sl:Cl,n=typeof window<"u"?getComputedStyle(document.documentElement):null;return{backgroundDefault:Ce("--surface-base",t.backgroundDefault,n),backgroundPaper:Ce("--surface-secondary",t.backgroundPaper,n),primary:Ce("--accent-primary",t.primary,n),primaryContrast:Ce("--text-inverted",t.primaryContrast,n),textPrimary:Ce("--text-primary",t.textPrimary,n),textSecondary:Ce("--text-secondary",t.textSecondary,n),divider:Ce("--border-base",t.divider,n)}};function Iu(e){const t=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,{themePreference:n,setThemePreference:r}=cl(),[o,i]=k(!0),[s,a]=k(0),c=()=>n(),u=()=>{const w=c();return w==="dark"?!0:w==="light"?!1:(t==null?void 0:t.matches)??!1},l=()=>{const w=c(),g=u();hr(w==="system"?"system":w),i(g),typeof window<"u"?requestAnimationFrame(()=>a(b=>b+1)):a(b=>b+1)};K(()=>{l()}),Bt(()=>{if(!t)return;const w=()=>{l()};return t.addEventListener("change",w),()=>{t.removeEventListener("change",w)}});const d=w=>{r(w)},f=()=>{const w=c();d(w==="system"?"light":w==="light"?"dark":"system")},m=L(()=>{s();const w=vl(o());return Dr({palette:{mode:o()?"dark":"light",primary:{main:w.primary,contrastText:w.primaryContrast},secondary:{main:w.primary},background:{default:w.backgroundDefault,paper:w.backgroundPaper},text:{primary:w.textPrimary,secondary:w.textSecondary},divider:w.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 he(Ao.Provider,{value:{isDark:o,themeMode:c,setThemeMode:d,cycleThemeMode:f},get children(){return he(os,{get theme(){return m()},get children(){return[he(bl,{}),qo(()=>e.children)]}})}})}function To(){const e=ct(Ao);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const xl=/(^|\n)@@/m,Ol=/(^|\n)(diff --git |--- |\+\+\+)/,El=/^\*\*\* (Begin|End) Patch/,Al=/^\*\*\* Update File: (.+)$/,Tl=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function kl(e){const t=e.trim();if(!t.startsWith("```"))return t;const n=t.split(`
16
+ `);return n.length<2?"":n[n.length-1].startsWith("```")?n.slice(1,-1).join(`
17
+ `):t}function Ml(e){var i;if(!e)return"";const n=kl(e.replace(/\r\n/g,`
18
+ `)).split(`
19
+ `).map(s=>s.replace(/\s+$/u,""));let r=null;const o=[];for(const s of n){if(!s||El.test(s))continue;const a=s.match(Al);if(a){r=((i=a[1])==null?void 0:i.trim())||null;continue}o.push(s)}return r&&!Ol.test(o.join(`
20
+ `))&&(o.unshift(`+++ b/${r}`),o.unshift(`--- a/${r}`)),o.join(`
21
+ `).trim()}function Du(e){if(!e)return!1;const t=Ml(e);return t?xl.test(t):!1}function Pl(e){if(!e||e.trim().length===0)return{before:"",after:""};const t=e.replace(/\r\n/g,`
22
+ `).split(`
23
+ `),n=[],r=[];for(const o of t)o.startsWith("---")||o.startsWith("+++")||o.startsWith("diff --git")||Tl.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
+ `),after:r.join(`
25
+ `)}}const $l="0.52.2",vn=`https://cdn.jsdelivr.net/npm/monaco-editor@${$l}/min/vs`,Q="/monaco/vs";let Ot=null;function Il(e,t){return new Promise((n,r)=>{const o=setTimeout(()=>r(new Error("timeout")),t);e.then(i=>{clearTimeout(o),n(i)}).catch(i=>{clearTimeout(o),r(i)})})}async function Dl(){if(typeof fetch>"u")return!1;try{const e=new AbortController,t=fetch(`${vn}/loader.js`,{method:"HEAD",signal:e.signal}),n=await Il(t,1200);return e.abort(),n.ok}catch{return!1}}function Ll(){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=`${Q}/loader.js`,r.async=!0,r.onload=()=>t(),r.onerror=()=>n(new Error("Failed to load Monaco AMD loader")),document.head.appendChild(r)})}function Nl(){if(typeof document>"u"||document.querySelector('link[data-monaco-editor-css="true"]'))return;const t=document.createElement("link");t.rel="stylesheet",t.href=`${Q}/editor/editor.main.css`,t.dataset.monacoEditorCss="true",document.head.appendChild(t)}function Rl(){const e=globalThis,t=e.MonacoEnvironment??{},n="/monaco.worker.js";e.MonacoEnvironment={...t,getWorkerUrl(r,o){return n}}}function ko(){const e=globalThis.require;if(!e)throw new Error("Monaco AMD loader is not available");return e}function Fl(){const t=ko().config;if(!t)throw new Error("require.config is not available");return t}function xn(e){const t=ko();return new Promise((n,r)=>{t(e,(...o)=>n(o),o=>r(o))})}function _l(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 gr=new Set,ln=new Map;async function Mo(e){const t=_l(e);if(!t||gr.has(t))return;const n=ln.get(t);if(n)return n;const r=(async()=>{let o=!1;try{await xn([t]),o=!0}catch{}finally{o&&gr.add(t),ln.delete(t)}})();return ln.set(t,r),r}async function Po(){return Ot||(Ot=(async()=>{await Ll(),Rl(),Nl();const e=await Dl(),t=Fl(),n={vs:Q};e&&(n["vs/basic-languages"]=`${vn}/basic-languages`,n["vs/language"]=`${vn}/language`,n["vs/basic-languages/python"]=`${Q}/basic-languages/python`,n["vs/basic-languages/markdown"]=`${Q}/basic-languages/markdown`,n["vs/basic-languages/cpp"]=`${Q}/basic-languages/cpp`,n["vs/basic-languages/kotlin"]=`${Q}/basic-languages/kotlin`,n["vs/language/typescript"]=`${Q}/language/typescript`,n["vs/language/html"]=`${Q}/language/html`,n["vs/language/json"]=`${Q}/language/json`,n["vs/language/css"]=`${Q}/language/css`),t({paths:n,ignoreDuplicateModules:["vs/editor/editor.main"]});const[r]=await xn(["vs/editor/editor.main"]);return await xn(["vs/basic-languages/monaco.contribution"]).catch(()=>[]),globalThis.monaco??r})(),Ot)}const Ul=5,ue=new Map;function Bl(e,t){ue.delete(e),ue.set(e,t)}function Wl(){for(;ue.size>Ul;){const e=ue.keys().next().value;if(!e)return;const t=ue.get(e);ue.delete(e);try{t==null||t.model.dispose()}catch{}}}function On(e){const t=ue.get(e.cacheKey);if(t)return Bl(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 ue.set(e.cacheKey,o),Wl(),r}let Et=null;function Vl(e){var o;if(Et)return Et;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 i of r){const s=typeof(i==null?void 0:i.id)=="string"?i.id:null;if(!s)continue;const a=Array.isArray(i==null?void 0:i.filenames)?i.filenames:[];for(const u of a)typeof u=="string"&&(t.has(u)||t.set(u,s));const c=Array.isArray(i==null?void 0:i.extensions)?i.extensions:[];for(const u of c)typeof u=="string"&&(n.has(u)||n.set(u,s))}return Et={fileNameToId:t,extToId:n},Et}function jl(e){return e===".gitignore"||e===".gitattributes"||e===".gitmodules"||e==="Makefile"||e.startsWith("Makefile.")?"shell":null}function $o(e,t){const n=String(t||"").trim(),r=n.split("/").pop()||n,o=jl(r);if(o)return o;const i=Vl(e),s=i.fileNameToId.get(r);if(s)return s;const a=r.lastIndexOf(".");if(a>0){const c=r.slice(a),u=i.extToId.get(c);if(u)return u}return"plaintext"}var zl=En("<div class=monaco-viewer>");function Kl(e){const{isDark:t}=To();let n,r=null,o=null;const[i,s]=k(!1),a=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},c=()=>{!r||!e.onSave||e.onSave(r.getValue())},u=l=>{if(!e.compactGutter)return 5;const d=l.split(/\r\n|\r|\n/).length;return Math.max(3,String(d).length+1)};return Bt(()=>{let l=!1;(async()=>(o=await Po(),!l&&(!n||!o||(o.editor.setTheme(t()?"vs-dark":"vs"),r=o.editor.create(n,{value:"",language:"plaintext",readOnly:!1,automaticLayout:!0,lineNumbers:"on",lineNumbersMinChars:u(e.content),glyphMargin:!1,folding:!e.compactGutter,lineDecorationsWidth:e.compactGutter?8:10,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",renderWhitespace:"selection",fontSize:13}),r.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KeyS,c),r.onDidChangeModelContent(()=>{e.onContentChange&&e.onContentChange(r.getValue())}),s(!0)))))(),fe(()=>{l=!0,s(!1),a()})}),K(()=>{!i()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),K(()=>{!i()||!r||r.updateOptions({wordWrap:e.wordWrap==="on"?"on":"off"})}),K(()=>{!i()||!r||r.updateOptions({lineNumbersMinChars:u(e.content),folding:!e.compactGutter,lineDecorationsWidth:e.compactGutter?8:10})}),K(()=>{if(!i()||!o||!r)return;const l=$o(o,e.path),d=`${e.scopeKey}:file:${e.path}`,f=On({monaco:o,cacheKey:d,value:e.content});r.setModel(f),Mo(l).then(()=>{try{o.editor.setModelLanguage(f,l)}catch{}})}),(()=>{var l=zl(),d=n;return typeof d=="function"?An(d,l):n=l,l})()}const Lu=Object.freeze(Object.defineProperty({__proto__:null,MonacoFileViewer:Kl},Symbol.toStringTag,{value:"Module"}));var Gl=En("<div class=monaco-viewer><div class=git-change-context-overlay>"),Hl=En("<div class=git-change-context-widget-host><button type=button class=git-change-context-widget>+");function Ft(e){return e?e.split(`
26
+ `).length:1}function _t(e){return String(Math.max(1,e)).length}function Jl(e){const t=Ft(e.before),n=Ft(e.after),r=_t(t),o=_t(n),i=Math.max(r,o),s=Math.max(0,i-2),a=Math.max(2,r),c=Math.max(2,o),u=Math.max(0,i-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:6+s*2+u*2}}function ql(e){const t=Ft(e.before),n=Ft(e.after),r=_t(t),o=_t(n),i=Math.max(r,o),s=Math.max(0,i-2),a=Math.max(2,r),c=Math.max(2,o),u=Math.max(0,i-3);return{diffEditorLineNumbersMinChars:Math.max(a,c),originalLineNumbersMinChars:a,modifiedLineNumbersMinChars:c,lineDecorationsWidth:8+s*2+u}}function Yl(e){const{isDark:t}=To();let n,r=null,o=null,i=null;const[s,a]=k(!1),[c,u]=k(null),[l,d]=k(null),[f,m]=k(!1),[w,g]=k(null),b=L(()=>e.patch!==void 0&&e.patch!==null?Pl(e.patch):{before:e.before??"",after:e.after??""}),A=()=>{try{r==null||r.setModel(null)}catch{}try{r==null||r.dispose()}catch{}r=null},I=()=>{n&&(n.style.removeProperty("--split-original-line-number-width"),n.style.removeProperty("--split-original-delete-sign-left"),n.style.removeProperty("--split-original-gutter-width"))},N=p=>{if(n){if(i!==null&&typeof window<"u"&&(window.cancelAnimationFrame(i),i=null),p.viewMode!=="split"||typeof window>"u"){I();return}i=window.requestAnimationFrame(()=>{if(i=null,!n)return;const C=n.querySelector(".editor.original .line-numbers"),E=(C==null?void 0:C.getBoundingClientRect().width)??0,x=E>0?E:Math.max(12,p.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+p.lineDecorationsWidth}px`)})}},X=()=>{var p;return((p=r==null?void 0:r.getModifiedEditor)==null?void 0:p.call(r))??null},ht=()=>{const p=l();if(p)return p;if(f()&&c())return{startLine:c(),endLine:c()};const C=c();return C?{startLine:C,endLine:C}:null},V=()=>{var x,O,M,S;const p=X(),C=n;if(!p||!C)return;const E=ht();if(!E){g(null);return}try{const $=(x=p.getDomNode)==null?void 0:x.call(p);if(!$){g(null);return}const U=$.querySelector(".margin"),Z=$.querySelector(".monaco-scrollable-element.editor-scrollable"),pe=((O=p.getTopForLineNumber)==null?void 0:O.call(p,E.startLine))??0,Te=((M=p.getScrollTop)==null?void 0:M.call(p))??0,gt=Number(((S=p.getOption)==null?void 0:S.call(p,o.editor.EditorOption.lineHeight))??18),He=$.getBoundingClientRect(),ye=C.getBoundingClientRect(),mt=He.left-ye.left+((U==null?void 0:U.offsetWidth)??(Z==null?void 0:Z.offsetLeft)??0),Io=He.top-ye.top+(pe-Te)+gt/2;g({top:Io,left:mt})}catch{g(null)}};return Bt(()=>{let p=!1;(async()=>(o=await Po(),!p&&(!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),V()))))(),fe(()=>{p=!0,i!==null&&typeof window<"u"&&(window.cancelAnimationFrame(i),i=null),I(),a(!1),A()})}),K(()=>{!s()||!o||!r||o.editor.setTheme(t()?"vs-dark":"vs")}),K(()=>{n&&(n.dataset.viewMode=e.viewMode==="split"?"split":"unified")}),K(()=>{var E;if(!s()||!o||!r)return;const p=(E=r.getModifiedEditor)==null?void 0:E.call(r);if(!(p!=null&&p.onDidChangeCursorSelection))return;const C=p.onDidChangeCursorSelection(x=>{var M;const O=x==null?void 0:x.selection;if(!O||(M=O.isEmpty)!=null&&M.call(O)){d(null),V();return}d({startLine:Math.min(O.startLineNumber,O.endLineNumber),endLine:Math.max(O.startLineNumber,O.endLineNumber)}),V()});fe(()=>{var x;try{(x=C==null?void 0:C.dispose)==null||x.call(C)}catch{}})}),K(()=>{var O;if(!s()||!o||!r)return;const p=X();if(!(p!=null&&p.onMouseMove)||!(p!=null&&p.onMouseLeave)||!(p!=null&&p.onMouseDown))return;const C=p.onMouseMove(M=>{var $,U;const S=(U=($=M==null?void 0:M.target)==null?void 0:$.position)==null?void 0:U.lineNumber;u(typeof S=="number"?S:null),V()}),E=p.onMouseLeave(()=>{f()||u(null),V()}),x=(O=p.onDidScrollChange)==null?void 0:O.call(p,()=>{V()});fe(()=>{var M,S,$;try{(M=C==null?void 0:C.dispose)==null||M.call(C),(S=E==null?void 0:E.dispose)==null||S.call(E),($=x==null?void 0:x.dispose)==null||$.call(x)}catch{}})}),K(()=>{if(!s()||!o||!r)return;ht()||g(null),V()}),K(()=>{var pe,Te,gt,He,ye,mt;if(!s()||!o||!r)return;const p=e.viewMode==="unified"?"unified":"split",C=e.contextMode==="collapsed"?"collapsed":"expanded",E=e.wordWrap==="on"?"on":"off",{before:x,after:O}=b(),M=p==="unified"?Jl({before:x,after:O}):ql({before:x,after:O}),{diffEditorLineNumbersMinChars:S,originalLineNumbersMinChars:$,modifiedLineNumbersMinChars:U,lineDecorationsWidth:Z}=M;r.updateOptions({renderSideBySide:p==="split",renderSideBySideInlineBreakpoint:0,renderIndicators:!0,lineNumbersMinChars:S,lineDecorationsWidth:Z,hideUnchangedRegions:C==="collapsed"?{enabled:!0}:{enabled:!1},wordWrap:E});try{(gt=(Te=(pe=r.getOriginalEditor)==null?void 0:pe.call(r))==null?void 0:Te.updateOptions)==null||gt.call(Te,{wordWrap:E,lineNumbersMinChars:$,lineDecorationsWidth:Z})}catch{}try{(mt=(ye=(He=r.getModifiedEditor)==null?void 0:He.call(r))==null?void 0:ye.updateOptions)==null||mt.call(ye,{wordWrap:E,lineNumbersMinChars:U,lineDecorationsWidth:Z})}catch{}N({viewMode:p,originalLineNumbersMinChars:$,lineDecorationsWidth:Z})}),K(()=>{if(!s()||!o||!r)return;const p=$o(o,e.path),{before:C,after:E}=b(),x=`${e.scopeKey}:diff:${e.path}:before`,O=`${e.scopeKey}:diff:${e.path}:after`,M=On({monaco:o,cacheKey:x,value:C}),S=On({monaco:o,cacheKey:O,value:E});r.setModel({original:M,modified:S}),Mo(p).then(()=>{try{o.editor.setModelLanguage(M,p),o.editor.setModelLanguage(S,p)}catch{}})}),(()=>{var p=Gl(),C=p.firstChild,E=n;return typeof E=="function"?An(E,p):n=p,Mt(C,he(Uo,{get when(){return w()},children:x=>(()=>{var O=Hl(),M=O.firstChild;return O.addEventListener("mouseleave",()=>{m(!1),V()}),O.addEventListener("mouseenter",()=>{m(!0),V()}),M.$$click=S=>{var U;S.preventDefault(),S.stopPropagation();const $=ht();$&&((U=e.onRequestInsertContext)==null||U.call(e,$))},M.$$mousedown=S=>{S.preventDefault(),S.stopPropagation()},de(S=>{var $=`${x().top}px`,U=`${x().left}px`,Z=e.insertContextLabel??"Add git change context to prompt",pe=e.insertContextLabel??"Add git change context to prompt";return $!==S.e&&Fn(O,"top",S.e=$),U!==S.t&&Fn(O,"left",S.t=U),Z!==S.a&&st(M,"aria-label",S.a=Z),pe!==S.o&&st(M,"title",S.o=pe),S},{e:void 0,t:void 0,a:void 0,o:void 0}),O})()})),p})()}br(["mousedown","click"]);const Nu=Object.freeze(Object.defineProperty({__proto__:null,MonacoDiffViewer:Yl},Symbol.toStringTag,{value:"Module"}));export{au as $,sl as A,se as B,pu as C,nu as D,ou as E,il as F,_ as G,qa as H,lr as I,me as J,Wc as K,zc as L,Ra as M,qt as N,cl as O,tu as P,Su as Q,ti as R,mu as S,su as T,Eo as U,Vs as V,cu as W,hu as X,Ks as Y,Yr as Z,Js as _,Qo as a,uu as a0,ys as a1,du as a2,lu as a3,gu as a4,gi as a5,fu as a6,bi as a7,wi as a8,To as a9,Du as aa,fo as ab,uo as ac,Gt as ad,yu as ae,Mu as af,Cc as ag,Pu as ah,jc as ai,Kc as aj,wu as ak,ku as al,Au as am,Tu as an,vu as ao,Oc as ap,ee as aq,eu as ar,Eu as as,Iu as at,$u as au,Ou as av,Ml as aw,Lu as ax,Nu as ay,Cr as b,ru as c,st as d,Rr as e,br as f,Fn as g,ei as h,Mt as i,re as j,ae as k,Ve as l,qo as m,Cu as n,Ea as o,iu as p,Aa as q,xu as r,ni as s,En as t,An as u,Me as v,Ma as w,bu as x,Ht as y,At as z};
@@ -0,0 +1 @@
1
+ import{I as r}from"./main-BnwG4srg.js";import{n as a,m as o}from"./git-diff-vendor-CYS3ApzA.js";const m=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],p=e=>a(r,o(e,{name:"TerminalSquare",iconNode:m}));export{p as T};