@siteboon/claude-code-ui 1.8.11 β 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-Bmo7Hu70.css +32 -0
- package/dist/assets/index-D3NZxyU6.js +793 -0
- package/dist/assets/vendor-codemirror-D2k1L1JZ.js +39 -0
- package/dist/assets/vendor-react-7V_UDHjJ.js +59 -0
- package/dist/assets/vendor-xterm-jI4BCHEb.js +66 -0
- package/dist/clear-cache.html +85 -0
- package/dist/index.html +5 -2
- package/package.json +6 -3
- package/server/claude-sdk.js +513 -0
- package/server/cursor-cli.js +14 -2
- package/server/database/auth.db +0 -0
- package/server/index.js +224 -38
- package/server/projects.js +108 -17
- package/server/routes/commands.js +572 -0
- package/server/utils/commandParser.js +303 -0
- package/dist/assets/index-Co7ALK3i.css +0 -32
- package/dist/assets/index-DAipXx7e.js +0 -895
- package/server/claude-cli.js +0 -391
|
@@ -0,0 +1,793 @@
|
|
|
1
|
+
import{j as e,S as ic,a as oc,E as Mn,D as es,R as ro,o as no,b as lc,m as so,c as cc,d as dc,h as uc,p as mc,e as pc}from"./vendor-codemirror-D2k1L1JZ.js";import{b as hc,g as on,a as p,R as lr,B as xc,c as gc,d as Ta,u as fc,e as bc}from"./vendor-react-7V_UDHjJ.js";import{r as yc,a as kc,b as vc,c as wc}from"./vendor-xterm-jI4BCHEb.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var bn={},Da;function jc(){if(Da)return bn;Da=1;var t=hc();return bn.createRoot=t.createRoot,bn.hydrateRoot=t.hydrateRoot,bn}var Nc=jc();const Sc=on(Nc);function ao(t){var r,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(r=0;r<a;r++)t[r]&&(n=ao(t[r]))&&(s&&(s+=" "),s+=n)}else for(n in t)t[n]&&(s&&(s+=" "),s+=n);return s}function io(){for(var t,r,n=0,s="",a=arguments.length;n<a;n++)(t=arguments[n])&&(r=ao(t))&&(s&&(s+=" "),s+=r);return s}const Zs="-",Cc=t=>{const r=Ic(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:o=>{const l=o.split(Zs);return l[0]===""&&l.length!==1&&l.shift(),oo(l,r)||Ec(o)},getConflictingClassGroupIds:(o,l)=>{const d=n[o]||[];return l&&s[o]?[...d,...s[o]]:d}}},oo=(t,r)=>{if(t.length===0)return r.classGroupId;const n=t[0],s=r.nextPart.get(n),a=s?oo(t.slice(1),s):void 0;if(a)return a;if(r.validators.length===0)return;const i=t.join(Zs);return r.validators.find(({validator:o})=>o(i))?.classGroupId},Pa=/^\[(.+)\]$/,Ec=t=>{if(Pa.test(t)){const r=Pa.exec(t)[1],n=r?.substring(0,r.indexOf(":"));if(n)return"arbitrary.."+n}},Ic=t=>{const{theme:r,classGroups:n}=t,s={nextPart:new Map,validators:[]};for(const a in n)Ss(n[a],s,a,r);return s},Ss=(t,r,n,s)=>{t.forEach(a=>{if(typeof a=="string"){const i=a===""?r:La(r,a);i.classGroupId=n;return}if(typeof a=="function"){if(Ac(a)){Ss(a(s),r,n,s);return}r.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{Ss(o,La(r,i),n,s)})})},La=(t,r)=>{let n=t;return r.split(Zs).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Ac=t=>t.isThemeGetter,Mc=t=>{if(t<1)return{get:()=>{},set:()=>{}};let r=0,n=new Map,s=new Map;const a=(i,o)=>{n.set(i,o),r++,r>t&&(r=0,s=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},Cs="!",Es=":",Tc=Es.length,Dc=t=>{const{prefix:r,experimentalParseClassName:n}=t;let s=a=>{const i=[];let o=0,l=0,d=0,c;for(let y=0;y<a.length;y++){let v=a[y];if(o===0&&l===0){if(v===Es){i.push(a.slice(d,y)),d=y+Tc;continue}if(v==="/"){c=y;continue}}v==="["?o++:v==="]"?o--:v==="("?l++:v===")"&&l--}const u=i.length===0?a:a.substring(d),h=Pc(u),x=h!==u,m=c&&c>d?c-d:void 0;return{modifiers:i,hasImportantModifier:x,baseClassName:h,maybePostfixModifierPosition:m}};if(r){const a=r+Es,i=s;s=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const a=s;s=i=>n({className:i,parseClassName:a})}return s},Pc=t=>t.endsWith(Cs)?t.substring(0,t.length-1):t.startsWith(Cs)?t.substring(1):t,Lc=t=>{const r=Object.fromEntries(t.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const a=[];let i=[];return s.forEach(o=>{o[0]==="["||r[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},Rc=t=>({cache:Mc(t.cacheSize),parseClassName:Dc(t),sortModifiers:Lc(t),...Cc(t)}),zc=/\s+/,_c=(t,r)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:i}=r,o=[],l=t.trim().split(zc);let d="";for(let c=l.length-1;c>=0;c-=1){const u=l[c],{isExternal:h,modifiers:x,hasImportantModifier:m,baseClassName:y,maybePostfixModifierPosition:v}=n(u);if(h){d=u+(d.length>0?" "+d:d);continue}let E=!!v,A=s(E?y.substring(0,v):y);if(!A){if(!E){d=u+(d.length>0?" "+d:d);continue}if(A=s(y),!A){d=u+(d.length>0?" "+d:d);continue}E=!1}const T=i(x).join(":"),j=m?T+Cs:T,W=j+A;if(o.includes(W))continue;o.push(W);const Z=a(A,E);for(let D=0;D<Z.length;++D){const q=Z[D];o.push(j+q)}d=u+(d.length>0?" "+d:d)}return d};function Fc(){let t=0,r,n,s="";for(;t<arguments.length;)(r=arguments[t++])&&(n=lo(r))&&(s&&(s+=" "),s+=n);return s}const lo=t=>{if(typeof t=="string")return t;let r,n="";for(let s=0;s<t.length;s++)t[s]&&(r=lo(t[s]))&&(n&&(n+=" "),n+=r);return n};function $c(t,...r){let n,s,a,i=o;function o(d){const c=r.reduce((u,h)=>h(u),t());return n=Rc(c),s=n.cache.get,a=n.cache.set,i=l,l(d)}function l(d){const c=s(d);if(c)return c;const u=_c(d,n);return a(d,u),u}return function(){return i(Fc.apply(null,arguments))}}const bt=t=>{const r=n=>n[t]||[];return r.isThemeGetter=!0,r},co=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,uo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Oc=/^\d+\/\d+$/,Bc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Vc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sr=t=>Oc.test(t),qe=t=>!!t&&!Number.isNaN(Number(t)),sr=t=>!!t&&Number.isInteger(Number(t)),ts=t=>t.endsWith("%")&&qe(t.slice(0,-1)),Qt=t=>Bc.test(t),Hc=()=>!0,Jc=t=>Uc.test(t)&&!Wc.test(t),mo=()=>!1,Gc=t=>qc.test(t),Kc=t=>Vc.test(t),Yc=t=>!fe(t)&&!be(t),Qc=t=>zr(t,xo,mo),fe=t=>co.test(t),hr=t=>zr(t,go,Jc),rs=t=>zr(t,rd,qe),Ra=t=>zr(t,po,mo),Xc=t=>zr(t,ho,Kc),yn=t=>zr(t,fo,Gc),be=t=>uo.test(t),Vr=t=>_r(t,go),Zc=t=>_r(t,nd),za=t=>_r(t,po),ed=t=>_r(t,xo),td=t=>_r(t,ho),kn=t=>_r(t,fo,!0),zr=(t,r,n)=>{const s=co.exec(t);return s?s[1]?r(s[1]):n(s[2]):!1},_r=(t,r,n=!1)=>{const s=uo.exec(t);return s?s[1]?r(s[1]):n:!1},po=t=>t==="position"||t==="percentage",ho=t=>t==="image"||t==="url",xo=t=>t==="length"||t==="size"||t==="bg-size",go=t=>t==="length",rd=t=>t==="number",nd=t=>t==="family-name",fo=t=>t==="shadow",sd=()=>{const t=bt("color"),r=bt("font"),n=bt("text"),s=bt("font-weight"),a=bt("tracking"),i=bt("leading"),o=bt("breakpoint"),l=bt("container"),d=bt("spacing"),c=bt("radius"),u=bt("shadow"),h=bt("inset-shadow"),x=bt("text-shadow"),m=bt("drop-shadow"),y=bt("blur"),v=bt("perspective"),E=bt("aspect"),A=bt("ease"),T=bt("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],Z=()=>[...W(),be,fe],D=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto","contain","none"],M=()=>[be,fe,d],_=()=>[Sr,"full","auto",...M()],R=()=>[sr,"none","subgrid",be,fe],L=()=>["auto",{span:["full",sr,be,fe]},sr,be,fe],C=()=>[sr,"auto",be,fe],I=()=>["auto","min","max","fr",be,fe],b=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...M()],B=()=>[Sr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],G=()=>[t,be,fe],ie=()=>[...W(),za,Ra,{position:[be,fe]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ie=()=>["auto","cover","contain",ed,Qc,{size:[be,fe]}],Fe=()=>[ts,Vr,hr],f=()=>["","none","full",c,be,fe],te=()=>["",qe,Vr,hr],ue=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ce=()=>[qe,ts,za,Ra],Be=()=>["","none",y,be,fe],ee=()=>["none",qe,be,fe],oe=()=>["none",qe,be,fe],xe=()=>[qe,be,fe],Ne=()=>[Sr,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qt],breakpoint:[Qt],color:[Hc],container:[Qt],"drop-shadow":[Qt],ease:["in","out","in-out"],font:[Yc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qt],shadow:[Qt],spacing:["px",qe],text:[Qt],"text-shadow":[Qt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Sr,fe,be,E]}],container:["container"],columns:[{columns:[qe,fe,be,l]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:Z()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{start:_()}],end:[{end:_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[sr,"auto",be,fe]}],basis:[{basis:[Sr,"full","auto",l,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qe,Sr,"auto","initial","none",fe]}],grow:[{grow:["",qe,be,fe]}],shrink:[{shrink:["",qe,be,fe]}],order:[{order:[sr,"first","last","none",be,fe]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...b(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...b()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":b()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",n,Vr,hr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,be,rs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ts,fe]}],"font-family":[{font:[Zc,fe,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,be,fe]}],"line-clamp":[{"line-clamp":[qe,"none",be,rs]}],leading:[{leading:[i,...M()]}],"list-image":[{"list-image":["none",be,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:[qe,"from-font","auto",be,hr]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[qe,"auto",be,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be,fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:Ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sr,be,fe],radial:["",be,fe],conic:[sr,be,fe]},td,Xc]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:Fe()}],"gradient-via-pos":[{via:Fe()}],"gradient-to-pos":[{to:Fe()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:f()}],"rounded-s":[{"rounded-s":f()}],"rounded-e":[{"rounded-e":f()}],"rounded-t":[{"rounded-t":f()}],"rounded-r":[{"rounded-r":f()}],"rounded-b":[{"rounded-b":f()}],"rounded-l":[{"rounded-l":f()}],"rounded-ss":[{"rounded-ss":f()}],"rounded-se":[{"rounded-se":f()}],"rounded-ee":[{"rounded-ee":f()}],"rounded-es":[{"rounded-es":f()}],"rounded-tl":[{"rounded-tl":f()}],"rounded-tr":[{"rounded-tr":f()}],"rounded-br":[{"rounded-br":f()}],"rounded-bl":[{"rounded-bl":f()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ue(),"hidden","none"]}],"divide-style":[{divide:[...ue(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...ue(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qe,be,fe]}],"outline-w":[{outline:["",qe,Vr,hr]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",u,kn,yn]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",h,kn,yn]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[qe,hr]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",x,kn,yn]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[qe,be,fe]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ce()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":Ce()}],"mask-image-t-to-pos":[{"mask-t-to":Ce()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":Ce()}],"mask-image-r-to-pos":[{"mask-r-to":Ce()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":Ce()}],"mask-image-b-to-pos":[{"mask-b-to":Ce()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":Ce()}],"mask-image-l-to-pos":[{"mask-l-to":Ce()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":Ce()}],"mask-image-x-to-pos":[{"mask-x-to":Ce()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":Ce()}],"mask-image-y-to-pos":[{"mask-y-to":Ce()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[be,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ce()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":W()}],"mask-image-conic-pos":[{"mask-conic":[qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ce()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:Ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,fe]}],filter:[{filter:["","none",be,fe]}],blur:[{blur:Be()}],brightness:[{brightness:[qe,be,fe]}],contrast:[{contrast:[qe,be,fe]}],"drop-shadow":[{"drop-shadow":["","none",m,kn,yn]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",qe,be,fe]}],"hue-rotate":[{"hue-rotate":[qe,be,fe]}],invert:[{invert:["",qe,be,fe]}],saturate:[{saturate:[qe,be,fe]}],sepia:[{sepia:["",qe,be,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",be,fe]}],"backdrop-blur":[{"backdrop-blur":Be()}],"backdrop-brightness":[{"backdrop-brightness":[qe,be,fe]}],"backdrop-contrast":[{"backdrop-contrast":[qe,be,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qe,be,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qe,be,fe]}],"backdrop-invert":[{"backdrop-invert":["",qe,be,fe]}],"backdrop-opacity":[{"backdrop-opacity":[qe,be,fe]}],"backdrop-saturate":[{"backdrop-saturate":[qe,be,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",qe,be,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",be,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qe,"initial",be,fe]}],ease:[{ease:["linear","initial",A,be,fe]}],delay:[{delay:[qe,be,fe]}],animate:[{animate:["none",T,be,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,be,fe]}],"perspective-origin":[{"perspective-origin":Z()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[be,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:Z()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ne()}],"translate-x":[{"translate-x":Ne()}],"translate-y":[{"translate-y":Ne()}],"translate-z":[{"translate-z":Ne()}],"translate-none":["translate-none"],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be,fe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be,fe]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[qe,Vr,hr,rs]}],stroke:[{stroke:["none",...G()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ad=$c(sd);function Se(...t){return ad(io(t))}const ea=p.forwardRef(({className:t,children:r,...n},s)=>e.jsx("div",{ref:s,className:Se("relative overflow-hidden",t),...n,children:e.jsx("div",{className:"h-full w-full rounded-[inherit] overflow-auto",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));ea.displayName="ScrollArea";const _a=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Fa=io,bo=(t,r)=>n=>{var s;if(r?.variants==null)return Fa(t,n?.class,n?.className);const{variants:a,defaultVariants:i}=r,o=Object.keys(a).map(c=>{const u=n?.[c],h=i?.[c];if(u===null)return null;const x=_a(u)||_a(h);return a[c][x]}),l=n&&Object.entries(n).reduce((c,u)=>{let[h,x]=u;return x===void 0||(c[h]=x),c},{}),d=r==null||(s=r.compoundVariants)===null||s===void 0?void 0:s.reduce((c,u)=>{let{class:h,className:x,...m}=u;return Object.entries(m).every(y=>{let[v,E]=y;return Array.isArray(E)?E.includes({...i,...l}[v]):{...i,...l}[v]===E})?[...c,h,x]:c},[]);return Fa(t,o,d,n?.class,n?.className)},id=bo("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Oe=p.forwardRef(({className:t,variant:r,size:n,...s},a)=>e.jsx("button",{className:Se(id({variant:r,size:n,className:t})),ref:a,...s}));Oe.displayName="Button";const od=bo("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function br({className:t,variant:r,...n}){return e.jsx("div",{className:Se(od({variant:r}),t),...n})}const _t=p.forwardRef(({className:t,type:r,...n},s)=>e.jsx("input",{type:r,className:Se("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...n}));_t.displayName="Input";/**
|
|
2
|
+
* @license lucide-react v0.515.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ld=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cd=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,s)=>s?s.toUpperCase():n.toLowerCase()),$a=t=>{const r=cd(t);return r.charAt(0).toUpperCase()+r.slice(1)},yo=(...t)=>t.filter((r,n,s)=>!!r&&r.trim()!==""&&s.indexOf(r)===n).join(" ").trim(),dd=t=>{for(const r in t)if(r.startsWith("aria-")||r==="role"||r==="title")return!0};/**
|
|
7
|
+
* @license lucide-react v0.515.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/var ud={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
12
|
+
* @license lucide-react v0.515.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const md=p.forwardRef(({color:t="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...l},d)=>p.createElement("svg",{ref:d,...ud,width:r,height:r,stroke:t,strokeWidth:s?Number(n)*24/Number(r):n,className:yo("lucide",a),...!i&&!dd(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,u])=>p.createElement(c,u)),...Array.isArray(i)?i:[i]]));/**
|
|
17
|
+
* @license lucide-react v0.515.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const de=(t,r)=>{const n=p.forwardRef(({className:s,...a},i)=>p.createElement(md,{ref:i,iconNode:r,className:yo(`lucide-${ld($a(t))}`,`lucide-${t}`,s),...a}));return n.displayName=$a(t),n};/**
|
|
22
|
+
* @license lucide-react v0.515.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const pd=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ko=de("arrow-down",pd);/**
|
|
27
|
+
* @license lucide-react v0.515.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const hd=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ta=de("arrow-right",hd);/**
|
|
32
|
+
* @license lucide-react v0.515.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const xd=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],gd=de("arrow-up-down",xd);/**
|
|
37
|
+
* @license lucide-react v0.515.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const fd=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],bd=de("arrow-up",fd);/**
|
|
42
|
+
* @license lucide-react v0.515.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const yd=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],vo=de("brain",yd);/**
|
|
47
|
+
* @license lucide-react v0.515.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const kd=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ir=de("check",kd);/**
|
|
52
|
+
* @license lucide-react v0.515.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const vd=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$t=de("chevron-down",vd);/**
|
|
57
|
+
* @license lucide-react v0.515.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const wd=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],jd=de("chevron-left",wd);/**
|
|
62
|
+
* @license lucide-react v0.515.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const Nd=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cr=de("chevron-right",Nd);/**
|
|
67
|
+
* @license lucide-react v0.515.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Sd=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Cd=de("chevron-up",Sd);/**
|
|
72
|
+
* @license lucide-react v0.515.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const Ed=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ra=de("circle-alert",Ed);/**
|
|
77
|
+
* @license lucide-react v0.515.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const Id=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ln=de("circle-check-big",Id);/**
|
|
82
|
+
* @license lucide-react v0.515.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const Ad=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Md=de("circle-check",Ad);/**
|
|
87
|
+
* @license lucide-react v0.515.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const Td=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Dd=de("circle-help",Td);/**
|
|
92
|
+
* @license lucide-react v0.515.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const Pd=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ar=de("circle",Pd);/**
|
|
97
|
+
* @license lucide-react v0.515.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const Ld=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],rn=de("clock",Ld);/**
|
|
102
|
+
* @license lucide-react v0.515.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const Rd=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],zd=de("columns-2",Rd);/**
|
|
107
|
+
* @license lucide-react v0.515.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const _d=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Fd=de("copy",_d);/**
|
|
112
|
+
* @license lucide-react v0.515.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const $d=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Pn=de("download",$d);/**
|
|
117
|
+
* @license lucide-react v0.515.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const Od=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],cn=de("eye",Od);/**
|
|
122
|
+
* @license lucide-react v0.515.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const Bd=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ud=de("eye-off",Bd);/**
|
|
127
|
+
* @license lucide-react v0.515.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const Wd=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],qd=de("file-code",Wd);/**
|
|
132
|
+
* @license lucide-react v0.515.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const Vd=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ct=de("file-text",Vd);/**
|
|
137
|
+
* @license lucide-react v0.515.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const Hd=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Oa=de("file",Hd);/**
|
|
142
|
+
* @license lucide-react v0.515.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const Jd=[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]],wo=de("flag",Jd);/**
|
|
147
|
+
* @license lucide-react v0.515.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const Gd=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],yr=de("folder-open",Gd);/**
|
|
152
|
+
* @license lucide-react v0.515.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const Kd=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],vn=de("folder-plus",Kd);/**
|
|
157
|
+
* @license lucide-react v0.515.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const Yd=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Wt=de("folder",Yd);/**
|
|
162
|
+
* @license lucide-react v0.515.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const Qd=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Xd=de("funnel",Qd);/**
|
|
167
|
+
* @license lucide-react v0.515.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const Zd=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Is=de("git-branch",Zd);/**
|
|
172
|
+
* @license lucide-react v0.515.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const eu=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Ba=de("git-commit-horizontal",eu);/**
|
|
177
|
+
* @license lucide-react v0.515.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const tu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ns=de("globe",tu);/**
|
|
182
|
+
* @license lucide-react v0.515.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const ru=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],nu=de("grid-3x3",ru);/**
|
|
187
|
+
* @license lucide-react v0.515.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const su=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Ua=de("history",su);/**
|
|
192
|
+
* @license lucide-react v0.515.0 - ISC
|
|
193
|
+
*
|
|
194
|
+
* This source code is licensed under the ISC license.
|
|
195
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
+
*/const au=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],iu=de("info",au);/**
|
|
197
|
+
* @license lucide-react v0.515.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/const ou=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],lu=de("languages",ou);/**
|
|
202
|
+
* @license lucide-react v0.515.0 - ISC
|
|
203
|
+
*
|
|
204
|
+
* This source code is licensed under the ISC license.
|
|
205
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
+
*/const cu=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],Ln=de("list",cu);/**
|
|
207
|
+
* @license lucide-react v0.515.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const du=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],uu=de("loader-circle",du);/**
|
|
212
|
+
* @license lucide-react v0.515.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const mu=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],wn=de("log-in",mu);/**
|
|
217
|
+
* @license lucide-react v0.515.0 - ISC
|
|
218
|
+
*
|
|
219
|
+
* This source code is licensed under the ISC license.
|
|
220
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
+
*/const pu=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],na=de("maximize-2",pu);/**
|
|
222
|
+
* @license lucide-react v0.515.0 - ISC
|
|
223
|
+
*
|
|
224
|
+
* This source code is licensed under the ISC license.
|
|
225
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
+
*/const hu=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],nn=de("message-square",hu);/**
|
|
227
|
+
* @license lucide-react v0.515.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/const xu=[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]],Tn=de("mic",xu);/**
|
|
232
|
+
* @license lucide-react v0.515.0 - ISC
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the ISC license.
|
|
235
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
+
*/const gu=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],jo=de("minimize-2",gu);/**
|
|
237
|
+
* @license lucide-react v0.515.0 - ISC
|
|
238
|
+
*
|
|
239
|
+
* This source code is licensed under the ISC license.
|
|
240
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
+
*/const fu=[["path",{d:"M5 12h14",key:"1ays0h"}]],bu=de("minus",fu);/**
|
|
242
|
+
* @license lucide-react v0.515.0 - ISC
|
|
243
|
+
*
|
|
244
|
+
* This source code is licensed under the ISC license.
|
|
245
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
+
*/const yu=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],No=de("moon",yu);/**
|
|
247
|
+
* @license lucide-react v0.515.0 - ISC
|
|
248
|
+
*
|
|
249
|
+
* This source code is licensed under the ISC license.
|
|
250
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
+
*/const ku=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],So=de("pause",ku);/**
|
|
252
|
+
* @license lucide-react v0.515.0 - ISC
|
|
253
|
+
*
|
|
254
|
+
* This source code is licensed under the ISC license.
|
|
255
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
+
*/const vu=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],As=de("pen-line",vu);/**
|
|
257
|
+
* @license lucide-react v0.515.0 - ISC
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the ISC license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/const wu=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ju=de("pen",wu);/**
|
|
262
|
+
* @license lucide-react v0.515.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/const Nu=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Su=de("play",Nu);/**
|
|
267
|
+
* @license lucide-react v0.515.0 - ISC
|
|
268
|
+
*
|
|
269
|
+
* This source code is licensed under the ISC license.
|
|
270
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
+
*/const Cu=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Dt=de("plus",Cu);/**
|
|
272
|
+
* @license lucide-react v0.515.0 - ISC
|
|
273
|
+
*
|
|
274
|
+
* This source code is licensed under the ISC license.
|
|
275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
+
*/const Eu=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],or=de("refresh-cw",Eu);/**
|
|
277
|
+
* @license lucide-react v0.515.0 - ISC
|
|
278
|
+
*
|
|
279
|
+
* This source code is licensed under the ISC license.
|
|
280
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
+
*/const Iu=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Rn=de("save",Iu);/**
|
|
282
|
+
* @license lucide-react v0.515.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/const Au=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Dr=de("search",Au);/**
|
|
287
|
+
* @license lucide-react v0.515.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/const Mu=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Wa=de("server",Mu);/**
|
|
292
|
+
* @license lucide-react v0.515.0 - ISC
|
|
293
|
+
*
|
|
294
|
+
* This source code is licensed under the ISC license.
|
|
295
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
+
*/const Tu=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Pr=de("settings",Tu);/**
|
|
297
|
+
* @license lucide-react v0.515.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/const Du=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Pu=de("settings-2",Du);/**
|
|
302
|
+
* @license lucide-react v0.515.0 - ISC
|
|
303
|
+
*
|
|
304
|
+
* This source code is licensed under the ISC license.
|
|
305
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
+
*/const Lu=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],ss=de("shield",Lu);/**
|
|
307
|
+
* @license lucide-react v0.515.0 - ISC
|
|
308
|
+
*
|
|
309
|
+
* This source code is licensed under the ISC license.
|
|
310
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
+
*/const Ru=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],kr=de("sparkles",Ru);/**
|
|
312
|
+
* @license lucide-react v0.515.0 - ISC
|
|
313
|
+
*
|
|
314
|
+
* This source code is licensed under the ISC license.
|
|
315
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
+
*/const zu=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],_u=de("square-check-big",zu);/**
|
|
317
|
+
* @license lucide-react v0.515.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/const Fu=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],$u=de("square-pen",Fu);/**
|
|
322
|
+
* @license lucide-react v0.515.0 - ISC
|
|
323
|
+
*
|
|
324
|
+
* This source code is licensed under the ISC license.
|
|
325
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
+
*/const Ou=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],qa=de("star",Ou);/**
|
|
327
|
+
* @license lucide-react v0.515.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/const Bu=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Co=de("sun",Bu);/**
|
|
332
|
+
* @license lucide-react v0.515.0 - ISC
|
|
333
|
+
*
|
|
334
|
+
* This source code is licensed under the ISC license.
|
|
335
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
+
*/const Uu=[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],Wu=de("table-properties",Uu);/**
|
|
337
|
+
* @license lucide-react v0.515.0 - ISC
|
|
338
|
+
*
|
|
339
|
+
* This source code is licensed under the ISC license.
|
|
340
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
+
*/const qu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Vu=de("target",qu);/**
|
|
342
|
+
* @license lucide-react v0.515.0 - ISC
|
|
343
|
+
*
|
|
344
|
+
* This source code is licensed under the ISC license.
|
|
345
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
+
*/const Hu=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Lr=de("terminal",Hu);/**
|
|
347
|
+
* @license lucide-react v0.515.0 - ISC
|
|
348
|
+
*
|
|
349
|
+
* This source code is licensed under the ISC license.
|
|
350
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
+
*/const Ju=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Xt=de("trash-2",Ju);/**
|
|
352
|
+
* @license lucide-react v0.515.0 - ISC
|
|
353
|
+
*
|
|
354
|
+
* This source code is licensed under the ISC license.
|
|
355
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
+
*/const Gu=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Xr=de("triangle-alert",Gu);/**
|
|
357
|
+
* @license lucide-react v0.515.0 - ISC
|
|
358
|
+
*
|
|
359
|
+
* This source code is licensed under the ISC license.
|
|
360
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
361
|
+
*/const Ku=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],jn=de("upload",Ku);/**
|
|
362
|
+
* @license lucide-react v0.515.0 - ISC
|
|
363
|
+
*
|
|
364
|
+
* This source code is licensed under the ISC license.
|
|
365
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
+
*/const Yu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],lt=de("x",Yu);/**
|
|
367
|
+
* @license lucide-react v0.515.0 - ISC
|
|
368
|
+
*
|
|
369
|
+
* This source code is licensed under the ISC license.
|
|
370
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
371
|
+
*/const Qu=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ms=de("zap",Qu),Vt=({className:t="w-5 h-5"})=>e.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:t}),Zt=({className:t="w-5 h-5"})=>e.jsx("img",{src:"/icons/cursor.svg",alt:"Cursor",className:t}),Xu=({status:t="not-configured",size:r="sm",className:n="",showLabel:s=!1})=>{const i=(()=>{switch(t){case"fully-configured":return{icon:ln,color:"text-green-500 dark:text-green-400",bgColor:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"};case"taskmaster-only":return{icon:Pr,color:"text-blue-500 dark:text-blue-400",bgColor:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"};case"mcp-only":return{icon:ra,color:"text-amber-500 dark:text-amber-400",bgColor:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"};case"not-configured":case"error":default:return{icon:lt,color:"text-gray-400 dark:text-gray-500",bgColor:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"}}})(),o=i.icon,l={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},d={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"};return s?e.jsxs("div",{className:Se("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",i.bgColor,i.color,n),title:i.title,children:[e.jsx(o,{className:l[r]}),e.jsx("span",{className:"font-medium",children:i.label})]}):e.jsx("div",{className:Se("inline-flex items-center justify-center rounded-full transition-colors",i.bgColor,d[r],n),title:i.title,children:e.jsx(o,{className:Se(l[r],i.color)})})},Re=(t,r={})=>{const n=localStorage.getItem("auth-token"),s={"Content-Type":"application/json"};return n&&(s.Authorization=`Bearer ${n}`),fetch(t,{...r,headers:{...s,...r.headers}})},Je={auth:{status:()=>fetch("/api/auth/status"),login:(t,r)=>fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:r})}),register:(t,r)=>fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:r})}),user:()=>Re("/api/auth/user"),logout:()=>Re("/api/auth/logout",{method:"POST"})},config:()=>Re("/api/config"),projects:()=>Re("/api/projects"),sessions:(t,r=5,n=0)=>Re(`/api/projects/${t}/sessions?limit=${r}&offset=${n}`),sessionMessages:(t,r,n=null,s=0)=>{const a=new URLSearchParams;n!==null&&(a.append("limit",n),a.append("offset",s));const i=a.toString(),o=`/api/projects/${t}/sessions/${r}/messages${i?`?${i}`:""}`;return Re(o)},renameProject:(t,r)=>Re(`/api/projects/${t}/rename`,{method:"PUT",body:JSON.stringify({displayName:r})}),deleteSession:(t,r)=>Re(`/api/projects/${t}/sessions/${r}`,{method:"DELETE"}),deleteProject:t=>Re(`/api/projects/${t}`,{method:"DELETE"}),createProject:t=>Re("/api/projects/create",{method:"POST",body:JSON.stringify({path:t})}),readFile:(t,r)=>Re(`/api/projects/${t}/file?filePath=${encodeURIComponent(r)}`),saveFile:(t,r,n)=>Re(`/api/projects/${t}/file`,{method:"PUT",body:JSON.stringify({filePath:r,content:n})}),getFiles:t=>Re(`/api/projects/${t}/files`),transcribe:t=>Re("/api/transcribe",{method:"POST",body:t,headers:{}}),taskmaster:{init:t=>Re(`/api/taskmaster/init/${t}`,{method:"POST"}),addTask:(t,{prompt:r,title:n,description:s,priority:a,dependencies:i})=>Re(`/api/taskmaster/add-task/${t}`,{method:"POST",body:JSON.stringify({prompt:r,title:n,description:s,priority:a,dependencies:i})}),parsePRD:(t,{fileName:r,numTasks:n,append:s})=>Re(`/api/taskmaster/parse-prd/${t}`,{method:"POST",body:JSON.stringify({fileName:r,numTasks:n,append:s})}),getTemplates:()=>Re("/api/taskmaster/prd-templates"),applyTemplate:(t,{templateId:r,fileName:n,customizations:s})=>Re(`/api/taskmaster/apply-template/${t}`,{method:"POST",body:JSON.stringify({templateId:r,fileName:n,customizations:s})}),updateTask:(t,r,n)=>Re(`/api/taskmaster/update-task/${t}/${r}`,{method:"PUT",body:JSON.stringify(n)})},browseFilesystem:(t=null)=>{const r=new URLSearchParams;return t&&r.append("path",t),Re(`/api/browse-filesystem?${r}`)},get:t=>Re(`/api${t}`)},Eo=p.createContext({user:null,token:null,login:()=>{},register:()=>{},logout:()=>{},isLoading:!0,needsSetup:!1,error:null}),Wn=()=>{const t=p.useContext(Eo);if(!t)throw new Error("useAuth must be used within an AuthProvider");return t},Zu=({children:t})=>{const[r,n]=p.useState(null),[s,a]=p.useState(localStorage.getItem("auth-token")),[i,o]=p.useState(!0),[l,d]=p.useState(!1),[c,u]=p.useState(null);p.useEffect(()=>{h()},[]);const h=async()=>{try{if(o(!0),u(null),(await(await Je.auth.status()).json()).needsSetup){d(!0),o(!1);return}if(s)try{const T=await Je.auth.user();if(T.ok){const j=await T.json();n(j.user),d(!1)}else localStorage.removeItem("auth-token"),a(null),n(null)}catch(T){console.error("Token verification failed:",T),localStorage.removeItem("auth-token"),a(null),n(null)}}catch(E){console.error("Auth status check failed:",E),u("Failed to check authentication status")}finally{o(!1)}},v={user:r,token:s,login:async(E,A)=>{try{u(null);const T=await Je.auth.login(E,A),j=await T.json();return T.ok?(a(j.token),n(j.user),localStorage.setItem("auth-token",j.token),{success:!0}):(u(j.error||"Login failed"),{success:!1,error:j.error||"Login failed"})}catch(T){console.error("Login error:",T);const j="Network error. Please try again.";return u(j),{success:!1,error:j}}},register:async(E,A)=>{try{u(null);const T=await Je.auth.register(E,A),j=await T.json();return T.ok?(a(j.token),n(j.user),d(!1),localStorage.setItem("auth-token",j.token),{success:!0}):(u(j.error||"Registration failed"),{success:!1,error:j.error||"Registration failed"})}catch(T){console.error("Registration error:",T);const j="Network error. Please try again.";return u(j),{success:!1,error:j}}},logout:()=>{a(null),n(null),localStorage.removeItem("auth-token"),s&&Je.auth.logout().catch(E=>{console.error("Logout endpoint error:",E)})},isLoading:i,needsSetup:l,error:c};return e.jsx(Eo.Provider,{value:v,children:t})};function em(){const[t,r]=p.useState(null),[n,s]=p.useState([]),[a,i]=p.useState(!1),o=p.useRef(null);p.useEffect(()=>(l(),()=>{o.current&&clearTimeout(o.current),t&&t.close()}),[]);const l=async()=>{try{const c=localStorage.getItem("auth-token");if(!c){console.warn("No authentication token found for WebSocket connection");return}let u;try{if(u=(await(await fetch("/api/config",{headers:{Authorization:`Bearer ${c}`}})).json()).wsUrl,u.includes("localhost")&&!window.location.hostname.includes("localhost")){console.warn("Config returned localhost, using current host with API server port instead");const v=window.location.protocol==="https:"?"wss:":"ws:",E=window.location.port==="3001"?"3002":window.location.port;u=`${v}//${window.location.hostname}:${E}`}}catch{console.warn("Could not fetch server config, falling back to current host with API server port");const y=window.location.protocol==="https:"?"wss:":"ws:",v=window.location.port==="3001"?"3002":window.location.port;u=`${y}//${window.location.hostname}:${v}`}const h=`${u}/ws?token=${encodeURIComponent(c)}`,x=new WebSocket(h);x.onopen=()=>{i(!0),r(x)},x.onmessage=m=>{try{const y=JSON.parse(m.data);s(v=>[...v,y])}catch(y){console.error("Error parsing WebSocket message:",y)}},x.onclose=()=>{i(!1),r(null),o.current=setTimeout(()=>{l()},3e3)},x.onerror=m=>{console.error("WebSocket error:",m)}}catch(c){console.error("Error creating WebSocket connection:",c)}};return{ws:t,sendMessage:c=>{t&&a?t.send(JSON.stringify(c)):console.warn("WebSocket not connected")},messages:n,isConnected:a}}const Io=p.createContext({ws:null,sendMessage:()=>{},messages:[],isConnected:!1}),Ao=()=>{const t=p.useContext(Io);if(!t)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return t},tm=({children:t})=>{const r=em();return e.jsx(Io.Provider,{value:r,children:t})},Mo=p.createContext({projects:[],currentProject:null,projectTaskMaster:null,mcpServerStatus:null,tasks:[],nextTask:null,isLoading:!1,isLoadingTasks:!1,isLoadingMCP:!1,error:null,refreshProjects:()=>{},setCurrentProject:()=>{},refreshTasks:()=>{},refreshMCPStatus:()=>{},clearError:()=>{}}),dn=()=>{const t=p.useContext(Mo);if(!t)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return t},rm=({children:t})=>{const{messages:r}=Ao(),{user:n,token:s,isLoading:a}=Wn(),[i,o]=p.useState([]),[l,d]=p.useState(null),[c,u]=p.useState(null),[h,x]=p.useState(null),[m,y]=p.useState([]),[v,E]=p.useState(null),[A,T]=p.useState(!1),[j,W]=p.useState(!1),[Z,D]=p.useState(!1),[q,M]=p.useState(null),_=(K,B)=>{console.error(`TaskMaster ${B} error:`,K),M({message:K.message||`Failed to ${B}`,context:B,timestamp:new Date().toISOString()})},R=p.useCallback(()=>{M(null)},[]),L=p.useCallback(async()=>{if(!n||!s){o([]),d(null);return}try{T(!0),R();const K=await Je.get("/projects");if(!K.ok)throw new Error(`Failed to fetch projects: ${K.status}`);const B=await K.json();if(!Array.isArray(B)){console.error("Projects API returned non-array data:",B),o([]);return}const G=B.map(ie=>({...ie,taskMasterConfigured:ie.taskmaster?.hasTaskmaster||!1,taskMasterStatus:ie.taskmaster?.status||"not-configured",taskCount:ie.taskmaster?.metadata?.taskCount||0,completedCount:ie.taskmaster?.metadata?.completed||0}));if(o(G),l){const ie=G.find(N=>N.name===l.name);ie&&(d(ie),u(ie.taskmaster))}}catch(K){_(K,"load projects")}finally{T(!1)}},[n,s]),C=p.useCallback(async K=>{try{if(d(K),y([]),E(null),u(null),K?.name)try{const B=await Je.get(`/taskmaster/detect/${encodeURIComponent(K.name)}`);if(B.ok){const G=await B.json();u(G.taskmaster)}else console.warn("Individual TaskMaster detection failed, using project data:",B.status),u(K.taskmaster||null)}catch(B){console.warn("TaskMaster detection error, using project data:",B.message),u(K.taskmaster||null)}else u(null)}catch(B){console.error("Error in setCurrentProject:",B),_(B,"set current project"),u(K?.taskmaster||null)}},[]),I=p.useCallback(async()=>{if(!n||!s){x(null);return}try{D(!0),R();const K=await Je.get("/mcp-utils/taskmaster-server");x(K)}catch(K){_(K,"check MCP server status")}finally{D(!1)}},[n,s]),b=p.useCallback(async()=>{if(!l){y([]),E(null);return}if(!n||!s){y([]),E(null);return}try{W(!0),R();const K=await Je.get(`/taskmaster/tasks/${encodeURIComponent(l.name)}`);if(!K.ok){const ie=await K.json();throw new Error(ie.message||"Failed to load tasks")}const B=await K.json();y(B.tasks||[]);const G=B.tasks?.find(ie=>ie.status==="pending"||ie.status==="in-progress")||null;E(G)}catch(K){console.error("Error loading tasks:",K),_(K,"load tasks"),y([]),E(null)}finally{W(!1)}},[l,n,s]);p.useEffect(()=>{!a&&n&&s?(L(),I()):console.log("Auth not ready or no user, skipping project load:",{authLoading:a,user:!!n,token:!!s})},[L,I,a,n,s]),p.useEffect(()=>{n&&s&&R()},[n,s,R]),p.useEffect(()=>{l?.name&&n&&s&&b()},[l?.name,n,s,b]),p.useEffect(()=>{const K=r[r.length-1];if(K)switch(K.type){case"taskmaster-project-updated":K.projectName&&L();break;case"taskmaster-tasks-updated":K.projectName===l?.name&&b();break;case"taskmaster-mcp-status-changed":I();break}},[r,L,b,I,l]);const z={projects:i,currentProject:l,projectTaskMaster:c,mcpServerStatus:h,tasks:m,nextTask:v,isLoading:A,isLoadingTasks:j,isLoadingMCP:Z,error:q,refreshProjects:L,setCurrentProject:C,refreshTasks:b,refreshMCPStatus:I,clearError:R};return e.jsx(Mo.Provider,{value:z,children:t})},To=p.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),un=()=>{const t=p.useContext(To);if(!t)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return t},nm=({children:t})=>{const[r,n]=p.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[s,a]=p.useState(null),[i,o]=p.useState(null),[l,d]=p.useState(null),[c,u]=p.useState(!0);p.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(r))},[r]),p.useEffect(()=>{setTimeout(async()=>{try{const y=await Je.get("/taskmaster/installation-status");if(y.ok){const v=await y.json();d(v),a(v.installation?.isInstalled||!1),o(v.isReady||!1);const E=localStorage.getItem("tasks-enabled");!v.installation?.isInstalled&&!E&&n(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(y){console.error("Error checking TaskMaster installation:",y),a(!1),o(!1)}finally{u(!1)}},0)},[]);const x={tasksEnabled:r,setTasksEnabled:n,toggleTasksEnabled:()=>{n(m=>!m)},isTaskMasterInstalled:s,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:c};return e.jsx(To.Provider,{value:x,children:t})},Va=(t,r)=>{const n=new Date(t),s=r;if(isNaN(n.getTime()))return"Unknown";const a=s-n,i=Math.floor(a/1e3),o=Math.floor(a/(1e3*60)),l=Math.floor(a/(1e3*60*60)),d=Math.floor(a/(1e3*60*60*24));return i<60?"Just now":o===1?"1 min ago":o<60?`${o} mins ago`:l===1?"1 hour ago":l<24?`${l} hours ago`:d===1?"1 day ago":d<7?`${d} days ago`:n.toLocaleDateString()};function Ha({projects:t,selectedProject:r,selectedSession:n,onProjectSelect:s,onSessionSelect:a,onNewSession:i,onSessionDelete:o,onProjectDelete:l,isLoading:d,onRefresh:c,onShowSettings:u,updateAvailable:h,latestVersion:x,currentVersion:m,onShowVersionModal:y,isPWA:v,isMobile:E}){const[A,T]=p.useState(new Set),[j,W]=p.useState(null),[Z,D]=p.useState(!1),[q,M]=p.useState(""),[_,R]=p.useState(""),[L,C]=p.useState(!1),[I,b]=p.useState({}),[z,K]=p.useState({}),[B,G]=p.useState(new Set),[ie,N]=p.useState(new Date),[Ie,Fe]=p.useState("name"),[f,te]=p.useState(!1),[ue,re]=p.useState(null),[Ce,Be]=p.useState(""),[ee,oe]=p.useState({}),[xe,Ne]=p.useState(""),[ye,Ue]=p.useState(!1),[Ye,nt]=p.useState([]),[me,pe]=p.useState([]),[Me,et]=p.useState(-1),{setCurrentProject:it,mcpServerStatus:ge}=dn(),{tasksEnabled:wt}=un(),[X,ke]=p.useState(()=>{try{const g=localStorage.getItem("starredProjects");return g?new Set(JSON.parse(g)):new Set}catch(g){return console.error("Error loading starred projects:",g),new Set}}),k=g=>U=>{U.target.closest(".overflow-y-auto")||U.target.closest("[data-scroll-container]")||(U.preventDefault(),U.stopPropagation(),g())};p.useEffect(()=>{const g=setInterval(()=>{N(new Date)},6e4);return()=>clearInterval(g)},[]),p.useEffect(()=>{K({}),G(new Set)},[t]),p.useEffect(()=>{n&&r&&T(g=>new Set([...g,r.name]))},[n,r]),p.useEffect(()=>{if(t.length>0&&!d){const g=new Set;t.forEach(U=>{U.sessions&&U.sessions.length>=0&&g.add(U.name)}),G(g)}},[t,d]),p.useEffect(()=>{const g=()=>{try{const we=localStorage.getItem("claude-settings");if(we){const V=JSON.parse(we);Fe(V.projectSortOrder||"name")}}catch(we){console.error("Error loading sort order:",we)}};g();const U=we=>{we.key==="claude-settings"&&g()};window.addEventListener("storage",U);const ce=setInterval(()=>{document.hasFocus()&&g()},1e3);return()=>{window.removeEventListener("storage",U),clearInterval(ce)}},[]),p.useEffect(()=>{(async()=>{try{const U=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]"),we=await(await Je.browseFilesystem()).json();if(we.suggestions){const V=we.suggestions.map(S=>({name:S.name,path:S.path})),Ve=[...U.map(S=>({name:S.split("/").pop(),path:S})),...V];nt(Ve)}else nt(U.map(V=>({name:V.split("/").pop(),path:V})))}catch(U){console.error("Error loading paths:",U);const ce=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]");nt(ce.map(we=>({name:we.split("/").pop(),path:we})))}})()},[]),p.useEffect(()=>{const g=_.trim();if(g.length===0){Ue(!1);return}Ue(!0),(async()=>{const ce=Ye.filter(V=>V.name.toLowerCase().includes(g.toLowerCase())||V.path.toLowerCase().includes(g.toLowerCase()));if(g.includes("/")&&g.length>1)try{let V;if(g.endsWith("/"))V=g.slice(0,-1);else{const Ve=g.lastIndexOf("/");V=g.substring(0,Ve)}if(V&&V!==""){const S=await(await Je.browseFilesystem(V)).json();if(S.suggestions){const ae=g.substring(g.lastIndexOf("/")+1),We=[...S.suggestions.filter(at=>{const kt=at.name;return ae?kt.toLowerCase().startsWith(ae.toLowerCase()):!0}).map(at=>({name:at.name,path:at.path})).slice(0,8),...ce].slice(0,8);pe(We),et(-1);return}}}catch(V){console.debug("Dynamic browsing failed:",V.message)}pe(ce.slice(0,8)),et(-1)})()},[_,Ye]);const P=g=>{R(g.path),Ue(!1),et(-1)},J=g=>{try{const U=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]"),ce=[g,...U.filter(we=>we!==g)].slice(0,10);localStorage.setItem("recentProjectPaths",JSON.stringify(ce))}catch(U){console.error("Error saving recent paths:",U)}},se=g=>{const U=new Set;A.has(g)||U.add(g),T(U)},le=(g,U)=>{a({...g,__projectName:U})},Le=g=>{const U=new Set(X);U.has(g)?U.delete(g):U.add(g),ke(U);try{localStorage.setItem("starredProjects",JSON.stringify([...U]))}catch(ce){console.error("Error saving starred projects:",ce)}},De=g=>X.has(g),Ge=g=>{const U=[...g.sessions||[],...z[g.name]||[]].map(V=>({...V,__provider:"claude"})),ce=(g.cursorSessions||[]).map(V=>({...V,__provider:"cursor"})),we=V=>new Date(V.__provider==="cursor"?V.createdAt:V.lastActivity);return[...U,...ce].sort((V,Ve)=>we(Ve)-we(V))},mt=g=>{const U=Ge(g);return U.length===0?new Date(0):U.reduce((we,V)=>{const Ve=new Date(V.lastActivity);return Ve>we?Ve:we},new Date(0))},Ze=[...t].sort((g,U)=>{const ce=De(g.name),we=De(U.name);if(ce&&!we)return-1;if(!ce&&we)return 1;if(Ie==="date")return mt(U)-mt(g);{const V=g.displayName||g.name,Ve=U.displayName||U.name;return V.localeCompare(Ve)}}),st=g=>{W(g.name),M(g.displayName)},ht=()=>{W(null),M("")},ct=async g=>{try{(await Je.renameProject(g,q)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(U){console.error("Error renaming project:",U)}W(null),M("")},Lt=async(g,U)=>{if(confirm("Are you sure you want to delete this session? This action cannot be undone."))try{(await Je.deleteSession(g,U)).ok?o&&o(U):(console.error("Failed to delete session"),alert("Failed to delete session. Please try again."))}catch(ce){console.error("Error deleting session:",ce),alert("Error deleting session. Please try again.")}},Rt=async g=>{if(confirm("Are you sure you want to delete this empty project? This action cannot be undone."))try{const U=await Je.deleteProject(g);if(U.ok)l&&l(g);else{const ce=await U.json();console.error("Failed to delete project"),alert(ce.error||"Failed to delete project. Please try again.")}}catch(U){console.error("Error deleting project:",U),alert("Error deleting project. Please try again.")}},jt=async()=>{if(!_.trim()){alert("Please enter a project path");return}C(!0);try{const g=await Je.createProject(_.trim());if(g.ok){const U=await g.json();J(_.trim()),D(!1),R(""),setShowSuggestions(!1),window.refreshProjects?window.refreshProjects():window.location.reload()}else{const U=await g.json();alert(U.error||"Failed to create project. Please try again.")}}catch(g){console.error("Error creating project:",g),alert("Error creating project. Please try again.")}finally{C(!1)}},yt=()=>{D(!1),R(""),setShowSuggestions(!1)},mr=async g=>{if(!(!(g.sessionMeta?.hasMore!==!1)||I[g.name])){b(ce=>({...ce,[g.name]:!0}));try{const ce=(g.sessions?.length||0)+(z[g.name]?.length||0),we=await Je.sessions(g.name,5,ce);if(we.ok){const V=await we.json();K(Ve=>({...Ve,[g.name]:[...Ve[g.name]||[],...V.sessions]})),V.hasMore===!1&&(g.sessionMeta={...g.sessionMeta,hasMore:!1})}}catch(ce){console.error("Error loading more sessions:",ce)}finally{b(ce=>({...ce,[g.name]:!1}))}}},ft=Ze.filter(g=>{if(!xe.trim())return!0;const U=xe.toLowerCase(),ce=(g.displayName||g.name).toLowerCase(),we=g.name.toLowerCase();return ce.includes(U)||we.includes(U)}),F=g=>{s(g),it(g)};return e.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:v&&E?{paddingTop:"44px"}:{},children:[e.jsxs("div",{className:"md:p-4 md:border-b md:border-border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:e.jsx(nn,{className:"w-4 h-4 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Claude Code UI"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"AI coding assistant interface"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Oe,{variant:"ghost",size:"sm",className:"h-9 w-9 px-0 hover:bg-accent transition-colors duration-200 group",onClick:async()=>{te(!0);try{await c()}finally{te(!1)}},disabled:f,title:"Refresh projects and sessions (Ctrl+R)",children:e.jsx(or,{className:`w-4 h-4 ${f?"animate-spin":""} group-hover:rotate-180 transition-transform duration-300`})}),e.jsx(Oe,{variant:"default",size:"sm",className:"h-9 w-9 px-0 bg-primary hover:bg-primary/90 transition-all duration-200 shadow-sm hover:shadow-md",onClick:()=>D(!0),title:"Create new project (Ctrl+N)",children:e.jsx(vn,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"md:hidden p-3 border-b border-border",style:v&&E?{paddingTop:"16px"}:{},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:e.jsx(nn,{className:"w-4 h-4 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Claude Code UI"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Projects"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:async()=>{te(!0);try{await c()}finally{te(!1)}},disabled:f,children:e.jsx(or,{className:`w-4 h-4 text-foreground ${f?"animate-spin":""}`})}),e.jsx("button",{className:"w-8 h-8 rounded-md bg-primary text-primary-foreground flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>D(!0),children:e.jsx(vn,{className:"w-4 h-4"})})]})]})})]}),Z&&e.jsxs("div",{className:"md:p-3 md:border-b md:border-border md:bg-muted/30",children:[e.jsxs("div",{className:"hidden md:block space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[e.jsx(vn,{className:"w-4 h-4"}),"Create New Project"]}),e.jsxs("div",{className:"relative",children:[e.jsx(_t,{value:_,onChange:g=>R(g.target.value),placeholder:"/path/to/project or relative/path",className:"text-sm focus:ring-2 focus:ring-primary/20",autoFocus:!0,onKeyDown:g=>{if(ye&&me.length>0){if(g.key==="ArrowDown")g.preventDefault(),et(U=>U<me.length-1?U+1:0);else if(g.key==="ArrowUp")g.preventDefault(),et(U=>U>0?U-1:me.length-1);else if(g.key==="Enter"){g.preventDefault(),Me>=0?P(me[Me]):me.length>0?P(me[0]):jt();return}else if(g.key==="Escape"){g.preventDefault(),Ue(!1);return}else if(g.key==="Tab"){g.preventDefault(),Me>=0?P(me[Me]):me.length>0&&P(me[0]);return}}g.key==="Enter"&&jt(),g.key==="Escape"&&yt()}}),ye&&me.length>0&&e.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-md shadow-lg max-h-48 overflow-y-auto z-50",children:me.map((g,U)=>e.jsx("div",{className:`px-3 py-2 cursor-pointer border-b border-border last:border-b-0 ${U===Me?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:ce=>{ce.preventDefault(),ce.stopPropagation()},onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),P(g)},children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:g.name}),e.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:g.path})]})]})},g.path))})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Oe,{size:"sm",onClick:jt,disabled:!_.trim()||L,className:"flex-1 h-8 text-xs hover:bg-primary/90 transition-colors",children:L?"Creating...":"Create Project"}),e.jsx(Oe,{size:"sm",variant:"outline",onClick:yt,disabled:L,className:"h-8 text-xs hover:bg-accent transition-colors",children:"Cancel"})]})]}),e.jsx("div",{className:"md:hidden fixed inset-0 z-[70] bg-black/50 backdrop-blur-sm flex items-end justify-center px-4 pb-24",children:e.jsxs("div",{className:"w-full max-w-sm bg-card rounded-t-lg border-t border-border p-4 space-y-4 animate-in slide-in-from-bottom duration-300",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 bg-primary/10 rounded-md flex items-center justify-center",children:e.jsx(vn,{className:"w-3 h-3 text-primary"})}),e.jsx("div",{children:e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"New Project"})})]}),e.jsx("button",{onClick:yt,disabled:L,className:"w-6 h-6 rounded-md bg-muted flex items-center justify-center active:scale-95 transition-transform",children:e.jsx(lt,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(_t,{value:_,onChange:g=>R(g.target.value),placeholder:"/path/to/project or relative/path",className:"text-sm h-10 rounded-md focus:border-primary transition-colors",autoFocus:!0,onKeyDown:g=>{if(ye&&me.length>0){if(g.key==="ArrowDown")g.preventDefault(),et(U=>U<me.length-1?U+1:0);else if(g.key==="ArrowUp")g.preventDefault(),et(U=>U>0?U-1:me.length-1);else if(g.key==="Enter"){g.preventDefault(),Me>=0?P(me[Me]):me.length>0?P(me[0]):jt();return}else if(g.key==="Escape"){g.preventDefault(),Ue(!1);return}}g.key==="Enter"&&jt(),g.key==="Escape"&&yt()},style:{fontSize:"16px",WebkitAppearance:"none"}}),ye&&me.length>0&&e.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-popover border border-border rounded-md shadow-lg max-h-40 overflow-y-auto",children:me.map((g,U)=>e.jsx("div",{className:`px-3 py-2.5 cursor-pointer border-b border-border last:border-b-0 active:scale-95 transition-all ${U===Me?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:ce=>{ce.preventDefault(),ce.stopPropagation()},onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),P(g)},children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:g.name}),e.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:g.path})]})]})},g.path))})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Oe,{onClick:yt,disabled:L,variant:"outline",className:"flex-1 h-9 text-sm rounded-md active:scale-95 transition-transform",children:"Cancel"}),e.jsx(Oe,{onClick:jt,disabled:!_.trim()||L,className:"flex-1 h-9 text-sm rounded-md bg-primary hover:bg-primary/90 active:scale-95 transition-all",children:L?"Creating...":"Create"})]})]}),e.jsx("div",{className:"h-4"})]})})]}),t.length>0&&!d&&e.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:e.jsxs("div",{className:"relative",children:[e.jsx(Dr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(_t,{type:"text",placeholder:"Search projects...",value:xe,onChange:g=>Ne(g.target.value),className:"pl-9 h-9 text-sm bg-muted/50 border-0 focus:bg-background focus:ring-1 focus:ring-primary/20"}),xe&&e.jsx("button",{onClick:()=>Ne(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 hover:bg-accent rounded",children:e.jsx(lt,{className:"w-3 h-3 text-muted-foreground"})})]})}),e.jsx(ea,{className:"flex-1 md:px-2 md:py-3 overflow-y-auto overscroll-contain",children:e.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:d?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"Loading projects..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Fetching your Claude projects and sessions"})]}):t.length===0?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(Wt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No projects found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Run Claude CLI in a project directory to get started"})]}):ft.length===0?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(Dr,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No matching projects"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Try adjusting your search term"})]}):ft.map(g=>{const U=A.has(g.name),ce=r?.name===g.name,we=De(g.name);return e.jsxs("div",{className:"md:space-y-1",children:[e.jsxs("div",{className:"group md:group",children:[e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:Se("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",ce&&"bg-primary/5 border-primary/20",we&&!ce&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{se(g.name)},onTouchEnd:k(()=>se(g.name)),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:Se("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",U?"bg-primary/10":"bg-muted"),children:U?e.jsx(yr,{className:"w-4 h-4 text-primary"}):e.jsx(Wt,{className:"w-4 h-4 text-muted-foreground"})}),e.jsx("div",{className:"min-w-0 flex-1",children:j===g.name?e.jsx("input",{type:"text",value:q,onChange:V=>M(V.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:"Project name",autoFocus:!0,autoComplete:"off",onClick:V=>V.stopPropagation(),onKeyDown:V=>{V.key==="Enter"&&ct(g.name),V.key==="Escape"&&ht()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between min-w-0 flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:g.displayName}),wt&&e.jsx(Xu,{status:(()=>{const V=g.taskmaster?.hasTaskmaster,Ve=ge?.hasMCPServer&&ge?.isConfigured;return V&&Ve?"fully-configured":V?"taskmaster-only":Ve?"mcp-only":"not-configured"})(),size:"xs",className:"hidden md:inline-flex flex-shrink-0 ml-2"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(()=>{const V=Ge(g).length,S=g.sessionMeta?.hasMore!==!1&&V>=5?`${V}+`:V;return`${S} session${S===1?"":"s"}`})()})]})})]}),e.jsx("div",{className:"flex items-center gap-1",children:j===g.name?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:V=>{V.stopPropagation(),ct(g.name)},children:e.jsx(Ir,{className:"w-4 h-4 text-white"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:V=>{V.stopPropagation(),ht()},children:e.jsx(lt,{className:"w-4 h-4 text-white"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:Se("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",we?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:V=>{V.stopPropagation(),Le(g.name)},onTouchEnd:k(()=>Le(g.name)),title:we?"Remove from favorites":"Add to favorites",children:e.jsx(qa,{className:Se("w-4 h-4 transition-colors",we?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),Ge(g).length===0&&e.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:V=>{V.stopPropagation(),Rt(g.name)},onTouchEnd:k(()=>Rt(g.name)),children:e.jsx(Xt,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:V=>{V.stopPropagation(),st(g)},onTouchEnd:k(()=>st(g)),children:e.jsx(As,{className:"w-4 h-4 text-primary"})}),e.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:U?e.jsx($t,{className:"w-3 h-3 text-muted-foreground"}):e.jsx(cr,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),e.jsxs(Oe,{variant:"ghost",className:Se("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",ce&&"bg-accent text-accent-foreground",we&&!ce&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:()=>{r?.name!==g.name&&F(g),se(g.name)},onTouchEnd:k(()=>{r?.name!==g.name&&F(g),se(g.name)}),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[U?e.jsx(yr,{className:"w-4 h-4 text-primary flex-shrink-0"}):e.jsx(Wt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"min-w-0 flex-1 text-left",children:j===g.name?e.jsxs("div",{className:"space-y-1",children:[e.jsx("input",{type:"text",value:q,onChange:V=>M(V.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:"Project name",autoFocus:!0,onKeyDown:V=>{V.key==="Enter"&&ct(g.name),V.key==="Escape"&&ht()}}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",title:g.fullPath,children:g.fullPath})]}):e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:g.displayName,children:g.displayName}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[(()=>{const V=Ge(g).length;return g.sessionMeta?.hasMore!==!1&&V>=5?`${V}+`:V})(),g.fullPath!==g.displayName&&e.jsxs("span",{className:"ml-1 opacity-60",title:g.fullPath,children:["β’ ",g.fullPath.length>25?"..."+g.fullPath.slice(-22):g.fullPath]})]})]})})]}),e.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:j===g.name?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:V=>{V.stopPropagation(),ct(g.name)},children:e.jsx(Ir,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:V=>{V.stopPropagation(),ht()},children:e.jsx(lt,{className:"w-3 h-3"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:Se("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",we?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:V=>{V.stopPropagation(),Le(g.name)},title:we?"Remove from favorites":"Add to favorites",children:e.jsx(qa,{className:Se("w-3 h-3 transition-colors",we?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:V=>{V.stopPropagation(),st(g)},title:"Rename project (F2)",children:e.jsx(As,{className:"w-3 h-3"})}),Ge(g).length===0&&e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:V=>{V.stopPropagation(),Rt(g.name)},title:"Delete empty project (Delete)",children:e.jsx(Xt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),U?e.jsx($t,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):e.jsx(cr,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),U&&e.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[B.has(g.name)?Ge(g).length===0&&!I[g.name]?e.jsx("div",{className:"py-2 px-3 text-left",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions yet"})}):Ge(g).map(V=>{const Ve=V.__provider==="cursor",S=new Date(Ve?V.createdAt:V.lastActivity),Ae=Math.floor((ie-S)/(1e3*60))<10,We=Ve?V.name||"Untitled Session":V.summary||"New Session",at=Ve?V.createdAt:V.lastActivity,kt=V.messageCount||0;return e.jsxs("div",{className:"group relative",children:[Ae&&e.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:Se("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",n?.id===V.id?"bg-primary/5 border-primary/20":Ae?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{F(g),le(V,g.name)},onTouchEnd:k(()=>{F(g),le(V,g.name)}),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:Se("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",n?.id===V.id?"bg-primary/10":"bg-muted/50"),children:Ve?e.jsx(Zt,{className:"w-3 h-3"}):e.jsx(Vt,{className:"w-3 h-3"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:We}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(rn,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Va(at,ie)}),kt>0&&e.jsx(br,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:kt}),e.jsx("span",{className:"ml-1 opacity-70",children:Ve?e.jsx(Zt,{className:"w-3 h-3"}):e.jsx(Vt,{className:"w-3 h-3"})})]})]}),!Ve&&e.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:tt=>{tt.stopPropagation(),Lt(g.name,V.id)},onTouchEnd:k(()=>Lt(g.name,V.id)),children:e.jsx(Xt,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),e.jsxs("div",{className:"hidden md:block",children:[e.jsx(Oe,{variant:"ghost",className:Se("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",n?.id===V.id&&"bg-accent text-accent-foreground"),onClick:()=>le(V,g.name),onTouchEnd:k(()=>le(V,g.name)),children:e.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[Ve?e.jsx(Zt,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):e.jsx(Vt,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:We}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(rn,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Va(at,ie)}),kt>0&&e.jsx(br,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:kt}),e.jsx("span",{className:"ml-1 opacity-70",children:Ve?e.jsx(Zt,{className:"w-3 h-3"}):e.jsx(Vt,{className:"w-3 h-3"})})]})]})]})}),!Ve&&e.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all duration-200",children:ue===V.id?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:Ce,onChange:tt=>Be(tt.target.value),onKeyDown:tt=>{tt.stopPropagation(),tt.key==="Enter"?updateSessionSummary(g.name,V.id,Ce):tt.key==="Escape"&&(re(null),Be(""))},onClick:tt=>tt.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),e.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:tt=>{tt.stopPropagation(),updateSessionSummary(g.name,V.id,Ce)},title:"Save",children:e.jsx(Ir,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),e.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:tt=>{tt.stopPropagation(),re(null),Be("")},title:"Cancel",children:e.jsx(lt,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:tt=>{tt.stopPropagation(),re(V.id),Be(V.summary||"New Session")},title:"Manually edit session name",children:e.jsx(ju,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{className:"w-6 h-6 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:tt=>{tt.stopPropagation(),Lt(g.name,V.id)},title:"Delete this session permanently",children:e.jsx(Xt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},V.id)}):Array.from({length:3}).map((V,Ve)=>e.jsx("div",{className:"p-2 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+Ve*15}%`}}),e.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},Ve)),Ge(g).length>0&&g.sessionMeta?.hasMore!==!1&&e.jsx(Oe,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>mr(g),disabled:I[g.name],children:I[g.name]?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),"Loading..."]}):e.jsxs(e.Fragment,{children:[e.jsx($t,{className:"w-3 h-3"}),"Show more sessions"]})}),e.jsx("div",{className:"md:hidden px-3 pb-2",children:e.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{F(g),i(g)},children:[e.jsx(Dt,{className:"w-3 h-3"}),"New Session"]})}),e.jsxs(Oe,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>i(g),children:[e.jsx(Dt,{className:"w-3 h-3"}),"New Session"]})]})]},g.name)})})}),h&&e.jsxs("div",{className:"md:p-2 border-t border-border/50 flex-shrink-0",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Oe,{variant:"ghost",className:"w-full justify-start gap-3 p-3 h-auto font-normal text-left hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors duration-200 border border-blue-200 dark:border-blue-700 rounded-lg mb-2",onClick:y,children:[e.jsxs("div",{className:"relative",children:[e.jsx("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})}),e.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:"Update Available"}),e.jsxs("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:["Version ",x," is ready"]})]})]})}),e.jsx("div",{className:"md:hidden p-3 pb-2",children:e.jsxs("button",{className:"w-full h-12 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-xl flex items-center justify-start gap-3 px-4 active:scale-[0.98] transition-all duration-150",onClick:y,children:[e.jsxs("div",{className:"relative",children:[e.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})}),e.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),e.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[e.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:"Update Available"}),e.jsxs("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:["Version ",x," is ready"]})]})]})})]}),e.jsxs("div",{className:"md:p-2 md:border-t md:border-border flex-shrink-0",children:[e.jsx("div",{className:"md:hidden p-4 pb-20 border-t border-border/50",children:e.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:u,children:[e.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:e.jsx(Pr,{className:"w-5 h-5 text-muted-foreground"})}),e.jsx("span",{className:"text-lg font-medium text-foreground",children:"Settings"})]})}),e.jsxs(Oe,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:u,children:[e.jsx(Pr,{className:"w-3 h-3"}),e.jsx("span",{className:"text-xs",children:"Settings"})]})]})]})}function sm(t,r){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const am=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,im=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,om={};function Ja(t,r){return(om.jsx?im:am).test(t)}const lm=/[ \t\n\f\r]/g;function cm(t){return typeof t=="object"?t.type==="text"?Ga(t.value):!1:Ga(t)}function Ga(t){return t.replace(lm,"")===""}class mn{constructor(r,n,s){this.normal=n,this.property=r,s&&(this.space=s)}}mn.prototype.normal={};mn.prototype.property={};mn.prototype.space=void 0;function Do(t,r){const n={},s={};for(const a of t)Object.assign(n,a.property),Object.assign(s,a.normal);return new mn(n,s,r)}function Ts(t){return t.toLowerCase()}class At{constructor(r,n){this.attribute=n,this.property=r}}At.prototype.attribute="";At.prototype.booleanish=!1;At.prototype.boolean=!1;At.prototype.commaOrSpaceSeparated=!1;At.prototype.commaSeparated=!1;At.prototype.defined=!1;At.prototype.mustUseProperty=!1;At.prototype.number=!1;At.prototype.overloadedBoolean=!1;At.prototype.property="";At.prototype.spaceSeparated=!1;At.prototype.space=void 0;let dm=0;const _e=vr(),gt=vr(),Ds=vr(),ne=vr(),dt=vr(),Mr=vr(),Mt=vr();function vr(){return 2**++dm}const Ps=Object.freeze(Object.defineProperty({__proto__:null,boolean:_e,booleanish:gt,commaOrSpaceSeparated:Mt,commaSeparated:Mr,number:ne,overloadedBoolean:Ds,spaceSeparated:dt},Symbol.toStringTag,{value:"Module"})),as=Object.keys(Ps);class sa extends At{constructor(r,n,s,a){let i=-1;if(super(r,n),Ka(this,"space",a),typeof s=="number")for(;++i<as.length;){const o=as[i];Ka(this,as[i],(s&Ps[o])===Ps[o])}}}sa.prototype.defined=!0;function Ka(t,r,n){n&&(t[r]=n)}function Fr(t){const r={},n={};for(const[s,a]of Object.entries(t.properties)){const i=new sa(s,t.transform(t.attributes||{},s),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),r[s]=i,n[Ts(s)]=s,n[Ts(i.attribute)]=s}return new mn(r,n,t.space)}const Po=Fr({properties:{ariaActiveDescendant:null,ariaAtomic:gt,ariaAutoComplete:null,ariaBusy:gt,ariaChecked:gt,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:dt,ariaCurrent:null,ariaDescribedBy:dt,ariaDetails:null,ariaDisabled:gt,ariaDropEffect:dt,ariaErrorMessage:null,ariaExpanded:gt,ariaFlowTo:dt,ariaGrabbed:gt,ariaHasPopup:null,ariaHidden:gt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:dt,ariaLevel:ne,ariaLive:null,ariaModal:gt,ariaMultiLine:gt,ariaMultiSelectable:gt,ariaOrientation:null,ariaOwns:dt,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:gt,ariaReadOnly:gt,ariaRelevant:null,ariaRequired:gt,ariaRoleDescription:dt,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:gt,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(t,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Lo(t,r){return r in t?t[r]:r}function Ro(t,r){return Lo(t,r.toLowerCase())}const um=Fr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Mr,acceptCharset:dt,accessKey:dt,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:dt,autoFocus:_e,autoPlay:_e,blocking:dt,capture:null,charSet:null,checked:_e,cite:null,className:dt,cols:ne,colSpan:null,content:null,contentEditable:gt,controls:_e,controlsList:dt,coords:ne|Mr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:Ds,draggable:gt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:dt,height:ne,hidden:Ds,high:ne,href:null,hrefLang:null,htmlFor:dt,httpEquiv:dt,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:dt,itemRef:dt,itemScope:_e,itemType:dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:_e,muted:_e,name:null,nonce:null,noModule:_e,noValidate:_e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_e,optimum:ne,pattern:null,ping:dt,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:dt,required:_e,reversed:_e,rows:ne,rowSpan:ne,sandbox:dt,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:gt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:gt,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:dt,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_e,declare:_e,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:gt,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_e,disableRemotePlayback:_e,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:Ro}),mm=Fr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Mt,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,className:dt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Mr,g2:Mr,glyphName:Mr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:Mt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mt,rev:Mt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mt,requiredFeatures:Mt,requiredFonts:Mt,requiredFormats:Mt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:Mt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mt,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Lo}),zo=Fr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,r){return"xlink:"+r.slice(5).toLowerCase()}}),_o=Fr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ro}),Fo=Fr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,r){return"xml:"+r.slice(3).toLowerCase()}}),pm={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},hm=/[A-Z]/g,Ya=/-[a-z]/g,xm=/^data[-\w.:]+$/i;function gm(t,r){const n=Ts(r);let s=r,a=At;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&xm.test(r)){if(r.charAt(4)==="-"){const i=r.slice(5).replace(Ya,bm);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=r.slice(4);if(!Ya.test(i)){let o=i.replace(hm,fm);o.charAt(0)!=="-"&&(o="-"+o),r="data"+o}}a=sa}return new a(s,r)}function fm(t){return"-"+t.toLowerCase()}function bm(t){return t.charAt(1).toUpperCase()}const ym=Do([Po,um,zo,_o,Fo],"html"),aa=Do([Po,mm,zo,_o,Fo],"svg");function km(t){return t.join(" ").trim()}var Cr={},is,Qa;function vm(){if(Qa)return is;Qa=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
|
|
372
|
+
`,c="/",u="*",h="",x="comment",m="declaration";is=function(v,E){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];E=E||{};var A=1,T=1;function j(I){var b=I.match(r);b&&(A+=b.length);var z=I.lastIndexOf(d);T=~z?I.length-z:T+I.length}function W(){var I={line:A,column:T};return function(b){return b.position=new Z(I),M(),b}}function Z(I){this.start=I,this.end={line:A,column:T},this.source=E.source}Z.prototype.content=v;function D(I){var b=new Error(E.source+":"+A+":"+T+": "+I);if(b.reason=I,b.filename=E.source,b.line=A,b.column=T,b.source=v,!E.silent)throw b}function q(I){var b=I.exec(v);if(b){var z=b[0];return j(z),v=v.slice(z.length),b}}function M(){q(n)}function _(I){var b;for(I=I||[];b=R();)b!==!1&&I.push(b);return I}function R(){var I=W();if(!(c!=v.charAt(0)||u!=v.charAt(1))){for(var b=2;h!=v.charAt(b)&&(u!=v.charAt(b)||c!=v.charAt(b+1));)++b;if(b+=2,h===v.charAt(b-1))return D("End of comment missing");var z=v.slice(2,b-2);return T+=2,j(z),v=v.slice(b),T+=2,I({type:x,comment:z})}}function L(){var I=W(),b=q(s);if(b){if(R(),!q(a))return D("property missing ':'");var z=q(i),K=I({type:m,property:y(b[0].replace(t,h)),value:z?y(z[0].replace(t,h)):h});return q(o),K}}function C(){var I=[];_(I);for(var b;b=L();)b!==!1&&(I.push(b),_(I));return I}return M(),C()};function y(v){return v?v.replace(l,h):h}return is}var Xa;function wm(){if(Xa)return Cr;Xa=1;var t=Cr&&Cr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.default=n;var r=t(vm());function n(s,a){var i=null;if(!s||typeof s!="string")return i;var o=(0,r.default)(s),l=typeof a=="function";return o.forEach(function(d){if(d.type==="declaration"){var c=d.property,u=d.value;l?a(c,u,d):u&&(i=i||{},i[c]=u)}}),i}return Cr}var Hr={},Za;function jm(){if(Za)return Hr;Za=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(c){return!c||n.test(c)||t.test(c)},o=function(c,u){return u.toUpperCase()},l=function(c,u){return"".concat(u,"-")},d=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(a,l):c=c.replace(s,l),c.replace(r,o))};return Hr.camelCase=d,Hr}var Jr,ei;function Nm(){if(ei)return Jr;ei=1;var t=Jr&&Jr.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},r=t(wm()),n=jm();function s(a,i){var o={};return!a||typeof a!="string"||(0,r.default)(a,function(l,d){l&&d&&(o[(0,n.camelCase)(l,i)]=d)}),o}return s.default=s,Jr=s,Jr}var Sm=Nm();const Cm=on(Sm),$o=Oo("end"),ia=Oo("start");function Oo(t){return r;function r(n){const s=n&&n.position&&n.position[t]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function Em(t){const r=ia(t),n=$o(t);if(r&&n)return{start:r,end:n}}function Zr(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ti(t.position):"start"in t||"end"in t?ti(t):"line"in t||"column"in t?Ls(t):""}function Ls(t){return ri(t&&t.line)+":"+ri(t&&t.column)}function ti(t){return Ls(t&&t.start)+"-"+Ls(t&&t.end)}function ri(t){return t&&typeof t=="number"?t:1}class vt extends Error{constructor(r,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof r=="string"?a=r:!i.cause&&r&&(o=!0,a=r.message,i.cause=r),!i.ruleId&&!i.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?i.ruleId=s:(i.source=s.slice(0,d),i.ruleId=s.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=l?l.line:void 0,this.name=Zr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;const oa={}.hasOwnProperty,Im=new Map,Am=/[A-Z]/g,Mm=new Set(["table","tbody","thead","tfoot","tr"]),Tm=new Set(["td","th"]),Bo="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dm(t,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=Om(n,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=$m(n,r.jsx,r.jsxs)}const a={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?aa:ym,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},i=Uo(a,t,void 0);return i&&typeof i!="string"?i:a.create(t,a.Fragment,{children:i||void 0},void 0)}function Uo(t,r,n){if(r.type==="element")return Pm(t,r,n);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return Lm(t,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return zm(t,r,n);if(r.type==="mdxjsEsm")return Rm(t,r);if(r.type==="root")return _m(t,r,n);if(r.type==="text")return Fm(t,r)}function Pm(t,r,n){const s=t.schema;let a=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=aa,t.schema=a),t.ancestors.push(r);const i=qo(t,r.tagName,!1),o=Bm(t,r);let l=ca(t,r);return Mm.has(r.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!cm(d):!0})),Wo(t,o,i,r),la(o,l),t.ancestors.pop(),t.schema=s,t.create(r,i,o,n)}function Lm(t,r){if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];return s.type,t.evaluater.evaluateExpression(s.expression)}sn(t,r.position)}function Rm(t,r){if(r.data&&r.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(r.data.estree);sn(t,r.position)}function zm(t,r,n){const s=t.schema;let a=s;r.name==="svg"&&s.space==="html"&&(a=aa,t.schema=a),t.ancestors.push(r);const i=r.name===null?t.Fragment:qo(t,r.name,!0),o=Um(t,r),l=ca(t,r);return Wo(t,o,i,r),la(o,l),t.ancestors.pop(),t.schema=s,t.create(r,i,o,n)}function _m(t,r,n){const s={};return la(s,ca(t,r)),t.create(r,t.Fragment,s,n)}function Fm(t,r){return r.value}function Wo(t,r,n,s){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(r.node=s)}function la(t,r){if(r.length>0){const n=r.length>1?r:r[0];n&&(t.children=n)}}function $m(t,r,n){return s;function s(a,i,o,l){const c=Array.isArray(o.children)?n:r;return l?c(i,o,l):c(i,o)}}function Om(t,r){return n;function n(s,a,i,o){const l=Array.isArray(i.children),d=ia(s);return r(a,i,o,l,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Bm(t,r){const n={};let s,a;for(a in r.properties)if(a!=="children"&&oa.call(r.properties,a)){const i=Wm(t,a,r.properties[a]);if(i){const[o,l]=i;t.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Tm.has(r.tagName)?s=l:n[o]=l}}if(s){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function Um(t,r){const n={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&t.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else sn(t,r.position);else{const a=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&t.evaluater){const l=s.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else sn(t,r.position);else i=s.value===null?!0:s.value;n[a]=i}return n}function ca(t,r){const n=[];let s=-1;const a=t.passKeys?new Map:Im;for(;++s<r.children.length;){const i=r.children[s];let o;if(t.passKeys){const d=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(d){const c=a.get(d)||0;o=d+"-"+c,a.set(d,c+1)}}const l=Uo(t,i,o);l!==void 0&&n.push(l)}return n}function Wm(t,r,n){const s=gm(t.schema,r);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?sm(n):km(n)),s.property==="style"){let a=typeof n=="object"?n:qm(t,String(n));return t.stylePropertyNameCase==="css"&&(a=Vm(a)),["style",a]}return[t.elementAttributeNameCase==="react"&&s.space?pm[s.property]||s.property:s.attribute,n]}}function qm(t,r){try{return Cm(r,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const s=n,a=new vt("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=t.filePath||void 0,a.url=Bo+"#cannot-parse-style-attribute",a}}function qo(t,r,n){let s;if(!n)s={type:"Literal",value:r};else if(r.includes(".")){const a=r.split(".");let i=-1,o;for(;++i<a.length;){const l=Ja(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}s=o}else s=Ja(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const a=s.value;return oa.call(t.components,a)?t.components[a]:a}if(t.evaluater)return t.evaluater.evaluateExpression(s);sn(t)}function sn(t,r){const n=new vt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=Bo+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Vm(t){const r={};let n;for(n in t)oa.call(t,n)&&(r[Hm(n)]=t[n]);return r}function Hm(t){let r=t.replace(Am,Jm);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function Jm(t){return"-"+t.toLowerCase()}const os={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Gm={};function Km(t,r){const n=Gm,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Vo(t,s,a)}function Vo(t,r,n){if(Ym(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(r&&"alt"in t&&t.alt)return t.alt;if("children"in t)return ni(t.children,r,n)}return Array.isArray(t)?ni(t,r,n):""}function ni(t,r,n){const s=[];let a=-1;for(;++a<t.length;)s[a]=Vo(t[a],r,n);return s.join("")}function Ym(t){return!!(t&&typeof t=="object")}const si=document.createElement("i");function da(t){const r="&"+t+";";si.innerHTML=r;const n=si.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===r?!1:n}function Jt(t,r,n,s){const a=t.length;let i=0,o;if(r<0?r=-r>a?0:a+r:r=r>a?a:r,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(r,n),t.splice(...o);else for(n&&t.splice(r,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(r,0),t.splice(...o),i+=1e4,r+=1e4}function Ft(t,r){return t.length>0?(Jt(t,t.length,0,r),t):r}const ai={}.hasOwnProperty;function Qm(t){const r={};let n=-1;for(;++n<t.length;)Xm(r,t[n]);return r}function Xm(t,r){let n;for(n in r){const a=(ai.call(t,n)?t[n]:void 0)||(t[n]={}),i=r[n];let o;if(i)for(o in i){ai.call(a,o)||(a[o]=[]);const l=i[o];Zm(a[o],Array.isArray(l)?l:l?[l]:[])}}}function Zm(t,r){let n=-1;const s=[];for(;++n<r.length;)(r[n].add==="after"?t:s).push(r[n]);Jt(t,0,0,s)}function Ho(t,r){const n=Number.parseInt(t,r);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"οΏ½":String.fromCodePoint(n)}function Tr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const qt=dr(/[A-Za-z]/),Pt=dr(/[\dA-Za-z]/),ep=dr(/[#-'*+\--9=?A-Z^-~]/);function Rs(t){return t!==null&&(t<32||t===127)}const zs=dr(/\d/),tp=dr(/[\dA-Fa-f]/),rp=dr(/[!-/:-@[-`{-~]/);function Pe(t){return t!==null&&t<-2}function It(t){return t!==null&&(t<0||t===32)}function rt(t){return t===-2||t===-1||t===32}const np=dr(new RegExp("\\p{P}|\\p{S}","u")),sp=dr(/\s/);function dr(t){return r;function r(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function $r(t){const r=[];let n=-1,s=0,a=0;for(;++n<t.length;){const i=t.charCodeAt(n);let o="";if(i===37&&Pt(t.charCodeAt(n+1))&&Pt(t.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),a=1):o="οΏ½"}else o=String.fromCharCode(i);o&&(r.push(t.slice(s,n),encodeURIComponent(o)),s=n+a+1,o=""),a&&(n+=a,a=0)}return r.join("")+t.slice(s)}function ut(t,r,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(d){return rt(d)?(t.enter(n),l(d)):r(d)}function l(d){return rt(d)&&i++<a?(t.consume(d),l):(t.exit(n),r(d))}}const ap={tokenize:ip};function ip(t){const r=t.attempt(this.parser.constructs.contentInitial,s,a);let n;return r;function s(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),ut(t,r,"linePrefix")}function a(l){return t.enter("paragraph"),i(l)}function i(l){const d=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,o(l)}function o(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return Pe(l)?(t.consume(l),t.exit("chunkText"),i):(t.consume(l),o)}}const op={tokenize:lp},ii={tokenize:cp};function lp(t){const r=this,n=[];let s=0,a,i,o;return l;function l(j){if(s<n.length){const W=n[s];return r.containerState=W[1],t.attempt(W[0].continuation,d,c)(j)}return c(j)}function d(j){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,a&&T();const W=r.events.length;let Z=W,D;for(;Z--;)if(r.events[Z][0]==="exit"&&r.events[Z][1].type==="chunkFlow"){D=r.events[Z][1].end;break}A(s);let q=W;for(;q<r.events.length;)r.events[q][1].end={...D},q++;return Jt(r.events,Z+1,0,r.events.slice(W)),r.events.length=q,c(j)}return l(j)}function c(j){if(s===n.length){if(!a)return x(j);if(a.currentConstruct&&a.currentConstruct.concrete)return y(j);r.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return r.containerState={},t.check(ii,u,h)(j)}function u(j){return a&&T(),A(s),x(j)}function h(j){return r.parser.lazy[r.now().line]=s!==n.length,o=r.now().offset,y(j)}function x(j){return r.containerState={},t.attempt(ii,m,y)(j)}function m(j){return s++,n.push([r.currentConstruct,r.containerState]),x(j)}function y(j){if(j===null){a&&T(),A(0),t.consume(j);return}return a=a||r.parser.flow(r.now()),t.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),v(j)}function v(j){if(j===null){E(t.exit("chunkFlow"),!0),A(0),t.consume(j);return}return Pe(j)?(t.consume(j),E(t.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(t.consume(j),v)}function E(j,W){const Z=r.sliceStream(j);if(W&&Z.push(null),j.previous=i,i&&(i.next=j),i=j,a.defineSkip(j.start),a.write(Z),r.parser.lazy[j.start.line]){let D=a.events.length;for(;D--;)if(a.events[D][1].start.offset<o&&(!a.events[D][1].end||a.events[D][1].end.offset>o))return;const q=r.events.length;let M=q,_,R;for(;M--;)if(r.events[M][0]==="exit"&&r.events[M][1].type==="chunkFlow"){if(_){R=r.events[M][1].end;break}_=!0}for(A(s),D=q;D<r.events.length;)r.events[D][1].end={...R},D++;Jt(r.events,M+1,0,r.events.slice(q)),r.events.length=D}}function A(j){let W=n.length;for(;W-- >j;){const Z=n[W];r.containerState=Z[1],Z[0].exit.call(r,t)}n.length=j}function T(){a.write([null]),i=void 0,a=void 0,r.containerState._closeFlow=void 0}}function cp(t,r,n){return ut(t,t.attempt(this.parser.constructs.document,r,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oi(t){if(t===null||It(t)||sp(t))return 1;if(np(t))return 2}function ua(t,r,n){const s=[];let a=-1;for(;++a<t.length;){const i=t[a].resolveAll;i&&!s.includes(i)&&(r=i(r,n),s.push(i))}return r}const _s={name:"attention",resolveAll:dp,tokenize:up};function dp(t,r){let n=-1,s,a,i,o,l,d,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(s=n;s--;)if(t[s][0]==="exit"&&t[s][1].type==="attentionSequence"&&t[s][1]._open&&r.sliceSerialize(t[s][1]).charCodeAt(0)===r.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[s][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[s][1].end.offset-t[s][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;d=t[s][1].end.offset-t[s][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[s][1].end},x={...t[n][1].start};li(h,-d),li(x,d),o={type:d>1?"strongSequence":"emphasisSequence",start:h,end:{...t[s][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[s][1].end},end:{...t[n][1].start}},a={type:d>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},t[s][1].end={...o.start},t[n][1].start={...l.end},c=[],t[s][1].end.offset-t[s][1].start.offset&&(c=Ft(c,[["enter",t[s][1],r],["exit",t[s][1],r]])),c=Ft(c,[["enter",a,r],["enter",o,r],["exit",o,r],["enter",i,r]]),c=Ft(c,ua(r.parser.constructs.insideSpan.null,t.slice(s+1,n),r)),c=Ft(c,[["exit",i,r],["enter",l,r],["exit",l,r],["exit",a,r]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=Ft(c,[["enter",t[n][1],r],["exit",t[n][1],r]])):u=0,Jt(t,s-1,n-s+3,c),n=s+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function up(t,r){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=oi(s);let i;return o;function o(d){return i=d,t.enter("attentionSequence"),l(d)}function l(d){if(d===i)return t.consume(d),l;const c=t.exit("attentionSequence"),u=oi(d),h=!u||u===2&&a||n.includes(d),x=!a||a===2&&u||n.includes(s);return c._open=!!(i===42?h:h&&(a||!x)),c._close=!!(i===42?x:x&&(u||!h)),r(d)}}function li(t,r){t.column+=r,t.offset+=r,t._bufferIndex+=r}const mp={name:"autolink",tokenize:pp};function pp(t,r,n){let s=0;return a;function a(m){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(m){return qt(m)?(t.consume(m),o):m===64?n(m):c(m)}function o(m){return m===43||m===45||m===46||Pt(m)?(s=1,l(m)):c(m)}function l(m){return m===58?(t.consume(m),s=0,d):(m===43||m===45||m===46||Pt(m))&&s++<32?(t.consume(m),l):(s=0,c(m))}function d(m){return m===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),r):m===null||m===32||m===60||Rs(m)?n(m):(t.consume(m),d)}function c(m){return m===64?(t.consume(m),u):ep(m)?(t.consume(m),c):n(m)}function u(m){return Pt(m)?h(m):n(m)}function h(m){return m===46?(t.consume(m),s=0,u):m===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),r):x(m)}function x(m){if((m===45||Pt(m))&&s++<63){const y=m===45?x:h;return t.consume(m),y}return n(m)}}const qn={partial:!0,tokenize:hp};function hp(t,r,n){return s;function s(i){return rt(i)?ut(t,a,"linePrefix")(i):a(i)}function a(i){return i===null||Pe(i)?r(i):n(i)}}const Jo={continuation:{tokenize:gp},exit:fp,name:"blockQuote",tokenize:xp};function xp(t,r,n){const s=this;return a;function a(o){if(o===62){const l=s.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),i}return n(o)}function i(o){return rt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),r):(t.exit("blockQuotePrefix"),r(o))}}function gp(t,r,n){const s=this;return a;function a(o){return rt(o)?ut(t,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return t.attempt(Jo,r,n)(o)}}function fp(t){t.exit("blockQuote")}const Go={name:"characterEscape",tokenize:bp};function bp(t,r,n){return s;function s(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),a}function a(i){return rp(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),r):n(i)}}const Ko={name:"characterReference",tokenize:yp};function yp(t,r,n){const s=this;let a=0,i,o;return l;function l(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),d}function d(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),i=31,o=Pt,u(h))}function c(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,o=tp,u):(t.enter("characterReferenceValue"),i=7,o=zs,u(h))}function u(h){if(h===59&&a){const x=t.exit("characterReferenceValue");return o===Pt&&!da(s.sliceSerialize(x))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),r)}return o(h)&&a++<i?(t.consume(h),u):n(h)}}const ci={partial:!0,tokenize:vp},di={concrete:!0,name:"codeFenced",tokenize:kp};function kp(t,r,n){const s=this,a={partial:!0,tokenize:Z};let i=0,o=0,l;return d;function d(D){return c(D)}function c(D){const q=s.events[s.events.length-1];return i=q&&q[1].type==="linePrefix"?q[2].sliceSerialize(q[1],!0).length:0,l=D,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(D)}function u(D){return D===l?(o++,t.consume(D),u):o<3?n(D):(t.exit("codeFencedFenceSequence"),rt(D)?ut(t,h,"whitespace")(D):h(D))}function h(D){return D===null||Pe(D)?(t.exit("codeFencedFence"),s.interrupt?r(D):t.check(ci,v,W)(D)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),x(D))}function x(D){return D===null||Pe(D)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(D)):rt(D)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ut(t,m,"whitespace")(D)):D===96&&D===l?n(D):(t.consume(D),x)}function m(D){return D===null||Pe(D)?h(D):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),y(D))}function y(D){return D===null||Pe(D)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(D)):D===96&&D===l?n(D):(t.consume(D),y)}function v(D){return t.attempt(a,W,E)(D)}function E(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),A}function A(D){return i>0&&rt(D)?ut(t,T,"linePrefix",i+1)(D):T(D)}function T(D){return D===null||Pe(D)?t.check(ci,v,W)(D):(t.enter("codeFlowValue"),j(D))}function j(D){return D===null||Pe(D)?(t.exit("codeFlowValue"),T(D)):(t.consume(D),j)}function W(D){return t.exit("codeFenced"),r(D)}function Z(D,q,M){let _=0;return R;function R(z){return D.enter("lineEnding"),D.consume(z),D.exit("lineEnding"),L}function L(z){return D.enter("codeFencedFence"),rt(z)?ut(D,C,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):C(z)}function C(z){return z===l?(D.enter("codeFencedFenceSequence"),I(z)):M(z)}function I(z){return z===l?(_++,D.consume(z),I):_>=o?(D.exit("codeFencedFenceSequence"),rt(z)?ut(D,b,"whitespace")(z):b(z)):M(z)}function b(z){return z===null||Pe(z)?(D.exit("codeFencedFence"),q(z)):M(z)}}}function vp(t,r,n){const s=this;return a;function a(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):r(o)}}const ls={name:"codeIndented",tokenize:jp},wp={partial:!0,tokenize:Np};function jp(t,r,n){const s=this;return a;function a(c){return t.enter("codeIndented"),ut(t,i,"linePrefix",5)(c)}function i(c){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?d(c):Pe(c)?t.attempt(wp,o,d)(c):(t.enter("codeFlowValue"),l(c))}function l(c){return c===null||Pe(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),l)}function d(c){return t.exit("codeIndented"),r(c)}}function Np(t,r,n){const s=this;return a;function a(o){return s.parser.lazy[s.now().line]?n(o):Pe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a):ut(t,i,"linePrefix",5)(o)}function i(o){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(o):Pe(o)?a(o):n(o)}}const Sp={name:"codeText",previous:Ep,resolve:Cp,tokenize:Ip};function Cp(t){let r=t.length-4,n=3,s,a;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[r][1].type==="lineEnding"||t[r][1].type==="space")){for(s=n;++s<r;)if(t[s][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[r][1].type="codeTextPadding",n+=2,r-=2;break}}for(s=n-1,r++;++s<=r;)a===void 0?s!==r&&t[s][1].type!=="lineEnding"&&(a=s):(s===r||t[s][1].type==="lineEnding")&&(t[a][1].type="codeTextData",s!==a+2&&(t[a][1].end=t[s-1][1].end,t.splice(a+2,s-a-2),r-=s-a-2,s=a+2),a=void 0);return t}function Ep(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ip(t,r,n){let s=0,a,i;return o;function o(h){return t.enter("codeText"),t.enter("codeTextSequence"),l(h)}function l(h){return h===96?(t.consume(h),s++,l):(t.exit("codeTextSequence"),d(h))}function d(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),d):h===96?(i=t.enter("codeTextSequence"),a=0,u(h)):Pe(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),d):(t.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||Pe(h)?(t.exit("codeTextData"),d(h)):(t.consume(h),c)}function u(h){return h===96?(t.consume(h),a++,u):a===s?(t.exit("codeTextSequence"),t.exit("codeText"),r(h)):(i.type="codeTextData",c(h))}}class Ap{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,n,s){const a=n||0;this.setCursor(Math.trunc(r));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Gr(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Gr(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Gr(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const n=this.left.splice(r,Number.POSITIVE_INFINITY);Gr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Gr(this.left,n.reverse())}}}function Gr(t,r){let n=0;if(r.length<1e4)t.push(...r);else for(;n<r.length;)t.push(...r.slice(n,n+1e4)),n+=1e4}function Yo(t){const r={};let n=-1,s,a,i,o,l,d,c;const u=new Ap(t);for(;++n<u.length;){for(;n in r;)n=r[n];if(s=u.get(n),n&&s[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,i=0,i<d.length&&d[i][1].type==="lineEndingBlank"&&(i+=2),i<d.length&&d[i][1].type==="content"))for(;++i<d.length&&d[i][1].type!=="content";)d[i][1].type==="chunkText"&&(d[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,Mp(u,n)),n=r[n],c=!0);else if(s[1]._container){for(i=n,a=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(u.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(s[1].end={...u.get(a)[1].start},l=u.slice(a,n),l.unshift(s),u.splice(a,n-a+1,l))}}return Jt(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Mp(t,r){const n=t.get(r)[1],s=t.get(r)[2];let a=r-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,d=[],c={};let u,h,x=-1,m=n,y=0,v=0;const E=[v];for(;m;){for(;t.get(++a)[1]!==m;);i.push(a),m._tokenizer||(u=s.sliceStream(m),m.next||u.push(null),h&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++x<l.length;)l[x][0]==="exit"&&l[x-1][0]==="enter"&&l[x][1].type===l[x-1][1].type&&l[x][1].start.line!==l[x][1].end.line&&(v=x+1,E.push(v),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):E.pop(),x=E.length;x--;){const A=l.slice(E[x],E[x+1]),T=i.pop();d.push([T,T+A.length-1]),t.splice(T,2,A)}for(d.reverse(),x=-1;++x<d.length;)c[y+d[x][0]]=y+d[x][1],y+=d[x][1]-d[x][0]-1;return c}const Tp={resolve:Pp,tokenize:Lp},Dp={partial:!0,tokenize:Rp};function Pp(t){return Yo(t),t}function Lp(t,r){let n;return s;function s(l){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):Pe(l)?t.check(Dp,o,i)(l):(t.consume(l),a)}function i(l){return t.exit("chunkContent"),t.exit("content"),r(l)}function o(l){return t.consume(l),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function Rp(t,r,n){const s=this;return a;function a(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),ut(t,i,"linePrefix")}function i(o){if(o===null||Pe(o))return n(o);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(o):t.interrupt(s.parser.constructs.flow,n,r)(o)}}function Qo(t,r,n,s,a,i,o,l,d){const c=d||Number.POSITIVE_INFINITY;let u=0;return h;function h(A){return A===60?(t.enter(s),t.enter(a),t.enter(i),t.consume(A),t.exit(i),x):A===null||A===32||A===41||Rs(A)?n(A):(t.enter(s),t.enter(o),t.enter(l),t.enter("chunkString",{contentType:"string"}),v(A))}function x(A){return A===62?(t.enter(i),t.consume(A),t.exit(i),t.exit(a),t.exit(s),r):(t.enter(l),t.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return A===62?(t.exit("chunkString"),t.exit(l),x(A)):A===null||A===60||Pe(A)?n(A):(t.consume(A),A===92?y:m)}function y(A){return A===60||A===62||A===92?(t.consume(A),m):m(A)}function v(A){return!u&&(A===null||A===41||It(A))?(t.exit("chunkString"),t.exit(l),t.exit(o),t.exit(s),r(A)):u<c&&A===40?(t.consume(A),u++,v):A===41?(t.consume(A),u--,v):A===null||A===32||A===40||Rs(A)?n(A):(t.consume(A),A===92?E:v)}function E(A){return A===40||A===41||A===92?(t.consume(A),v):v(A)}}function Xo(t,r,n,s,a,i){const o=this;let l=0,d;return c;function c(m){return t.enter(s),t.enter(a),t.consume(m),t.exit(a),t.enter(i),u}function u(m){return l>999||m===null||m===91||m===93&&!d||m===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(t.exit(i),t.enter(a),t.consume(m),t.exit(a),t.exit(s),r):Pe(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||Pe(m)||l++>999?(t.exit("chunkString"),u(m)):(t.consume(m),d||(d=!rt(m)),m===92?x:h)}function x(m){return m===91||m===92||m===93?(t.consume(m),l++,h):h(m)}}function Zo(t,r,n,s,a,i){let o;return l;function l(x){return x===34||x===39||x===40?(t.enter(s),t.enter(a),t.consume(x),t.exit(a),o=x===40?41:x,d):n(x)}function d(x){return x===o?(t.enter(a),t.consume(x),t.exit(a),t.exit(s),r):(t.enter(i),c(x))}function c(x){return x===o?(t.exit(i),d(o)):x===null?n(x):Pe(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),ut(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(x))}function u(x){return x===o||x===null||Pe(x)?(t.exit("chunkString"),c(x)):(t.consume(x),x===92?h:u)}function h(x){return x===o||x===92?(t.consume(x),u):u(x)}}function en(t,r){let n;return s;function s(a){return Pe(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),n=!0,s):rt(a)?ut(t,s,n?"linePrefix":"lineSuffix")(a):r(a)}}const zp={name:"definition",tokenize:Fp},_p={partial:!0,tokenize:$p};function Fp(t,r,n){const s=this;let a;return i;function i(m){return t.enter("definition"),o(m)}function o(m){return Xo.call(s,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return a=Tr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),d):n(m)}function d(m){return It(m)?en(t,c)(m):c(m)}function c(m){return Qo(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return t.attempt(_p,h,h)(m)}function h(m){return rt(m)?ut(t,x,"whitespace")(m):x(m)}function x(m){return m===null||Pe(m)?(t.exit("definition"),s.parser.defined.push(a),r(m)):n(m)}}function $p(t,r,n){return s;function s(l){return It(l)?en(t,a)(l):n(l)}function a(l){return Zo(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return rt(l)?ut(t,o,"whitespace")(l):o(l)}function o(l){return l===null||Pe(l)?r(l):n(l)}}const Op={name:"hardBreakEscape",tokenize:Bp};function Bp(t,r,n){return s;function s(i){return t.enter("hardBreakEscape"),t.consume(i),a}function a(i){return Pe(i)?(t.exit("hardBreakEscape"),r(i)):n(i)}}const Up={name:"headingAtx",resolve:Wp,tokenize:qp};function Wp(t,r){let n=t.length-2,s=3,a,i;return t[s][1].type==="whitespace"&&(s+=2),n-2>s&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&t[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:t[s][1].start,end:t[n][1].end},i={type:"chunkText",start:t[s][1].start,end:t[n][1].end,contentType:"text"},Jt(t,s,n-s+1,[["enter",a,r],["enter",i,r],["exit",i,r],["exit",a,r]])),t}function qp(t,r,n){let s=0;return a;function a(u){return t.enter("atxHeading"),i(u)}function i(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&s++<6?(t.consume(u),o):u===null||It(u)?(t.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(t.enter("atxHeadingSequence"),d(u)):u===null||Pe(u)?(t.exit("atxHeading"),r(u)):rt(u)?ut(t,l,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function d(u){return u===35?(t.consume(u),d):(t.exit("atxHeadingSequence"),l(u))}function c(u){return u===null||u===35||It(u)?(t.exit("atxHeadingText"),l(u)):(t.consume(u),c)}}const Vp=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ui=["pre","script","style","textarea"],Hp={concrete:!0,name:"htmlFlow",resolveTo:Kp,tokenize:Yp},Jp={partial:!0,tokenize:Xp},Gp={partial:!0,tokenize:Qp};function Kp(t){let r=t.length;for(;r--&&!(t[r][0]==="enter"&&t[r][1].type==="htmlFlow"););return r>1&&t[r-2][1].type==="linePrefix"&&(t[r][1].start=t[r-2][1].start,t[r+1][1].start=t[r-2][1].start,t.splice(r-2,2)),t}function Yp(t,r,n){const s=this;let a,i,o,l,d;return c;function c(f){return u(f)}function u(f){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(f),h}function h(f){return f===33?(t.consume(f),x):f===47?(t.consume(f),i=!0,v):f===63?(t.consume(f),a=3,s.interrupt?r:N):qt(f)?(t.consume(f),o=String.fromCharCode(f),E):n(f)}function x(f){return f===45?(t.consume(f),a=2,m):f===91?(t.consume(f),a=5,l=0,y):qt(f)?(t.consume(f),a=4,s.interrupt?r:N):n(f)}function m(f){return f===45?(t.consume(f),s.interrupt?r:N):n(f)}function y(f){const te="CDATA[";return f===te.charCodeAt(l++)?(t.consume(f),l===te.length?s.interrupt?r:C:y):n(f)}function v(f){return qt(f)?(t.consume(f),o=String.fromCharCode(f),E):n(f)}function E(f){if(f===null||f===47||f===62||It(f)){const te=f===47,ue=o.toLowerCase();return!te&&!i&&ui.includes(ue)?(a=1,s.interrupt?r(f):C(f)):Vp.includes(o.toLowerCase())?(a=6,te?(t.consume(f),A):s.interrupt?r(f):C(f)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(f):i?T(f):j(f))}return f===45||Pt(f)?(t.consume(f),o+=String.fromCharCode(f),E):n(f)}function A(f){return f===62?(t.consume(f),s.interrupt?r:C):n(f)}function T(f){return rt(f)?(t.consume(f),T):R(f)}function j(f){return f===47?(t.consume(f),R):f===58||f===95||qt(f)?(t.consume(f),W):rt(f)?(t.consume(f),j):R(f)}function W(f){return f===45||f===46||f===58||f===95||Pt(f)?(t.consume(f),W):Z(f)}function Z(f){return f===61?(t.consume(f),D):rt(f)?(t.consume(f),Z):j(f)}function D(f){return f===null||f===60||f===61||f===62||f===96?n(f):f===34||f===39?(t.consume(f),d=f,q):rt(f)?(t.consume(f),D):M(f)}function q(f){return f===d?(t.consume(f),d=null,_):f===null||Pe(f)?n(f):(t.consume(f),q)}function M(f){return f===null||f===34||f===39||f===47||f===60||f===61||f===62||f===96||It(f)?Z(f):(t.consume(f),M)}function _(f){return f===47||f===62||rt(f)?j(f):n(f)}function R(f){return f===62?(t.consume(f),L):n(f)}function L(f){return f===null||Pe(f)?C(f):rt(f)?(t.consume(f),L):n(f)}function C(f){return f===45&&a===2?(t.consume(f),K):f===60&&a===1?(t.consume(f),B):f===62&&a===4?(t.consume(f),Ie):f===63&&a===3?(t.consume(f),N):f===93&&a===5?(t.consume(f),ie):Pe(f)&&(a===6||a===7)?(t.exit("htmlFlowData"),t.check(Jp,Fe,I)(f)):f===null||Pe(f)?(t.exit("htmlFlowData"),I(f)):(t.consume(f),C)}function I(f){return t.check(Gp,b,Fe)(f)}function b(f){return t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),z}function z(f){return f===null||Pe(f)?I(f):(t.enter("htmlFlowData"),C(f))}function K(f){return f===45?(t.consume(f),N):C(f)}function B(f){return f===47?(t.consume(f),o="",G):C(f)}function G(f){if(f===62){const te=o.toLowerCase();return ui.includes(te)?(t.consume(f),Ie):C(f)}return qt(f)&&o.length<8?(t.consume(f),o+=String.fromCharCode(f),G):C(f)}function ie(f){return f===93?(t.consume(f),N):C(f)}function N(f){return f===62?(t.consume(f),Ie):f===45&&a===2?(t.consume(f),N):C(f)}function Ie(f){return f===null||Pe(f)?(t.exit("htmlFlowData"),Fe(f)):(t.consume(f),Ie)}function Fe(f){return t.exit("htmlFlow"),r(f)}}function Qp(t,r,n){const s=this;return a;function a(o){return Pe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):r(o)}}function Xp(t,r,n){return s;function s(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),t.attempt(qn,r,n)}}const Zp={name:"htmlText",tokenize:eh};function eh(t,r,n){const s=this;let a,i,o;return l;function l(N){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(N),d}function d(N){return N===33?(t.consume(N),c):N===47?(t.consume(N),Z):N===63?(t.consume(N),j):qt(N)?(t.consume(N),M):n(N)}function c(N){return N===45?(t.consume(N),u):N===91?(t.consume(N),i=0,y):qt(N)?(t.consume(N),T):n(N)}function u(N){return N===45?(t.consume(N),m):n(N)}function h(N){return N===null?n(N):N===45?(t.consume(N),x):Pe(N)?(o=h,B(N)):(t.consume(N),h)}function x(N){return N===45?(t.consume(N),m):h(N)}function m(N){return N===62?K(N):N===45?x(N):h(N)}function y(N){const Ie="CDATA[";return N===Ie.charCodeAt(i++)?(t.consume(N),i===Ie.length?v:y):n(N)}function v(N){return N===null?n(N):N===93?(t.consume(N),E):Pe(N)?(o=v,B(N)):(t.consume(N),v)}function E(N){return N===93?(t.consume(N),A):v(N)}function A(N){return N===62?K(N):N===93?(t.consume(N),A):v(N)}function T(N){return N===null||N===62?K(N):Pe(N)?(o=T,B(N)):(t.consume(N),T)}function j(N){return N===null?n(N):N===63?(t.consume(N),W):Pe(N)?(o=j,B(N)):(t.consume(N),j)}function W(N){return N===62?K(N):j(N)}function Z(N){return qt(N)?(t.consume(N),D):n(N)}function D(N){return N===45||Pt(N)?(t.consume(N),D):q(N)}function q(N){return Pe(N)?(o=q,B(N)):rt(N)?(t.consume(N),q):K(N)}function M(N){return N===45||Pt(N)?(t.consume(N),M):N===47||N===62||It(N)?_(N):n(N)}function _(N){return N===47?(t.consume(N),K):N===58||N===95||qt(N)?(t.consume(N),R):Pe(N)?(o=_,B(N)):rt(N)?(t.consume(N),_):K(N)}function R(N){return N===45||N===46||N===58||N===95||Pt(N)?(t.consume(N),R):L(N)}function L(N){return N===61?(t.consume(N),C):Pe(N)?(o=L,B(N)):rt(N)?(t.consume(N),L):_(N)}function C(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(t.consume(N),a=N,I):Pe(N)?(o=C,B(N)):rt(N)?(t.consume(N),C):(t.consume(N),b)}function I(N){return N===a?(t.consume(N),a=void 0,z):N===null?n(N):Pe(N)?(o=I,B(N)):(t.consume(N),I)}function b(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||It(N)?_(N):(t.consume(N),b)}function z(N){return N===47||N===62||It(N)?_(N):n(N)}function K(N){return N===62?(t.consume(N),t.exit("htmlTextData"),t.exit("htmlText"),r):n(N)}function B(N){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),G}function G(N){return rt(N)?ut(t,ie,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):ie(N)}function ie(N){return t.enter("htmlTextData"),o(N)}}const ma={name:"labelEnd",resolveAll:sh,resolveTo:ah,tokenize:ih},th={tokenize:oh},rh={tokenize:lh},nh={tokenize:ch};function sh(t){let r=-1;const n=[];for(;++r<t.length;){const s=t[r][1];if(n.push(t[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",r+=a}}return t.length!==n.length&&Jt(t,0,t.length,n),t}function ah(t,r){let n=t.length,s=0,a,i,o,l;for(;n--;)if(a=t[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;t[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(o=n);const d={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[i][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[i+s+2][1].end},end:{...t[o-2][1].start}};return l=[["enter",d,r],["enter",c,r]],l=Ft(l,t.slice(i+1,i+s+3)),l=Ft(l,[["enter",u,r]]),l=Ft(l,ua(r.parser.constructs.insideSpan.null,t.slice(i+s+4,o-3),r)),l=Ft(l,[["exit",u,r],t[o-2],t[o-1],["exit",c,r]]),l=Ft(l,t.slice(o+1)),l=Ft(l,[["exit",d,r]]),Jt(t,i,t.length,l),t}function ih(t,r,n){const s=this;let a=s.events.length,i,o;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){i=s.events[a][1];break}return l;function l(x){return i?i._inactive?h(x):(o=s.parser.defined.includes(Tr(s.sliceSerialize({start:i.end,end:s.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(x),t.exit("labelMarker"),t.exit("labelEnd"),d):n(x)}function d(x){return x===40?t.attempt(th,u,o?u:h)(x):x===91?t.attempt(rh,u,o?c:h)(x):o?u(x):h(x)}function c(x){return t.attempt(nh,u,h)(x)}function u(x){return r(x)}function h(x){return i._balanced=!0,n(x)}}function oh(t,r,n){return s;function s(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),a}function a(h){return It(h)?en(t,i)(h):i(h)}function i(h){return h===41?u(h):Qo(t,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return It(h)?en(t,d)(h):u(h)}function l(h){return n(h)}function d(h){return h===34||h===39||h===40?Zo(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):u(h)}function c(h){return It(h)?en(t,u)(h):u(h)}function u(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),r):n(h)}}function lh(t,r,n){const s=this;return a;function a(l){return Xo.call(s,t,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return s.parser.defined.includes(Tr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):n(l)}function o(l){return n(l)}}function ch(t,r,n){return s;function s(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),a}function a(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),r):n(i)}}const dh={name:"labelStartImage",resolveAll:ma.resolveAll,tokenize:uh};function uh(t,r,n){const s=this;return a;function a(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),i}function i(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):r(l)}}const mh={name:"labelStartLink",resolveAll:ma.resolveAll,tokenize:ph};function ph(t,r,n){const s=this;return a;function a(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):r(o)}}const cs={name:"lineEnding",tokenize:hh};function hh(t,r){return n;function n(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),ut(t,r,"linePrefix")}}const Dn={name:"thematicBreak",tokenize:xh};function xh(t,r,n){let s=0,a;return i;function i(c){return t.enter("thematicBreak"),o(c)}function o(c){return a=c,l(c)}function l(c){return c===a?(t.enter("thematicBreakSequence"),d(c)):s>=3&&(c===null||Pe(c))?(t.exit("thematicBreak"),r(c)):n(c)}function d(c){return c===a?(t.consume(c),s++,d):(t.exit("thematicBreakSequence"),rt(c)?ut(t,l,"whitespace")(c):l(c))}}const St={continuation:{tokenize:yh},exit:vh,name:"list",tokenize:bh},gh={partial:!0,tokenize:wh},fh={partial:!0,tokenize:kh};function bh(t,r,n){const s=this,a=s.events[s.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(m){const y=s.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!s.containerState.marker||m===s.containerState.marker:zs(m)){if(s.containerState.type||(s.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),m===42||m===45?t.check(Dn,n,c)(m):c(m);if(!s.interrupt||m===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(m)}return n(m)}function d(m){return zs(m)&&++o<10?(t.consume(m),d):(!s.interrupt||o<2)&&(s.containerState.marker?m===s.containerState.marker:m===41||m===46)?(t.exit("listItemValue"),c(m)):n(m)}function c(m){return t.enter("listItemMarker"),t.consume(m),t.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||m,t.check(qn,s.interrupt?n:u,t.attempt(gh,x,h))}function u(m){return s.containerState.initialBlankLine=!0,i++,x(m)}function h(m){return rt(m)?(t.enter("listItemPrefixWhitespace"),t.consume(m),t.exit("listItemPrefixWhitespace"),x):n(m)}function x(m){return s.containerState.size=i+s.sliceSerialize(t.exit("listItemPrefix"),!0).length,r(m)}}function yh(t,r,n){const s=this;return s.containerState._closeFlow=void 0,t.check(qn,a,i);function a(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ut(t,r,"listItemIndent",s.containerState.size+1)(l)}function i(l){return s.containerState.furtherBlankLines||!rt(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,t.attempt(fh,r,o)(l))}function o(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,ut(t,t.attempt(St,r,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function kh(t,r,n){const s=this;return ut(t,a,"listItemIndent",s.containerState.size+1);function a(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?r(i):n(i)}}function vh(t){t.exit(this.containerState.type)}function wh(t,r,n){const s=this;return ut(t,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=s.events[s.events.length-1];return!rt(i)&&o&&o[1].type==="listItemPrefixWhitespace"?r(i):n(i)}}const mi={name:"setextUnderline",resolveTo:jh,tokenize:Nh};function jh(t,r){let n=t.length,s,a,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){s=n;break}t[n][1].type==="paragraph"&&(a=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...t[s][1].start},end:{...t[t.length-1][1].end}};return t[a][1].type="setextHeadingText",i?(t.splice(a,0,["enter",o,r]),t.splice(i+1,0,["exit",t[s][1],r]),t[s][1].end={...t[i][1].end}):t[s][1]=o,t.push(["exit",o,r]),t}function Nh(t,r,n){const s=this;let a;return i;function i(c){let u=s.events.length,h;for(;u--;)if(s.events[u][1].type!=="lineEnding"&&s.events[u][1].type!=="linePrefix"&&s.events[u][1].type!=="content"){h=s.events[u][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||h)?(t.enter("setextHeadingLine"),a=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===a?(t.consume(c),l):(t.exit("setextHeadingLineSequence"),rt(c)?ut(t,d,"lineSuffix")(c):d(c))}function d(c){return c===null||Pe(c)?(t.exit("setextHeadingLine"),r(c)):n(c)}}const Sh={tokenize:Ch};function Ch(t){const r=this,n=t.attempt(qn,s,t.attempt(this.parser.constructs.flowInitial,a,ut(t,t.attempt(this.parser.constructs.flow,a,t.attempt(Tp,a)),"linePrefix")));return n;function s(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),r.currentConstruct=void 0,n}function a(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r.currentConstruct=void 0,n}}const Eh={resolveAll:tl()},Ih=el("string"),Ah=el("text");function el(t){return{resolveAll:tl(t==="text"?Mh:void 0),tokenize:r};function r(n){const s=this,a=this.parser.constructs[t],i=n.attempt(a,o,l);return o;function o(u){return c(u)?i(u):l(u)}function l(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),d}function d(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),d)}function c(u){if(u===null)return!0;const h=a[u];let x=-1;if(h)for(;++x<h.length;){const m=h[x];if(!m.previous||m.previous.call(s,s.previous))return!0}return!1}}}function tl(t){return r;function r(n,s){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return t?t(n,s):n}}function Mh(t,r){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const s=t[n-1][1],a=r.sliceStream(s);let i=a.length,o=-1,l=0,d;for(;i--;){const c=a[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(c===-2)d=!0,l++;else if(c!==-1){i++;break}}if(r._contentTypeTextTrailing&&n===t.length&&(l=0),l){const c={type:n===t.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...c.start},s.start.offset===s.end.offset?Object.assign(s,c):(t.splice(n,0,["enter",c,r],["exit",c,r]),n+=2)}n++}return t}const Th={42:St,43:St,45:St,48:St,49:St,50:St,51:St,52:St,53:St,54:St,55:St,56:St,57:St,62:Jo},Dh={91:zp},Ph={[-2]:ls,[-1]:ls,32:ls},Lh={35:Up,42:Dn,45:[mi,Dn],60:Hp,61:mi,95:Dn,96:di,126:di},Rh={38:Ko,92:Go},zh={[-5]:cs,[-4]:cs,[-3]:cs,33:dh,38:Ko,42:_s,60:[mp,Zp],91:mh,92:[Op,Go],93:ma,95:_s,96:Sp},_h={null:[_s,Eh]},Fh={null:[42,95]},$h={null:[]},Oh=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Fh,contentInitial:Dh,disable:$h,document:Th,flow:Lh,flowInitial:Ph,insideSpan:_h,string:Rh,text:zh},Symbol.toStringTag,{value:"Module"}));function Bh(t,r,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],l=[];const d={attempt:q(Z),check:q(D),consume:T,enter:j,exit:W,interrupt:q(D,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,events:[],now:y,parser:t,previous:null,sliceSerialize:x,sliceStream:m,write:h};let u=r.tokenize.call(c,d);return r.resolveAll&&i.push(r),c;function h(L){return o=Ft(o,L),E(),o[o.length-1]!==null?[]:(M(r,0),c.events=ua(i,c.events,c),c.events)}function x(L,C){return Wh(m(L),C)}function m(L){return Uh(o,L)}function y(){const{_bufferIndex:L,_index:C,line:I,column:b,offset:z}=s;return{_bufferIndex:L,_index:C,line:I,column:b,offset:z}}function v(L){a[L.line]=L.column,R()}function E(){let L;for(;s._index<o.length;){const C=o[s._index];if(typeof C=="string")for(L=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===L&&s._bufferIndex<C.length;)A(C.charCodeAt(s._bufferIndex));else A(C)}}function A(L){u=u(L)}function T(L){Pe(L)?(s.line++,s.column=1,s.offset+=L===-3?2:1,R()):L!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),c.previous=L}function j(L,C){const I=C||{};return I.type=L,I.start=y(),c.events.push(["enter",I,c]),l.push(I),I}function W(L){const C=l.pop();return C.end=y(),c.events.push(["exit",C,c]),C}function Z(L,C){M(L,C.from)}function D(L,C){C.restore()}function q(L,C){return I;function I(b,z,K){let B,G,ie,N;return Array.isArray(b)?Fe(b):"tokenize"in b?Fe([b]):Ie(b);function Ie(re){return Ce;function Ce(Be){const ee=Be!==null&&re[Be],oe=Be!==null&&re.null,xe=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return Fe(xe)(Be)}}function Fe(re){return B=re,G=0,re.length===0?K:f(re[G])}function f(re){return Ce;function Ce(Be){return N=_(),ie=re,re.partial||(c.currentConstruct=re),re.name&&c.parser.constructs.disable.null.includes(re.name)?ue():re.tokenize.call(C?Object.assign(Object.create(c),C):c,d,te,ue)(Be)}}function te(re){return L(ie,N),z}function ue(re){return N.restore(),++G<B.length?f(B[G]):K}}}function M(L,C){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&Jt(c.events,C,c.events.length-C,L.resolve(c.events.slice(C),c)),L.resolveTo&&(c.events=L.resolveTo(c.events,c))}function _(){const L=y(),C=c.previous,I=c.currentConstruct,b=c.events.length,z=Array.from(l);return{from:b,restore:K};function K(){s=L,c.previous=C,c.currentConstruct=I,c.events.length=b,l=z,R()}}function R(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function Uh(t,r){const n=r.start._index,s=r.start._bufferIndex,a=r.end._index,i=r.end._bufferIndex;let o;if(n===a)o=[t[n].slice(s,i)];else{if(o=t.slice(n,a),s>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(s):o.shift()}i>0&&o.push(t[a].slice(0,i))}return o}function Wh(t,r){let n=-1;const s=[];let a;for(;++n<t.length;){const i=t[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
373
|
+
`;break}case-3:{o=`\r
|
|
374
|
+
`;break}case-2:{o=r?" ":" ";break}case-1:{if(!r&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,s.push(o)}return s.join("")}function qh(t){const s={constructs:Qm([Oh,...(t||{}).extensions||[]]),content:a(ap),defined:[],document:a(op),flow:a(Sh),lazy:{},string:a(Ih),text:a(Ah)};return s;function a(i){return o;function o(l){return Bh(s,i,l)}}}function Vh(t){for(;!Yo(t););return t}const pi=/[\0\t\n\r]/g;function Hh(){let t=1,r="",n=!0,s;return a;function a(i,o,l){const d=[];let c,u,h,x,m;for(i=r+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,r="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(pi.lastIndex=h,c=pi.exec(i),x=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(x),!c){r=i.slice(h);break}if(m===10&&h===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),h<x&&(d.push(i.slice(h,x)),t+=x-h),m){case 0:{d.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,d.push(-2);t++<u;)d.push(-1);break}case 10:{d.push(-4),t=1;break}default:s=!0,t=1}h=x+1}return l&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const Jh=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Gh(t){return t.replace(Jh,Kh)}function Kh(t,r,n){if(r)return r;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Ho(n.slice(i?2:1),i?16:10)}return da(n)||t}const rl={}.hasOwnProperty;function Yh(t,r,n){return typeof r!="string"&&(n=r,r=void 0),Qh(n)(Vh(qh(n).document().write(Hh()(t,r,!0))))}function Qh(t){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Me),autolinkProtocol:_,autolinkEmail:_,atxHeading:i(Ye),blockQuote:i(oe),characterEscape:_,characterReference:_,codeFenced:i(xe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(xe,o),codeText:i(Ne,o),codeTextData:_,data:_,codeFlowValue:_,definition:i(ye),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ue),hardBreakEscape:i(nt),hardBreakTrailing:i(nt),htmlFlow:i(me,o),htmlFlowData:_,htmlText:i(me,o),htmlTextData:_,image:i(pe),label:o,link:i(Me),listItem:i(it),listItemValue:x,listOrdered:i(et,h),listUnordered:i(et),paragraph:i(ge),reference:f,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ye),strong:i(wt),thematicBreak:i(ke)},exit:{atxHeading:d(),atxHeadingSequence:Z,autolink:d(),autolinkEmail:ee,autolinkProtocol:Be,blockQuote:d(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:re,characterReference:Ce,codeFenced:d(E),codeFencedFence:v,codeFencedFenceInfo:m,codeFencedFenceMeta:y,codeFlowValue:R,codeIndented:d(A),codeText:d(z),codeTextData:R,data:R,definition:d(),definitionDestinationString:W,definitionLabelString:T,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(C),hardBreakTrailing:d(C),htmlFlow:d(I),htmlFlowData:R,htmlText:d(b),htmlTextData:R,image:d(B),label:ie,labelText:G,lineEnding:L,link:d(K),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:te,resourceDestinationString:N,resourceTitleString:Ie,resource:Fe,setextHeading:d(M),setextHeadingLineSequence:q,setextHeadingText:D,strong:d(),thematicBreak:d()}};nl(r,(t||{}).mdastExtensions||[]);const n={};return s;function s(k){let P={type:"root",children:[]};const J={stack:[P],tokenStack:[],config:r,enter:l,exit:c,buffer:o,resume:u,data:n},se=[];let le=-1;for(;++le<k.length;)if(k[le][1].type==="listOrdered"||k[le][1].type==="listUnordered")if(k[le][0]==="enter")se.push(le);else{const Le=se.pop();le=a(k,Le,le)}for(le=-1;++le<k.length;){const Le=r[k[le][0]];rl.call(Le,k[le][1].type)&&Le[k[le][1].type].call(Object.assign({sliceSerialize:k[le][2].sliceSerialize},J),k[le][1])}if(J.tokenStack.length>0){const Le=J.tokenStack[J.tokenStack.length-1];(Le[1]||hi).call(J,void 0,Le[0])}for(P.position={start:ar(k.length>0?k[0][1].start:{line:1,column:1,offset:0}),end:ar(k.length>0?k[k.length-2][1].end:{line:1,column:1,offset:0})},le=-1;++le<r.transforms.length;)P=r.transforms[le](P)||P;return P}function a(k,P,J){let se=P-1,le=-1,Le=!1,De,Ge,mt,Ze;for(;++se<=J;){const st=k[se];switch(st[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{st[0]==="enter"?le++:le--,Ze=void 0;break}case"lineEndingBlank":{st[0]==="enter"&&(De&&!Ze&&!le&&!mt&&(mt=se),Ze=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ze=void 0}if(!le&&st[0]==="enter"&&st[1].type==="listItemPrefix"||le===-1&&st[0]==="exit"&&(st[1].type==="listUnordered"||st[1].type==="listOrdered")){if(De){let ht=se;for(Ge=void 0;ht--;){const ct=k[ht];if(ct[1].type==="lineEnding"||ct[1].type==="lineEndingBlank"){if(ct[0]==="exit")continue;Ge&&(k[Ge][1].type="lineEndingBlank",Le=!0),ct[1].type="lineEnding",Ge=ht}else if(!(ct[1].type==="linePrefix"||ct[1].type==="blockQuotePrefix"||ct[1].type==="blockQuotePrefixWhitespace"||ct[1].type==="blockQuoteMarker"||ct[1].type==="listItemIndent"))break}mt&&(!Ge||mt<Ge)&&(De._spread=!0),De.end=Object.assign({},Ge?k[Ge][1].start:st[1].end),k.splice(Ge||se,0,["exit",De,st[2]]),se++,J++}if(st[1].type==="listItemPrefix"){const ht={type:"listItem",_spread:!1,start:Object.assign({},st[1].start),end:void 0};De=ht,k.splice(se,0,["enter",ht,st[2]]),se++,J++,mt=void 0,Ze=!0}}}return k[P][1]._spread=Le,J}function i(k,P){return J;function J(se){l.call(this,k(se),se),P&&P.call(this,se)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(k,P,J){this.stack[this.stack.length-1].children.push(k),this.stack.push(k),this.tokenStack.push([P,J||void 0]),k.position={start:ar(P.start),end:void 0}}function d(k){return P;function P(J){k&&k.call(this,J),c.call(this,J)}}function c(k,P){const J=this.stack.pop(),se=this.tokenStack.pop();if(se)se[0].type!==k.type&&(P?P.call(this,k,se[0]):(se[1]||hi).call(this,k,se[0]));else throw new Error("Cannot close `"+k.type+"` ("+Zr({start:k.start,end:k.end})+"): itβs not open");J.position.end=ar(k.end)}function u(){return Km(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function x(k){if(this.data.expectingFirstListItemValue){const P=this.stack[this.stack.length-2];P.start=Number.parseInt(this.sliceSerialize(k),10),this.data.expectingFirstListItemValue=void 0}}function m(){const k=this.resume(),P=this.stack[this.stack.length-1];P.lang=k}function y(){const k=this.resume(),P=this.stack[this.stack.length-1];P.meta=k}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k.replace(/(\r?\n|\r)$/g,"")}function T(k){const P=this.resume(),J=this.stack[this.stack.length-1];J.label=P,J.identifier=Tr(this.sliceSerialize(k)).toLowerCase()}function j(){const k=this.resume(),P=this.stack[this.stack.length-1];P.title=k}function W(){const k=this.resume(),P=this.stack[this.stack.length-1];P.url=k}function Z(k){const P=this.stack[this.stack.length-1];if(!P.depth){const J=this.sliceSerialize(k).length;P.depth=J}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function q(k){const P=this.stack[this.stack.length-1];P.depth=this.sliceSerialize(k).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function _(k){const J=this.stack[this.stack.length-1].children;let se=J[J.length-1];(!se||se.type!=="text")&&(se=X(),se.position={start:ar(k.start),end:void 0},J.push(se)),this.stack.push(se)}function R(k){const P=this.stack.pop();P.value+=this.sliceSerialize(k),P.position.end=ar(k.end)}function L(k){const P=this.stack[this.stack.length-1];if(this.data.atHardBreak){const J=P.children[P.children.length-1];J.position.end=ar(k.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(P.type)&&(_.call(this,k),R.call(this,k))}function C(){this.data.atHardBreak=!0}function I(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k}function b(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k}function z(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k}function K(){const k=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";k.type+="Reference",k.referenceType=P,delete k.url,delete k.title}else delete k.identifier,delete k.label;this.data.referenceType=void 0}function B(){const k=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";k.type+="Reference",k.referenceType=P,delete k.url,delete k.title}else delete k.identifier,delete k.label;this.data.referenceType=void 0}function G(k){const P=this.sliceSerialize(k),J=this.stack[this.stack.length-2];J.label=Gh(P),J.identifier=Tr(P).toLowerCase()}function ie(){const k=this.stack[this.stack.length-1],P=this.resume(),J=this.stack[this.stack.length-1];if(this.data.inReference=!0,J.type==="link"){const se=k.children;J.children=se}else J.alt=P}function N(){const k=this.resume(),P=this.stack[this.stack.length-1];P.url=k}function Ie(){const k=this.resume(),P=this.stack[this.stack.length-1];P.title=k}function Fe(){this.data.inReference=void 0}function f(){this.data.referenceType="collapsed"}function te(k){const P=this.resume(),J=this.stack[this.stack.length-1];J.label=P,J.identifier=Tr(this.sliceSerialize(k)).toLowerCase(),this.data.referenceType="full"}function ue(k){this.data.characterReferenceType=k.type}function re(k){const P=this.sliceSerialize(k),J=this.data.characterReferenceType;let se;J?(se=Ho(P,J==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):se=da(P);const le=this.stack[this.stack.length-1];le.value+=se}function Ce(k){const P=this.stack.pop();P.position.end=ar(k.end)}function Be(k){R.call(this,k);const P=this.stack[this.stack.length-1];P.url=this.sliceSerialize(k)}function ee(k){R.call(this,k);const P=this.stack[this.stack.length-1];P.url="mailto:"+this.sliceSerialize(k)}function oe(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function Ne(){return{type:"inlineCode",value:""}}function ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ue(){return{type:"emphasis",children:[]}}function Ye(){return{type:"heading",depth:0,children:[]}}function nt(){return{type:"break"}}function me(){return{type:"html",value:""}}function pe(){return{type:"image",title:null,url:"",alt:null}}function Me(){return{type:"link",title:null,url:"",children:[]}}function et(k){return{type:"list",ordered:k.type==="listOrdered",start:null,spread:k._spread,children:[]}}function it(k){return{type:"listItem",spread:k._spread,checked:null,children:[]}}function ge(){return{type:"paragraph",children:[]}}function wt(){return{type:"strong",children:[]}}function X(){return{type:"text",value:""}}function ke(){return{type:"thematicBreak"}}}function ar(t){return{line:t.line,column:t.column,offset:t.offset}}function nl(t,r){let n=-1;for(;++n<r.length;){const s=r[n];Array.isArray(s)?nl(t,s):Xh(t,s)}}function Xh(t,r){let n;for(n in r)if(rl.call(r,n))switch(n){case"canContainEols":{const s=r[n];s&&t[n].push(...s);break}case"transforms":{const s=r[n];s&&t[n].push(...s);break}case"enter":case"exit":{const s=r[n];s&&Object.assign(t[n],s);break}}}function hi(t,r){throw t?new Error("Cannot close `"+t.type+"` ("+Zr({start:t.start,end:t.end})+"): a different token (`"+r.type+"`, "+Zr({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Zr({start:r.start,end:r.end})+") is still open")}function Zh(t){const r=this;r.parser=n;function n(s){return Yh(s,{...r.data("settings"),...t,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function e0(t,r){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(r),!0)};return t.patch(r,n),t.applyData(r,n)}function t0(t,r){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(r,n),[t.applyData(r,n),{type:"text",value:`
|
|
375
|
+
`}]}function r0(t,r){const n=r.value?r.value+`
|
|
376
|
+
`:"",s={};r.lang&&(s.className=["language-"+r.lang]);let a={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return r.meta&&(a.data={meta:r.meta}),t.patch(r,a),a=t.applyData(r,a),a={type:"element",tagName:"pre",properties:{},children:[a]},t.patch(r,a),a}function n0(t,r){const n={type:"element",tagName:"del",properties:{},children:t.all(r)};return t.patch(r,n),t.applyData(r,n)}function s0(t,r){const n={type:"element",tagName:"em",properties:{},children:t.all(r)};return t.patch(r,n),t.applyData(r,n)}function a0(t,r){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),a=$r(s.toLowerCase()),i=t.footnoteOrder.indexOf(s);let o,l=t.footnoteCounts.get(s);l===void 0?(l=0,t.footnoteOrder.push(s),o=t.footnoteOrder.length):o=i+1,l+=1,t.footnoteCounts.set(s,l);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(r,d);const c={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(r,c),t.applyData(r,c)}function i0(t,r){const n={type:"element",tagName:"h"+r.depth,properties:{},children:t.all(r)};return t.patch(r,n),t.applyData(r,n)}function o0(t,r){if(t.options.allowDangerousHtml){const n={type:"raw",value:r.value};return t.patch(r,n),t.applyData(r,n)}}function sl(t,r){const n=r.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const a=t.all(r),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=s:a.push({type:"text",value:s}),a}function l0(t,r){const n=String(r.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return sl(t,r);const a={src:$r(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"img",properties:a,children:[]};return t.patch(r,i),t.applyData(r,i)}function c0(t,r){const n={src:$r(r.url)};r.alt!==null&&r.alt!==void 0&&(n.alt=r.alt),r.title!==null&&r.title!==void 0&&(n.title=r.title);const s={type:"element",tagName:"img",properties:n,children:[]};return t.patch(r,s),t.applyData(r,s)}function d0(t,r){const n={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};t.patch(r,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(r,s),t.applyData(r,s)}function u0(t,r){const n=String(r.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return sl(t,r);const a={href:$r(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"a",properties:a,children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function m0(t,r){const n={href:$r(r.url)};r.title!==null&&r.title!==void 0&&(n.title=r.title);const s={type:"element",tagName:"a",properties:n,children:t.all(r)};return t.patch(r,s),t.applyData(r,s)}function p0(t,r,n){const s=t.all(r),a=n?h0(n):al(r),i={},o=[];if(typeof r.checked=="boolean"){const u=s[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},s.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const u=s[l];(a||l!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
377
|
+
`}),u.type==="element"&&u.tagName==="p"&&!a?o.push(...u.children):o.push(u)}const d=s[s.length-1];d&&(a||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
|
|
378
|
+
`});const c={type:"element",tagName:"li",properties:i,children:o};return t.patch(r,c),t.applyData(r,c)}function h0(t){let r=!1;if(t.type==="list"){r=t.spread||!1;const n=t.children;let s=-1;for(;!r&&++s<n.length;)r=al(n[s])}return r}function al(t){const r=t.spread;return r??t.children.length>1}function x0(t,r){const n={},s=t.all(r);let a=-1;for(typeof r.start=="number"&&r.start!==1&&(n.start=r.start);++a<s.length;){const o=s[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:r.ordered?"ol":"ul",properties:n,children:t.wrap(s,!0)};return t.patch(r,i),t.applyData(r,i)}function g0(t,r){const n={type:"element",tagName:"p",properties:{},children:t.all(r)};return t.patch(r,n),t.applyData(r,n)}function f0(t,r){const n={type:"root",children:t.wrap(t.all(r))};return t.patch(r,n),t.applyData(r,n)}function b0(t,r){const n={type:"element",tagName:"strong",properties:{},children:t.all(r)};return t.patch(r,n),t.applyData(r,n)}function y0(t,r){const n=t.all(r),s=n.shift(),a=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([s],!0)};t.patch(r.children[0],o),a.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=ia(r.children[1]),d=$o(r.children[r.children.length-1]);l&&d&&(o.position={start:l,end:d}),a.push(o)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(a,!0)};return t.patch(r,i),t.applyData(r,i)}function k0(t,r,n){const s=n?n.children:void 0,i=(s?s.indexOf(r):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:r.children.length;let d=-1;const c=[];for(;++d<l;){const h=r.children[d],x={},m=o?o[d]:void 0;m&&(x.align=m);let y={type:"element",tagName:i,properties:x,children:[]};h&&(y.children=t.all(h),t.patch(h,y),y=t.applyData(h,y)),c.push(y)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(r,u),t.applyData(r,u)}function v0(t,r){const n={type:"element",tagName:"td",properties:{},children:t.all(r)};return t.patch(r,n),t.applyData(r,n)}const xi=9,gi=32;function w0(t){const r=String(t),n=/\r?\n|\r/g;let s=n.exec(r),a=0;const i=[];for(;s;)i.push(fi(r.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(r);return i.push(fi(r.slice(a),a>0,!1)),i.join("")}function fi(t,r,n){let s=0,a=t.length;if(r){let i=t.codePointAt(s);for(;i===xi||i===gi;)s++,i=t.codePointAt(s)}if(n){let i=t.codePointAt(a-1);for(;i===xi||i===gi;)a--,i=t.codePointAt(a-1)}return a>s?t.slice(s,a):""}function j0(t,r){const n={type:"text",value:w0(String(r.value))};return t.patch(r,n),t.applyData(r,n)}function N0(t,r){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(r,n),t.applyData(r,n)}const S0={blockquote:e0,break:t0,code:r0,delete:n0,emphasis:s0,footnoteReference:a0,heading:i0,html:o0,imageReference:l0,image:c0,inlineCode:d0,linkReference:u0,link:m0,listItem:p0,list:x0,paragraph:g0,root:f0,strong:b0,table:y0,tableCell:v0,tableRow:k0,text:j0,thematicBreak:N0,toml:Nn,yaml:Nn,definition:Nn,footnoteDefinition:Nn};function Nn(){}const il=-1,Vn=0,tn=1,zn=2,pa=3,ha=4,xa=5,ga=6,ol=7,ll=8,bi=typeof self=="object"?self:globalThis,C0=(t,r)=>{const n=(a,i)=>(t.set(i,a),a),s=a=>{if(t.has(a))return t.get(a);const[i,o]=r[a];switch(i){case Vn:case il:return n(o,a);case tn:{const l=n([],a);for(const d of o)l.push(s(d));return l}case zn:{const l=n({},a);for(const[d,c]of o)l[s(d)]=s(c);return l}case pa:return n(new Date(o),a);case ha:{const{source:l,flags:d}=o;return n(new RegExp(l,d),a)}case xa:{const l=n(new Map,a);for(const[d,c]of o)l.set(s(d),s(c));return l}case ga:{const l=n(new Set,a);for(const d of o)l.add(s(d));return l}case ol:{const{name:l,message:d}=o;return n(new bi[l](d),a)}case ll:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new bi[i](o),a)};return s},yi=t=>C0(new Map,t)(0),Er="",{toString:E0}={},{keys:I0}=Object,Kr=t=>{const r=typeof t;if(r!=="object"||!t)return[Vn,r];const n=E0.call(t).slice(8,-1);switch(n){case"Array":return[tn,Er];case"Object":return[zn,Er];case"Date":return[pa,Er];case"RegExp":return[ha,Er];case"Map":return[xa,Er];case"Set":return[ga,Er];case"DataView":return[tn,n]}return n.includes("Array")?[tn,n]:n.includes("Error")?[ol,n]:[zn,n]},Sn=([t,r])=>t===Vn&&(r==="function"||r==="symbol"),A0=(t,r,n,s)=>{const a=(o,l)=>{const d=s.push(o)-1;return n.set(l,d),d},i=o=>{if(n.has(o))return n.get(o);let[l,d]=Kr(o);switch(l){case Vn:{let u=o;switch(d){case"bigint":l=ll,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);u=null;break;case"undefined":return a([il],o)}return a([l,u],o)}case tn:{if(d){let x=o;return d==="DataView"?x=new Uint8Array(o.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(o)),a([d,[...x]],o)}const u=[],h=a([l,u],o);for(const x of o)u.push(i(x));return h}case zn:{if(d)switch(d){case"BigInt":return a([d,o.toString()],o);case"Boolean":case"Number":case"String":return a([d,o.valueOf()],o)}if(r&&"toJSON"in o)return i(o.toJSON());const u=[],h=a([l,u],o);for(const x of I0(o))(t||!Sn(Kr(o[x])))&&u.push([i(x),i(o[x])]);return h}case pa:return a([l,o.toISOString()],o);case ha:{const{source:u,flags:h}=o;return a([l,{source:u,flags:h}],o)}case xa:{const u=[],h=a([l,u],o);for(const[x,m]of o)(t||!(Sn(Kr(x))||Sn(Kr(m))))&&u.push([i(x),i(m)]);return h}case ga:{const u=[],h=a([l,u],o);for(const x of o)(t||!Sn(Kr(x)))&&u.push(i(x));return h}}const{message:c}=o;return a([l,{name:d,message:c}],o)};return i},ki=(t,{json:r,lossy:n}={})=>{const s=[];return A0(!(r||n),!!r,new Map,s)(t),s},_n=typeof structuredClone=="function"?(t,r)=>r&&("json"in r||"lossy"in r)?yi(ki(t,r)):structuredClone(t):(t,r)=>yi(ki(t,r));function M0(t,r){const n=[{type:"text",value:"β©"}];return r>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),n}function T0(t,r){return"Back to reference "+(t+1)+(r>1?"-"+r:"")}function D0(t){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||M0,s=t.options.footnoteBackLabel||T0,a=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let d=-1;for(;++d<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[d]);if(!c)continue;const u=t.all(c),h=String(c.identifier).toUpperCase(),x=$r(h.toLowerCase());let m=0;const y=[],v=t.footnoteCounts.get(h);for(;v!==void 0&&++m<=v;){y.length>0&&y.push({type:"text",value:" "});let T=typeof n=="string"?n:n(d,m);typeof T=="string"&&(T={type:"text",value:T}),y.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+x+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,m),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const E=u[u.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const T=E.children[E.children.length-1];T&&T.type==="text"?T.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...y)}else u.push(...y);const A={type:"element",tagName:"li",properties:{id:r+"fn-"+x},children:t.wrap(u,!0)};t.patch(c,A),l.push(A)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{..._n(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
379
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
|
|
380
|
+
`}]}}const cl=function(t){if(t==null)return z0;if(typeof t=="function")return Hn(t);if(typeof t=="object")return Array.isArray(t)?P0(t):L0(t);if(typeof t=="string")return R0(t);throw new Error("Expected function, string, or object as test")};function P0(t){const r=[];let n=-1;for(;++n<t.length;)r[n]=cl(t[n]);return Hn(s);function s(...a){let i=-1;for(;++i<r.length;)if(r[i].apply(this,a))return!0;return!1}}function L0(t){const r=t;return Hn(n);function n(s){const a=s;let i;for(i in t)if(a[i]!==r[i])return!1;return!0}}function R0(t){return Hn(r);function r(n){return n&&n.type===t}}function Hn(t){return r;function r(n,s,a){return!!(_0(n)&&t.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function z0(){return!0}function _0(t){return t!==null&&typeof t=="object"&&"type"in t}const dl=[],F0=!0,vi=!1,$0="skip";function O0(t,r,n,s){let a;typeof r=="function"&&typeof n!="function"?(s=n,n=r):a=r;const i=cl(a),o=s?-1:1;l(t,void 0,[])();function l(d,c,u){const h=d&&typeof d=="object"?d:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(m?"<"+m+">":""))+")"})}return x;function x(){let m=dl,y,v,E;if((!r||i(d,c,u[u.length-1]||void 0))&&(m=B0(n(d,u)),m[0]===vi))return m;if("children"in d&&d.children){const A=d;if(A.children&&m[0]!==$0)for(v=(s?A.children.length:-1)+o,E=u.concat(A);v>-1&&v<A.children.length;){const T=A.children[v];if(y=l(T,v,E)(),y[0]===vi)return y;v=typeof y[1]=="number"?y[1]:v+o}}return m}}}function B0(t){return Array.isArray(t)?t:typeof t=="number"?[F0,t]:t==null?dl:[t]}function ul(t,r,n,s){let a,i,o;typeof r=="function"&&typeof n!="function"?(i=void 0,o=r,a=n):(i=r,o=n,a=s),O0(t,i,l,a);function l(d,c){const u=c[c.length-1],h=u?u.children.indexOf(d):void 0;return o(d,h,u)}}const Fs={}.hasOwnProperty,U0={};function W0(t,r){const n=r||U0,s=new Map,a=new Map,i=new Map,o={...S0,...n.handlers},l={all:c,applyData:V0,definitionById:s,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:d,options:n,patch:q0,wrap:J0};return ul(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const h=u.type==="definition"?s:a,x=String(u.identifier).toUpperCase();h.has(x)||h.set(x,u)}}),l;function d(u,h){const x=u.type,m=l.handlers[x];if(Fs.call(l.handlers,x)&&m)return m(l,u,h);if(l.options.passThrough&&l.options.passThrough.includes(x)){if("children"in u){const{children:v,...E}=u,A=_n(E);return A.children=l.all(u),A}return _n(u)}return(l.options.unknownHandler||H0)(l,u,h)}function c(u){const h=[];if("children"in u){const x=u.children;let m=-1;for(;++m<x.length;){const y=l.one(x[m],u);if(y){if(m&&x[m-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=wi(y.value)),!Array.isArray(y)&&y.type==="element")){const v=y.children[0];v&&v.type==="text"&&(v.value=wi(v.value))}Array.isArray(y)?h.push(...y):h.push(y)}}}return h}}function q0(t,r){t.position&&(r.position=Em(t))}function V0(t,r){let n=r;if(t&&t.data){const s=t.data.hName,a=t.data.hChildren,i=t.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,_n(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function H0(t,r){const n=r.data||{},s="value"in r&&!(Fs.call(n,"hProperties")||Fs.call(n,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:t.all(r)};return t.patch(r,s),t.applyData(r,s)}function J0(t,r){const n=[];let s=-1;for(r&&n.push({type:"text",value:`
|
|
381
|
+
`});++s<t.length;)s&&n.push({type:"text",value:`
|
|
382
|
+
`}),n.push(t[s]);return r&&t.length>0&&n.push({type:"text",value:`
|
|
383
|
+
`}),n}function wi(t){let r=0,n=t.charCodeAt(r);for(;n===9||n===32;)r++,n=t.charCodeAt(r);return t.slice(r)}function ji(t,r){const n=W0(t,r),s=n.one(t,void 0),a=D0(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
|
|
384
|
+
`},a),i}function G0(t,r){return t&&"run"in t?async function(n,s){const a=ji(n,{file:s,...r});await t.run(a,s)}:function(n,s){return ji(n,{file:s,...t||r})}}function Ni(t){if(t)throw t}var ds,Si;function K0(){if(Si)return ds;Si=1;var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(c){return typeof Array.isArray=="function"?Array.isArray(c):r.call(c)==="[object Array]"},i=function(c){if(!c||r.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!h)return!1;var x;for(x in c);return typeof x>"u"||t.call(c,x)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},l=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(s)return s(c,u).value}else return;return c[u]};return ds=function d(){var c,u,h,x,m,y,v=arguments[0],E=1,A=arguments.length,T=!1;for(typeof v=="boolean"&&(T=v,v=arguments[1]||{},E=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});E<A;++E)if(c=arguments[E],c!=null)for(u in c)h=l(v,u),x=l(c,u),v!==x&&(T&&x&&(i(x)||(m=a(x)))?(m?(m=!1,y=h&&a(h)?h:[]):y=h&&i(h)?h:{},o(v,{name:u,newValue:d(T,y,x)})):typeof x<"u"&&o(v,{name:u,newValue:x}));return v},ds}var Y0=K0();const us=on(Y0);function $s(t){if(typeof t!="object"||t===null)return!1;const r=Object.getPrototypeOf(t);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Q0(){const t=[],r={run:n,use:s};return r;function n(...a){let i=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(d,...c){const u=t[++i];let h=-1;if(d){o(d);return}for(;++h<a.length;)(c[h]===null||c[h]===void 0)&&(c[h]=a[h]);a=c,u?X0(u,l)(...c):o(null,...c)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return t.push(a),r}}function X0(t,r){let n;return s;function s(...o){const l=t.length>o.length;let d;l&&o.push(a);try{d=t.apply(this,o)}catch(c){const u=c;if(l&&n)throw u;return a(u)}l||(d&&d.then&&typeof d.then=="function"?d.then(i,a):d instanceof Error?a(d):i(d))}function a(o,...l){n||(n=!0,r(o,...l))}function i(o){a(null,o)}}const Ut={basename:Z0,dirname:ex,extname:tx,join:rx,sep:"/"};function Z0(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');pn(t);let n=0,s=-1,a=t.length,i;if(r===void 0||r.length===0||r.length>t.length){for(;a--;)if(t.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1);return s<0?"":t.slice(n,s)}if(r===t)return"";let o=-1,l=r.length-1;for(;a--;)if(t.codePointAt(a)===47){if(i){n=a+1;break}}else o<0&&(i=!0,o=a+1),l>-1&&(t.codePointAt(a)===r.codePointAt(l--)?l<0&&(s=a):(l=-1,s=o));return n===s?s=o:s<0&&(s=t.length),t.slice(n,s)}function ex(t){if(pn(t),t.length===0)return".";let r=-1,n=t.length,s;for(;--n;)if(t.codePointAt(n)===47){if(s){r=n;break}}else s||(s=!0);return r<0?t.codePointAt(0)===47?"/":".":r===1&&t.codePointAt(0)===47?"//":t.slice(0,r)}function tx(t){pn(t);let r=t.length,n=-1,s=0,a=-1,i=0,o;for(;r--;){const l=t.codePointAt(r);if(l===47){if(o){s=r+1;break}continue}n<0&&(o=!0,n=r+1),l===46?a<0?a=r:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===s+1?"":t.slice(a,n)}function rx(...t){let r=-1,n;for(;++r<t.length;)pn(t[r]),t[r]&&(n=n===void 0?t[r]:n+"/"+t[r]);return n===void 0?".":nx(n)}function nx(t){pn(t);const r=t.codePointAt(0)===47;let n=sx(t,!r);return n.length===0&&!r&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),r?"/"+n:n}function sx(t,r){let n="",s=0,a=-1,i=0,o=-1,l,d;for(;++o<=t.length;){if(o<t.length)l=t.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(a===o-1||i===1))if(a!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf("/")),a=o,i=0;continue}}else if(n.length>0){n="",s=0,a=o,i=0;continue}}r&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+t.slice(a+1,o):n=t.slice(a+1,o),s=o-a-1;a=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function pn(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const ax={cwd:ix};function ix(){return"/"}function Os(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function ox(t){if(typeof t=="string")t=new URL(t);else if(!Os(t)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(t.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return lx(t)}function lx(t){if(t.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=t.pathname;let n=-1;for(;++n<r.length;)if(r.codePointAt(n)===37&&r.codePointAt(n+1)===50){const s=r.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(r)}const ms=["history","path","basename","stem","extname","dirname"];class ml{constructor(r){let n;r?Os(r)?n={path:r}:typeof r=="string"||cx(r)?n={value:r}:n=r:n={},this.cwd="cwd"in n?"":ax.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<ms.length;){const i=ms[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)ms.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ut.basename(this.path):void 0}set basename(r){hs(r,"basename"),ps(r,"basename"),this.path=Ut.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Ut.dirname(this.path):void 0}set dirname(r){Ci(this.basename,"dirname"),this.path=Ut.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Ut.extname(this.path):void 0}set extname(r){if(ps(r,"extname"),Ci(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ut.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){Os(r)&&(r=ox(r)),hs(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?Ut.basename(this.path,this.extname):void 0}set stem(r){hs(r,"stem"),ps(r,"stem"),this.path=Ut.join(this.dirname||"",r+(this.extname||""))}fail(r,n,s){const a=this.message(r,n,s);throw a.fatal=!0,a}info(r,n,s){const a=this.message(r,n,s);return a.fatal=void 0,a}message(r,n,s){const a=new vt(r,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function ps(t,r){if(t&&t.includes(Ut.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Ut.sep+"`")}function hs(t,r){if(!t)throw new Error("`"+r+"` cannot be empty")}function Ci(t,r){if(!t)throw new Error("Setting `"+r+"` requires `path` to be set too")}function cx(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const dx=function(t){const s=this.constructor.prototype,a=s[t],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},ux={}.hasOwnProperty;class fa extends dx{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Q0()}copy(){const r=new fa;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];r.use(...s)}return r.data(us(!0,{},this.namespace)),r}data(r,n){return typeof r=="string"?arguments.length===2?(fs("data",this.frozen),this.namespace[r]=n,this):ux.call(this.namespace,r)&&this.namespace[r]||void 0:r?(fs("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(r,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const n=Cn(r),s=this.parser||this.Parser;return xs("parse",s),s(String(n),n)}process(r,n){const s=this;return this.freeze(),xs("process",this.parser||this.Parser),gs("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,o){const l=Cn(r),d=s.parse(l);s.run(d,l,function(u,h,x){if(u||!h||!x)return c(u);const m=h,y=s.stringify(m,x);hx(y)?x.value=y:x.result=y,c(u,x)});function c(u,h){u||!h?o(u):i?i(h):n(void 0,h)}}}processSync(r){let n=!1,s;return this.freeze(),xs("processSync",this.parser||this.Parser),gs("processSync",this.compiler||this.Compiler),this.process(r,a),Ii("processSync","process",n),s;function a(i,o){n=!0,Ni(i),s=o}}run(r,n,s){Ei(r),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,l){const d=Cn(n);a.run(r,d,c);function c(u,h,x){const m=h||r;u?l(u):o?o(m):s(void 0,m,x)}}}runSync(r,n){let s=!1,a;return this.run(r,n,i),Ii("runSync","run",s),a;function i(o,l){Ni(o),a=l,s=!0}}stringify(r,n){this.freeze();const s=Cn(n),a=this.compiler||this.Compiler;return gs("stringify",a),Ei(r),a(r,s)}use(r,...n){const s=this.attachers,a=this.namespace;if(fs("use",this.frozen),r!=null)if(typeof r=="function")d(r,n);else if(typeof r=="object")Array.isArray(r)?l(r):o(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function i(c){if(typeof c=="function")d(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...h]=c;d(u,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(a.settings=us(!0,a.settings,c.settings))}function l(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const h=c[u];i(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function d(c,u){let h=-1,x=-1;for(;++h<s.length;)if(s[h][0]===c){x=h;break}if(x===-1)s.push([c,...u]);else if(u.length>0){let[m,...y]=u;const v=s[x][1];$s(v)&&$s(m)&&(m=us(!0,v,m)),s[x]=[c,m,...y]}}}}const mx=new fa().freeze();function xs(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function gs(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function fs(t,r){if(r)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ei(t){if(!$s(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ii(t,r,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+r+"` instead")}function Cn(t){return px(t)?t:new ml(t)}function px(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function hx(t){return typeof t=="string"||xx(t)}function xx(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const gx="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ai=[],Mi={allowDangerousHtml:!0},fx=/^(https?|ircs?|mailto|xmpp)$/i,bx=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Yr(t){const r=yx(t),n=kx(t);return vx(r.runSync(r.parse(n),n),t)}function yx(t){const r=t.rehypePlugins||Ai,n=t.remarkPlugins||Ai,s=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Mi}:Mi;return mx().use(Zh).use(n).use(G0,s).use(r)}function kx(t){const r=t.children||"",n=new ml;return typeof r=="string"&&(n.value=r),n}function vx(t,r){const n=r.allowedElements,s=r.allowElement,a=r.components,i=r.disallowedElements,o=r.skipHtml,l=r.unwrapDisallowed,d=r.urlTransform||wx;for(const u of bx)Object.hasOwn(r,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+gx+u.id,void 0);return ul(t,c),Dm(t,{Fragment:e.Fragment,components:a,ignoreInvalidStyle:!0,jsx:e.jsx,jsxs:e.jsxs,passKeys:!0,passNode:!0});function c(u,h,x){if(u.type==="raw"&&x&&typeof h=="number")return o?x.children.splice(h,1):x.children[h]={type:"text",value:u.value},h;if(u.type==="element"){let m;for(m in os)if(Object.hasOwn(os,m)&&Object.hasOwn(u.properties,m)){const y=u.properties[m],v=os[m];(v===null||v.includes(u.tagName))&&(u.properties[m]=d(String(y||""),m,u))}}if(u.type==="element"){let m=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!m&&s&&typeof h=="number"&&(m=!s(u,h,x)),m&&x&&typeof h=="number")return l&&u.children?x.children.splice(h,1,...u.children):x.children.splice(h,1),h}}}function wx(t){const r=t.indexOf(":"),n=t.indexOf("?"),s=t.indexOf("#"),a=t.indexOf("/");return r===-1||a!==-1&&r>a||n!==-1&&r>n||s!==-1&&r>s||fx.test(t.slice(0,r))?t:""}var bs={exports:{}},ys,Ti;function jx(){if(Ti)return ys;Ti=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ys=t,ys}var ks,Di;function Nx(){if(Di)return ks;Di=1;var t=jx();function r(){}function n(){}return n.resetWarningCache=r,ks=function(){function s(o,l,d,c,u,h){if(h!==t){var x=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw x.name="Invariant Violation",x}}s.isRequired=s;function a(){return s}var i={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:a,element:s,elementType:s,instanceOf:a,node:s,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:r};return i.PropTypes=i,i},ks}var Pi;function Sx(){return Pi||(Pi=1,bs.exports=Nx()()),bs.exports}var Cx=Sx();const ot=on(Cx);function wr(t,r,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):a(u.value).then(l,d)}c((s=s.apply(t,r||[])).next())})}const Ex=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function Rr(t,r,n){const s=Ix(t),{webkitRelativePath:a}=t,i=typeof r=="string"?r:typeof a=="string"&&a.length>0?a:`./${t.name}`;return typeof s.path!="string"&&Li(s,"path",i),Li(s,"relativePath",i),s}function Ix(t){const{name:r}=t;if(r&&r.lastIndexOf(".")!==-1&&!t.type){const s=r.split(".").pop().toLowerCase(),a=Ex.get(s);a&&Object.defineProperty(t,"type",{value:a,writable:!1,configurable:!1,enumerable:!0})}return t}function Li(t,r,n){Object.defineProperty(t,r,{value:n,writable:!1,configurable:!1,enumerable:!0})}const Ax=[".DS_Store","Thumbs.db"];function Mx(t){return wr(this,void 0,void 0,function*(){return Fn(t)&&Tx(t.dataTransfer)?Rx(t.dataTransfer,t.type):Dx(t)?Px(t):Array.isArray(t)&&t.every(r=>"getFile"in r&&typeof r.getFile=="function")?Lx(t):[]})}function Tx(t){return Fn(t)}function Dx(t){return Fn(t)&&Fn(t.target)}function Fn(t){return typeof t=="object"&&t!==null}function Px(t){return Bs(t.target.files).map(r=>Rr(r))}function Lx(t){return wr(this,void 0,void 0,function*(){return(yield Promise.all(t.map(n=>n.getFile()))).map(n=>Rr(n))})}function Rx(t,r){return wr(this,void 0,void 0,function*(){if(t.items){const n=Bs(t.items).filter(a=>a.kind==="file");if(r!=="drop")return n;const s=yield Promise.all(n.map(zx));return Ri(pl(s))}return Ri(Bs(t.files).map(n=>Rr(n)))})}function Ri(t){return t.filter(r=>Ax.indexOf(r.name)===-1)}function Bs(t){if(t===null)return[];const r=[];for(let n=0;n<t.length;n++){const s=t[n];r.push(s)}return r}function zx(t){if(typeof t.webkitGetAsEntry!="function")return zi(t);const r=t.webkitGetAsEntry();return r&&r.isDirectory?hl(r):zi(t,r)}function pl(t){return t.reduce((r,n)=>[...r,...Array.isArray(n)?pl(n):[n]],[])}function zi(t,r){return wr(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof t.getAsFileSystemHandle=="function"){const i=yield t.getAsFileSystemHandle();if(i===null)throw new Error(`${t} is not a File`);if(i!==void 0){const o=yield i.getFile();return o.handle=i,Rr(o)}}const s=t.getAsFile();if(!s)throw new Error(`${t} is not a File`);return Rr(s,(n=r?.fullPath)!==null&&n!==void 0?n:void 0)})}function _x(t){return wr(this,void 0,void 0,function*(){return t.isDirectory?hl(t):Fx(t)})}function hl(t){const r=t.createReader();return new Promise((n,s)=>{const a=[];function i(){r.readEntries(o=>wr(this,void 0,void 0,function*(){if(o.length){const l=Promise.all(o.map(_x));a.push(l),i()}else try{const l=yield Promise.all(a);n(l)}catch(l){s(l)}}),o=>{s(o)})}i()})}function Fx(t){return wr(this,void 0,void 0,function*(){return new Promise((r,n)=>{t.file(s=>{const a=Rr(s,t.fullPath);r(a)},s=>{n(s)})})})}var En={},_i;function $x(){return _i||(_i=1,En.__esModule=!0,En.default=function(t,r){if(t&&r){var n=Array.isArray(r)?r:r.split(",");if(n.length===0)return!0;var s=t.name||"",a=(t.type||"").toLowerCase(),i=a.replace(/\/.*$/,"");return n.some(function(o){var l=o.trim().toLowerCase();return l.charAt(0)==="."?s.toLowerCase().endsWith(l):l.endsWith("/*")?i===l.replace(/\/.*$/,""):a===l})}return!0}),En}var Ox=$x();const vs=on(Ox);function Fi(t){return Wx(t)||Ux(t)||gl(t)||Bx()}function Bx(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
385
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ux(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Wx(t){if(Array.isArray(t))return Us(t)}function $i(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);r&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Oi(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?$i(Object(n),!0).forEach(function(s){xl(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$i(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function xl(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function an(t,r){return Hx(t)||Vx(t,r)||gl(t,r)||qx()}function qx(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
386
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gl(t,r){if(t){if(typeof t=="string")return Us(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Us(t,r)}}function Us(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,s=new Array(r);n<r;n++)s[n]=t[n];return s}function Vx(t,r){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var s=[],a=!0,i=!1,o,l;try{for(n=n.call(t);!(a=(o=n.next()).done)&&(s.push(o.value),!(r&&s.length===r));a=!0);}catch(d){i=!0,l=d}finally{try{!a&&n.return!=null&&n.return()}finally{if(i)throw l}}return s}}function Hx(t){if(Array.isArray(t))return t}var Jx=typeof vs=="function"?vs:vs.default,Gx="file-invalid-type",Kx="file-too-large",Yx="file-too-small",Qx="too-many-files",Xx=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=r.split(","),s=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:Gx,message:"File type must be ".concat(s)}},Bi=function(r){return{code:Kx,message:"File is larger than ".concat(r," ").concat(r===1?"byte":"bytes")}},Ui=function(r){return{code:Yx,message:"File is smaller than ".concat(r," ").concat(r===1?"byte":"bytes")}},Zx={code:Qx,message:"Too many files"};function fl(t,r){var n=t.type==="application/x-moz-file"||Jx(t,r);return[n,n?null:Xx(r)]}function bl(t,r,n){if(gr(t.size))if(gr(r)&&gr(n)){if(t.size>n)return[!1,Bi(n)];if(t.size<r)return[!1,Ui(r)]}else{if(gr(r)&&t.size<r)return[!1,Ui(r)];if(gr(n)&&t.size>n)return[!1,Bi(n)]}return[!0,null]}function gr(t){return t!=null}function eg(t){var r=t.files,n=t.accept,s=t.minSize,a=t.maxSize,i=t.multiple,o=t.maxFiles,l=t.validator;return!i&&r.length>1||i&&o>=1&&r.length>o?!1:r.every(function(d){var c=fl(d,n),u=an(c,1),h=u[0],x=bl(d,s,a),m=an(x,1),y=m[0],v=l?l(d):null;return h&&y&&!v})}function $n(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function In(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,function(r){return r==="Files"||r==="application/x-moz-file"}):!!t.target&&!!t.target.files}function Wi(t){t.preventDefault()}function tg(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function rg(t){return t.indexOf("Edge/")!==-1}function ng(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return tg(t)||rg(t)}function Bt(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(s){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return r.some(function(l){return!$n(s)&&l&&l.apply(void 0,[s].concat(i)),$n(s)})}}function sg(){return"showOpenFilePicker"in window}function ag(t){if(gr(t)){var r=Object.entries(t).filter(function(n){var s=an(n,2),a=s[0],i=s[1],o=!0;return yl(a)||(console.warn('Skipped "'.concat(a,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),o=!1),(!Array.isArray(i)||!i.every(kl))&&(console.warn('Skipped "'.concat(a,'" because an invalid file extension was provided.')),o=!1),o}).reduce(function(n,s){var a=an(s,2),i=a[0],o=a[1];return Oi(Oi({},n),{},xl({},i,o))},{});return[{description:"Files",accept:r}]}return t}function ig(t){if(gr(t))return Object.entries(t).reduce(function(r,n){var s=an(n,2),a=s[0],i=s[1];return[].concat(Fi(r),[a],Fi(i))},[]).filter(function(r){return yl(r)||kl(r)}).join(",")}function og(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function lg(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function yl(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function kl(t){return/^.*\.[\w]+$/.test(t)}var cg=["children"],dg=["open"],ug=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],mg=["refKey","onChange","onClick"];function pg(t){return gg(t)||xg(t)||vl(t)||hg()}function hg(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
387
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xg(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function gg(t){if(Array.isArray(t))return Ws(t)}function ws(t,r){return yg(t)||bg(t,r)||vl(t,r)||fg()}function fg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
388
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vl(t,r){if(t){if(typeof t=="string")return Ws(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ws(t,r)}}function Ws(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,s=new Array(r);n<r;n++)s[n]=t[n];return s}function bg(t,r){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var s=[],a=!0,i=!1,o,l;try{for(n=n.call(t);!(a=(o=n.next()).done)&&(s.push(o.value),!(r&&s.length===r));a=!0);}catch(d){i=!0,l=d}finally{try{!a&&n.return!=null&&n.return()}finally{if(i)throw l}}return s}}function yg(t){if(Array.isArray(t))return t}function qi(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);r&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function xt(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?qi(Object(n),!0).forEach(function(s){qs(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qi(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function qs(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function On(t,r){if(t==null)return{};var n=kg(t,r),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function kg(t,r){if(t==null)return{};var n={},s=Object.keys(t),a,i;for(i=0;i<s.length;i++)a=s[i],!(r.indexOf(a)>=0)&&(n[a]=t[a]);return n}var ba=p.forwardRef(function(t,r){var n=t.children,s=On(t,cg),a=jl(s),i=a.open,o=On(a,dg);return p.useImperativeHandle(r,function(){return{open:i}},[i]),lr.createElement(p.Fragment,null,n(xt(xt({},o),{},{open:i})))});ba.displayName="Dropzone";var wl={disabled:!1,getFilesFromEvent:Mx,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};ba.defaultProps=wl;ba.propTypes={children:ot.func,accept:ot.objectOf(ot.arrayOf(ot.string)),multiple:ot.bool,preventDropOnDocument:ot.bool,noClick:ot.bool,noKeyboard:ot.bool,noDrag:ot.bool,noDragEventsBubbling:ot.bool,minSize:ot.number,maxSize:ot.number,maxFiles:ot.number,disabled:ot.bool,getFilesFromEvent:ot.func,onFileDialogCancel:ot.func,onFileDialogOpen:ot.func,useFsAccessApi:ot.bool,autoFocus:ot.bool,onDragEnter:ot.func,onDragLeave:ot.func,onDragOver:ot.func,onDrop:ot.func,onDropAccepted:ot.func,onDropRejected:ot.func,onError:ot.func,validator:ot.func};var Vs={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function jl(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=xt(xt({},wl),t),n=r.accept,s=r.disabled,a=r.getFilesFromEvent,i=r.maxSize,o=r.minSize,l=r.multiple,d=r.maxFiles,c=r.onDragEnter,u=r.onDragLeave,h=r.onDragOver,x=r.onDrop,m=r.onDropAccepted,y=r.onDropRejected,v=r.onFileDialogCancel,E=r.onFileDialogOpen,A=r.useFsAccessApi,T=r.autoFocus,j=r.preventDropOnDocument,W=r.noClick,Z=r.noKeyboard,D=r.noDrag,q=r.noDragEventsBubbling,M=r.onError,_=r.validator,R=p.useMemo(function(){return ig(n)},[n]),L=p.useMemo(function(){return ag(n)},[n]),C=p.useMemo(function(){return typeof E=="function"?E:Vi},[E]),I=p.useMemo(function(){return typeof v=="function"?v:Vi},[v]),b=p.useRef(null),z=p.useRef(null),K=p.useReducer(vg,Vs),B=ws(K,2),G=B[0],ie=B[1],N=G.isFocused,Ie=G.isFileDialogActive,Fe=p.useRef(typeof window<"u"&&window.isSecureContext&&A&&sg()),f=function(){!Fe.current&&Ie&&setTimeout(function(){if(z.current){var ke=z.current.files;ke.length||(ie({type:"closeDialog"}),I())}},300)};p.useEffect(function(){return window.addEventListener("focus",f,!1),function(){window.removeEventListener("focus",f,!1)}},[z,Ie,I,Fe]);var te=p.useRef([]),ue=function(ke){b.current&&b.current.contains(ke.target)||(ke.preventDefault(),te.current=[])};p.useEffect(function(){return j&&(document.addEventListener("dragover",Wi,!1),document.addEventListener("drop",ue,!1)),function(){j&&(document.removeEventListener("dragover",Wi),document.removeEventListener("drop",ue))}},[b,j]),p.useEffect(function(){return!s&&T&&b.current&&b.current.focus(),function(){}},[b,T,s]);var re=p.useCallback(function(X){M?M(X):console.error(X)},[M]),Ce=p.useCallback(function(X){X.preventDefault(),X.persist(),et(X),te.current=[].concat(pg(te.current),[X.target]),In(X)&&Promise.resolve(a(X)).then(function(ke){if(!($n(X)&&!q)){var k=ke.length,P=k>0&&eg({files:ke,accept:R,minSize:o,maxSize:i,multiple:l,maxFiles:d,validator:_}),J=k>0&&!P;ie({isDragAccept:P,isDragReject:J,isDragActive:!0,type:"setDraggedFiles"}),c&&c(X)}}).catch(function(ke){return re(ke)})},[a,c,re,q,R,o,i,l,d,_]),Be=p.useCallback(function(X){X.preventDefault(),X.persist(),et(X);var ke=In(X);if(ke&&X.dataTransfer)try{X.dataTransfer.dropEffect="copy"}catch{}return ke&&h&&h(X),!1},[h,q]),ee=p.useCallback(function(X){X.preventDefault(),X.persist(),et(X);var ke=te.current.filter(function(P){return b.current&&b.current.contains(P)}),k=ke.indexOf(X.target);k!==-1&&ke.splice(k,1),te.current=ke,!(ke.length>0)&&(ie({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),In(X)&&u&&u(X))},[b,u,q]),oe=p.useCallback(function(X,ke){var k=[],P=[];X.forEach(function(J){var se=fl(J,R),le=ws(se,2),Le=le[0],De=le[1],Ge=bl(J,o,i),mt=ws(Ge,2),Ze=mt[0],st=mt[1],ht=_?_(J):null;if(Le&&Ze&&!ht)k.push(J);else{var ct=[De,st];ht&&(ct=ct.concat(ht)),P.push({file:J,errors:ct.filter(function(Lt){return Lt})})}}),(!l&&k.length>1||l&&d>=1&&k.length>d)&&(k.forEach(function(J){P.push({file:J,errors:[Zx]})}),k.splice(0)),ie({acceptedFiles:k,fileRejections:P,isDragReject:P.length>0,type:"setFiles"}),x&&x(k,P,ke),P.length>0&&y&&y(P,ke),k.length>0&&m&&m(k,ke)},[ie,l,R,o,i,d,x,m,y,_]),xe=p.useCallback(function(X){X.preventDefault(),X.persist(),et(X),te.current=[],In(X)&&Promise.resolve(a(X)).then(function(ke){$n(X)&&!q||oe(ke,X)}).catch(function(ke){return re(ke)}),ie({type:"reset"})},[a,oe,re,q]),Ne=p.useCallback(function(){if(Fe.current){ie({type:"openDialog"}),C();var X={multiple:l,types:L};window.showOpenFilePicker(X).then(function(ke){return a(ke)}).then(function(ke){oe(ke,null),ie({type:"closeDialog"})}).catch(function(ke){og(ke)?(I(ke),ie({type:"closeDialog"})):lg(ke)?(Fe.current=!1,z.current?(z.current.value=null,z.current.click()):re(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):re(ke)});return}z.current&&(ie({type:"openDialog"}),C(),z.current.value=null,z.current.click())},[ie,C,I,A,oe,re,L,l]),ye=p.useCallback(function(X){!b.current||!b.current.isEqualNode(X.target)||(X.key===" "||X.key==="Enter"||X.keyCode===32||X.keyCode===13)&&(X.preventDefault(),Ne())},[b,Ne]),Ue=p.useCallback(function(){ie({type:"focus"})},[]),Ye=p.useCallback(function(){ie({type:"blur"})},[]),nt=p.useCallback(function(){W||(ng()?setTimeout(Ne,0):Ne())},[W,Ne]),me=function(ke){return s?null:ke},pe=function(ke){return Z?null:me(ke)},Me=function(ke){return D?null:me(ke)},et=function(ke){q&&ke.stopPropagation()},it=p.useMemo(function(){return function(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ke=X.refKey,k=ke===void 0?"ref":ke,P=X.role,J=X.onKeyDown,se=X.onFocus,le=X.onBlur,Le=X.onClick,De=X.onDragEnter,Ge=X.onDragOver,mt=X.onDragLeave,Ze=X.onDrop,st=On(X,ug);return xt(xt(qs({onKeyDown:pe(Bt(J,ye)),onFocus:pe(Bt(se,Ue)),onBlur:pe(Bt(le,Ye)),onClick:me(Bt(Le,nt)),onDragEnter:Me(Bt(De,Ce)),onDragOver:Me(Bt(Ge,Be)),onDragLeave:Me(Bt(mt,ee)),onDrop:Me(Bt(Ze,xe)),role:typeof P=="string"&&P!==""?P:"presentation"},k,b),!s&&!Z?{tabIndex:0}:{}),st)}},[b,ye,Ue,Ye,nt,Ce,Be,ee,xe,Z,D,s]),ge=p.useCallback(function(X){X.stopPropagation()},[]),wt=p.useMemo(function(){return function(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ke=X.refKey,k=ke===void 0?"ref":ke,P=X.onChange,J=X.onClick,se=On(X,mg),le=qs({accept:R,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:me(Bt(P,xe)),onClick:me(Bt(J,ge)),tabIndex:-1},k,z);return xt(xt({},le),se)}},[z,n,l,xe,s]);return xt(xt({},G),{},{isFocused:N&&!s,getRootProps:it,getInputProps:wt,rootRef:b,inputRef:z,open:me(Ne)})}function vg(t,r){switch(r.type){case"focus":return xt(xt({},t),{},{isFocused:!0});case"blur":return xt(xt({},t),{},{isFocused:!1});case"openDialog":return xt(xt({},Vs),{},{isFileDialogActive:!0});case"closeDialog":return xt(xt({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return xt(xt({},t),{},{isDragActive:r.isDragActive,isDragAccept:r.isDragAccept,isDragReject:r.isDragReject});case"setFiles":return xt(xt({},t),{},{acceptedFiles:r.acceptedFiles,fileRejections:r.fileRejections,isDragReject:r.isDragReject});case"reset":return xt({},Vs);default:return t}}function Vi(){}const js=({todos:t,isResult:r=!1})=>{if(!t||!Array.isArray(t))return null;const n=i=>{switch(i){case"completed":return e.jsx(Md,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"in_progress":return e.jsx(rn,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"});case"pending":default:return e.jsx(Ar,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}},s=i=>{switch(i){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 border-green-200 dark:border-green-800";case"in_progress":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-200 border-blue-200 dark:border-blue-800";case"pending":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}},a=i=>{switch(i){case"high":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 border-red-200 dark:border-red-800";case"medium":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800";case"low":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}};return e.jsxs("div",{className:"space-y-3",children:[r&&e.jsxs("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Todo List (",t.length," ",t.length===1?"item":"items",")"]}),t.map((i,o)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md dark:shadow-gray-900/50 transition-shadow",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n(i.status)}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[e.jsx("p",{className:`text-sm font-medium ${i.status==="completed"?"line-through text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100"}`,children:i.content}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(br,{variant:"outline",className:`text-xs px-2 py-0.5 ${a(i.priority)}`,children:i.priority}),e.jsx(br,{variant:"outline",className:`text-xs px-2 py-0.5 ${s(i.status)}`,children:i.status.replace("_"," ")})]})]})})]},i.id||`todo-${o}`))]})};var wg=yc(),jg=kc(),Ng=vc(),Sg=wc();const Cg=`
|
|
389
|
+
.xterm .xterm-screen {
|
|
390
|
+
outline: none !important;
|
|
391
|
+
}
|
|
392
|
+
.xterm:focus .xterm-screen {
|
|
393
|
+
outline: none !important;
|
|
394
|
+
}
|
|
395
|
+
.xterm-screen:focus {
|
|
396
|
+
outline: none !important;
|
|
397
|
+
}
|
|
398
|
+
`;if(typeof document<"u"){const t=document.createElement("style");t.type="text/css",t.innerText=Cg,document.head.appendChild(t)}const xr=new Map;function ya({selectedProject:t,selectedSession:r,isActive:n,initialCommand:s,isPlainShell:a=!1,onProcessComplete:i}){const o=p.useRef(null),l=p.useRef(null),d=p.useRef(null),c=p.useRef(null),[u,h]=p.useState(!1),[x,m]=p.useState(!1),[y,v]=p.useState(!1),[E,A]=p.useState(null),[T,j]=p.useState(!1),W=()=>{!x||u||T||(j(!0),q())},Z=()=>{c.current&&(c.current.close(),c.current=null),l.current&&(l.current.clear(),l.current.write("\x1B[2J\x1B[H")),h(!1),j(!1)},D=()=>{v(!0),Array.from(xr.keys()).filter(_=>_.includes(t.name)).forEach(_=>xr.delete(_)),c.current&&(c.current.close(),c.current=null),l.current&&(l.current.dispose(),l.current=null,d.current=null),h(!1),m(!1),setTimeout(()=>{v(!1)},200)};p.useEffect(()=>{const M=r?.id||null;E!==null&&E!==M&&x&&(Z(),Array.from(xr.keys()).forEach(R=>{R.includes(t.name)&&xr.delete(R)})),A(M)},[r?.id,x]),p.useEffect(()=>{if(!o.current||!t||y)return;const M=r?.id||`project-${t.name}`,_=xr.get(M);if(_&&!l.current)try{l.current=_.terminal,d.current=_.fitAddon,c.current=_.ws,h(_.isConnected),l.current.element&&l.current.element.parentNode&&l.current.element.parentNode.removeChild(l.current.element),l.current.open(o.current),setTimeout(()=>{d.current&&(d.current.fit(),c.current&&c.current.readyState===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100),m(!0);return}catch{xr.delete(M),l.current=null,d.current=null,c.current=null}if(l.current)return;l.current=new wg.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}}),d.current=new jg.FitAddon;const R=new Ng.ClipboardAddon,L=new Sg.WebglAddon;l.current.loadAddon(d.current),l.current.loadAddon(R);try{l.current.loadAddon(L)}catch{}l.current.open(o.current),setTimeout(()=>{d.current&&d.current.fit()},50),l.current.attachCustomKeyEventHandler(I=>(I.ctrlKey||I.metaKey)&&I.key==="c"&&l.current.hasSelection()?(document.execCommand("copy"),!1):(I.ctrlKey||I.metaKey)&&I.key==="v"?(navigator.clipboard.readText().then(b=>{c.current&&c.current.readyState===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"input",data:b}))}).catch(b=>{}),!1):!0),setTimeout(()=>{d.current&&(d.current.fit(),l.current&&c.current&&c.current.readyState===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100),m(!0),l.current.onData(I=>{c.current&&c.current.readyState===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"input",data:I}))});const C=new ResizeObserver(()=>{d.current&&l.current&&setTimeout(()=>{d.current.fit(),c.current&&c.current.readyState===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows}))},50)});return o.current&&C.observe(o.current),()=>{if(C.disconnect(),l.current&&t){const I=r?.id||`project-${t.name}`;try{xr.set(I,{terminal:l.current,fitAddon:d.current,ws:c.current,isConnected:u})}catch{}}}},[o.current,t,r,y]),p.useEffect(()=>{!n||!x||setTimeout(()=>{d.current&&(d.current.fit(),l.current&&c.current&&c.current.readyState===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100)},[n,x]);const q=async()=>{if(!(T||u))try{const M=localStorage.getItem("auth-token");if(!M){console.error("No authentication token found for Shell WebSocket connection");return}let _;try{if(_=(await(await fetch("/api/config",{headers:{Authorization:`Bearer ${M}`}})).json()).wsUrl,_.includes("localhost")&&!window.location.hostname.includes("localhost")){const I=window.location.protocol==="https:"?"wss:":"ws:",b=window.location.port==="3001"?"3002":window.location.port;_=`${I}//${window.location.hostname}:${b}`}}catch{const C=window.location.protocol==="https:"?"wss:":"ws:",I=window.location.port==="3001"?"3002":window.location.port;_=`${C}//${window.location.hostname}:${I}`}const R=`${_}/shell?token=${encodeURIComponent(M)}`;c.current=new WebSocket(R),c.current.onopen=()=>{h(!0),j(!1),setTimeout(()=>{d.current&&l.current&&(d.current.fit(),setTimeout(()=>{const L={type:"init",projectPath:t.fullPath||t.path,sessionId:a?null:r?.id,hasSession:a?!1:!!r,provider:a?"plain-shell":r?.__provider||"claude",cols:l.current.cols,rows:l.current.rows,initialCommand:s,isPlainShell:a};console.log("Shell init payload:",L),c.current.send(JSON.stringify(L)),setTimeout(()=>{l.current&&c.current&&c.current.readyState===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows}))},100)},50))},200)},c.current.onmessage=L=>{try{const C=JSON.parse(L.data);if(C.type==="output"){const I=/(https?:\/\/[^\s\x1b\x07]+)/g;let b=C.data;const z=[];let K;for(;(K=I.exec(b.replace(/\x1b\[[0-9;]*m/g,"")))!==null;)z.push(K[1]);if(a&&i){const B=b.replace(/\x1b\[[0-9;]*m/g,"");if(B.includes("Process exited with code 0"))i(0);else if(B.match(/Process exited with code (\d+)/)){const G=parseInt(B.match(/Process exited with code (\d+)/)[1]);G!==0&&i(G)}}l.current.write(b)}else C.type==="url_open"&&window.open(C.url,"_blank")}catch{}},c.current.onclose=L=>{h(!1),j(!1),l.current&&(l.current.clear(),l.current.write("\x1B[2J\x1B[H"))},c.current.onerror=L=>{h(!1),j(!1)}}catch{h(!1),j(!1)}};return t?e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${u?"bg-green-500":"bg-red-500"}`}),r&&(()=>{const M=r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session";return e.jsxs("span",{className:"text-xs text-blue-300",children:["(",M.slice(0,30),"...)"]})})(),!r&&e.jsx("span",{className:"text-xs text-gray-400",children:"(New Session)"}),!x&&e.jsx("span",{className:"text-xs text-yellow-400",children:"(Initializing...)"}),y&&e.jsx("span",{className:"text-xs text-blue-400",children:"(Restarting...)"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[u&&e.jsxs("button",{onClick:Z,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"Disconnect from shell",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:"Disconnect"})]}),e.jsxs("button",{onClick:D,disabled:y||u,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"Restart Shell (disconnect first)",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:"Restart"})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:o,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!x&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:"Loading terminal..."})}),x&&!u&&!T&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("button",{onClick:W,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",title:"Connect to shell",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:"Continue in Shell"})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:a?`Run ${s||"command"} in ${t.displayName}`:r?`Resume session: ${(r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session").slice(0,50)}...`:"Start a new Claude session"})]})}),T&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:"Connecting to shell..."})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:a?`Running ${s||"command"} in ${t.displayName}`:`Starting Claude CLI in ${t.displayName}`})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Select a Project"}),e.jsx("p",{children:"Choose a project to open an interactive shell in that directory"})]})})}const Nl=({task:t,onClose:r,onEdit:n,onStatusChange:s,onTaskClick:a,isOpen:i=!0,className:o=""})=>{const[l,d]=p.useState(!1),[c,u]=p.useState(t||{}),[h,x]=p.useState(!1),[m,y]=p.useState(!1),[v,E]=p.useState(!1),{currentProject:A,refreshTasks:T}=dn();if(!i||!t)return null;const j=async()=>{if(A){x(!0);try{const R={};if(c.title!==t.title&&(R.title=c.title),c.description!==t.description&&(R.description=c.description),c.details!==t.details&&(R.details=c.details),Object.keys(R).length>0){const L=await Je.taskmaster.updateTask(A.name,t.id,R);if(L.ok)T?.(),n?.(c),d(!1);else{const C=await L.json();console.error("Failed to update task:",C),alert(`Failed to update task: ${C.message}`)}}else d(!1)}catch(R){console.error("Error updating task:",R),alert("Error updating task. Please try again.")}finally{x(!1)}}},W=()=>{navigator.clipboard.writeText(t.id.toString())},Z=R=>{switch(R){case"done":return{icon:ln,color:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-950"};case"in-progress":return{icon:rn,color:"text-blue-600 dark:text-blue-400",bg:"bg-blue-50 dark:bg-blue-950"};case"review":return{icon:ra,color:"text-amber-600 dark:text-amber-400",bg:"bg-amber-50 dark:bg-amber-950"};case"deferred":return{icon:So,color:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800"};case"cancelled":return{icon:lt,color:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-950"};default:return{icon:Ar,color:"text-slate-500 dark:text-slate-400",bg:"bg-slate-50 dark:bg-slate-800"}}},D=Z(t.status),q=D.icon,M=R=>{switch(R){case"high":return"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-950";case"medium":return"text-yellow-600 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-950";case"low":return"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-950";default:return"text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-800"}},_=[{value:"pending",label:"Pending"},{value:"in-progress",label:"In Progress"},{value:"review",label:"Review"},{value:"done",label:"Done"},{value:"deferred",label:"Deferred"},{value:"cancelled",label:"Cancelled"}];return e.jsx("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[100] md:p-4 bg-black/50",children:e.jsxs("div",{className:Se("bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 md:rounded-lg shadow-xl","w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",o),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx(q,{className:Se("w-6 h-6",D.color)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("button",{onClick:W,className:"flex items-center gap-1 px-2 py-1 text-xs bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:"Click to copy task ID",children:[e.jsxs("span",{children:["Task ",t.id]}),e.jsx(Fd,{className:"w-3 h-3"})]}),t.parentId&&e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Subtask of Task ",t.parentId]})]}),l?e.jsx("input",{type:"text",value:c.title||"",onChange:R=>u({...c,title:R.target.value}),className:"w-full text-lg font-semibold bg-transparent border-b-2 border-blue-500 focus:outline-none text-gray-900 dark:text-white",placeholder:"Task title"}):e.jsx("h1",{className:"text-lg md:text-xl font-semibold text-gray-900 dark:text-white line-clamp-2",children:t.title})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:j,disabled:h,className:"p-2 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:h?"Saving...":"Save changes",children:e.jsx(Rn,{className:Se("w-5 h-5",h&&"animate-spin")})}),e.jsx("button",{onClick:()=>{d(!1),u(t)},disabled:h,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Cancel editing",children:e.jsx(lt,{className:"w-5 h-5"})})]}):e.jsx("button",{onClick:()=>d(!0),className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors",title:"Edit task",children:e.jsx($u,{className:"w-5 h-5"})}),e.jsx("button",{onClick:r,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors",title:"Close",children:e.jsx(lt,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-6 space-y-6 min-h-0",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Status"}),e.jsx("div",{className:Se("w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600",D.bg,D.color),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium capitalize",children:_.find(R=>R.value===t.status)?.label||t.status})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Priority"}),e.jsxs("div",{className:Se("px-3 py-2 rounded-md text-sm font-medium capitalize",M(t.priority)),children:[e.jsx(wo,{className:"w-4 h-4 inline mr-2"}),t.priority||"Not set"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Dependencies"}),t.dependencies&&t.dependencies.length>0?e.jsx("div",{className:"flex flex-wrap gap-1",children:t.dependencies.map(R=>e.jsxs("button",{onClick:()=>a&&a({id:R}),className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded text-sm hover:bg-blue-200 dark:hover:bg-blue-800 transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50",disabled:!a,title:a?`Click to view Task ${R}`:`Task ${R}`,children:[e.jsx(ta,{className:"w-3 h-3 inline mr-1"}),R]},R))}):e.jsx("span",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No dependencies"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Description"}),l?e.jsx("textarea",{value:c.description||"",onChange:R=>u({...c,description:R.target.value}),rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",placeholder:"Task description"}):e.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:t.description||"No description provided"})]}),t.details&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsxs("button",{onClick:()=>y(!m),className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Implementation Details"}),m?e.jsx($t,{className:"w-4 h-4 text-gray-500"}):e.jsx(cr,{className:"w-4 h-4 text-gray-500"})]}),m&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:l?e.jsx("textarea",{value:c.details||"",onChange:R=>u({...c,details:R.target.value}),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",placeholder:"Implementation details"}):e.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-4",children:e.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:t.details})})})]}),t.testStrategy&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsxs("button",{onClick:()=>E(!v),className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Test Strategy"}),v?e.jsx($t,{className:"w-4 h-4 text-gray-500"}):e.jsx(cr,{className:"w-4 h-4 text-gray-500"})]}),v&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:e.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 rounded-md p-4",children:e.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:t.testStrategy})})})]}),t.subtasks&&t.subtasks.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Subtasks (",t.subtasks.length,")"]}),e.jsx("div",{className:"space-y-2",children:t.subtasks.map(R=>{const L=Z(R.status),C=L.icon;return e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[e.jsx(C,{className:Se("w-4 h-4",L.color)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white truncate",children:R.title}),R.description&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 truncate",children:R.description})]}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:R.id})]},R.id)})})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:[e.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Task ID: ",t.id]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Close"})})]})]})})},Hi=({onShowAllTasks:t,onStartTask:r,className:n=""})=>{const{nextTask:s,tasks:a,currentProject:i,isLoadingTasks:o,projectTaskMaster:l,refreshTasks:d,refreshProjects:c}=dn(),[u,h]=p.useState(!1),[x,m]=p.useState(!1),[y,v]=p.useState(!1),[E,A]=p.useState(!1),[T,j]=p.useState(!1),[W,Z]=p.useState(!1),[D,q]=p.useState(!1),M=()=>{v(!0),m(!1)},_=()=>{A(!0),m(!1)};if(!i||o)return null;let R;if((!a||a.length===0)&&!l?.hasTaskmaster)R=e.jsxs("div",{className:Se("bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-3 mb-4",n),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ln,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"TaskMaster AI is not configured"}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-0.5"})]})]}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsxs("button",{onClick:()=>m(!x),className:"text-xs px-2 py-1 bg-blue-600 hover:bg-blue-700 text-white rounded transition-colors flex items-center gap-1",children:[e.jsx(Pr,{className:"w-3 h-3"}),"Initialize TaskMaster AI"]})})]}),x&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-blue-200 dark:border-blue-800",children:[!l?.hasTaskmaster&&e.jsxs("div",{className:"mb-3 p-3 bg-blue-50 dark:bg-blue-900/50 rounded-lg",children:[e.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-2",children:"π― What is TaskMaster?"}),e.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:l?.hasTaskmaster?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-2 p-2 bg-green-50 dark:bg-green-900/30 rounded text-xs text-green-800 dark:text-green-200",children:[e.jsx("strong",{children:"Add more tasks:"})," Create additional tasks manually or generate them from a PRD template"]}),e.jsxs("button",{className:"text-xs px-3 py-2 bg-green-100 dark:bg-green-900 hover:bg-green-200 dark:hover:bg-green-800 text-green-800 dark:text-green-200 rounded transition-colors text-left flex items-center gap-2 disabled:opacity-50",onClick:M,disabled:D,children:[e.jsx(Dt,{className:"w-3 h-3"}),"Create a new task manually"]}),e.jsxs("button",{className:"text-xs px-3 py-2 bg-purple-100 dark:bg-purple-900 hover:bg-purple-200 dark:hover:bg-purple-800 text-purple-800 dark:text-purple-200 rounded transition-colors text-left flex items-center gap-2 disabled:opacity-50",onClick:_,disabled:D,children:[e.jsx(Ct,{className:"w-3 h-3"}),D?"Parsing...":"Generate tasks from PRD template"]})]}):e.jsxs("button",{className:"text-xs px-3 py-2 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 text-slate-800 dark:text-slate-200 rounded transition-colors text-left flex items-center gap-2",onClick:()=>j(!0),children:[e.jsx(Lr,{className:"w-3 h-3"}),"Initialize TaskMaster"]})})]})]});else if(s)R=e.jsx("div",{className:Se("bg-slate-50 dark:bg-slate-900/30 border border-slate-200 dark:border-slate-700 rounded-lg p-3 mb-4",n),children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"w-5 h-5 bg-blue-100 dark:bg-blue-900/50 rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(Vu,{className:"w-3 h-3 text-blue-600 dark:text-blue-400"})}),e.jsxs("span",{className:"text-xs text-slate-600 dark:text-slate-400 font-medium",children:["Task ",s.id]}),s.priority==="high"&&e.jsx("div",{className:"w-4 h-4 rounded bg-red-100 dark:bg-red-900/50 flex items-center justify-center",title:"High Priority",children:e.jsx(Ms,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})}),s.priority==="medium"&&e.jsx("div",{className:"w-4 h-4 rounded bg-amber-100 dark:bg-amber-900/50 flex items-center justify-center",title:"Medium Priority",children:e.jsx(wo,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})}),s.priority==="low"&&e.jsx("div",{className:"w-4 h-4 rounded bg-gray-100 dark:bg-gray-800 flex items-center justify-center",title:"Low Priority",children:e.jsx(Ar,{className:"w-2.5 h-2.5 text-gray-400 dark:text-gray-500"})})]}),e.jsx("p",{className:"text-sm font-medium text-slate-900 dark:text-slate-100 line-clamp-1",children:s.title})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>r?.(),className:"text-xs px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-md font-medium transition-colors shadow-sm flex items-center gap-1",children:[e.jsx(Su,{className:"w-3 h-3"}),"Start Task"]}),e.jsx("button",{onClick:()=>Z(!0),className:"text-xs px-2 py-1.5 border border-slate-300 dark:border-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-600 dark:text-slate-300 rounded-md transition-colors flex items-center gap-1",title:"View task details",children:e.jsx(cn,{className:"w-3 h-3"})}),t&&e.jsx("button",{onClick:t,className:"text-xs px-2 py-1.5 border border-slate-300 dark:border-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-600 dark:text-slate-300 rounded-md transition-colors flex items-center gap-1",title:"View all tasks",children:e.jsx(Ln,{className:"w-3 h-3"})})]})]})});else if(a&&a.length>0){const L=a.filter(I=>I.status==="done").length,C=a.length;R=e.jsx("div",{className:Se("bg-purple-50 dark:bg-purple-950 border border-purple-200 dark:border-purple-800 rounded-lg p-3 mb-4",n),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ln,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:L===C?"All done! π":"No pending tasks"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:[L,"/",C]}),e.jsx("button",{onClick:t,className:"text-xs px-2 py-1 bg-purple-600 hover:bg-purple-700 text-white rounded transition-colors",children:"Review"})]})]})})}else R=null;return e.jsxs(e.Fragment,{children:[R,y&&e.jsx(Eg,{currentProject:i,onClose:()=>v(!1),onTaskCreated:()=>{d(),v(!1)}}),E&&e.jsx(Ig,{currentProject:i,onClose:()=>A(!1),onTemplateApplied:()=>{d(),A(!1)}}),T&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(Lr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",i?.displayName]})]})]}),e.jsx("button",{onClick:()=>j(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:e.jsx(lt,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex-1 p-4",children:e.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",children:e.jsx(ya,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0})})}),e.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster initialization will start automatically"}),e.jsx("button",{onClick:()=>j(!1),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Close"})]})})]})}),W&&s&&e.jsx(Nl,{task:s,isOpen:W,onClose:()=>Z(!1),onStatusChange:()=>d?.(),onTaskClick:null})]})},Eg=({currentProject:t,onClose:r,onTaskCreated:n})=>{const[s,a]=p.useState({title:"",description:"",priority:"medium",useAI:!1,prompt:""}),[i,o]=p.useState(!1),l=async d=>{if(d.preventDefault(),!!t){o(!0);try{const c=s.useAI?{prompt:s.prompt,priority:s.priority}:{title:s.title,description:s.description,priority:s.priority},u=await Je.taskmaster.addTask(t.name,c);if(u.ok)n();else{const h=await u.json();console.error("Failed to create task:",h),alert(`Failed to create task: ${h.message}`)}}catch(c){console.error("Error creating task:",c),alert("Error creating task. Please try again.")}finally{o(!1)}}};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create New Task"}),e.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:e.jsx(lt,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:l,className:"space-y-4",children:[e.jsx("div",{children:e.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[e.jsx("input",{type:"checkbox",checked:s.useAI,onChange:d=>a(c=>({...c,useAI:d.target.checked}))}),"Use AI to generate task details"]})}),s.useAI?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Task Description (AI will generate details)"}),e.jsx("textarea",{value:s.prompt,onChange:d=>a(c=>({...c,prompt:d.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",rows:"3",placeholder:"Describe what you want to accomplish...",required:!0})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Task Title"}),e.jsx("input",{type:"text",value:s.title,onChange:d=>a(c=>({...c,title:d.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"Enter task title...",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Description"}),e.jsx("textarea",{value:s.description,onChange:d=>a(c=>({...c,description:d.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",rows:"3",placeholder:"Describe the task...",required:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Priority"}),e.jsxs("select",{value:s.priority,onChange:d=>a(c=>({...c,priority:d.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"})]})]}),e.jsxs("div",{className:"flex gap-2 pt-4",children:[e.jsx("button",{type:"button",onClick:r,className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",disabled:i,children:"Cancel"}),e.jsx("button",{type:"submit",className:"flex-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded disabled:opacity-50",disabled:i||s.useAI&&!s.prompt.trim()||!s.useAI&&(!s.title.trim()||!s.description.trim()),children:i?"Creating...":"Create Task"})]})]})]})})},Ig=({currentProject:t,onClose:r,onTemplateApplied:n})=>{const[s,a]=p.useState([]),[i,o]=p.useState(null),[l,d]=p.useState({}),[c,u]=p.useState("prd.txt"),[h,x]=p.useState(!0),[m,y]=p.useState(!1),[v,E]=p.useState("select");useEffect(()=>{(async()=>{try{const W=await Je.taskmaster.getTemplates();if(W.ok){const Z=await W.json();a(Z.templates)}}catch(W){console.error("Error loading templates:",W)}finally{x(!1)}})()},[]);const A=j=>{o(j);const W=j.content.match(/\[([^\]]+)\]/g)||[],Z=[...new Set(W.map(q=>q.slice(1,-1)))],D={};Z.forEach(q=>{D[q]=""}),d(D),E("customize")},T=async()=>{if(!(!i||!t)){y(!0);try{const j=await Je.taskmaster.applyTemplate(t.name,{templateId:i.id,fileName:c,customizations:l});if(!j.ok){const Z=await j.json();throw new Error(Z.message||"Failed to apply template")}const W=await Je.taskmaster.parsePRD(t.name,{fileName:c,numTasks:10});if(!W.ok){const Z=await W.json();throw new Error(Z.message||"Failed to generate tasks")}E("generate"),setTimeout(()=>{n()},2e3)}catch(j){console.error("Error applying template:",j),alert(`Error: ${j.message}`),y(!1)}}};return h?e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading templates..."})]})})}):e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:v==="select"?"Select PRD Template":v==="customize"?"Customize Template":"Generating Tasks"}),e.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:e.jsx(lt,{className:"w-4 h-4"})})]}),v==="select"&&e.jsx("div",{className:"space-y-3",children:s.map(j=>e.jsx("div",{className:"p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer transition-colors",onClick:()=>A(j),children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white",children:j.name}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:j.description}),e.jsx("span",{className:"inline-block text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded mt-2",children:j.category})]}),e.jsx(ta,{className:"w-4 h-4 text-gray-400 mt-1"})]})},j.id))}),v==="customize"&&i&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"File Name"}),e.jsx("input",{type:"text",value:c,onChange:j=>u(j.target.value),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"prd.txt"})]}),Object.keys(l).length>0&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Customize Template"}),e.jsx("div",{className:"space-y-3",children:Object.entries(l).map(([j,W])=>e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 dark:text-gray-400 mb-1",children:j.replace(/([A-Z])/g," $1").replace(/^./,Z=>Z.toUpperCase())}),e.jsx("input",{type:"text",value:W,onChange:Z=>d(D=>({...D,[j]:Z.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:`Enter ${j.toLowerCase()}`})]},j))})]}),e.jsxs("div",{className:"flex gap-2 pt-4",children:[e.jsx("button",{onClick:()=>E("select"),className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",children:"Back"}),e.jsx("button",{onClick:T,className:"flex-1 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded disabled:opacity-50",disabled:m,children:m?"Applying...":"Apply & Generate Tasks"})]})]}),v==="generate"&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(ln,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),e.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Template Applied Successfully!"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Your PRD has been created and tasks are being generated..."})]})]})})};function Ag({status:t,onAbort:r,isLoading:n,provider:s="claude"}){const[a,i]=p.useState(0),[o,l]=p.useState(0),[d,c]=p.useState(0);if(p.useEffect(()=>{if(!n){i(0),c(0);return}const A=Date.now(),T=setInterval(()=>{const j=Math.floor((Date.now()-A)/1e3);i(j),c(Math.floor(j*(30+Math.random()*20)))},1e3);return()=>clearInterval(T)},[n]),p.useEffect(()=>{if(!n)return;const A=setInterval(()=>{l(T=>(T+1)%4)},500);return()=>clearInterval(A)},[n]),!n)return null;const u=["Thinking","Processing","Analyzing","Working","Computing","Reasoning"],h=Math.floor(a/3)%u.length,x=t?.text||u[h],m=t?.tokens||d,y=t?.can_interrupt!==!1,E=["β»","βΉ","βΈ","βΆ"][o];return e.jsx("div",{className:"w-full mb-6 animate-in slide-in-from-bottom duration-300",children:e.jsxs("div",{className:"flex items-center justify-between max-w-4xl mx-auto bg-gray-900 dark:bg-gray-950 text-white rounded-lg shadow-lg px-4 py-3",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:Se("text-xl transition-all duration-500",o%2===0?"text-blue-400 scale-110":"text-blue-300"),children:E}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium text-sm",children:[x,"..."]}),e.jsxs("span",{className:"text-gray-400 text-sm",children:["(",a,"s)"]}),m>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-400",children:"Β·"}),e.jsxs("span",{className:"text-gray-300 text-sm hidden sm:inline",children:["β ",m.toLocaleString()," tokens"]}),e.jsxs("span",{className:"text-gray-300 text-sm sm:hidden",children:["β ",m.toLocaleString()]})]}),e.jsx("span",{className:"text-gray-400 hidden sm:inline",children:"Β·"}),e.jsx("span",{className:"text-gray-300 text-sm hidden sm:inline",children:"esc to interrupt"})]}),e.jsx("div",{className:"text-xs text-gray-400 sm:hidden mt-1",children:"esc to interrupt"})]})]})}),y&&r&&e.jsxs("button",{onClick:r,className:"ml-3 text-xs bg-red-600 hover:bg-red-700 text-white px-2.5 py-1 sm:px-3 sm:py-1.5 rounded-md transition-colors flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{className:"hidden sm:inline",children:"Stop"})]})]})})}function Mg({used:t,total:r}){if(t==null||r==null||r<=0)return null;const n=Math.min(100,t/r*100),s=10,a=2*Math.PI*s,i=a-n/100*a,o=()=>n<50?"#3b82f6":n<75?"#f59e0b":"#ef4444";return e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"transform -rotate-90",children:[e.jsx("circle",{cx:"12",cy:"12",r:s,fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-gray-300 dark:text-gray-600"}),e.jsx("circle",{cx:"12",cy:"12",r:s,fill:"none",stroke:o(),strokeWidth:"2",strokeDasharray:a,strokeDashoffset:i,strokeLinecap:"round"})]}),e.jsxs("span",{title:`${t.toLocaleString()} / ${r.toLocaleString()} tokens`,children:[n.toFixed(1),"%"]})]})}async function Tg(t,r){const n=new FormData,s=`recording_${Date.now()}.webm`,a=new File([t],s,{type:t.type});n.append("audio",a);const i=window.localStorage.getItem("whisperMode")||"default";n.append("mode",i);try{const o=await Je.transcribe(n);if(!o.ok){const d=await o.json().catch(()=>({}));throw new Error(d.error||`Transcription error: ${o.status} ${o.statusText}`)}return(await o.json()).text||""}catch(o){throw o.name==="TypeError"&&o.message.includes("fetch")?new Error("Cannot connect to server. Please ensure the backend is running."):o}}function Sl({onTranscript:t,className:r=""}){const[n,s]=p.useState("idle"),[a,i]=p.useState(null),[o,l]=p.useState(!0),d=p.useRef(null),c=p.useRef(null),u=p.useRef([]),h=p.useRef(0);p.useEffect(()=>{(()=>{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){l(!1),i("Microphone not supported. Please use HTTPS or a modern browser.");return}if(location.protocol!=="https:"&&location.hostname!=="localhost"){l(!1),i("Microphone requires HTTPS. Please use a secure connection.");return}l(!0),i(null)})()},[]);const x=async()=>{try{if(console.log("Starting recording..."),i(null),u.current=[],!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Microphone access not available. Please use HTTPS or a supported browser.");const j=await navigator.mediaDevices.getUserMedia({audio:!0});c.current=j;const W=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",Z=new MediaRecorder(j,{mimeType:W});d.current=Z,Z.ondataavailable=D=>{D.data.size>0&&u.current.push(D.data)},Z.onstop=async()=>{console.log("Recording stopped, creating blob...");const D=new Blob(u.current,{type:W});c.current&&(c.current.getTracks().forEach(R=>R.stop()),c.current=null),s("transcribing");const q=window.localStorage.getItem("whisperMode")||"default",M=q==="prompt"||q==="vibe"||q==="instructions"||q==="architect";let _;M&&(_=setTimeout(()=>{s("processing")},2e3));try{const R=await Tg(D);R&&t&&t(R)}catch(R){console.error("Transcription error:",R),i(R.message)}finally{_&&clearTimeout(_),s("idle")}},Z.start(),s("recording"),console.log("Recording started successfully")}catch(j){console.error("Failed to start recording:",j);let W="Microphone access failed";j.name==="NotAllowedError"?W="Microphone access denied. Please allow microphone permissions.":j.name==="NotFoundError"?W="No microphone found. Please check your audio devices.":j.name==="NotSupportedError"?W="Microphone not supported by this browser.":j.name==="NotReadableError"?W="Microphone is being used by another application.":j.message.includes("HTTPS")&&(W=j.message),i(W),s("idle")}},m=()=>{console.log("Stopping recording..."),d.current&&d.current.state==="recording"?d.current.stop():(console.log("Recorder not in recording state, forcing cleanup"),c.current&&(c.current.getTracks().forEach(j=>j.stop()),c.current=null),s("idle"))},y=j=>{if(j&&(j.preventDefault(),j.stopPropagation()),!o)return;const W=Date.now();if(W-h.current<300){console.log("Ignoring rapid tap");return}h.current=W,console.log("Button clicked, current state:",n),n==="idle"?x():n==="recording"&&m()};p.useEffect(()=>()=>{c.current&&c.current.getTracks().forEach(j=>j.stop())},[]);const v=()=>{if(!o)return{icon:e.jsx(Tn,{className:"w-5 h-5"}),className:"bg-gray-400 cursor-not-allowed",disabled:!0};switch(n){case"recording":return{icon:e.jsx(Tn,{className:"w-5 h-5 text-white"}),className:"bg-red-500 hover:bg-red-600 animate-pulse",disabled:!1};case"transcribing":return{icon:e.jsx(uu,{className:"w-5 h-5 animate-spin"}),className:"bg-blue-500 hover:bg-blue-600",disabled:!0};case"processing":return{icon:e.jsx(vo,{className:"w-5 h-5 animate-pulse"}),className:"bg-purple-500 hover:bg-purple-600",disabled:!0};default:return{icon:e.jsx(Tn,{className:"w-5 h-5"}),className:"bg-gray-700 hover:bg-gray-600",disabled:!1}}},{icon:E,className:A,disabled:T}=v();return e.jsxs("div",{className:"relative",children:[e.jsx("button",{type:"button",style:{backgroundColor:n==="recording"?"#ef4444":n==="transcribing"?"#3b82f6":n==="processing"?"#a855f7":"#374151"},className:`
|
|
399
|
+
flex items-center justify-center
|
|
400
|
+
w-12 h-12 rounded-full
|
|
401
|
+
text-white transition-all duration-200
|
|
402
|
+
focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
|
|
403
|
+
dark:ring-offset-gray-800
|
|
404
|
+
touch-action-manipulation
|
|
405
|
+
${T?"cursor-not-allowed opacity-75":"cursor-pointer"}
|
|
406
|
+
${n==="recording"?"animate-pulse":""}
|
|
407
|
+
hover:opacity-90
|
|
408
|
+
${r}
|
|
409
|
+
`,onClick:y,disabled:T,children:E}),a&&e.jsx("div",{className:`absolute top-full mt-2 left-1/2 transform -translate-x-1/2
|
|
410
|
+
bg-red-500 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-10
|
|
411
|
+
animate-fade-in`,children:a}),n==="recording"&&e.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-red-500 animate-ping pointer-events-none"}),n==="processing"&&e.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-purple-500 animate-ping pointer-events-none"})]})}function er(t){return Array.isArray?Array.isArray(t):Il(t)==="[object Array]"}function Dg(t){if(typeof t=="string")return t;let r=t+"";return r=="0"&&1/t==-1/0?"-0":r}function Pg(t){return t==null?"":Dg(t)}function Ht(t){return typeof t=="string"}function Cl(t){return typeof t=="number"}function Lg(t){return t===!0||t===!1||Rg(t)&&Il(t)=="[object Boolean]"}function El(t){return typeof t=="object"}function Rg(t){return El(t)&&t!==null}function Tt(t){return t!=null}function Ns(t){return!t.trim().length}function Il(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const zg="Incorrect 'index' type",_g=t=>`Invalid value for key ${t}`,Fg=t=>`Pattern length exceeds max of ${t}.`,$g=t=>`Missing ${t} property in key`,Og=t=>`Property 'weight' in key '${t}' must be a positive integer`,Ji=Object.prototype.hasOwnProperty;class Bg{constructor(r){this._keys=[],this._keyMap={};let n=0;r.forEach(s=>{let a=Al(s);this._keys.push(a),this._keyMap[a.id]=a,n+=a.weight}),this._keys.forEach(s=>{s.weight/=n})}get(r){return this._keyMap[r]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Al(t){let r=null,n=null,s=null,a=1,i=null;if(Ht(t)||er(t))s=t,r=Gi(t),n=Hs(t);else{if(!Ji.call(t,"name"))throw new Error($g("name"));const o=t.name;if(s=o,Ji.call(t,"weight")&&(a=t.weight,a<=0))throw new Error(Og(o));r=Gi(o),n=Hs(o),i=t.getFn}return{path:r,id:n,weight:a,src:s,getFn:i}}function Gi(t){return er(t)?t:t.split(".")}function Hs(t){return er(t)?t.join("."):t}function Ug(t,r){let n=[],s=!1;const a=(i,o,l)=>{if(Tt(i))if(!o[l])n.push(i);else{let d=o[l];const c=i[d];if(!Tt(c))return;if(l===o.length-1&&(Ht(c)||Cl(c)||Lg(c)))n.push(Pg(c));else if(er(c)){s=!0;for(let u=0,h=c.length;u<h;u+=1)a(c[u],o,l+1)}else o.length&&a(c,o,l+1)}};return a(t,Ht(r)?r.split("."):r,0),s?n:n[0]}const Wg={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},qg={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,r)=>t.score===r.score?t.idx<r.idx?-1:1:t.score<r.score?-1:1},Vg={location:0,threshold:.6,distance:100},Hg={useExtendedSearch:!1,getFn:Ug,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Te={...qg,...Wg,...Vg,...Hg};const Jg=/[^ ]+/g;function Gg(t=1,r=3){const n=new Map,s=Math.pow(10,r);return{get(a){const i=a.match(Jg).length;if(n.has(i))return n.get(i);const o=1/Math.pow(i,.5*t),l=parseFloat(Math.round(o*s)/s);return n.set(i,l),l},clear(){n.clear()}}}class ka{constructor({getFn:r=Te.getFn,fieldNormWeight:n=Te.fieldNormWeight}={}){this.norm=Gg(n,3),this.getFn=r,this.isCreated=!1,this.setIndexRecords()}setSources(r=[]){this.docs=r}setIndexRecords(r=[]){this.records=r}setKeys(r=[]){this.keys=r,this._keysMap={},r.forEach((n,s)=>{this._keysMap[n.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Ht(this.docs[0])?this.docs.forEach((r,n)=>{this._addString(r,n)}):this.docs.forEach((r,n)=>{this._addObject(r,n)}),this.norm.clear())}add(r){const n=this.size();Ht(r)?this._addString(r,n):this._addObject(r,n)}removeAt(r){this.records.splice(r,1);for(let n=r,s=this.size();n<s;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(r,n){return r[this._keysMap[n]]}size(){return this.records.length}_addString(r,n){if(!Tt(r)||Ns(r))return;let s={v:r,i:n,n:this.norm.get(r)};this.records.push(s)}_addObject(r,n){let s={i:n,$:{}};this.keys.forEach((a,i)=>{let o=a.getFn?a.getFn(r):this.getFn(r,a.path);if(Tt(o)){if(er(o)){let l=[];const d=[{nestedArrIndex:-1,value:o}];for(;d.length;){const{nestedArrIndex:c,value:u}=d.pop();if(Tt(u))if(Ht(u)&&!Ns(u)){let h={v:u,i:c,n:this.norm.get(u)};l.push(h)}else er(u)&&u.forEach((h,x)=>{d.push({nestedArrIndex:x,value:h})})}s.$[i]=l}else if(Ht(o)&&!Ns(o)){let l={v:o,n:this.norm.get(o)};s.$[i]=l}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function Ml(t,r,{getFn:n=Te.getFn,fieldNormWeight:s=Te.fieldNormWeight}={}){const a=new ka({getFn:n,fieldNormWeight:s});return a.setKeys(t.map(Al)),a.setSources(r),a.create(),a}function Kg(t,{getFn:r=Te.getFn,fieldNormWeight:n=Te.fieldNormWeight}={}){const{keys:s,records:a}=t,i=new ka({getFn:r,fieldNormWeight:n});return i.setKeys(s),i.setIndexRecords(a),i}function An(t,{errors:r=0,currentLocation:n=0,expectedLocation:s=0,distance:a=Te.distance,ignoreLocation:i=Te.ignoreLocation}={}){const o=r/t.length;if(i)return o;const l=Math.abs(s-n);return a?o+l/a:l?1:o}function Yg(t=[],r=Te.minMatchCharLength){let n=[],s=-1,a=-1,i=0;for(let o=t.length;i<o;i+=1){let l=t[i];l&&s===-1?s=i:!l&&s!==-1&&(a=i-1,a-s+1>=r&&n.push([s,a]),s=-1)}return t[i-1]&&i-s>=r&&n.push([s,i-1]),n}const fr=32;function Qg(t,r,n,{location:s=Te.location,distance:a=Te.distance,threshold:i=Te.threshold,findAllMatches:o=Te.findAllMatches,minMatchCharLength:l=Te.minMatchCharLength,includeMatches:d=Te.includeMatches,ignoreLocation:c=Te.ignoreLocation}={}){if(r.length>fr)throw new Error(Fg(fr));const u=r.length,h=t.length,x=Math.max(0,Math.min(s,h));let m=i,y=x;const v=l>1||d,E=v?Array(h):[];let A;for(;(A=t.indexOf(r,y))>-1;){let q=An(r,{currentLocation:A,expectedLocation:x,distance:a,ignoreLocation:c});if(m=Math.min(q,m),y=A+u,v){let M=0;for(;M<u;)E[A+M]=1,M+=1}}y=-1;let T=[],j=1,W=u+h;const Z=1<<u-1;for(let q=0;q<u;q+=1){let M=0,_=W;for(;M<_;)An(r,{errors:q,currentLocation:x+_,expectedLocation:x,distance:a,ignoreLocation:c})<=m?M=_:W=_,_=Math.floor((W-M)/2+M);W=_;let R=Math.max(1,x-_+1),L=o?h:Math.min(x+_,h)+u,C=Array(L+2);C[L+1]=(1<<q)-1;for(let b=L;b>=R;b-=1){let z=b-1,K=n[t.charAt(z)];if(v&&(E[z]=+!!K),C[b]=(C[b+1]<<1|1)&K,q&&(C[b]|=(T[b+1]|T[b])<<1|1|T[b+1]),C[b]&Z&&(j=An(r,{errors:q,currentLocation:z,expectedLocation:x,distance:a,ignoreLocation:c}),j<=m)){if(m=j,y=z,y<=x)break;R=Math.max(1,2*x-y)}}if(An(r,{errors:q+1,currentLocation:x,expectedLocation:x,distance:a,ignoreLocation:c})>m)break;T=C}const D={isMatch:y>=0,score:Math.max(.001,j)};if(v){const q=Yg(E,l);q.length?d&&(D.indices=q):D.isMatch=!1}return D}function Xg(t){let r={};for(let n=0,s=t.length;n<s;n+=1){const a=t.charAt(n);r[a]=(r[a]||0)|1<<s-n-1}return r}const Bn=String.prototype.normalize?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):t=>t;class Tl{constructor(r,{location:n=Te.location,threshold:s=Te.threshold,distance:a=Te.distance,includeMatches:i=Te.includeMatches,findAllMatches:o=Te.findAllMatches,minMatchCharLength:l=Te.minMatchCharLength,isCaseSensitive:d=Te.isCaseSensitive,ignoreDiacritics:c=Te.ignoreDiacritics,ignoreLocation:u=Te.ignoreLocation}={}){if(this.options={location:n,threshold:s,distance:a,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:d,ignoreDiacritics:c,ignoreLocation:u},r=d?r:r.toLowerCase(),r=c?Bn(r):r,this.pattern=r,this.chunks=[],!this.pattern.length)return;const h=(m,y)=>{this.chunks.push({pattern:m,alphabet:Xg(m),startIndex:y})},x=this.pattern.length;if(x>fr){let m=0;const y=x%fr,v=x-y;for(;m<v;)h(this.pattern.substr(m,fr),m),m+=fr;if(y){const E=x-fr;h(this.pattern.substr(E),E)}}else h(this.pattern,0)}searchIn(r){const{isCaseSensitive:n,ignoreDiacritics:s,includeMatches:a}=this.options;if(r=n?r:r.toLowerCase(),r=s?Bn(r):r,this.pattern===r){let v={isMatch:!0,score:0};return a&&(v.indices=[[0,r.length-1]]),v}const{location:i,distance:o,threshold:l,findAllMatches:d,minMatchCharLength:c,ignoreLocation:u}=this.options;let h=[],x=0,m=!1;this.chunks.forEach(({pattern:v,alphabet:E,startIndex:A})=>{const{isMatch:T,score:j,indices:W}=Qg(r,v,E,{location:i+A,distance:o,threshold:l,findAllMatches:d,minMatchCharLength:c,includeMatches:a,ignoreLocation:u});T&&(m=!0),x+=j,T&&W&&(h=[...h,...W])});let y={isMatch:m,score:m?x/this.chunks.length:1};return m&&a&&(y.indices=h),y}}class ur{constructor(r){this.pattern=r}static isMultiMatch(r){return Ki(r,this.multiRegex)}static isSingleMatch(r){return Ki(r,this.singleRegex)}search(){}}function Ki(t,r){const n=t.match(r);return n?n[1]:null}class Zg extends ur{constructor(r){super(r)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(r){const n=r===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class ef extends ur{constructor(r){super(r)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(r){const s=r.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,r.length-1]}}}class tf extends ur{constructor(r){super(r)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(r){const n=r.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class rf extends ur{constructor(r){super(r)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(r){const n=!r.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,r.length-1]}}}class nf extends ur{constructor(r){super(r)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(r){const n=r.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[r.length-this.pattern.length,r.length-1]}}}class sf extends ur{constructor(r){super(r)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(r){const n=!r.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,r.length-1]}}}class Dl extends ur{constructor(r,{location:n=Te.location,threshold:s=Te.threshold,distance:a=Te.distance,includeMatches:i=Te.includeMatches,findAllMatches:o=Te.findAllMatches,minMatchCharLength:l=Te.minMatchCharLength,isCaseSensitive:d=Te.isCaseSensitive,ignoreDiacritics:c=Te.ignoreDiacritics,ignoreLocation:u=Te.ignoreLocation}={}){super(r),this._bitapSearch=new Tl(r,{location:n,threshold:s,distance:a,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:d,ignoreDiacritics:c,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(r){return this._bitapSearch.searchIn(r)}}class Pl extends ur{constructor(r){super(r)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(r){let n=0,s;const a=[],i=this.pattern.length;for(;(s=r.indexOf(this.pattern,n))>-1;)n=s+i,a.push([s,n-1]);const o=!!a.length;return{isMatch:o,score:o?0:1,indices:a}}}const Js=[Zg,Pl,tf,rf,sf,nf,ef,Dl],Yi=Js.length,af=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,of="|";function lf(t,r={}){return t.split(of).map(n=>{let s=n.trim().split(af).filter(i=>i&&!!i.trim()),a=[];for(let i=0,o=s.length;i<o;i+=1){const l=s[i];let d=!1,c=-1;for(;!d&&++c<Yi;){const u=Js[c];let h=u.isMultiMatch(l);h&&(a.push(new u(h,r)),d=!0)}if(!d)for(c=-1;++c<Yi;){const u=Js[c];let h=u.isSingleMatch(l);if(h){a.push(new u(h,r));break}}}return a})}const cf=new Set([Dl.type,Pl.type]);class df{constructor(r,{isCaseSensitive:n=Te.isCaseSensitive,ignoreDiacritics:s=Te.ignoreDiacritics,includeMatches:a=Te.includeMatches,minMatchCharLength:i=Te.minMatchCharLength,ignoreLocation:o=Te.ignoreLocation,findAllMatches:l=Te.findAllMatches,location:d=Te.location,threshold:c=Te.threshold,distance:u=Te.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:s,includeMatches:a,minMatchCharLength:i,findAllMatches:l,ignoreLocation:o,location:d,threshold:c,distance:u},r=n?r:r.toLowerCase(),r=s?Bn(r):r,this.pattern=r,this.query=lf(this.pattern,this.options)}static condition(r,n){return n.useExtendedSearch}searchIn(r){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:a,ignoreDiacritics:i}=this.options;r=a?r:r.toLowerCase(),r=i?Bn(r):r;let o=0,l=[],d=0;for(let c=0,u=n.length;c<u;c+=1){const h=n[c];l.length=0,o=0;for(let x=0,m=h.length;x<m;x+=1){const y=h[x],{isMatch:v,indices:E,score:A}=y.search(r);if(v){if(o+=1,d+=A,s){const T=y.constructor.type;cf.has(T)?l=[...l,...E]:l.push(E)}}else{d=0,o=0,l.length=0;break}}if(o){let x={isMatch:!0,score:d/o};return s&&(x.indices=l),x}}return{isMatch:!1,score:1}}}const Gs=[];function uf(...t){Gs.push(...t)}function Ks(t,r){for(let n=0,s=Gs.length;n<s;n+=1){let a=Gs[n];if(a.condition(t,r))return new a(t,r)}return new Tl(t,r)}const Un={AND:"$and",OR:"$or"},Ys={PATH:"$path",PATTERN:"$val"},Qs=t=>!!(t[Un.AND]||t[Un.OR]),mf=t=>!!t[Ys.PATH],pf=t=>!er(t)&&El(t)&&!Qs(t),Qi=t=>({[Un.AND]:Object.keys(t).map(r=>({[r]:t[r]}))});function Ll(t,r,{auto:n=!0}={}){const s=a=>{let i=Object.keys(a);const o=mf(a);if(!o&&i.length>1&&!Qs(a))return s(Qi(a));if(pf(a)){const d=o?a[Ys.PATH]:i[0],c=o?a[Ys.PATTERN]:a[d];if(!Ht(c))throw new Error(_g(d));const u={keyId:Hs(d),pattern:c};return n&&(u.searcher=Ks(c,r)),u}let l={children:[],operator:i[0]};return i.forEach(d=>{const c=a[d];er(c)&&c.forEach(u=>{l.children.push(s(u))})}),l};return Qs(t)||(t=Qi(t)),s(t)}function hf(t,{ignoreFieldNorm:r=Te.ignoreFieldNorm}){t.forEach(n=>{let s=1;n.matches.forEach(({key:a,norm:i,score:o})=>{const l=a?a.weight:null;s*=Math.pow(o===0&&l?Number.EPSILON:o,(l||1)*(r?1:i))}),n.score=s})}function xf(t,r){const n=t.matches;r.matches=[],Tt(n)&&n.forEach(s=>{if(!Tt(s.indices)||!s.indices.length)return;const{indices:a,value:i}=s;let o={indices:a,value:i};s.key&&(o.key=s.key.src),s.idx>-1&&(o.refIndex=s.idx),r.matches.push(o)})}function gf(t,r){r.score=t.score}function ff(t,r,{includeMatches:n=Te.includeMatches,includeScore:s=Te.includeScore}={}){const a=[];return n&&a.push(xf),s&&a.push(gf),t.map(i=>{const{idx:o}=i,l={item:r[o],refIndex:o};return a.length&&a.forEach(d=>{d(i,l)}),l})}class Or{constructor(r,n={},s){this.options={...Te,...n},this.options.useExtendedSearch,this._keyStore=new Bg(this.options.keys),this.setCollection(r,s)}setCollection(r,n){if(this._docs=r,n&&!(n instanceof ka))throw new Error(zg);this._myIndex=n||Ml(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(r){Tt(r)&&(this._docs.push(r),this._myIndex.add(r))}remove(r=()=>!1){const n=[];for(let s=0,a=this._docs.length;s<a;s+=1){const i=this._docs[s];r(i,s)&&(this.removeAt(s),s-=1,a-=1,n.push(i))}return n}removeAt(r){this._docs.splice(r,1),this._myIndex.removeAt(r)}getIndex(){return this._myIndex}search(r,{limit:n=-1}={}){const{includeMatches:s,includeScore:a,shouldSort:i,sortFn:o,ignoreFieldNorm:l}=this.options;let d=Ht(r)?Ht(this._docs[0])?this._searchStringList(r):this._searchObjectList(r):this._searchLogical(r);return hf(d,{ignoreFieldNorm:l}),i&&d.sort(o),Cl(n)&&n>-1&&(d=d.slice(0,n)),ff(d,this._docs,{includeMatches:s,includeScore:a})}_searchStringList(r){const n=Ks(r,this.options),{records:s}=this._myIndex,a=[];return s.forEach(({v:i,i:o,n:l})=>{if(!Tt(i))return;const{isMatch:d,score:c,indices:u}=n.searchIn(i);d&&a.push({item:i,idx:o,matches:[{score:c,value:i,norm:l,indices:u}]})}),a}_searchLogical(r){const n=Ll(r,this.options),s=(l,d,c)=>{if(!l.children){const{keyId:h,searcher:x}=l,m=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(d,h),searcher:x});return m&&m.length?[{idx:c,item:d,matches:m}]:[]}const u=[];for(let h=0,x=l.children.length;h<x;h+=1){const m=l.children[h],y=s(m,d,c);if(y.length)u.push(...y);else if(l.operator===Un.AND)return[]}return u},a=this._myIndex.records,i={},o=[];return a.forEach(({$:l,i:d})=>{if(Tt(l)){let c=s(n,l,d);c.length&&(i[d]||(i[d]={idx:d,item:l,matches:[]},o.push(i[d])),c.forEach(({matches:u})=>{i[d].matches.push(...u)}))}}),o}_searchObjectList(r){const n=Ks(r,this.options),{keys:s,records:a}=this._myIndex,i=[];return a.forEach(({$:o,i:l})=>{if(!Tt(o))return;let d=[];s.forEach((c,u)=>{d.push(...this._findMatches({key:c,value:o[u],searcher:n}))}),d.length&&i.push({idx:l,item:o,matches:d})}),i}_findMatches({key:r,value:n,searcher:s}){if(!Tt(n))return[];let a=[];if(er(n))n.forEach(({v:i,i:o,n:l})=>{if(!Tt(i))return;const{isMatch:d,score:c,indices:u}=s.searchIn(i);d&&a.push({score:c,key:r,value:i,idx:o,norm:l,indices:u})});else{const{v:i,n:o}=n,{isMatch:l,score:d,indices:c}=s.searchIn(i);l&&a.push({score:d,key:r,value:i,norm:o,indices:c})}return a}}Or.version="7.1.0";Or.createIndex=Ml;Or.parseIndex=Kg;Or.config=Te;Or.parseQuery=Ll;uf(df);const bf=({commands:t=[],selectedIndex:r=-1,onSelect:n,onClose:s,position:a={top:0,left:0},isOpen:i=!1,frequentCommands:o=[]})=>{const l=p.useRef(null),d=p.useRef(null),u=(()=>{const T=window.innerWidth<640,j=window.innerHeight;return T?{position:"fixed",bottom:`${a.bottom||90}px`,left:"16px",right:"16px",width:"auto",maxWidth:"calc(100vw - 32px)",maxHeight:"min(50vh, 300px)"}:{position:"fixed",top:`${Math.max(16,Math.min(a.top,j-316))}px`,left:`${a.left}px`,width:"min(400px, calc(100vw - 32px))",maxWidth:"calc(100vw - 32px)",maxHeight:"300px"}})();if(p.useEffect(()=>{const T=j=>{l.current&&!l.current.contains(j.target)&&i&&s()};if(i)return document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[i,s]),p.useEffect(()=>{if(d.current&&l.current){const T=l.current.getBoundingClientRect(),j=d.current.getBoundingClientRect();j.bottom>T.bottom?d.current.scrollIntoView({block:"nearest",behavior:"smooth"}):j.top<T.top&&d.current.scrollIntoView({block:"nearest",behavior:"smooth"})}},[r]),!i)return null;if(t.length===0)return e.jsx("div",{ref:l,className:"command-menu command-menu-empty",style:{...u,maxHeight:"300px",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"20px",opacity:1,transform:"translateY(0)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out",textAlign:"center"},children:"No commands available"});const h=o.length>0,x=t.reduce((T,j)=>{const W=j.namespace||j.type||"other";return T[W]||(T[W]=[]),T[W].push(j),T},{});h&&(x.frequent=o);const y=(h?["frequent","builtin","project","user","other"]:["builtin","project","user","other"]).filter(T=>x[T]),v={frequent:"β Frequently Used",builtin:"Built-in Commands",project:"Project Commands",user:"User Commands",other:"Other Commands"};let E=0;const A=[];return y.forEach(T=>{x[T].forEach(j=>{A.push({...j,globalIndex:E++,namespace:T})})}),e.jsxs("div",{ref:l,role:"listbox","aria-label":"Available commands",className:"command-menu",style:{...u,maxHeight:"300px",overflowY:"auto",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"8px",opacity:i?1:0,transform:i?"translateY(0)":"translateY(-10px)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out"},children:[y.map(T=>e.jsxs("div",{className:"command-group",children:[y.length>1&&e.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:"#6b7280",padding:"8px 12px 4px",letterSpacing:"0.05em"},children:v[T]||T}),x[T].map(j=>{const W=A.find(D=>D.name===j.name&&D.namespace===T),Z=W&&W.globalIndex===r;return e.jsxs("div",{ref:Z?d:null,role:"option","aria-selected":Z,className:"command-item",onMouseEnter:()=>n&&n(j,W.globalIndex,!0),onClick:()=>n&&n(j,W.globalIndex,!1),style:{display:"flex",alignItems:"flex-start",padding:"10px 12px",borderRadius:"6px",cursor:"pointer",backgroundColor:Z?"#eff6ff":"transparent",transition:"background-color 100ms ease-in-out",marginBottom:"2px"},onMouseDown:D=>D.preventDefault(),children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:j.description?"4px":0},children:[e.jsxs("span",{style:{fontSize:"16px",flexShrink:0},children:[T==="builtin"&&"β‘",T==="project"&&"π",T==="user"&&"π€",T==="other"&&"π"]}),e.jsx("span",{style:{fontWeight:600,fontSize:"14px",color:"#111827",fontFamily:"monospace"},children:j.name}),j.metadata?.type&&e.jsx("span",{className:"command-metadata-badge",style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f3f4f6",color:"#6b7280",fontWeight:500},children:j.metadata.type})]}),j.description&&e.jsx("div",{style:{fontSize:"13px",color:"#6b7280",marginLeft:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:j.description})]}),Z&&e.jsx("span",{style:{marginLeft:"8px",color:"#3b82f6",fontSize:"12px",fontWeight:600},children:"β΅"})]},`${T}-${j.name}`)})]},T)),e.jsx("style",{children:`
|
|
412
|
+
.command-menu {
|
|
413
|
+
background-color: white;
|
|
414
|
+
border: 1px solid #e5e7eb;
|
|
415
|
+
}
|
|
416
|
+
.command-menu-empty {
|
|
417
|
+
color: #6b7280;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
@media (prefers-color-scheme: dark) {
|
|
421
|
+
.command-menu {
|
|
422
|
+
background-color: #1f2937 !important;
|
|
423
|
+
border: 1px solid #374151 !important;
|
|
424
|
+
}
|
|
425
|
+
.command-menu-empty {
|
|
426
|
+
color: #9ca3af !important;
|
|
427
|
+
}
|
|
428
|
+
.command-item[aria-selected="true"] {
|
|
429
|
+
background-color: #1e40af !important;
|
|
430
|
+
}
|
|
431
|
+
.command-item span:not(.command-metadata-badge) {
|
|
432
|
+
color: #f3f4f6 !important;
|
|
433
|
+
}
|
|
434
|
+
.command-metadata-badge {
|
|
435
|
+
background-color: #f3f4f6 !important;
|
|
436
|
+
color: #6b7280 !important;
|
|
437
|
+
}
|
|
438
|
+
.command-item div {
|
|
439
|
+
color: #d1d5db !important;
|
|
440
|
+
}
|
|
441
|
+
.command-group > div:first-child {
|
|
442
|
+
color: #9ca3af !important;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
`})]})};function ir(t){return t&&t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function Xs(t){try{return typeof t!="string"?t:t.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(r,n)=>{let s=parseInt(n,10);if(!Number.isFinite(s))return r;s<1e12&&(s*=1e3);const a=new Date(s),i=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(a),o=-a.getTimezoneOffset(),l=o>=0?"+":"-",d=Math.abs(o),c=Math.floor(d/60),u=d%60,h=`GMT${l}${c}${u?":"+String(u).padStart(2,"0"):""}`,y=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,T=>T.toUpperCase()),v=y?`${h} (${y})`:h,E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],A=`${a.getDate()} ${E[a.getMonth()]} ${a.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${i} ${v}** - ${A}`})}catch{return t}}const Nt={setItem:(t,r)=>{try{if(t.startsWith("chat_messages_")&&typeof r=="string")try{const n=JSON.parse(r);if(Array.isArray(n)&&n.length>50){console.warn(`Truncating chat history for ${t} from ${n.length} to 50 messages`);const s=n.slice(-50);r=JSON.stringify(s)}}catch(n){console.warn("Could not parse chat messages for truncation:",n)}localStorage.setItem(t,r)}catch(n){if(n.name==="QuotaExceededError"){console.warn("localStorage quota exceeded, clearing old data");const s=Object.keys(localStorage),a=s.filter(o=>o.startsWith("chat_messages_")).sort();a.length>3&&a.slice(0,a.length-3).forEach(o=>{localStorage.removeItem(o),console.log(`Removed old chat data: ${o}`)}),s.filter(o=>o.startsWith("draft_input_")).forEach(o=>{localStorage.removeItem(o)});try{localStorage.setItem(t,r)}catch(o){if(console.error("Failed to save to localStorage even after cleanup:",o),t.startsWith("chat_messages_")&&typeof r=="string")try{const l=JSON.parse(r);if(Array.isArray(l)&&l.length>10){const d=l.slice(-10);localStorage.setItem(t,JSON.stringify(d)),console.warn("Saved only last 10 messages due to quota constraints")}}catch(l){console.error("Final save attempt failed:",l)}}}else console.error("localStorage error:",n)}},getItem:t=>{try{return localStorage.getItem(t)}catch(r){return console.error("localStorage getItem error:",r),null}},removeItem:t=>{try{localStorage.removeItem(t)}catch(r){console.error("localStorage removeItem error:",r)}}},yf=p.memo(({message:t,index:r,prevMessage:n,createDiff:s,onFileOpen:a,onShowSettings:i,autoExpandTools:o,showRawParameters:l,showThinking:d})=>{const c=n&&n.type===t.type&&(n.type==="assistant"||n.type==="user"||n.type==="tool"||n.type==="error"),u=lr.useRef(null),[h,x]=lr.useState(!1);return lr.useEffect(()=>{if(!o||!u.current||!t.isToolUse)return;const m=new IntersectionObserver(y=>{y.forEach(v=>{v.isIntersecting&&!h&&(x(!0),u.current.querySelectorAll("details").forEach(A=>{A.open=!0}))})},{threshold:.1});return m.observe(u.current),()=>{u.current&&m.unobserve(u.current)}},[o,h,t.isToolUse]),e.jsx("div",{ref:u,className:`chat-message ${t.type} ${c?"grouped":""} ${t.type==="user"?"flex justify-end px-3 sm:px-0":"px-3 sm:px-0"}`,children:t.type==="user"?e.jsxs("div",{className:"flex items-end space-x-0 sm:space-x-3 w-full sm:w-auto sm:max-w-[85%] md:max-w-md lg:max-w-lg xl:max-w-xl",children:[e.jsxs("div",{className:"bg-blue-600 text-white rounded-2xl rounded-br-md px-3 sm:px-4 py-2 shadow-sm flex-1 sm:flex-initial",children:[e.jsx("div",{className:"text-sm whitespace-pre-wrap break-words",children:t.content}),t.images&&t.images.length>0&&e.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:t.images.map((m,y)=>e.jsx("img",{src:m.data,alt:m.name,className:"rounded-lg max-w-full h-auto cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(m.data,"_blank")},y))}),e.jsx("div",{className:"text-xs text-blue-100 mt-1 text-right",children:new Date(t.timestamp).toLocaleTimeString()})]}),!c&&e.jsx("div",{className:"hidden sm:flex w-8 h-8 bg-blue-600 rounded-full items-center justify-center text-white text-sm flex-shrink-0",children:"U"})]}):e.jsxs("div",{className:"w-full",children:[!c&&e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[t.type==="error"?e.jsx("div",{className:"w-8 h-8 bg-red-600 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"!"}):t.type==="tool"?e.jsx("div",{className:"w-8 h-8 bg-gray-600 dark:bg-gray-700 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"π§"}):e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?e.jsx(Zt,{className:"w-full h-full"}):e.jsx(Vt,{className:"w-full h-full"})}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:t.type==="error"?"Error":t.type==="tool"?"Tool":(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":"Claude"})]}),e.jsxs("div",{className:"w-full",children:[t.isToolUse&&!["Read","TodoWrite","TodoRead"].includes(t.toolName)?e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-2 sm:p-3 mb-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 bg-blue-600 rounded flex items-center justify-center",children:e.jsxs("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),e.jsxs("span",{className:"font-medium text-blue-900 dark:text-blue-100",children:["Using ",t.toolName]}),e.jsx("span",{className:"text-xs text-blue-600 dark:text-blue-400 font-mono",children:t.toolId})]}),i&&e.jsx("button",{onClick:m=>{m.stopPropagation(),i()},className:"p-1 rounded hover:bg-blue-200 dark:hover:bg-blue-800 transition-colors",title:"Tool Settings",children:e.jsxs("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]}),t.toolInput&&t.toolName==="Edit"&&(()=>{try{const m=JSON.parse(t.toolInput);if(m.file_path&&m.old_string&&m.new_string)return e.jsxs("details",{className:"mt-2",open:o,children:[e.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"π View edit diff for",e.jsx("button",{onClick:y=>{y.preventDefault(),y.stopPropagation(),a&&a(m.file_path,{old_string:m.old_string,new_string:m.new_string})},className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-mono",children:m.file_path.split("/").pop()})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("button",{onClick:()=>a&&a(m.file_path,{old_string:m.old_string,new_string:m.new_string}),className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 truncate underline cursor-pointer",children:m.file_path}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Diff"})]}),e.jsx("div",{className:"text-xs font-mono",children:s(m.old_string,m.new_string).map((y,v)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:`w-8 text-center border-r ${y.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:y.type==="removed"?"-":"+"}),e.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${y.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:y.content})]},v))})]}),l&&e.jsxs("details",{className:"mt-2",open:o,children:[e.jsx("summary",{className:"text-xs text-blue-600 dark:text-blue-400 cursor-pointer hover:text-blue-700 dark:hover:text-blue-300",children:"View raw parameters"}),e.jsx("pre",{className:"mt-2 text-xs bg-blue-100 dark:bg-blue-800/30 p-2 rounded whitespace-pre-wrap break-words overflow-hidden text-blue-900 dark:text-blue-100",children:t.toolInput})]})]})]})}catch{}return e.jsxs("details",{className:"mt-2",open:o,children:[e.jsx("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200",children:"View input parameters"}),e.jsx("pre",{className:"mt-2 text-xs bg-blue-100 dark:bg-blue-800/30 p-2 rounded whitespace-pre-wrap break-words overflow-hidden text-blue-900 dark:text-blue-100",children:t.toolInput})]})})(),t.toolInput&&t.toolName!=="Edit"&&(()=>{if(t.toolName==="Write")try{let m;if(typeof t.toolInput=="string"?m=JSON.parse(t.toolInput):m=t.toolInput,m.file_path&&m.content!==void 0)return e.jsxs("details",{className:"mt-2",open:o,children:[e.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"π Creating new file:",e.jsx("button",{onClick:y=>{y.preventDefault(),y.stopPropagation(),a&&a(m.file_path,{old_string:"",new_string:m.content})},className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-mono",children:m.file_path.split("/").pop()})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("button",{onClick:()=>a&&a(m.file_path,{old_string:"",new_string:m.content}),className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 truncate underline cursor-pointer",children:m.file_path}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"New File"})]}),e.jsx("div",{className:"text-xs font-mono",children:s("",m.content).map((y,v)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:`w-8 text-center border-r ${y.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:y.type==="removed"?"-":"+"}),e.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${y.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:y.content})]},v))})]}),l&&e.jsxs("details",{className:"mt-2",open:o,children:[e.jsx("summary",{className:"text-xs text-blue-600 dark:text-blue-400 cursor-pointer hover:text-blue-700 dark:hover:text-blue-300",children:"View raw parameters"}),e.jsx("pre",{className:"mt-2 text-xs bg-blue-100 dark:bg-blue-800/30 p-2 rounded whitespace-pre-wrap break-words overflow-hidden text-blue-900 dark:text-blue-100",children:t.toolInput})]})]})]})}catch{}if(t.toolName==="TodoWrite")try{const m=JSON.parse(t.toolInput);if(m.todos&&Array.isArray(m.todos))return e.jsxs("details",{className:"mt-2",open:o,children:[e.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"Updating Todo List"]}),e.jsxs("div",{className:"mt-3",children:[e.jsx(js,{todos:m.todos}),l&&e.jsxs("details",{className:"mt-3",open:o,children:[e.jsx("summary",{className:"text-xs text-blue-600 dark:text-blue-400 cursor-pointer hover:text-blue-700 dark:hover:text-blue-300",children:"View raw parameters"}),e.jsx("pre",{className:"mt-2 text-xs bg-blue-100 dark:bg-blue-800/30 p-2 rounded overflow-x-auto text-blue-900 dark:text-blue-100",children:t.toolInput})]})]})]})}catch{}if(t.toolName==="Bash")try{const m=JSON.parse(t.toolInput);return e.jsxs("details",{className:"mt-2",open:o,children:[e.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"Running command"]}),e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 font-mono text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-gray-400",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e.jsx("span",{className:"text-xs",children:"Terminal"})]}),e.jsxs("div",{className:"whitespace-pre-wrap break-all text-green-400",children:["$ ",m.command]})]}),m.description&&e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 italic",children:m.description}),l&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-xs text-blue-600 dark:text-blue-400 cursor-pointer hover:text-blue-700 dark:hover:text-blue-300",children:"View raw parameters"}),e.jsx("pre",{className:"mt-2 text-xs bg-blue-100 dark:bg-blue-800/30 p-2 rounded whitespace-pre-wrap break-words overflow-hidden text-blue-900 dark:text-blue-100",children:t.toolInput})]})]})]})}catch{}if(t.toolName==="Read")try{const m=JSON.parse(t.toolInput);if(m.file_path){const y=m.file_path.split("/").pop();return e.jsxs("div",{className:"mt-2 text-sm text-blue-700 dark:text-blue-300",children:["Read"," ",e.jsx("button",{onClick:()=>a&&a(m.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-mono",children:y})]})}}catch{}if(t.toolName==="exit_plan_mode")try{const m=JSON.parse(t.toolInput);if(m.plan){const y=m.plan.replace(/\\n/g,`
|
|
446
|
+
`);return e.jsxs("details",{className:"mt-2",open:o,children:[e.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"π View implementation plan"]}),e.jsx("div",{className:"mt-3 prose prose-sm max-w-none dark:prose-invert",children:e.jsx(Yr,{children:y})})]})}}catch{}return e.jsxs("details",{className:"mt-2",open:o,children:[e.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View input parameters"]}),e.jsx("pre",{className:"mt-2 text-xs bg-blue-100 dark:bg-blue-800/30 p-2 rounded whitespace-pre-wrap break-words overflow-hidden text-blue-900 dark:text-blue-100",children:t.toolInput})]})})(),t.toolResult&&e.jsxs("div",{className:"mt-3 border-t border-blue-200 dark:border-blue-700 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`w-4 h-4 rounded flex items-center justify-center ${t.toolResult.isError?"bg-red-500":"bg-green-500"}`,children:e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.toolResult.isError?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsx("span",{className:`text-sm font-medium ${t.toolResult.isError?"text-red-700 dark:text-red-300":"text-green-700 dark:text-green-300"}`,children:t.toolResult.isError?"Tool Error":"Tool Result"})]}),e.jsx("div",{className:`text-sm ${t.toolResult.isError?"text-red-800 dark:text-red-200":"text-green-800 dark:text-green-200"}`,children:(()=>{const m=String(t.toolResult.content||"");if((t.toolName==="TodoWrite"||t.toolName==="TodoRead")&&(m.includes("Todos have been modified successfully")||m.includes("Todo list")||m.startsWith("[")&&m.includes('"content"')&&m.includes('"status"')))try{let E=null;if(m.startsWith("["))E=JSON.parse(m);else if(m.includes("Todos have been modified successfully"))return e.jsx("div",{children:e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"font-medium",children:"Todo list has been updated successfully"})})});if(E&&Array.isArray(E))return e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-3",children:e.jsx("span",{className:"font-medium",children:"Current Todo List"})}),e.jsx(js,{todos:E,isResult:!0})]})}catch{}if(t.toolName==="exit_plan_mode")try{const E=JSON.parse(m);if(E.plan){const A=E.plan.replace(/\\n/g,`
|
|
447
|
+
`);return e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-3",children:e.jsx("span",{className:"font-medium",children:"Implementation Plan"})}),e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(Yr,{children:A})})]})}}catch{}if(m.includes("Do you want to proceed?")&&t.toolName==="Bash"){const E=m.split(`
|
|
448
|
+
`),A=E.findIndex(M=>M.includes("Do you want to proceed?")),T=E.slice(0,A).join(`
|
|
449
|
+
`),j=E.slice(A),W=j.find(M=>M.includes("Do you want to proceed?"))||"",Z=[];j.forEach(M=>{const _=M.match(/^\s*(\d+)\.\s+(.+)$/);_&&Z.push({number:_[1],text:_[2].trim()})});const D=m.match(/>\s*(\d+)/),q=D?D[1]:null;return e.jsxs("div",{className:"space-y-3",children:[T&&e.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words",children:T})}),e.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-2",children:"Interactive Prompt"}),e.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:W}),e.jsx("div",{className:"space-y-2 mb-4",children:Z.map(M=>e.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${q===M.number?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700 hover:border-amber-400 dark:hover:border-amber-600 hover:shadow-sm"} ${q?"cursor-default":"cursor-not-allowed opacity-75"}`,disabled:!0,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${q===M.number?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:M.number}),e.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:M.text}),q===M.number&&e.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})]})},M.number))}),q&&e.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[e.jsxs("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:["β Claude selected option ",q]}),e.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"In the CLI, you would select this option interactively using arrow keys or by typing the number."})]})]})]})})]})}const y=m.match(/The file (.+?) has been updated\./);if(y)return e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"font-medium",children:"File updated successfully"})}),e.jsx("button",{onClick:()=>a&&a(y[1]),className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:y[1]})]});const v=m.match(/(?:The file|File) (.+?) has been (?:created|written)(?: successfully)?\.?/);return v?e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"font-medium",children:"File created successfully"})}),e.jsx("button",{onClick:()=>a&&a(v[1]),className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:v[1]})]}):t.toolName==="Write"&&!t.toolResult.isError?e.jsxs("div",{className:"text-green-700 dark:text-green-300",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("span",{className:"font-medium",children:"File written successfully"})]}),e.jsx("p",{className:"text-xs mt-1 text-green-600 dark:text-green-400",children:"The file content is displayed in the diff view above"})]}):m.includes("cat -n")&&m.includes("β")?e.jsxs("details",{open:o,children:[e.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View file content"]}),e.jsx("div",{className:"mt-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsx("div",{className:"text-xs font-mono p-3 whitespace-pre-wrap break-words overflow-hidden",children:m})})]}):m.length>300?e.jsxs("details",{open:o,children:[e.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View full output (",m.length," chars)"]}),e.jsx("div",{className:"mt-2 prose prose-sm max-w-none prose-green dark:prose-invert",children:e.jsx(Yr,{children:m})})]}):e.jsx("div",{className:"prose prose-sm max-w-none prose-green dark:prose-invert",children:e.jsx(Yr,{children:m})})})()})]})]}):t.isInteractivePrompt?e.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-3",children:"Interactive Prompt"}),(()=>{const m=t.content.split(`
|
|
450
|
+
`).filter(E=>E.trim()),y=m.find(E=>E.includes("?"))||m[0]||"",v=[];return m.forEach(E=>{const A=E.match(/[β―\s]*(\d+)\.\s+(.+)/);if(A){const T=E.includes("β―");v.push({number:A[1],text:A[2].trim(),isSelected:T})}}),e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:y}),e.jsx("div",{className:"space-y-2 mb-4",children:v.map(E=>e.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${E.isSelected?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700"} cursor-not-allowed opacity-75`,disabled:!0,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${E.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:E.number}),e.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:E.text}),E.isSelected&&e.jsx("span",{className:"text-lg",children:"β―"})]})},E.number))}),e.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[e.jsx("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:"β³ Waiting for your response in the CLI"}),e.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"Please select an option in your terminal where Claude is running."})]})]})})()]})]})}):t.isToolUse&&t.toolName==="Read"?(()=>{try{const m=JSON.parse(t.toolInput);if(m.file_path){const y=m.file_path.split("/").pop();return e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border-l-2 border-blue-300 dark:border-blue-600 pl-3 py-1 mb-2 text-sm text-blue-700 dark:text-blue-300",children:["π Read"," ",e.jsx("button",{onClick:()=>a&&a(m.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-mono",children:y})]})}}catch{return e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border-l-2 border-blue-300 dark:border-blue-600 pl-3 py-1 mb-2 text-sm text-blue-700 dark:text-blue-300",children:"π Read file"})}})():t.isToolUse&&t.toolName==="TodoWrite"?(()=>{try{const m=JSON.parse(t.toolInput);if(m.todos&&Array.isArray(m.todos))return e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border-l-2 border-blue-300 dark:border-blue-600 pl-3 py-1 mb-2",children:[e.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300 mb-2",children:"π Update todo list"}),e.jsx(js,{todos:m.todos})]})}catch{return e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border-l-2 border-blue-300 dark:border-blue-600 pl-3 py-1 mb-2 text-sm text-blue-700 dark:text-blue-300",children:"π Update todo list"})}})():t.isToolUse&&t.toolName==="TodoRead"?e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border-l-2 border-blue-300 dark:border-blue-600 pl-3 py-1 mb-2 text-sm text-blue-700 dark:text-blue-300",children:"π Read todo list"}):e.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:[d&&t.reasoning&&e.jsxs("details",{className:"mb-3",children:[e.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 font-medium",children:"π Thinking..."}),e.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 italic text-gray-600 dark:text-gray-400 text-sm",children:e.jsx("div",{className:"whitespace-pre-wrap",children:t.reasoning})})]}),(()=>{const m=Xs(String(t.content||"")),y=m.trim();if((y.startsWith("{")||y.startsWith("["))&&(y.endsWith("}")||y.endsWith("]")))try{const v=JSON.parse(y),E=JSON.stringify(v,null,2);return e.jsxs("div",{className:"my-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),e.jsx("span",{className:"font-medium",children:"JSON Response"})]}),e.jsx("div",{className:"bg-gray-800 dark:bg-gray-900 border border-gray-600/30 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsx("pre",{className:"p-4 overflow-x-auto",children:e.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre",children:E})})})]})}catch{}return t.type==="assistant"?e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert prose-gray [&_code]:!bg-transparent [&_code]:!p-0 [&_pre]:!bg-transparent [&_pre]:!border-0 [&_pre]:!p-0",children:e.jsx(Yr,{components:{code:({node:v,inline:E,className:A,children:T,...j})=>E?e.jsx("strong",{className:"text-blue-600 dark:text-blue-400 font-bold not-prose",...j,children:T}):e.jsx("div",{className:"bg-gray-800 dark:bg-gray-800 border border-gray-600/30 dark:border-gray-600/30 p-3 rounded-lg overflow-hidden my-2",children:e.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre-wrap break-words",...j,children:T})}),blockquote:({children:v})=>e.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:v}),a:({href:v,children:E})=>e.jsx("a",{href:v,className:"text-blue-600 dark:text-blue-400 hover:underline",target:"_blank",rel:"noopener noreferrer",children:E}),p:({children:v})=>e.jsx("div",{className:"mb-2 last:mb-0",children:v})},children:m})}):e.jsx("div",{className:"whitespace-pre-wrap",children:m})})()]}),e.jsx("div",{className:`text-xs text-gray-500 dark:text-gray-400 mt-1 ${c?"opacity-0 group-hover:opacity-100":""}`,children:new Date(t.timestamp).toLocaleTimeString()})]})]})})}),kf=({file:t,onRemove:r,uploadProgress:n,error:s})=>{const[a,i]=p.useState(null);return p.useEffect(()=>{const o=URL.createObjectURL(t);return i(o),()=>URL.revokeObjectURL(o)},[t]),e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:a,alt:t.name,className:"w-20 h-20 object-cover rounded"}),n!==void 0&&n<100&&e.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:e.jsxs("div",{className:"text-white text-xs",children:[n,"%"]})}),s&&e.jsx("div",{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("button",{onClick:r,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};function vf({selectedProject:t,selectedSession:r,ws:n,sendMessage:s,messages:a,onFileOpen:i,onInputFocusChange:o,onSessionActive:l,onSessionInactive:d,onSessionProcessing:c,onSessionNotProcessing:u,processingSessions:h,onReplaceTemporarySession:x,onNavigateToSession:m,onShowSettings:y,autoExpandTools:v,showRawParameters:E,showThinking:A,autoScrollToBottom:T,sendByCtrlEnter:j,externalMessageUpdate:W,onTaskClick:Z,onShowAllTasks:D}){const{tasksEnabled:q}=un(),[M,_]=p.useState(()=>typeof window<"u"&&t&&Nt.getItem(`draft_input_${t.name}`)||""),[R,L]=p.useState(()=>{if(typeof window<"u"&&t){const w=Nt.getItem(`chat_messages_${t.name}`);return w?JSON.parse(w):[]}return[]}),[C,I]=p.useState(!1),[b,z]=p.useState(r?.id||null),[K,B]=p.useState(!1),[G,ie]=p.useState([]),[N,Ie]=p.useState(!1),[Fe,f]=p.useState(!1),[te,ue]=p.useState(0),[re,Ce]=p.useState(!1),[Be,ee]=p.useState(0),oe=20,[xe,Ne]=p.useState(!1),[ye,Ue]=p.useState("default"),[Ye,nt]=p.useState([]),[me,pe]=p.useState(new Map),[Me,et]=p.useState(new Map),it=p.useRef(null),ge=p.useRef(null),wt=p.useRef(null),X=p.useRef(null),ke=p.useRef(!1),k=p.useRef(""),P=p.useRef(null),J=p.useRef(null),[se,le]=p.useState(""),[Le,De]=p.useState(!1),[Ge,mt]=p.useState([]),[Ze,st]=p.useState([]),[ht,ct]=p.useState(-1),[Lt,Rt]=p.useState(0),[jt,yt]=p.useState(-1),[mr,ft]=p.useState(!1),[F,g]=p.useState(!1),U=p.useRef({height:0,top:0}),[ce,we]=p.useState(!1),[V,Ve]=p.useState([]),[S,ae]=p.useState([]),[Ae,We]=p.useState(""),[at,kt]=p.useState(!1),[tt,Br]=p.useState(null),[Jn,Gt]=p.useState(-1),[wa,tr]=p.useState(-1),[Ur,Fl]=p.useState(100),[$l,jr]=p.useState(null),[pt,Gn]=p.useState(()=>localStorage.getItem("selected-provider")||"claude"),[Nr,ja]=p.useState(()=>localStorage.getItem("cursor-model")||"gpt-5");p.useEffect(()=>{if(r?.id){const w=localStorage.getItem(`permissionMode-${r.id}`);Ue(w||"default")}},[r?.id]),p.useEffect(()=>{r&&r.__provider&&r.__provider!==pt&&(Gn(r.__provider),localStorage.setItem("selected-provider",r.__provider))},[r]),p.useEffect(()=>{pt==="cursor"&&fetch("/api/cursor/config",{headers:{Authorization:`Bearer ${localStorage.getItem("auth-token")}`}}).then(w=>w.json()).then(w=>{if(w.success&&w.config?.model?.modelId){const O={"gpt-5":"gpt-5","claude-4-sonnet":"sonnet-4","sonnet-4":"sonnet-4","claude-4-opus":"opus-4.1","opus-4.1":"opus-4.1"}[w.config.model.modelId]||w.config.model.modelId;localStorage.getItem("cursor-model")||ja(O)}}).catch(w=>console.error("Error loading Cursor config:",w))},[pt]),p.useEffect(()=>{(async()=>{if(t)try{const H=await Re("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:t.path})});if(!H.ok)throw new Error("Failed to fetch commands");const O=await H.json(),$=[...(O.builtIn||[]).map(je=>({...je,type:"built-in"})),...(O.custom||[]).map(je=>({...je,type:"custom"}))];Ve($);const Q=`command_history_${t.name}`,ve=Nt.getItem(Q);if(ve)try{const je=JSON.parse(ve),Ke=$.sort((Ee,Y)=>{const he=je[Ee.name]||0;return(je[Y.name]||0)-he});Ve(Ke)}catch(je){console.error("Error parsing command history:",je)}}catch(H){console.error("Error fetching slash commands:",H),Ve([])}})()},[t]);const Kn=p.useMemo(()=>V.length?new Or(V,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[V]);p.useEffect(()=>{if(!Ae){ae(V);return}if(!Kn){ae([]);return}const w=Kn.search(Ae);ae(w.map(H=>H.item))},[Ae,V,Kn]);const Ol=p.useMemo(()=>{if(!t||V.length===0)return[];const w=`command_history_${t.name}`,H=Nt.getItem(w);if(!H)return[];try{const O=JSON.parse(H);return V.map(Q=>({...Q,usageCount:O[Q.name]||0})).filter(Q=>Q.usageCount>0).sort((Q,ve)=>ve.usageCount-Q.usageCount).slice(0,5)}catch(O){return console.error("Error parsing command history:",O),[]}},[t,V]),Bl=p.useCallback((w,H,O)=>{if(!w||!t)return;if(O){Gt(H);return}const $=`command_history_${t.name}`,Q=Nt.getItem($);let ve={};try{ve=Q?JSON.parse(Q):{}}catch(je){console.error("Error parsing command history:",je)}ve[w.name]=(ve[w.name]||0)+1,Nt.setItem($,JSON.stringify(ve)),Na(w)},[t]),Ul=p.useCallback(w=>{const{action:H,data:O}=w;switch(H){case"clear":L([]),ie([]);break;case"help":L($=>[...$,{role:"assistant",content:O.content,timestamp:Date.now()}]);break;case"model":L($=>[...$,{role:"assistant",content:`**Current Model**: ${O.current.model}
|
|
451
|
+
|
|
452
|
+
**Available Models**:
|
|
453
|
+
|
|
454
|
+
Claude: ${O.available.claude.join(", ")}
|
|
455
|
+
|
|
456
|
+
Cursor: ${O.available.cursor.join(", ")}`,timestamp:Date.now()}]);break;case"cost":{const $=`**Token Usage**: ${O.tokenUsage.used.toLocaleString()} / ${O.tokenUsage.total.toLocaleString()} (${O.tokenUsage.percentage}%)
|
|
457
|
+
|
|
458
|
+
**Estimated Cost**:
|
|
459
|
+
- Input: $${O.cost.input}
|
|
460
|
+
- Output: $${O.cost.output}
|
|
461
|
+
- **Total**: $${O.cost.total}
|
|
462
|
+
|
|
463
|
+
**Model**: ${O.model}`;L(Q=>[...Q,{role:"assistant",content:$,timestamp:Date.now()}]);break}case"status":{const $=`**System Status**
|
|
464
|
+
|
|
465
|
+
- Version: ${O.version}
|
|
466
|
+
- Uptime: ${O.uptime}
|
|
467
|
+
- Model: ${O.model}
|
|
468
|
+
- Provider: ${O.provider}
|
|
469
|
+
- Node.js: ${O.nodeVersion}
|
|
470
|
+
- Platform: ${O.platform}`;L(Q=>[...Q,{role:"assistant",content:$,timestamp:Date.now()}]);break}case"memory":O.error?L($=>[...$,{role:"assistant",content:`β οΈ ${O.message}`,timestamp:Date.now()}]):(L($=>[...$,{role:"assistant",content:`π ${O.message}
|
|
471
|
+
|
|
472
|
+
Path: \`${O.path}\``,timestamp:Date.now()}]),O.exists&&i&&i(O.path));break;case"config":y&&y();break;case"rewind":O.error?L($=>[...$,{role:"assistant",content:`β οΈ ${O.message}`,timestamp:Date.now()}]):(L($=>$.slice(0,-O.steps*2)),L($=>[...$,{role:"assistant",content:`βͺ ${O.message}`,timestamp:Date.now()}]));break;default:console.warn("Unknown built-in command action:",H)}},[i,y]),Yn=p.useRef(null),Wl=p.useCallback(async(w,H)=>{const{content:O,hasBashCommands:$,hasFileIncludes:Q}=w;if($&&!window.confirm("This command contains bash commands that will be executed. Do you want to proceed?")){L(je=>[...je,{role:"assistant",content:"β Command execution cancelled",timestamp:Date.now()}]);return}_(O),setTimeout(()=>{if(Yn.current){const ve={preventDefault:()=>{}};Yn.current(ve)}},50)},[]),Na=p.useCallback(async w=>{if(!(!w||!t))try{const H=M.match(new RegExp(`${w.name}\\s*(.*)`)),O=H&&H[1]?H[1].trim().split(/\s+/):[],$={projectPath:t.path,projectName:t.name,sessionId:b,provider:pt,model:pt==="cursor"?Nr:"claude-sonnet-4.5",tokenUsage:tt},Q=await Re("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandName:w.name,commandPath:w.path,args:O,context:$})});if(!Q.ok)throw new Error("Failed to execute command");const ve=await Q.json();ve.type==="builtin"?Ul(ve):ve.type==="custom"&&await Wl(ve,O),_(""),we(!1),tr(-1),We(""),Gt(-1)}catch(H){console.error("Error executing command:",H),L(O=>[...O,{role:"assistant",content:`Error executing command: ${H.message}`,timestamp:Date.now()}])}},[M,t,b,pt,Nr,tt]),ql=p.useMemo(()=>{const w=new Map;return(H,O)=>{const $=`${H.length}-${O.length}-${H.slice(0,50)}`;if(w.has($))return w.get($);const Q=Vl(H,O);if(w.set($,Q),w.size>100){const ve=w.keys().next().value;w.delete(ve)}return Q}},[]),Wr=p.useCallback(async(w,H,O=!1)=>{if(!w||!H)return[];const $=!O;$?Ie(!0):f(!0);try{const Q=O?te:0,ve=await Je.sessionMessages(w,H,oe,Q);if(!ve.ok)throw new Error("Failed to load session messages");const je=await ve.json();if(je.hasMore!==void 0)return Ce(je.hasMore),ee(je.total),ue(Q+(je.messages?.length||0)),je.messages||[];{const Ke=je.messages||[];return Ce(!1),ee(Ke.length),Ke}}catch(Q){return console.error("Error loading session messages:",Q),[]}finally{$?Ie(!1):f(!1)}},[te]),hn=p.useCallback(async(w,H)=>{if(!w||!H)return[];Ie(!0);try{const O=`/api/cursor/sessions/${encodeURIComponent(H)}?projectPath=${encodeURIComponent(w)}`,$=await Re(O);if(!$.ok)return[];const ve=(await $.json())?.session?.messages||[],je=[],Ke={};for(let Ee=0;Ee<ve.length;Ee++){const Y=ve[Ee],he=Y.content;let ze="",Xe="assistant",Qe=null;try{if(he?.role&&he?.content){if(he.role==="system")continue;if(he.role==="tool"){if(Array.isArray(he.content)){for(const $e of he.content)if($e?.type==="tool-result"){let He=$e.toolName||"Unknown Tool";He==="ApplyPatch"&&(He="Edit");const zt=$e.toolCallId||he.id,rr=$e.result||"";Ke[zt]?Ke[zt].toolResult={content:rr,isError:!1}:je.push({type:"assistant",content:"",timestamp:new Date(Date.now()+Ee*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:He,toolId:zt,toolInput:null,toolResult:{content:rr,isError:!1}})}}continue}else if(Xe=he.role==="user"?"user":"assistant",Array.isArray(he.content)){const $e=[];for(const He of he.content)if(He?.type==="text"&&He?.text)$e.push(ir(He.text));else if(He?.type==="reasoning"&&He?.text)Qe=ir(He.text);else if(He?.type==="tool-call"){($e.length>0||Qe)&&(je.push({type:Xe,content:$e.join(`
|
|
473
|
+
`),reasoning:Qe,timestamp:new Date(Date.now()+Ee*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),$e.length=0,Qe=null);let zt=He.toolName||"Unknown Tool";zt==="ApplyPatch"&&(zt="Edit");const rr=He.toolCallId||`tool_${Ee}`;let Yt=He.args;if(zt==="Edit"&&He.args)if(He.args.patch){const Ot=He.args.patch.split(`
|
|
474
|
+
`);let qr=[],Zn=[],Ma=!1;for(const nr of Ot)nr.startsWith("@@")?Ma=!0:Ma&&(nr.startsWith("-")?qr.push(nr.substring(1)):nr.startsWith("+")?Zn.push(nr.substring(1)):nr.startsWith(" ")&&(qr.push(nr.substring(1)),Zn.push(nr.substring(1))));const fn=He.args.file_path;Yt={file_path:fn&&!fn.startsWith("/")?`${w}/${fn}`:fn,old_string:qr.join(`
|
|
475
|
+
`)||He.args.patch,new_string:Zn.join(`
|
|
476
|
+
`)||He.args.patch}}else Yt=He.args;else if(zt==="Read"&&He.args){const Ot=He.args.path||He.args.file_path;Yt={file_path:Ot&&!Ot.startsWith("/")?`${w}/${Ot}`:Ot}}else if(zt==="Write"&&He.args){const Ot=He.args.path||He.args.file_path;Yt={file_path:Ot&&!Ot.startsWith("/")?`${w}/${Ot}`:Ot,content:He.args.contents||He.args.content}}const Aa={type:"assistant",content:"",timestamp:new Date(Date.now()+Ee*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:zt,toolId:rr,toolInput:Yt?JSON.stringify(Yt):null,toolResult:null};je.push(Aa),Ke[rr]=Aa}else if(He?.type==="tool_use"){($e.length>0||Qe)&&(je.push({type:Xe,content:$e.join(`
|
|
477
|
+
`),reasoning:Qe,timestamp:new Date(Date.now()+Ee*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),$e.length=0,Qe=null);const zt=He.name||"Unknown Tool",rr=He.id||`tool_${Ee}`,Yt={type:"assistant",content:"",timestamp:new Date(Date.now()+Ee*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:zt,toolId:rr,toolInput:He.input?JSON.stringify(He.input):null,toolResult:null};je.push(Yt),Ke[rr]=Yt}else typeof He=="string"&&$e.push(He);$e.length>0?(ze=$e.join(`
|
|
478
|
+
`),Qe&&!ze&&(je.push({type:Xe,content:"",reasoning:Qe,timestamp:new Date(Date.now()+Ee*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),ze="")):ze=""}else typeof he.content=="string"&&(ze=he.content)}else if(he?.message?.role&&he?.message?.content){if(he.message.role==="system")continue;Xe=he.message.role==="user"?"user":"assistant",Array.isArray(he.message.content)?ze=he.message.content.map($e=>typeof $e=="string"?$e:$e?.text||"").filter(Boolean).join(`
|
|
479
|
+
`):typeof he.message.content=="string"&&(ze=he.message.content)}}catch($e){console.log("Error parsing blob content:",$e)}if(ze&&ze.trim()){const $e={type:Xe,content:ze,timestamp:new Date(Date.now()+Ee*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid};Qe&&($e.reasoning=Qe),je.push($e)}}return je.sort((Ee,Y)=>Ee.sequence!==void 0&&Y.sequence!==void 0?Ee.sequence-Y.sequence:Ee.rowid!==void 0&&Y.rowid!==void 0?Ee.rowid-Y.rowid:new Date(Ee.timestamp)-new Date(Y.timestamp)),je}catch(O){return console.error("Error loading Cursor session messages:",O),[]}finally{Ie(!1)}},[]),Vl=(w,H)=>{const O=w.split(`
|
|
480
|
+
`),$=H.split(`
|
|
481
|
+
`),Q=[];let ve=0,je=0;for(;ve<O.length||je<$.length;){const Ke=O[ve],Ee=$[je];ve>=O.length?(Q.push({type:"added",content:Ee,lineNum:je+1}),je++):je>=$.length?(Q.push({type:"removed",content:Ke,lineNum:ve+1}),ve++):Ke===Ee?(ve++,je++):(Q.push({type:"removed",content:Ke,lineNum:ve+1}),Q.push({type:"added",content:Ee,lineNum:je+1}),ve++,je++)}return Q},Hl=w=>{const H=[],O=new Map;for(const $ of w)if($.message?.role==="user"&&Array.isArray($.message?.content))for(const Q of $.message.content)Q.type==="tool_result"&&O.set(Q.tool_use_id,{content:Q.content,isError:Q.is_error,timestamp:new Date($.timestamp||Date.now())});for(const $ of w)if($.message?.role==="user"&&$.message?.content){let Q="",ve="user";if(Array.isArray($.message.content)){const Ke=[];for(const Ee of $.message.content)Ee.type==="text"&&Ke.push(ir(Ee.text));Q=Ke.join(`
|
|
482
|
+
`)}else typeof $.message.content=="string"?Q=ir($.message.content):Q=ir(String($.message.content));!Q||Q.startsWith("<command-name>")||Q.startsWith("<command-message>")||Q.startsWith("<command-args>")||Q.startsWith("<local-command-stdout>")||Q.startsWith("<system-reminder>")||Q.startsWith("Caveat:")||Q.startsWith("This session is being continued from a previous")||Q.startsWith("[Request interrupted")||(Q=Q.replace(/\\n/g,`
|
|
483
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r"),H.push({type:ve,content:Q,timestamp:$.timestamp||new Date().toISOString()}))}else if($.message?.role==="assistant"&&$.message?.content){if(Array.isArray($.message.content)){for(const Q of $.message.content)if(Q.type==="text"){let ve=Q.text;typeof ve=="string"&&(ve=ve.replace(/\\n/g,`
|
|
484
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r")),H.push({type:"assistant",content:ve,timestamp:$.timestamp||new Date().toISOString()})}else if(Q.type==="tool_use"){const ve=O.get(Q.id);H.push({type:"assistant",content:"",timestamp:$.timestamp||new Date().toISOString(),isToolUse:!0,toolName:Q.name,toolInput:JSON.stringify(Q.input),toolResult:ve?typeof ve.content=="string"?ve.content:JSON.stringify(ve.content):null,toolError:ve?.isError||!1,toolResultTimestamp:ve?.timestamp||new Date})}}else if(typeof $.message.content=="string"){let Q=$.message.content;Q=Q.replace(/\\n/g,`
|
|
485
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r"),H.push({type:"assistant",content:Q,timestamp:$.timestamp||new Date().toISOString()})}}return H},Sa=p.useMemo(()=>Hl(G),[G]),Kt=p.useCallback(()=>{X.current&&(X.current.scrollTop=X.current.scrollHeight,g(!1))},[]),xn=p.useCallback(()=>{if(!X.current)return!1;const{scrollTop:w,scrollHeight:H,clientHeight:O}=X.current;return H-w-O<50},[]),Qn=p.useCallback(async()=>{if(X.current){const w=X.current,H=xn();g(!H);const O=w.scrollTop<100,$=localStorage.getItem("selected-provider")||"claude";if(O&&re&&!Fe&&r&&t&&$!=="cursor"){const Q=w.scrollHeight,ve=w.scrollTop,je=await Wr(t.name,r.id,!0);je.length>0&&(ie(Ke=>[...je,...Ke]),setTimeout(()=>{if(X.current){const Ee=X.current.scrollHeight-Q;X.current.scrollTop=ve+Ee}},0))}}},[xn,re,Fe,r,t,Wr]);p.useEffect(()=>{(async()=>{if(r&&t){const H=localStorage.getItem("selected-provider")||"claude";if(ke.current=!0,b!==null&&b!==r.id?(ue(0),Ce(!1),ee(0),Br(null),I(!1),n&&s&&s({type:"check-session-status",sessionId:r.id,provider:H})):b===null&&(ue(0),Ce(!1),ee(0),n&&s&&s({type:"check-session-status",sessionId:r.id,provider:H})),H==="cursor")if(z(r.id),sessionStorage.setItem("cursorSessionId",r.id),xe)Ne(!1);else{const $=t.fullPath||t.path,Q=await hn($,r.id);ie([]),L(Q)}else if(z(r.id),xe)Ne(!1);else{const $=await Wr(t.name,r.id,!1);ie($)}}else!xe&&!C&&(L([]),ie([])),z(null),sessionStorage.removeItem("cursorSessionId"),ue(0),Ce(!1),ee(0);setTimeout(()=>{ke.current=!1},250)})()},[r,t,hn,Kt,xe]),p.useEffect(()=>{W>0&&r&&t&&(console.log("π Reloading messages due to external CLI update"),(async()=>{try{if((localStorage.getItem("selected-provider")||"claude")==="cursor"){const O=t.fullPath||t.path,$=await hn(O,r.id);ie([]),L($)}else{const O=await Wr(t.name,r.id,!1);ie(O),xn&&T&&setTimeout(()=>Kt(),200)}}catch(H){console.error("Error reloading messages from external update:",H)}})())},[W,r,t,hn,Wr,xn,T,Kt]),p.useEffect(()=>{G.length>0&&L(Sa)},[Sa,G]),p.useEffect(()=>{o&&o(K)},[K,o]),p.useEffect(()=>{t&&M!==""?Nt.setItem(`draft_input_${t.name}`,M):t&&M===""&&Nt.removeItem(`draft_input_${t.name}`)},[M,t]),p.useEffect(()=>{t&&R.length>0&&Nt.setItem(`chat_messages_${t.name}`,JSON.stringify(R))},[R,t]),p.useEffect(()=>{if(t){const w=Nt.getItem(`draft_input_${t.name}`)||"";w!==M&&_(w)}},[t?.name]),p.useEffect(()=>{b&&C&&c&&c(b)},[C,b,c]),p.useEffect(()=>{b&&h&&h.has(b)&&!C&&(I(!0),ft(!0))},[b,h]),p.useEffect(()=>{if(a.length>0){const w=a[a.length-1];if(console.log("π΅ WebSocket message received:",w.type,w),!["projects_updated","taskmaster-project-updated","session-created","claude-complete"].includes(w.type)&&w.sessionId&&b&&w.sessionId!==b){console.log("βοΈ Skipping message for different session:",w.sessionId,"current:",b);return}switch(w.type){case"session-created":w.sessionId&&!b&&(sessionStorage.setItem("pendingSessionId",w.sessionId),x&&x(w.sessionId));break;case"token-budget":break;case"claude-response":const $=w.data.message||w.data;if($&&typeof $=="object"&&$.type){if($.type==="content_block_delta"&&$.delta?.text){const Y=ir($.delta.text);k.current+=Y,P.current||(P.current=setTimeout(()=>{const he=k.current;k.current="",P.current=null,he&&L(ze=>{const Xe=[...ze],Qe=Xe[Xe.length-1];return Qe&&Qe.type==="assistant"&&!Qe.isToolUse&&Qe.isStreaming?Qe.content=(Qe.content||"")+he:Xe.push({type:"assistant",content:he,timestamp:new Date,isStreaming:!0}),Xe})},100));return}if($.type==="content_block_stop"){P.current&&(clearTimeout(P.current),P.current=null);const Y=k.current;k.current="",Y&&L(he=>{const ze=[...he],Xe=ze[ze.length-1];return Xe&&Xe.type==="assistant"&&!Xe.isToolUse&&Xe.isStreaming?Xe.content=(Xe.content||"")+Y:ze.push({type:"assistant",content:Y,timestamp:new Date,isStreaming:!0}),ze}),L(he=>{const ze=[...he],Xe=ze[ze.length-1];return Xe&&Xe.type==="assistant"&&Xe.isStreaming&&(Xe.isStreaming=!1),ze});return}}if(w.data.type==="system"&&w.data.subtype==="init"&&w.data.session_id&&b&&w.data.session_id!==b){console.log("π Claude CLI session duplication detected:",{originalSession:b,newSession:w.data.session_id}),Ne(!0),m&&m(w.data.session_id);return}if(w.data.type==="system"&&w.data.subtype==="init"&&w.data.session_id&&!b){console.log("π New session init detected:",{newSession:w.data.session_id}),Ne(!0),m&&m(w.data.session_id);return}if(w.data.type==="system"&&w.data.subtype==="init"&&w.data.session_id&&b&&w.data.session_id===b){console.log("π System init message for current session, ignoring");return}if(Array.isArray($.content)){for(const Y of $.content)if(Y.type==="tool_use"){const he=Y.input?JSON.stringify(Y.input,null,2):"";L(ze=>[...ze,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:Y.name,toolInput:he,toolId:Y.id,toolResult:null}])}else if(Y.type==="text"&&Y.text?.trim()){let he=ir(Y.text);he=Xs(he),L(ze=>[...ze,{type:"assistant",content:he,timestamp:new Date}])}}else if(typeof $.content=="string"&&$.content.trim()){let Y=ir($.content);Y=Xs(Y),L(he=>[...he,{type:"assistant",content:Y,timestamp:new Date}])}if($.role==="user"&&Array.isArray($.content))for(const Y of $.content)Y.type==="tool_result"&&L(he=>he.map(ze=>ze.isToolUse&&ze.toolId===Y.tool_use_id?{...ze,toolResult:{content:Y.content,isError:Y.is_error,timestamp:new Date}}:ze));break;case"claude-output":{const Y=String(w.data||"");Y.trim()&&(k.current+=k.current?`
|
|
486
|
+
${Y}`:Y,P.current||(P.current=setTimeout(()=>{const he=k.current;k.current="",P.current=null,he&&L(ze=>{const Xe=[...ze],Qe=Xe[Xe.length-1];return Qe&&Qe.type==="assistant"&&!Qe.isToolUse&&Qe.isStreaming?Qe.content=Qe.content?`${Qe.content}
|
|
487
|
+
${he}`:he:Xe.push({type:"assistant",content:he,timestamp:new Date,isStreaming:!0}),Xe})},100)))}break;case"claude-interactive-prompt":L(Y=>[...Y,{type:"assistant",content:w.data,timestamp:new Date,isInteractivePrompt:!0}]);break;case"claude-error":L(Y=>[...Y,{type:"error",content:`Error: ${w.error}`,timestamp:new Date}]);break;case"cursor-system":try{const Y=w.data;if(Y&&Y.type==="system"&&Y.subtype==="init"&&Y.session_id){if(b&&Y.session_id!==b){console.log("π Cursor session switch detected:",{originalSession:b,newSession:Y.session_id}),Ne(!0),m&&m(Y.session_id);return}if(!b){console.log("π Cursor new session init detected:",{newSession:Y.session_id}),Ne(!0),m&&m(Y.session_id);return}}}catch(Y){console.warn("Error handling cursor-system message:",Y)}break;case"cursor-user":break;case"cursor-tool-use":L(Y=>[...Y,{type:"assistant",content:`Using tool: ${w.tool} ${w.input?`with ${w.input}`:""}`,timestamp:new Date,isToolUse:!0,toolName:w.tool,toolInput:w.input}]);break;case"cursor-error":L(Y=>[...Y,{type:"error",content:`Cursor error: ${w.error||"Unknown error"}`,timestamp:new Date}]);break;case"cursor-result":const Q=w.sessionId||b;if(Q===b&&(I(!1),ft(!1),jr(null)),Q&&(d&&d(Q),u&&u(Q)),Q===b)try{const Y=w.data||{},he=typeof Y.result=="string"?Y.result:"";P.current&&(clearTimeout(P.current),P.current=null);const ze=k.current;k.current="",L(Xe=>{const Qe=[...Xe],$e=Qe[Qe.length-1];if($e&&$e.type==="assistant"&&!$e.isToolUse&&$e.isStreaming){const He=he&&he.trim()?he:($e.content||"")+(ze||"");$e.content=He,$e.isStreaming=!1}else he&&he.trim()&&Qe.push({type:Y.is_error?"error":"assistant",content:he,timestamp:new Date,isStreaming:!1});return Qe})}catch(Y){console.warn("Error handling cursor-result message:",Y)}const ve=sessionStorage.getItem("pendingSessionId");Q&&!b&&Q===ve&&(z(Q),sessionStorage.removeItem("pendingSessionId"),window.refreshProjects&&setTimeout(()=>window.refreshProjects(),500));break;case"cursor-output":try{const he=String(w.data??"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"").trim();he&&(k.current+=k.current?`
|
|
488
|
+
${he}`:he,P.current||(P.current=setTimeout(()=>{const ze=k.current;k.current="",P.current=null,ze&&L(Xe=>{const Qe=[...Xe],$e=Qe[Qe.length-1];return $e&&$e.type==="assistant"&&!$e.isToolUse&&$e.isStreaming?$e.content=$e.content?`${$e.content}
|
|
489
|
+
${ze}`:ze:Qe.push({type:"assistant",content:ze,timestamp:new Date,isStreaming:!0}),Qe})},100)))}catch(Y){console.warn("Error handling cursor-output message:",Y)}break;case"claude-complete":const je=w.sessionId||b||sessionStorage.getItem("pendingSessionId");console.log("π― claude-complete received:",{completedSessionId:je,currentSessionId:b,match:je===b,isNew:!b}),(je===b||!b)&&(console.log("β
Stopping loading state"),I(!1),ft(!1),jr(null),t&&r?.id&&(async()=>{try{const he=`/api/projects/${t.name}/sessions/${r.id}/token-usage`,ze=await Re(he);if(ze.ok){const Xe=await ze.json();Br(Xe)}}catch(he){console.error("Failed to fetch updated token usage:",he)}})()),je&&(d&&d(je),u&&u(je));const Ke=sessionStorage.getItem("pendingSessionId");Ke&&!b&&w.exitCode===0&&(z(Ke),sessionStorage.removeItem("pendingSessionId"),console.log("β
New session complete, ID set to:",Ke)),t&&w.exitCode===0&&Nt.removeItem(`chat_messages_${t.name}`);break;case"session-aborted":{const Y=w.sessionId||b;Y===b&&(I(!1),ft(!1),jr(null)),Y&&(d&&d(Y),u&&u(Y)),L(he=>[...he,{type:"assistant",content:"Session interrupted by user.",timestamp:new Date}]);break}case"session-status":{const Y=w.sessionId;(Y===b||r&&Y===r.id)&&w.isProcessing&&(I(!0),ft(!0),c&&c(Y));break}case"claude-status":const Ee=w.data;if(Ee){let Y={text:"Working...",tokens:0,can_interrupt:!0};Ee.message?Y.text=Ee.message:Ee.status?Y.text=Ee.status:typeof Ee=="string"&&(Y.text=Ee),Ee.tokens?Y.tokens=Ee.tokens:Ee.token_count&&(Y.tokens=Ee.token_count),Ee.can_interrupt!==void 0&&(Y.can_interrupt=Ee.can_interrupt),jr(Y),I(!0),ft(Y.can_interrupt)}break}}},[a]),p.useEffect(()=>{t&&Jl()},[t]);const Jl=async()=>{try{const w=await Je.getFiles(t.name);if(w.ok){const H=await w.json(),O=Ca(H);mt(O)}}catch(w){console.error("Error fetching files:",w)}},Ca=(w,H="")=>{let O=[];for(const $ of w){const Q=H?`${H}/${$.name}`:$.name;$.type==="directory"&&$.children?O=O.concat(Ca($.children,Q)):$.type==="file"&&O.push({name:$.name,path:Q,relativePath:$.path})}return O};p.useEffect(()=>{const w=M.slice(0,Lt),H=w.lastIndexOf("@");if(H!==-1){const O=w.slice(H+1);if(O.includes(" "))De(!1),yt(-1);else{yt(H),De(!0);const $=Ge.filter(Q=>Q.name.toLowerCase().includes(O.toLowerCase())||Q.path.toLowerCase().includes(O.toLowerCase())).slice(0,10);st($),ct(-1)}}else De(!1),yt(-1)},[M,Lt,Ge]),p.useEffect(()=>{const w=setTimeout(()=>{le(M)},150);return()=>clearTimeout(w)},[M]);const Ea=p.useMemo(()=>R.length<=Ur?R:R.slice(-Ur),[R,Ur]);p.useEffect(()=>{if(!T&&X.current){const w=X.current;U.current={height:w.scrollHeight,top:w.scrollTop}}}),p.useEffect(()=>{if(X.current&&R.length>0)if(T)F||setTimeout(()=>Kt(),50);else{const w=X.current,H=U.current.height,O=U.current.top,Q=w.scrollHeight-H;Q>0&&O>0&&(w.scrollTop=O+Q)}},[R.length,F,Kt,T]),p.useEffect(()=>{X.current&&R.length>0&&!ke.current&&(g(!1),setTimeout(()=>Kt(),200))},[r?.id,t?.name]),p.useEffect(()=>{const w=X.current;if(w)return w.addEventListener("scroll",Qn),()=>w.removeEventListener("scroll",Qn)},[Qn]),p.useEffect(()=>{if(ge.current){ge.current.style.height="auto",ge.current.style.height=ge.current.scrollHeight+"px";const w=parseInt(window.getComputedStyle(ge.current).lineHeight),H=ge.current.scrollHeight>w*2;kt(H)}},[]),p.useEffect(()=>{ge.current&&!M.trim()&&(ge.current.style.height="auto",kt(!1))},[M]),p.useEffect(()=>{if(!t||!r?.id||r.id.startsWith("new-session-")){Br(null);return}(async()=>{try{const H=`/api/projects/${t.name}/sessions/${r.id}/token-usage`;console.log("π Fetching initial token usage from:",H);const O=await Re(H);if(O.ok){const $=await O.json();console.log("β
Initial token usage loaded:",$),Br($)}else console.log("β οΈ No token usage data available for this session yet"),Br(null)}catch(H){console.error("Failed to fetch initial token usage:",H)}})()},[r?.id,t?.path]);const Gl=p.useCallback(w=>{w.trim()&&_(H=>{const O=H.trim()?`${H} ${w}`:w;return setTimeout(()=>{if(ge.current){ge.current.style.height="auto",ge.current.style.height=ge.current.scrollHeight+"px";const $=parseInt(window.getComputedStyle(ge.current).lineHeight),Q=ge.current.scrollHeight>$*2;kt(Q)}},0),O})},[]),Kl=p.useCallback(()=>{Fl(w=>w+100)},[]),gn=p.useCallback(w=>{const H=w.filter(O=>{try{if(!O||typeof O!="object")return console.warn("Invalid file object:",O),!1;if(!O.type||!O.type.startsWith("image/"))return!1;if(!O.size||O.size>5242880){const $=O.name||"Unknown file";return et(Q=>{const ve=new Map(Q);return ve.set($,"File too large (max 5MB)"),ve}),!1}return!0}catch($){return console.error("Error validating file:",$,O),!1}});H.length>0&&nt(O=>[...O,...H].slice(0,5))},[]),Yl=p.useCallback(async w=>{const H=Array.from(w.clipboardData.items);for(const O of H)if(O.type.startsWith("image/")){const $=O.getAsFile();$&&gn([$])}if(H.length===0&&w.clipboardData.files.length>0){const $=Array.from(w.clipboardData.files).filter(Q=>Q.type.startsWith("image/"));$.length>0&&gn($)}},[gn]),{getRootProps:Ql,getInputProps:Xl,isDragActive:Zl,open:ec}=jl({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:gn,noClick:!0,noKeyboard:!0}),pr=p.useCallback(async w=>{if(w.preventDefault(),!M.trim()||C||!t)return;let H=[];if(Ye.length>0){const Ke=new FormData;Ye.forEach(Ee=>{Ke.append("images",Ee)});try{const Ee=Nt.getItem("auth-token"),Y={};Ee&&(Y.Authorization=`Bearer ${Ee}`);const he=await fetch(`/api/projects/${t.name}/upload-images`,{method:"POST",headers:Y,body:Ke});if(!he.ok)throw new Error("Failed to upload images");H=(await he.json()).images}catch(Ee){console.error("Image upload failed:",Ee),L(Y=>[...Y,{type:"error",content:`Failed to upload images: ${Ee.message}`,timestamp:new Date}]);return}}const O={type:"user",content:M,images:H,timestamp:new Date};L(Ke=>[...Ke,O]),I(!0),ft(!0),jr({text:"Processing",tokens:0,can_interrupt:!0}),g(!1),setTimeout(()=>Kt(),100);const $=b||r?.id||sessionStorage.getItem("cursorSessionId"),Q=$||`new-session-${Date.now()}`;l&&l(Q);const je=(()=>{try{const Ke=pt==="cursor"?"cursor-tools-settings":"claude-settings",Ee=Nt.getItem(Ke);if(Ee)return JSON.parse(Ee)}catch(Ke){console.error("Error loading tools settings:",Ke)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();s(pt==="cursor"?{type:"cursor-command",command:M,sessionId:$,options:{cwd:t.fullPath||t.path,projectPath:t.fullPath||t.path,sessionId:$,resume:!!$,model:Nr,skipPermissions:je?.skipPermissions||!1,toolsSettings:je}}:{type:"claude-command",command:M,options:{projectPath:t.path,cwd:t.fullPath,sessionId:b,resume:!!b,toolsSettings:je,permissionMode:ye,images:H}}),_(""),nt([]),pe(new Map),et(new Map),kt(!1),ge.current&&(ge.current.style.height="auto"),t&&Nt.removeItem(`draft_input_${t.name}`)},[M,C,t,Ye,b,r,pt,ye,l,Nr,s,_,nt,pe,et,kt,ge,L,I,ft,jr,g,Kt]);p.useEffect(()=>{Yn.current=pr},[pr]);const Ia=w=>{if(!w)return;const H=M.slice(0,wa),O=M.slice(wa),$=O.indexOf(" "),Q=$!==-1?O.slice($):"",ve=H+w.name+" "+Q;_(ve),we(!1),tr(-1),We(""),Gt(-1),J.current&&clearTimeout(J.current),Na(w)},tc=w=>{if(ce&&S.length>0){if(w.key==="ArrowDown"){w.preventDefault(),Gt(H=>H<S.length-1?H+1:0);return}if(w.key==="ArrowUp"){w.preventDefault(),Gt(H=>H>0?H-1:S.length-1);return}if(w.key==="Tab"||w.key==="Enter"){w.preventDefault(),Jn>=0?Ia(S[Jn]):S.length>0&&Ia(S[0]);return}if(w.key==="Escape"){w.preventDefault(),we(!1),tr(-1),We(""),Gt(-1),J.current&&clearTimeout(J.current);return}}if(Le&&Ze.length>0){if(w.key==="ArrowDown"){w.preventDefault(),ct(H=>H<Ze.length-1?H+1:0);return}if(w.key==="ArrowUp"){w.preventDefault(),ct(H=>H>0?H-1:Ze.length-1);return}if(w.key==="Tab"||w.key==="Enter"){w.preventDefault(),ht>=0?Xn(Ze[ht]):Ze.length>0&&Xn(Ze[0]);return}if(w.key==="Escape"){w.preventDefault(),De(!1);return}}if(w.key==="Tab"&&!Le&&!ce){w.preventDefault();const H=["default","acceptEdits","bypassPermissions","plan"],$=(H.indexOf(ye)+1)%H.length,Q=H[$];Ue(Q),r?.id&&localStorage.setItem(`permissionMode-${r.id}`,Q);return}if(w.key==="Enter"){if(w.nativeEvent.isComposing)return;(w.ctrlKey||w.metaKey)&&!w.shiftKey?(w.preventDefault(),pr(w)):!w.shiftKey&&!w.ctrlKey&&!w.metaKey&&(j||(w.preventDefault(),pr(w)))}},Xn=w=>{const H=M.slice(0,jt),O=M.slice(jt),$=O.indexOf(" "),Q=$!==-1?O.slice($):"",ve=H+"@"+w.path+" "+Q,je=H.length+1+w.path.length+1;ge.current&&!ge.current.matches(":focus")&&ge.current.focus(),_(ve),Rt(je),De(!1),yt(-1),ge.current&&requestAnimationFrame(()=>{ge.current&&(ge.current.setSelectionRange(je,je),ge.current.matches(":focus")||ge.current.focus())})},rc=w=>{const H=w.target.value,O=w.target.selectionStart;if(!b&&H.trim(),_(H),Rt(O),!H.trim()){w.target.style.height="auto",kt(!1),we(!1),tr(-1),We("");return}const $=H.slice(0,O);if(($.match(/```/g)||[]).length%2===1){we(!1),tr(-1),We("");return}const je=/(^|\s)\/(\S*)$/,Ke=$.match(je);if(Ke){const Ee=Ke.index+Ke[1].length,Y=Ke[2];tr(Ee),we(!0),Gt(-1),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{We(Y)},150)}else we(!1),tr(-1),We(""),J.current&&clearTimeout(J.current)},nc=w=>{Rt(w.target.selectionStart)},sc=()=>{b&&mr&&s({type:"abort-session",sessionId:b,provider:pt})},ac=()=>{const w=["default","acceptEdits","bypassPermissions","plan"],O=(w.indexOf(ye)+1)%w.length,$=w[O];Ue($),r?.id&&localStorage.setItem(`permissionMode-${r.id}`,$)};return t?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
|
|
490
|
+
details[open] .details-chevron {
|
|
491
|
+
transform: rotate(180deg);
|
|
492
|
+
}
|
|
493
|
+
`}),e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{ref:X,className:"flex-1 overflow-y-auto overflow-x-hidden px-0 py-3 sm:p-4 space-y-3 sm:space-y-4 relative",children:[N&&R.length===0?e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),e.jsx("p",{children:"Loading session messages..."})]})}):R.length===0?e.jsxs("div",{className:"flex items-center justify-center h-full",children:[!r&&!b&&e.jsxs("div",{className:"text-center px-6 sm:px-4 py-8",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:"Choose Your AI Assistant"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-8",children:"Select a provider to start a new conversation"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-8",children:[e.jsxs("button",{onClick:()=>{Gn("claude"),localStorage.setItem("selected-provider","claude"),setTimeout(()=>ge.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${pt==="claude"?"border-blue-500 shadow-lg ring-2 ring-blue-500/20":"border-gray-200 dark:border-gray-700 hover:border-blue-400"}`,children:[e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx(Vt,{className:"w-10 h-10"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Claude"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"by Anthropic"})]})]}),pt==="claude"&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx("div",{className:"w-5 h-5 bg-blue-500 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),e.jsxs("button",{onClick:()=>{Gn("cursor"),localStorage.setItem("selected-provider","cursor"),setTimeout(()=>ge.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${pt==="cursor"?"border-purple-500 shadow-lg ring-2 ring-purple-500/20":"border-gray-200 dark:border-gray-700 hover:border-purple-400"}`,children:[e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx(Zt,{className:"w-10 h-10"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Cursor"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"AI Code Editor"})]})]}),pt==="cursor"&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx("div",{className:"w-5 h-5 bg-purple-500 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]})]}),e.jsxs("div",{className:`mb-6 transition-opacity duration-200 ${pt==="cursor"?"opacity-100":"opacity-0 pointer-events-none"}`,children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:pt==="cursor"?"Select Model":"Β "}),e.jsxs("select",{value:Nr,onChange:w=>{const H=w.target.value;ja(H),localStorage.setItem("cursor-model",H)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",disabled:pt!=="cursor",children:[e.jsx("option",{value:"gpt-5",children:"GPT-5"}),e.jsx("option",{value:"sonnet-4",children:"Sonnet-4"}),e.jsx("option",{value:"opus-4.1",children:"Opus 4.1"})]})]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:pt==="claude"?"Ready to use Claude AI. Start typing your message below.":pt==="cursor"?`Ready to use Cursor with ${Nr}. Start typing your message below.`:"Select a provider above to begin"}),pt&&q&&e.jsx("div",{className:"mt-4 px-4 sm:px-0",children:e.jsx(Hi,{onStartTask:()=>_("Start the next task"),onShowAllTasks:D})})]}),r&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 px-6 sm:px-4",children:[e.jsx("p",{className:"font-bold text-lg sm:text-xl mb-3",children:"Continue your conversation"}),e.jsx("p",{className:"text-sm sm:text-base leading-relaxed",children:"Ask questions about your code, request changes, or get help with development tasks"}),q&&e.jsx("div",{className:"mt-4 px-4 sm:px-0",children:e.jsx(Hi,{onStartTask:()=>_("Start the next task"),onShowAllTasks:D})})]})]}):e.jsxs(e.Fragment,{children:[Fe&&e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-3",children:e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),e.jsx("p",{className:"text-sm",children:"Loading older messages..."})]})}),re&&!Fe&&e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:Be>0&&e.jsxs("span",{children:["Showing ",G.length," of ",Be," messages β’",e.jsx("span",{className:"text-xs",children:"Scroll up to load more"})]})}),!re&&R.length>Ur&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:["Showing last ",Ur," messages (",R.length," total) β’",e.jsx("button",{className:"ml-1 text-blue-600 hover:text-blue-700 underline",onClick:Kl,children:"Load earlier messages"})]}),Ea.map((w,H)=>{const O=H>0?Ea[H-1]:null;return e.jsx(yf,{message:w,index:H,prevMessage:O,createDiff:ql,onFileOpen:i,onShowSettings:y,autoExpandTools:v,showRawParameters:E,showThinking:A},H)})]}),C&&e.jsx("div",{className:"chat-message assistant",children:e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1 bg-transparent",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?e.jsx(Zt,{className:"w-full h-full"}):e.jsx(Vt,{className:"w-full h-full"})}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":"Claude"})]}),e.jsx("div",{className:"w-full text-sm text-gray-500 dark:text-gray-400 pl-3 sm:pl-0",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx("div",{className:"animate-pulse",children:"β"}),e.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"β"}),e.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"β"}),e.jsx("span",{className:"ml-2",children:"Thinking..."})]})})]})}),e.jsx("div",{ref:it})]}),e.jsxs("div",{className:"p-2 sm:p-4 md:p-4 flex-shrink-0 pb-2 sm:pb-4 md:pb-6",children:[e.jsx("div",{className:"flex-1",children:e.jsx(Ag,{status:$l,isLoading:C,onAbort:sc,provider:pt,showThinking:A})}),e.jsx("div",{ref:wt,className:"max-w-4xl mx-auto mb-3",children:e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsx("button",{type:"button",onClick:ac,className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 ${ye==="default"?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600":ye==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-300 dark:border-green-600 hover:bg-green-100 dark:hover:bg-green-900/30":ye==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 border-orange-300 dark:border-orange-600 hover:bg-orange-100 dark:hover:bg-orange-900/30":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-600 hover:bg-blue-100 dark:hover:bg-blue-900/30"}`,title:"Click to change permission mode (or press Tab in input)",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${ye==="default"?"bg-gray-500":ye==="acceptEdits"?"bg-green-500":ye==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),e.jsxs("span",{children:[ye==="default"&&"Default Mode",ye==="acceptEdits"&&"Accept Edits",ye==="bypassPermissions"&&"Bypass Permissions",ye==="plan"&&"Plan Mode"]})]})}),e.jsx(Mg,{used:tt?.used||0,total:tt?.total||parseInt(void 0)||16e4}),M.trim()&&e.jsx("button",{type:"button",onClick:w=>{w.preventDefault(),w.stopPropagation(),_(""),ge.current&&(ge.current.style.height="auto",ge.current.focus()),kt(!1)},className:"w-8 h-8 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-full flex items-center justify-center transition-all duration-200 group shadow-sm",title:"Clear input",children:e.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300 group-hover:text-gray-800 dark:group-hover:text-gray-100 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),F&&R.length>0&&e.jsx("button",{onClick:Kt,className:"w-8 h-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"Scroll to bottom",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})}),e.jsxs("form",{onSubmit:pr,className:"relative max-w-4xl mx-auto",children:[Zl&&e.jsx("div",{className:"absolute inset-0 bg-blue-500/20 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-lg",children:[e.jsx("svg",{className:"w-8 h-8 text-blue-500 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),e.jsx("p",{className:"text-sm font-medium",children:"Drop images here"})]})}),Ye.length>0&&e.jsx("div",{className:"mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-lg",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:Ye.map((w,H)=>e.jsx(kf,{file:w,onRemove:()=>{nt(O=>O.filter(($,Q)=>Q!==H))},uploadProgress:me.get(w.name),error:Me.get(w.name)},H))})}),Le&&Ze.length>0&&e.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg max-h-48 overflow-y-auto z-50 backdrop-blur-sm",children:Ze.map((w,H)=>e.jsxs("div",{className:`px-4 py-3 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 touch-manipulation ${H===ht?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onMouseDown:O=>{O.preventDefault(),O.stopPropagation()},onClick:O=>{O.preventDefault(),O.stopPropagation(),Xn(w)},children:[e.jsx("div",{className:"font-medium text-sm",children:w.name}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:w.path})]},w.path))}),e.jsx(bf,{commands:S,selectedIndex:Jn,onSelect:Bl,onClose:()=>{we(!1),tr(-1),We(""),Gt(-1)},position:{top:ge.current?Math.max(16,ge.current.getBoundingClientRect().top-316):0,left:ge.current?ge.current.getBoundingClientRect().left:16,bottom:ge.current?window.innerHeight-ge.current.getBoundingClientRect().top+8:90},isOpen:ce,frequentCommands:Ae?[]:Ol}),e.jsxs("div",{...Ql(),className:`relative bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 dark:focus-within:ring-blue-500 focus-within:border-blue-500 transition-all duration-200 overflow-hidden ${at?"chat-input-expanded":""}`,children:[e.jsx("input",{...Xl()}),e.jsx("textarea",{ref:ge,value:M,onChange:rc,onClick:nc,onKeyDown:tc,onPaste:Yl,onFocus:()=>B(!0),onBlur:()=>B(!1),onInput:w=>{w.target.style.height="auto",w.target.style.height=w.target.scrollHeight+"px",Rt(w.target.selectionStart);const H=parseInt(window.getComputedStyle(w.target).lineHeight),O=w.target.scrollHeight>H*2;kt(O)},placeholder:`Ask ${pt==="cursor"?"Cursor":"Claude"} to help with your code...`,disabled:C,className:"chat-input-placeholder block w-full pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 bg-transparent rounded-2xl focus:outline-none text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 disabled:opacity-50 resize-none min-h-[50px] sm:min-h-[80px] max-h-[40vh] sm:max-h-[300px] overflow-y-auto text-sm sm:text-base leading-[21px] sm:leading-6 transition-all duration-200",style:{height:"50px"}}),!M.trim()&&!K&&e.jsxs("div",{className:"absolute inset-0 pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 pointer-events-none text-gray-400 dark:text-gray-500 text-sm sm:text-base",style:{whiteSpace:"normal",wordWrap:"break-word"},children:["Type / for commands, @ for files, or ask ",pt==="cursor"?"Cursor":"Claude"," anything..."]}),e.jsx("button",{type:"button",onClick:ec,className:"absolute left-2 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Attach images",children:e.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsx("div",{className:"absolute right-16 sm:right-16 top-1/2 transform -translate-y-1/2",style:{display:"none"},children:e.jsx(Sl,{onTranscript:Gl,className:"w-10 h-10 sm:w-10 sm:h-10"})}),e.jsxs("button",{type:"button",onClick:()=>{const w=!ce;we(w),We(""),Gt(-1),w&&ae(V),ge.current&&ge.current.focus()},className:"absolute right-14 sm:right-36 top-1/2 transform -translate-y-1/2 w-10 h-10 sm:w-10 sm:h-10 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800 relative z-10",title:"Show all commands",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),V.length>0&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-blue-600 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",style:{fontSize:"10px"},children:V.length})]}),e.jsx("button",{type:"submit",disabled:!M.trim()||C,onMouseDown:w=>{w.preventDefault(),pr(w)},onTouchStart:w=>{w.preventDefault(),pr(w)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 w-12 h-12 sm:w-12 sm:h-12 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",children:e.jsx("svg",{className:"w-4 h-4 sm:w-5 sm:h-5 text-white transform rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 text-center mt-2 hidden sm:block",children:j?"Ctrl+Enter to send (IME safe) β’ Shift+Enter for new line β’ Tab to change modes":"Press Enter to send β’ Shift+Enter for new line β’ Tab to change modes"}),e.jsx("div",{className:`text-xs text-gray-500 dark:text-gray-400 text-center mt-2 sm:hidden transition-opacity duration-200 ${K?"opacity-100":"opacity-0"}`,children:j?"Ctrl+Enter to send (IME safe) β’ Tab for modes β’ @ for files":"Enter to send β’ Tab for modes β’ @ for files"})]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:"Select a project to start chatting with Claude"})})})}const wf=lr.memo(vf);function Rl({file:t,onClose:r,projectPath:n}){const[s,a]=p.useState(""),[i,o]=p.useState(!0),[l,d]=p.useState(!1),[c,u]=p.useState(!1),[h,x]=p.useState(!0),[m,y]=p.useState(!1),[v,E]=p.useState(!!t.diffInfo),[A,T]=p.useState(!1),j=ic.define(),W=oc.define({create(){return es.none},update(C,I){C=C.map(I.changes);for(let b of I.effects)b.is(j)&&(C=b.value);return C},provide:C=>Mn.decorations.from(C)}),Z=(C,I)=>{if(!I||!v)return es.none;const b=new lc,z=C.split(`
|
|
494
|
+
`),K=I.old_string.split(`
|
|
495
|
+
`);let B=-1;for(let G=0;G<=z.length-K.length;G++){let ie=!0;for(let N=0;N<K.length;N++)if(z[G+N]!==K[N]){ie=!1;break}if(ie){B=G;break}}if(B>=0){let G=0;for(let ie=0;ie<B;ie++)G+=z[ie].length+1;for(let ie=0;ie<K.length;ie++){const N=G,Ie=G+K[ie].length;b.add(N,Ie,es.line({class:h?"diff-removed-dark":"diff-removed-light"})),G+=K[ie].length+1}}return b.finish()},D=Mn.theme({".diff-removed-light":{backgroundColor:"#fef2f2",borderLeft:"3px solid #ef4444"},".diff-removed-dark":{backgroundColor:"rgba(239, 68, 68, 0.1)",borderLeft:"3px solid #ef4444"},".diff-added-light":{backgroundColor:"#f0fdf4",borderLeft:"3px solid #22c55e"},".diff-added-dark":{backgroundColor:"rgba(34, 197, 94, 0.1)",borderLeft:"3px solid #22c55e"}}),q=C=>{const I=C.split(".").pop()?.toLowerCase();switch(I){case"js":case"jsx":case"ts":case"tsx":return[pc({jsx:!0,typescript:I.includes("ts")})];case"py":return[mc()];case"html":case"htm":return[uc()];case"css":case"scss":case"less":return[dc()];case"json":return[cc()];case"md":case"markdown":return[so()];default:return[]}};p.useEffect(()=>{(async()=>{try{o(!0);const I=await Je.readFile(t.projectName,t.path);if(!I.ok)throw new Error(`Failed to load file: ${I.status} ${I.statusText}`);const b=await I.json();a(b.content)}catch(I){console.error("Error loading file:",I),a(`// Error loading file: ${I.message}
|
|
496
|
+
// File: ${t.name}
|
|
497
|
+
// Path: ${t.path}`)}finally{o(!1)}})()},[t,n]);const M=p.useRef(null);p.useEffect(()=>{if(M.current&&s&&t.diffInfo&&v){const C=Z(s,t.diffInfo),I=M.current.view;I&&I.dispatch({effects:j.of(C)})}},[s,t.diffInfo,v,h]);const _=async()=>{d(!0);try{const C=await Je.saveFile(t.projectName,t.path,s);if(!C.ok){const b=await C.json();throw new Error(b.error||`Save failed: ${C.status}`)}const I=await C.json();y(!0),setTimeout(()=>y(!1),2e3)}catch(C){console.error("Error saving file:",C),alert(`Error saving file: ${C.message}`)}finally{d(!1)}},R=()=>{const C=new Blob([s],{type:"text/plain"}),I=URL.createObjectURL(C),b=document.createElement("a");b.href=I,b.download=t.name,document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(I)},L=()=>{u(!c)};return p.useEffect(()=>{const C=I=>{(I.ctrlKey||I.metaKey)&&(I.key==="s"?(I.preventDefault(),_()):I.key==="Escape"&&(I.preventDefault(),r()))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[s]),i?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
|
|
498
|
+
.code-editor-loading {
|
|
499
|
+
background-color: ${h?"#111827":"#ffffff"} !important;
|
|
500
|
+
}
|
|
501
|
+
.code-editor-loading:hover {
|
|
502
|
+
background-color: ${h?"#111827":"#ffffff"} !important;
|
|
503
|
+
}
|
|
504
|
+
`}),e.jsx("div",{className:"fixed inset-0 z-50 md:bg-black/50 md:flex md:items-center md:justify-center",children:e.jsx("div",{className:"code-editor-loading w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),e.jsxs("span",{className:"text-gray-900 dark:text-white",children:["Loading ",t.name,"..."]})]})})})]}):e.jsx("div",{className:`fixed inset-0 z-50 md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${c?"md:p-0":""}`,children:e.jsxs("div",{className:`bg-white shadow-2xl flex flex-col ${"w-full h-full md:rounded-lg md:shadow-2xl"+(c?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]")}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 flex-shrink-0 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded flex items-center justify-center flex-shrink-0",children:e.jsx("span",{className:"text-white text-sm font-mono",children:t.name.split(".").pop()?.toUpperCase()||"FILE"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("h3",{className:"font-medium text-gray-900 truncate",children:t.name}),t.diffInfo&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-600 px-2 py-1 rounded whitespace-nowrap",children:"π Has changes"})]}),e.jsx("p",{className:"text-sm text-gray-500 truncate",children:t.path})]})]}),e.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[t.diffInfo&&e.jsx("button",{onClick:()=>E(!v),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:v?"Hide diff highlighting":"Show diff highlighting",children:v?e.jsx(Ud,{className:"w-5 h-5 md:w-4 md:h-4"}):e.jsx(cn,{className:"w-5 h-5 md:w-4 md:h-4"})}),e.jsx("button",{onClick:()=>T(!A),className:`p-2 md:p-2 rounded-md hover:bg-gray-100 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center ${A?"text-blue-600 bg-blue-50":"text-gray-600 hover:text-gray-900"}`,title:A?"Disable word wrap":"Enable word wrap",children:e.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"β΅"})}),e.jsx("button",{onClick:()=>x(!h),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:e.jsx("span",{className:"text-lg md:text-base",children:h?"βοΈ":"π"})}),e.jsx("button",{onClick:R,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download file",children:e.jsx(Pn,{className:"w-5 h-5 md:w-4 md:h-4"})}),e.jsx("button",{onClick:_,disabled:l,className:`px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors min-h-[44px] md:min-h-0 ${m?"bg-green-600 hover:bg-green-700":"bg-blue-600 hover:bg-blue-700"}`,children:m?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Rn,{className:"w-5 h-5 md:w-4 md:h-4"}),e.jsx("span",{className:"hidden sm:inline",children:l?"Saving...":"Save"})]})}),e.jsx("button",{onClick:L,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:c?"Exit fullscreen":"Fullscreen",children:c?e.jsx(jo,{className:"w-4 h-4"}):e.jsx(na,{className:"w-4 h-4"})}),e.jsx("button",{onClick:r,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:e.jsx(lt,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ro,{ref:M,value:s,onChange:a,extensions:[...q(t.name),W,D,...A?[Mn.lineWrapping]:[]],theme:h?no:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),e.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:["Lines: ",s.split(`
|
|
505
|
+
`).length]}),e.jsxs("span",{children:["Characters: ",s.length]}),e.jsxs("span",{children:["Language: ",t.name.split(".").pop()?.toUpperCase()||"Text"]})]}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save β’ Esc to close"})]})]})})}function jf({file:t,onClose:r}){const n=`/api/projects/${t.projectName}/files/content?path=${encodeURIComponent(t.path)}`;return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t.name}),e.jsx(Oe,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:e.jsx(lt,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[e.jsx("img",{src:n,alt:t.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md",onError:s=>{s.target.style.display="none",s.target.nextSibling.style.display="block"}}),e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",style:{display:"none"},children:[e.jsx("p",{children:"Unable to load image"}),e.jsx("p",{className:"text-sm mt-2",children:t.path})]})]}),e.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:t.path})})]})})}function Nf({selectedProject:t}){const[r,n]=p.useState([]),[s,a]=p.useState(!1),[i,o]=p.useState(new Set),[l,d]=p.useState(null),[c,u]=p.useState(null),[h,x]=p.useState("detailed"),[m,y]=p.useState(""),[v,E]=p.useState([]);p.useEffect(()=>{t&&T()},[t]),p.useEffect(()=>{const C=localStorage.getItem("file-tree-view-mode");C&&["simple","detailed","compact"].includes(C)&&x(C)},[]),p.useEffect(()=>{if(!m.trim())E(r);else{const C=A(r,m.toLowerCase());E(C);const I=b=>{b.forEach(z=>{z.type==="directory"&&z.children&&z.children.length>0&&(o(K=>new Set(K.add(z.path))),I(z.children))})};I(C)}},[r,m]);const A=(C,I)=>C.reduce((b,z)=>{const K=z.name.toLowerCase().includes(I);let B=[];return z.type==="directory"&&z.children&&(B=A(z.children,I)),(K||B.length>0)&&b.push({...z,children:B}),b},[]),T=async()=>{a(!0);try{const C=await Je.getFiles(t.name);if(!C.ok){const b=await C.text();console.error("β File fetch failed:",C.status,b),n([]);return}const I=await C.json();n(I)}catch(C){console.error("β Error fetching files:",C),n([])}finally{a(!1)}},j=C=>{const I=new Set(i);I.has(C)?I.delete(C):I.add(C),o(I)},W=C=>{x(C),localStorage.setItem("file-tree-view-mode",C)},Z=C=>{if(!C||C===0)return"0 B";const I=1024,b=["B","KB","MB","GB"],z=Math.floor(Math.log(C)/Math.log(I));return parseFloat((C/Math.pow(I,z)).toFixed(1))+" "+b[z]},D=C=>{if(!C)return"-";const I=new Date,b=new Date(C),z=Math.floor((I-b)/1e3);return z<60?"just now":z<3600?`${Math.floor(z/60)} min ago`:z<86400?`${Math.floor(z/3600)} hours ago`:z<2592e3?`${Math.floor(z/86400)} days ago`:b.toLocaleDateString()},q=(C,I=0)=>C.map(b=>e.jsxs("div",{className:"select-none",children:[e.jsx(Oe,{variant:"ghost",className:Se("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent"),style:{paddingLeft:`${I*16+12}px`},onClick:()=>{b.type==="directory"?j(b.path):M(b.name)?u({name:b.name,path:b.path,projectPath:t.path,projectName:t.name}):d({name:b.name,path:b.path,projectPath:t.path,projectName:t.name})},children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b.type==="directory"?i.has(b.path)?e.jsx(yr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):e.jsx(Wt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):_(b.name),e.jsx("span",{className:"text-sm truncate text-foreground",children:b.name})]})}),b.type==="directory"&&i.has(b.path)&&b.children&&b.children.length>0&&e.jsx("div",{children:q(b.children,I+1)})]},b.path)),M=C=>{const I=C.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(I)},_=C=>{const I=C.split(".").pop()?.toLowerCase(),b=["js","jsx","ts","tsx","py","java","cpp","c","php","rb","go","rs"],z=["md","txt","doc","pdf"],K=["png","jpg","jpeg","gif","svg","webp","ico","bmp"];return b.includes(I)?e.jsx(qd,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):z.includes(I)?e.jsx(Ct,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):K.includes(I)?e.jsx(Oa,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}):e.jsx(Oa,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})},R=(C,I=0)=>C.map(b=>e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{className:Se("grid grid-cols-12 gap-2 p-2 hover:bg-accent cursor-pointer items-center"),style:{paddingLeft:`${I*16+12}px`},onClick:()=>{b.type==="directory"?j(b.path):M(b.name)?u({name:b.name,path:b.path,projectPath:t.path,projectName:t.name}):d({name:b.name,path:b.path,projectPath:t.path,projectName:t.name})},children:[e.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[b.type==="directory"?i.has(b.path)?e.jsx(yr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):e.jsx(Wt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):_(b.name),e.jsx("span",{className:"text-sm truncate text-foreground",children:b.name})]}),e.jsx("div",{className:"col-span-2 text-sm text-muted-foreground",children:b.type==="file"?Z(b.size):"-"}),e.jsx("div",{className:"col-span-3 text-sm text-muted-foreground",children:D(b.modified)}),e.jsx("div",{className:"col-span-2 text-sm text-muted-foreground font-mono",children:b.permissionsRwx||"-"})]}),b.type==="directory"&&i.has(b.path)&&b.children&&R(b.children,I+1)]},b.path)),L=(C,I=0)=>C.map(b=>e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{className:Se("flex items-center justify-between p-2 hover:bg-accent cursor-pointer"),style:{paddingLeft:`${I*16+12}px`},onClick:()=>{b.type==="directory"?j(b.path):M(b.name)?u({name:b.name,path:b.path,projectPath:t.path,projectName:t.name}):d({name:b.name,path:b.path,projectPath:t.path,projectName:t.name})},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.type==="directory"?i.has(b.path)?e.jsx(yr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):e.jsx(Wt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):_(b.name),e.jsx("span",{className:"text-sm truncate text-foreground",children:b.name})]}),e.jsx("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:b.type==="file"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:Z(b.size)}),e.jsx("span",{className:"font-mono",children:b.permissionsRwx})]})})]}),b.type==="directory"&&i.has(b.path)&&b.children&&L(b.children,I+1)]},b.path));return s?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading files..."})}):e.jsxs("div",{className:"h-full flex flex-col bg-card",children:[e.jsxs("div",{className:"p-4 border-b border-border space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Files"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Oe,{variant:h==="simple"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>W("simple"),title:"Simple view",children:e.jsx(Ln,{className:"w-4 h-4"})}),e.jsx(Oe,{variant:h==="compact"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>W("compact"),title:"Compact view",children:e.jsx(cn,{className:"w-4 h-4"})}),e.jsx(Oe,{variant:h==="detailed"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>W("detailed"),title:"Detailed view",children:e.jsx(Wu,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Dr,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(_t,{type:"text",placeholder:"Search files and folders...",value:m,onChange:C=>y(C.target.value),className:"pl-8 pr-8 h-8 text-sm"}),m&&e.jsx(Oe,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-accent",onClick:()=>y(""),title:"Clear search",children:e.jsx(lt,{className:"w-3 h-3"})})]})]}),h==="detailed"&&v.length>0&&e.jsx("div",{className:"px-4 pt-2 pb-1 border-b border-border",children:e.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[e.jsx("div",{className:"col-span-5",children:"Name"}),e.jsx("div",{className:"col-span-2",children:"Size"}),e.jsx("div",{className:"col-span-3",children:"Modified"}),e.jsx("div",{className:"col-span-2",children:"Permissions"})]})}),e.jsx(ea,{className:"flex-1 p-4",children:r.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(Wt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:"No files found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Check if the project path is accessible"})]}):v.length===0&&m?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(Dr,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:"No matches found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Try a different search term or clear the search"})]}):e.jsxs("div",{className:h==="detailed"?"":"space-y-1",children:[h==="simple"&&q(v),h==="compact"&&L(v),h==="detailed"&&R(v)]})}),l&&e.jsx(Rl,{file:l,onClose:()=>d(null),projectPath:l.projectPath}),c&&e.jsx(jf,{file:c,onClose:()=>u(null)})]})}function zl({project:t,session:r=null,command:n=null,isActive:s=!0,isPlainShell:a=null,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:d=null,className:c="",showHeader:u=!0,compact:h=!1}){const[x,m]=p.useState(!1),y=a!==null?a:n!==null,v=E=>{m(!0),o&&o(E)};return t?e.jsxs("div",{className:`h-full flex flex-col ${c}`,children:[u&&d&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:d}),x&&e.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),l&&e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",title:"Close",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1",children:e.jsx(ya,{selectedProject:t,selectedSession:r,isActive:s,initialCommand:n,isPlainShell:y,onProcessComplete:v})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${c}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Project Selected"}),e.jsx("p",{children:"A project is required to open a shell"})]})})}function Xi({diff:t,fileName:r,isMobile:n,wrapText:s}){if(!t)return e.jsx("div",{className:"p-4 text-center text-gray-500 dark:text-gray-400 text-sm",children:"No diff available"});const a=(i,o)=>{const l=i.startsWith("+")&&!i.startsWith("+++"),d=i.startsWith("-")&&!i.startsWith("---"),c=i.startsWith("@@");return e.jsx("div",{className:`font-mono text-xs p-2 ${n&&s?"whitespace-pre-wrap break-all":"whitespace-pre overflow-x-auto"} ${l?"bg-green-50 dark:bg-green-950 text-green-700 dark:text-green-300":d?"bg-red-50 dark:bg-red-950 text-red-700 dark:text-red-300":c?"bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`,children:i},o)};return e.jsx("div",{className:"diff-viewer",children:t.split(`
|
|
506
|
+
`).map((i,o)=>a(i,o))})}function Sf({selectedProject:t,isMobile:r}){const[n,s]=p.useState(null),[a,i]=p.useState({}),[o,l]=p.useState(!1),[d,c]=p.useState(""),[u,h]=p.useState(new Set),[x,m]=p.useState(new Set),[y,v]=p.useState(!1),[E,A]=p.useState(""),[T,j]=p.useState([]),[W,Z]=p.useState(!0),[D,q]=p.useState(!1),[M,_]=p.useState(!1),[R,L]=p.useState(!1),[C,I]=p.useState(""),[b,z]=p.useState(!1),[K,B]=p.useState("changes"),[G,ie]=p.useState([]),[N,Ie]=p.useState(new Set),[Fe,f]=p.useState({}),[te,ue]=p.useState(!1),[re,Ce]=p.useState(null),[Be,ee]=p.useState(!1),[oe,xe]=p.useState(!1),[Ne,ye]=p.useState(!1),[Ue,Ye]=p.useState(!1),[nt,me]=p.useState(r),[pe,Me]=p.useState(null),et=p.useRef(null),it=p.useRef(null);p.useEffect(()=>{t&&(ge(),wt(),X(),K==="history"&&Ze())},[t,K]),p.useEffect(()=>{const F=g=>{it.current&&!it.current.contains(g.target)&&_(!1)};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);const ge=async()=>{if(t){l(!0);try{const g=await(await Re(`/api/git/status?project=${encodeURIComponent(t.name)}`)).json();if(g.error)console.error("Git status error:",g.error),s({error:g.error,details:g.details});else{s(g),A(g.branch||"main");const U=new Set([...g.modified||[],...g.added||[],...g.deleted||[],...g.untracked||[]]);m(U);for(const ce of g.modified||[])mt(ce);for(const ce of g.added||[])mt(ce)}}catch(F){console.error("Error fetching git status:",F)}finally{l(!1)}}},wt=async()=>{try{const g=await(await Re(`/api/git/branches?project=${encodeURIComponent(t.name)}`)).json();!g.error&&g.branches&&j(g.branches)}catch(F){console.error("Error fetching branches:",F)}},X=async()=>{if(t)try{const g=await(await Re(`/api/git/remote-status?project=${encodeURIComponent(t.name)}`)).json();g.error?Ce(null):Ce(g)}catch(F){console.error("Error fetching remote status:",F),Ce(null)}},ke=async F=>{try{const U=await(await Re("/api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name,branch:F})})).json();U.success?(A(F),_(!1),ge()):console.error("Failed to switch branch:",U.error)}catch(g){console.error("Error switching branch:",g)}},k=async()=>{if(C.trim()){z(!0);try{const g=await(await Re("/api/git/create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name,branch:C.trim()})})).json();g.success?(A(C.trim()),L(!1),_(!1),I(""),wt(),ge()):console.error("Failed to create branch:",g.error)}catch(F){console.error("Error creating branch:",F)}finally{z(!1)}}},P=async()=>{ee(!0);try{const g=await(await Re("/api/git/fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name})})).json();g.success?(ge(),X()):console.error("Fetch failed:",g.error)}catch(F){console.error("Error fetching from remote:",F)}finally{ee(!1)}},J=async()=>{xe(!0);try{const g=await(await Re("/api/git/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name})})).json();g.success?(ge(),X()):console.error("Pull failed:",g.error)}catch(F){console.error("Error pulling from remote:",F)}finally{xe(!1)}},se=async()=>{ye(!0);try{const g=await(await Re("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name})})).json();g.success?(ge(),X()):console.error("Push failed:",g.error)}catch(F){console.error("Error pushing to remote:",F)}finally{ye(!1)}},le=async()=>{Ye(!0);try{const g=await(await Re("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name,branch:E})})).json();g.success?(ge(),X()):console.error("Publish failed:",g.error)}catch(F){console.error("Error publishing branch:",F)}finally{Ye(!1)}},Le=async F=>{try{const U=await(await Re("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name,file:F})})).json();U.success?(m(ce=>{const we=new Set(ce);return we.delete(F),we}),ge()):console.error("Discard failed:",U.error)}catch(g){console.error("Error discarding changes:",g)}},De=async F=>{try{const U=await(await Re("/api/git/delete-untracked",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name,file:F})})).json();U.success?(m(ce=>{const we=new Set(ce);return we.delete(F),we}),ge()):console.error("Delete failed:",U.error)}catch(g){console.error("Error deleting untracked file:",g)}},Ge=async()=>{if(!pe)return;const{type:F,file:g,message:U}=pe;Me(null);try{switch(F){case"discard":await Le(g);break;case"delete":await De(g);break;case"commit":await jt();break;case"pull":await J();break;case"push":await se();break;case"publish":await le();break}}catch(ce){console.error(`Error executing ${F}:`,ce)}},mt=async F=>{try{const U=await(await Re(`/api/git/diff?project=${encodeURIComponent(t.name)}&file=${encodeURIComponent(F)}`)).json();!U.error&&U.diff&&i(ce=>({...ce,[F]:U.diff}))}catch(g){console.error("Error fetching file diff:",g)}},Ze=async()=>{try{const g=await(await Re(`/api/git/commits?project=${encodeURIComponent(t.name)}&limit=10`)).json();!g.error&&g.commits&&ie(g.commits)}catch(F){console.error("Error fetching commits:",F)}},st=async F=>{try{const U=await(await Re(`/api/git/commit-diff?project=${encodeURIComponent(t.name)}&commit=${F}`)).json();!U.error&&U.diff&&f(ce=>({...ce,[F]:U.diff}))}catch(g){console.error("Error fetching commit diff:",g)}},ht=async()=>{ue(!0);try{const g=await(await Re("/api/git/generate-commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name,files:Array.from(x)})})).json();g.message?c(g.message):console.error("Failed to generate commit message:",g.error)}catch(F){console.error("Error generating commit message:",F)}finally{ue(!1)}},ct=F=>{h(g=>{const U=new Set(g);return U.has(F)?U.delete(F):U.add(F),U})},Lt=F=>{Ie(g=>{const U=new Set(g);return U.has(F)?U.delete(F):(U.add(F),Fe[F]||st(F)),U})},Rt=F=>{m(g=>{const U=new Set(g);return U.has(F)?U.delete(F):U.add(F),U})},jt=async()=>{if(!(!d.trim()||x.size===0)){v(!0);try{const g=await(await Re("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:t.name,message:d,files:Array.from(x)})})).json();g.success?(c(""),m(new Set),ge(),X()):console.error("Commit failed:",g.error)}catch(F){console.error("Error committing changes:",F)}finally{v(!1)}}},yt=F=>{switch(F){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"U":return"Untracked";default:return F}},mr=F=>{const g=N.has(F.hash),U=Fe[F.hash];return e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[e.jsxs("div",{className:"flex items-start p-3 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer",onClick:()=>Lt(F.hash),children:[e.jsx("div",{className:"mr-2 mt-1 p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:g?e.jsx($t,{className:"w-3 h-3"}):e.jsx(cr,{className:"w-3 h-3"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:F.message}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:[F.author," β’ ",F.date]})]}),e.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 flex-shrink-0",children:F.hash.substring(0,7)})]})})]}),g&&U&&e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-h-96 overflow-y-auto p-2",children:[e.jsx("div",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 mb-2",children:F.stats}),e.jsx(Xi,{diff:U,fileName:"commit",isMobile:r,wrapText:W})]})})]},F.hash)},ft=(F,g)=>{const U=u.has(F),ce=x.has(F),we=a[F];return e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[e.jsxs("div",{className:`flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 ${r?"px-2 py-1.5":"px-3 py-2"}`,children:[e.jsx("input",{type:"checkbox",checked:ce,onChange:()=>Rt(F),onClick:V=>V.stopPropagation(),className:`rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600 ${r?"mr-1.5":"mr-2"}`}),e.jsxs("div",{className:"flex items-center flex-1 cursor-pointer",onClick:()=>ct(F),children:[e.jsx("div",{className:`p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded ${r?"mr-1":"mr-2"}`,children:e.jsx(cr,{className:`w-3 h-3 transition-transform duration-200 ease-in-out ${U?"rotate-90":"rotate-0"}`})}),e.jsx("span",{className:`flex-1 truncate ${r?"text-xs":"text-sm"}`,children:F}),e.jsxs("div",{className:"flex items-center gap-1",children:[(g==="M"||g==="D")&&e.jsxs("button",{onClick:V=>{V.stopPropagation(),Me({type:"discard",file:F,message:`Discard all changes to "${F}"? This action cannot be undone.`})},className:`${r?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Discard changes",children:[e.jsx(Xt,{className:"w-3 h-3"}),r&&e.jsx("span",{children:"Discard"})]}),g==="U"&&e.jsxs("button",{onClick:V=>{V.stopPropagation(),Me({type:"delete",file:F,message:`Delete untracked file "${F}"? This action cannot be undone.`})},className:`${r?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Delete untracked file",children:[e.jsx(Xt,{className:"w-3 h-3"}),r&&e.jsx("span",{children:"Delete"})]}),e.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${g==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":g==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":g==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,title:yt(g),children:g})]})]})]}),e.jsxs("div",{className:`bg-gray-50 dark:bg-gray-900 transition-all duration-400 ease-in-out overflow-hidden ${U&&we?"max-h-[600px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-1"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${g==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":g==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":g==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,children:g}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:yt(g)})]}),r&&e.jsx("button",{onClick:V=>{V.stopPropagation(),Z(!W)},className:"text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",title:W?"Switch to horizontal scroll":"Switch to text wrap",children:W?"βοΈ Scroll":"β©οΈ Wrap"})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:we&&e.jsx(Xi,{diff:we,fileName:F,isMobile:r,wrapText:W})})]})]},F)};return t?e.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[e.jsxs("div",{className:`flex items-center justify-between border-b border-gray-200 dark:border-gray-700 ${r?"px-3 py-2":"px-4 py-3"}`,children:[e.jsxs("div",{className:"relative",ref:it,children:[e.jsxs("button",{onClick:()=>_(!M),className:`flex items-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors ${r?"space-x-1 px-2 py-1":"space-x-2 px-3 py-1.5"}`,children:[e.jsx(Is,{className:`text-gray-600 dark:text-gray-400 ${r?"w-3 h-3":"w-4 h-4"}`}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:`font-medium ${r?"text-xs":"text-sm"}`,children:E}),re?.hasRemote&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[re.ahead>0&&e.jsxs("span",{className:"text-green-600 dark:text-green-400",title:`${re.ahead} commit${re.ahead!==1?"s":""} ahead`,children:["β",re.ahead]}),re.behind>0&&e.jsxs("span",{className:"text-blue-600 dark:text-blue-400",title:`${re.behind} commit${re.behind!==1?"s":""} behind`,children:["β",re.behind]}),re.isUpToDate&&e.jsx("span",{className:"text-gray-500 dark:text-gray-400",title:"Up to date with remote",children:"β"})]})]}),e.jsx($t,{className:`w-3 h-3 text-gray-500 transition-transform ${M?"rotate-180":""}`})]}),M&&e.jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:[e.jsx("div",{className:"py-1 max-h-64 overflow-y-auto",children:T.map(F=>e.jsx("button",{onClick:()=>ke(F),className:`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${F===E?"bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:e.jsxs("div",{className:"flex items-center space-x-2",children:[F===E&&e.jsx(Ir,{className:"w-3 h-3 text-green-600 dark:text-green-400"}),e.jsx("span",{className:F===E?"font-medium":"",children:F})]})},F))}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 py-1",children:e.jsxs("button",{onClick:()=>{L(!0),_(!1)},className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center space-x-2",children:[e.jsx(Dt,{className:"w-3 h-3"}),e.jsx("span",{children:"Create new branch"})]})})]})]}),e.jsxs("div",{className:`flex items-center ${r?"gap-1":"gap-2"}`,children:[re?.hasRemote&&e.jsxs(e.Fragment,{children:[!re?.hasUpstream&&e.jsxs("button",{onClick:()=>Me({type:"publish",message:`Publish branch "${E}" to ${re.remoteName}?`}),disabled:Ue,className:"px-2 py-1 text-xs bg-purple-600 text-white rounded hover:bg-purple-700 disabled:opacity-50 flex items-center gap-1",title:`Publish branch "${E}" to ${re.remoteName}`,children:[e.jsx(jn,{className:`w-3 h-3 ${Ue?"animate-pulse":""}`}),e.jsx("span",{children:Ue?"Publishing...":"Publish"})]}),re?.hasUpstream&&!re?.isUpToDate&&e.jsxs(e.Fragment,{children:[re.behind>0&&e.jsxs("button",{onClick:()=>Me({type:"pull",message:`Pull ${re.behind} commit${re.behind!==1?"s":""} from ${re.remoteName}?`}),disabled:oe,className:"px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center gap-1",title:`Pull ${re.behind} commit${re.behind!==1?"s":""} from ${re.remoteName}`,children:[e.jsx(Pn,{className:`w-3 h-3 ${oe?"animate-pulse":""}`}),e.jsx("span",{children:oe?"Pulling...":`Pull ${re.behind}`})]}),re.ahead>0&&e.jsxs("button",{onClick:()=>Me({type:"push",message:`Push ${re.ahead} commit${re.ahead!==1?"s":""} to ${re.remoteName}?`}),disabled:Ne,className:"px-2 py-1 text-xs bg-orange-600 text-white rounded hover:bg-orange-700 disabled:opacity-50 flex items-center gap-1",title:`Push ${re.ahead} commit${re.ahead!==1?"s":""} to ${re.remoteName}`,children:[e.jsx(jn,{className:`w-3 h-3 ${Ne?"animate-pulse":""}`}),e.jsx("span",{children:Ne?"Pushing...":`Push ${re.ahead}`})]}),(re.ahead>0||re.behind>0&&re.ahead>0)&&e.jsxs("button",{onClick:P,disabled:Be,className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 flex items-center gap-1",title:`Fetch from ${re.remoteName}`,children:[e.jsx(or,{className:`w-3 h-3 ${Be?"animate-spin":""}`}),e.jsx("span",{children:Be?"Fetching...":"Fetch"})]})]})]}),e.jsx("button",{onClick:()=>{ge(),wt(),X()},disabled:o,className:`hover:bg-gray-100 dark:hover:bg-gray-800 rounded ${r?"p-1":"p-1.5"}`,children:e.jsx(or,{className:`${o?"animate-spin":""} ${r?"w-3 h-3":"w-4 h-4"}`})})]})]}),n?.error?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 px-6 py-12",children:[e.jsx(Is,{className:"w-20 h-20 mb-6 opacity-30"}),e.jsx("h3",{className:"text-xl font-medium mb-3 text-center",children:n.error}),n.details&&e.jsx("p",{className:"text-sm text-center leading-relaxed mb-6 max-w-md",children:n.details}),e.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800 max-w-md",children:e.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300 text-center",children:[e.jsx("strong",{children:"Tip:"})," Run ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-2 py-1 rounded font-mono text-xs",children:"git init"})," in your project directory to initialize git source control."]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`flex border-b border-gray-200 dark:border-gray-700 transition-all duration-300 ease-in-out ${u.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[e.jsx("button",{onClick:()=>B("changes"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${K==="changes"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Ct,{className:"w-4 h-4"}),e.jsx("span",{children:"Changes"})]})}),e.jsx("button",{onClick:()=>B("history"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${K==="history"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Ua,{className:"w-4 h-4"}),e.jsx("span",{children:"History"})]})})]}),K==="changes"&&e.jsx(e.Fragment,{children:e.jsx("div",{className:`transition-all duration-300 ease-in-out ${u.size===0?"max-h-96 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:r&&nt?e.jsx("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("button",{onClick:()=>me(!1),className:"w-full flex items-center justify-center gap-2 px-3 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700",children:[e.jsx(Ba,{className:"w-4 h-4"}),e.jsxs("span",{children:["Commit ",x.size," file",x.size!==1?"s":""]}),e.jsx($t,{className:"w-3 h-3"})]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[r&&e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Commit Changes"}),e.jsx("button",{onClick:()=>me(!0),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded",children:e.jsx($t,{className:"w-4 h-4 rotate-180"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:et,value:d,onChange:F=>c(F.target.value),placeholder:"Message (Ctrl+Enter to commit)",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 resize-none pr-20",rows:"3",onKeyDown:F=>{F.key==="Enter"&&(F.ctrlKey||F.metaKey)&&jt()}}),e.jsxs("div",{className:"absolute right-2 top-2 flex gap-1",children:[e.jsx("button",{onClick:ht,disabled:x.size===0||te,className:"p-1.5 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",title:"Generate commit message",children:te?e.jsx(or,{className:"w-4 h-4 animate-spin"}):e.jsx(kr,{className:"w-4 h-4"})}),e.jsx("div",{style:{display:"none"},children:e.jsx(Sl,{onTranscript:F=>c(F),mode:"default",className:"p-1.5"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsxs("span",{className:"text-xs text-gray-500",children:[x.size," file",x.size!==1?"s":""," selected"]}),e.jsxs("button",{onClick:()=>Me({type:"commit",message:`Commit ${x.size} file${x.size!==1?"s":""} with message: "${d.trim()}"?`}),disabled:!d.trim()||x.size===0||y,className:"px-3 py-1 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",children:[e.jsx(Ir,{className:"w-3 h-3"}),e.jsx("span",{children:y?"Committing...":"Commit"})]})]})]})})})}),K==="changes"&&n&&!n.error&&e.jsxs("div",{className:`border-b border-gray-200 dark:border-gray-700 flex items-center justify-between transition-all duration-300 ease-in-out ${r?"px-3 py-1.5":"px-4 py-2"} ${u.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[e.jsxs("span",{className:"text-gray-600 dark:text-gray-400 text-xs",children:[x.size," of ",(n?.modified?.length||0)+(n?.added?.length||0)+(n?.deleted?.length||0)+(n?.untracked?.length||0)," ",r?"":"files"," selected"]}),e.jsxs("div",{className:`flex ${r?"gap-1":"gap-2"}`,children:[e.jsx("button",{onClick:()=>{const F=new Set([...n?.modified||[],...n?.added||[],...n?.deleted||[],...n?.untracked||[]]);m(F)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:r?"All":"Select All"}),e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),e.jsx("button",{onClick:()=>m(new Set),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:r?"None":"Deselect All"})]})]}),!n?.error&&!r&&e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>q(!D),className:"w-full px-4 py-2 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-750 text-xs text-gray-600 dark:text-gray-400 flex items-center justify-center gap-1",children:[e.jsx(iu,{className:"w-3 h-3"}),e.jsx("span",{children:"File Status Guide"}),D?e.jsx($t,{className:"w-3 h-3"}):e.jsx(cr,{className:"w-3 h-3"})]}),D&&e.jsx("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-800 text-xs",children:e.jsxs("div",{className:`${r?"grid grid-cols-2 gap-3 justify-items-center":"flex justify-center gap-6"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 rounded border border-yellow-200 dark:border-yellow-800 font-bold text-xs",children:"M"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Modified"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 rounded border border-green-200 dark:border-green-800 font-bold text-xs",children:"A"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Added"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 rounded border border-red-200 dark:border-red-800 font-bold text-xs",children:"D"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Deleted"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 rounded border border-gray-300 dark:border-gray-600 font-bold text-xs",children:"U"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Untracked"})]})]})})]})]}),K==="changes"&&!n?.error&&e.jsx("div",{className:`flex-1 overflow-y-auto ${r?"pb-20":""}`,children:o?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx(or,{className:"w-6 h-6 animate-spin text-gray-400"})}):!n||!n.modified?.length&&!n.added?.length&&!n.deleted?.length&&!n.untracked?.length?e.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[e.jsx(Ba,{className:"w-12 h-12 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No changes detected"})]}):e.jsxs("div",{className:r?"pb-4":"",children:[n.modified?.map(F=>ft(F,"M")),n.added?.map(F=>ft(F,"A")),n.deleted?.map(F=>ft(F,"D")),n.untracked?.map(F=>ft(F,"U"))]})}),K==="history"&&!n?.error&&e.jsx("div",{className:`flex-1 overflow-y-auto ${r?"pb-20":""}`,children:o?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx(or,{className:"w-6 h-6 animate-spin text-gray-400"})}):G.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[e.jsx(Ua,{className:"w-12 h-12 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No commits found"})]}):e.jsx("div",{className:r?"pb-4":"",children:G.map(F=>mr(F))})}),R&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>L(!1)}),e.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:e.jsxs("div",{className:"p-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Create New Branch"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Branch Name"}),e.jsx("input",{type:"text",value:C,onChange:F=>I(F.target.value),onKeyDown:F=>{F.key==="Enter"&&!b&&k()},placeholder:"feature/new-feature",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0})]}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:["This will create a new branch from the current branch (",E,")"]}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:()=>{L(!1),I("")},className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),e.jsx("button",{onClick:k,disabled:!C.trim()||b,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2",children:b?e.jsxs(e.Fragment,{children:[e.jsx(or,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Creating..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Dt,{className:"w-3 h-3"}),e.jsx("span",{children:"Create Branch"})]})})]})]})})]}),pe&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>Me(null)}),e.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center mb-4",children:[e.jsx("div",{className:`p-2 rounded-full mr-3 ${pe.type==="discard"||pe.type==="delete"?"bg-red-100 dark:bg-red-900":"bg-yellow-100 dark:bg-yellow-900"}`,children:e.jsx(Xr,{className:`w-5 h-5 ${pe.type==="discard"||pe.type==="delete"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`})}),e.jsx("h3",{className:"text-lg font-semibold",children:pe.type==="discard"?"Discard Changes":pe.type==="delete"?"Delete File":pe.type==="commit"?"Confirm Commit":pe.type==="pull"?"Confirm Pull":pe.type==="publish"?"Publish Branch":"Confirm Push"})]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:pe.message}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:()=>Me(null),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),e.jsx("button",{onClick:Ge,className:`px-4 py-2 text-sm text-white rounded-md ${pe.type==="discard"||pe.type==="delete"?"bg-red-600 hover:bg-red-700":pe.type==="commit"?"bg-blue-600 hover:bg-blue-700":pe.type==="pull"?"bg-green-600 hover:bg-green-700":pe.type==="publish"?"bg-purple-600 hover:bg-purple-700":"bg-orange-600 hover:bg-orange-700"} flex items-center space-x-2`,children:pe.type==="discard"?e.jsxs(e.Fragment,{children:[e.jsx(Xt,{className:"w-4 h-4"}),e.jsx("span",{children:"Discard"})]}):pe.type==="delete"?e.jsxs(e.Fragment,{children:[e.jsx(Xt,{className:"w-4 h-4"}),e.jsx("span",{children:"Delete"})]}):pe.type==="commit"?e.jsxs(e.Fragment,{children:[e.jsx(Ir,{className:"w-4 h-4"}),e.jsx("span",{children:"Commit"})]}):pe.type==="pull"?e.jsxs(e.Fragment,{children:[e.jsx(Pn,{className:"w-4 h-4"}),e.jsx("span",{children:"Pull"})]}):pe.type==="publish"?e.jsxs(e.Fragment,{children:[e.jsx(jn,{className:"w-4 h-4"}),e.jsx("span",{children:"Publish"})]}):e.jsxs(e.Fragment,{children:[e.jsx(jn,{className:"w-4 h-4"}),e.jsx("span",{children:"Push"})]})})]})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:"Select a project to view source control"})})}class Cf extends lr.Component{constructor(r){super(r),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(r){return{hasError:!0}}componentDidCatch(r,n){console.error("ErrorBoundary caught an error:",r,n),this.setState({error:r,errorInfo:n})}render(){return this.state.hasError?e.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[e.jsxs("div",{className:"flex items-center mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),e.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"Something went wrong"})]}),e.jsxs("div",{className:"text-sm text-red-700",children:[e.jsx("p",{className:"mb-2",children:"An error occurred while loading the chat interface."}),this.props.showDetails&&this.state.error&&e.jsxs("details",{className:"mt-4",children:[e.jsx("summary",{className:"cursor-pointer text-xs font-mono",children:"Error Details"}),e.jsxs("pre",{className:"mt-2 text-xs bg-red-100 p-2 rounded overflow-auto max-h-40",children:[this.state.error.toString(),this.state.errorInfo&&this.state.errorInfo.componentStack]})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry&&this.props.onRetry()},className:"bg-red-600 text-white px-4 py-2 rounded text-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"Try Again"})})]})}):this.props.children}}const Et=({children:t,content:r,position:n="top",className:s="",delay:a=500})=>{const[i,o]=p.useState(!1),[l,d]=p.useState(null),c=()=>{const m=setTimeout(()=>{o(!0)},a);d(m)},u=()=>{l&&(clearTimeout(l),d(null)),o(!1)},h=()=>{switch(n){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}},x=()=>{switch(n){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}};return r?e.jsxs("div",{className:"relative inline-block",onMouseEnter:c,onMouseLeave:u,children:[t,i&&e.jsxs("div",{className:Se("absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",h(),s),children:[r,e.jsx("div",{className:Se("absolute w-0 h-0 border-4 border-transparent",x())})]})]}):t},Zi=({task:t,onClick:r,showParent:n=!1,className:s=""})=>{const i=(l=>{switch(l){case"done":return{icon:ln,bgColor:"bg-green-50 dark:bg-green-950",borderColor:"border-green-200 dark:border-green-800",iconColor:"text-green-600 dark:text-green-400",textColor:"text-green-900 dark:text-green-100",statusText:"Done"};case"in-progress":return{icon:rn,bgColor:"bg-blue-50 dark:bg-blue-950",borderColor:"border-blue-200 dark:border-blue-800",iconColor:"text-blue-600 dark:text-blue-400",textColor:"text-blue-900 dark:text-blue-100",statusText:"In Progress"};case"review":return{icon:ra,bgColor:"bg-amber-50 dark:bg-amber-950",borderColor:"border-amber-200 dark:border-amber-800",iconColor:"text-amber-600 dark:text-amber-400",textColor:"text-amber-900 dark:text-amber-100",statusText:"Review"};case"deferred":return{icon:So,bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-gray-200 dark:border-gray-700",iconColor:"text-gray-500 dark:text-gray-400",textColor:"text-gray-700 dark:text-gray-300",statusText:"Deferred"};case"cancelled":return{icon:lt,bgColor:"bg-red-50 dark:bg-red-950",borderColor:"border-red-200 dark:border-red-800",iconColor:"text-red-600 dark:text-red-400",textColor:"text-red-900 dark:text-red-100",statusText:"Cancelled"};case"pending":default:return{icon:Ar,bgColor:"bg-slate-50 dark:bg-slate-800",borderColor:"border-slate-200 dark:border-slate-700",iconColor:"text-slate-500 dark:text-slate-400",textColor:"text-slate-900 dark:text-slate-100",statusText:"Pending"}}})(t.status);i.icon;const o=l=>{switch(l){case"high":return e.jsx(Et,{content:"High Priority",children:e.jsx("div",{className:"w-4 h-4 bg-red-100 dark:bg-red-900/30 rounded flex items-center justify-center",children:e.jsx(Cd,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})});case"medium":return e.jsx(Et,{content:"Medium Priority",children:e.jsx("div",{className:"w-4 h-4 bg-amber-100 dark:bg-amber-900/30 rounded flex items-center justify-center",children:e.jsx(bu,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})})});case"low":return e.jsx(Et,{content:"Low Priority",children:e.jsx("div",{className:"w-4 h-4 bg-blue-100 dark:bg-blue-900/30 rounded flex items-center justify-center",children:e.jsx(Ar,{className:"w-1.5 h-1.5 text-blue-600 dark:text-blue-400 fill-current"})})});default:return e.jsx(Et,{content:"No Priority Set",children:e.jsx("div",{className:"w-4 h-4 bg-gray-100 dark:bg-gray-800 rounded flex items-center justify-center",children:e.jsx(Ar,{className:"w-1.5 h-1.5 text-gray-400 dark:text-gray-500"})})})}};return e.jsxs("div",{className:Se("bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700","hover:shadow-md hover:border-blue-300 dark:hover:border-blue-600 transition-all duration-200 cursor-pointer","p-3 space-y-3",r&&"hover:-translate-y-0.5",s),onClick:r,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsx(Et,{content:`Task ID: ${t.id}`,children:e.jsx("span",{className:"text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:t.id})})}),e.jsx("h3",{className:"font-medium text-sm text-gray-900 dark:text-white line-clamp-2 leading-tight",children:t.title}),n&&t.parentId&&e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["Task ",t.parentId]})]}),e.jsx("div",{className:"flex-shrink-0",children:o(t.priority)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center",children:t.dependencies&&Array.isArray(t.dependencies)&&t.dependencies.length>0&&e.jsx(Et,{content:`Depends on: ${t.dependencies.map(l=>`Task ${l}`).join(", ")}`,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400",children:[e.jsx(ta,{className:"w-3 h-3"}),e.jsxs("span",{children:["Depends on: ",t.dependencies.join(", ")]})]})})}),e.jsx(Et,{content:`Status: ${i.statusText}`,children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:Se("w-2 h-2 rounded-full",i.iconColor.replace("text-","bg-"))}),e.jsx("span",{className:Se("text-xs font-medium",i.textColor),children:i.statusText})]})})]}),t.subtasks&&t.subtasks.length>0&&e.jsx("div",{className:"ml-3",children:e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Progress:"}),e.jsx(Et,{content:`${t.subtasks.filter(l=>l.status==="done").length} of ${t.subtasks.length} subtasks completed`,children:e.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-1.5",children:e.jsx("div",{className:Se("h-full rounded-full transition-all duration-300",t.status==="done"?"bg-green-500":"bg-blue-500"),style:{width:`${Math.round(t.subtasks.filter(l=>l.status==="done").length/t.subtasks.length*100)}%`}})})}),e.jsx(Et,{content:`${t.subtasks.filter(l=>l.status==="done").length} completed, ${t.subtasks.filter(l=>l.status==="pending").length} pending, ${t.subtasks.filter(l=>l.status==="in-progress").length} in progress`,children:e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[t.subtasks.filter(l=>l.status==="done").length,"/",t.subtasks.length]})})]})})]})},Ef=({currentProject:t,onClose:r,onTaskCreated:n})=>e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create AI-Generated Task"})]}),e.jsx("button",{onClick:r,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(lt,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx(kr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"π‘ Pro Tip: Ask Claude Code Directly!"}),e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"You can simply ask Claude Code in the chat to create tasks for you. The AI assistant will automatically generate detailed tasks with research-backed insights."}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-blue-200 dark:border-blue-700 p-3 mb-3",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Example:"}),e.jsx("p",{className:"text-sm text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),e.jsxs("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:[e.jsx("strong",{children:"This runs:"})," ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900/50 px-1 rounded text-xs",children:'task-master add-task --prompt="Implement user profile image uploads using Cloudinary" --research'})]})]})]})}),e.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),e.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-medium",children:"View TaskMaster Documentation β"})]}),e.jsx("div",{className:"pt-4",children:e.jsx("button",{onClick:r,className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),If=({tasks:t=[],onTaskClick:r,className:n="",showParentTasks:s=!1,defaultView:a="kanban",currentProject:i,onTaskCreated:o,onShowPRDEditor:l,existingPRDs:d=[],onRefreshPRDs:c})=>{const[u,h]=p.useState(""),[x,m]=p.useState("all"),[y,v]=p.useState("all"),[E,A]=p.useState("id"),[T,j]=p.useState("asc"),[W,Z]=p.useState(a),[D,q]=p.useState(!1),[M,_]=p.useState(!1),[R,L]=p.useState(!1),[C,I]=p.useState(!1),[b,z]=p.useState(!1),[K,B]=p.useState(!1),{projectTaskMaster:G,refreshProjects:ie,refreshTasks:N,setCurrentProject:Ie}=dn();p.useEffect(()=>{const ee=oe=>{K&&!oe.target.closest(".relative")&&B(!1)};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[K]);const Fe=p.useMemo(()=>{const ee=new Set(t.map(oe=>oe.status).filter(Boolean));return Array.from(ee).sort()},[t]),f=p.useMemo(()=>{const ee=new Set(t.map(oe=>oe.priority).filter(Boolean));return Array.from(ee).sort()},[t]),te=p.useMemo(()=>{let ee=t.filter(oe=>{const xe=u.toLowerCase(),Ne=!u||oe.title.toLowerCase().includes(xe)||oe.description?.toLowerCase().includes(xe)||oe.id.toString().includes(xe),ye=x==="all"||oe.status===x,Ue=y==="all"||oe.priority===y;return Ne&&ye&&Ue});return ee.sort((oe,xe)=>{let Ne,ye;switch(E){case"title":Ne=oe.title.toLowerCase(),ye=xe.title.toLowerCase();break;case"status":const Ue={pending:1,"in-progress":2,done:3,blocked:4,deferred:5,cancelled:6};Ne=Ue[oe.status]||99,ye=Ue[xe.status]||99;break;case"priority":const Ye={high:3,medium:2,low:1};Ne=Ye[oe.priority]||0,ye=Ye[xe.priority]||0;break;case"updated":Ne=new Date(oe.updatedAt||oe.createdAt||0),ye=new Date(xe.updatedAt||xe.createdAt||0);break;case"id":default:const nt=Me=>Me.toString().split(".").map(it=>parseInt(it,10)),me=nt(oe.id),pe=nt(xe.id);for(let Me=0;Me<Math.max(me.length,pe.length);Me++){const et=me[Me]||0,it=pe[Me]||0;if(et!==it){Ne=et,ye=it;break}}break}return E==="updated"?T==="asc"?Ne-ye:ye-Ne:typeof Ne=="string"?T==="asc"?Ne.localeCompare(ye):ye.localeCompare(Ne):T==="asc"?Ne-ye:ye-Ne}),ee},[t,u,x,y,E,T]),ue=p.useMemo(()=>{const ee=[{id:"pending",title:"π To Do",status:"pending",color:"bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-700",headerColor:"bg-slate-100 dark:bg-slate-800 text-slate-800 dark:text-slate-200"},{id:"in-progress",title:"π In Progress",status:"in-progress",color:"bg-blue-50 dark:bg-blue-900/50 border-blue-200 dark:border-blue-700",headerColor:"bg-blue-100 dark:bg-blue-800 text-blue-800 dark:text-blue-200"},{id:"done",title:"β
Done",status:"done",color:"bg-emerald-50 dark:bg-emerald-900/50 border-emerald-200 dark:border-emerald-700",headerColor:"bg-emerald-100 dark:bg-emerald-800 text-emerald-800 dark:text-emerald-200"},{id:"blocked",title:"π« Blocked",status:"blocked",color:"bg-red-50 dark:bg-red-900/50 border-red-200 dark:border-red-700",headerColor:"bg-red-100 dark:bg-red-800 text-red-800 dark:text-red-200"},{id:"deferred",title:"β³ Deferred",status:"deferred",color:"bg-amber-50 dark:bg-amber-900/50 border-amber-200 dark:border-amber-700",headerColor:"bg-amber-100 dark:bg-amber-800 text-amber-800 dark:text-amber-200"},{id:"cancelled",title:"β Cancelled",status:"cancelled",color:"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700",headerColor:"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200"}],oe=["pending","in-progress","done"];return ee.filter(Ne=>{const ye=te.some(Ye=>Ye.status===Ne.status),Ue=oe.includes(Ne.status);return ye||Ue}).map(Ne=>({...Ne,tasks:te.filter(ye=>ye.status===Ne.status)}))},[te]),re=ee=>{E===ee?j(T==="asc"?"desc":"asc"):(A(ee),j("asc"))},Ce=()=>{h(""),m("all"),v("all")},Be=ee=>E!==ee?e.jsx(gd,{className:"w-4 h-4"}):T==="asc"?e.jsx(bd,{className:"w-4 h-4"}):e.jsx(ko,{className:"w-4 h-4"});if(t.length===0){const ee=i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||G?.hasTaskmaster;return e.jsxs("div",{className:Se("text-center py-12",n),children:[ee?e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-xl border border-blue-200 dark:border-blue-800 p-6 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(Ct,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster is initialized! Here's what to do next:"})]})]}),e.jsxs("div",{className:"space-y-4 text-left",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[e.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"1"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Create a Product Requirements Document (PRD)"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Discuss your project idea and create a PRD that describes what you want to build."}),e.jsxs("button",{onClick:()=>{l?.()},className:"inline-flex items-center gap-1 text-xs bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-2 py-1 rounded hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[e.jsx(Ct,{className:"w-3 h-3"}),"Add PRD"]}),d.length>0&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Existing PRDs:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(oe=>e.jsxs("button",{onClick:async()=>{try{const xe=await Je.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(oe.name)}`);if(xe.ok){const Ne=await xe.json();l?.({name:oe.name,content:Ne.content,isExisting:!0})}else console.error("Failed to load PRD:",xe.statusText)}catch(xe){console.error("Error loading PRD:",xe)}},className:"inline-flex items-center gap-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 px-2 py-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:[e.jsx(Ct,{className:"w-3 h-3"}),oe.name]},oe.name))})]})]})]}),e.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[e.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"2"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Generate Tasks from PRD"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."})]})]}),e.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[e.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Analyze & Expand Tasks"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."})]})]}),e.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[e.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"4"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Start Building"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."})]})]})]}),e.jsx("div",{className:"flex gap-3 pt-4 border-t border-blue-200 dark:border-blue-700",children:e.jsxs("button",{onClick:oe=>{oe.preventDefault(),oe.stopPropagation(),l?.()},className:"flex items-center gap-2 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-colors cursor-pointer",style:{zIndex:10},children:[e.jsx(Ct,{className:"w-4 h-4"}),"Add PRD"]})})]})]}),e.jsx("div",{className:"text-center",children:e.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-2",children:["π‘ ",e.jsx("strong",{children:"Tip:"})," Start with a PRD to get the most out of TaskMaster's AI-powered task generation"]})})]}):e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsx("div",{className:"text-blue-600 dark:text-blue-400 mb-4",children:e.jsx(Pr,{className:"w-12 h-12 mx-auto mb-4"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"TaskMaster AI is not configured"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:"TaskMaster helps break down complex projects into manageable tasks with AI-powered assistance"}),e.jsxs("div",{className:"mb-6 p-4 bg-blue-50 dark:bg-blue-950 rounded-lg text-left",children:[e.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-3",children:"π― What is TaskMaster?"}),e.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),e.jsxs("p",{children:["β’ ",e.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),e.jsxs("button",{onClick:()=>{z(!1),L(!0)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium transition-colors flex items-center gap-2 mx-auto",children:[e.jsx(Lr,{className:"w-4 h-4"}),"Initialize TaskMaster AI"]})]}),R&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center p-4 pt-16 bg-black/50 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(Lr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",i?.displayName]})]})]}),e.jsx("button",{onClick:()=>{L(!1),setTimeout(()=>{ie(),i&&Ie(i)},1e3)},className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:e.jsx(Dt,{className:"w-5 h-5 rotate-45"})})]}),e.jsx("div",{className:"flex-1 p-4",children:e.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",onClick:oe=>{const xe=oe.currentTarget.querySelector(".xterm-screen");xe&&xe.focus()},children:e.jsx(ya,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0,onProcessComplete:oe=>{z(!0),oe===0&&setTimeout(()=>{ie(),i&&Ie(i)},1e3)}})})}),e.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:b?e.jsxs("span",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"TaskMaster setup completed! You can now close this window."]}):"TaskMaster initialization will start automatically"}),e.jsx("button",{onClick:()=>{L(!1),z(!1),setTimeout(()=>{ie(),i&&Ie(i)},1e3)},className:Se("px-4 py-2 text-sm font-medium rounded-md transition-colors",b?"bg-green-600 hover:bg-green-700 text-white":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600"),children:b?"Close & Continue":"Close"})]})})]})})]})}return e.jsxs("div",{className:Se("space-y-4",n),children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(Dr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),e.jsx("input",{type:"text",placeholder:"Search tasks...",value:u,onChange:ee=>h(ee.target.value),className:"pl-10 pr-4 py-2 w-full border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[e.jsx("button",{onClick:()=>Z("kanban"),className:Se("p-2 rounded-md transition-colors",W==="kanban"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Kanban view",children:e.jsx(zd,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>Z("list"),className:Se("p-2 rounded-md transition-colors",W==="list"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"List view",children:e.jsx(Ln,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>Z("grid"),className:Se("p-2 rounded-md transition-colors",W==="grid"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Grid view",children:e.jsx(nu,{className:"w-4 h-4"})})]}),e.jsxs("button",{onClick:()=>q(!D),className:Se("flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",D?"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700 text-blue-700 dark:text-blue-300":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"),children:[e.jsx(Xd,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Filters"}),e.jsx($t,{className:Se("w-4 h-4 transition-transform",D&&"rotate-180")})]}),i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>I(!0),className:"p-2 text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors border border-gray-300 dark:border-gray-600",title:"TaskMaster Getting Started Guide",children:e.jsx(Dd,{className:"w-4 h-4"})}),e.jsx("div",{className:"relative",children:d.length>0?e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>B(!K),className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:`${d.length} PRD${d.length>1?"s":""} available`,children:[e.jsx(Ct,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"PRDs"}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-purple-500 rounded-full min-w-[1.25rem] text-center",children:d.length}),e.jsx($t,{className:Se("w-3 h-3 transition-transform hidden sm:block",K&&"rotate-180")})]}),K&&e.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-xl z-30",children:e.jsxs("div",{className:"p-2",children:[e.jsxs("button",{onClick:()=>{l?.(),B(!1)},className:"w-full text-left px-3 py-2 text-sm font-medium text-purple-700 dark:text-purple-300 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded flex items-center gap-2",children:[e.jsx(Dt,{className:"w-4 h-4"}),"Create New PRD"]}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-1"}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 px-3 py-1 font-medium",children:"Existing PRDs:"}),d.map(ee=>e.jsxs("button",{onClick:async()=>{try{const oe=await Je.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(ee.name)}`);if(oe.ok){const xe=await oe.json();l?.({name:ee.name,content:xe.content,isExisting:!0}),B(!1)}}catch(oe){console.error("Error loading PRD:",oe)}},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded flex items-center gap-2",title:`Modified: ${new Date(ee.modified).toLocaleDateString()}`,children:[e.jsx(Ct,{className:"w-4 h-4"}),e.jsx("span",{className:"truncate",children:ee.name})]},ee.name))]})})]}):e.jsxs("button",{onClick:()=>{l?.()},className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:"Create Product Requirements Document",children:[e.jsx(Ct,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Add PRD"})]})}),(i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||G?.hasTaskmaster||t.length>0)&&e.jsxs("button",{onClick:()=>_(!0),className:"flex items-center gap-2 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium",title:"Add a new task",children:[e.jsx(Dt,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Add Task"})]})]})]})]}),D&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-4 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),e.jsxs("select",{value:x,onChange:ee=>m(ee.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"all",children:"All Statuses"}),Fe.map(ee=>e.jsx("option",{value:ee,children:ee.charAt(0).toUpperCase()+ee.slice(1).replace("-"," ")},ee))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),e.jsxs("select",{value:y,onChange:ee=>v(ee.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"all",children:"All Priorities"}),f.map(ee=>e.jsx("option",{value:ee,children:ee.charAt(0).toUpperCase()+ee.slice(1)},ee))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sort By"}),e.jsxs("select",{value:`${E}-${T}`,onChange:ee=>{const[oe,xe]=ee.target.value.split("-");A(oe),j(xe)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"id-asc",children:"ID (Ascending)"}),e.jsx("option",{value:"id-desc",children:"ID (Descending)"}),e.jsx("option",{value:"title-asc",children:"Title (A-Z)"}),e.jsx("option",{value:"title-desc",children:"Title (Z-A)"}),e.jsx("option",{value:"status-asc",children:"Status (Pending First)"}),e.jsx("option",{value:"status-desc",children:"Status (Done First)"}),e.jsx("option",{value:"priority-asc",children:"Priority (High First)"}),e.jsx("option",{value:"priority-desc",children:"Priority (Low First)"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Showing ",te.length," of ",t.length," tasks"]}),e.jsx("button",{onClick:Ce,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:"Clear Filters"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{onClick:()=>re("id"),className:Se("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",E==="id"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["ID ",Be("id")]}),e.jsxs("button",{onClick:()=>re("status"),className:Se("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",E==="status"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Status ",Be("status")]}),e.jsxs("button",{onClick:()=>re("priority"),className:Se("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",E==="priority"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Priority ",Be("priority")]})]}),te.length===0?e.jsx("div",{className:"text-center py-12",children:e.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:[e.jsx(Dr,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tasks match your filters"}),e.jsx("p",{className:"text-sm",children:"Try adjusting your search or filter criteria."})]})}):W==="kanban"?e.jsx("div",{className:Se("grid gap-6",ue.length===1&&"grid-cols-1 max-w-md mx-auto",ue.length===2&&"grid-cols-1 md:grid-cols-2",ue.length===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",ue.length===4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-4",ue.length===5&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",ue.length>=6&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"),children:ue.map(ee=>e.jsxs("div",{className:Se("rounded-xl border shadow-sm transition-shadow hover:shadow-md",ee.color),children:[e.jsx("div",{className:Se("px-4 py-3 rounded-t-xl border-b",ee.headerColor),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold text-sm",children:ee.title}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-xs font-medium px-2 py-1 bg-white/60 dark:bg-black/20 rounded-full",children:ee.tasks.length})})]})}),e.jsx("div",{className:"p-3 space-y-3 min-h-[200px] max-h-[calc(100vh-300px)] overflow-y-auto",children:ee.tasks.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500",children:[e.jsx("div",{className:"w-8 h-8 mx-auto mb-2 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:e.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-300 dark:bg-gray-600"})}),e.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"No tasks yet"}),e.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:ee.status==="pending"?"Tasks will appear here":ee.status==="in-progress"?"Move tasks here when started":ee.status==="done"?"Completed tasks appear here":"Tasks with this status will appear here"})]}):ee.tasks.map(oe=>e.jsx("div",{className:"transform transition-transform hover:scale-[1.02]",children:e.jsx(Zi,{task:oe,onClick:()=>r?.(oe),showParent:s,className:"w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer"})},oe.id))})]},ee.id))}):e.jsx("div",{className:Se("gap-4",W==="grid"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3":"space-y-4"),children:te.map(ee=>e.jsx(Zi,{task:ee,onClick:()=>r?.(ee),showParent:s,className:W==="grid"?"h-full":""},ee.id))}),M&&e.jsx(Ef,{currentProject:i,onClose:()=>_(!1),onTaskCreated:()=>{_(!1),o&&o()}}),C&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl max-h-[90vh] overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(Ct,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Your guide to productive task management"})]})]}),e.jsx("button",{onClick:()=>I(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e.jsx(lt,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-120px)]",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-blue-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"1"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Create a Product Requirements Document (PRD)"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Discuss your project idea and create a PRD that describes what you want to build."}),e.jsxs("button",{onClick:()=>{l?.(),I(!1)},className:"inline-flex items-center gap-2 text-sm bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-3 py-1.5 rounded-lg hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[e.jsx(Ct,{className:"w-4 h-4"}),"Add PRD"]})]})]}),e.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950/50 dark:to-emerald-950/50 rounded-lg border border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-green-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"2"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Generate Tasks from PRD"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."}),e.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-green-200 dark:border-green-700/50 p-3 mb-2",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"π¬ Example:"}),e.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt. Can you help me parse it and set up the initial tasks?"`})]})]})]}),e.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/50 dark:to-orange-950/50 rounded-lg border border-amber-200 dark:border-amber-800",children:[e.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-amber-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Analyze & Expand Tasks"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."}),e.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-amber-200 dark:border-amber-700/50 p-3 mb-2",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"π¬ Example:"}),e.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Task 5 seems complex. Can you break it down into subtasks?"'})]})]})]}),e.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-950/50 dark:to-pink-950/50 rounded-lg border border-purple-200 dark:border-purple-800",children:[e.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-purple-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"4"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Start Building"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."}),e.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-purple-200 dark:border-purple-700/50 p-3 mb-3",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"π¬ Example:"}),e.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),e.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"View more examples and usage patterns β"})]})]}),e.jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-3",children:"π‘ Pro Tips"}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-2 flex-shrink-0"}),"Use the search bar to quickly find specific tasks"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full mt-2 flex-shrink-0"}),"Switch between Kanban, List, and Grid views using the view toggles"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-purple-500 rounded-full mt-2 flex-shrink-0"}),"Use filters to focus on specific task statuses or priorities"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-orange-500 rounded-full mt-2 flex-shrink-0"}),"Click on any task to view detailed information and manage subtasks"]})]})]}),e.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-3",children:"π Learn More"}),e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"TaskMaster AI is an advanced task management system built for developers. Get documentation, examples, and contribute to the project."}),e.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded-lg font-medium transition-colors",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})})]})})]})},Af=({file:t,onClose:r,projectPath:n,project:s,initialContent:a="",isNewFile:i=!1,onSave:o})=>{const[l,d]=p.useState(a),[c,u]=p.useState(!i),[h,x]=p.useState(!1),[m,y]=p.useState(!1),[v,E]=p.useState(!0),[A,T]=p.useState(!1),[j,W]=p.useState(!1),[Z,D]=p.useState(!0),[q,M]=p.useState(""),[_,R]=p.useState(!1),[L,C]=p.useState(!1),[I,b]=p.useState([]),z=p.useRef(null),K=`# Product Requirements Document - Example Project
|
|
507
|
+
|
|
508
|
+
## 1. Overview
|
|
509
|
+
**Product Name:** AI-Powered Task Manager
|
|
510
|
+
**Version:** 1.0
|
|
511
|
+
**Date:** 2024-12-27
|
|
512
|
+
**Author:** Development Team
|
|
513
|
+
|
|
514
|
+
This document outlines the requirements for building an AI-powered task management application that integrates with development workflows and provides intelligent task breakdown and prioritization.
|
|
515
|
+
|
|
516
|
+
## 2. Objectives
|
|
517
|
+
- Create an intuitive task management system that works seamlessly with developer tools
|
|
518
|
+
- Provide AI-powered task generation from high-level requirements
|
|
519
|
+
- Enable real-time collaboration and progress tracking
|
|
520
|
+
- Integrate with popular development environments (VS Code, Cursor, etc.)
|
|
521
|
+
|
|
522
|
+
### Success Metrics
|
|
523
|
+
- User adoption rate > 80% within development teams
|
|
524
|
+
- Task completion rate improvement of 25%
|
|
525
|
+
- Time-to-delivery reduction of 15%
|
|
526
|
+
|
|
527
|
+
## 3. User Stories
|
|
528
|
+
|
|
529
|
+
### Core Functionality
|
|
530
|
+
- As a project manager, I want to create PRDs that automatically generate detailed tasks so I can save time on project planning
|
|
531
|
+
- As a developer, I want to see my next task clearly highlighted so I can maintain focus
|
|
532
|
+
- As a team lead, I want to track progress across multiple projects so I can provide accurate status updates
|
|
533
|
+
- As a developer, I want tasks to be broken down into implementable subtasks so I can work more efficiently
|
|
534
|
+
|
|
535
|
+
### AI Integration
|
|
536
|
+
- As a user, I want to describe a feature in natural language and get detailed implementation tasks so I can start working immediately
|
|
537
|
+
- As a project manager, I want the AI to analyze task complexity and suggest appropriate time estimates
|
|
538
|
+
- As a developer, I want intelligent task prioritization based on dependencies and deadlines
|
|
539
|
+
|
|
540
|
+
### Collaboration
|
|
541
|
+
- As a team member, I want to see real-time updates when tasks are completed so I can coordinate my work
|
|
542
|
+
- As a stakeholder, I want to view project progress through intuitive dashboards
|
|
543
|
+
- As a developer, I want to add implementation notes to tasks for future reference
|
|
544
|
+
|
|
545
|
+
## 4. Functional Requirements
|
|
546
|
+
|
|
547
|
+
### Task Management
|
|
548
|
+
- Create, edit, and delete tasks with rich metadata (priority, status, dependencies, estimates)
|
|
549
|
+
- Hierarchical task structure with subtasks and sub-subtasks
|
|
550
|
+
- Real-time status updates and progress tracking
|
|
551
|
+
- Dependency management with circular dependency detection
|
|
552
|
+
- Bulk operations (move, update status, assign)
|
|
553
|
+
|
|
554
|
+
### AI Features
|
|
555
|
+
- Natural language PRD parsing to generate structured tasks
|
|
556
|
+
- Intelligent task breakdown with complexity analysis
|
|
557
|
+
- Automated subtask generation with implementation details
|
|
558
|
+
- Smart dependency suggestion
|
|
559
|
+
- Progress prediction based on historical data
|
|
560
|
+
|
|
561
|
+
### Integration Features
|
|
562
|
+
- VS Code/Cursor extension for in-editor task management
|
|
563
|
+
- Git integration for linking commits to tasks
|
|
564
|
+
- API for third-party tool integration
|
|
565
|
+
- Webhook support for external notifications
|
|
566
|
+
- CLI tool for command-line task management
|
|
567
|
+
|
|
568
|
+
### User Interface
|
|
569
|
+
- Responsive web application (desktop and mobile)
|
|
570
|
+
- Multiple view modes (Kanban, list, calendar)
|
|
571
|
+
- Dark/light theme support
|
|
572
|
+
- Drag-and-drop task organization
|
|
573
|
+
- Advanced filtering and search capabilities
|
|
574
|
+
- Keyboard shortcuts for power users
|
|
575
|
+
|
|
576
|
+
## 5. Technical Requirements
|
|
577
|
+
|
|
578
|
+
### Frontend
|
|
579
|
+
- React.js with TypeScript for type safety
|
|
580
|
+
- Modern UI framework (Tailwind CSS)
|
|
581
|
+
- State management (Context API or Redux)
|
|
582
|
+
- Real-time updates via WebSockets
|
|
583
|
+
- Progressive Web App (PWA) support
|
|
584
|
+
- Accessibility compliance (WCAG 2.1 AA)
|
|
585
|
+
|
|
586
|
+
### Backend
|
|
587
|
+
- Node.js with Express.js framework
|
|
588
|
+
- RESTful API design with OpenAPI documentation
|
|
589
|
+
- Real-time communication via Socket.io
|
|
590
|
+
- Background job processing
|
|
591
|
+
- Rate limiting and security middleware
|
|
592
|
+
|
|
593
|
+
### AI Integration
|
|
594
|
+
- Integration with multiple AI providers (OpenAI, Anthropic, etc.)
|
|
595
|
+
- Fallback model support
|
|
596
|
+
- Context-aware prompt engineering
|
|
597
|
+
- Token usage optimization
|
|
598
|
+
- Model response caching
|
|
599
|
+
|
|
600
|
+
### Database
|
|
601
|
+
- Primary: PostgreSQL for relational data
|
|
602
|
+
- Cache: Redis for session management and real-time features
|
|
603
|
+
- Full-text search capabilities
|
|
604
|
+
- Database migrations and seeding
|
|
605
|
+
- Backup and recovery procedures
|
|
606
|
+
|
|
607
|
+
### Infrastructure
|
|
608
|
+
- Docker containerization
|
|
609
|
+
- Cloud deployment (AWS/GCP/Azure)
|
|
610
|
+
- Auto-scaling capabilities
|
|
611
|
+
- Monitoring and logging (structured logging)
|
|
612
|
+
- CI/CD pipeline with automated testing
|
|
613
|
+
|
|
614
|
+
## 6. Non-Functional Requirements
|
|
615
|
+
|
|
616
|
+
### Performance
|
|
617
|
+
- Page load time < 2 seconds
|
|
618
|
+
- API response time < 500ms for 95% of requests
|
|
619
|
+
- Support for 1000+ concurrent users
|
|
620
|
+
- Efficient handling of large task lists (10,000+ tasks)
|
|
621
|
+
|
|
622
|
+
### Security
|
|
623
|
+
- JWT-based authentication with refresh tokens
|
|
624
|
+
- Role-based access control (RBAC)
|
|
625
|
+
- Data encryption at rest and in transit
|
|
626
|
+
- Regular security audits and penetration testing
|
|
627
|
+
- GDPR and privacy compliance
|
|
628
|
+
|
|
629
|
+
### Reliability
|
|
630
|
+
- 99.9% uptime SLA
|
|
631
|
+
- Graceful error handling and recovery
|
|
632
|
+
- Data backup every 6 hours with point-in-time recovery
|
|
633
|
+
- Disaster recovery plan with RTO < 4 hours
|
|
634
|
+
|
|
635
|
+
### Scalability
|
|
636
|
+
- Horizontal scaling for both frontend and backend
|
|
637
|
+
- Database read replicas for query optimization
|
|
638
|
+
- CDN for static asset delivery
|
|
639
|
+
- Microservices architecture for future expansion
|
|
640
|
+
|
|
641
|
+
## 7. User Experience Design
|
|
642
|
+
|
|
643
|
+
### Information Architecture
|
|
644
|
+
- Intuitive navigation with breadcrumbs
|
|
645
|
+
- Context-aware menus and actions
|
|
646
|
+
- Progressive disclosure of complex features
|
|
647
|
+
- Consistent design patterns throughout
|
|
648
|
+
|
|
649
|
+
### Interaction Design
|
|
650
|
+
- Smooth animations and transitions
|
|
651
|
+
- Immediate feedback for user actions
|
|
652
|
+
- Undo/redo functionality for critical operations
|
|
653
|
+
- Smart defaults and auto-save features
|
|
654
|
+
|
|
655
|
+
### Visual Design
|
|
656
|
+
- Modern, clean interface with plenty of whitespace
|
|
657
|
+
- Consistent color scheme and typography
|
|
658
|
+
- Clear visual hierarchy with proper contrast ratios
|
|
659
|
+
- Iconography that supports comprehension
|
|
660
|
+
|
|
661
|
+
## 8. Integration Requirements
|
|
662
|
+
|
|
663
|
+
### Development Tools
|
|
664
|
+
- VS Code extension with task panel and quick actions
|
|
665
|
+
- Cursor IDE integration with AI task suggestions
|
|
666
|
+
- Terminal CLI for command-line workflow
|
|
667
|
+
- Browser extension for web-based tools
|
|
668
|
+
|
|
669
|
+
### Third-Party Services
|
|
670
|
+
- GitHub/GitLab integration for issue sync
|
|
671
|
+
- Slack/Discord notifications
|
|
672
|
+
- Calendar integration (Google Calendar, Outlook)
|
|
673
|
+
- Time tracking tools (Toggl, Harvest)
|
|
674
|
+
|
|
675
|
+
### APIs and Webhooks
|
|
676
|
+
- RESTful API with comprehensive documentation
|
|
677
|
+
- GraphQL endpoint for complex queries
|
|
678
|
+
- Webhook system for external integrations
|
|
679
|
+
- SDK development for major programming languages
|
|
680
|
+
|
|
681
|
+
## 9. Implementation Phases
|
|
682
|
+
|
|
683
|
+
### Phase 1: Core MVP (8-10 weeks)
|
|
684
|
+
- Basic task management (CRUD operations)
|
|
685
|
+
- Simple AI task generation
|
|
686
|
+
- Web interface with essential features
|
|
687
|
+
- User authentication and basic permissions
|
|
688
|
+
|
|
689
|
+
### Phase 2: Enhanced Features (6-8 weeks)
|
|
690
|
+
- Advanced AI features (complexity analysis, subtask generation)
|
|
691
|
+
- Real-time collaboration
|
|
692
|
+
- Mobile-responsive design
|
|
693
|
+
- Integration with one development tool (VS Code)
|
|
694
|
+
|
|
695
|
+
### Phase 3: Enterprise Features (4-6 weeks)
|
|
696
|
+
- Advanced user management and permissions
|
|
697
|
+
- API and webhook system
|
|
698
|
+
- Performance optimization
|
|
699
|
+
- Comprehensive testing and security audit
|
|
700
|
+
|
|
701
|
+
### Phase 4: Ecosystem Expansion (4-6 weeks)
|
|
702
|
+
- Additional tool integrations
|
|
703
|
+
- Mobile app development
|
|
704
|
+
- Advanced analytics and reporting
|
|
705
|
+
- Third-party marketplace preparation
|
|
706
|
+
|
|
707
|
+
## 10. Risk Assessment
|
|
708
|
+
|
|
709
|
+
### Technical Risks
|
|
710
|
+
- AI model reliability and cost management
|
|
711
|
+
- Real-time synchronization complexity
|
|
712
|
+
- Database performance with large datasets
|
|
713
|
+
- Integration complexity with multiple tools
|
|
714
|
+
|
|
715
|
+
### Business Risks
|
|
716
|
+
- User adoption in competitive market
|
|
717
|
+
- AI provider dependency
|
|
718
|
+
- Data privacy and security concerns
|
|
719
|
+
- Feature scope creep and timeline delays
|
|
720
|
+
|
|
721
|
+
### Mitigation Strategies
|
|
722
|
+
- Implement robust error handling and fallback systems
|
|
723
|
+
- Develop comprehensive testing strategy
|
|
724
|
+
- Create detailed documentation and user guides
|
|
725
|
+
- Establish clear project scope and change management process
|
|
726
|
+
|
|
727
|
+
## 11. Success Criteria
|
|
728
|
+
|
|
729
|
+
### Development Milestones
|
|
730
|
+
- Alpha version with core features completed
|
|
731
|
+
- Beta version with selected user group feedback
|
|
732
|
+
- Production-ready version with full feature set
|
|
733
|
+
- Post-launch iterations based on user feedback
|
|
734
|
+
|
|
735
|
+
### Business Metrics
|
|
736
|
+
- User engagement and retention rates
|
|
737
|
+
- Task completion and productivity metrics
|
|
738
|
+
- Customer satisfaction scores (NPS > 50)
|
|
739
|
+
- Revenue targets and subscription growth
|
|
740
|
+
|
|
741
|
+
## 12. Appendices
|
|
742
|
+
|
|
743
|
+
### Glossary
|
|
744
|
+
- **PRD**: Product Requirements Document
|
|
745
|
+
- **AI**: Artificial Intelligence
|
|
746
|
+
- **CRUD**: Create, Read, Update, Delete
|
|
747
|
+
- **API**: Application Programming Interface
|
|
748
|
+
- **CI/CD**: Continuous Integration/Continuous Deployment
|
|
749
|
+
|
|
750
|
+
### References
|
|
751
|
+
- Industry best practices for task management
|
|
752
|
+
- AI integration patterns and examples
|
|
753
|
+
- Security and compliance requirements
|
|
754
|
+
- Performance benchmarking data
|
|
755
|
+
|
|
756
|
+
---
|
|
757
|
+
|
|
758
|
+
**Document Control:**
|
|
759
|
+
- Version: 1.0
|
|
760
|
+
- Last Updated: December 27, 2024
|
|
761
|
+
- Next Review: January 15, 2025
|
|
762
|
+
- Approved By: Product Owner, Technical Lead`;p.useEffect(()=>{(async()=>{if(t?.name)M(t.name.replace(/\.(txt|md)$/,""));else if(i){const ue=new Date().toISOString().split("T")[0];M(`prd-${ue}`)}if(i){d(K),u(!1);return}if(t.content){d(t.content),u(!1);return}try{u(!0);const te=await Je.readFile(t.projectName,t.path);if(!te.ok)throw new Error(`Failed to load file: ${te.status} ${te.statusText}`);const ue=await te.json();d(ue.content||K)}catch(te){console.error("Error loading PRD file:",te),d(`# Error Loading PRD
|
|
763
|
+
|
|
764
|
+
Error: ${te.message}
|
|
765
|
+
|
|
766
|
+
File: ${t?.name||"New PRD"}
|
|
767
|
+
Path: ${t?.path||"Not saved yet"}
|
|
768
|
+
|
|
769
|
+
${K}`)}finally{u(!1)}})()},[t,n,i]),p.useEffect(()=>{(async()=>{if(!s?.name){console.log("No project name available:",s);return}try{console.log("Fetching PRDs for project:",s.name);const te=await Je.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(te.ok){const ue=await te.json();console.log("Fetched existing PRDs:",ue.prds),b(ue.prds||[])}else console.log("Failed to fetch PRDs:",te.status,te.statusText)}catch(te){console.error("Error fetching existing PRDs:",te)}})()},[s?.name]);const B=async()=>{if(!l.trim()){alert("Please add content before saving.");return}if(!q.trim()){alert("Please provide a filename for the PRD.");return}const f=q.endsWith(".txt")||q.endsWith(".md")?q:`${q}.txt`,te=I.find(ue=>ue.name===f);if(console.log("Save check:",{fullFileName:f,existingPRDs:I,existingFile:te,isExisting:t?.isExisting,fileObject:t,shouldShowModal:te&&!t?.isExisting}),te&&!t?.isExisting){console.log("Showing overwrite confirmation modal"),C(!0);return}await G()},G=async()=>{x(!0);try{const f=q.endsWith(".txt")||q.endsWith(".md")?q:`${q}.txt`,te=await Re(`/api/taskmaster/prd/${encodeURIComponent(s?.name)}`,{method:"POST",body:JSON.stringify({fileName:f,content:l})});if(!te.ok){const re=await te.json();throw new Error(re.message||`Save failed: ${te.status}`)}T(!0),setTimeout(()=>T(!1),2e3);const ue=await Je.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(ue.ok){const re=await ue.json();b(re.prds||[])}o&&await o()}catch(f){console.error("Error saving PRD:",f),alert(`Error saving PRD: ${f.message}`)}finally{x(!1)}},ie=()=>{const f=new Blob([l],{type:"text/markdown"}),te=URL.createObjectURL(f),ue=document.createElement("a");ue.href=te;const re=q?`${q}.txt`:"prd.txt";ue.download=re,document.body.appendChild(ue),ue.click(),document.body.removeChild(ue),URL.revokeObjectURL(te)},N=async()=>{if(!l.trim()){alert("Please add content to the PRD before generating tasks.");return}R(!0)},Ie=()=>{y(!m)};p.useEffect(()=>{const f=te=>{(te.ctrlKey||te.metaKey)&&(te.key==="s"?(te.preventDefault(),B()):te.key==="Escape"&&(te.preventDefault(),r()))};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[l]);const Fe=f=>f.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/^\- (.*$)/gim,"<li>$1</li>").replace(/(<li>.*<\/li>)/gims,"<ul>$1</ul>").replace(/\n\n/gim,"</p><p>").replace(/^(?!<[h|u|l])(.*$)/gim,"<p>$1</p>").replace(/<\/ul>\s*<ul>/gim,"");return c?e.jsx("div",{className:"fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center",children:e.jsx("div",{className:"w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center bg-white dark:bg-gray-900",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading PRD..."})]})})}):e.jsxs("div",{className:`fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${m?"md:p-0":""}`,children:[e.jsxs("div",{className:Se("bg-white dark:bg-gray-900 shadow-2xl flex flex-col","w-full h-full md:rounded-lg md:shadow-2xl",m?"md:w-full md:h-full md:rounded-none":"md:w-full md:max-w-6xl md:h-[85vh] md:max-h-[85vh]"),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-600 rounded flex items-center justify-center flex-shrink-0",children:e.jsx(Ct,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center min-w-0 flex-1 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md px-3 py-2 focus-within:ring-2 focus-within:ring-purple-500 focus-within:border-purple-500 dark:focus-within:ring-purple-400 dark:focus-within:border-purple-400",children:[e.jsx("input",{type:"text",value:q,onChange:f=>{const te=f.target.value.replace(/[<>:"/\\|?*]/g,"");M(te)},className:"font-medium text-gray-900 dark:text-white bg-transparent border-none outline-none min-w-0 flex-1 text-base sm:text-sm placeholder-gray-400 dark:placeholder-gray-500",placeholder:"Enter PRD filename",maxLength:100}),e.jsx("span",{className:"text-sm sm:text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap ml-1",children:".txt"})]}),e.jsx("button",{onClick:()=>document.querySelector('input[placeholder="Enter PRD filename"]')?.focus(),className:"p-1 text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:"Click to edit filename",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("span",{className:"text-xs bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 px-2 py-1 rounded whitespace-nowrap",children:"π PRD"}),i&&e.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-300 px-2 py-1 rounded whitespace-nowrap",children:"β¨ New"})]})]}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:"Product Requirements Document"})]})]}),e.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:()=>W(!j),className:Se("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",j?"text-purple-600 dark:text-purple-400 bg-purple-50 dark:bg-purple-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:j?"Switch to edit mode":"Preview markdown",children:e.jsx(cn,{className:"w-5 h-5 md:w-4 md:h-4"})}),e.jsx("button",{onClick:()=>D(!Z),className:Se("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",Z?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:Z?"Disable word wrap":"Enable word wrap",children:e.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"β΅"})}),e.jsx("button",{onClick:()=>E(!v),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:e.jsx("span",{className:"text-lg md:text-base",children:v?"βοΈ":"π"})}),e.jsx("button",{onClick:ie,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download PRD",children:e.jsx(Pn,{className:"w-5 h-5 md:w-4 md:h-4"})}),e.jsxs("button",{onClick:N,disabled:!l.trim(),className:Se("px-3 py-2 rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors text-sm font-medium","bg-purple-600 hover:bg-purple-700 text-white","min-h-[44px] md:min-h-0"),title:"Generate tasks from PRD content",children:[e.jsx(kr,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden md:inline",children:"Generate Tasks"})]}),e.jsx("button",{onClick:B,disabled:h,className:Se("px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors","min-h-[44px] md:min-h-0",A?"bg-green-600 hover:bg-green-700":"bg-purple-600 hover:bg-purple-700"),children:A?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Rn,{className:"w-5 h-5 md:w-4 md:h-4"}),e.jsx("span",{className:"hidden sm:inline",children:h?"Saving...":"Save PRD"})]})}),e.jsx("button",{onClick:Ie,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:m?"Exit fullscreen":"Fullscreen",children:m?e.jsx(jo,{className:"w-4 h-4"}):e.jsx(na,{className:"w-4 h-4"})}),e.jsx("button",{onClick:r,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:e.jsx(lt,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:j?e.jsx("div",{className:"h-full overflow-y-auto p-6 prose prose-gray dark:prose-invert max-w-none",children:e.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:Fe(l)}})}):e.jsx(ro,{ref:z,value:l,onChange:d,extensions:[so(),...Z?[Mn.lineWrapping]:[]],theme:v?no:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),e.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:["Lines: ",l.split(`
|
|
770
|
+
`).length]}),e.jsxs("span",{children:["Characters: ",l.length]}),e.jsxs("span",{children:["Words: ",l.split(/\s+/).filter(f=>f.length>0).length]}),e.jsx("span",{children:"Format: Markdown"})]}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save β’ Esc to close"})]})]}),_&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),e.jsx("button",{onClick:()=>R(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(lt,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx(kr,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"π‘ Pro Tip: Ask Claude Code Directly!"}),e.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask Claude Code in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"π¬ Example:"}),e.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,q.endsWith(".txt")||q.endsWith(".md")?q:`${q}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),e.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[e.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),e.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),e.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation β"})]}),e.jsx("div",{className:"pt-4",children:e.jsx("button",{onClick:()=>R(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),L&&e.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>C(!1)}),e.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center mb-4",children:[e.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:e.jsx(Xr,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',q.endsWith(".txt")||q.endsWith(".md")?q:`${q}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:()=>C(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:async()=>{C(!1),await G()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[e.jsx(Rn,{className:"w-4 h-4"}),e.jsx("span",{children:"Overwrite"})]})]})]})})]})]})};function Mf({selectedProject:t,selectedSession:r,activeTab:n,setActiveTab:s,ws:a,sendMessage:i,messages:o,isMobile:l,isPWA:d,onMenuClick:c,isLoading:u,onInputFocusChange:h,onSessionActive:x,onSessionInactive:m,onSessionProcessing:y,onSessionNotProcessing:v,processingSessions:E,onReplaceTemporarySession:A,onNavigateToSession:T,onShowSettings:j,autoExpandTools:W,showRawParameters:Z,showThinking:D,autoScrollToBottom:q,sendByCtrlEnter:M,externalMessageUpdate:_}){const[R,L]=p.useState(null),[C,I]=p.useState(null),[b,z]=p.useState(!1),[K,B]=p.useState(!1),[G,ie]=p.useState(null),[N,Ie]=p.useState([]),[Fe,f]=p.useState(null),{tasks:te,currentProject:ue,refreshTasks:re,setCurrentProject:Ce}=dn(),{tasksEnabled:Be,isTaskMasterInstalled:ee,isTaskMasterReady:oe}=un(),xe=Be&ⅇp.useEffect(()=>{t&&t!==ue&&Ce(t)},[t,ue,Ce]),p.useEffect(()=>{!xe&&n==="tasks"&&s("chat")},[xe,n,s]),p.useEffect(()=>{(async()=>{if(!ue?.name){Ie([]);return}try{const pe=await Je.get(`/taskmaster/prd/${encodeURIComponent(ue.name)}`);if(pe.ok){const Me=await pe.json();Ie(Me.prdFiles||[])}else Ie([])}catch(pe){console.error("Failed to load existing PRDs:",pe),Ie([])}})()},[ue?.name]);const Ne=(me,pe=null)=>{const Me={name:me.split("/").pop(),path:me,projectName:t?.name,diffInfo:pe};L(Me)},ye=()=>{L(null)},Ue=me=>{if(typeof me=="object"&&me.id&&!me.title){const pe=te?.find(Me=>Me.id===me.id);pe&&(I(pe),z(!0))}else I(me),z(!0)},Ye=()=>{z(!1),I(null)},nt=(me,pe)=>{console.log("Update task status:",me,pe),re?.()};return u?e.jsxs("div",{className:"h-full flex flex-col",children:[l&&e.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:e.jsx("button",{onClick:c,className:"p-1.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:e.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Loading Claude Code UI"}),e.jsx("p",{children:"Setting up your workspace..."})]})})]}):t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2 sm:space-x-3",children:[l&&e.jsx("button",{onClick:c,onTouchStart:me=>{me.preventDefault(),c()},className:"p-2.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button",children:e.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),e.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[n==="chat"&&r&&e.jsx("div",{className:"w-6 h-6 flex-shrink-0 flex items-center justify-center",children:r.__provider==="cursor"?e.jsx(Zt,{className:"w-5 h-5"}):e.jsx(Vt,{className:"w-5 h-5"})}),e.jsx("div",{className:"flex-1 min-w-0",children:n==="chat"&&r?e.jsxs("div",{children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white truncate",children:r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session"}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:[t.displayName," ",e.jsxs("span",{className:"hidden sm:inline",children:["β’ ",r.id]})]})]}):n==="chat"&&!r?e.jsxs("div",{children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white",children:"New Session"}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:t.displayName})]}):e.jsxs("div",{children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white",children:n==="files"?"Project Files":n==="git"?"Source Control":n==="tasks"&&xe?"TaskMaster":"Project"}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:t.displayName})]})})]})]}),e.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:e.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[e.jsx(Et,{content:"Chat",position:"bottom",children:e.jsx("button",{onClick:()=>s("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${n==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Chat"})]})})}),e.jsx(Et,{content:"Shell",position:"bottom",children:e.jsx("button",{onClick:()=>s("shell"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="shell"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Shell"})]})})}),e.jsx(Et,{content:"Files",position:"bottom",children:e.jsx("button",{onClick:()=>s("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Files"})]})})}),e.jsx(Et,{content:"Source Control",position:"bottom",children:e.jsx("button",{onClick:()=>s("git"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="git"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Source Control"})]})})}),xe&&e.jsx(Et,{content:"Tasks",position:"bottom",children:e.jsx("button",{onClick:()=>s("tasks"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="tasks"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Tasks"})]})})})]})})]})}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[e.jsx("div",{className:`h-full ${n==="chat"?"block":"hidden"}`,children:e.jsx(Cf,{showDetails:!0,children:e.jsx(wf,{selectedProject:t,selectedSession:r,ws:a,sendMessage:i,messages:o,onFileOpen:Ne,onInputFocusChange:h,onSessionActive:x,onSessionInactive:m,onSessionProcessing:y,onSessionNotProcessing:v,processingSessions:E,onReplaceTemporarySession:A,onNavigateToSession:T,onShowSettings:j,autoExpandTools:W,showRawParameters:Z,showThinking:D,autoScrollToBottom:q,sendByCtrlEnter:M,externalMessageUpdate:_,onShowAllTasks:Be?()=>s("tasks"):null})})}),e.jsx("div",{className:`h-full overflow-hidden ${n==="files"?"block":"hidden"}`,children:e.jsx(Nf,{selectedProject:t})}),e.jsx("div",{className:`h-full overflow-hidden ${n==="shell"?"block":"hidden"}`,children:e.jsx(zl,{project:t,session:r,isActive:n==="shell",showHeader:!1})}),e.jsx("div",{className:`h-full overflow-hidden ${n==="git"?"block":"hidden"}`,children:e.jsx(Sf,{selectedProject:t,isMobile:l})}),xe&&e.jsx("div",{className:`h-full ${n==="tasks"?"block":"hidden"}`,children:e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx(If,{tasks:te||[],onTaskClick:Ue,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:ue,onTaskCreated:re,onShowPRDEditor:(me=null)=>{ie(me),B(!0)},existingPRDs:N,onRefreshPRDs:(me=!1)=>{ue?.name&&Je.get(`/taskmaster/prd/${encodeURIComponent(ue.name)}`).then(pe=>pe.ok?pe.json():Promise.reject()).then(pe=>{Ie(pe.prdFiles||[]),me&&(f("PRD saved successfully!"),setTimeout(()=>f(null),3e3))}).catch(pe=>console.error("Failed to refresh PRDs:",pe))}})})}),e.jsx("div",{className:`h-full overflow-hidden ${n==="preview"?"block":"hidden"}`})]}),R&&e.jsx(Rl,{file:R,onClose:ye,projectPath:t?.path}),xe&&b&&C&&e.jsx(Nl,{task:C,isOpen:b,onClose:Ye,onStatusChange:nt,onTaskClick:Ue}),K&&e.jsx(Af,{project:ue,projectPath:ue?.fullPath||ue?.path,onClose:()=>{B(!1),ie(null)},isNewFile:!G?.isExisting,file:{name:G?.name||"prd.txt",content:G?.content||""},onSave:async()=>{B(!1),ie(null);try{const me=await Je.get(`/taskmaster/prd/${encodeURIComponent(ue.name)}`);if(me.ok){const pe=await me.json();Ie(pe.prdFiles||[]),f("PRD saved successfully!"),setTimeout(()=>f(null),3e3)}}catch(me){console.error("Failed to refresh PRDs:",me)}re?.()}}),Fe&&e.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:e.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{className:"font-medium",children:Fe})]})})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[l&&e.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:e.jsx("button",{onClick:c,className:"p-1.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),e.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:"Choose Your Project"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:"Select a project from the sidebar to start coding with Claude. Each project contains your chat sessions and file history."}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:e.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["π‘ ",e.jsx("strong",{children:"Tip:"})," ",l?"Tap the menu button above to access projects":"Create a new project by clicking the folder icon in the sidebar"]})})]})})]})}const Tf=lr.memo(Mf);function Df({activeTab:t,setActiveTab:r,isInputFocused:n}){const{tasksEnabled:s}=un(),a=document.documentElement.classList.contains("dark"),i=[{id:"chat",icon:nn,onClick:()=>r("chat")},{id:"shell",icon:Lr,onClick:()=>r("shell")},{id:"files",icon:Wt,onClick:()=>r("files")},{id:"git",icon:Is,onClick:()=>r("git")},...s?[{id:"tasks",icon:_u,onClick:()=>r("tasks")}]:[]];return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
|
|
771
|
+
.mobile-nav-container {
|
|
772
|
+
background-color: ${a?"#1f2937":"#ffffff"} !important;
|
|
773
|
+
}
|
|
774
|
+
.mobile-nav-container:hover {
|
|
775
|
+
background-color: ${a?"#1f2937":"#ffffff"} !important;
|
|
776
|
+
}
|
|
777
|
+
`}),e.jsx("div",{className:`mobile-nav-container fixed bottom-0 left-0 right-0 border-t border-gray-200 dark:border-gray-700 z-50 ios-bottom-safe transform transition-transform duration-300 ease-in-out shadow-lg ${n?"translate-y-full":"translate-y-0"}`,children:e.jsx("div",{className:"flex items-center justify-around py-1",children:i.map(o=>{const l=o.icon,d=t===o.id;return e.jsxs("button",{onClick:o.onClick,onTouchStart:c=>{c.preventDefault(),o.onClick()},className:`flex items-center justify-center p-2 rounded-lg min-h-[40px] min-w-[40px] relative touch-manipulation ${d?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,"aria-label":o.id,children:[e.jsx(l,{className:"w-5 h-5"}),d&&e.jsx("div",{className:"absolute top-0 left-1/2 transform -translate-x-1/2 w-6 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-full"})]},o.id)})})})]})}const _l=p.createContext(),va=()=>{const t=p.useContext(_l);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t},Pf=({children:t})=>{const[r,n]=p.useState(()=>{const i=localStorage.getItem("theme");return i?i==="dark":window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1});p.useEffect(()=>{if(r){document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark");const i=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');i&&i.setAttribute("content","black-translucent");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#0c1117")}else{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const i=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');i&&i.setAttribute("content","default");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#ffffff")}},[r]),p.useEffect(()=>{if(!window.matchMedia)return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=l=>{localStorage.getItem("theme")||n(l.matches)};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]);const a={isDarkMode:r,toggleDarkMode:()=>{n(i=>!i)}};return e.jsx(_l.Provider,{value:a,children:t})};function Lf({isOpen:t,onClose:r,projects:n=[]}){const{isDarkMode:s,toggleDarkMode:a}=va(),{tasksEnabled:i,setTasksEnabled:o,isTaskMasterInstalled:l,isTaskMasterReady:d,installationStatus:c,isCheckingInstallation:u}=un(),[h,x]=p.useState([]),[m,y]=p.useState([]),[v,E]=p.useState(""),[A,T]=p.useState(""),[j,W]=p.useState(!1),[Z,D]=p.useState(!1),[q,M]=p.useState(null),[_,R]=p.useState("name"),[L,C]=p.useState([]),[I,b]=p.useState(!1),[z,K]=p.useState(null),[B,G]=p.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[ie,N]=p.useState(!1),[Ie,Fe]=p.useState({}),[f,te]=p.useState({}),[ue,re]=p.useState({}),[Ce,Be]=p.useState("tools"),[ee,oe]=p.useState(""),[xe,Ne]=p.useState("claude"),[ye,Ue]=p.useState([]),[Ye,nt]=p.useState([]),[me,pe]=p.useState(!1),[Me,et]=p.useState(""),[it,ge]=p.useState(""),[wt,X]=p.useState([]),[ke,k]=p.useState(!1),[P,J]=p.useState(""),[se,le]=p.useState(null),Le=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],De=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"],Ge=async()=>{try{const S=localStorage.getItem("auth-token"),ae=await fetch("/api/cursor/mcp",{headers:{Authorization:`Bearer ${S}`,"Content-Type":"application/json"}});if(ae.ok){const Ae=await ae.json();X(Ae.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(S){console.error("Error fetching Cursor MCP servers:",S)}},mt=async()=>{try{const S=localStorage.getItem("auth-token"),ae=await fetch("/api/mcp/config/read",{headers:{Authorization:`Bearer ${S}`,"Content-Type":"application/json"}});if(ae.ok){const at=await ae.json();if(at.success&&at.servers){C(at.servers);return}}const Ae=await fetch("/api/mcp/cli/list",{headers:{Authorization:`Bearer ${S}`,"Content-Type":"application/json"}});if(Ae.ok){const at=await Ae.json();if(at.success&&at.servers){const kt=at.servers.map(tt=>({id:tt.name,name:tt.name,type:tt.type,scope:"user",config:{command:tt.command||"",args:tt.args||[],env:tt.env||{},url:tt.url||"",headers:tt.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));C(kt);return}}const We=await fetch("/api/mcp/servers?scope=user",{headers:{Authorization:`Bearer ${S}`,"Content-Type":"application/json"}});if(We.ok){const at=await We.json();C(at.servers||[])}else console.error("Failed to fetch MCP servers")}catch(S){console.error("Error fetching MCP servers:",S)}},Ze=async S=>{try{const ae=localStorage.getItem("auth-token");z&&await st(z.id,"user");const Ae=await fetch("/api/mcp/cli/add",{method:"POST",headers:{Authorization:`Bearer ${ae}`,"Content-Type":"application/json"},body:JSON.stringify({name:S.name,type:S.type,scope:S.scope,projectPath:S.projectPath,command:S.config?.command,args:S.config?.args||[],url:S.config?.url,headers:S.config?.headers||{},env:S.config?.env||{}})});if(Ae.ok){const We=await Ae.json();if(We.success)return await mt(),!0;throw new Error(We.error||"Failed to save server via Claude CLI")}else{const We=await Ae.json();throw new Error(We.error||"Failed to save server")}}catch(ae){throw console.error("Error saving MCP server:",ae),ae}},st=async(S,ae="user")=>{try{const Ae=localStorage.getItem("auth-token"),We=await fetch(`/api/mcp/cli/remove/${S}?scope=${ae}`,{method:"DELETE",headers:{Authorization:`Bearer ${Ae}`,"Content-Type":"application/json"}});if(We.ok){const at=await We.json();if(at.success)return await mt(),!0;throw new Error(at.error||"Failed to delete server via Claude CLI")}else{const at=await We.json();throw new Error(at.error||"Failed to delete server")}}catch(Ae){throw console.error("Error deleting MCP server:",Ae),Ae}};p.useEffect(()=>{t&&ht()},[t]);const ht=async()=>{try{const S=localStorage.getItem("claude-settings");if(S){const Ae=JSON.parse(S);x(Ae.allowedTools||[]),y(Ae.disallowedTools||[]),W(Ae.skipPermissions||!1),R(Ae.projectSortOrder||"name")}else x([]),y([]),W(!1),R("name");const ae=localStorage.getItem("cursor-tools-settings");if(ae){const Ae=JSON.parse(ae);Ue(Ae.allowedCommands||[]),nt(Ae.disallowedCommands||[]),pe(Ae.skipPermissions||!1)}else Ue([]),nt([]),pe(!1);await mt(),await Ge()}catch(S){console.error("Error loading tool settings:",S),x([]),y([]),W(!1),R("name")}},ct=()=>{J("claude"),le(n?.[0]||{name:"default",fullPath:process.cwd()}),k(!0)},Lt=()=>{J("cursor"),le(n?.[0]||{name:"default",fullPath:process.cwd()}),k(!0)},Rt=S=>{k(!1)},jt=()=>{D(!0),M(null);try{const S={allowedTools:h,disallowedTools:m,skipPermissions:j,projectSortOrder:_,lastUpdated:new Date().toISOString()},ae={allowedCommands:ye,disallowedCommands:Ye,skipPermissions:me,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(S)),localStorage.setItem("cursor-tools-settings",JSON.stringify(ae)),M("success"),setTimeout(()=>{r()},1e3)}catch(S){console.error("Error saving tool settings:",S),M("error")}finally{D(!1)}},yt=S=>{S&&!h.includes(S)&&(x([...h,S]),E(""))},mr=S=>{x(h.filter(ae=>ae!==S))},ft=S=>{S&&!m.includes(S)&&(y([...m,S]),T(""))},F=S=>{y(m.filter(ae=>ae!==S))},g=()=>{G({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),K(null),b(!1),oe("")},U=(S=null)=>{S?(K(S),G({name:S.name,type:S.type,scope:S.scope,projectPath:S.projectPath||"",config:{...S.config},raw:S.raw,importMode:"form",jsonInput:""})):g(),b(!0)},ce=async S=>{S.preventDefault(),N(!0);try{if(B.importMode==="json"){const ae=localStorage.getItem("auth-token"),Ae=await fetch("/api/mcp/cli/add-json",{method:"POST",headers:{Authorization:`Bearer ${ae}`,"Content-Type":"application/json"},body:JSON.stringify({name:B.name,jsonConfig:B.jsonInput,scope:B.scope,projectPath:B.projectPath})});if(Ae.ok){const We=await Ae.json();if(We.success)await mt(),g(),M("success");else throw new Error(We.error||"Failed to add server via JSON")}else{const We=await Ae.json();throw new Error(We.error||"Failed to add server")}}else await Ze(B),g(),M("success")}catch(ae){alert(`Error: ${ae.message}`),M("error")}finally{N(!1)}},we=async(S,ae)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await st(S,ae),M("success")}catch(Ae){alert(`Error: ${Ae.message}`),M("error")}},V=(S,ae)=>{G(Ae=>({...Ae,config:{...Ae.config,[S]:ae}}))},Ve=S=>{switch(S){case"stdio":return e.jsx(Lr,{className:"w-4 h-4"});case"sse":return e.jsx(Ms,{className:"w-4 h-4"});case"http":return e.jsx(ns,{className:"w-4 h-4"});default:return e.jsx(Wa,{className:"w-4 h-4"})}};return t?e.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[100] md:p-4 bg-background/95",children:[e.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pr,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),e.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:"Settings"})]}),e.jsx(Oe,{variant:"ghost",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:e.jsx(lt,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"border-b border-border",children:e.jsxs("div",{className:"flex px-4 md:px-6",children:[e.jsx("button",{onClick:()=>Be("tools"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="tools"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Tools"}),e.jsx("button",{onClick:()=>Be("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Appearance"}),e.jsx("button",{onClick:()=>Be("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Tasks"})]})}),e.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[Ce==="appearance"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:Ce==="appearance"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"Dark Mode"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Toggle between light and dark themes"})]}),e.jsxs("button",{onClick:a,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":s,"aria-label":"Toggle dark mode",children:[e.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),e.jsx("span",{className:`${s?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:s?e.jsx(No,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(Co,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"Project Sorting"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"How projects are ordered in the sidebar"})]}),e.jsxs("select",{value:_,onChange:S=>R(S.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[e.jsx("option",{value:"name",children:"Alphabetical"}),e.jsx("option",{value:"date",children:"Recent Activity"})]})]})})})]})}),Ce==="tools"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsx("div",{className:"border-b border-gray-300 dark:border-gray-600",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsx("button",{onClick:()=>Ne("claude"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${xe==="claude"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vt,{className:"w-4 h-4"}),e.jsx("span",{children:"Claude"})]})}),e.jsx("button",{onClick:()=>Ne("cursor"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${xe==="cursor"?"border-purple-600 text-purple-600 dark:text-purple-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zt,{className:"w-4 h-4"}),e.jsx("span",{children:"Cursor"})]})})]})}),xe==="claude"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Xr,{className:"w-5 h-5 text-orange-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Permission Settings"})]}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:j,onChange:S=>W(S.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to --dangerously-skip-permissions flag"})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(wn,{className:"w-5 h-5 text-blue-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Authentication"})]}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100",children:"Claude CLI Login"}),e.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:"Sign in to your Claude account to enable AI features"})]}),e.jsxs(Oe,{onClick:ct,className:"bg-blue-600 hover:bg-blue-700 text-white",size:"sm",children:[e.jsx(wn,{className:"w-4 h-4 mr-2"}),"Login"]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ss,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Tools"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tools that are automatically allowed without prompting for permission"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(_t,{value:v,onChange:S=>E(S.target.value),placeholder:'e.g., "Bash(git log:*)" or "Write"',onKeyPress:S=>{S.key==="Enter"&&yt(v)},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),e.jsxs(Oe,{onClick:()=>yt(v),disabled:!v,size:"sm",className:"h-10 px-4 touch-manipulation",children:[e.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:"Add Tool"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common tools:"}),e.jsx("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-2",children:Le.map(S=>e.jsx(Oe,{variant:"outline",size:"sm",onClick:()=>yt(S),disabled:h.includes(S),className:"text-xs h-8 touch-manipulation truncate",children:S},S))})]}),e.jsxs("div",{className:"space-y-2",children:[h.map(S=>e.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:S}),e.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>mr(S),className:"text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",children:e.jsx(lt,{className:"w-4 h-4"})})]},S)),h.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No allowed tools configured"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Xr,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Disallowed Tools"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tools that are automatically blocked without prompting for permission"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(_t,{value:A,onChange:S=>T(S.target.value),placeholder:'e.g., "Bash(rm:*)" or "Write"',onKeyPress:S=>{S.key==="Enter"&&ft(A)},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),e.jsxs(Oe,{onClick:()=>ft(A),disabled:!A,size:"sm",className:"h-10 px-4 touch-manipulation",children:[e.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:"Add Tool"})]})]}),e.jsxs("div",{className:"space-y-2",children:[m.map(S=>e.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:S}),e.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>F(S),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:e.jsx(lt,{className:"w-4 h-4"})})]},S)),m.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No disallowed tools configured"})]})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Tool Pattern Examples:"}),e.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," - Allow all git log commands"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," - Allow all git diff commands"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," - Allow all Write tool usage"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Read"'})," - Allow all Read tool usage"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," - Block all rm commands (dangerous)"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Wa,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"MCP Servers"})]}),e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Model Context Protocol servers provide additional tools and data sources to Claude"})}),e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(Oe,{onClick:()=>U(),className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[e.jsx(Dt,{className:"w-4 h-4 mr-2"}),"Add MCP Server"]})}),e.jsxs("div",{className:"space-y-2",children:[L.map(S=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Ve(S.type),e.jsx("span",{className:"font-medium text-foreground",children:S.name}),e.jsx(br,{variant:"outline",className:"text-xs",children:S.type}),e.jsx(br,{variant:"outline",className:"text-xs",children:S.scope==="local"?"π local":S.scope==="user"?"π€ user":S.scope}),S.projectPath&&e.jsx(br,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20",title:S.projectPath,children:S.projectPath.split("/").pop()})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[S.type==="stdio"&&S.config.command&&e.jsxs("div",{children:["Command: ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:S.config.command})]}),(S.type==="sse"||S.type==="http")&&S.config.url&&e.jsxs("div",{children:["URL: ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:S.config.url})]}),S.config.args&&S.config.args.length>0&&e.jsxs("div",{children:["Args: ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:S.config.args.join(" ")})]}),S.config.env&&Object.keys(S.config.env).length>0&&e.jsxs("div",{children:["Environment: ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(S.config.env).map(([ae,Ae])=>`${ae}=${Ae}`).join(", ")})]}),S.raw&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"View full config"}),e.jsx("pre",{className:"mt-1 text-xs bg-gray-100 dark:bg-gray-800 p-2 rounded overflow-x-auto",children:JSON.stringify(S.raw,null,2)})]})]}),Ie[S.id]&&e.jsxs("div",{className:`mt-2 p-2 rounded text-xs ${Ie[S.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:[e.jsx("div",{className:"font-medium",children:Ie[S.id].message}),Ie[S.id].details&&Ie[S.id].details.length>0&&e.jsx("ul",{className:"mt-1 space-y-0.5",children:Ie[S.id].details.map((ae,Ae)=>e.jsxs("li",{children:["β’ ",ae]},Ae))})]}),f[S.id]&&e.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200 border border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"font-medium mb-2",children:"Available Tools & Resources"}),f[S.id].tools&&f[S.id].tools.length>0&&e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"font-medium text-xs mb-1",children:["Tools (",f[S.id].tools.length,"):"]}),e.jsx("ul",{className:"space-y-0.5",children:f[S.id].tools.map((ae,Ae)=>e.jsxs("li",{className:"flex items-start gap-1",children:[e.jsx("span",{className:"text-blue-400 mt-0.5",children:"β’"}),e.jsxs("div",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:ae.name}),ae.description&&ae.description!=="No description provided"&&e.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",ae.description]})]})]},Ae))})]}),f[S.id].resources&&f[S.id].resources.length>0&&e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"font-medium text-xs mb-1",children:["Resources (",f[S.id].resources.length,"):"]}),e.jsx("ul",{className:"space-y-0.5",children:f[S.id].resources.map((ae,Ae)=>e.jsxs("li",{className:"flex items-start gap-1",children:[e.jsx("span",{className:"text-blue-400 mt-0.5",children:"β’"}),e.jsxs("div",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:ae.name}),ae.description&&ae.description!=="No description provided"&&e.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",ae.description]})]})]},Ae))})]}),f[S.id].prompts&&f[S.id].prompts.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-xs mb-1",children:["Prompts (",f[S.id].prompts.length,"):"]}),e.jsx("ul",{className:"space-y-0.5",children:f[S.id].prompts.map((ae,Ae)=>e.jsxs("li",{className:"flex items-start gap-1",children:[e.jsx("span",{className:"text-blue-400 mt-0.5",children:"β’"}),e.jsxs("div",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:ae.name}),ae.description&&ae.description!=="No description provided"&&e.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",ae.description]})]})]},Ae))})]}),(!f[S.id].tools||f[S.id].tools.length===0)&&(!f[S.id].resources||f[S.id].resources.length===0)&&(!f[S.id].prompts||f[S.id].prompts.length===0)&&e.jsx("div",{className:"text-xs opacity-75",children:"No tools, resources, or prompts discovered"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(Oe,{onClick:()=>U(S),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",title:"Edit server",children:e.jsx(As,{className:"w-4 h-4"})}),e.jsx(Oe,{onClick:()=>we(S.id,S.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",title:"Delete server",children:e.jsx(Xt,{className:"w-4 h-4"})})]})]})},S.id)),L.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No MCP servers configured"})]})]}),I&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:e.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:z?"Edit MCP Server":"Add MCP Server"}),e.jsx(Oe,{variant:"ghost",size:"sm",onClick:g,children:e.jsx(lt,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:ce,className:"p-4 space-y-4",children:[!z&&e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsx("button",{type:"button",onClick:()=>G(S=>({...S,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${B.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"Form Input"}),e.jsx("button",{type:"button",onClick:()=>G(S=>({...S,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${B.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"JSON Import"})]}),B.importMode==="form"&&z&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Scope"}),e.jsxs("div",{className:"flex items-center gap-2",children:[B.scope==="user"?e.jsx(ns,{className:"w-4 h-4"}):e.jsx(yr,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:B.scope==="user"?"User (Global)":"Project (Local)"}),B.scope==="local"&&B.projectPath&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",B.projectPath]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Scope cannot be changed when editing an existing server"})]}),B.importMode==="form"&&!z&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Scope *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>G(S=>({...S,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${B.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(ns,{className:"w-4 h-4"}),e.jsx("span",{children:"User (Global)"})]})}),e.jsx("button",{type:"button",onClick:()=>G(S=>({...S,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${B.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(yr,{className:"w-4 h-4"}),e.jsx("span",{children:"Project (Local)"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:B.scope==="user"?"User scope: Available across all projects on your machine":"Local scope: Only available in the selected project"})]}),B.scope==="local"&&!z&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Project *"}),e.jsxs("select",{value:B.projectPath,onChange:S=>G(ae=>({...ae,projectPath:S.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:B.scope==="local",children:[e.jsx("option",{value:"",children:"Select a project..."}),n.map(S=>e.jsx("option",{value:S.path||S.fullPath,children:S.displayName||S.name},S.name))]}),B.projectPath&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Path: ",B.projectPath]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:B.importMode==="json"?"md:col-span-2":"",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Server Name *"}),e.jsx(_t,{value:B.name,onChange:S=>{G(ae=>({...ae,name:S.target.value}))},placeholder:"my-server",required:!0})]}),B.importMode==="form"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Transport Type *"}),e.jsxs("select",{value:B.type,onChange:S=>{G(ae=>({...ae,type:S.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"sse",children:"SSE"}),e.jsx("option",{value:"http",children:"HTTP"})]})]})]}),z&&B.raw&&B.importMode==="form"&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("h4",{className:"text-sm font-medium text-foreground mb-2",children:["Configuration Details (from ",z.scope==="global"?"~/.claude.json":"project config",")"]}),e.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(B.raw,null,2)})]}),B.importMode==="json"&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"JSON Configuration *"}),e.jsx("textarea",{value:B.jsonInput,onChange:S=>{G(ae=>({...ae,jsonInput:S.target.value}));try{if(S.target.value.trim()){const ae=JSON.parse(S.target.value);ae.type?ae.type==="stdio"&&!ae.command?oe("stdio type requires a command field"):(ae.type==="http"||ae.type==="sse")&&!ae.url?oe(`${ae.type} type requires a url field`):oe(""):oe("Missing required field: type")}}catch{S.target.value.trim()?oe("Invalid JSON format"):oe("")}},className:`w-full px-3 py-2 border ${ee?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
|
|
778
|
+
"type": "stdio",
|
|
779
|
+
"command": "/path/to/server",
|
|
780
|
+
"args": ["--api-key", "abc123"],
|
|
781
|
+
"env": {
|
|
782
|
+
"CACHE_DIR": "/tmp"
|
|
783
|
+
}
|
|
784
|
+
}`,required:!0}),ee&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:ee}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Paste your MCP server configuration in JSON format. Example formats:",e.jsx("br",{}),"β’ stdio: ",'{"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',e.jsx("br",{}),"β’ http/sse: ",'{"type":"http","url":"https://api.example.com/mcp"}']})]})}),B.importMode==="form"&&B.type==="stdio"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Command *"}),e.jsx(_t,{value:B.config.command,onChange:S=>V("command",S.target.value),placeholder:"/path/to/mcp-server",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Arguments (one per line)"}),e.jsx("textarea",{value:Array.isArray(B.config.args)?B.config.args.join(`
|
|
785
|
+
`):"",onChange:S=>V("args",S.target.value.split(`
|
|
786
|
+
`).filter(ae=>ae.trim())),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`--api-key
|
|
787
|
+
abc123`})]})]}),B.importMode==="form"&&(B.type==="sse"||B.type==="http")&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"URL *"}),e.jsx(_t,{value:B.config.url,onChange:S=>V("url",S.target.value),placeholder:"https://api.example.com/mcp",type:"url",required:!0})]}),B.importMode==="form"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Environment Variables (KEY=value, one per line)"}),e.jsx("textarea",{value:Object.entries(B.config.env||{}).map(([S,ae])=>`${S}=${ae}`).join(`
|
|
788
|
+
`),onChange:S=>{const ae={};S.target.value.split(`
|
|
789
|
+
`).forEach(Ae=>{const[We,...at]=Ae.split("=");We&&We.trim()&&(ae[We.trim()]=at.join("=").trim())}),V("env",ae)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`API_KEY=your-key
|
|
790
|
+
DEBUG=true`})]}),B.importMode==="form"&&(B.type==="sse"||B.type==="http")&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Headers (KEY=value, one per line)"}),e.jsx("textarea",{value:Object.entries(B.config.headers||{}).map(([S,ae])=>`${S}=${ae}`).join(`
|
|
791
|
+
`),onChange:S=>{const ae={};S.target.value.split(`
|
|
792
|
+
`).forEach(Ae=>{const[We,...at]=Ae.split("=");We&&We.trim()&&(ae[We.trim()]=at.join("=").trim())}),V("headers",ae)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`Authorization=Bearer token
|
|
793
|
+
X-API-Key=your-key`})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Oe,{type:"button",variant:"outline",onClick:g,children:"Cancel"}),e.jsx(Oe,{type:"submit",disabled:ie,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:ie?"Saving...":z?"Update Server":"Add Server"})]})]})]})})]}),xe==="cursor"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Xr,{className:"w-5 h-5 text-orange-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Cursor Permission Settings"})]}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:me,onChange:S=>pe(S.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to -f flag in Cursor CLI"})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(wn,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Authentication"})]}),e.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-purple-900 dark:text-purple-100",children:"Cursor CLI Login"}),e.jsx("div",{className:"text-sm text-purple-700 dark:text-purple-300",children:"Sign in to your Cursor account to enable AI features"})]}),e.jsxs(Oe,{onClick:Lt,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[e.jsx(wn,{className:"w-4 h-4 mr-2"}),"Login"]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ss,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Shell Commands"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that are automatically allowed without prompting for permission"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(_t,{value:Me,onChange:S=>et(S.target.value),placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',onKeyPress:S=>{S.key==="Enter"&&Me&&!ye.includes(Me)&&(Ue([...ye,Me]),et(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),e.jsxs(Oe,{onClick:()=>{Me&&!ye.includes(Me)&&(Ue([...ye,Me]),et(""))},disabled:!Me,size:"sm",className:"h-10 px-4 touch-manipulation",children:[e.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common commands:"}),e.jsx("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-2",children:De.map(S=>e.jsx(Oe,{variant:"outline",size:"sm",onClick:()=>{ye.includes(S)||Ue([...ye,S])},disabled:ye.includes(S),className:"text-xs h-8 touch-manipulation truncate",children:S},S))})]}),e.jsxs("div",{className:"space-y-2",children:[ye.map(S=>e.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:S}),e.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>Ue(ye.filter(ae=>ae!==S)),className:"text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",children:e.jsx(lt,{className:"w-4 h-4"})})]},S)),ye.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No allowed shell commands configured"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ss,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Disallowed Shell Commands"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that should always be denied"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(_t,{value:it,onChange:S=>ge(S.target.value),placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',onKeyPress:S=>{S.key==="Enter"&&it&&!Ye.includes(it)&&(nt([...Ye,it]),ge(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),e.jsxs(Oe,{onClick:()=>{it&&!Ye.includes(it)&&(nt([...Ye,it]),ge(""))},disabled:!it,size:"sm",className:"h-10 px-4 touch-manipulation",children:[e.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),e.jsxs("div",{className:"space-y-2",children:[Ye.map(S=>e.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:S}),e.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>nt(Ye.filter(ae=>ae!==S)),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:e.jsx(lt,{className:"w-4 h-4"})})]},S)),Ye.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No disallowed shell commands configured"})]})]}),e.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:"Cursor Shell Command Examples:"}),e.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," - Allow ls command"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," - Allow git status command"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(mkdir)"'})," - Allow mkdir command"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"-f"'})," flag - Skip all permission prompts (dangerous)"]})]})]})]})]}),Ce==="tasks"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:u?e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking TaskMaster installation..."})]})}):e.jsxs(e.Fragment,{children:[!l&&e.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:"TaskMaster AI CLI Not Installed"}),e.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[e.jsx("p",{children:"TaskMaster CLI is required to use task management features. Install it to get started:"}),e.jsxs("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:[e.jsx("code",{children:"npm install -g task-master-ai"}),e.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"After installation:"}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[e.jsx("li",{children:"Restart this application"}),e.jsx("li",{children:"TaskMaster features will automatically become available"}),e.jsxs("li",{children:["Use ",e.jsx("code",{className:"bg-orange-100 dark:bg-orange-800 px-1 rounded",children:"task-master init"})," in your project directory"]})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"Enable TaskMaster Integration"}),e.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:"Show TaskMaster tasks, banners, and sidebar indicators across the interface"}),!l&&e.jsx("div",{className:"text-xs text-orange-600 dark:text-orange-400 mt-1",children:"TaskMaster CLI must be installed first"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:S=>o(S.target.checked),disabled:!l,className:"sr-only peer"}),e.jsx("div",{className:`w-11 h-6 ${l?"bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800":"bg-gray-300 dark:bg-gray-600"} rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600`})]})]})}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx(Ms,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"π― About TaskMaster AI"}),e.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks with AI assistance"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"PRD:"})," Generate structured tasks from Product Requirements Documents"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Progress Visualization:"})," Kanban boards, and detailed task views"]})]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-blue-200 dark:border-blue-700",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-6 h-6 bg-blue-100 dark:bg-blue-800 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-3 h-3 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"π Learn More & Tutorial"}),e.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[e.jsxs("p",{children:["TaskMaster AI (aka ",e.jsx("strong",{children:"claude-task-master"})," ) is an advanced AI-powered task management system built for developers."]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Find documentation, setup guides, and examples for advanced TaskMaster workflows"})]})]})]})]})})]})})]})]})})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[e.jsxs("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:[q==="success"&&e.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Settings saved successfully!"]}),q==="error"&&e.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),"Failed to save settings"]})]}),e.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[e.jsx(Oe,{variant:"outline",onClick:r,disabled:Z,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"Cancel"}),e.jsx(Oe,{onClick:jt,disabled:Z,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:Z?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),"Saving..."]}):"Save Settings"})]})]})]}),ke&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 max-md:items-stretch max-md:justify-stretch",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:P==="claude"?"Claude CLI Login":"Cursor CLI Login"}),e.jsx("button",{onClick:()=>k(!1),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(lt,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(zl,{project:se,command:P==="claude"?"claude /login":"cursor-agent login",onComplete:Rt,showHeader:!1})})]})})]}):null}function Rf(){const{isDarkMode:t,toggleDarkMode:r}=va();return e.jsxs("button",{onClick:r,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":t,"aria-label":"Toggle dark mode",children:[e.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),e.jsx("span",{className:`${t?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:t?e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})}):e.jsx("svg",{className:"w-3.5 h-3.5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})})]})}const zf=({isOpen:t,onToggle:r,autoExpandTools:n,onAutoExpandChange:s,showRawParameters:a,onShowRawParametersChange:i,showThinking:o,onShowThinkingChange:l,autoScrollToBottom:d,onAutoScrollChange:c,sendByCtrlEnter:u,onSendByCtrlEnterChange:h,isMobile:x})=>{const[m,y]=p.useState(t),[v,E]=p.useState(()=>localStorage.getItem("whisperMode")||"default"),{isDarkMode:A}=va();p.useEffect(()=>{y(t)},[t]);const T=()=>{const j=!m;y(j),r(j)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`fixed ${x?"bottom-44":"top-1/2 -translate-y-1/2"} ${m?"right-64":"right-0"} z-50 transition-all duration-150 ease-out`,children:e.jsx("button",{onClick:T,className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-l-md p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-lg","aria-label":m?"Close settings panel":"Open settings panel",children:m?e.jsx(cr,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):e.jsx(jd,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}),e.jsx("div",{className:`fixed top-0 right-0 h-full w-64 bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl transform transition-transform duration-150 ease-out z-40 ${m?"translate-x-0":"translate-x-full"} ${x?"h-screen":""}`,children:e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:e.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(Pu,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),"Quick Settings"]})}),e.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-6 bg-white dark:bg-gray-900 ${x?"pb-20":""}`,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Appearance"}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[A?e.jsx(No,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):e.jsx(Co,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Dark Mode"]}),e.jsx(Rf,{})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Tool Display"}),e.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e.jsx(na,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-expand tools"]}),e.jsx("input",{type:"checkbox",checked:n,onChange:j=>s(j.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]}),e.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e.jsx(cn,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show raw parameters"]}),e.jsx("input",{type:"checkbox",checked:a,onChange:j=>i(j.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]}),e.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e.jsx(vo,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show thinking"]}),e.jsx("input",{type:"checkbox",checked:o,onChange:j=>l(j.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"View Options"}),e.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e.jsx(ko,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-scroll to bottom"]}),e.jsx("input",{type:"checkbox",checked:d,onChange:j=>c(j.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Input Settings"}),e.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e.jsx(lu,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Send by Ctrl+Enter"]}),e.jsx("input",{type:"checkbox",checked:u,onChange:j=>h(j.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-3",children:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends."})]}),e.jsxs("div",{className:"space-y-2",style:{display:"none"},children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Whisper Dictation"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsx("input",{type:"radio",name:"whisperMode",value:"default",checked:v==="default",onChange:()=>{E("default"),localStorage.setItem("whisperMode","default"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),e.jsxs("div",{className:"ml-3 flex-1",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[e.jsx(Tn,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Default Mode"]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Direct transcription of your speech"})]})]}),e.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsx("input",{type:"radio",name:"whisperMode",value:"prompt",checked:v==="prompt",onChange:()=>{E("prompt"),localStorage.setItem("whisperMode","prompt"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),e.jsxs("div",{className:"ml-3 flex-1",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[e.jsx(kr,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Prompt Enhancement"]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Transform rough ideas into clear, detailed AI prompts"})]})]}),e.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsx("input",{type:"radio",name:"whisperMode",value:"vibe",checked:v==="vibe"||v==="instructions"||v==="architect",onChange:()=>{E("vibe"),localStorage.setItem("whisperMode","vibe"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),e.jsxs("div",{className:"ml-3 flex-1",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[e.jsx(Ct,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Vibe Mode"]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Format ideas as clear agent instructions with details"})]})]})]})]})]})]})}),m&&e.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-30 transition-opacity duration-150 ease-out",onClick:T})]})},_f=()=>{const[t,r]=p.useState(""),[n,s]=p.useState(""),[a,i]=p.useState(""),[o,l]=p.useState(!1),[d,c]=p.useState(""),{register:u}=Wn(),h=async x=>{if(x.preventDefault(),c(""),n!==a){c("Passwords do not match");return}if(t.length<3){c("Username must be at least 3 characters long");return}if(n.length<6){c("Password must be at least 6 characters long");return}l(!0);const m=await u(t,n);m.success||c(m.error),l(!1)};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Vt,{size:64})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome to Claude Code UI"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Set up your account to get started"})]}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),e.jsx("input",{type:"text",id:"username",value:t,onChange:x=>r(x.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:o})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),e.jsx("input",{type:"password",id:"password",value:n,onChange:x=>s(x.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:o})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),e.jsx("input",{type:"password",id:"confirmPassword",value:a,onChange:x=>i(x.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:o})]}),d&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),e.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:o?"Setting up...":"Create Account"})]}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a single-user system. Only one account can be created."})})]})})})},Ff=()=>{const[t,r]=p.useState(""),[n,s]=p.useState(""),[a,i]=p.useState(!1),[o,l]=p.useState(""),{login:d}=Wn(),c=async u=>{if(u.preventDefault(),l(""),!t||!n){l("Please enter both username and password");return}i(!0);const h=await d(t,n);h.success||l(h.error),i(!1)};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:e.jsx(nn,{className:"w-8 h-8 text-primary-foreground"})})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome Back"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign in to your Claude Code UI account"})]}),e.jsxs("form",{onSubmit:c,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),e.jsx("input",{type:"text",id:"username",value:t,onChange:u=>r(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:a})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),e.jsx("input",{type:"password",id:"password",value:n,onChange:u=>s(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:a})]}),o&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),e.jsx("button",{type:"submit",disabled:a,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"Signing in...":"Sign In"})]}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to access Claude Code UI"})})]})})})},$f=()=>e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:e.jsx(nn,{className:"w-8 h-8 text-primary-foreground"})})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Claude Code UI"}),e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Loading..."})]})}),Of=({children:t})=>{const{user:r,isLoading:n,needsSetup:s}=Wn();return n?e.jsx($f,{}):s?e.jsx(_f,{}):r?t:e.jsx(Ff,{})},eo="1.8.12",Bf=(t,r)=>{const[n,s]=p.useState(!1),[a,i]=p.useState(null);return p.useEffect(()=>{const o=async()=>{try{const c=await(await fetch(`https://api.github.com/repos/${t}/${r}/releases/latest`)).json();if(c.tag_name){const u=c.tag_name.replace(/^v/,"");i(u),s(eo!==u)}else s(!1),i(null)}catch(d){console.error("Version check failed:",d),s(!1),i(null)}};o();const l=setInterval(o,300*1e3);return()=>clearInterval(l)},[t,r]),{updateAvailable:n,latestVersion:a,currentVersion:eo}};function Qr(t,r){const[n,s]=p.useState(()=>{if(typeof window>"u")return r;try{const i=window.localStorage.getItem(t);return i?JSON.parse(i):r}catch(i){return console.log(i),r}});return[n,i=>{if(!(typeof window>"u"))try{const o=i instanceof Function?i(n):i;window.localStorage.setItem(t,JSON.stringify(o)),s(o)}catch(o){console.log(o)}}]}function to(){const t=fc(),{sessionId:r}=bc(),{updateAvailable:n,latestVersion:s,currentVersion:a}=Bf("siteboon","claudecodeui"),[i,o]=p.useState(!1),[l,d]=p.useState([]),[c,u]=p.useState(null),[h,x]=p.useState(null),[m,y]=p.useState("chat"),[v,E]=p.useState(!1),[A,T]=p.useState(!1),[j,W]=p.useState(!0),[Z,D]=p.useState(!1),[q,M]=p.useState(!1),[_,R]=p.useState(!1),[L,C]=Qr("autoExpandTools",!1),[I,b]=Qr("showRawParameters",!1),[z,K]=Qr("showThinking",!0),[B,G]=Qr("autoScrollToBottom",!0),[ie,N]=Qr("sendByCtrlEnter",!1),[Ie,Fe]=p.useState(new Set),[f,te]=p.useState(new Set),[ue,re]=p.useState(0),{ws:Ce,sendMessage:Be,messages:ee}=Ao(),[oe,xe]=p.useState(!1);p.useEffect(()=>{const k=()=>{const P=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");xe(P),P?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return k(),window.matchMedia("(display-mode: standalone)").addEventListener("change",k),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",k)}},[]),p.useEffect(()=>{const k=()=>{E(window.innerWidth<768)};return k(),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[]),p.useEffect(()=>{ye()},[]);const Ne=(k,P,J,se)=>{if(!J||!se)return!0;const le=k?.find(Ze=>Ze.name===J.name),Le=P?.find(Ze=>Ze.name===J.name);if(!le||!Le)return!1;const De=le.sessions?.find(Ze=>Ze.id===se.id),Ge=Le.sessions?.find(Ze=>Ze.id===se.id);return!De||!Ge?!1:De.id===Ge.id&&De.title===Ge.title&&De.created_at===Ge.created_at&&De.updated_at===Ge.updated_at};p.useEffect(()=>{if(ee.length>0){const k=ee[ee.length-1];if(k.type==="projects_updated"){if(k.changedFile&&h&&c){const se=k.changedFile.split("/");if(se.length>=2){const Le=se[se.length-1].replace(".jsonl","");Le===h.id&&(Ie.has(h.id)?console.log("βΈοΈ External update paused - session is active:",Le):(console.log("π External CLI update detected for current session:",Le),re(Ge=>Ge+1)))}}if(h&&Ie.has(h.id)||Ie.size>0&&Array.from(Ie).some(se=>se.startsWith("new-session-"))){const se=k.projects;if(!Ne(l,se,c,h))return}const J=k.projects;if(d(J),c){const se=J.find(le=>le.name===c.name);se&&(JSON.stringify(se)!==JSON.stringify(c)&&u(se),h&&(se.sessions?.find(Le=>Le.id===h.id)||x(null)))}}}},[ee,c,h,Ie]);const ye=async()=>{try{W(!0);const P=await(await Je.projects()).json();for(let J of P)try{const se=`/api/cursor/sessions?projectPath=${encodeURIComponent(J.fullPath||J.path)}`,le=await Re(se);if(le.ok){const Le=await le.json();Le.success&&Le.sessions?J.cursorSessions=Le.sessions:J.cursorSessions=[]}else J.cursorSessions=[]}catch(se){console.error(`Error fetching Cursor sessions for project ${J.name}:`,se),J.cursorSessions=[]}d(J=>J.length===0||P.some((le,Le)=>{const De=J[Le];return De?le.name!==De.name||le.displayName!==De.displayName||le.fullPath!==De.fullPath||JSON.stringify(le.sessionMeta)!==JSON.stringify(De.sessionMeta)||JSON.stringify(le.sessions)!==JSON.stringify(De.sessions)||JSON.stringify(le.cursorSessions)!==JSON.stringify(De.cursorSessions):!0})||P.length!==J.length?P:J)}catch(k){console.error("Error fetching projects:",k)}finally{W(!1)}};window.refreshProjects=ye,p.useEffect(()=>{if(r&&l.length>0){const k=!h||h.id!==r;for(const P of l){let J=P.sessions?.find(le=>le.id===r);if(J){u(P),x({...J,__provider:"claude"}),k&&y("chat");return}const se=P.cursorSessions?.find(le=>le.id===r);if(se){u(P),x({...se,__provider:"cursor"}),k&&y("chat");return}}}},[r,l,t]);const Ue=k=>{u(k),x(null),t("/"),v&&T(!1)},Ye=k=>{if(x(k),m!=="git"&&m!=="preview"&&y("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",k.id),v){const J=k.__projectName,se=c?.name;J!==se&&T(!1)}t(`/session/${k.id}`)},nt=k=>{u(k),x(null),y("chat"),t("/"),v&&T(!1)},me=k=>{h?.id===k&&(x(null),t("/")),d(P=>P.map(J=>({...J,sessions:J.sessions?.filter(se=>se.id!==k)||[],sessionMeta:{...J.sessionMeta,total:Math.max(0,(J.sessionMeta?.total||0)-1)}})))},pe=async()=>{try{const P=await(await Je.projects()).json();if(d(J=>P.some((le,Le)=>{const De=J[Le];return De?le.name!==De.name||le.displayName!==De.displayName||le.fullPath!==De.fullPath||JSON.stringify(le.sessionMeta)!==JSON.stringify(De.sessionMeta)||JSON.stringify(le.sessions)!==JSON.stringify(De.sessions):!0})||P.length!==J.length?P:J),c){const J=P.find(se=>se.name===c.name);if(J&&(JSON.stringify(J)!==JSON.stringify(c)&&u(J),h)){const se=J.sessions?.find(le=>le.id===h.id);se&&JSON.stringify(se)!==JSON.stringify(h)&&x(se)}}}catch(k){console.error("Error refreshing sidebar:",k)}},Me=k=>{c?.name===k&&(u(null),x(null),t("/")),d(P=>P.filter(J=>J.name!==k))},et=k=>{k&&Fe(P=>new Set([...P,k]))},it=k=>{k&&Fe(P=>{const J=new Set(P);return J.delete(k),J})},ge=k=>{k&&te(P=>new Set([...P,k]))},wt=k=>{k&&te(P=>{const J=new Set(P);return J.delete(k),J})},X=k=>{k&&Fe(P=>{const J=new Set;for(const se of P)se.startsWith("new-session-")||J.add(se);return J.add(k),J})},ke=()=>i?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("button",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>o(!1),"aria-label":"Close version upgrade modal"}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-md mx-4 p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center",children:e.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Update Available"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"A new version is ready"})]})]}),e.jsx("button",{onClick:()=>o(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Current Version"}),e.jsx("span",{className:"text-sm text-gray-900 dark:text-white font-mono",children:a})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-700",children:[e.jsx("span",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:"Latest Version"}),e.jsx("span",{className:"text-sm text-blue-900 dark:text-blue-100 font-mono",children:s})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"How to upgrade:"}),e.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-lg p-3 border",children:e.jsx("code",{className:"text-sm text-gray-800 dark:text-gray-200 font-mono",children:"git checkout main && git pull && npm install"})}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Run this command in your Claude Code UI directory to update to the latest version."})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("button",{onClick:()=>o(!1),className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:"Later"}),e.jsx("button",{onClick:()=>{navigator.clipboard.writeText("git checkout main && git pull && npm install"),o(!1)},className:"flex-1 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors",children:"Copy Command"})]})]})]}):null;return e.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!v&&e.jsx("div",{className:"w-80 flex-shrink-0 border-r border-border bg-card",children:e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(Ha,{projects:l,selectedProject:c,selectedSession:h,onProjectSelect:Ue,onSessionSelect:Ye,onNewSession:nt,onSessionDelete:me,onProjectDelete:Me,isLoading:j,onRefresh:pe,onShowSettings:()=>M(!0),updateAvailable:n,latestVersion:s,currentVersion:a,onShowVersionModal:()=>o(!0),isPWA:oe,isMobile:v})})}),v&&e.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${A?"opacity-100 visible":"opacity-0 invisible"}`,children:[e.jsx("button",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:k=>{k.stopPropagation(),T(!1)},onTouchStart:k=>{k.preventDefault(),k.stopPropagation(),T(!1)},"aria-label":"Close sidebar"}),e.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 bg-card border-r border-border transform transition-transform duration-150 ease-out ${A?"translate-x-0":"-translate-x-full"}`,style:{height:"calc(100vh - 80px)"},onClick:k=>k.stopPropagation(),onTouchStart:k=>k.stopPropagation(),children:e.jsx(Ha,{projects:l,selectedProject:c,selectedSession:h,onProjectSelect:Ue,onSessionSelect:Ye,onNewSession:nt,onSessionDelete:me,onProjectDelete:Me,isLoading:j,onRefresh:pe,onShowSettings:()=>M(!0),updateAvailable:n,latestVersion:s,currentVersion:a,onShowVersionModal:()=>o(!0),isPWA:oe,isMobile:v})})]}),e.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${v&&!Z?"pb-16":""}`,children:e.jsx(Tf,{selectedProject:c,selectedSession:h,activeTab:m,setActiveTab:y,ws:Ce,sendMessage:Be,messages:ee,isMobile:v,isPWA:oe,onMenuClick:()=>T(!0),isLoading:j,onInputFocusChange:D,onSessionActive:et,onSessionInactive:it,onSessionProcessing:ge,onSessionNotProcessing:wt,processingSessions:f,onReplaceTemporarySession:X,onNavigateToSession:k=>t(`/session/${k}`),onShowSettings:()=>M(!0),autoExpandTools:L,showRawParameters:I,showThinking:z,autoScrollToBottom:B,sendByCtrlEnter:ie,externalMessageUpdate:ue})}),v&&e.jsx(Df,{activeTab:m,setActiveTab:y,isInputFocused:Z}),m==="chat"&&e.jsx(zf,{isOpen:_,onToggle:R,autoExpandTools:L,onAutoExpandChange:C,showRawParameters:I,onShowRawParametersChange:b,showThinking:z,onShowThinkingChange:K,autoScrollToBottom:B,onAutoScrollChange:G,sendByCtrlEnter:ie,onSendByCtrlEnterChange:N,isMobile:v}),e.jsx(Lf,{isOpen:q,onClose:()=>M(!1),projects:l}),e.jsx(ke,{})]})}function Uf(){return e.jsx(Pf,{children:e.jsx(Zu,{children:e.jsx(tm,{children:e.jsx(nm,{children:e.jsx(rm,{children:e.jsx(Of,{children:e.jsx(xc,{children:e.jsxs(gc,{children:[e.jsx(Ta,{path:"/",element:e.jsx(to,{})}),e.jsx(Ta,{path:"/session/:sessionId",element:e.jsx(to,{})})]})})})})})})})})}"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(r=>{r.unregister()})}).catch(t=>{console.warn("Failed to unregister service workers:",t)});Sc.createRoot(document.getElementById("root")).render(e.jsx(lr.StrictMode,{children:e.jsx(Uf,{})}));
|